Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_resource_cifs.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 #
4 # Ansible module to manage CheckPoint Firewall (c) 2019
5 #
6 # Ansible is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # Ansible is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
18 #
19
20 from __future__ import (absolute_import, division, print_function)
21
22 __metaclass__ = type
23
24 ANSIBLE_METADATA = {'metadata_version': '1.1',
25 'status': ['preview'],
26 'supported_by': 'community'}
27
28 DOCUMENTATION = """
29 ---
30 module: cp_mgmt_resource_cifs
31 short_description: Manages resource-cifs objects on Checkpoint over Web Services API
32 description:
33 - Manages resource-cifs objects on Checkpoint devices including creating, updating and removing objects.
34 - All operations are performed over Web Services API.
35 - Available from R82 management version.
36 version_added: "6.0.0"
37 author: "Eden Brillant (@chkp-edenbr)"
38 options:
39 name:
40 description:
41 - Object name.
42 type: str
43 required: True
44 allowed_disk_and_print_shares:
45 description:
46 - The list of Allowed Disk and Print Shares. Must be added in pairs.
47 type: list
48 elements: dict
49 suboptions:
50 server_name:
51 description:
52 - Blocks the ability to remotely manipulate a the window's registry.
53 type: str
54 share_name:
55 description:
56 - Disk shares.
57 type: str
58 log_mapped_shares:
59 description:
60 - Logs each share map attempt.
61 type: bool
62 log_access_violation:
63 description:
64 - Logs any attempt to violate the restrictions imposed by the Resource.
65 type: bool
66 block_remote_registry_access:
67 description:
68 - Blocks the ability to remotely manipulate a the window's registry.
69 type: bool
70 tags:
71 description:
72 - Collection of tag identifiers.
73 type: list
74 elements: str
75 color:
76 description:
77 - Color of the object. Should be one of existing colors.
78 type: str
79 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
80 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
81 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
82 comments:
83 description:
84 - Comments string.
85 type: str
86 details_level:
87 description:
88 - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed
89 representation of the object.
90 type: str
91 choices: ['uid', 'standard', 'full']
92 ignore_warnings:
93 description:
94 - Apply changes ignoring warnings.
95 type: bool
96 ignore_errors:
97 description:
98 - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored.
99 type: bool
100 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
101 """
102
103 EXAMPLES = """
104 - name: add-resource-cifs
105 cp_mgmt_resource_cifs:
106 allowed_disk_and_print_shares:
107 - server_name: server1
108 share_name: share1
109 - server_name: server2
110 share_name: share2
111 name: newCifsResource
112 state: present
113
114 - name: set-resource-cifs
115 cp_mgmt_resource_cifs:
116 allowed_disk_and_print_shares:
117 - server_name: server5
118 share_name: share5
119 - server_name: server6
120 share_name: share6
121 name: newCifsResource3
122 state: present
123
124 - name: delete-resource-cifs
125 cp_mgmt_resource_cifs:
126 name: newCifsResource
127 state: absent
128 """
129
130 RETURN = """
131 cp_mgmt_resource_cifs:
132 description: The checkpoint object created or updated.
133 returned: always, except when deleting the object.
134 type: dict
135 """
136
137 from ansible.module_utils.basic import AnsibleModule
138 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call
139
140
141 def main():
142 argument_spec = dict(
143 name=dict(type='str', required=True),
144 allowed_disk_and_print_shares=dict(type='list', elements='dict', options=dict(
145 server_name=dict(type='str'),
146 share_name=dict(type='str')
147 )),
148 log_mapped_shares=dict(type='bool'),
149 log_access_violation=dict(type='bool'),
150 block_remote_registry_access=dict(type='bool'),
151 tags=dict(type='list', elements='str'),
152 color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green',
153 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown',
154 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green',
155 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna',
156 'yellow']),
157 comments=dict(type='str'),
158 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
159 ignore_warnings=dict(type='bool'),
160 ignore_errors=dict(type='bool')
161 )
162 argument_spec.update(checkpoint_argument_spec_for_objects)
163
164 module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
165 api_call_object = 'resource-cifs'
166
167 result = api_call(module, api_call_object)
168 module.exit_json(**result)
169
170
171 if __name__ == '__main__':
172 main()