Debian Codegraph @

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