Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_securid_server.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_securid_server
31 short_description: Manages securid-server objects on Checkpoint over Web Services API
32 description:
33 - Manages securid-server objects on Checkpoint devices including creating, updating and removing objects.
34 - All operations are performed over Web Services API.
35 - Available from R82 JHF management version.
36 version_added: "6.5.0"
37 author: "Dor Berenstein (@chkp-dorbe)"
38 options:
39 name:
40 description:
41 - Object name.
42 type: str
43 required: True
44 config_file_name:
45 description:
46 - Configuration file name.
47 type: str
48 base64_config_file_content:
49 description:
50 - Base64 encoded configuration file for authentication.
51 type: str
52 color:
53 description:
54 - Color of the object. Should be one of existing colors.
55 type: str
56 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
57 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
58 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
59 comments:
60 description:
61 - Comments string.
62 type: str
63 details_level:
64 description:
65 - 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
66 representation of the object.
67 type: str
68 choices: ['uid', 'standard', 'full']
69 domains_to_process:
70 description:
71 - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and
72 with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER.
73 type: list
74 elements: str
75 tags:
76 description:
77 - Collection of tag identifiers.
78 type: list
79 elements: str
80 ignore_warnings:
81 description:
82 - Apply changes ignoring warnings.
83 type: bool
84 ignore_errors:
85 description:
86 - 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.
87 type: bool
88 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
89 """
90
91 EXAMPLES = """
92 - name: add-securid-server
93 cp_mgmt_securid_server:
94 base64_config_file_content: Q0xJRU5UX0lQPSAxLjEuMS4xMQ==
95 config_file_name: configFile
96 name: TestSecurIdServer
97 state: present
98
99 - name: set-securid-server
100 cp_mgmt_securid_server:
101 base64_config_file_content: Q0xJRU5UX0lQPSAxLjEuMS4yMg==
102 config_file_name: NewConfigFile
103 name: TestSecurIdServer
104 state: present
105
106 - name: delete-securid-server
107 cp_mgmt_securid_server:
108 name: TestSecurIdServer
109 state: absent
110 """
111
112 RETURN = """
113 cp_mgmt_securid_server:
114 description: The checkpoint object created or updated.
115 returned: always, except when deleting the object.
116 type: dict
117 """
118
119 from ansible.module_utils.basic import AnsibleModule
120 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call
121
122
123 def main():
124 argument_spec = dict(
125 name=dict(type='str', required=True),
126 config_file_name=dict(type='str'),
127 base64_config_file_content=dict(type='str'),
128 color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green',
129 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown',
130 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green',
131 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna',
132 'yellow']),
133 comments=dict(type='str'),
134 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
135 domains_to_process=dict(type='list', elements="str"),
136 tags=dict(type='list', elements="str"),
137 ignore_warnings=dict(type='bool'),
138 ignore_errors=dict(type='bool')
139 )
140 argument_spec.update(checkpoint_argument_spec_for_objects)
141
142 module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
143 api_call_object = 'securid-server'
144
145 result = api_call(module, api_call_object)
146 module.exit_json(**result)
147
148
149 if __name__ == '__main__':
150 main()