Debian Codegraph @

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