Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_application_internetservicecustom_disableentry.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_application_internetservicecustom_disableentry
15 short_description: Disable entries in the Internet service database.
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 internet-service-custom:
29 description: Deprecated, please use "internet_service_custom"
30 type: str
31 internet_service_custom:
32 description: The parameter (internet-service-custom) in requested url.
33 type: str
34 application_internetservicecustom_disableentry:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 id:
40 type: int
41 description: Disable entry ID.
42 required: true
43 ip_range:
44 aliases: ['ip-range']
45 type: list
46 elements: dict
47 description: Ip range.
48 suboptions:
49 end_ip:
50 aliases: ['end-ip']
51 type: str
52 description: End IP address.
53 id:
54 type: int
55 description: Disable entry range ID.
56 start_ip:
57 aliases: ['start-ip']
58 type: str
59 description: Start IP address.
60 port:
61 type: raw
62 description: (list) Port.
63 protocol:
64 type: int
65 description: Protocol number.
66 '''
67
68 EXAMPLES = '''
69 - name: Example playbook (generated based on argument schema)
70 hosts: fortimanagers
71 connection: httpapi
72 gather_facts: false
73 tasks:
74 - name: Disable entries in the Internet service database.
75 fortinet.fortimanager.fmgr_application_internetservicecustom_disableentry:
76 # workspace_locking_adom: <global or your adom name>
77 adom: <your own value>
78 internet_service_custom: <your own value>
79 state: present # <value in [present, absent]>
80 application_internetservicecustom_disableentry:
81 id: 0 # Required variable, integer
82 # ip_range:
83 # - end_ip: <string>
84 # id: <integer>
85 # start_ip: <string>
86 # port: <list or integer>
87 # protocol: <integer>
88 '''
89
90 RETURN = '''
91 meta:
92 description: The result of the request.
93 type: dict
94 returned: always
95 contains:
96 request_url:
97 description: The full url requested.
98 returned: always
99 type: str
100 sample: /sys/login/user
101 response_code:
102 description: The status of api request.
103 returned: always
104 type: int
105 sample: 0
106 response_data:
107 description: The api response.
108 type: list
109 returned: always
110 response_message:
111 description: The descriptive message of the api response.
112 type: str
113 returned: always
114 sample: OK.
115 system_information:
116 description: The information of the target system.
117 type: dict
118 returned: always
119 rc:
120 description: The status the request.
121 type: int
122 returned: always
123 sample: 0
124 version_check_warning:
125 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
126 type: list
127 returned: complex
128 '''
129 from ansible.module_utils.basic import AnsibleModule
130 from ansible.module_utils.connection import Connection
131 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
132 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
133
134
135 def main():
136 urls_list = [
137 '/pm/config/adom/{adom}/obj/application/internet-service-custom/{internet-service-custom}/disable-entry',
138 '/pm/config/global/obj/application/internet-service-custom/{internet-service-custom}/disable-entry'
139 ]
140 module_arg_spec = {
141 'adom': {'required': True, 'type': 'str'},
142 'internet-service-custom': {'type': 'str', 'api_name': 'internet_service_custom'},
143 'internet_service_custom': {'type': 'str'},
144 'revision_note': {'type': 'str'},
145 'application_internetservicecustom_disableentry': {
146 'type': 'dict', 'v_range': [['6.2.0', '6.2.13']],
147 'options': {
148 'id': {'v_range': [['6.2.0', '6.2.13']], 'required': True, 'type': 'int'},
149 'ip-range': {
150 'v_range': [['6.2.0', '6.2.13']],
151 'type': 'list',
152 'options': {
153 'end-ip': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
154 'id': {'v_range': [['6.2.0', '6.2.13']], 'type': 'int'},
155 'start-ip': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'}
156 },
157 'elements': 'dict'
158 },
159 'port': {'v_range': [['6.2.0', '6.2.13']], 'type': 'raw'},
160 'protocol': {'v_range': [['6.2.0', '6.2.13']], 'type': 'int'}
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, 'application_internetservicecustom_disableentry'),
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 'id', 'data', module, connection)
175 fmgr.process_crud()
176 module.exit_json(meta=module.params)
177
178
179 if __name__ == '__main__':
180 main()