Debian Codegraph @

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