Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_mmsprofile_notifmsisdn.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_mmsprofile_notifmsisdn
15 short_description: Notification for MSISDNs.
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 mms-profile:
29 description: Deprecated, please use "mms_profile"
30 type: str
31 mms_profile:
32 description: The parameter (mms-profile) in requested url.
33 type: str
34 firewall_mmsprofile_notifmsisdn:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 msisdn:
40 type: str
41 description: Recipient MSISDN.
42 required: true
43 threshold:
44 type: list
45 elements: str
46 description: Thresholds on which this MSISDN will receive an alert.
47 choices: ['flood-thresh-1', 'flood-thresh-2', 'flood-thresh-3', 'dupe-thresh-1',
48 'dupe-thresh-2', 'dupe-thresh-3']
49 '''
50
51 EXAMPLES = '''
52 - name: Example playbook
53 hosts: fortimanagers
54 gather_facts: false
55 connection: httpapi
56 vars:
57 ansible_httpapi_use_ssl: true
58 ansible_httpapi_validate_certs: false
59 ansible_httpapi_port: 443
60 tasks:
61 - name: Notification for MSISDNs.
62 fortinet.fortimanager.fmgr_firewall_mmsprofile_notifmsisdn:
63 bypass_validation: false
64 adom: FortiCarrier # This is FOC-only object, need a FortiCarrier adom
65 mms_profile: "ansible-test" # name
66 state: present
67 firewall_mmsprofile_notifmsisdn:
68 msisdn: "ansible"
69 threshold:
70 - flood-thresh-1
71 - flood-thresh-2
72 - flood-thresh-3
73 - dupe-thresh-1
74 - dupe-thresh-2
75 - dupe-thresh-3
76
77 - name: Gathering fortimanager facts
78 hosts: fortimanagers
79 gather_facts: false
80 connection: httpapi
81 vars:
82 ansible_httpapi_use_ssl: true
83 ansible_httpapi_validate_certs: false
84 ansible_httpapi_port: 443
85 tasks:
86 - name: Retrieve all the Notification for MSISDNs
87 fortinet.fortimanager.fmgr_fact:
88 facts:
89 selector: "firewall_mmsprofile_notifmsisdn"
90 params:
91 adom: "FortiCarrier" # This is FOC-only object, need a FortiCarrier adom
92 mms_profile: "ansible-test" # name
93 notif_msisdn: "your_value"
94 '''
95
96 RETURN = '''
97 meta:
98 description: The result of the request.
99 type: dict
100 returned: always
101 contains:
102 request_url:
103 description: The full url requested.
104 returned: always
105 type: str
106 sample: /sys/login/user
107 response_code:
108 description: The status of api request.
109 returned: always
110 type: int
111 sample: 0
112 response_data:
113 description: The api response.
114 type: list
115 returned: always
116 response_message:
117 description: The descriptive message of the api response.
118 type: str
119 returned: always
120 sample: OK.
121 system_information:
122 description: The information of the target system.
123 type: dict
124 returned: always
125 rc:
126 description: The status the request.
127 type: int
128 returned: always
129 sample: 0
130 version_check_warning:
131 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
132 type: list
133 returned: complex
134 '''
135 from ansible.module_utils.basic import AnsibleModule
136 from ansible.module_utils.connection import Connection
137 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
138 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
139
140
141 def main():
142 urls_list = [
143 '/pm/config/adom/{adom}/obj/firewall/mms-profile/{mms-profile}/notif-msisdn',
144 '/pm/config/global/obj/firewall/mms-profile/{mms-profile}/notif-msisdn'
145 ]
146 module_arg_spec = {
147 'adom': {'required': True, 'type': 'str'},
148 'mms-profile': {'type': 'str', 'api_name': 'mms_profile'},
149 'mms_profile': {'type': 'str'},
150 'revision_note': {'type': 'str'},
151 'firewall_mmsprofile_notifmsisdn': {
152 'type': 'dict', 'v_range': [['6.0.0', '7.6.2']],
153 'options': {
154 'msisdn': {'v_range': [['6.0.0', '7.6.2']], 'required': True, 'type': 'str'},
155 'threshold': {
156 'v_range': [['6.0.0', '7.6.2']],
157 'type': 'list',
158 'choices': ['flood-thresh-1', 'flood-thresh-2', 'flood-thresh-3', 'dupe-thresh-1', 'dupe-thresh-2', 'dupe-thresh-3'],
159 'elements': 'str'
160 }
161 }
162 }
163 }
164
165 module_option_spec = get_module_arg_spec('full crud')
166 module_arg_spec.update(module_option_spec)
167 check_galaxy_version(module_arg_spec)
168 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_mmsprofile_notifmsisdn'),
169 supports_check_mode=True)
170 if not module._socket_path:
171 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
172 connection = Connection(module._socket_path)
173 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
174 'msisdn', 'data', module, connection)
175 fmgr.process_crud()
176 module.exit_json(meta=module.params)
177
178
179 if __name__ == '__main__':
180 main()