Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_dynamic_address_dynamicaddrmapping.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_address_dynamicaddrmapping
15 short_description: Dynamic address dynamic addr 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 address:
29 description: The parameter (address) in requested url.
30 type: str
31 required: true
32 dynamic_address_dynamicaddrmapping:
33 description: The top level parameters set.
34 required: false
35 type: dict
36 suboptions:
37 addr:
38 type: str
39 description: Addr.
40 id:
41 type: int
42 description: Id.
43 required: true
44 '''
45
46 EXAMPLES = '''
47 - name: Example playbook (generated based on argument schema)
48 hosts: fortimanagers
49 connection: httpapi
50 gather_facts: false
51 tasks:
52 - name: Dynamic address dynamic addr mapping
53 fortinet.fortimanager.fmgr_dynamic_address_dynamicaddrmapping:
54 # workspace_locking_adom: <global or your adom name>
55 adom: <your own value>
56 address: <your own value>
57 state: present # <value in [present, absent]>
58 dynamic_address_dynamicaddrmapping:
59 id: 0 # Required variable, integer
60 # addr: <string>
61 '''
62
63 RETURN = '''
64 meta:
65 description: The result of the request.
66 type: dict
67 returned: always
68 contains:
69 request_url:
70 description: The full url requested.
71 returned: always
72 type: str
73 sample: /sys/login/user
74 response_code:
75 description: The status of api request.
76 returned: always
77 type: int
78 sample: 0
79 response_data:
80 description: The api response.
81 type: list
82 returned: always
83 response_message:
84 description: The descriptive message of the api response.
85 type: str
86 returned: always
87 sample: OK.
88 system_information:
89 description: The information of the target system.
90 type: dict
91 returned: always
92 rc:
93 description: The status the request.
94 type: int
95 returned: always
96 sample: 0
97 version_check_warning:
98 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
99 type: list
100 returned: complex
101 '''
102 from ansible.module_utils.basic import AnsibleModule
103 from ansible.module_utils.connection import Connection
104 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
105 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
106
107
108 def main():
109 urls_list = [
110 '/pm/config/adom/{adom}/obj/dynamic/address/{address}/dynamic_addr_mapping',
111 '/pm/config/global/obj/dynamic/address/{address}/dynamic_addr_mapping'
112 ]
113 module_arg_spec = {
114 'adom': {'required': True, 'type': 'str'},
115 'address': {'required': True, 'type': 'str'},
116 'revision_note': {'type': 'str'},
117 'dynamic_address_dynamicaddrmapping': {
118 'type': 'dict', 'v_range': [['6.0.0', '']],
119 'options': {'addr': {'type': 'str'}, 'id': {'required': True, 'type': 'int'}}
120 }
121 }
122
123 module_option_spec = get_module_arg_spec('full crud')
124 module_arg_spec.update(module_option_spec)
125 check_galaxy_version(module_arg_spec)
126 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'dynamic_address_dynamicaddrmapping'),
127 supports_check_mode=True)
128 if not module._socket_path:
129 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
130 connection = Connection(module._socket_path)
131 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
132 'id', 'data', module, connection)
133 fmgr.process_crud()
134 module.exit_json(meta=module.params)
135
136
137 if __name__ == '__main__':
138 main()