腾讯云新接口修改实例参数

#!/usr/bin/python
# -*- coding: utf-8 -*-

# 引入云API入口模块
import logging
import traceback
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
    # 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey
    cred = credential.Credential("xx", "xx")

    #实例化要请求产品(以cdb为例)的client对象
    client = cdb_client.CdbClient(cred, "ap-shanghai")

    #实例化一个请求对象
    req = models.ModifyInstanceParamRequest()
    req.InstanceIds = ["cdb-xxx","cdb-xxx"]
    param = models.Parameter()
    param.Name = "max_connections"
    param.CurrentValue = "500"
    req.ParamList = [param]


    print req
    # 通过client对象调用想要访问的接口,需要传入请求对象
    resp = client.ModifyInstanceParam(req)

    # 输出json格式的字符串回包
    print(resp.to_json_string())
except TencentCloudSDKException as err:
    msg = traceback.format_exc() # 方式1  
    print (msg)

猜你喜欢

转载自blog.csdn.net/mchdba/article/details/81228396