Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_wildcardfqdn_group.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_wildcardfqdn_group
15 short_description: Config global Wildcard FQDN address groups.
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 firewall_wildcardfqdn_group:
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: raw
41 description: (list or str) Address group members.
42 name:
43 type: str
44 description: Address group name.
45 required: true
46 uuid:
47 type: str
48 description: Universally Unique Identifier
49 visibility:
50 type: str
51 description: Enable/disable address visibility.
52 choices: ['disable', 'enable']
53 '''
54
55 EXAMPLES = '''
56 - name: Example playbook
57 hosts: fortimanagers
58 gather_facts: false
59 connection: httpapi
60 vars:
61 ansible_httpapi_use_ssl: true
62 ansible_httpapi_validate_certs: false
63 ansible_httpapi_port: 443
64 tasks:
65 - name: Config global Wildcard FQDN address groups.
66 fortinet.fortimanager.fmgr_firewall_wildcardfqdn_group:
67 bypass_validation: false
68 adom: ansible
69 state: present
70 firewall_wildcardfqdn_group:
71 color: 1
72 comment: "ansible-comment"
73 member: "ansible-test"
74 name: "ansible-test-fqdn-grp"
75
76 - name: Gathering fortimanager facts
77 hosts: fortimanagers
78 gather_facts: false
79 connection: httpapi
80 vars:
81 ansible_httpapi_use_ssl: true
82 ansible_httpapi_validate_certs: false
83 ansible_httpapi_port: 443
84 tasks:
85 - name: Retrieve all the global Wildcard FQDN address groups
86 fortinet.fortimanager.fmgr_fact:
87 facts:
88 selector: "firewall_wildcardfqdn_group"
89 params:
90 adom: "ansible"
91 group: "your_value"
92 '''
93
94 RETURN = '''
95 meta:
96 description: The result of the request.
97 type: dict
98 returned: always
99 contains:
100 request_url:
101 description: The full url requested.
102 returned: always
103 type: str
104 sample: /sys/login/user
105 response_code:
106 description: The status of api request.
107 returned: always
108 type: int
109 sample: 0
110 response_data:
111 description: The api response.
112 type: list
113 returned: always
114 response_message:
115 description: The descriptive message of the api response.
116 type: str
117 returned: always
118 sample: OK.
119 system_information:
120 description: The information of the target system.
121 type: dict
122 returned: always
123 rc:
124 description: The status the request.
125 type: int
126 returned: always
127 sample: 0
128 version_check_warning:
129 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
130 type: list
131 returned: complex
132 '''
133 from ansible.module_utils.basic import AnsibleModule
134 from ansible.module_utils.connection import Connection
135 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
136 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
137
138
139 def main():
140 urls_list = [
141 '/pm/config/adom/{adom}/obj/firewall/wildcard-fqdn/group',
142 '/pm/config/global/obj/firewall/wildcard-fqdn/group'
143 ]
144 module_arg_spec = {
145 'adom': {'required': True, 'type': 'str'},
146 'revision_note': {'type': 'str'},
147 'firewall_wildcardfqdn_group': {
148 'type': 'dict', 'v_range': [['6.0.0', '']],
149 'options': {
150 'color': {'type': 'int'},
151 'comment': {'type': 'str'},
152 'member': {'type': 'raw'},
153 'name': {'required': True, 'type': 'str'},
154 'uuid': {'type': 'str'},
155 'visibility': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'}
156 }
157 }
158 }
159
160 module_option_spec = get_module_arg_spec('full crud')
161 module_arg_spec.update(module_option_spec)
162 check_galaxy_version(module_arg_spec)
163 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_wildcardfqdn_group'),
164 supports_check_mode=True)
165 if not module._socket_path:
166 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
167 connection = Connection(module._socket_path)
168 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
169 'name', 'data', module, connection)
170 fmgr.process_crud()
171 module.exit_json(meta=module.params)
172
173
174 if __name__ == '__main__':
175 main()