Debian Codegraph @

ansible_collections/theforeman/foreman/plugins/modules/smart_proxy_refresh.py

raw symbols SCIP
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # (c) Evgeni Golov
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 from __future__ import absolute_import, division, print_function
19 __metaclass__ = type
20
21
22 DOCUMENTATION = '''
23 ---
24 module: smart_proxy_refresh
25 version_added: 5.9.0
26 short_description: Refresh Smart Proxy features
27 description:
28 - Refresh Smart Proxy features
29 author:
30 - "Evgeni Golov (@evgeni)"
31 options:
32 smart_proxy:
33 description:
34 - Name of the Smart Proxy
35 required: true
36 type: str
37 attributes:
38 check_mode:
39 support: none
40 diff_mode:
41 support: none
42 extends_documentation_fragment:
43 - theforeman.foreman.foreman
44 - theforeman.foreman.foreman.taxonomy
45 '''
46
47 EXAMPLES = '''
48 - name: "Refresh Smart Proxy"
49 theforeman.foreman.smart_proxy_refresh:
50 username: "admin"
51 password: "changeme"
52 server_url: "https://foreman.example.com"
53 smart_proxy: "foreman-proxy.example.com"
54 '''
55
56 RETURN = '''
57 entity:
58 description: Final state of the affected entities grouped by their type.
59 returned: success
60 type: dict
61 contains:
62 smart_proxies:
63 description: List of smart_proxies.
64 type: list
65 elements: dict
66 '''
67
68 from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import ForemanTaxonomicAnsibleModule
69
70
71 class ForemanSmartProxyRefreshModule(ForemanTaxonomicAnsibleModule):
72 pass
73
74
75 def main():
76 module = ForemanSmartProxyRefreshModule(
77 foreman_spec=dict(
78 smart_proxy=dict(type='entity', required=True),
79 ),
80 supports_check_mode=False,
81 )
82
83 with module.api_connection():
84 smart_proxy = module.lookup_entity('smart_proxy')
85 entity = module.resource_action('smart_proxies', 'refresh', {'id': smart_proxy['id']})
86 module.exit_json(entity=entity)
87
88
89 if __name__ == '__main__':
90 main()