Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_application_internetservice.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_internetservice
15 short_description: Show Internet service application.
16 version_added: "2.2.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_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 application_internetservice:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 entry:
34 type: list
35 elements: dict
36 description: Entry.
37 suboptions:
38 id:
39 type: int
40 description: Entry ID.
41 ip_number:
42 aliases: ['ip-number']
43 type: int
44 description: Total number of IP addresses.
45 ip_range_number:
46 aliases: ['ip-range-number']
47 type: int
48 description: Total number of IP ranges.
49 port:
50 type: raw
51 description: (list) Port.
52 protocol:
53 type: int
54 description: Protocol number.
55 id:
56 type: int
57 description: Internet service Application ID.
58 name:
59 type: str
60 description: Internet service Application name.
61 offset:
62 type: int
63 description: Offset of Internet service Application ID.
64 reputation:
65 type: int
66 description: Reputation level of the Internet service application.
67 '''
68
69 EXAMPLES = '''
70 - name: Example playbook (generated based on argument schema)
71 hosts: fortimanagers
72 connection: httpapi
73 gather_facts: false
74 tasks:
75 - name: Show Internet service application.
76 fortinet.fortimanager.fmgr_application_internetservice:
77 # workspace_locking_adom: <global or your adom name>
78 adom: <your own value>
79 application_internetservice:
80 # entry:
81 # - id: <integer>
82 # ip_number: <integer>
83 # ip_range_number: <integer>
84 # port: <list or integer>
85 # protocol: <integer>
86 # id: <integer>
87 # name: <string>
88 # offset: <integer>
89 # reputation: <integer>
90 '''
91
92 RETURN = '''
93 meta:
94 description: The result of the request.
95 type: dict
96 returned: always
97 contains:
98 request_url:
99 description: The full url requested.
100 returned: always
101 type: str
102 sample: /sys/login/user
103 response_code:
104 description: The status of api request.
105 returned: always
106 type: int
107 sample: 0
108 response_data:
109 description: The api response.
110 type: list
111 returned: always
112 response_message:
113 description: The descriptive message of the api response.
114 type: str
115 returned: always
116 sample: OK.
117 system_information:
118 description: The information of the target system.
119 type: dict
120 returned: always
121 rc:
122 description: The status the request.
123 type: int
124 returned: always
125 sample: 0
126 version_check_warning:
127 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
128 type: list
129 returned: complex
130 '''
131 from ansible.module_utils.basic import AnsibleModule
132 from ansible.module_utils.connection import Connection
133 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
134 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
135
136
137 def main():
138 urls_list = [
139 '/pm/config/adom/{adom}/obj/application/internet-service',
140 '/pm/config/global/obj/application/internet-service'
141 ]
142 module_arg_spec = {
143 'adom': {'required': True, 'type': 'str'},
144 'revision_note': {'type': 'str'},
145 'application_internetservice': {
146 'type': 'dict', 'v_range': [['6.2.0', '6.2.13']],
147 'options': {
148 'entry': {
149 'v_range': [['6.2.0', '6.2.13']],
150 'type': 'list',
151 'options': {
152 'id': {'v_range': [['6.2.0', '6.2.13']], 'type': 'int'},
153 'ip-number': {'v_range': [['6.2.0', '6.2.13']], 'type': 'int'},
154 'ip-range-number': {'v_range': [['6.2.0', '6.2.13']], 'type': 'int'},
155 'port': {'v_range': [['6.2.0', '6.2.13']], 'type': 'raw'},
156 'protocol': {'v_range': [['6.2.0', '6.2.13']], 'type': 'int'}
157 },
158 'elements': 'dict'
159 },
160 'id': {'v_range': [['6.2.0', '6.2.13']], 'type': 'int'},
161 'name': {'v_range': [['6.2.0', '6.2.13']], 'type': 'str'},
162 'offset': {'v_range': [['6.2.0', '6.2.13']], 'type': 'int'},
163 'reputation': {'v_range': [['6.2.0', '6.2.13']], 'type': 'int'}
164 }
165 }
166 }
167
168 module_option_spec = get_module_arg_spec('partial crud')
169 module_arg_spec.update(module_option_spec)
170 check_galaxy_version(module_arg_spec)
171 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'application_internetservice'),
172 supports_check_mode=True)
173 if not module._socket_path:
174 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
175 connection = Connection(module._socket_path)
176 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
177 None, 'data', module, connection)
178 fmgr.process_partial_crud()
179 module.exit_json(meta=module.params)
180
181
182 if __name__ == '__main__':
183 main()