Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_isolator_profile.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_isolator_profile
15 short_description: Isolator profile
16 version_added: "2.12.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 isolator_profile:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 comments:
34 type: str
35 description: Comments.
36 disclaimer:
37 type: str
38 description: Disclaimer.
39 entries:
40 type: list
41 elements: dict
42 description: Entries.
43 suboptions:
44 action:
45 type: str
46 description: Action.
47 choices: ['isolate', 'freeze', 'block', 'allow']
48 id:
49 type: int
50 description: Id.
51 proxy_address:
52 aliases: ['proxy-address']
53 type: list
54 elements: str
55 description: Proxy address.
56 status:
57 type: str
58 description: Status.
59 choices: ['disable', 'enable']
60 copy_paste:
61 aliases: ['copy-paste']
62 type: str
63 description: Copy paste.
64 choices: ['disable', 'enable']
65 right_click:
66 aliases: ['right-click']
67 type: str
68 description: Right click.
69 choices: ['disable', 'enable']
70 name:
71 type: str
72 description: Name.
73 required: true
74 '''
75
76 EXAMPLES = '''
77 - name: Example playbook (generated based on argument schema)
78 hosts: fortimanagers
79 connection: httpapi
80 gather_facts: false
81 tasks:
82 - name: Isolator profile
83 fortinet.fortimanager.fmgr_isolator_profile:
84 # workspace_locking_adom: <global or your adom name>
85 adom: <your own value>
86 state: present # <value in [present, absent]>
87 isolator_profile:
88 name: "your value" # Required variable, string
89 # comments: <string>
90 # disclaimer: <string>
91 # entries:
92 # - action: <value in [isolate, freeze, block, ...]>
93 # id: <integer>
94 # proxy_address: <list or string>
95 # status: <value in [disable, enable]>
96 # copy_paste: <value in [disable, enable]>
97 # right_click: <value in [disable, enable]>
98 '''
99
100 RETURN = '''
101 meta:
102 description: The result of the request.
103 type: dict
104 returned: always
105 contains:
106 request_url:
107 description: The full url requested.
108 returned: always
109 type: str
110 sample: /sys/login/user
111 response_code:
112 description: The status of api request.
113 returned: always
114 type: int
115 sample: 0
116 response_data:
117 description: The api response.
118 type: list
119 returned: always
120 response_message:
121 description: The descriptive message of the api response.
122 type: str
123 returned: always
124 sample: OK.
125 system_information:
126 description: The information of the target system.
127 type: dict
128 returned: always
129 rc:
130 description: The status the request.
131 type: int
132 returned: always
133 sample: 0
134 version_check_warning:
135 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
136 type: list
137 returned: complex
138 '''
139 from ansible.module_utils.basic import AnsibleModule
140 from ansible.module_utils.connection import Connection
141 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
142 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
143
144
145 def main():
146 urls_list = [
147 '/pm/config/adom/{adom}/obj/isolator/profile',
148 '/pm/config/global/obj/isolator/profile'
149 ]
150 module_arg_spec = {
151 'adom': {'required': True, 'type': 'str'},
152 'revision_note': {'type': 'str'},
153 'isolator_profile': {
154 'type': 'dict', 'v_range': [['7.6.4', '']],
155 'options': {
156 'comments': {'v_range': [['7.6.4', '']], 'type': 'str'},
157 'disclaimer': {'v_range': [['7.6.4', '']], 'type': 'str'},
158 'entries': {
159 'v_range': [['7.6.4', '']],
160 'type': 'list',
161 'options': {
162 'action': {'v_range': [['7.6.4', '']], 'choices': ['isolate', 'freeze', 'block', 'allow'], 'type': 'str'},
163 'id': {'v_range': [['7.6.4', '']], 'type': 'int'},
164 'proxy-address': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
165 'status': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
166 'copy-paste': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
167 'right-click': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
168 },
169 'elements': 'dict'
170 },
171 'name': {'v_range': [['7.6.4', '']], 'required': True, 'type': 'str'}
172 }
173 }
174 }
175
176 module_option_spec = get_module_arg_spec('full crud')
177 module_arg_spec.update(module_option_spec)
178 check_galaxy_version(module_arg_spec)
179 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'isolator_profile'),
180 supports_check_mode=True)
181 if not module._socket_path:
182 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
183 connection = Connection(module._socket_path)
184 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
185 'name', 'data', module, connection)
186 fmgr.process_crud()
187 module.exit_json(meta=module.params)
188
189
190 if __name__ == '__main__':
191 main()