Best Python code snippet using playwright-python
connection.py
Source:connection.py
...162 @param limit: specify the number of the returning results.163 """164 action = const.ACTION_DESCRIBE_ACCESS_KEYS165 valid_keys = ['access_keys', 'status', 'offset', 'limit']166 body = filter_out_none(locals(), valid_keys)167 if not self.req_checker.check_params(body,168 integer_params=["offset", "limit"],169 list_params=["access_keys", "status"]):170 return None171 return self.send_request(action, body)172 def describe_notification_center_user_posts(self,173 post_type=None,174 status=None,175 limit=None,176 offset=None,177 **ignore):178 """ Describe posts in notification center179 @param post_type: specify the type of post, valid values: failures, products180 @param status: filter by status: new, read181 @param offset: the starting offset of the returning results.182 @param limit: specify the number of the returning results.183 """184 action = const.ACTION_DESCRIBE_NOTIFICATION_CENTER_USER_POSTS185 valid_keys = ['post_type', 'status', 'offset', 'limit']186 body = filter_out_none(locals(), valid_keys)187 if not self.req_checker.check_params(body,188 integer_params=["offset", "limit"],189 list_params=["post_type", "status"]):190 return None191 return self.send_request(action, body)192 def describe_zones(self):193 """ Describe zones194 """195 action = const.ACTION_DESCRIBE_ZONES196 body = {}197 if not self.req_checker.check_params(body,198 required_params=[],199 ):200 return None201 return self.send_request(action, body)202 def describe_jobs(self, jobs=None,203 status=None,204 job_action=None,205 offset=None,206 limit=None,207 **ignore):208 """ Describe jobs.209 @param jobs: the IDs of job you want to describe.210 @param status: valid values include pending, working, failed, successful.211 @param job_action: the action of job you want to describe.212 @param offset: the starting offset of the returning results.213 @param limit: specify the number of the returning results.214 """215 action = const.ACTION_DESCRIBE_JOBS216 valid_keys = ['jobs', 'status', 'job_action', 'offset', 'limit']217 body = filter_out_none(locals(), valid_keys)218 if not self.req_checker.check_params(body,219 required_params=[],220 integer_params=[221 "offset", "limit"],222 list_params=["jobs"]223 ):224 return None225 return self.send_request(action, body)226 def create_server_certificate(self, server_certificate_name=None,227 certificate_content=None,228 private_key=None,229 **ignore):230 """ Create server certificate231 @param server_certificate_name: the name of server certificate232 @param certificate_content: the name of server certificate233 @param private_key: the private key of server certificate234 """235 action = const.ACTION_CREATE_SERVER_CERTIFICATE236 body = {'server_certificate_name': server_certificate_name,237 'certificate_content': certificate_content,238 'private_key': private_key}239 if not self.req_checker.check_params(body,240 required_params=[241 'certificate_content', 'private_key'],242 integer_params=[],243 list_params=[]244 ):245 return None246 return self.send_request(action, body, verb='POST')247 def describe_server_certificates(self, server_certificates=None,248 search_word=None,249 verbose=0,250 offset=None,251 limit=None,252 **ignore):253 """ Describe server certificates.254 @param server_certificates: filter by server certificates ID.255 @param search_word: filter by server certificates name.256 @param verbose: the number to specify the verbose level,257 larger the number, the more detailed information will be returned.258 @param offset: the starting offset of the returning results.259 @param limit: specify the number of the returning results.260 """261 action = const.ACTION_DESCRIBE_SERVER_CERTIFICATES262 valid_keys = ['server_certificates', 'search_word',263 'verbose', 'offset', 'limit']264 body = filter_out_none(locals(), valid_keys)265 if not self.req_checker.check_params(body,266 required_params=[],267 integer_params=['verbose', 'offset', 'limit'],268 list_params=['server_certificates']269 ):270 return None271 return self.send_request(action, body)272 def modify_server_certificate_attributes(self,273 server_certificate=None,274 server_certificate_name=None,275 description=None,276 **ignore):277 """ Modify server certificate attributes278 @param server_certificate: the ID of server certificate.279 @param server_certificate_name: server certificate new name.280 @param description: server certificate new description.281 :return:282 """283 action = const.ACTION_MODIFY_SERVER_CERTIFICATE_ATTRIBUTES284 valid_keys = ['server_certificate', 'server_certificate_name', 'description']285 body = filter_out_none(locals(), valid_keys)286 if not self.req_checker.check_params(body,287 required_params=['server_certificate'],288 integer_params=[],289 list_params=[]290 ):291 return None292 return self.send_request(action, body)293 def delete_server_certificates(self, server_certificates,294 **ignore):295 """ Delete server certificates.296 @param server_certificates: the array of policy rule IDs.297 """298 action = const.ACTION_DELETE_SERVER_CERTIFICATES299 body = {'server_certificates': server_certificates}300 if not self.req_checker.check_params(body,301 required_params=[302 'server_certificates'],303 integer_params=[],304 list_params=[305 'server_certificates']306 ):307 return None308 return self.send_request(action, body)309 def get_monitoring_data(self, resource,310 meters,311 step,312 start_time,313 end_time,314 decompress=False,315 **ignore):316 """ Get resource monitoring data.317 @param resource: the ID of resource, can be instance_id, volume_id, eip_id or router_id.318 @param meters: list of metering types you want to get.319 If resource is instance, meter can be "cpu", "disk-os", "memory",320 "disk-%s" % attached_volume_id, "if-%s" % vxnet_mac_address.321 If resource is volume, meter should be "disk-%s" % volume_id.322 If resource is eip, meter should be "traffic".323 If resource is router, meter can be "vxnet-0" and joint vxnet ID.324 @param step: The metering time step, valid steps: "5m", "15m", "30m", "1h", "2h", "1d".325 @param start_time: the starting UTC time, in the format YYYY-MM-DDThh:mm:ssZ.326 @param end_time: the ending UTC time, in the format YYYY-MM-DDThh:mm:ssZ.327 """328 action = const.ACTION_GET_MONITOR329 valid_keys = ['resource', 'meters', 'step', 'start_time', 'end_time']330 body = filter_out_none(locals(), valid_keys)331 if not self.req_checker.check_params(body,332 required_params=[333 'resource', 'meters', 'step', 'start_time', 'end_time'],334 integer_params=[],335 datetime_params=[336 'start_time', 'end_time'],337 list_params=['meters']338 ):339 return None340 resp = self.send_request(action, body)341 if resp and resp.get('meter_set') and decompress:342 p = MonitorProcessor(resp['meter_set'], start_time, end_time, step)343 resp['meter_set'] = p.decompress_monitoring_data()344 return resp345 def get_loadbalancer_monitoring_data(self, resource,346 meters,347 step,348 start_time,349 end_time,350 decompress=False,351 **ignore):352 """ Get load balancer monitoring data.353 @param resource: the ID of resource, can be loadbalancer_id, listener_id or backend_id.354 @param meters: list of metering types you want to get, valid values: request, traffic.355 @param step: The metering time step, valid steps: "5m", "15m", "30m", "1h", "2h", "1d".356 @param start_time: the starting UTC time, in the format YYYY-MM-DDThh:mm:ssZ.357 @param end_time: the ending UTC time, in the format YYYY-MM-DDThh:mm:ssZ.358 """359 action = const.ACTION_GET_LOADBALANCER_MONITOR360 valid_keys = ['resource', 'meters', 'step', 'start_time', 'end_time']361 body = filter_out_none(locals(), valid_keys)362 if not self.req_checker.check_params(body,363 required_params=[364 'resource', 'meters', 'step', 'start_time', 'end_time'],365 integer_params=[],366 datetime_params=[367 'start_time', 'end_time'],368 list_params=['meters']369 ):370 return None371 resp = self.send_request(action, body)372 if resp and resp.get('meter_set') and decompress:373 p = MonitorProcessor(resp['meter_set'], start_time, end_time, step)374 resp['meter_set'] = p.decompress_lb_monitoring_data()375 return resp376 def describe_rdbs(self, rdbs=None,377 rdb_engine=None,378 status=None,379 owner=None,380 verbose=0,381 search_word=None,382 offset=None,383 limit=None,384 tags=None,385 **ignore):386 """ Describe rdbs filtered by condition.387 @param rdbs: an array including IDs of the rdbs you want to list.388 No ID specified means list all.389 @param rdb_engine: filter by rdb engine: mysql, psql.390 @param status: valid values include pending, available, suspended, deleted, ceased.391 @param verbose: the number to specify the verbose level,392 larger the number, the more detailed information will be returned.393 @param search_word: the search word.394 @param offset: the starting offset of the returning results.395 @param limit: specify the number of the returning results.396 @param tags : the array of IDs of tags.397 """398 action = const.ACTION_DESCRIBE_RDBS399 valid_keys = ['rdbs', 'rdb_engine', 'status', 'owner',400 'verbose', 'search_word', 'offset', 'limit', 'tags']401 body = filter_out_none(locals(), valid_keys)402 if not self.req_checker.check_params(body,403 required_params=[],404 integer_params=[405 "offset", "limit", "verbose"],406 list_params=["rdbs", "tags"]407 ):408 return None409 return self.send_request(action, body)410 def create_rdb(self, vxnet=None,411 rdb_engine=None,412 engine_version=None,413 rdb_username=None,414 rdb_password=None,415 rdb_type=None,416 storage_size=None,417 rdb_name=None,418 private_ips=None,419 description=None,420 auto_backup_time=None,421 **ignore):422 """ Create one rdb.423 @param vxnet: vxnet_id.424 @param rdb_engine: set rdb engine: mysql, psql.425 @param engine_version: set rdb version, mysql support 5.5, psql support 9.4.426 the default is 5.5.427 @param rdb_username: the rdb's username428 @param rdb_password: the rdb's password429 @param rdb_type: defined by qingcloud: 1, 2, 3, 4, 5430 @param storage_size: the size of rdb storage, min 10G, max 1000G431 @param rdb_name: the rdb's name432 @param private_ips: set node's ip, like [{"master":"192.168.100.14","topslave":"192.168.100.17"}]433 @param description: the description of this rdb434 @param auto_backup_time: auto backup time, valid value is [0, 23], any value over 23 means close435 autp backup. If skipped, it will choose a value randomly.436 """437 action = const.ACTION_CREATE_RDB438 valid_keys = ['vxnet', 'rdb_engine', 'engine_version', 'rdb_username',439 'rdb_password', 'rdb_type', 'storage_size', 'rdb_name',440 'private_ips', 'description', 'auto_backup_time']441 body = filter_out_none(locals(), valid_keys)442 if not self.req_checker.check_params(body,443 required_params=['vxnet', 'engine_version', 'rdb_username', 'rdb_password',444 'rdb_type', 'storage_size'],445 integer_params=['rdb_type',446 'storage_size', 'auto_backup_time'],447 list_params=[]448 ):449 return None450 return self.send_request(action, body)451 def resize_rdbs(self, rdbs,452 rdb_type=None,453 storage_size=None,454 **ignore):455 """ Resize one or more rdbs.456 @param rdbs: the IDs of the rdbs you want to resize.457 @param rdb_type: defined by qingcloud: 1, 2, 3, 4, 5458 @param cpu: cpu core number.459 @param memory: memory size in MB.460 """461 action = const.ACTION_RESIZE_RDBS462 valid_keys = ['rdbs', 'rdb_type', 'storage_size']463 body = filter_out_none(locals(), valid_keys)464 if not self.req_checker.check_params(body,465 required_params=['rdbs'],466 integer_params=[467 'rdb_type', 'storage_size'],468 list_params=['rdbs']469 ):470 return None471 return self.send_request(action, body)472 def start_rdbs(self, rdbs,473 **ignore):474 """ Start one or more rdbs.475 @param rdbs: the IDs of the rdbs you want to start.476 """477 action = const.ACTION_START_RDBS478 valid_keys = ['rdbs']479 body = filter_out_none(locals(), valid_keys)480 if not self.req_checker.check_params(body,481 required_params=['rdbs'],482 list_params=['rdbs']483 ):484 return None485 return self.send_request(action, body)486 def stop_rdbs(self, rdbs,487 **ignore):488 """ Stop one or more rdbs.489 @param rdbs: the IDs of the rdbs you want to stop.490 """491 action = const.ACTION_STOP_RDBS492 valid_keys = ['rdbs']493 body = filter_out_none(locals(), valid_keys)494 if not self.req_checker.check_params(body,495 required_params=['rdbs'],496 list_params=['rdbs']497 ):498 return None499 return self.send_request(action, body)500 def cease_rdbs(self, rdbs,501 **ignore):502 """ Stop one or more rdbs.503 @param rdbs: the IDs of the rdbs you want to stop.504 """505 action = const.ACTION_CEASE_RDBs506 valid_keys = ['rdbs']507 body = filter_out_none(locals(), valid_keys)508 if not self.req_checker.check_params(body,509 required_params=['rdbs'],510 list_params=['rdbs']511 ):512 return None513 return self.send_request(action, body)514 def describe_mongos(self, mongos=None,515 status=None,516 verbose=0,517 owner=None,518 search_word=None,519 offset=None,520 limit=None,521 tags=None,522 **ignore):523 """ Describe mongos filtered by condition.524 @param mongos: an array including IDs of the mongos you want to list.525 No ID specified means list all.526 @param status: valid values include pending, available, suspended, deleted, ceased.527 @param verbose: the number to specify the verbose level,528 larger the number, the more detailed information will be returned.529 @param search_word: the search word.530 @param offset: the starting offset of the returning results.531 @param limit: specify the number of the returning results.532 @param tags : the array of IDs of tags.533 """534 action = const.ACTION_DESCRIBE_MONGOS535 valid_keys = ['mongos', 'status', 'verbose', 'search_word',536 'offset', 'limit', 'tags', 'owner']537 body = filter_out_none(locals(), valid_keys)538 if not self.req_checker.check_params(body,539 required_params=[],540 integer_params=[541 "offset", "limit", "verbose"],542 list_params=["mongos", "tags"]543 ):544 return None545 return self.send_request(action, body)546 def resize_mongos(self, mongos,547 mongo_type=None,548 storage_size=None,549 **ignore):550 """ Resize one or more mongos.551 @param mongos: the IDs of the mongos you want to resize.552 @param mongo_type: defined by qingcloud: 1, 2, 3, 4.553 see: https://docs.qingcloud.com/api/mongo/resize_mongos.html554 @param cpu: cpu core number.555 @param memory: memory size in MB.556 """557 action = const.ACTION_RESIZE_MONGOS558 valid_keys = ['mongos', 'mongo_type', 'storage_size']559 body = filter_out_none(locals(), valid_keys)560 if not self.req_checker.check_params(body,561 required_params=['mongos'],562 integer_params=[563 'mongo_type', 'storage_size'],564 list_params=['mongos']565 ):566 return None567 return self.send_request(action, body)568 def start_mongos(self, mongos,569 **ignore):570 """ Start one or more mongos.571 @param mongos: the IDs of the mongos you want to start.572 """573 action = const.ACTION_START_MONGOS574 valid_keys = ['mongos']575 body = filter_out_none(locals(), valid_keys)576 if not self.req_checker.check_params(body,577 required_params=['mongos'],578 list_params=['mongos']579 ):580 return None581 return self.send_request(action, body)582 def stop_mongos(self, mongos,583 **ignore):584 """ Stop one or more mongos.585 @param mongos: the IDs of the mongos you want to stop.586 """587 action = const.ACTION_STOP_MONGOS588 valid_keys = ['mongos']589 body = filter_out_none(locals(), valid_keys)590 if not self.req_checker.check_params(body,591 required_params=['mongos'],592 list_params=['mongos']593 ):594 return None595 return self.send_request(action, body)596 def describe_caches(self, caches=None,597 status=None,598 verbose=0,599 owner=None,600 search_word=None,601 offset=None,602 limit=None,603 tags=None,604 **ignore):605 """ Describe caches filtered by condition.606 @param caches: an array including IDs of the caches you want to list.607 No ID specified means list all.608 @param status: valid values include pending, available, suspended, deleted, ceased.609 @param verbose: the number to specify the verbose level,610 larger the number, the more detailed information will be returned.611 @param search_word: the search word.612 @param offset: the starting offset of the returning results.613 @param limit: specify the number of the returning results.614 @param tags : the array of IDs of tags.615 """616 action = const.ACTION_DESCRIBE_CACHES617 valid_keys = ['caches', 'status', 'verbose', 'search_word',618 'offset', 'limit', 'tags', 'owner']619 body = filter_out_none(locals(), valid_keys)620 if not self.req_checker.check_params(body,621 required_params=[],622 integer_params=[623 "offset", "limit", "verbose"],624 list_params=["caches", "tags"]625 ):626 return None627 return self.send_request(action, body)628 def create_cache(self, vxnet=None,629 cache_size=None,630 cache_type=None,631 node_count=None,632 cache_name=None,633 cache_parameter_group=None,634 private_ips=None,635 auto_backup_time=None,636 cache_class=None,637 **ignore):638 """ Create a cache.639 @param vxnet: the vxnet id that cache added.640 @param cache_size: cache size, unit is GB641 @param cache_type: cache service type, now support redis2.8.17 and memcached1.4.13.642 @param node_count: cache service node number, default set 1.643 @param cache_name: cache service's name644 @param cache_parameter_group: cache service configuration group ID, if not given,645 set to default one.646 @param private_ips: the array of private_ips setting, include cache_role and specify private_ips647 @param auto_backup_time: auto backup time, valid value is [0, 23], any value over 23 means close648 autp backup. If skipped, it will choose a value randomly.649 @param cache_class: property type set 0 and high property type set 1650 """651 action = const.ACTION_CREATE_CACHE652 valid_keys = ['vxnet', 'cache_size', 'cache_type', 'node_count',653 'cache_name', 'cache_parameter_group', 'private_ips',654 'auto_backup_time', 'cache_class']655 body = filter_out_none(locals(), valid_keys)656 if not self.req_checker.check_params(body,657 required_params=[658 'vxnet', 'cache_size', 'cache_type'],659 integer_params=['cache_size', 'node_count',660 'auto_backup_time', 'cache_class'],661 list_params=['private_ips']662 ):663 return None664 return self.send_request(action, body)665 def resize_caches(self, caches,666 cache_size=None,667 storage_size=None,668 **ignore):669 """ Resize one or more caches.670 @param caches: the IDs of the caches you want to resize.671 @param cache_size: defined by qingcloud: 1 - 32 GB.672 @param cpu: cpu core number.673 @param memory: memory size in MB.674 """675 action = const.ACTION_RESIZE_CACHES676 valid_keys = ['caches', 'cache_size', 'storage_size']677 body = filter_out_none(locals(), valid_keys)678 if not self.req_checker.check_params(body,679 required_params=['caches'],680 integer_params=[681 'cache_size', 'storage_size'],682 list_params=['caches']683 ):684 return None685 return self.send_request(action, body)686 def start_caches(self, caches,687 **ignore):688 """ Start one or more caches.689 @param caches: the IDs of the caches you want to start.690 """691 action = const.ACTION_START_CACHES692 valid_keys = ['caches']693 body = filter_out_none(locals(), valid_keys)694 if not self.req_checker.check_params(body,695 required_params=['caches'],696 list_params=['caches']697 ):698 return None699 return self.send_request(action, body)700 def stop_caches(self, caches,701 **ignore):702 """ Stop one or more caches.703 @param caches: the IDs of the caches you want to stop.704 """705 action = const.ACTION_STOP_CACHES706 valid_keys = ['caches']707 body = filter_out_none(locals(), valid_keys)708 if not self.req_checker.check_params(body,709 required_params=['caches'],710 list_params=['caches']711 ):712 return None713 return self.send_request(action, body)714 def create_spark(self, vxnet=None,715 spark_version=None,716 enable_hdfs=None,717 storage_size=None,718 spark_type=None,719 node_count=None,720 spark_name=None,721 private_ips=None,722 spark_class=None,723 description=None,724 zk_id=None,725 parameter_group=None,726 **ignore):727 """ Create a spark cluster.728 @param vxnet: the vxnet id that spark want to join.729 @param spark_version: the version of spark, suck as 1.4.1, 1.5.0, 1.6.0730 @param enabled_hdfs: whether to use hdfs as storage or not731 @param storage_size: storage size, unit is GB732 @param spark_type: cpu-memory size of spark cluster, such as 1:1c2g, 2:2c4g, 3:2c8g, 4:4c8g, 5:8c16g733 @param node_count: spark cluster node number, at least 2 for hdfs enabled.734 @param spark_name: spark cluster's name735 @param private_ips: the array of private_ips setting, include spark_role and specified private_ips736 @param spark_class: high performance is set 0 and super-high 1737 @param zk_id: the zookeeper id which ha-enabled spark will use738 @param parameter_group: the parameter configuration group which will be applied to spark cluster739 """740 action = const.ACTION_CREATE_SPARK741 valid_keys = ['vxnet', 'storage_size', 'spark_type', 'node_count',742 'spark_name', 'spark_version', 'private_ips',743 'enable_hdfs', 'spark_class', "description",744 "zk_id", "parameter_group"]745 body = filter_out_none(locals(), valid_keys)746 if not self.req_checker.check_params(body,747 required_params=["vxnet", "spark_type",748 "spark_version", "node_count",749 "storage_size", "enable_hdfs"],750 integer_params=["node_count", "spark_type",751 "storage_size", "enable_hdfs", "spark_class"],752 list_params=['private_ips']753 ):754 return None755 return self.send_request(action, body)756 def describe_sparks(self, sparks=None,757 status=None,758 verbose=0,759 owner=None,760 search_word=None,761 offset=None,762 limit=None,763 tags=None,764 **ignore):765 """ Describe sparks filtered by condition.766 @param sparks: the array of spark IDs.767 @param status: pending, active, stopped, deleted, suspended, ceased768 @param verbose: the number to specify the verbose level, larger the number, the more detailed information will be returned.769 @param search_word: search word column.770 @param offset: the starting offset of the returning results.771 @param limit: specify the number of the returning results.772 @param tags : the array of IDs of tags.773 """774 action = const.ACTION_DESCRIBE_SPARKS775 valid_keys = ['sparks', 'status', 'verbose', 'search_word',776 'offset', 'limit', 'tags', 'owner']777 body = filter_out_none(locals(), valid_keys)778 if not self.req_checker.check_params(body,779 required_params=[],780 integer_params=[781 'offset', 'limit'],782 list_params=[783 'sparks', 'status', 'tags']784 ):785 return None786 return self.send_request(action, body)787 def start_sparks(self, sparks,788 **ignore):789 """ Start one or more sparks.790 @param sparks: the IDs of the spark you want to start.791 """792 action = const.ACTION_START_SPARKS793 valid_keys = ['sparks']794 body = filter_out_none(locals(), valid_keys)795 if not self.req_checker.check_params(body,796 required_params=['sparks'],797 list_params=['sparks']798 ):799 return None800 return self.send_request(action, body)801 def stop_sparks(self, sparks,802 **ignore):803 """ Stop one or more sparks.804 @param sparks: the IDs of the spark you want to stop.805 """806 action = const.ACTION_STOP_SPARKS807 valid_keys = ['sparks']808 body = filter_out_none(locals(), valid_keys)809 if not self.req_checker.check_params(body,810 required_params=['sparks'],811 list_params=['sparks']812 ):813 return None814 return self.send_request(action, body)815 def delete_sparks(self, sparks, **ignore):816 '''Delete one or more sparks817 @param sparks: the IDs of the spark you want to stop.818 '''819 action = const.ACTION_DELETE_SPARKS820 valid_keys = ['sparks']821 body = filter_out_none(locals(), valid_keys)822 if not self.req_checker.check_params(body,823 required_params=['sparks'],824 list_params=['sparks']825 ):826 return None827 return self.send_request(action, body)828 def add_spark_nodes(self, spark, node_count, node_name=None, private_ips=None, **params):829 """ Add one or more spark nodes830 """831 action = const.ACTION_ADD_SPARK_NODES832 valid_keys = ['spark', 'node_count', 'node_name', 'private_ips']833 body = filter_out_none(locals(), valid_keys)834 if not self.req_checker.check_params(body,835 required_params=[836 'spark', 'node_count'],837 integer_params=['node_count'],838 list_params=['private_ips']839 ):840 return None841 return self.send_request(action, body)842 def delete_spark_nodes(self, spark, spark_nodes):843 """ Delete one or more spark nodes844 """845 action = const.ACTION_DELETE_SPARK_NODES846 valid_keys = ['spark', 'spark_nodes']847 body = filter_out_none(locals(), valid_keys)848 if not self.req_checker.check_params(body,849 required_params=[850 'spark', 'spark_nodes'],851 list_params=['spark_nodes']):852 return None853 return self.send_request(action, body)854 def describe_hadoops(self, hadoops=None,855 status=None,856 verbose=0,857 owner=None,858 search_word=None,859 offset=None,860 limit=None,861 tags=None,862 **ignore):863 """ Describe hadoops filtered by condition.864 @param hadoops: the array of hadoop IDs.865 @param status: pending, active, stopped, deleted, suspended, ceased866 @param verbose: the number to specify the verbose level, larger the number, the more detailed information will be returned.867 @param search_word: search word column.868 @param offset: the starting offset of the returning results.869 @param limit: specify the number of the returning results.870 @param tags : the array of IDs of tags.871 """872 action = const.ACTION_DESCRIBE_HADOOPS873 valid_keys = ['hadoops', 'status', 'verbose', 'search_word',874 'offset', 'limit', 'tags', 'owner']875 body = filter_out_none(locals(), valid_keys)876 if not self.req_checker.check_params(body,877 required_params=[],878 integer_params=[879 'offset', 'limit'],880 list_params=[881 'hadoops', 'status', 'tags']882 ):883 return None884 return self.send_request(action, body)885 def start_hadoops(self, hadoops,886 **ignore):887 """ Start one or more hadoops.888 @param hadoops: the IDs of the hadoop you want to start.889 """890 action = const.ACTION_START_HADOOPS891 valid_keys = ['hadoops']892 body = filter_out_none(locals(), valid_keys)893 if not self.req_checker.check_params(body,894 required_params=['hadoops'],895 list_params=['hadoops']896 ):897 return None898 return self.send_request(action, body)899 def stop_hadoops(self, hadoops,900 **ignore):901 """ Stop one or more hadoops.902 @param hadoops: the IDs of the hadoop you want to stop.903 """904 action = const.ACTION_STOP_HADOOPS905 valid_keys = ['hadoops']906 body = filter_out_none(locals(), valid_keys)907 if not self.req_checker.check_params(body,908 required_params=['hadoops'],909 list_params=['hadoops']910 ):911 return None912 return self.send_request(action, body)913 def describe_dns_aliases(self, dns_aliases=None,914 resource_id=None,915 offset=None,916 limit=None,917 **ignore):918 """ Describe dns aliases filtered by condition.919 @param dns_aliases: the array of dns alias IDs.920 @param resource_id: search word column.921 @param offset: the starting offset of the returning results.922 @param limit: specify the number of the returning results.923 """924 action = const.ACTION_DESCRIBE_DNS_ALIASES925 valid_keys = ['dns_aliases', 'resource_id', 'offset', 'limit']926 body = filter_out_none(locals(), valid_keys)927 if not self.req_checker.check_params(body,928 required_params=[],929 integer_params=[930 'offset', 'limit'],931 list_params=['dns_aliases']932 ):933 return None934 return self.send_request(action, body)935 def associate_dns_alias(self, prefix,936 resource,937 **ignore):938 """ Associate DNS alias.939 @param prefix: the DNS prefix.940 @param resource: The id of resource you want to associate DNS alias with.941 """942 action = const.ACTION_ASSOCIATE_DNS_ALIAS943 valid_keys = ['prefix', 'resource']944 body = filter_out_none(locals(), valid_keys)945 if not self.req_checker.check_params(body,946 required_params=[947 'prefix', 'resource'],948 list_params=[]949 ):950 return None951 return self.send_request(action, body)952 def dissociate_dns_aliases(self, dns_aliases,953 **ignore):954 """ Dissociate DNS aliases.955 @param dns_aliases: The array of dns alias IDs you want to dissociate.956 """957 action = const.ACTION_DISSOCIATE_DNS_ALIASES958 valid_keys = ['dns_aliases']959 body = filter_out_none(locals(), valid_keys)960 if not self.req_checker.check_params(body,961 required_params=['dns_aliases'],962 list_params=['dns_aliases']963 ):964 return None965 return self.send_request(action, body)966 def get_dns_label(self, **ignore):967 """ Get DNS label and domain name in this zone.968 """969 action = const.ACTION_GET_DNS_LABEL970 valid_keys = []971 body = filter_out_none(locals(), valid_keys)972 if not self.req_checker.check_params(body,973 required_params=[],974 ):975 return None976 return self.send_request(action, body)977 def describe_zookeepers(self, zookeepers=None,978 status=None,979 verbose=0,980 search_word=None,981 owner=None,982 offset=None,983 limit=None,984 tags=None,985 **ignore):986 """ Describe zookeepers filtered by condition.987 @param zookeepers: the array of zookeeper IDs.988 @param status: pending, active, stopped, deleted, suspended, ceased989 @param verbose: the number to specify the verbose level, larger the number, the more detailed information will be returned.990 @param search_word: search word column.991 @param offset: the starting offset of the returning results.992 @param limit: specify the number of the returning results.993 @param tags : the array of IDs of tags.994 """995 action = const.ACTION_DESCRIBE_ZOOKEEPERS996 valid_keys = ['zookeepers', 'status', 'verbose', 'search_word',997 'offset', 'limit', 'tags', 'owner']998 body = filter_out_none(locals(), valid_keys)999 if not self.req_checker.check_params(body,1000 required_params=[],1001 integer_params=[1002 'offset', 'limit'],1003 list_params=['zookeepers', 'tags']1004 ):1005 return None1006 return self.send_request(action, body)1007 def start_zookeepers(self, zookeepers,1008 **ignore):1009 """ Start one or more zookeepers.1010 @param zookeepers: the IDs of the zookeeper you want to start.1011 """1012 action = const.ACTION_START_ZOOKEEPERS1013 valid_keys = ['zookeepers']1014 body = filter_out_none(locals(), valid_keys)1015 if not self.req_checker.check_params(body,1016 required_params=['zookeepers'],1017 list_params=['zookeepers']1018 ):1019 return None1020 return self.send_request(action, body)1021 def stop_zookeepers(self, zookeepers,1022 **ignore):1023 """ Stop one or more zookeepers.1024 @param zookeepers: the IDs of the zookeeper you want to stop.1025 """1026 action = const.ACTION_STOP_ZOOKEEPERS1027 valid_keys = ['zookeepers']1028 body = filter_out_none(locals(), valid_keys)1029 if not self.req_checker.check_params(body,1030 required_params=['zookeepers'],1031 list_params=['zookeepers']1032 ):1033 return None1034 return self.send_request(action, body)1035 def describe_elasticsearchs(self, elasticsearchs=None,1036 status=None,1037 verbose=0,1038 search_word=None,1039 owner=None,1040 offset=None,1041 limit=None,1042 tags=None,1043 **ignore):1044 """ Describe elasticsearchs filtered by condition.1045 @param elasticsearchs: the array of elasticsearchs IDs.1046 @param status: pending, active, stopped, deleted, suspended, ceased1047 @param verbose: the number to specify the verbose level, larger the number, the more detailed information will be returned.1048 @param search_word: search word column.1049 @param offset: the starting offset of the returning results.1050 @param limit: specify the number of the returning results.1051 @param tags : the array of IDs of tags.1052 """1053 action = const.ACTION_DESCRIBE_ELASTICSEARCHS1054 valid_keys = ['elasticsearchs', 'status', 'verbose', 'search_word',1055 'offset', 'limit', 'tags', 'owner']1056 body = filter_out_none(locals(), valid_keys)1057 if not self.req_checker.check_params(body,1058 required_params=[],1059 integer_params=[1060 'offset', 'limit'],1061 list_params=['elasticsearchs', 'tags']1062 ):1063 return None1064 return self.send_request(action, body)1065 def start_elasticsearchs(self, elasticsearchs,1066 **ignore):1067 """ Start one or more elasticsearchs.1068 @param elasticsearchs: the IDs of the elasticsearch you want to start.1069 """1070 action = const.ACTION_START_ELASTICSEARCHS1071 valid_keys = ['elasticsearchs']1072 body = filter_out_none(locals(), valid_keys)1073 if not self.req_checker.check_params(body,1074 required_params=['elasticsearchs'],1075 list_params=['elasticsearchs']1076 ):1077 return None1078 return self.send_request(action, body)1079 def stop_elasticsearchs(self, elasticsearchs,1080 **ignore):1081 """ Stop one or more elasticsearchs.1082 @param elasticsearchs: the IDs of the elasticsearch you want to stop.1083 """1084 action = const.ACTION_STOP_ELASTICSEARCHS1085 valid_keys = ['elasticsearchs']1086 body = filter_out_none(locals(), valid_keys)1087 if not self.req_checker.check_params(body,1088 required_params=['elasticsearchs'],1089 list_params=['elasticsearchs']1090 ):1091 return None1092 return self.send_request(action, body)1093 def describe_queues(self, queues=None,1094 status=None,1095 verbose=0,1096 owner=None,1097 search_word=None,1098 offset=None,1099 limit=None,1100 tags=None,1101 **ignore):1102 """ Describe queues filtered by condition.1103 @param queues: the array of queue IDs.1104 @param status: pending, active, stopped, deleted, suspended, ceased1105 @param verbose: the number to specify the verbose level, larger the number, the more detailed information will be returned.1106 @param search_word: search word column.1107 @param offset: the starting offset of the returning results.1108 @param limit: specify the number of the returning results.1109 @param tags : the array of IDs of tags.1110 """1111 action = const.ACTION_DESCRIBE_QUEUES1112 valid_keys = ['queues', 'status', 'verbose', 'search_word',1113 'offset', 'limit', 'tags', 'owner']1114 body = filter_out_none(locals(), valid_keys)1115 if not self.req_checker.check_params(body,1116 required_params=[],1117 integer_params=[1118 'offset', 'limit'],1119 list_params=[1120 'queues', 'status', 'tags']1121 ):1122 return None1123 return self.send_request(action, body)1124 def start_queues(self, queues,1125 **ignore):1126 """ Start one or more queues.1127 @param queues: the IDs of the queue you want to start.1128 """1129 action = const.ACTION_START_QUEUES1130 valid_keys = ['queues']1131 body = filter_out_none(locals(), valid_keys)1132 if not self.req_checker.check_params(body,1133 required_params=['queues'],1134 list_params=['queues']1135 ):1136 return None1137 return self.send_request(action, body)1138 def stop_queues(self, queues,1139 **ignore):1140 """ Stop one or more queues.1141 @param queues: the IDs of the queue you want to stop.1142 """1143 action = const.ACTION_STOP_QUEUES1144 valid_keys = ['queues']1145 body = filter_out_none(locals(), valid_keys)1146 if not self.req_checker.check_params(body,1147 required_params=['queues'],1148 list_params=['queues']1149 ):1150 return None1151 return self.send_request(action, body)1152 def __getattr__(self, attr):1153 """ Get api functions from each Action class1154 """1155 for action in self.actions:1156 if hasattr(action, attr):1157 return getattr(action, attr)1158 raise InvalidAction(attr)1159 def get_balance(self, **ignore):1160 """Get the balance information filtered by conditions.1161 """1162 action = const.ACTION_GET_BALANCE1163 valid_keys = []1164 body = filter_out_none(locals(), valid_keys)1165 if not self.req_checker.check_params(body):1166 return None1167 return self.send_request(action, body)1168 def get_lease_info(self,1169 resource,1170 user=None,1171 **ignore):1172 """ Get the lease info filtered by conditions.1173 @param resource: the ID of resource.1174 @param user : the ID of user.1175 """1176 action = const.ACTION_GET_LEASE_INFO1177 valid_keys = ['resource', 'user']1178 body = filter_out_none(locals(), valid_keys)1179 if not self.req_checker.check_params(body,1180 required_params=['resource']):1181 return None1182 return self.send_request(action, body)1183 def describe_shared_resource_groups(self,1184 resource_groups=None,1185 owner=None,1186 **ignore):1187 """ Describe resource groups which be shared with oneself.1188 @param resource_groups: An array including IDs of resource groups.1189 @param owner: The people who shares resource groups with oneself.1190 """1191 action = const.ACTION_DESCRIBE_SHARED_RESOURCE_GROUPS1192 valid_keys = ['resource_groups', 'owner']1193 body = filter_out_none(locals(), valid_keys)1194 if not self.req_checker.check_params(body,1195 list_params=['resource_groups']1196 ):1197 return None1198 return self.send_request(action, body)1199 def describe_resource_groups(self,1200 resource_groups=None,1201 search_word=None,1202 limit=None,1203 offset=None,1204 verbose=None,1205 sort_key=None,1206 reverse=None,1207 **ignore):1208 """ Describe the messages of resource groups filtered by condition.1209 @param resource_groups: an array including IDs of resource groups.1210 @param search_word: the search word which can be instance id and instance name.1211 @param limit: specify the number of the returning results.1212 @param offset: the starting offset of the returning results.1213 @param verbose: Whether to return redundant message.1214 if it is 1, return the details of the instance related other resources.1215 @param sort_key: the sort key, which defaults be create_time.1216 @param reverse: 0 for Ascending order, 1 for Descending order.1217 """1218 action = const.ACTION_DESCRIBE_RESOURCE_GROUPS1219 valid_keys = [1220 'resource_groups', 'search_word', 'limit',1221 'offset', 'verbose', 'sort_key', 'reverse'1222 ]1223 body = filter_out_none(locals(), valid_keys)1224 if not self.req_checker.check_params(body,1225 integer_params=[1226 'offset', 'limit',1227 'verbose', 'reverse'1228 ],1229 list_params=['resource_groups']1230 ):1231 return None1232 return self.send_request(action, body)1233 def create_resource_groups(self,1234 resource_group_name=None,1235 description=None,1236 count=None,1237 **ignore):1238 """ Create resource groups.1239 @param resource_group_name: the name of resource groups.1240 @param description: the description of resource groups.1241 @param count: the number of resource groups created at one time.1242 """1243 action = const.ACTION_CREATE_RESOURCE_GROUPS1244 valid_keys = ['resource_group_name', 'description', 'count']1245 body = filter_out_none(locals(), valid_keys)1246 if not self.req_checker.check_params(body,1247 integer_params=['count']1248 ):1249 return None1250 return self.send_request(action, body)1251 def modify_resource_group_attributes(self,1252 resource_group,1253 resource_group_name=None,1254 description=None,1255 **ignore):1256 """ Modify resource group attributes.1257 @param resource_group: The ID of resource group which attributes you want to modify.1258 @param resource_group_name: The new name of the resource group which will be modified.1259 @param description: The description of the resource group.1260 """1261 action = const.ACTION_MODIFY_RESOURCE_GROUP_ATTRIBUTES1262 valid_keys = ['resource_group', 'resource_group_name', 'description']1263 body = filter_out_none(locals(), valid_keys)1264 if not self.req_checker.check_params(body,1265 required_params=['resource_group']1266 ):1267 return None1268 return self.send_request(action, body)1269 def delete_resource_groups(self,1270 resource_groups,1271 **ignore):1272 """ Delete resource groups.1273 @param resource_groups: An array including IDs of the resource groups which you want to delete.1274 """1275 action = const.ACTION_DELETE_RESOURCE_GROUPS1276 valid_keys = ['resource_groups']1277 body = filter_out_none(locals(), valid_keys)1278 if not self.req_checker.check_params(body,1279 required_params=['resource_groups'],1280 list_params=['resource_groups']1281 ):1282 return None1283 return self.send_request(action, body)1284 def describe_resource_group_items(self,1285 resource_groups=None,1286 resources=None,1287 limit=None,1288 offset=None,1289 verbose=None,1290 sort_key=None,1291 reverse=None,1292 **ignore):1293 """ Describe the items of resource groups filtered by condition.1294 @param resource_groups: an array including IDs of resource groups.1295 @param resources: an array including IDs of resources, used to query all resource groups for the resource.1296 @param limit: specify the number of the returning results.1297 @param offset: the starting offset of the returning results.1298 @param verbose: Whether to return redundant message.1299 if it is 1, return the details of the instance related other resources.1300 @param sort_key: the sort key, which defaults be create_time.1301 @param reverse: 0 for ascending order, 1 for descending order.1302 """1303 action = const.ACTION_DESCRIBE_RESOURCE_GROUP_ITEMS1304 valid_keys = [1305 'resource_groups', 'search_word', 'limit',1306 'offset', 'verbose', 'sort_key', 'reverse'1307 ]1308 body = filter_out_none(locals(), valid_keys)1309 if not self.req_checker.check_params(body,1310 integer_params=[1311 'offset', 'limit',1312 'verbose', 'reverse'1313 ],1314 list_params=['resource_groups', 'resources']1315 ):1316 return None1317 return self.send_request(action, body)1318 def add_resource_group_items(self,1319 resource_group,1320 resources,1321 **ignore):1322 """ Add resources to the specified resource group.1323 @param resource_group: the ID of the resource group.1324 @param resources: a list of resources which you want to add.1325 """1326 action = const.ACTION_ADD_RESOURCE_GROUP_ITEMS1327 valid_keys = ['resource_group', 'resources']1328 body = filter_out_none(locals(), valid_keys)1329 if not self.req_checker.check_params(body,1330 required_params=['resource_group', 'resources'],1331 list_params=['resources']1332 ):1333 return None1334 return self.send_request(action, body)1335 def delete_resource_group_items(self,1336 resource_group,1337 resources,1338 **ignore):1339 """ Delete resources from the specified resource group.1340 @param resource_group: the ID of the resource group.1341 @param resources: An array including IDs of resources which you want to delete.1342 """1343 action = const.ACTION_DELETE_RESOURCE_GROUP_ITEMS1344 valid_keys = ['resource_group', 'resources']1345 body = filter_out_none(locals(), valid_keys)1346 if not self.req_checker.check_params(body,1347 required_params=['resource_group', 'resources'],1348 list_params=['resources']1349 ):1350 return None1351 return self.send_request(action, body)1352 def describe_user_groups(self,1353 user_groups=None,1354 status=None,1355 search_word=None,1356 limit=None,1357 offset=None,1358 verbose=None,1359 sort_key=None,1360 reverse=None,1361 **ignore):1362 """ Describe the messages of user groups filtered by condition.1363 @param user_groups: an array including IDs of user groups.1364 @param status: an array including filtering status.1365 @param search_word: the search word which can be instance id and instance name.1366 @param limit: specify the number of the returning results.1367 @param offset: the starting offset of the returning results.1368 @param verbose: Whether to return redundant message.1369 if it is 1, return the details of the instance related other resources.1370 @param sort_key: the sort key, which defaults be create_time.1371 @param reverse: 0 for Ascending order, 1 for Descending order.1372 """1373 action = const.ACTION_DESCRIBE_USER_GROUPS1374 valid_keys = [1375 'user_groups', 'status',1376 'search_word', 'limit',1377 'offset', 'verbose',1378 'sort_key', 'reverse'1379 ]1380 body = filter_out_none(locals(), valid_keys)1381 if not self.req_checker.check_params(body,1382 integer_params=[1383 'offset', 'limit',1384 'verbose', 'reverse'1385 ],1386 list_params=['user_groups', 'status']1387 ):1388 return None1389 return self.send_request(action, body)1390 def create_user_groups(self,1391 user_group_name=None,1392 description=None,1393 count=None,1394 **ignore):1395 """ Create user groups.1396 @param user_group_name: the name of user groups.1397 @param description: the description of user groups.1398 @param count: the number of user groups created at one time, defaults 1.1399 """1400 action = const.ACTION_CREATE_USER_GROUPS1401 valid_keys = ['user_group_name', 'description', 'count']1402 body = filter_out_none(locals(), valid_keys)1403 if not self.req_checker.check_params(body,1404 integer_params=['count']1405 ):1406 return None1407 return self.send_request(action, body)1408 def modify_user_group_attributes(self,1409 user_group,1410 user_group_name=None,1411 description=None,1412 status=None,1413 **ignore):1414 """ Modify user group attributes.1415 @param user_group: The ID of user group which attributes you want to modify.1416 @param user_group_name: The new name of the user group which will be modified.1417 @param description: The description of the resource group.1418 @param status: the status of user group.1419 """1420 action = const.ACTION_MODIFY_USER_GROUP_ATTRIBUTES1421 valid_keys = ['user_group', 'user_group_name', 'description', 'status']1422 body = filter_out_none(locals(), valid_keys)1423 if not self.req_checker.check_params(body,1424 required_params=['user_group']1425 ):1426 return None1427 return self.send_request(action, body)1428 def delete_user_groups(self,1429 user_groups,1430 **ignore):1431 """ Delete the specified user groups.1432 @param user_groups: An array including the IDs of the user groups.1433 """1434 action = const.ACTION_DELETE_USER_GROUPS1435 valid_keys = ['user_groups']1436 body = filter_out_none(locals(), valid_keys)1437 if not self.req_checker.check_params(body,1438 required_params=['user_groups'],1439 list_params=['user_groups']1440 ):1441 return None1442 return self.send_request(action, body)1443 def describe_user_group_members(self,1444 user_groups=None,1445 users=None,1446 status=None,1447 search_word=None,1448 limit=None,1449 offset=None,1450 verbose=None,1451 sort_key=None,1452 reverse=None,1453 **ignore):1454 """ Describe the messages of user group members filtered by condition.1455 @param user_groups: an array including IDs of user groups.1456 @param users: an array including IDs of users.1457 @param status: an array including filtering status.1458 @param search_word: the search word which can be instance id and instance name.1459 @param limit: specify the number of the returning results.1460 @param offset: the starting offset of the returning results.1461 @param verbose: Whether to return redundant message.1462 if it is 1, return the details of the instance related other resources.1463 @param sort_key: the sort key, which defaults be create_time.1464 @param reverse: 0 for Ascending order, 1 for Descending order.1465 """1466 action = const.ACTION_DESCRIBE_USER_GROUP_MEMBERS1467 valid_keys = [1468 'user_groups', 'users', 'status',1469 'search_word', 'limit', 'offset',1470 'verbose', 'sort_key', 'reverse'1471 ]1472 body = filter_out_none(locals(), valid_keys)1473 if not self.req_checker.check_params(body,1474 integer_params=[1475 'offset', 'limit',1476 'verbose', 'reverse'1477 ],1478 list_params=['user_groups', 'users', 'status']1479 ):1480 return None1481 return self.send_request(action, body)1482 def add_user_group_members(self,1483 user_group,1484 users,1485 **ignore):1486 """ Add users to the specified user group.1487 @param user_group: the ID of the user group.1488 @param users: an array including IDs or emails of users which you want to add.1489 """1490 action = const.ACTION_ADD_USER_GROUP_MEMBERS1491 valid_keys = ['user_group', 'users']1492 body = filter_out_none(locals(), valid_keys)1493 if not self.req_checker.check_params(body,1494 required_params=['user_group', 'users'],1495 list_params=['users']1496 ):1497 return None1498 return self.send_request(action, body)1499 def modify_user_group_member_attributes(self,1500 user_group,1501 user,1502 remarks=None,1503 status=None,1504 **ignore):1505 """ Modify user group member attributes.1506 @param user_group: The ID of user group which attributes you want to modify.1507 @param user: The ID of user which attributes you want to modify.1508 @param remarks: The remarks information.1509 @param status: The status of user group.1510 """1511 action = const.ACTION_MODIFY_USER_GROUP_MEMBER_ATTRIBUTES1512 valid_keys = ['user_group', 'user', 'remarks', 'status']1513 body = filter_out_none(locals(), valid_keys)1514 if not self.req_checker.check_params(body,1515 required_params=['user_group', 'user']1516 ):1517 return None1518 return self.send_request(action, body)1519 def delete_user_group_members(self,1520 user_group,1521 users,1522 **ignore):1523 """ Delete the specified user group members.1524 @param user_group: the ID of the specified user group.1525 @param users: an array including IDs of users which you want delete.1526 """1527 action = const.ACTION_DELETE_USER_GROUP_MEMBERS1528 valid_keys = ['user_group', 'users']1529 body = filter_out_none(locals(), valid_keys)1530 if not self.req_checker.check_params(body,1531 required_params=['user_group', 'users'],1532 list_params=['users']1533 ):1534 return None1535 return self.send_request(action, body)1536 def describe_group_roles(self,1537 group_roles=None,1538 status=None,1539 search_word=None,1540 limit=None,1541 offset=None,1542 verbose=None,1543 sort_key=None,1544 reverse=None,1545 **ignore):1546 """ Describe the group roles filtered by condition.1547 @param group_roles: an array including IDs of user group roles.1548 @param status: an array including role status.1549 @param search_word: the search word which can be instance id and instance name.1550 @param limit: specify the number of the returning results.1551 @param offset: the starting offset of the returning results.1552 @param verbose: Whether to return redundant message.1553 if it is 1, return the details of the instance related other resources.1554 @param sort_key: the sort key, which defaults be create_time.1555 @param reverse: 0 for Ascending order, 1 for Descending order.1556 """1557 action = const.ACTION_DESCRIBE_GROUP_ROLES1558 valid_keys = [1559 'group_roles', 'status',1560 'search_word', 'limit',1561 'offset', 'verbose',1562 'sort_key', 'reverse'1563 ]1564 body = filter_out_none(locals(), valid_keys)1565 if not self.req_checker.check_params(body,1566 integer_params=[1567 'offset', 'limit',1568 'verbose', 'reverse'1569 ],1570 list_params=['group_roles', 'status']1571 ):1572 return None1573 return self.send_request(action, body)1574 def create_group_roles(self,1575 role_type,1576 group_role_name=None,1577 description=None,1578 count=None,1579 **ignore):1580 """ Create group roles.1581 @param role_type: the type of role, Currently only support 'rule'.1582 @param group_role_name: the name of group role.1583 @param description: the description of group role.1584 @param count: the number of user roles created at one time.1585 """1586 action = const.ACTION_CREATE_GROUP_ROLES1587 valid_keys = ['role_type', 'group_role_name', 'description', 'count']1588 body = filter_out_none(locals(), valid_keys)1589 if not self.req_checker.check_params(body,1590 required_params=['role_type'],1591 integer_params=['count']1592 ):1593 return None1594 return self.send_request(action, body)1595 def modify_group_role_attributes(self,1596 group_role,1597 role_type=None,1598 group_role_name=None,1599 description=None,1600 status=None,1601 **ignore):1602 """ Modify group role attributes.1603 @param group_role: The ID of group role which attributes you want to modify.1604 @param role_type: The type of role, Currently only support 'rule'.1605 @param group_role_name: The name of group role.1606 @param description: the description of group role.1607 @param status: The status of group role which could be 'disabled' or 'enabled'.1608 """1609 action = const.ACTION_MODIFY_GROUP_ROLE_ATTRIBUTES1610 valid_keys = [1611 'group_role', 'role_type', 'group_role_name', 'description', 'status'1612 ]1613 body = filter_out_none(locals(), valid_keys)1614 if not self.req_checker.check_params(body,1615 required_params=['group_role']1616 ):1617 return None1618 return self.send_request(action, body)1619 def delete_group_roles(self,1620 group_roles,1621 **ignore):1622 """ Delete the specified user group members.1623 @param group_roles: an array including the IDs of group roles.1624 """1625 action = const.ACTION_DELETE_GROUP_ROLES1626 valid_keys = ['group_roles']1627 body = filter_out_none(locals(), valid_keys)1628 if not self.req_checker.check_params(body,1629 required_params=['group_roles'],1630 list_params=['group_roles']1631 ):1632 return None1633 return self.send_request(action, body)1634 def describe_group_role_rules(self,1635 group_role_rules=None,1636 group_roles=None,1637 status=None,1638 limit=None,1639 offset=None,1640 verbose=None,1641 sort_key=None,1642 reverse=None,1643 **ignore):1644 """ Describe the group role rules filtered by condition.1645 @param group_role_rules: an array including IDs of group role rules.1646 @param group_roles: an array including IDs of group roles.1647 @param status: an array including status which could be 'disabled' or 'enabled'.1648 @param limit: specify the number of the returning results.1649 @param offset: the starting offset of the returning results.1650 @param verbose: Whether to return redundant message.1651 if it is 1, return the details of the instance related other resources.1652 @param sort_key: the sort key, which defaults be create_time.1653 @param reverse: 0 for Ascending order, 1 for Descending order.1654 """1655 action = const.ACTION_DESCRIBE_GROUP_ROLE_RULES1656 valid_keys = [1657 'group_role_rules', 'group_roles',1658 'status', 'limit', 'offset',1659 'verbose', 'sort_key', 'reverse'1660 ]1661 body = filter_out_none(locals(), valid_keys)1662 if not self.req_checker.check_params(body,1663 integer_params=[1664 'offset', 'limit',1665 'verbose', 'reverse'1666 ],1667 list_params=[1668 'group_role_rules', 'group_roles', 'status'1669 ]1670 ):1671 return None1672 return self.send_request(action, body)1673 def add_group_role_rules(self,1674 group_role,1675 policy,1676 description=None,1677 **ignore):1678 """ Add rules to the specified group role.1679 @param group_role: the ID of the group role.1680 @param policy: the policy whose format is 'resource_typeor.operation_type'.1681 See: https://docs.qingcloud.com/api/resource_acl/AddGroupRoleRules.html1682 @param description: the description of rule.1683 """1684 action = const.ACTION_ADD_GROUP_ROLE_RULES1685 valid_keys = ['group_role', 'policy', 'description']1686 body = filter_out_none(locals(), valid_keys)1687 if not self.req_checker.check_params(body,1688 required_params=['group_role', 'policy'],1689 ):1690 return None1691 return self.send_request(action, body)1692 def modify_group_role_rule_attributes(self,1693 group_role_rule,1694 description=None,1695 policy=None,1696 **ignore):1697 """ Modify group role rule attributes.1698 @param group_role_rule: the ID of group role rule whose attributes you want to modify.1699 @param description: the description of group role rule.1700 @param policy: the policy whose format is 'resource_type' or 'operation_type'.1701 """1702 action = const.ACTION_MODIFY_GROUP_ROLE_RULE_ATTRIBUTES1703 valid_keys = ['group_role_rule', 'description', 'policy']1704 body = filter_out_none(locals(), valid_keys)1705 if not self.req_checker.check_params(body,1706 required_params=['group_role_rule']1707 ):1708 return None1709 return self.send_request(action, body)1710 def delete_group_role_rules(self,1711 group_role_rules=None,1712 group_roles=None,1713 **ignore):1714 """ Delete some rules of group role.1715 @param group_role_rules: an array including the IDs of group role rules.1716 @param group_roles: an array including the IDs of group roles.1717 """1718 action = const.ACTION_DELETE_GROUP_ROLE_RULES1719 valid_keys = ['group_role_rules', 'group_roles']1720 body = filter_out_none(locals(), valid_keys)1721 if not self.req_checker.check_params(body,1722 list_params=['group_role_rules', 'group_roles']1723 ):1724 return None1725 return self.send_request(action, body)1726 def grant_resource_groups_to_user_groups(self,1727 rur_set,1728 **ignore):1729 """ Grant the resource groups to user groups.1730 @param rur_set: a list which contains ID of resource group,1731 ID of user group and ID of group role.1732 """1733 action = const.ACTION_GRANT_RESOURCE_GROUPS_TO_USER_GROUPS1734 valid_keys = ['rur_set']1735 body = filter_out_none(locals(), valid_keys)1736 if not self.req_checker.check_params(body,1737 required_params=['rur_set'],1738 list_params=['rur_set']1739 ):1740 return None1741 if not self.req_checker.check_sg_rules(body.get('rur_set', [])):1742 return None1743 return self.send_request(action, body)1744 def revoke_resource_groups_from_user_groups(self,1745 ru_set,1746 resource_groups=None,1747 user_groups=None,1748 group_roles=None,1749 **ignore):1750 """ Revoke the resource groups from user groups.1751 @param ru_set: a list which contains ID of resource group and ID of user group.1752 @param resource_groups: an array including IDs of resource groups.1753 if it is not empty, will revoke all authorization relationships of specified resource groups.1754 @param user_groups: an array including IDs of user groups.1755 if it is not empty, will revoke all authorization relationships of specified user groups.1756 @param group_roles: an array including IDs of group roles.1757 if it is not empty, will revoke all authorization relationships of specified group roles.1758 """1759 action = const.ACTION_REVOKE_RESOURCE_GROUPS_FROM_USER_GROUPS1760 valid_keys = [1761 'ru_set', 'resource_groups', 'user_groups', 'group_roles'1762 ]1763 body = filter_out_none(locals(), valid_keys)1764 if not self.req_checker.check_params(body,1765 required_params=['ru_set'],1766 list_params=[1767 'ru_set', 'resource_groups',1768 'user_groups', 'group_roles'1769 ]1770 ):1771 return None1772 if not self.req_checker.check_sg_rules(body.get('ru_set', [])):1773 return None1774 return self.send_request(action, body)1775 def describe_resource_user_groups(self,1776 resource_groups=None,1777 user_groups=None,1778 group_roles=None,1779 limit=None,1780 offset=None,1781 verbose=None,1782 sort_key=None,1783 reverse=None,1784 **ignore):1785 """ Describe the authorization relations between resource groups and user groups.1786 @param resource_groups: an array including IDs of resource groups.1787 @param user_groups: an array including IDs of user groups.1788 @param group_roles: an array including IDs of group roles.1789 @param limit: specify the number of the returning results.1790 @param offset: the starting offset of the returning results.1791 @param verbose: Whether to return redundant message.1792 if it is 1, return the details of the instance related other resources.1793 @param sort_key: the sort key, which defaults be create_time.1794 @param reverse: 0 for Ascending order, 1 for Descending order.1795 """1796 action = const.ACTION_DESCRIBE_RESOURCE_USER_GROUPS1797 valid_keys = [1798 'resource_groups', 'user_groups',1799 'group_roles', 'limit', 'offset',1800 'verbose', 'sort_key', 'reverse'1801 ]1802 body = filter_out_none(locals(), valid_keys)1803 if not self.req_checker.check_params(body,1804 integer_params=[1805 'offset', 'limit',1806 'verbose', 'reverse'1807 ],1808 list_params=[1809 'resource_groups',1810 'user_groups',1811 'group_roles'1812 ]1813 ):1814 return None1815 return self.send_request(action, body)1816 def create_notification_list(self, notification_list_name,1817 notification_items,1818 **ignore):1819 """ Create new notification list.1820 @param notification_list_name: the name of the notification list.1821 @param notification_items: an array including IDs of the notification items.1822 """1823 action = const.ACTION_CREATE_NOTIFICATION_LIST1824 valid_keys = ['notification_list_name', 'notification_items']1825 body = filter_out_none(locals(), valid_keys)1826 if not self.req_checker.check_params(body,1827 required_params=['notification_list_name', 'notification_items'],1828 list_params=['notification_items']1829 ):1830 return None1831 return self.send_request(action, body)1832 def describe_notification_lists(self, notification_lists=None,1833 search_word=None,1834 offset=None,1835 limit=None,1836 **ignore):1837 """ Describe notification lists filtered by condition.1838 @param notification_lists: an array including the IDs of the notification lists.1839 @param search_word: the search word of notification list name.1840 @param offset: the starting offset of the returning results.1841 @param limit: specify the number of the returning results.1842 """1843 action = const.ACTION_DESCRIBE_NOTIFICATION_LISTS1844 valid_keys = ['notification_lists', 'search_word', 'offset', 'limit']1845 body = filter_out_none(locals(), valid_keys)1846 if not self.req_checker.check_params(body,1847 required_params=[],1848 integer_params=['offset', 'limit'],1849 list_params=['notification_lists']):1850 return None1851 return self.send_request(action, body)1852 def modify_notification_list_attributes(self, notification_list,1853 notification_list_name=None,1854 notification_items=None,1855 **ignore):1856 """ Modify notification list attributes.1857 @param notification_list: The ID of notification list which attributes you want to modify.1858 @param notification_list_name: The new name of the notification list which will be modified.1859 @param notification_items: An array including IDs of notification items.1860 """1861 action = const.ACTION_MODIFY_NOTIFICATION_LIST_ATTRIBUTES1862 valid_keys = ['notification_list', 'notification_list_name', 'notification_items']1863 body = filter_out_none(locals(), valid_keys)1864 if not self.req_checker.check_params(body,1865 required_params=['notification_list'],1866 integer_params=[],1867 list_params=['notification_items']1868 ):1869 return None1870 return self.send_request(action, body)1871 def delete_notification_lists(self, notification_lists,1872 **ignore):1873 """ Delete one or more notification lists.1874 the notification list will not be deleted along with the notification items.1875 @param notification_lists: An array including IDs of the notification lists which you want to delete.1876 """1877 action = const.ACTION_DELETE_NOTIFICATION_LISTS1878 valid_keys = ['notification_lists']1879 body = filter_out_none(locals(), valid_keys)1880 if not self.req_checker.check_params(body,1881 required_params=['notification_lists'],1882 integer_params=[],1883 list_params=['notification_lists']1884 ):1885 return None1886 return self.send_request(action, body)1887 def create_notification_items(self, notification_items,1888 **ignore):1889 """ Create new notification items.1890 @param notification_items: The message of notification items,each item in the array is an Object,1891 including 'content','notification_item_type' and 'remarks'.1892 """1893 action = const.ACTION_CREATE_NOTIFICATION_ITEMS1894 valid_keys = ['notification_items']1895 body = filter_out_none(locals(), valid_keys)1896 if not self.req_checker.check_params(body,1897 required_params=['notification_items'],1898 integer_params=[],1899 list_params=['notification_items']1900 ):1901 return None1902 return self.send_request(action, body)1903 def describe_notification_items(self,1904 notification_items=None,1905 notification_list=None,1906 notification_item_type=None,1907 offset=None,1908 limit=None,1909 **ignore):1910 """ Describe notification items filtered by condition.1911 @param notification_items: An array including IDs of notification items.1912 @param notification_list: The ID of notification list.1913 @param notification_item_type: The type of notification item, including 'email', 'phone' and 'webhook'.1914 @param offset: the starting offset of the returning results.1915 @param limit: specify the number of the returning results.1916 """1917 action = const.ACTION_DESCRIBE_NOTIFICATION_ITEMS1918 valid_keys = ['notification_items', 'notification_list', 'notification_item_type', 'offset', 'limit']1919 body = filter_out_none(locals(), valid_keys)1920 if not self.req_checker.check_params(body,1921 integer_params=['offset', 'limit'],1922 list_params=['notification_items']1923 ):1924 return None1925 return self.send_request(action, body)1926 def delete_notification_items(self, notification_items,1927 **ignore):1928 """ Delete one or more notification items.1929 @param notification_items: An array including IDs of the notification items which you want to delete.1930 """1931 action = const.ACTION_DELETE_NOTIFICATION_ITEMS1932 valid_keys = ['notification_items']1933 body = filter_out_none(locals(), valid_keys)1934 if not self.req_checker.check_params(body,1935 required_params=['notification_items'],1936 integer_params=[],1937 list_params=['notification_items']1938 ):1939 return None1940 return self.send_request(action, body)1941 def verify_notification_item(self,1942 notification_item_content,1943 verification_code,1944 **ignore):1945 """ Verify the notification item.1946 All notification items need to be verified to receive notifications.1947 @param notification_item_content: The content of notification item which will be verified.1948 @param verification_code: The verification code.1949 """1950 action = const.ACTION_VERIFY_NOTIFICATION_ITEM1951 valid_keys = ['notification_item_content', 'verification_code']1952 body = filter_out_none(locals(), valid_keys)1953 if not self.req_checker.check_params(body,1954 required_params=['notification_item_content', 'verification_code'],1955 integer_params=[],1956 list_params=[]1957 ):1958 return None...
s2.py
Source:s2.py
...40 valid_keys = [41 'vxnet', 'service_type', 's2_server_name', 's2_server_type',42 'private_ip', 'description', 's2_class',43 ]44 body = filter_out_none(locals(), valid_keys)45 if not self.conn.req_checker.check_params(46 body,47 integer_params=["s2_server_type", "s2_class"],48 ):49 return None50 return self.conn.send_request(action, body)51 def describe_s2_servers(self,52 s2_servers=None,53 service_types=None,54 status=None,55 search_word=None,56 tags=None,57 verbose=None,58 offset=None,59 limit=None,60 **ignore):61 """ Describe S2 servers62 :param s2_servers: the IDs of s2 server you want to describe.63 :param service_types: the type of service, valid value is 'vsan' or 'vnas'.64 :param status: valid values include pending, active, poweroffed, suspended, deleted, ceased.65 :param search_word: you may use this field to search from id, name and description.66 :param tags: the array of IDs of tags.67 :param verbose: the number to specify the verbose level, larger the number, the more detailed information will be returned.68 :param offset: the starting offset of the returning results.69 :param limit: specify the number of the returning results.70 """71 action = const.ACTION_DESCRIBE_S2_SERVERS72 valid_keys = [73 's2_servers', 'service_types', 'status', 'search_word',74 'tags', 'verbose', 'offset', 'limit',75 ]76 body = filter_out_none(locals(), valid_keys)77 if not self.conn.req_checker.check_params(78 body,79 integer_params=["offset", "limit", "verbose"],80 list_params=["s2_servers", "service_types", "tags", "status"],81 ):82 return None83 return self.conn.send_request(action, body)84 def modify_s2_server(self,85 s2_server,86 s2_server_name=None,87 description=None,88 **ignore):89 """ Modify S2 server90 :param s2_server: the ID of s2 server.91 :param s2_server_name: the new name you want to use.92 :param description: the new value of description.93 """94 action = const.ACTION_MODIFY_S2_SERVER95 valid_keys = [96 's2_server', 's2_server_name', 'description',97 ]98 body = filter_out_none(locals(), valid_keys)99 return self.conn.send_request(action, body)100 def resize_s2_servers(self,101 s2_servers,102 s2_server_type,103 **ignore):104 """ Resize S2 servers105 :param s2_servers: the IDs of s2 servers you want to resize.106 :param s2_server_type: valid values includes 0, 1, 2, 3.107 """108 action = const.ACTION_RESIZE_S2_SERVERS109 valid_keys = [110 's2_servers', 's2_server_type'111 ]112 body = filter_out_none(locals(), valid_keys)113 if not self.conn.req_checker.check_params(114 body,115 integer_params=['s2_server_type'],116 list_params=['s2_servers'],117 ):118 return None119 return self.conn.send_request(action, body)120 def delete_s2_servers(self,121 s2_servers,122 **ignore):123 """ Delete S2 servers124 :param s2_servers: the IDs of s2 servers you want to delete.125 """126 action = const.ACTION_DELETE_S2_SERVERS127 valid_keys = [128 's2_servers'129 ]130 body = filter_out_none(locals(), valid_keys)131 if not self.conn.req_checker.check_params(132 body,133 list_params=['s2_servers'],134 ):135 return None136 return self.conn.send_request(action, body)137 def poweron_s2_servers(self,138 s2_servers,139 **ignore):140 """ PowerOn S2 servers141 :param s2_servers: the IDs of s2 servers you want to power on.142 """143 action = const.ACTION_POWERON_S2_SERVERS144 valid_keys = [145 's2_servers',146 ]147 body = filter_out_none(locals(), valid_keys)148 if not self.conn.req_checker.check_params(149 body,150 list_params=['s2_servers'],151 ):152 return None153 return self.conn.send_request(action, body)154 def poweroff_s2_servers(self,155 s2_servers,156 **ignore):157 """ PowerOff S2 servers158 :param s2_servers: the IDs of s2 servers you want to power off.159 """160 action = const.ACTION_POWEROFF_S2_SERVERS161 valid_keys = [162 's2_servers',163 ]164 body = filter_out_none(locals(), valid_keys)165 if not self.conn.req_checker.check_params(166 body,167 list_params=['s2_servers'],168 ):169 return None170 return self.conn.send_request(action, body)171 def update_s2_servers(self,172 s2_servers,173 **ignore):174 """ Update S2 servers175 :param s2_servers: the IDs of s2 servers you want to update.176 """177 action = const.ACTION_UPDATE_S2_SERVERS178 valid_keys = [179 's2_servers',180 ]181 body = filter_out_none(locals(), valid_keys)182 if not self.conn.req_checker.check_params(183 body,184 list_params=['s2_servers'],185 ):186 return None187 return self.conn.send_request(action, body)188 def change_s2_server_vxnet(self,189 s2_server,190 vxnet,191 private_ip=None,192 **ignore):193 """ Change S2 server vxnet194 :param s2_server: the ID of s2 server.195 :param vxnet: the ID of vxnet.196 :param private_ip: you may specify the ip address of this server.197 """198 action = const.ACTION_CHANGE_S2_SERVER_VXNET199 valid_keys = [200 's2_server', 'vxnet', 'private_ip',201 ]202 body = filter_out_none(locals(), valid_keys)203 return self.conn.send_request(action, body)204 def create_s2_shared_target(self,205 s2_server_id,206 export_name,207 target_type,208 description=None,209 volumes=None,210 initiator_names=None,211 **ignore):212 """ Create S2 shared target213 :param s2_server_id: the ID of s2 server.214 :param export_name: the name of shared target.215 :param target_type: valid values includes 'ISCSI', 'FCoE','NFS' and 'SMB'.216 :param description: the detailed description of the resource.217 :param volumes: the IDs of volumes will be attached as backstore.218 :param initiator_names: specify client IQN, available in vsan.219 """220 action = const.ACTION_CREATE_S2_SHARED_TARGET221 valid_keys = [222 's2_server_id', 'export_name', 'target_type',223 'description', 'volumes', 'initiator_names',224 ]225 body = filter_out_none(locals(), valid_keys)226 if not self.conn.req_checker.check_params(227 body,228 list_params=['volumes', 'initiator_names'],229 ):230 return None231 return self.conn.send_request(action, body)232 def describe_s2_shared_targets(self,233 shared_targets=None,234 target_types=None,235 s2_server_id=None,236 export_name=None,237 search_word=None,238 verbose=None,239 offset=None,240 limit=None,241 **ignore):242 """ Describe S2 servers243 :param shared_targets: the IDs of shared targets.244 :param target_types: valid values includes 'ISCSI', 'FCoE','NFS' and 'SMB'.245 :param s2_server_id: the ID of s2 server.246 :param export_name: the name of shared target.247 :param search_word: you may use this field to search from export_name or description.248 :param verbose: the number to specify the verbose level, larger the number, the more detailed information will be returned.249 :param offset: the starting offset of the returning results.250 :param limit: specify the number of the returning results.251 """252 action = const.ACTION_DESCRIBE_S2_SHARED_TARGETS253 valid_keys = [254 'shared_targets', 'target_types', 's2_server_id', 'export_name',255 'search_word', 'verbose', 'offset', 'limit',256 ]257 body = filter_out_none(locals(), valid_keys)258 if not self.conn.req_checker.check_params(259 body,260 integer_params=["limit", "offset", "verbose"],261 list_params=["shared_targets", "target_types"],262 ):263 return None264 return self.conn.send_request(action, body)265 def delete_s2_shared_targets(self,266 shared_targets,267 **ignore):268 """ Delete S2 shared targets269 :param shared_targets: the IDs of shared targets you want to delete.270 """271 action = const.ACTION_DELETE_S2_SHARED_TARGETS272 valid_keys = [273 'shared_targets',274 ]275 body = filter_out_none(locals(), valid_keys)276 if not self.conn.req_checker.check_params(277 body,278 list_params=['shared_targets'],279 ):280 return None281 return self.conn.send_request(action, body)282 def enable_s2_shared_targets(self,283 shared_targets,284 **ignore):285 """ Enable S2 shared targets286 :param shared_targets: the IDs of shared targets you want to enable.287 """288 action = const.ACTION_ENABLE_S2_SHARED_TARGETS289 valid_keys = [290 'shared_targets',291 ]292 body = filter_out_none(locals(), valid_keys)293 if not self.conn.req_checker.check_params(294 body,295 list_params=['shared_targets'],296 ):297 return None298 return self.conn.send_request(action, body)299 def disable_s2_shared_targets(self,300 shared_targets,301 **ignore):302 """ Disable S2 shared targets303 :param shared_targets: the IDs of shared targets you want to disable.304 """305 action = const.ACTION_DISABLE_S2_SHARED_TARGETS306 valid_keys = [307 'shared_targets',308 ]309 body = filter_out_none(locals(), valid_keys)310 if not self.conn.req_checker.check_params(311 body,312 list_params=['shared_targets'],313 ):314 return None315 return self.conn.send_request(action, body)316 def modify_s2_shared_target_attributes(self,317 shared_target,318 operation,319 parameters=None,320 initiator_names=None,321 s2_group=None,322 export_name=None,323 **ignore):324 """ Modify S2 shared target attributes325 :param shared_target: the ID of shared target.326 :param operation: valid values includes add, modify, delete, set.327 :param parameters: please refer https://docs.qingcloud.com/api/s2/describle_s2_default_parameters.html328 :param initiator_names: client IQN.329 :param s2_group: the ID of permission group.330 :param export_name: the name of shared target, available in vnas.331 """332 action = const.ACTION_MODIFY_S2_SHARED_TARGET333 valid_keys = [334 'shared_target', 'operation', 'parameters',335 'initiator_names', 's2_group', 'export_name',336 ]337 body = filter_out_none(locals(), valid_keys)338 if not self.conn.req_checker.check_params(339 body,340 list_params=["initiator_names", "parameters"],341 ):342 return None343 return self.conn.send_request(action, body)344 def attach_to_s2_shared_target(self,345 shared_target,346 volumes,347 **ignore):348 """ Attach to S2 shared target349 :param shared_target: the ID of shared target.350 :param volumes: the IDs of volumes.351 """352 action = const.ACTION_ATTACH_TO_S2_SHARED_TARGET353 valid_keys = [354 'shared_target', 'volumes',355 ]356 body = filter_out_none(locals(), valid_keys)357 if not self.conn.req_checker.check_params(358 body,359 list_params=['volumes'],360 ):361 return None362 return self.conn.send_request(action, body)363 def detach_from_s2_shared_target(self,364 shared_target,365 volumes,366 **ignore):367 """ Detach from s2 shared target368 :param shared_target: the ID of shared target.369 :param volumes: the IDs of volumes.370 """371 action = const.ACTION_DETACH_FROM_S2_SHARED_TARGET372 valid_keys = [373 'shared_target', 'volumes',374 ]375 body = filter_out_none(locals(), valid_keys)376 if not self.conn.req_checker.check_params(377 body,378 list_params=['volumes'],379 ):380 return None381 return self.conn.send_request(action, body)382 def describe_s2_default_parameters(self,383 service_type=None,384 target_type=None,385 offset=None,386 limit=None,387 **ignore):388 """ Describe S2 default parameters389 :param service_type: valid values is vsan or vnas.390 :param target_type: valid values is ISCSI, FCoE, NFS or SMB.391 :param offset: the starting offset of the returning results.392 :param limit: specify the number of the returning results.393 """394 action = const.ACTION_DESCRIBE_S2_DEFAULT_PARAMETERS395 valid_keys = [396 'service_type', 'target_type', 'offset', 'limit',397 ]398 body = filter_out_none(locals(), valid_keys)399 if not self.conn.req_checker.check_params(400 body,401 integer_params=['offset', 'limit'],402 ):403 return None404 return self.conn.send_request(action, body)405 def create_s2_group(self,406 group_type,407 group_name=None,408 s2_accounts=None,409 description=None,410 **ignore):411 """ Create S2 group412 :param group_type: valid values is NFS_GROUP or SMB_GROUP.413 :param group_name: the name of group.414 :param s2_accounts: the IDs of s2 accounts.415 :param description: the detailed description of the resource.416 """417 action = const.ACTION_CREATE_S2_GROUP418 valid_keys = [419 'group_type', 'group_name', 's2_accounts', 'description',420 ]421 body = filter_out_none(locals(), valid_keys)422 return self.conn.send_request(action, body)423 def describe_s2_groups(self,424 s2_groups=None,425 group_types=None,426 group_name=None,427 search_word=None,428 verbose=None,429 offset=None,430 limit=None,431 **ignore):432 """ Describe S2 groups433 :param s2_groups: the IDs of s2 groups.434 :param group_types: valid values is NFS_GROUP or SMB_GROUP.435 :param group_name: the name of group.436 :param search_word: you may use this field to search from id or name.437 :param verbose: the number to specify the verbose level, larger the number, the more detailed information will be returned.438 :param offset: the starting offset of the returning results.439 :param limit: specify the number of the returning results.440 """441 action = const.ACTION_DESCRIBE_S2_GROUPS442 valid_keys = [443 's2_groups', 'group_types', 'account_name', 'search_word',444 'verbose', 'offset', 'limit',445 ]446 body = filter_out_none(locals(), valid_keys)447 if not self.conn.req_checker.check_params(448 body,449 integer_params=['offset', 'limit', 'verbose'],450 list_params=['s2_groups', 'group_types'],451 ):452 return None453 return self.conn.send_request(action, body)454 def modify_s2_group(self,455 s2_group,456 group_name=None,457 s2_accounts=None,458 description=None,459 **ignore):460 """ Modify S2 group461 :param s2_group: the ID of group.462 :param group_name: the name of group.463 :param s2_accounts: the IDs of accounts.464 :param description: the new value of description.465 """466 action = const.ACTION_MODIFY_S2_GROUP467 valid_keys = [468 's2_group', 'group_name', 's2_accounts', 'description',469 ]470 body = filter_out_none(locals(), valid_keys)471 if not self.conn.req_checker.check_params(472 body,473 list_params=['s2_accounts'],474 ):475 return None476 return self.conn.send_request(action, body)477 def delete_s2_group(self,478 s2_groups,479 **ignore):480 """ Delete S2 groups481 :param s2_groups: the IDs of groups.482 """483 action = const.ACTION_DELETE_S2_GROUPS484 valid_keys = [485 's2_groups',486 ]487 body = filter_out_none(locals(), valid_keys)488 if not self.conn.req_checker.check_params(489 body,490 list_params=['s2_groups'],491 ):492 return None493 return self.conn.send_request(action, body)494 def create_s2_account(self,495 account_type,496 account_name=None,497 smb_name=None,498 smb_passwd=None,499 nfs_ipaddr=None,500 s2_groups=None,501 opt_parameters=None,502 description=None,503 **ignore):504 """ Create S2 account505 :param account_type: valid values is NFS or SMB.506 :param account_name: the name of account.507 :param smb_name: the user name of smb.508 :param smb_passwd: the password of smb.509 :param nfs_ipaddr: ip address available in NFS.510 :param s2_groups: the JSON form of groups. e.g. '[{"group_id":"s2g-xxxx", "rw_flag": "rw"}]'511 :param opt_parameters: options parameters for NFS.512 :param description: the detailed description of the resource.513 """514 action = const.ACTION_CREATE_S2_ACCOUNT515 valid_keys = [516 'account_type', 'account_name', 'smb_name', 'smb_passwd',517 'nfs_ipaddr', 's2_groups', 'opt_parameters', 'description',518 ]519 body = filter_out_none(locals(), valid_keys)520 if not self.conn.req_checker.check_params(521 body,522 list_params=["s2_groups"],523 ):524 return None525 return self.conn.send_request(action, body)526 def describe_s2_accounts(self,527 s2_accounts=None,528 account_types=None,529 account_name=None,530 search_word=None,531 verbose=None,532 offset=None,533 limit=None,534 **ignore):535 """ Describe S2 accounts536 :param s2_accounts: the IDs of accounts.537 :param account_types: valid values is NFS or SMB.538 :param account_name: the name of account.539 :param search_word: you may use this field to search from id, account_name nfs_ipaddr or smb_name.540 :param verbose: the number to specify the verbose level, larger the number, the more detailed information will be returned.541 :param offset: the starting offset of the returning results.542 :param limit: specify the number of the returning results.543 """544 action = const.ACTION_DESCRIBE_S2_ACCOUNTS545 valid_keys = [546 's2_accounts', 'account_types', 'account_name', 'search_word',547 'verbose', 'offset', 'limit',548 ]549 body = filter_out_none(locals(), valid_keys)550 if not self.conn.req_checker.check_params(551 body,552 integer_params=["limit", "offset", "verbose"],553 list_params=["s2_accounts", "account_types"],554 ):555 return None556 return self.conn.send_request(action, body)557 def modify_s2_account(self,558 s2_account,559 opt_parameters=None,560 account_name=None,561 smb_passwd=None,562 nfs_ipaddr=None,563 description=None,564 **ignore):565 """ Modify S2 account566 :param s2_account: the ID of account.567 :param opt_parameters: the options parameters.568 :param account_name: the new value of account name.569 :param smb_passwd: the new password.570 :param nfs_ipaddr: the new ip address.571 :param description: the new value of description.572 """573 action = const.ACTION_MODIFY_S2_ACCOUNT574 valid_keys = [575 's2_account', 'opt_parameters', 'account_name', 'smb_passwd',576 'nfs_ipaddr', 'description',577 ]578 body = filter_out_none(locals(), valid_keys)579 return self.conn.send_request(action, body)580 def delete_s2_accounts(self,581 s2_accounts,582 **ignore):583 """ Delete S2 accounts584 :param s2_accounts: the IDs of accounts.585 """586 action = const.ACTION_DELETE_S2_ACCOUNTS587 valid_keys = [588 's2_accounts'589 ]590 body = filter_out_none(locals(), valid_keys)591 if not self.conn.req_checker.check_params(592 body,593 list_params=['s2_accounts'],594 ):595 return None596 return self.conn.send_request(action, body)597 def associate_s2_account_group(self,598 s2_group,599 s2_accounts,600 **ignore):601 """ Associate S2 account group602 :param s2_group: the ID of group.603 :param s2_accounts: the JSON form of accounts. e.g. '[{"account_id": "s2a-xxxx", "rw_flag": "rw"}]'604 """605 action = const.ACTION_ASSOCIATE_S2_ACCOUNT_GROUP606 valid_keys = [607 's2_group', 's2_accounts',608 ]609 body = filter_out_none(locals(), valid_keys)610 if not self.conn.req_checker.check_params(611 body,612 list_params=['s2_accounts'],613 ):614 return None615 return self.conn.send_request(action, body)616 def dissociate_s2_account_group(self,617 s2_groups,618 s2_accounts,619 **ignore):620 """ Dissociate S2 account group621 :param s2_groups: the IDs of groups.622 :param s2_accounts: the IDs of accounts.623 """624 action = const.ACTION_DISSOCIATE_S2_ACCOUNT_GROUP625 valid_keys = [626 's2_groups', 's2_accounts',627 ]628 body = filter_out_none(locals(), valid_keys)629 if not self.conn.req_checker.check_params(630 body,631 list_params=['s2_groups', 's2_accounts'],632 ):633 return None...
DOE Demo.py
Source:DOE Demo.py
...143 if found_match_1:144 playbook_demo_child_pb_promote_1(action=action, success=success, container=container, results=results, handle=handle)145 return146 return147def filter_out_none(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, **kwargs):148 phantom.debug("filter_out_none() called")149 # collect filtered artifact ids and results for 'if' condition 1150 matched_artifacts_1, matched_results_1 = phantom.condition(151 container=container,152 conditions=[153 ["locate_source:action_result.data.*.country_name", "!=", ""]154 ],155 name="filter_out_none:condition_1")156 # call connected blocks if filtered artifacts or results157 if matched_artifacts_1 or matched_results_1:158 debug_1(action=action, success=success, container=container, results=results, handle=handle, filtered_artifacts=matched_artifacts_1, filtered_results=matched_results_1)159 # collect filtered artifact ids and results for 'if' condition 2160 matched_artifacts_2, matched_results_2 = phantom.condition(161 container=container,162 conditions=[...
alarm_policy.py
Source:alarm_policy.py
...48 'alarm_policies', 'alarm_policy_name',49 'alarm_policy_type', 'search_word', 'resource',50 'status', 'verbose', 'offset', 'limit', 'tags',51 ]52 body = filter_out_none(locals(), valid_keys)53 if not self.conn.req_checker.check_params(54 body,55 integer_params=['offset', 'limit', 'verbose'],56 list_params=['alarm_policies', 'status', 'tags'],57 ):58 return None59 return self.conn.send_request(action, body)60 def create_alarm_policy(self, alarm_policy_type,61 period,62 alarm_policy_name=None,63 **ignore):64 """ Create an alarm policy.65 @param alarm_policy_type : the type of alarm_policy.66 @param period: the period of alarm_policy. For example: One minute : 1m.67 @param alarm_policy_name: the name of alarm_policy.68 """69 action = const.ACTION_CREATE_ALARM_POLICY70 valid_keys = ['alarm_policy_type', 'period', 'alarm_policy_name']71 body = filter_out_none(locals(), valid_keys)72 if not self.req_checker.check_params(body,73 required_params=['alarm_policy_type', 'period']74 ):75 return None76 return self.send_request(action, body)77 def modify_alarm_policy_attributes(self, alarm_policy,78 alarm_policy_name=None,79 period=None,80 description=None,81 **ignore):82 """ Modify alarm policy attributes.83 @param alarm_policy : the ID of alarm_policy.84 @param alarm_policy_name : the name of alarm_policy.85 @param period: the check period of alarm_policy.86 @param description: the description of alarm_policy.87 """88 action = const.ACTION_MODIFY_ALARM_POLICY_ATTRIBUTES89 valid_keys = ['alarm_policy', 'alarm_policy_name', 'period', 'description']90 body = filter_out_none(locals(), valid_keys)91 if not self.req_checker.check_params(body,92 required_params=['alarm_policy']93 ):94 return None95 return self.send_request(action, body)96 def delete_alarm_policies(self, alarm_policies,97 **ignore):98 """ Delete one or more alarm policies.99 @param alarm_policies : the array of IDs of alarm policies.100 """101 action = const.ACTION_DELETE_ALARM_POLICIES102 valid_keys = ['alarm_policies']103 body = filter_out_none(locals(), valid_keys)104 if not self.req_checker.check_params(body,105 required_params=['alarm_policies'],106 list_params=['alarm_policies']107 ):108 return None109 return self.send_request(action, body)110 def describe_alarm_policy_rules(self, alarm_policy=None,111 alarm_policy_rules=None,112 offset=None,113 limit=None,114 **ignore):115 """ Describe alarm policy rules filtered by conditions.116 @param alarm_policy : the ID of alarm_policy.117 @param alarm_policy_rules : the array of IDs of alarm policy rules.118 @param offset: the starting offset of the returning results.119 @param limit: specify the number of the returning results.120 """121 action = const.ACTION_DESCRIBE_ALARM_POLICY_RULES122 valid_keys = ['alarm_policy', 'alarm_policy_rules', 'offset', 'limit']123 body = filter_out_none(locals(), valid_keys)124 if not self.req_checker.check_params(body,125 integer_params=['offset', 'limit'],126 list_params=['alarm_policy_rules']127 ):128 return None129 return self.send_request(action, body)130 def add_alarm_policy_rules(self, alarm_policy,131 rules,132 **ignore):133 """ Add rules to alarm policy.134 @param alarm_policy: the ID of the alarm policy whose rules you135 want to add.136 @param rules: a list of rules you want to add.137 """138 action = const.ACTION_ADD_ALARM_POLICY_RULES139 valid_keys = ['alarm_policy', 'rules']140 body = filter_out_none(locals(), valid_keys)141 if not self.req_checker.check_params(body,142 required_params=['alarm_policy', 'rules'],143 list_params=['rules']144 ):145 return None146 if not self.req_checker.check_sg_rules(body.get('rules', [])):147 return None148 return self.send_request(action, body)149 def modify_alarm_policy_rule_attributes(self, alarm_policy_rule,150 condition_type,151 thresholds=None,152 alarm_policy_rule_name=None,153 data_processor=None,154 consecutive_periods=None,155 **ignore):156 """ Modify alarm policy rule attributes.157 @param alarm_policy_rule: the ID of the alarm policy rule whose content you158 want to update.159 @param condition_type: gt for greater than, lt for less than.160 @param thresholds: the thresholds of alarm.161 @param alarm_policy_rule_name: the name of the alarm policy rule.162 @param data_processor: raw for use the monitoring data raw value, percent only for IP bandwidth monitoring.163 @param consecutive_periods: during several consecutive inspection periods, the monitoring data reaches the alarm threshold,164 then will trigger the alarm behavior.165 """166 action = const.ACTION_MODIFY_ALARM_POLICY_RULE_ATTRIBUTES167 valid_keys = ['alarm_policy_rule', 'condition_type', 'thresholds',168 'alarm_policy_rule_name', 'data_processor', 'consecutive_periods']169 body = filter_out_none(locals(), valid_keys)170 if not self.req_checker.check_params(body,171 required_params=['alarm_policy_rule', 'condition_type']172 ):173 return None174 return self.send_request(action, body)175 def delete_alarm_policy_rules(self, alarm_policy_rules,176 **ignore):177 """ Delete one or more alarm policy rules.178 @param alarm_policy_rules : the array of IDs of alarm policy rules.179 """180 action = const.ACTION_DELETE_ALARM_POLICY_RULES181 valid_keys = ['alarm_policy_rules']182 body = filter_out_none(locals(), valid_keys)183 if not self.req_checker.check_params(body,184 required_params=['alarm_policy_rules'],185 list_params=['alarm_policy_rules']186 ):187 return None188 return self.send_request(action, body)189 def describe_alarm_policy_actions(self, alarm_policy=None,190 alarm_policy_actions=None,191 offset=None,192 limit=None,193 **ignore):194 """ Describe alarm policy actions filtered by conditions.195 @param alarm_policy : the ID of alarm_policy.196 @param alarm_policy_actions : the array of IDs of alarm policy rules.197 @param offset: the starting offset of the returning results.198 @param limit: specify the number of the returning results.199 """200 action = const.ACTION_DESCRIBE_ALARM_POLICY_ACTIONS201 valid_keys = ['alarm_policy', 'alarm_policy_actions', 'offset', 'limit']202 body = filter_out_none(locals(), valid_keys)203 if not self.req_checker.check_params(body,204 integer_params=['offset', 'limit'],205 list_params=['alarm_policy_actions']206 ):207 return None208 return self.send_request(action, body)209 def add_alarm_policy_actions(self, alarm_policy,210 actions,211 **ignore):212 """ Add actions to alarm policy.213 @param alarm_policy: the ID of the alarm policy whose actions you214 want to add.215 @param actions: a list of actions you want to add.216 """217 action = const.ACTION_ADD_ALARM_POLICY_ACTIONS218 valid_keys = ['alarm_policy', 'actions']219 body = filter_out_none(locals(), valid_keys)220 if not self.req_checker.check_params(body,221 required_params=['alarm_policy', 'actions'],222 list_params=['actions']223 ):224 return None225 if not self.req_checker.check_sg_rules(body.get('actions', [])):226 return None227 return self.send_request(action, body)228 def modify_alarm_policy_action_attributes(self, alarm_policy_action,229 trigger_action=None,230 trigger_status=None,231 **ignore):232 """ Modify alarm policy action attributes.233 @param alarm_policy_action: the ID of the alarm policy action whose content you234 want to update.235 @param trigger_action: the ID of the trigger action.236 @param trigger_status: when the monitor alarm state becomes 'ok' or 'alarm', the message will be sent to this trigger list.237 """238 action = const.ACTION_MODIFY_ALARM_POLICY_ACTION_ATTRIBUTES239 valid_keys = ['alarm_policy_action', 'trigger_action', 'trigger_status']240 body = filter_out_none(locals(), valid_keys)241 if not self.req_checker.check_params(body,242 required_params=['alarm_policy_action']243 ):244 return None245 return self.send_request(action, body)246 def delete_alarm_policy_actions(self, alarm_policy_actions,247 **ignore):248 """ Delete one or more alarm policy actions.249 @param alarm_policy_actions : the array of IDs of alarm policy actions.250 """251 action = const.ACTION_DELETE_ALARM_POLICY_ACTIONS252 valid_keys = ['alarm_policy_actions']253 body = filter_out_none(locals(), valid_keys)254 if not self.req_checker.check_params(body,255 required_params=['alarm_policy_actions'],256 list_params=['alarm_policy_actions']257 ):258 return None259 return self.send_request(action, body)260 def associate_alarm_policy(self, alarm_policy,261 resources,262 related_resource=None,263 **ignore):264 """ Associate an alarm_policy on one or more resources.265 @param alarm_policy: The id of alarm policy you want to associate with resources.266 @param resources: the id of resources you want to associate alarm policy.267 @param related_resource: when the network load balancer is bound,268 related_resource needs to specify a public network IP ID associated with this load balancer.269 """270 action = const.ACTION_ASSOCIATE_ALARM_POLICY271 valid_keys = ['alarm_policy', 'resources', 'related_resource']272 body = filter_out_none(locals(), valid_keys)273 if not self.req_checker.check_params(body,274 required_params=['alarm_policy', 'resources'],275 list_params=['resources']276 ):277 return None278 return self.send_request(action, body)279 def dissociate_alarm_policy(self, alarm_policy,280 resources=None,281 related_resource=None,282 **ignore):283 """ Dissociate alarm policy.284 @param alarm_policy: The id of alarm policy you want to associate with resources.285 @param resources: the id of resources you want to associate alarm policy.286 @param related_resource: when the network load balancer is bound,287 related_resource needs to specify a public network IP ID associated with this load balancer.288 """289 action = const.ACTION_DISSOCIATE_ALARM_POLICY290 valid_keys = ['alarm_policy', 'resources', 'related_resource']291 body = filter_out_none(locals(), valid_keys)292 if not self.req_checker.check_params(body,293 required_params=['alarm_policy'],294 list_params=['resources']295 ):296 return None297 return self.send_request(action, body)298 def apply_alarm_policy(self, alarm_policy,299 **ignore):300 """ Apply alarm policy.301 @param alarm_policy: the ID of alarm policy which would be applied effective.302 """303 action = const.ACTION_APPLY_ALARM_POLICY304 valid_keys = ['alarm_policy']305 body = filter_out_none(locals(), valid_keys)306 if not self.req_checker.check_params(body,307 required_params=['alarm_policy']308 ):309 return None310 return self.send_request(action, body)311 def describe_alarms(self, alarms=None,312 policy=None,313 status=None,314 resource=None,315 offset=None,316 limit=None,317 **ignore):318 """ Describe alarms filtered by condition.319 @param alarms: an array including IDs of the alarms you want to list.320 @param policy: the ID of alarm policy.321 @param status: ok stand for normal, alarm stand for alarming, insufficient stand for monitoring data cannot be collected.322 @param resource: The ID of resource which associated with the alarm.323 @param offset: the starting offset of the returning results.324 @param limit: specify the number of the returning results.325 """326 action = const.ACTION_DESCRIBE_ALARMS327 valid_keys = ['alarms', 'policy', 'status', 'resource', 'offset', 'limit']328 body = filter_out_none(locals(), valid_keys)329 if not self.req_checker.check_params(body,330 integer_params=['offset', 'limit'],331 list_params=['alarms']332 ):333 return None334 return self.send_request(action, body)335 def describe_alarm_history(self, alarm,336 history_type=None,337 offset=None,338 limit=None,339 **ignore):340 """ Describe alarm history filtered by condition.341 @param alarm: the ID of the resource alarm entity.342 @param history_type: the types including trigger_action, status_change, config_update.343 @param offset: the starting offset of the returning results.344 @param limit: specify the number of the returning results.345 """346 action = const.ACTION_DESCRIBE_ALARM_HISTORY347 valid_keys = ['alarm', 'history_type', 'offset', 'limit']348 body = filter_out_none(locals(), valid_keys)349 if not self.req_checker.check_params(body,350 required_params=['alarm'],351 integer_params=['offset', 'limit']352 ):353 return None...
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!