Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_fmg_sasemanager_settings.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_fmg_sasemanager_settings
15 short_description: Fmg sase manager settings
16 version_added: "2.7.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 fmg_sasemanager_settings:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 address:
34 type: list
35 elements: str
36 description: Address.
37 profile_group:
38 aliases: ['profile-group']
39 type: list
40 elements: str
41 description: Profile group.
42 sync_address:
43 aliases: ['sync-address']
44 type: str
45 description: Sync address.
46 choices: ['disable', 'specify', 'all']
47 sync_profile_group:
48 aliases: ['sync-profile-group']
49 type: str
50 description: Sync profile group.
51 choices: ['disable', 'specify', 'all']
52 sync_user:
53 aliases: ['sync-user']
54 type: str
55 description: Sync user.
56 choices: ['disable', 'specify', 'all']
57 user:
58 type: list
59 elements: str
60 description: User.
61 '''
62
63 EXAMPLES = '''
64 - name: Example playbook (generated based on argument schema)
65 hosts: fortimanagers
66 connection: httpapi
67 gather_facts: false
68 tasks:
69 - name: Fmg sase manager settings
70 fortinet.fortimanager.fmgr_fmg_sasemanager_settings:
71 # workspace_locking_adom: <global or your adom name>
72 adom: <your own value>
73 fmg_sasemanager_settings:
74 # address: <list or string>
75 # profile_group: <list or string>
76 # sync_address: <value in [disable, specify, all]>
77 # sync_profile_group: <value in [disable, specify, all]>
78 # sync_user: <value in [disable, specify, all]>
79 # user: <list or string>
80 '''
81
82 RETURN = '''
83 meta:
84 description: The result of the request.
85 type: dict
86 returned: always
87 contains:
88 request_url:
89 description: The full url requested.
90 returned: always
91 type: str
92 sample: /sys/login/user
93 response_code:
94 description: The status of api request.
95 returned: always
96 type: int
97 sample: 0
98 response_data:
99 description: The api response.
100 type: list
101 returned: always
102 response_message:
103 description: The descriptive message of the api response.
104 type: str
105 returned: always
106 sample: OK.
107 system_information:
108 description: The information of the target system.
109 type: dict
110 returned: always
111 rc:
112 description: The status the request.
113 type: int
114 returned: always
115 sample: 0
116 version_check_warning:
117 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
118 type: list
119 returned: complex
120 '''
121 from ansible.module_utils.basic import AnsibleModule
122 from ansible.module_utils.connection import Connection
123 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
124 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
125
126
127 def main():
128 urls_list = [
129 '/pm/config/adom/{adom}/obj/fmg/sase-manager/settings',
130 '/pm/config/global/obj/fmg/sase-manager/settings'
131 ]
132 module_arg_spec = {
133 'adom': {'required': True, 'type': 'str'},
134 'revision_note': {'type': 'str'},
135 'fmg_sasemanager_settings': {
136 'type': 'dict', 'v_range': [['7.6.0', '7.6.1']],
137 'options': {
138 'address': {'v_range': [['7.6.0', '7.6.1']], 'type': 'list', 'elements': 'str'},
139 'profile-group': {'v_range': [['7.6.0', '7.6.1']], 'type': 'list', 'elements': 'str'},
140 'sync-address': {'v_range': [['7.6.0', '7.6.1']], 'choices': ['disable', 'specify', 'all'], 'type': 'str'},
141 'sync-profile-group': {'v_range': [['7.6.0', '7.6.1']], 'choices': ['disable', 'specify', 'all'], 'type': 'str'},
142 'sync-user': {'v_range': [['7.6.0', '7.6.1']], 'choices': ['disable', 'specify', 'all'], 'type': 'str'},
143 'user': {'v_range': [['7.6.0', '7.6.1']], 'type': 'list', 'elements': 'str'}
144 }
145 }
146 }
147
148 module_option_spec = get_module_arg_spec('partial crud')
149 module_arg_spec.update(module_option_spec)
150 check_galaxy_version(module_arg_spec)
151 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'fmg_sasemanager_settings'),
152 supports_check_mode=True)
153 if not module._socket_path:
154 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
155 connection = Connection(module._socket_path)
156 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
157 None, 'data', module, connection)
158 fmgr.process_partial_crud()
159 module.exit_json(meta=module.params)
160
161
162 if __name__ == '__main__':
163 main()