Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_api_settings.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_set_api_settings
31 short_description: Edit API settings, the changes will be applied after publish followed by running 'api restart' command.
32 description:
33 - Edit API settings, the changes will be applied after publish followed by running 'api restart' command.
34 - All operations are performed over Web Services API.
35 - Available from R80 management version.
36 version_added: "5.0.0"
37 author: "Eden Brillant (@chkp-edenbr)"
38 options:
39 accepted_api_calls_from:
40 description:
41 - Clients allowed to connect to the API Server.
42 type: str
43 choices: ['management server only', 'all ip addresses that can be used for gui clients', 'all ip addresses']
44 extends_documentation_fragment: check_point.mgmt.checkpoint_commands
45 """
46
47 EXAMPLES = """
48 - name: set-api-settings
49 cp_mgmt_set_api_settings:
50 accepted_api_calls_from: 'all ip addresses'
51 """
52
53 RETURN = """
54 cp_mgmt_set_api_settings:
55 description: The checkpoint set-api-settings output.
56 returned: always.
57 type: dict
58 """
59
60 from ansible.module_utils.basic import AnsibleModule
61 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command
62
63
64 def main():
65 argument_spec = dict(
66 accepted_api_calls_from=dict(type='str', choices=['management server only', 'all ip addresses that can be used for gui clients', 'all ip addresses'])
67 )
68 argument_spec.update(checkpoint_argument_spec_for_commands)
69
70 module = AnsibleModule(argument_spec=argument_spec)
71
72 command = "set-api-settings"
73
74 result = api_command(module, command)
75 module.exit_json(**result)
76
77
78 if __name__ == '__main__':
79 main()