Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_session.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 = {
25 "metadata_version": "1.1",
26 "status": ["preview"],
27 "supported_by": "community",
28 }
29
30 DOCUMENTATION = """
31 ---
32 module: cp_mgmt_set_session
33 short_description: Edit user's current session.
34 description:
35 - Edit user's current session.
36 - All operations are performed over Web Services API.
37 - Available from R80 management version.
38 version_added: "2.0.0"
39 author: "Or Soffer (@chkp-orso)"
40 options:
41 description:
42 description:
43 - Session description.
44 type: str
45 new_name:
46 description:
47 - New name of the object.
48 type: str
49 tags:
50 description:
51 - Collection of tag identifiers.
52 type: list
53 elements: str
54 color:
55 description:
56 - Color of the object. Should be one of existing colors.
57 type: str
58 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
59 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
60 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
61 comments:
62 description:
63 - Comments string.
64 type: str
65 details_level:
66 description:
67 - 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
68 representation of the object.
69 type: str
70 choices: ['uid', 'standard', 'full']
71 ignore_warnings:
72 description:
73 - Apply changes ignoring warnings.
74 type: bool
75 ignore_errors:
76 description:
77 - 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.
78 type: bool
79 extends_documentation_fragment: check_point.mgmt.checkpoint_commands
80 """
81
82 EXAMPLES = """
83 - name: set-session
84 cp_mgmt_set_session:
85 description: Session to work on ticket number CR00323665
86 """
87
88 RETURN = """
89 cp_mgmt_set_session:
90 description: The checkpoint set-session output.
91 returned: always.
92 type: dict
93 """
94
95 from ansible.module_utils.basic import AnsibleModule
96 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import (
97 checkpoint_argument_spec_for_commands,
98 api_command,
99 )
100
101
102 def main():
103 argument_spec = dict(
104 description=dict(type="str"),
105 new_name=dict(type="str"),
106 tags=dict(type="list", elements="str"),
107 color=dict(
108 type="str",
109 choices=[
110 "aquamarine",
111 "black",
112 "blue",
113 "crete blue",
114 "burlywood",
115 "cyan",
116 "dark green",
117 "khaki",
118 "orchid",
119 "dark orange",
120 "dark sea green",
121 "pink",
122 "turquoise",
123 "dark blue",
124 "firebrick",
125 "brown",
126 "forest green",
127 "gold",
128 "dark gold",
129 "gray",
130 "dark gray",
131 "light green",
132 "lemon chiffon",
133 "coral",
134 "sea green",
135 "sky blue",
136 "magenta",
137 "purple",
138 "slate blue",
139 "violet red",
140 "navy blue",
141 "olive",
142 "orange",
143 "red",
144 "sienna",
145 "yellow",
146 ],
147 ),
148 comments=dict(type="str"),
149 details_level=dict(type="str", choices=["uid", "standard", "full"]),
150 ignore_warnings=dict(type="bool"),
151 ignore_errors=dict(type="bool"),
152 )
153 argument_spec.update(checkpoint_argument_spec_for_commands)
154
155 module = AnsibleModule(argument_spec=argument_spec)
156
157 command = "set-session"
158
159 result = api_command(module, command)
160 module.exit_json(**result)
161
162
163 if __name__ == "__main__":
164 main()