Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_localinpolicy_src.py

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3 # Copyright 2019-2024 Fortinet, Inc.
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 __metaclass__ = type
7
8 ANSIBLE_METADATA = {'status': ['preview'],
9 'supported_by': 'community',
10 'metadata_version': '1.1'}
11
12 DOCUMENTATION = '''
13 ---
14 module: fmgr_system_localinpolicy_src
15 short_description: Cli system local in policy src
16 version_added: "2.12.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 local-in-policy:
22 description: Deprecated, please use "local_in_policy"
23 type: str
24 local_in_policy:
25 description: The parameter (local-in-policy) in requested url.
26 type: str
27 system_localinpolicy_src:
28 description: The top level parameters set.
29 required: false
30 type: dict
31 suboptions:
32 src_ip:
33 aliases: ['src-ip']
34 type: str
35 description: Src ip.
36 '''
37
38 EXAMPLES = '''
39 - name: Example playbook (generated based on argument schema)
40 hosts: fortimanagers
41 connection: httpapi
42 gather_facts: false
43 tasks:
44 - name: Cli system local in policy src
45 fortinet.fortimanager.fmgr_system_localinpolicy_src:
46 # workspace_locking_adom: <global or your adom name>
47 local_in_policy: <your own value>
48 state: present # <value in [present, absent]>
49 system_localinpolicy_src:
50 # src_ip: <string>
51 '''
52
53 RETURN = '''
54 meta:
55 description: The result of the request.
56 type: dict
57 returned: always
58 contains:
59 request_url:
60 description: The full url requested.
61 returned: always
62 type: str
63 sample: /sys/login/user
64 response_code:
65 description: The status of api request.
66 returned: always
67 type: int
68 sample: 0
69 response_data:
70 description: The api response.
71 type: list
72 returned: always
73 response_message:
74 description: The descriptive message of the api response.
75 type: str
76 returned: always
77 sample: OK.
78 system_information:
79 description: The information of the target system.
80 type: dict
81 returned: always
82 rc:
83 description: The status the request.
84 type: int
85 returned: always
86 sample: 0
87 version_check_warning:
88 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
89 type: list
90 returned: complex
91 '''
92 from ansible.module_utils.basic import AnsibleModule
93 from ansible.module_utils.connection import Connection
94 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
95 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
96
97
98 def main():
99 urls_list = [
100 '/cli/global/system/local-in-policy/{local-in-policy}/src'
101 ]
102 module_arg_spec = {
103 'local-in-policy': {'type': 'str', 'api_name': 'local_in_policy'},
104 'local_in_policy': {'type': 'str'},
105 'system_localinpolicy_src': {
106 'type': 'dict', 'v_range': [['7.6.4', '']],
107 'options': {'src-ip': {'v_range': [['7.6.4', '']], 'type': 'str'}}
108 }
109 }
110
111 module_option_spec = get_module_arg_spec('full crud')
112 module_arg_spec.update(module_option_spec)
113 check_galaxy_version(module_arg_spec)
114 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_localinpolicy_src'),
115 supports_check_mode=True)
116 if not module._socket_path:
117 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
118 connection = Connection(module._socket_path)
119 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
120 None, 'data', module, connection)
121 fmgr.process_crud()
122 module.exit_json(meta=module.params)
123
124
125 if __name__ == '__main__':
126 main()