def Describe_Instance(region_id, access_key_id, access_secret): profile = Profile(region_id, access_key_id, access_secret) client = Client(profile) request = DescribeInstances() request.set_method('GET') # 调用旧版request.set_old_version() # 调用v2新版request.set_v2_version(),默认是新版 response = client.get_response(request) dict = json.loads(response) Action = request.get_action() save_log(dict, Action) return dict
def Rebuild_Instance(region_id, access_key_id, access_secret,password,id): profile = Profile(region_id,access_key_id,access_secret) client = Client(profile) request = RebuildInstance() request.set_method('GET') request.set_id(id) # 调用旧版request.set_old_version() # 调用v2新版request.set_v2_version(),默认是新版 response = client.get_response(request) dict = json.loads(response) Action=request.get_action() save_log(dict,Action) return dict
def Change_Instance_Firewall(region_id, access_key_id, access_secret,id,firewall_id): profile = Profile(region_id,access_key_id,access_secret) client = Client(profile) request = ChangeInstanceFirewall() request.set_method('GET') request.set_id(id) request.set_firewall_id(firewall_id) # 调用旧版request.set_old_version() # 调用v2新版request.set_v2_version(),默认是新版 response = client.get_response(request) dict = json.loads(response) Action = request.get_action() save_log(dict, Action) return dict
def Modify_Instance_Attributes(region_id, access_key_id, access_secret, id, name): profile = Profile(region_id, access_key_id, access_secret) client = Client(profile) request = ModifyInstanceAttributes() request.set_method('GET') request.set_id(id) request.set_name(name) # 调用旧版request.set_old_version() # 调用v2新版request.set_v2_version(),默认是新版 response = client.get_response(request) dict = json.loads(response) Action = request.get_action() save_log(dict, Action) return dict
def Instance_Iops_Write_Monitor(region_id, access_key_id, access_secret,start_time,end_time,id): profile = Profile(region_id,access_key_id,access_secret) client = Client(profile) request = InstanceIopsWriteMonitor() request.set_id(id) request.set_start_time(start_time) request.set_end_time(end_time) request.set_method('GET') # 调用旧版request.set_old_version() # 调用v2新版request.set_v2_version(),默认是新版 response = client.get_response(request) dict = json.loads(response) Action=request.get_action() save_log(dict,Action) return dict
def Change_Instance_Interface(region_id, access_key_id, access_secret, instance_id, old_network_id, new_network_id): profile = Profile(region_id, access_key_id, access_secret) client = Client(profile) request = ChangeInstanceInterface() request.set_method('GET') request.set_id(id) request.set_instance_id(instance_id) request.set_old_network_id(old_network_id) request.set_new_network_id(new_network_id) # 调用旧版request.set_old_version() # 调用v2新版request.set_v2_version(),默认是新版 response = client.get_response(request) dict = json.loads(response) Action = request.get_action() save_log(dict, Action) return dict
def Run_Instance(region_id, access_key_id, access_secret, image_id, instance_series, pay_type, period, instance_type, interface0network_id, volumes0type, volumes0size): profile = Profile(region_id, access_key_id, access_secret) client = Client(profile) request = RunInstance() request.set_method('GET') request.set_image_id(image_id) request.set_instance_series(instance_series) request.set_pay_type(pay_type) request.set_period(period) request.set_instance_type(instance_type) request.set_interface0network_id(interface0network_id) request.set_volumes0type(volumes0type) request.set_volumes0size(volumes0size) # 调用旧版request.set_old_version() # 调用v2新版request.set_v2_version(),默认是新版 response = client.get_response(request) dict = json.loads(response) Action = request.get_action() save_log(dict, Action) return dict