Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_user_fssopolling_adgrp.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_user_fssopolling_adgrp
15 short_description: LDAP Group Info.
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 fsso-polling:
29 description: Deprecated, please use "fsso_polling"
30 type: str
31 fsso_polling:
32 description: The parameter (fsso-polling) in requested url.
33 type: str
34 user_fssopolling_adgrp:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 name:
40 type: str
41 description: Name.
42 required: true
43 '''
44
45 EXAMPLES = '''
46 - name: Example playbook
47 hosts: fortimanagers
48 gather_facts: false
49 connection: httpapi
50 vars:
51 ansible_httpapi_use_ssl: true
52 ansible_httpapi_validate_certs: false
53 ansible_httpapi_port: 443
54 tasks:
55 - name: LDAP Group Info.
56 fortinet.fortimanager.fmgr_user_fssopolling_adgrp:
57 bypass_validation: false
58 adom: ansible
59 fsso_polling: 1 # id
60 state: present
61 user_fssopolling_adgrp:
62 name: ansible-test
63
64 - name: Gathering fortimanager facts
65 hosts: fortimanagers
66 gather_facts: false
67 connection: httpapi
68 vars:
69 ansible_httpapi_use_ssl: true
70 ansible_httpapi_validate_certs: false
71 ansible_httpapi_port: 443
72 tasks:
73 - name: Retrieve all the LDAP Groups of FSSO active directory server
74 fortinet.fortimanager.fmgr_fact:
75 facts:
76 selector: "user_fssopolling_adgrp"
77 params:
78 adom: "ansible"
79 fsso_polling: 1 # id
80 adgrp: "your_value"
81 '''
82
83 RETURN = '''
84 meta:
85 description: The result of the request.
86 type: dict
87 returned: always
88 contains:
89 request_url:
90 description: The full url requested.
91 returned: always
92 type: str
93 sample: /sys/login/user
94 response_code:
95 description: The status of api request.
96 returned: always
97 type: int
98 sample: 0
99 response_data:
100 description: The api response.
101 type: list
102 returned: always
103 response_message:
104 description: The descriptive message of the api response.
105 type: str
106 returned: always
107 sample: OK.
108 system_information:
109 description: The information of the target system.
110 type: dict
111 returned: always
112 rc:
113 description: The status the request.
114 type: int
115 returned: always
116 sample: 0
117 version_check_warning:
118 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
119 type: list
120 returned: complex
121 '''
122 from ansible.module_utils.basic import AnsibleModule
123 from ansible.module_utils.connection import Connection
124 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
125 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
126
127
128 def main():
129 urls_list = [
130 '/pm/config/adom/{adom}/obj/user/fsso-polling/{fsso-polling}/adgrp',
131 '/pm/config/global/obj/user/fsso-polling/{fsso-polling}/adgrp'
132 ]
133 module_arg_spec = {
134 'adom': {'required': True, 'type': 'str'},
135 'fsso-polling': {'type': 'str', 'api_name': 'fsso_polling'},
136 'fsso_polling': {'type': 'str'},
137 'revision_note': {'type': 'str'},
138 'user_fssopolling_adgrp': {
139 'type': 'dict', 'v_range': [['6.0.0', '']],
140 'options': {'name': {'required': True, 'type': 'str'}}
141 }
142 }
143
144 module_option_spec = get_module_arg_spec('full crud')
145 module_arg_spec.update(module_option_spec)
146 check_galaxy_version(module_arg_spec)
147 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'user_fssopolling_adgrp'),
148 supports_check_mode=True)
149 if not module._socket_path:
150 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
151 connection = Connection(module._socket_path)
152 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
153 'name', 'data', module, connection)
154 fmgr.process_crud()
155 module.exit_json(meta=module.params)
156
157
158 if __name__ == '__main__':
159 main()