def request(self, cluster_key, configuration):
"""
As an available resource, pass the configuration to the registry
and get the commands that have to be run.
:param cluster_key: Key of the cluster the resource wants to connect to
:param configuration: String with the configuration of the resource
:return: List with the commands that have to be run.
"""
arguments = {
'method': 'node_config',
'cluster': cluster_key,
'node': configuration
}
client = HTTPClient()
response = client.fetch('{}/cluster?{}'.format(
self.uri, parse.urlencode(arguments)),
headers={'Key': self.uk}
)
if response.code == 200:
return json.loads(response.body.decode('utf-8'))
else:
raise ValueError(response.body.decode('utf-8'))
评论列表
文章目录