Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_internetservice_entry.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_internetservice_entry
15 short_description: Entries in the Internet Service database.
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_internetservice_entry:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 id:
34 type: int
35 description: Entry ID.
36 required: true
37 ip_number:
38 aliases: ['ip-number']
39 type: int
40 description: Total number of IP addresses.
41 ip_range_number:
42 aliases: ['ip-range-number']
43 type: int
44 description: Total number of IP ranges.
45 port:
46 type: raw
47 description: (list) Integer value for the TCP/IP port
48 protocol:
49 type: int
50 description: Integer value for the protocol type as defined by IANA
51 '''
52
53 EXAMPLES = '''
54 - name: Example playbook (generated based on argument schema)
55 hosts: fortimanagers
56 connection: httpapi
57 gather_facts: false
58 tasks:
59 - name: Entries in the Internet Service database.
60 fortinet.fortimanager.fmgr_firewall_internetservice_entry:
61 # workspace_locking_adom: <global or your adom name>
62 adom: <your own value>
63 state: present # <value in [present, absent]>
64 firewall_internetservice_entry:
65 id: 0 # Required variable, integer
66 # ip_number: <integer>
67 # ip_range_number: <integer>
68 # port: <list or integer>
69 # protocol: <integer>
70 '''
71
72 RETURN = '''
73 meta:
74 description: The result of the request.
75 type: dict
76 returned: always
77 contains:
78 request_url:
79 description: The full url requested.
80 returned: always
81 type: str
82 sample: /sys/login/user
83 response_code:
84 description: The status of api request.
85 returned: always
86 type: int
87 sample: 0
88 response_data:
89 description: The api response.
90 type: list
91 returned: always
92 response_message:
93 description: The descriptive message of the api response.
94 type: str
95 returned: always
96 sample: OK.
97 system_information:
98 description: The information of the target system.
99 type: dict
100 returned: always
101 rc:
102 description: The status the request.
103 type: int
104 returned: always
105 sample: 0
106 version_check_warning:
107 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
108 type: list
109 returned: complex
110 '''
111 from ansible.module_utils.basic import AnsibleModule
112 from ansible.module_utils.connection import Connection
113 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
114 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
115
116
117 def main():
118 urls_list = [
119 '/pm/config/adom/{adom}/obj/firewall/internet-service/entry',
120 '/pm/config/global/obj/firewall/internet-service/entry'
121 ]
122 module_arg_spec = {
123 'adom': {'required': True, 'type': 'str'},
124 'revision_note': {'type': 'str'},
125 'firewall_internetservice_entry': {
126 'type': 'dict', 'v_range': [['6.0.0', '7.2.1'], ['7.4.8', '7.4.10']],
127 'options': {
128 'id': {'v_range': [['6.0.0', '7.2.1'], ['7.4.8', '7.4.10']], 'required': True, 'type': 'int'},
129 'ip-number': {'v_range': [['6.0.0', '7.2.1'], ['7.4.8', '7.4.10']], 'type': 'int'},
130 'ip-range-number': {'v_range': [['6.0.0', '7.2.1'], ['7.4.8', '7.4.10']], 'type': 'int'},
131 'port': {'v_range': [['6.0.0', '7.2.1'], ['7.4.8', '7.4.10']], 'type': 'raw'},
132 'protocol': {'v_range': [['6.0.0', '7.2.1'], ['7.4.8', '7.4.10']], 'type': 'int'}
133 }
134 }
135 }
136
137 module_option_spec = get_module_arg_spec('full crud')
138 module_arg_spec.update(module_option_spec)
139 check_galaxy_version(module_arg_spec)
140 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_internetservice_entry'),
141 supports_check_mode=True)
142 if not module._socket_path:
143 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
144 connection = Connection(module._socket_path)
145 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
146 'id', 'data', module, connection)
147 fmgr.process_crud()
148 module.exit_json(meta=module.params)
149
150
151 if __name__ == '__main__':
152 main()