Skip to content

Commit fc8bf0d

Browse files
authored
Merge pull request #53 from huyujie/master
add-elasticsearch-cluster-api
2 parents 848de77 + cc6481c commit fc8bf0d

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

qingcloud/iaas/connection.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3627,6 +3627,70 @@ def stop_zookeepers(self, zookeepers,
36273627

36283628
return self.send_request(action, body)
36293629

3630+
def describe_elasticsearchs(self, elasticsearchs=None,
3631+
status=None,
3632+
verbose=0,
3633+
search_word=None,
3634+
owner=None,
3635+
offset=None,
3636+
limit=None,
3637+
tags=None,
3638+
**ignore):
3639+
""" Describe elasticsearchs filtered by condition.
3640+
@param elasticsearchs: the array of elasticsearchs IDs.
3641+
@param status: pending, active, stopped, deleted, suspended, ceased
3642+
@param verbose: the number to specify the verbose level, larger the number, the more detailed information will be returned.
3643+
@param search_word: search word column.
3644+
@param offset: the starting offset of the returning results.
3645+
@param limit: specify the number of the returning results.
3646+
@param tags : the array of IDs of tags.
3647+
"""
3648+
action = const.ACTION_DESCRIBE_ELASTICSEARCHS
3649+
valid_keys = ['elasticsearchs', 'status', 'verbose', 'search_word',
3650+
'offset', 'limit', 'tags', 'owner']
3651+
body = filter_out_none(locals(), valid_keys)
3652+
if not self.req_checker.check_params(body,
3653+
required_params=[],
3654+
integer_params=[
3655+
'offset', 'limit'],
3656+
list_params=['elasticsearchs', 'tags']
3657+
):
3658+
return None
3659+
3660+
return self.send_request(action, body)
3661+
3662+
def start_elasticsearchs(self, elasticsearchs,
3663+
**ignore):
3664+
""" Start one or more elasticsearchs.
3665+
@param elasticsearchs: the IDs of the elasticsearch you want to start.
3666+
"""
3667+
action = const.ACTION_START_ELASTICSEARCHS
3668+
valid_keys = ['elasticsearchs']
3669+
body = filter_out_none(locals(), valid_keys)
3670+
if not self.req_checker.check_params(body,
3671+
required_params=['elasticsearchs'],
3672+
list_params=['elasticsearchs']
3673+
):
3674+
return None
3675+
3676+
return self.send_request(action, body)
3677+
3678+
def stop_elasticsearchs(self, elasticsearchs,
3679+
**ignore):
3680+
""" Stop one or more elasticsearchs.
3681+
@param elasticsearchs: the IDs of the elasticsearch you want to stop.
3682+
"""
3683+
action = const.ACTION_STOP_ELASTICSEARCHS
3684+
valid_keys = ['elasticsearchs']
3685+
body = filter_out_none(locals(), valid_keys)
3686+
if not self.req_checker.check_params(body,
3687+
required_params=['elasticsearchs'],
3688+
list_params=['elasticsearchs']
3689+
):
3690+
return None
3691+
3692+
return self.send_request(action, body)
3693+
36303694
def describe_queues(self, queues=None,
36313695
status=None,
36323696
verbose=0,

qingcloud/iaas/constants.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@
224224
ACTION_START_ZOOKEEPERS = "StartZookeepers"
225225
ACTION_STOP_ZOOKEEPERS = "StopZookeepers"
226226

227+
# elasticsearch
228+
ACTION_DESCRIBE_ELASTICSEARCHS = "DescribeElasticsearchs"
229+
ACTION_START_ELASTICSEARCHS = "StartElasticsearchs"
230+
ACTION_STOP_ELASTICSEARCHS = "StopElasticsearchs"
231+
227232
# queue
228233
ACTION_DESCRIBE_QUEUES = "DescribeQueues"
229234
ACTION_START_QUEUES = "StartQueues"

0 commit comments

Comments
 (0)