Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_adom_options.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_adom_options
15 short_description: Options
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_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 adom_options:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 assign_excluded:
34 type: str
35 description: Assign excluded.
36 choices: ['disable', 'enable']
37 specify_assign_pkg_list:
38 type: str
39 description: Specify assign pkg list.
40 choices: ['disable', 'enable']
41 assign_name:
42 type: str
43 description: Assign name.
44 '''
45
46 EXAMPLES = '''
47 - name: Example playbook (generated based on argument schema)
48 hosts: fortimanagers
49 connection: httpapi
50 gather_facts: false
51 tasks:
52 - name: Options
53 fortinet.fortimanager.fmgr_adom_options:
54 # workspace_locking_adom: <global or your adom name>
55 adom: <your own value>
56 adom_options:
57 # assign_excluded: <value in [disable, enable]>
58 # specify_assign_pkg_list: <value in [disable, enable]>
59 # assign_name: <string>
60 '''
61
62 RETURN = '''
63 meta:
64 description: The result of the request.
65 type: dict
66 returned: always
67 contains:
68 request_url:
69 description: The full url requested.
70 returned: always
71 type: str
72 sample: /sys/login/user
73 response_code:
74 description: The status of api request.
75 returned: always
76 type: int
77 sample: 0
78 response_data:
79 description: The api response.
80 type: list
81 returned: always
82 response_message:
83 description: The descriptive message of the api response.
84 type: str
85 returned: always
86 sample: OK.
87 system_information:
88 description: The information of the target system.
89 type: dict
90 returned: always
91 rc:
92 description: The status the request.
93 type: int
94 returned: always
95 sample: 0
96 version_check_warning:
97 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
98 type: list
99 returned: complex
100 '''
101 from ansible.module_utils.basic import AnsibleModule
102 from ansible.module_utils.connection import Connection
103 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
104 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
105
106
107 def main():
108 urls_list = [
109 '/pm/config/adom/{adom}/obj/adom/options',
110 '/pm/config/global/obj/adom/options'
111 ]
112 module_arg_spec = {
113 'adom': {'required': True, 'type': 'str'},
114 'revision_note': {'type': 'str'},
115 'adom_options': {
116 'type': 'dict', 'v_range': [['6.0.0', '']],
117 'options': {
118 'assign_excluded': {'choices': ['disable', 'enable'], 'type': 'str'},
119 'specify_assign_pkg_list': {'choices': ['disable', 'enable'], 'type': 'str'},
120 'assign_name': {'v_range': [['7.0.5', '7.0.16'], ['7.2.2', '']], 'type': 'str'}
121 }
122 }
123 }
124
125 module_option_spec = get_module_arg_spec('partial crud')
126 module_arg_spec.update(module_option_spec)
127 check_galaxy_version(module_arg_spec)
128 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'adom_options'),
129 supports_check_mode=True)
130 if not module._socket_path:
131 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
132 connection = Connection(module._socket_path)
133 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
134 None, 'data', module, connection)
135 fmgr.process_partial_crud()
136 module.exit_json(meta=module.params)
137
138
139 if __name__ == '__main__':
140 main()