Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_externalresource_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_system_externalresource_dynamicmapping
15 short_description: System external resource dynamic mapping
16 version_added: "2.14.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_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 external-resource:
29 description: Deprecated, please use "external_resource"
30 type: str
31 external_resource:
32 description: The parameter (external-resource) in requested url.
33 type: str
34 system_externalresource_dynamicmapping:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 _scope:
40 type: list
41 elements: dict
42 description: Scope.
43 suboptions:
44 name:
45 type: str
46 description: Name.
47 vdom:
48 type: str
49 description: Vdom.
50 source_ip:
51 aliases: ['source-ip']
52 type: str
53 description: Source ip.
54 '''
55
56 EXAMPLES = '''
57 - name: Example playbook (generated based on argument schema)
58 hosts: fortimanagers
59 connection: httpapi
60 gather_facts: false
61 tasks:
62 - name: System external resource dynamic mapping
63 fortinet.fortimanager.fmgr_system_externalresource_dynamicmapping:
64 # workspace_locking_adom: <global or your adom name>
65 adom: <your own value>
66 external_resource: <your own value>
67 system_externalresource_dynamicmapping:
68 # _scope:
69 # - name: <string>
70 # vdom: <string>
71 # source_ip: <string>
72 '''
73
74 RETURN = '''
75 meta:
76 description: The result of the request.
77 type: dict
78 returned: always
79 contains:
80 request_url:
81 description: The full url requested.
82 returned: always
83 type: str
84 sample: /sys/login/user
85 response_code:
86 description: The status of api request.
87 returned: always
88 type: int
89 sample: 0
90 response_data:
91 description: The api response.
92 type: list
93 returned: always
94 response_message:
95 description: The descriptive message of the api response.
96 type: str
97 returned: always
98 sample: OK.
99 system_information:
100 description: The information of the target system.
101 type: dict
102 returned: always
103 rc:
104 description: The status the request.
105 type: int
106 returned: always
107 sample: 0
108 version_check_warning:
109 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
110 type: list
111 returned: complex
112 '''
113 from ansible.module_utils.basic import AnsibleModule
114 from ansible.module_utils.connection import Connection
115 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
116 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
117
118
119 def main():
120 urls_list = [
121 '/pm/config/adom/{adom}/obj/system/external-resource/{external-resource}/dynamic_mapping',
122 '/pm/config/global/obj/system/external-resource/{external-resource}/dynamic_mapping'
123 ]
124 module_arg_spec = {
125 'adom': {'required': True, 'type': 'str'},
126 'external-resource': {'type': 'str', 'api_name': 'external_resource'},
127 'external_resource': {'type': 'str'},
128 'revision_note': {'type': 'str'},
129 'system_externalresource_dynamicmapping': {
130 'type': 'dict', 'v_range': [['7.6.2', '']],
131 'options': {
132 '_scope': {
133 'v_range': [['7.6.2', '']],
134 'type': 'list',
135 'options': {'name': {'v_range': [['7.6.2', '']], 'type': 'str'}, 'vdom': {'v_range': [['7.6.2', '']], 'type': 'str'}},
136 'elements': 'dict'
137 },
138 'source-ip': {'v_range': [['7.6.2', '']], 'type': 'str'}
139 }
140 }
141 }
142
143 module_option_spec = get_module_arg_spec('partial crud')
144 module_arg_spec.update(module_option_spec)
145 check_galaxy_version(module_arg_spec)
146 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_externalresource_dynamicmapping'),
147 supports_check_mode=True)
148 if not module._socket_path:
149 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
150 connection = Connection(module._socket_path)
151 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
152 None, 'data', module, connection)
153 fmgr.process_partial_crud()
154 module.exit_json(meta=module.params)
155
156
157 if __name__ == '__main__':
158 main()