Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_user_domaincontroller_extraserver.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_user_domaincontroller_extraserver
15 short_description: extra servers.
16 version_added: "2.1.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 domain-controller:
29 description: Deprecated, please use "domain_controller"
30 type: str
31 domain_controller:
32 description: The parameter (domain-controller) in requested url.
33 type: str
34 user_domaincontroller_extraserver:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 id:
40 type: int
41 description: Server ID.
42 required: true
43 ip_address:
44 aliases: ['ip-address']
45 type: str
46 description: Domain controller IP address.
47 port:
48 type: int
49 description: Port to be used for communication with the domain controller
50 source_ip_address:
51 aliases: ['source-ip-address']
52 type: str
53 description: FortiGate IPv4 address to be used for communication with the domain controller.
54 source_port:
55 aliases: ['source-port']
56 type: int
57 description: Source port to be used for communication with the domain controller.
58 '''
59
60 EXAMPLES = '''
61 - name: Example playbook (generated based on argument schema)
62 hosts: fortimanagers
63 connection: httpapi
64 gather_facts: false
65 tasks:
66 - name: Extra servers.
67 fortinet.fortimanager.fmgr_user_domaincontroller_extraserver:
68 # workspace_locking_adom: <global or your adom name>
69 adom: <your own value>
70 domain_controller: <your own value>
71 state: present # <value in [present, absent]>
72 user_domaincontroller_extraserver:
73 id: 0 # Required variable, integer
74 # ip_address: <string>
75 # port: <integer>
76 # source_ip_address: <string>
77 # source_port: <integer>
78 '''
79
80 RETURN = '''
81 meta:
82 description: The result of the request.
83 type: dict
84 returned: always
85 contains:
86 request_url:
87 description: The full url requested.
88 returned: always
89 type: str
90 sample: /sys/login/user
91 response_code:
92 description: The status of api request.
93 returned: always
94 type: int
95 sample: 0
96 response_data:
97 description: The api response.
98 type: list
99 returned: always
100 response_message:
101 description: The descriptive message of the api response.
102 type: str
103 returned: always
104 sample: OK.
105 system_information:
106 description: The information of the target system.
107 type: dict
108 returned: always
109 rc:
110 description: The status the request.
111 type: int
112 returned: always
113 sample: 0
114 version_check_warning:
115 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
116 type: list
117 returned: complex
118 '''
119 from ansible.module_utils.basic import AnsibleModule
120 from ansible.module_utils.connection import Connection
121 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
122 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
123
124
125 def main():
126 urls_list = [
127 '/pm/config/adom/{adom}/obj/user/domain-controller/{domain-controller}/extra-server',
128 '/pm/config/global/obj/user/domain-controller/{domain-controller}/extra-server'
129 ]
130 module_arg_spec = {
131 'adom': {'required': True, 'type': 'str'},
132 'domain-controller': {'type': 'str', 'api_name': 'domain_controller'},
133 'domain_controller': {'type': 'str'},
134 'revision_note': {'type': 'str'},
135 'user_domaincontroller_extraserver': {
136 'type': 'dict', 'v_range': [['6.2.1', '']],
137 'options': {
138 'id': {'v_range': [['6.2.1', '']], 'required': True, 'type': 'int'},
139 'ip-address': {'v_range': [['6.2.1', '']], 'type': 'str'},
140 'port': {'v_range': [['6.2.1', '']], 'type': 'int'},
141 'source-ip-address': {'v_range': [['7.0.0', '']], 'type': 'str'},
142 'source-port': {'v_range': [['7.0.0', '']], 'type': 'int'}
143 }
144 }
145 }
146
147 module_option_spec = get_module_arg_spec('full crud')
148 module_arg_spec.update(module_option_spec)
149 check_galaxy_version(module_arg_spec)
150 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'user_domaincontroller_extraserver'),
151 supports_check_mode=True)
152 if not module._socket_path:
153 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
154 connection = Connection(module._socket_path)
155 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
156 'id', 'data', module, connection)
157 fmgr.process_crud()
158 module.exit_json(meta=module.params)
159
160
161 if __name__ == '__main__':
162 main()