Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_dlp_fpsensitivity.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_dlp_fpsensitivity
15 short_description: Create self-explanatory DLP sensitivity levels to be used when setting sensitivity under config fp-doc-source.
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 dlp_fpsensitivity:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 name:
34 type: str
35 description: DLP Sensitivity Levels.
36 required: true
37 '''
38
39 EXAMPLES = '''
40 - name: Example playbook (generated based on argument schema)
41 hosts: fortimanagers
42 connection: httpapi
43 gather_facts: false
44 tasks:
45 - name: Create self-explanatory DLP sensitivity levels to be used when setting sensitivity under config fp-doc-source.
46 fortinet.fortimanager.fmgr_dlp_fpsensitivity:
47 # workspace_locking_adom: <global or your adom name>
48 adom: <your own value>
49 state: present # <value in [present, absent]>
50 dlp_fpsensitivity:
51 name: "your value" # Required variable, string
52 '''
53
54 RETURN = '''
55 meta:
56 description: The result of the request.
57 type: dict
58 returned: always
59 contains:
60 request_url:
61 description: The full url requested.
62 returned: always
63 type: str
64 sample: /sys/login/user
65 response_code:
66 description: The status of api request.
67 returned: always
68 type: int
69 sample: 0
70 response_data:
71 description: The api response.
72 type: list
73 returned: always
74 response_message:
75 description: The descriptive message of the api response.
76 type: str
77 returned: always
78 sample: OK.
79 system_information:
80 description: The information of the target system.
81 type: dict
82 returned: always
83 rc:
84 description: The status the request.
85 type: int
86 returned: always
87 sample: 0
88 version_check_warning:
89 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
90 type: list
91 returned: complex
92 '''
93 from ansible.module_utils.basic import AnsibleModule
94 from ansible.module_utils.connection import Connection
95 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
96 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
97
98
99 def main():
100 urls_list = [
101 '/pm/config/adom/{adom}/obj/dlp/fp-sensitivity',
102 '/pm/config/global/obj/dlp/fp-sensitivity'
103 ]
104 module_arg_spec = {
105 'adom': {'required': True, 'type': 'str'},
106 'revision_note': {'type': 'str'},
107 'dlp_fpsensitivity': {
108 'type': 'dict', 'v_range': [['6.0.0', '7.2.1'], ['7.4.8', '7.4.10']],
109 'options': {'name': {'v_range': [['6.0.0', '7.2.1'], ['7.4.8', '7.4.10']], 'required': True, 'type': 'str'}}
110 }
111 }
112
113 module_option_spec = get_module_arg_spec('full crud')
114 module_arg_spec.update(module_option_spec)
115 check_galaxy_version(module_arg_spec)
116 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'dlp_fpsensitivity'),
117 supports_check_mode=True)
118 if not module._socket_path:
119 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
120 connection = Connection(module._socket_path)
121 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
122 'name', 'data', module, connection)
123 fmgr.process_crud()
124 module.exit_json(meta=module.params)
125
126
127 if __name__ == '__main__':
128 main()