You need to enable JavaScript to run this app.
导航

查询伸缩日志

最近更新时间2023.07.19 17:54:47

首次发布时间2023.07.19 17:54:47

本文介绍如何查询伸缩日志。

示例代码

from __future__ import print_function
import volcenginesdkcore
import volcenginesdkautoscaling
from pprint import pprint
from volcenginesdkcore.rest import ApiException


if __name__ == '__main__':
    configuration = volcenginesdkcore.Configuration()
    # 设置您的ak、sk和要访问的地域
    configuration.ak = "AK"
    configuration.sk = "SK"
    configuration.region = "cn-beijing"
    # 设置默认配置
    volcenginesdkcore.Configuration.set_default(configuration)

		# 使用全局默认配置
    api_instance = volcenginesdkautoscaling.AUTOSCALINGApi()

    # 查询伸缩日志
    describe_scaling_activities_request = volcenginesdkautoscaling.DescribeScalingActivitiesRequest(
        page_number=1,# 列表的页码
        page_size=10,# 分页查询时每页的行数
        scaling_group_id="scg-yblhryq64wgh9zmp****",# 伸缩组ID
    )

		# 发起请求并处理返回或异常
    try:
        resp = api_instance.describe_scaling_activities(describe_scaling_activities_request)
        pprint(resp)
    except ApiException as e:
        print("Exception when calling api: %s\n" % e)

相关文档