Debian Codegraph @

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