def new_get_login_key_list_as_dict(self): try: get_login_key_list_request = ncloud_server.GetLoginKeyListRequest() api_response = self.get_login_key_list(get_login_key_list_request) return api_response.to_dict() except ApiException as e: print("Exception when calling V2Api->get_login_key_list: %s\n" % e)
def test_server_api(tid, time_to_sleep, api): print('thread %d, now %s, sleep %ss' % (tid, datetime.datetime.now().time(), time_to_sleep)) try: get_login_key_list_request = ncloud_server.GetLoginKeyListRequest() api_response = api.get_login_key_list(get_login_key_list_request) print('thread %d, now: %s, response: %s' % (tid, datetime.datetime.now().time(), api_response)) except ApiException as e: print("Exception when calling V2Api->get_login_key_list: %s\n" % e) print('thread %d, now: %s, end' % (tid, datetime.datetime.now().time()))
def test_get_login_key_list(self): """Test case for get_login_key_list """ get_login_key_list_request = ncloud_server.GetLoginKeyListRequest() try: api_response = self.api.get_login_key_list( get_login_key_list_request) print(api_response) except ApiException as e: print("Exception when calling V2Api->get_login_key_list: %s\n" % e) pass
def new_get_total_info(self): tmp_result_dict = dict() try: get_block_storage_instance_list_request = ncloud_server.GetBlockStorageInstanceListRequest( ) # GetBlockStorageInstanceListRequest | getBlockStorageInstanceListRequest tmp_result_dict["block_storage_instance_list"] = \ self.get_block_storage_instance_list(get_block_storage_instance_list_request).to_dict()[ "block_storage_instance_list"] except ApiException as e: print( "Exception when calling V2Api->get_block_storage_instance_list: %s\n" % e) try: get_init_script_list_rqeust = ncloud_server.GetInitScriptListRequest( ) # GetInitScriptListRequest | getInitScriptListRqeust tmp_result_dict["init_script_list"] = self.get_init_script_list( get_init_script_list_rqeust).to_dict()["init_script_list"] except ApiException as e: print("Exception when calling V2Api->get_init_script_list: %s\n" % e) get_login_key_list_request = ncloud_server.GetLoginKeyListRequest( ) # GetLoginKeyListRequest | getLoginKeyListRequest try: tmp_result_dict["login_key_list"] = self.get_login_key_list( get_login_key_list_request).to_dict()["login_key_list"] except ApiException as e: print("Exception when calling V2Api->get_login_key_list: %s\n" % e) try: get_member_server_image_list_request = ncloud_server.GetMemberServerImageListRequest( ) # GetMemberServerImageListRequest | getMemberServerImageListRequest tmp_result_dict["member_server_image_list"] = \ self.get_member_server_image_list(get_member_server_image_list_request).to_dict()[ "member_server_image_list"] except ApiException as e: print( "Exception when calling V2Api->get_member_server_image_list: %s\n" % e) try: get_region_list_request = ncloud_server.GetRegionListRequest( ) # GetRegionListRequest | getRegionListRequest tmp_result_dict["region_list"] = self.get_region_list( get_region_list_request).to_dict()["region_list"] except ApiException as e: print("Exception when calling V2Api->get_region_list: %s\n" % e) get_server_instance_list_request = ncloud_server.GetServerInstanceListRequest( ) # GetServerInstanceListRequest | getServerInstanceListRequest try: tmp_result_dict["server_instance_list"] = \ self.get_server_instance_list(get_server_instance_list_request).to_dict()["server_instance_list"] except ApiException as e: print( "Exception when calling V2Api->get_server_instance_list: %s\n" % e) try: get_server_image_product_list_request = ncloud_server.GetServerImageProductListRequest( ) # GetServerImageProductListRequest | getServerImageProductListRequest tmp_result_dict["product_list"] = \ self.get_server_image_product_list(get_server_image_product_list_request).to_dict()["product_list"] except ApiException as e: print( "Exception when calling V2Api->get_server_image_product_list: %s\n" % e) return tmp_result_dict
# coding: utf-8 import ncloud_server from ncloud_server.api.v2_api import V2Api from ncloud_server.rest import ApiException from ncloud_apikey.credentials import CredentialsResolver configuration = ncloud_server.Configuration() credentials = CredentialsResolver().load_credentials() configuration.access_key = credentials.access_key configuration.secret_key = credentials.secret_key api = V2Api(ncloud_server.ApiClient(configuration)) get_login_key_list_request = ncloud_server.GetLoginKeyListRequest() try: api_response = api.get_login_key_list(get_login_key_list_request) print(api_response) except ApiException as e: print("Exception when calling V2Api->get_login_key_list: %s\n" % e)