-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmemsource_project_template_info.py
More file actions
71 lines (53 loc) · 1.84 KB
/
memsource_project_template_info.py
File metadata and controls
71 lines (53 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = """
module: memsource_template_info
short_description: Gather information about templates available in Memsource.
version_added: 0.0.1
description:
- Gather information about templates available in Memsource
author: 'Yanis Guenane (@Spredzy)'
options:
filters:
description:
- A dict of filters to apply.
- Each dict item consists of a filter key and a filter value.
- See U(https://cloud.memsource.com/web/docs/api#operation/getProjectTemplate) for possible filters.
required: false
default: {}
type: dict
extends_documentation_fragment:
- ansible.memsource.memsource
requirements: [memsource]
"""
EXAMPLES = """
- name: Gather information about all available templates
ansible.memsource.memsource_template_info:
- name: Gather information about a named template
ansible.memsource.memsource_template_info:
filters:
name: my-memsource-template
"""
RETURN = """
templates:
returned: on success
description: >
Memsource templates that match the provided filters. Each element consists of a dict with all the information
related to that template.
type: list
"""
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.ansible.memsource.plugins.module_utils.memsource import (
get_default_argspec,
get_memsource_client,
)
def main():
argument_spec = get_default_argspec()
argument_spec = dict(filters=dict(default={}, type="dict"))
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
_memsource = get_memsource_client(module.params)
templates = _memsource.get_templates(filters=module.params.get("filters"))
module.exit_json(templates=templates)
if __name__ == "__main__":
main()