Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_limit.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_limit
31 short_description: Manages limit objects on Checkpoint over Web Services API
32 description:
33 - Manages limit 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 enable_download:
45 description:
46 - Enable throughput limit for downloads from the internet to the organization.
47 type: bool
48 download_rate:
49 description:
50 - The Rate for the maximum permitted bandwidth.
51 type: int
52 download_unit:
53 description:
54 - The Unit for the maximum permitted bandwidth.
55 type: str
56 choices: ['kbps', 'mbps', 'gbps']
57 enable_upload:
58 description:
59 - Enable throughput limit for uploads from the organization to the internet.
60 type: bool
61 upload_rate:
62 description:
63 - The Rate for the maximum permitted bandwidth.
64 type: int
65 upload_unit:
66 description:
67 - The Unit for the maximum permitted bandwidth.
68 type: str
69 choices: ['kbps', 'mbps', 'gbps']
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-limit
105 cp_mgmt_limit:
106 download_rate: '3'
107 download_unit: gbps
108 enable_download: 'true'
109 name: limit_obj
110 state: present
111
112 - name: set-limit
113 cp_mgmt_limit:
114 download_rate: 50
115 download_unit: kbps
116 name: limit_obj
117 state: present
118
119 - name: delete-limit
120 cp_mgmt_limit:
121 name: limit_obj_Clone
122 state: absent
123 """
124
125 RETURN = """
126 cp_mgmt_limit:
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 enable_download=dict(type='bool'),
140 download_rate=dict(type='int'),
141 download_unit=dict(type='str', choices=['kbps', 'mbps', 'gbps']),
142 enable_upload=dict(type='bool'),
143 upload_rate=dict(type='int'),
144 upload_unit=dict(type='str', choices=['kbps', 'mbps', 'gbps']),
145 tags=dict(type='list', elements='str'),
146 color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green',
147 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown',
148 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green',
149 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna',
150 'yellow']),
151 comments=dict(type='str'),
152 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
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 = 'limit'
160
161 result = api_call(module, api_call_object)
162 module.exit_json(**result)
163
164
165 if __name__ == '__main__':
166 main()