Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_resource_ftp.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_ftp
31 short_description: Manages resource-ftp objects on Checkpoint over Web Services API
32 description:
33 - Manages resource-ftp 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 resource_matching_method:
45 description:
46 - GET allows Downloads from the server to the client. PUT allows Uploads from the client to the server.
47 type: str
48 choices: ['get', 'put', 'get_and_put']
49 exception_track:
50 description:
51 - The UID or Name of the exception track to be used to log actions taken as a result of a match on the resource.
52 type: str
53 choices: ['none', 'exception log', 'exception alert']
54 resources_path:
55 description:
56 - Refers to a location on the FTP server.
57 type: str
58 cvp:
59 description:
60 - Configure CVP inspection on mail messages.
61 type: dict
62 suboptions:
63 enable_cvp:
64 description:
65 - Select to enable the Content Vectoring Protocol.
66 type: bool
67 server:
68 description:
69 - The UID or Name of the CVP server, make sure the CVP server is already be defined as an OPSEC Application.
70 type: str
71 allowed_to_modify_content:
72 description:
73 - Configures the CVP server to inspect but not modify content.
74 type: bool
75 reply_order:
76 description:
77 - Designates when the CVP server returns data to the Security Gateway security server.
78 type: str
79 choices: ['return_data_after_content_is_approved', 'return_data_before_content_is_approved']
80 tags:
81 description:
82 - Collection of tag identifiers.
83 type: list
84 elements: str
85 color:
86 description:
87 - Color of the object. Should be one of existing colors.
88 type: str
89 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
90 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
91 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
92 comments:
93 description:
94 - Comments string.
95 type: str
96 details_level:
97 description:
98 - 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
99 representation of the object.
100 type: str
101 choices: ['uid', 'standard', 'full']
102 ignore_warnings:
103 description:
104 - Apply changes ignoring warnings.
105 type: bool
106 ignore_errors:
107 description:
108 - 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.
109 type: bool
110 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
111 """
112
113 EXAMPLES = """
114 - name: add-resource-ftp
115 cp_mgmt_resource_ftp:
116 exception_track: exception log
117 name: newFtpResource
118 resource_matching_method: get_and_put
119 resources_path: path
120 state: present
121
122 - name: set-resource-ftp
123 cp_mgmt_resource_ftp:
124 name: newFtpResource
125 resource_matching_method: put
126 state: present
127
128 - name: delete-resource-ftp
129 cp_mgmt_resource_ftp:
130 name: newFtpResource
131 state: absent
132 """
133
134 RETURN = """
135 cp_mgmt_resource_ftp:
136 description: The checkpoint object created or updated.
137 returned: always, except when deleting the object.
138 type: dict
139 """
140
141 from ansible.module_utils.basic import AnsibleModule
142 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call
143
144
145 def main():
146 argument_spec = dict(
147 name=dict(type='str', required=True),
148 resource_matching_method=dict(type='str', choices=['get', 'put', 'get_and_put']),
149 exception_track=dict(type='str', choices=['none', 'exception log', 'exception alert']),
150 resources_path=dict(type='str'),
151 cvp=dict(type='dict', options=dict(
152 enable_cvp=dict(type='bool'),
153 server=dict(type='str'),
154 allowed_to_modify_content=dict(type='bool'),
155 reply_order=dict(type='str', choices=['return_data_after_content_is_approved', 'return_data_before_content_is_approved'])
156 )),
157 tags=dict(type='list', elements='str'),
158 color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green',
159 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown',
160 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green',
161 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna',
162 'yellow']),
163 comments=dict(type='str'),
164 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
165 ignore_warnings=dict(type='bool'),
166 ignore_errors=dict(type='bool')
167 )
168 argument_spec.update(checkpoint_argument_spec_for_objects)
169
170 module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
171 api_call_object = 'resource-ftp'
172
173 result = api_call(module, api_call_object)
174 module.exit_json(**result)
175
176
177 if __name__ == '__main__':
178 main()