Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_put_file.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 #
4 # Ansible module to manage Check Point 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 = {
25 "metadata_version": "1.1",
26 "status": ["preview"],
27 "supported_by": "community",
28 }
29
30 DOCUMENTATION = """
31 ---
32 module: cp_mgmt_put_file
33 short_description: put file on Check Point over Web Services API
34 description:
35 - put file on Check Point over Web Services API
36 - All operations are performed over Web Services API.
37 - Available from R80 management version.
38 version_added: "1.0.0"
39 author: "Or Soffer (@chkp-orso)"
40 options:
41 targets:
42 description:
43 - On what targets to execute this command. Targets may be identified by their name, or object unique identifier.
44 type: list
45 elements: str
46 file_content:
47 description:
48 - N/A
49 type: str
50 file_name:
51 description:
52 - N/A
53 type: str
54 file_path:
55 description:
56 - N/A
57 type: str
58 comments:
59 description:
60 - Comments string.
61 type: str
62 extends_documentation_fragment: check_point.mgmt.checkpoint_commands
63 """
64
65 EXAMPLES = """
66 - name: put-file
67 cp_mgmt_put_file:
68 file_content: 'vs ip 192.0.2.1\nvs2 ip 192.0.2.2'
69 file_name: vsx_conf
70 file_path: /home/admin/
71 targets:
72 - corporate-gateway
73 """
74
75 RETURN = """
76 cp_mgmt_put_file:
77 description: The checkpoint put-file output.
78 returned: always.
79 type: dict
80 """
81
82 from ansible.module_utils.basic import AnsibleModule
83 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import (
84 checkpoint_argument_spec_for_commands,
85 api_command,
86 )
87
88
89 def main():
90 argument_spec = dict(
91 targets=dict(type="list", elements="str"),
92 file_content=dict(type="str"),
93 file_name=dict(type="str"),
94 file_path=dict(type="str"),
95 comments=dict(type="str"),
96 )
97 argument_spec.update(checkpoint_argument_spec_for_commands)
98
99 module = AnsibleModule(argument_spec=argument_spec)
100
101 command = "put-file"
102
103 result = api_command(module, command)
104 module.exit_json(**result)
105
106
107 if __name__ == "__main__":
108 main()