Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_fmg_variable_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_fmg_variable_dynamicmapping
15 short_description: Fmg variable dynamic mapping
16 version_added: "2.1.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 variable:
29 description: The parameter (variable) in requested url.
30 type: str
31 required: true
32 fmg_variable_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 value:
49 type: str
50 description: Value.
51 '''
52
53 EXAMPLES = '''
54 - name: Example playbook (generated based on argument schema)
55 hosts: fortimanagers
56 connection: httpapi
57 gather_facts: false
58 tasks:
59 - name: Fmg variable dynamic mapping
60 fortinet.fortimanager.fmgr_fmg_variable_dynamicmapping:
61 # workspace_locking_adom: <global or your adom name>
62 adom: <your own value>
63 variable: <your own value>
64 state: present # <value in [present, absent]>
65 fmg_variable_dynamicmapping:
66 # _scope:
67 # - name: <string>
68 # vdom: <string>
69 # value: <string>
70 '''
71
72 RETURN = '''
73 meta:
74 description: The result of the request.
75 type: dict
76 returned: always
77 contains:
78 request_url:
79 description: The full url requested.
80 returned: always
81 type: str
82 sample: /sys/login/user
83 response_code:
84 description: The status of api request.
85 returned: always
86 type: int
87 sample: 0
88 response_data:
89 description: The api response.
90 type: list
91 returned: always
92 response_message:
93 description: The descriptive message of the api response.
94 type: str
95 returned: always
96 sample: OK.
97 system_information:
98 description: The information of the target system.
99 type: dict
100 returned: always
101 rc:
102 description: The status the request.
103 type: int
104 returned: always
105 sample: 0
106 version_check_warning:
107 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
108 type: list
109 returned: complex
110 '''
111 from ansible.module_utils.basic import AnsibleModule
112 from ansible.module_utils.connection import Connection
113 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
114 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
115
116
117 def main():
118 urls_list = [
119 '/pm/config/adom/{adom}/obj/fmg/variable/{variable}/dynamic_mapping',
120 '/pm/config/global/obj/fmg/variable/{variable}/dynamic_mapping'
121 ]
122 module_arg_spec = {
123 'adom': {'required': True, 'type': 'str'},
124 'variable': {'required': True, 'type': 'str'},
125 'revision_note': {'type': 'str'},
126 'fmg_variable_dynamicmapping': {
127 'type': 'dict', 'v_range': [['7.2.0', '']],
128 'options': {
129 '_scope': {
130 'v_range': [['7.2.0', '']],
131 'type': 'list',
132 'options': {'name': {'v_range': [['7.2.0', '']], 'type': 'str'}, 'vdom': {'v_range': [['7.2.0', '']], 'type': 'str'}},
133 'elements': 'dict'
134 },
135 'value': {'v_range': [['7.2.0', '']], 'type': 'str'}
136 }
137 }
138 }
139
140 module_option_spec = get_module_arg_spec('full crud')
141 module_arg_spec.update(module_option_spec)
142 check_galaxy_version(module_arg_spec)
143 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'fmg_variable_dynamicmapping'),
144 supports_check_mode=True)
145 if not module._socket_path:
146 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
147 connection = Connection(module._socket_path)
148 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
149 None, 'data', module, connection)
150 fmgr.process_crud()
151 module.exit_json(meta=module.params)
152
153
154 if __name__ == '__main__':
155 main()