Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_explicitproxyaddrgrp.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_firewall_explicitproxyaddrgrp
15 short_description: Explicit web proxy address group configuration.
16 version_added: "2.2.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 firewall_explicitproxyaddrgrp:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 color:
34 type: int
35 description: GUI icon color.
36 comment:
37 type: str
38 description: Comment.
39 member:
40 type: str
41 description: Address group members.
42 name:
43 type: str
44 description: Address group name.
45 required: true
46 tags:
47 type: str
48 description: Applied object tags.
49 type:
50 type: str
51 description: Address group type.
52 choices: ['src', 'dst']
53 uuid:
54 type: str
55 description: Universally Unique IDentifier.
56 visibility:
57 type: str
58 description: Enable/disable address visibility.
59 choices: ['disable', 'enable']
60 '''
61
62 EXAMPLES = '''
63 - name: Example playbook (generated based on argument schema)
64 hosts: fortimanagers
65 connection: httpapi
66 gather_facts: false
67 tasks:
68 - name: Explicit web proxy address group configuration.
69 fortinet.fortimanager.fmgr_firewall_explicitproxyaddrgrp:
70 # workspace_locking_adom: <global or your adom name>
71 adom: <your own value>
72 state: present # <value in [present, absent]>
73 firewall_explicitproxyaddrgrp:
74 name: "your value" # Required variable, string
75 # color: <integer>
76 # comment: <string>
77 # member: <string>
78 # tags: <string>
79 # type: <value in [src, dst]>
80 # uuid: <string>
81 # visibility: <value in [disable, enable]>
82 '''
83
84 RETURN = '''
85 meta:
86 description: The result of the request.
87 type: dict
88 returned: always
89 contains:
90 request_url:
91 description: The full url requested.
92 returned: always
93 type: str
94 sample: /sys/login/user
95 response_code:
96 description: The status of api request.
97 returned: always
98 type: int
99 sample: 0
100 response_data:
101 description: The api response.
102 type: list
103 returned: always
104 response_message:
105 description: The descriptive message of the api response.
106 type: str
107 returned: always
108 sample: OK.
109 system_information:
110 description: The information of the target system.
111 type: dict
112 returned: always
113 rc:
114 description: The status the request.
115 type: int
116 returned: always
117 sample: 0
118 version_check_warning:
119 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
120 type: list
121 returned: complex
122 '''
123 from ansible.module_utils.basic import AnsibleModule
124 from ansible.module_utils.connection import Connection
125 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
126 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
127
128
129 def main():
130 urls_list = [
131 '/pm/config/adom/{adom}/obj/firewall/explicit-proxy-addrgrp',
132 '/pm/config/global/obj/firewall/explicit-proxy-addrgrp'
133 ]
134 module_arg_spec = {
135 'adom': {'required': True, 'type': 'str'},
136 'revision_note': {'type': 'str'},
137 'firewall_explicitproxyaddrgrp': {
138 'type': 'dict', 'v_range': [['6.2.0', '6.2.13']],
139 'options': {
140 'color': {'v_range': [['6.2.0', '6.2.13']], 'type': 'int'},
141 'comment': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
142 'member': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
143 'name': {'v_range': [['6.2.0', '6.2.13']], 'required': True, 'type': 'str'},
144 'tags': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
145 'type': {'v_range': [['6.2.0', '6.2.13']], 'choices': ['src', 'dst'], 'type': 'str'},
146 'uuid': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
147 'visibility': {'v_range': [['6.2.0', '6.2.13']], 'choices': ['disable', 'enable'], 'type': 'str'}
148 }
149 }
150 }
151
152 module_option_spec = get_module_arg_spec('full crud')
153 module_arg_spec.update(module_option_spec)
154 check_galaxy_version(module_arg_spec)
155 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_explicitproxyaddrgrp'),
156 supports_check_mode=True)
157 if not module._socket_path:
158 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
159 connection = Connection(module._socket_path)
160 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
161 'name', 'data', module, connection)
162 fmgr.process_crud()
163 module.exit_json(meta=module.params)
164
165
166 if __name__ == '__main__':
167 main()