Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_lsv_profile.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_lsv_profile
31 short_description: Manages lsv-profile objects on Checkpoint over Web Services API
32 description:
33 - Manages lsv-profile objects on Checkpoint devices including creating, updating and removing objects.
34 - All operations are performed over Web Services API.
35 - Available from R80.40 management version.
36 version_added: "5.0.0"
37 author: "Eden Brillant (@chkp-edenbr)"
38 options:
39 name:
40 description:
41 - Object name.
42 type: str
43 required: True
44 certificate_authority:
45 description:
46 - Trusted Certificate authority for establishing trust between VPN peers, identified by name or UID.
47 type: str
48 allowed_ip_addresses:
49 description:
50 - Collection of network objects identified by name or UID that represent IP addresses allowed in profile's VPN domain.
51 type: list
52 elements: str
53 restrict_allowed_addresses:
54 description:
55 - Indicate whether the IP addresses allowed in the VPN Domain will be restricted or not, according to allowed-ip-addresses field.
56 type: bool
57 tags:
58 description:
59 - Collection of tag identifiers.
60 type: list
61 elements: str
62 vpn_domain:
63 description:
64 - peers' VPN Domain properties.
65 type: dict
66 suboptions:
67 limit_peer_domain_size:
68 description:
69 - Use this parameter to limit the number of IP addresses in the VPN Domain of each peer according to the value in the max-allowed-addresses field.
70 type: bool
71 max_allowed_addresses:
72 description:
73 - Maximum number of IP addresses in the VPN Domain of each peer. This value will be enforced only when limit-peer-domain-size field is
74 set to true. Select a value between 1 and 256. Default value is 256.
75 type: int
76 color:
77 description:
78 - Color of the object. Should be one of existing colors.
79 type: str
80 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
81 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
82 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
83 comments:
84 description:
85 - Comments string.
86 type: str
87 details_level:
88 description:
89 - 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
90 representation of the object.
91 type: str
92 choices: ['uid', 'standard', 'full']
93 groups:
94 description:
95 - Collection of group identifiers.
96 type: list
97 elements: str
98 ignore_warnings:
99 description:
100 - Apply changes ignoring warnings.
101 type: bool
102 ignore_errors:
103 description:
104 - 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.
105 type: bool
106 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
107 """
108
109 EXAMPLES = """
110 - name: add-lsv-profile
111 cp_mgmt_lsv_profile:
112 certificate_authority: dedicated_profile_certificate
113 name: New lsv-profile
114 state: present
115
116 - name: set-lsv-profile
117 cp_mgmt_lsv_profile:
118 certificate_authority: another CA
119 name: existing lsv-profile
120 restrict_allowed_addresses: 'false'
121 state: present
122 vpn_domain:
123 limit_peer_domain_size: 'false'
124
125 - name: delete-lsv-profile
126 cp_mgmt_lsv_profile:
127 name: existing lsv-profile
128 state: absent
129 """
130
131 RETURN = """
132 cp_mgmt_lsv_profile:
133 description: The checkpoint object created or updated.
134 returned: always, except when deleting the object.
135 type: dict
136 """
137
138 from ansible.module_utils.basic import AnsibleModule
139 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call
140
141
142 def main():
143 argument_spec = dict(
144 name=dict(type='str', required=True),
145 certificate_authority=dict(type='str'),
146 allowed_ip_addresses=dict(type='list', elements='str'),
147 restrict_allowed_addresses=dict(type='bool'),
148 tags=dict(type='list', elements='str'),
149 vpn_domain=dict(type='dict', options=dict(
150 limit_peer_domain_size=dict(type='bool'),
151 max_allowed_addresses=dict(type='int')
152 )),
153 color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green',
154 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown',
155 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green',
156 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna',
157 'yellow']),
158 comments=dict(type='str'),
159 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
160 groups=dict(type='list', elements='str'),
161 ignore_warnings=dict(type='bool'),
162 ignore_errors=dict(type='bool')
163 )
164 argument_spec.update(checkpoint_argument_spec_for_objects)
165
166 module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
167 api_call_object = 'lsv-profile'
168
169 result = api_call(module, api_call_object)
170 module.exit_json(**result)
171
172
173 if __name__ == '__main__':
174 main()