Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_dynamic_interface_dynamicmapping.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_dynamic_interface_dynamicmapping
15 short_description: Dynamic interface dynamic mapping
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 interface:
29 description: The parameter (interface) in requested url.
30 type: str
31 required: true
32 dynamic_interface_dynamicmapping:
33 description: The top level parameters set.
34 required: false
35 type: dict
36 suboptions:
37 _scope:
38 type: list
39 elements: dict
40 description: Scope.
41 suboptions:
42 name:
43 type: str
44 description: Name.
45 vdom:
46 type: str
47 description: Vdom.
48 egress_shaping_profile:
49 aliases: ['egress-shaping-profile']
50 type: raw
51 description: (list or str) Egress shaping profile.
52 intrazone_deny:
53 aliases: ['intrazone-deny']
54 type: str
55 description: Intrazone deny.
56 choices: ['disable', 'enable']
57 local_intf:
58 aliases: ['local-intf']
59 type: raw
60 description: (list) Local intf.
61 ingress_shaping_profile:
62 aliases: ['ingress-shaping-profile']
63 type: raw
64 description: (list or str) Ingress shaping profile.
65 '''
66
67 EXAMPLES = '''
68 - name: Example playbook (generated based on argument schema)
69 hosts: fortimanagers
70 connection: httpapi
71 gather_facts: false
72 tasks:
73 - name: Dynamic interface dynamic mapping
74 fortinet.fortimanager.fmgr_dynamic_interface_dynamicmapping:
75 # workspace_locking_adom: <global or your adom name>
76 adom: <your own value>
77 interface: <your own value>
78 state: present # <value in [present, absent]>
79 dynamic_interface_dynamicmapping:
80 _scope: # Required variable, list of device
81 - name: <string>
82 vdom: <string>
83 # egress_shaping_profile: <list or string>
84 # intrazone_deny: <value in [disable, enable]>
85 # local_intf: <list or string>
86 # ingress_shaping_profile: <list or string>
87 '''
88
89 RETURN = '''
90 meta:
91 description: The result of the request.
92 type: dict
93 returned: always
94 contains:
95 request_url:
96 description: The full url requested.
97 returned: always
98 type: str
99 sample: /sys/login/user
100 response_code:
101 description: The status of api request.
102 returned: always
103 type: int
104 sample: 0
105 response_data:
106 description: The api response.
107 type: list
108 returned: always
109 response_message:
110 description: The descriptive message of the api response.
111 type: str
112 returned: always
113 sample: OK.
114 system_information:
115 description: The information of the target system.
116 type: dict
117 returned: always
118 rc:
119 description: The status the request.
120 type: int
121 returned: always
122 sample: 0
123 version_check_warning:
124 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
125 type: list
126 returned: complex
127 '''
128 from ansible.module_utils.basic import AnsibleModule
129 from ansible.module_utils.connection import Connection
130 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
131 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
132
133
134 def main():
135 urls_list = [
136 '/pm/config/adom/{adom}/obj/dynamic/interface/{interface}/dynamic_mapping',
137 '/pm/config/global/obj/dynamic/interface/{interface}/dynamic_mapping'
138 ]
139 module_arg_spec = {
140 'adom': {'required': True, 'type': 'str'},
141 'interface': {'required': True, 'type': 'str'},
142 'revision_note': {'type': 'str'},
143 'dynamic_interface_dynamicmapping': {
144 'type': 'dict', 'v_range': [['6.0.0', '']],
145 'options': {
146 '_scope': {'type': 'list', 'options': {'name': {'type': 'str'}, 'vdom': {'type': 'str'}}, 'elements': 'dict'},
147 'egress-shaping-profile': {'type': 'raw'},
148 'intrazone-deny': {'choices': ['disable', 'enable'], 'type': 'str'},
149 'local-intf': {'type': 'raw'},
150 'ingress-shaping-profile': {'v_range': [['6.2.2', '']], 'type': 'raw'}
151 }
152 }
153 }
154
155 module_option_spec = get_module_arg_spec('full crud')
156 module_arg_spec.update(module_option_spec)
157 check_galaxy_version(module_arg_spec)
158 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'dynamic_interface_dynamicmapping'),
159 supports_check_mode=True)
160 if not module._socket_path:
161 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
162 connection = Connection(module._socket_path)
163 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
164 'complex:{{module}}["_scope"][0]["name"]+"/"+{{module}}["_scope"][0]["vdom"]', 'data', module, connection)
165 fmgr.process_crud()
166 module.exit_json(meta=module.params)
167
168
169 if __name__ == '__main__':
170 main()