@file : DescribeInstancesRequest.py @time : 2018/4/2 15:42 @desc : """ from aliyun_api.common.Slb import UrlRequest from aliyun_api.common.config import Ecs # from aliyun_api.api.SlbBackendServer.config import DescribeHealthStatus from aliyun_api.common.Logger import Logger if __name__ == '__main__': """ 获取实例列表 https://help.aliyun.com/document_detail/25506.html 名称 类型 是否必需 描述 ZoneId String 否 实例所属可用区 PageNumber Integer 否 实例状态列表的页码。起始值:1 默认值:1 PageSize Integer 否 分页查询时设置的每页行数。取值范围:[1, 50] 默认值: 10 :param page_number: page_number :param page_size: page_size :return: json str """ api_parameter = { 'Action': 'DescribeInstances', 'RegionId': 'cn-shenzhen', 'PageNumber': '1', 'PageSize': '50' } result = UrlRequest(api_parameter).getResult(Ecs.qiandai.commonParameter) Logger("Ecs-DescribeInstances").getLogger().info(result)
# -*- coding: utf-8 -*- # @Time : 2018/4/26 16:05 # @Author : Abner.F # @Site : # @File : DescribeDomainsRequest.py # @Software: PyCharm # @python : 3.6 from aliyun_api.common.Slb import UrlRequest from aliyun_api.common.config import Dns from aliyun_api.common.Logger import Logger if __name__ == '__main__': api_parameter = { 'Action': 'DescribeDomainRecords', 'DomainName': 'ttjiekuan.com', 'RegionId': 'cn-shenzhen', 'PageNumber': '1', 'PageSize': '50' } result = UrlRequest(api_parameter).getResult(Dns.jiekuan.commonParameter) Logger("Ecs-DescribeInstances").getLogger().info(result)
#"[{'ServerId':'i-wz9fzprkt1ullkni4w38', 'Weight':'50'}]" return 返回参数 参数 类型 描述 RequestId String 请求ID。 LoadBalancerId String 负载均衡实例ID。 BackendServers List 后端服务器列表。 BackendServers objects ServerId string ECS实例ID。 Weight Integer 后端服务器的权重。 i-wz9glp2ttd1099jgers8 ''' BackendServers = {'ServerId': 'i-wz9glp2ttd1099jgers8', 'Weight': '100'} BackendServersObj = [] BackendServersObj.append(BackendServers) apiParameter = { 'Action': 'SetBackendServers', 'RegionId': 'cn-shenzhen', 'LoadBalancerId': 'lb-wz937jr1qc2bssbt8ptd0', 'BackendServers': str(BackendServersObj) } result = UrlRequest(apiParameter).getResult() print(result)
# -*- coding: utf-8 -*- # @Time : 2018/3/26 14:23 # @Author : Abner # @File : DescribeHealthStatus.py # @Software: PyCharm from aliyun_api.common.Slb import UrlRequest from aliyun_api.common.config import Slb from aliyun_api.api.SlbBackendServer.config import DescribeHealthStatus from aliyun_api.common.Logger import Logger if __name__ == '__main__': parameter = { 'Action': 'DescribeHealthStatus', 'RegionId': 'cn-shenzhen', 'LoadBalancerId': 'lb-wz937jr1qc2bssbt8ptd0' } # result = UrlRequest(DescribeHealthStatus.qiandai.parameter).getResult(Slb.qiandai.parameter) result = UrlRequest(parameter).getResult(Slb.qiandai.commonParameter) Logger("Slb-DescriberHealthStatus").getLogger().info(result)