Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_switchcontroller_lldpprofile_medlocationservice.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_lldpprofile_medlocationservice
15 short_description: Configuration method to edit Media Endpoint Discovery
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 lldp-profile:
29 description: Deprecated, please use "lldp_profile"
30 type: str
31 lldp_profile:
32 description: The parameter (lldp-profile) in requested url.
33 type: str
34 switchcontroller_lldpprofile_medlocationservice:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 name:
40 type: str
41 description: Location service type name.
42 required: true
43 status:
44 type: str
45 description: Enable or disable this TLV.
46 choices: ['disable', 'enable']
47 sys_location_id:
48 aliases: ['sys-location-id']
49 type: str
50 description: Location service ID.
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: Configuration method to edit Media Endpoint Discovery
60 fortinet.fortimanager.fmgr_switchcontroller_lldpprofile_medlocationservice:
61 # workspace_locking_adom: <global or your adom name>
62 adom: <your own value>
63 lldp_profile: <your own value>
64 state: present # <value in [present, absent]>
65 switchcontroller_lldpprofile_medlocationservice:
66 name: "your value" # Required variable, string
67 # status: <value in [disable, enable]>
68 # sys_location_id: <string>
69 '''
70
71 RETURN = '''
72 meta:
73 description: The result of the request.
74 type: dict
75 returned: always
76 contains:
77 request_url:
78 description: The full url requested.
79 returned: always
80 type: str
81 sample: /sys/login/user
82 response_code:
83 description: The status of api request.
84 returned: always
85 type: int
86 sample: 0
87 response_data:
88 description: The api response.
89 type: list
90 returned: always
91 response_message:
92 description: The descriptive message of the api response.
93 type: str
94 returned: always
95 sample: OK.
96 system_information:
97 description: The information of the target system.
98 type: dict
99 returned: always
100 rc:
101 description: The status the request.
102 type: int
103 returned: always
104 sample: 0
105 version_check_warning:
106 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
107 type: list
108 returned: complex
109 '''
110 from ansible.module_utils.basic import AnsibleModule
111 from ansible.module_utils.connection import Connection
112 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
113 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
114
115
116 def main():
117 urls_list = [
118 '/pm/config/adom/{adom}/obj/switch-controller/lldp-profile/{lldp-profile}/med-location-service',
119 '/pm/config/global/obj/switch-controller/lldp-profile/{lldp-profile}/med-location-service'
120 ]
121 module_arg_spec = {
122 'adom': {'required': True, 'type': 'str'},
123 'lldp-profile': {'type': 'str', 'api_name': 'lldp_profile'},
124 'lldp_profile': {'type': 'str'},
125 'revision_note': {'type': 'str'},
126 'switchcontroller_lldpprofile_medlocationservice': {
127 'type': 'dict', 'v_range': [['6.2.0', '']],
128 'options': {
129 'name': {'v_range': [['6.2.0', '']], 'required': True, 'type': 'str'},
130 'status': {'v_range': [['6.2.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
131 'sys-location-id': {'v_range': [['6.2.0', '']], 'type': 'str'}
132 }
133 }
134 }
135
136 module_option_spec = get_module_arg_spec('full crud')
137 module_arg_spec.update(module_option_spec)
138 check_galaxy_version(module_arg_spec)
139 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'switchcontroller_lldpprofile_medlocationservice'),
140 supports_check_mode=True)
141 if not module._socket_path:
142 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
143 connection = Connection(module._socket_path)
144 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
145 'name', 'data', module, connection)
146 fmgr.process_crud()
147 module.exit_json(meta=module.params)
148
149
150 if __name__ == '__main__':
151 main()