Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_point_name.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_access_point_name
31 short_description: Manages access-point-name objects on Checkpoint over Web Services API
32 description:
33 - Manages access-point-name objects on Checkpoint devices including creating, updating and removing objects.
34 - All operations are performed over Web Services API.
35 - Available from R80.40 JHF 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 apn:
45 description:
46 - APN name.
47 type: str
48 enforce_end_user_domain:
49 description:
50 - Enable enforce end user domain.
51 type: bool
52 block_traffic_other_end_user_domains:
53 description:
54 - Block MS to MS traffic between this and other APN end user domains.
55 type: bool
56 block_traffic_this_end_user_domain:
57 description:
58 - Block MS to MS traffic within this end user domain.
59 type: bool
60 end_user_domain:
61 description:
62 - End user domain name or UID.
63 type: str
64 tags:
65 description:
66 - Collection of tag identifiers.
67 type: list
68 elements: str
69 color:
70 description:
71 - Color of the object. Should be one of existing colors.
72 type: str
73 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
74 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
75 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
76 comments:
77 description:
78 - Comments string.
79 type: str
80 details_level:
81 description:
82 - 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
83 representation of the object.
84 type: str
85 choices: ['uid', 'standard', 'full']
86 groups:
87 description:
88 - Collection of group identifiers.
89 type: list
90 elements: str
91 ignore_warnings:
92 description:
93 - Apply changes ignoring warnings.
94 type: bool
95 ignore_errors:
96 description:
97 - 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.
98 type: bool
99 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
100 """
101
102 EXAMPLES = """
103 - name: add-access-point-name
104 cp_mgmt_access_point_name:
105 name: myaccesspointname
106 apn: apnname
107 end_user_domain: All_Internet
108 enforce_end_user_domain: 'True'
109 state: present
110
111 - name: set-access-point-name
112 cp_mgmt_access_point_name:
113 name: myaccesspointname
114 block_traffic_other_end_user_domains: 'False'
115 block_traffic_this_end_user_domain: 'False'
116 enforce_end_user_domain: 'True'
117 state: present
118
119 - name: delete-access-point-name
120 cp_mgmt_access_point_name:
121 name: myaccesspointname
122 state: absent
123 """
124
125 RETURN = """
126 cp_mgmt_access_point_name:
127 description: The checkpoint object created or updated.
128 returned: always, except when deleting the object.
129 type: dict
130 """
131
132 from ansible.module_utils.basic import AnsibleModule
133 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call
134
135
136 def main():
137 argument_spec = dict(
138 name=dict(type='str', required=True),
139 apn=dict(type='str'),
140 enforce_end_user_domain=dict(type='bool'),
141 block_traffic_other_end_user_domains=dict(type='bool'),
142 block_traffic_this_end_user_domain=dict(type='bool'),
143 end_user_domain=dict(type='str'),
144 tags=dict(type='list', elements='str'),
145 color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green',
146 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown',
147 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green',
148 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna',
149 'yellow']),
150 comments=dict(type='str'),
151 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
152 groups=dict(type='list', elements='str'),
153 ignore_warnings=dict(type='bool'),
154 ignore_errors=dict(type='bool')
155 )
156 argument_spec.update(checkpoint_argument_spec_for_objects)
157
158 module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
159 api_call_object = 'access-point-name'
160
161 result = api_call(module, api_call_object)
162 module.exit_json(**result)
163
164
165 if __name__ == '__main__':
166 main()