Пример #1
0
def doModifyComputeEnv(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("ModifyComputeEnv", g_param[OptionsDefine.Version])
        return

    param = {
        "EnvId":
        Utils.try_to_json(argv, "--EnvId"),
        "DesiredComputeNodeCount":
        Utils.try_to_json(argv, "--DesiredComputeNodeCount"),
        "EnvName":
        Utils.try_to_json(argv, "--EnvName"),
        "EnvDescription":
        Utils.try_to_json(argv, "--EnvDescription"),
        "EnvData":
        Utils.try_to_json(argv, "--EnvData"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.BatchClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.ModifyComputeEnvRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.ModifyComputeEnv(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #2
0
def doGetFunctionLogs(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("GetFunctionLogs", g_param[OptionsDefine.Version])
        return

    param = {
        "FunctionName": Utils.try_to_json(argv, "--FunctionName"),
        "Offset": Utils.try_to_json(argv, "--Offset"),
        "Limit": Utils.try_to_json(argv, "--Limit"),
        "Order": Utils.try_to_json(argv, "--Order"),
        "OrderBy": Utils.try_to_json(argv, "--OrderBy"),
        "Filter": Utils.try_to_json(argv, "--Filter"),
        "Qualifier": Utils.try_to_json(argv, "--Qualifier"),
        "FunctionRequestId": Utils.try_to_json(argv, "--FunctionRequestId"),
        "StartTime": Utils.try_to_json(argv, "--StartTime"),
        "EndTime": Utils.try_to_json(argv, "--EndTime"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.ScfClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.GetFunctionLogsRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.GetFunctionLogs(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #3
0
def doDescribeCaptchaResult(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("DescribeCaptchaResult", g_param[OptionsDefine.Version])
        return

    param = {
        "CaptchaType": Utils.try_to_json(argv, "--CaptchaType"),
        "Ticket": argv.get("--Ticket"),
        "UserIp": argv.get("--UserIp"),
        "Randstr": argv.get("--Randstr"),
        "CaptchaAppId": Utils.try_to_json(argv, "--CaptchaAppId"),
        "AppSecretKey": argv.get("--AppSecretKey"),
        "BusinessId": Utils.try_to_json(argv, "--BusinessId"),
        "SceneId": Utils.try_to_json(argv, "--SceneId"),
        "MacAddress": argv.get("--MacAddress"),
        "Imei": argv.get("--Imei"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.CaptchaClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.DescribeCaptchaResultRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.DescribeCaptchaResult(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #4
0
def doSignContractByCoordinate(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("SignContractByCoordinate", g_param[OptionsDefine.Version])
        return

    param = {
        "Module": argv.get("--Module"),
        "Operation": argv.get("--Operation"),
        "ContractResId": argv.get("--ContractResId"),
        "AccountResId": argv.get("--AccountResId"),
        "AuthorizationTime": argv.get("--AuthorizationTime"),
        "Position": argv.get("--Position"),
        "SignLocations": Utils.try_to_json(argv, "--SignLocations"),
        "SealResId": argv.get("--SealResId"),
        "CertType": Utils.try_to_json(argv, "--CertType"),
        "ImageData": argv.get("--ImageData"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.DsClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.SignContractByCoordinateRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.SignContractByCoordinate(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #5
0
def doDescribeBillDetail(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("DescribeBillDetail", g_param[OptionsDefine.Version])
        return

    param = {
        "Offset": Utils.try_to_json(argv, "--Offset"),
        "Limit": Utils.try_to_json(argv, "--Limit"),
        "PeriodType": argv.get("--PeriodType"),
        "Month": argv.get("--Month"),
        "BeginTime": argv.get("--BeginTime"),
        "EndTime": argv.get("--EndTime"),
        "NeedRecordNum": Utils.try_to_json(argv, "--NeedRecordNum"),
        "ProductCode": argv.get("--ProductCode"),
        "PayMode": argv.get("--PayMode"),
        "ResourceId": argv.get("--ResourceId"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.BillingClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.DescribeBillDetailRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.DescribeBillDetail(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #6
0
def doUpdateService(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("UpdateService", g_param[OptionsDefine.Version])
        return

    param = {
        "ServiceId": argv.get("--ServiceId"),
        "Scaler": Utils.try_to_json(argv, "--Scaler"),
        "ServiceConfigId": argv.get("--ServiceConfigId"),
        "ScaleMode": argv.get("--ScaleMode"),
        "ServiceAction": argv.get("--ServiceAction"),
        "Description": argv.get("--Description"),
        "GpuType": argv.get("--GpuType"),
        "Cpu": Utils.try_to_json(argv, "--Cpu"),
        "Memory": Utils.try_to_json(argv, "--Memory"),
        "Gpu": Utils.try_to_json(argv, "--Gpu"),
        "LogTopicId": argv.get("--LogTopicId"),

    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint]
    )
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.TiemsClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.UpdateServiceRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.UpdateService(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8')) # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
Пример #7
0
def doCreateEnterpriseAccount(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CreateEnterpriseAccount", g_param[OptionsDefine.Version])
        return

    param = {
        "Module": argv.get("--Module"),
        "Operation": argv.get("--Operation"),
        "Name": argv.get("--Name"),
        "IdentType": Utils.try_to_json(argv, "--IdentType"),
        "IdentNo": argv.get("--IdentNo"),
        "MobilePhone": argv.get("--MobilePhone"),
        "TransactorName": argv.get("--TransactorName"),
        "TransactorIdentType": Utils.try_to_json(argv, "--TransactorIdentType"),
        "TransactorIdentNo": argv.get("--TransactorIdentNo"),
        "TransactorPhone": argv.get("--TransactorPhone"),
        "Email": argv.get("--Email"),

    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint]
    )
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.DsClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.CreateEnterpriseAccountRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CreateEnterpriseAccount(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8')) # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
Пример #8
0
def doCreateClusterAsGroup(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CreateClusterAsGroup", g_param[OptionsDefine.Version])
        return

    param = {
        "ClusterId":
        argv.get("--ClusterId"),
        "AutoScalingGroupPara":
        argv.get("--AutoScalingGroupPara"),
        "LaunchConfigurePara":
        argv.get("--LaunchConfigurePara"),
        "InstanceAdvancedSettings":
        Utils.try_to_json(argv, "--InstanceAdvancedSettings"),
        "Labels":
        Utils.try_to_json(argv, "--Labels"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.TkeClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.CreateClusterAsGroupRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CreateClusterAsGroup(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #9
0
def doDescribeRecords(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("DescribeRecords", g_param[OptionsDefine.Version])
        return

    param = {
        "Module": Utils.try_to_json(argv, "--Module"),
        "Operation": Utils.try_to_json(argv, "--Operation"),
        "ProductId": Utils.try_to_json(argv, "--ProductId"),
        "AccountNum": Utils.try_to_json(argv, "--AccountNum"),
        "CalledPhone": Utils.try_to_json(argv, "--CalledPhone"),
        "StartBizDate": Utils.try_to_json(argv, "--StartBizDate"),
        "EndBizDate": Utils.try_to_json(argv, "--EndBizDate"),
        "Offset": Utils.try_to_json(argv, "--Offset"),
        "Limit": Utils.try_to_json(argv, "--Limit"),
        "InstId": Utils.try_to_json(argv, "--InstId"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.CrClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.DescribeRecordsRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.DescribeRecords(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #10
0
def doUpdateNotebookInstance(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("UpdateNotebookInstance", g_param[OptionsDefine.Version])
        return

    param = {
        "NotebookInstanceName": argv.get("--NotebookInstanceName"),
        "RoleArn": argv.get("--RoleArn"),
        "RootAccess": argv.get("--RootAccess"),
        "VolumeSizeInGB": Utils.try_to_json(argv, "--VolumeSizeInGB"),
        "InstanceType": argv.get("--InstanceType"),
        "LifecycleScriptsName": argv.get("--LifecycleScriptsName"),
        "DisassociateLifecycleScript": Utils.try_to_json(argv, "--DisassociateLifecycleScript"),
        "DefaultCodeRepository": argv.get("--DefaultCodeRepository"),
        "AdditionalCodeRepositories": Utils.try_to_json(argv, "--AdditionalCodeRepositories"),
        "DisassociateDefaultCodeRepository": Utils.try_to_json(argv, "--DisassociateDefaultCodeRepository"),
        "DisassociateAdditionalCodeRepositories": Utils.try_to_json(argv, "--DisassociateAdditionalCodeRepositories"),

    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint]
    )
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.TioneClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.UpdateNotebookInstanceRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.UpdateNotebookInstance(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8')) # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
Пример #11
0
def doCreateLiveRecord(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CreateLiveRecord", g_param[OptionsDefine.Version])
        return

    param = {
        "StreamName": Utils.try_to_json(argv, "--StreamName"),
        "AppName": Utils.try_to_json(argv, "--AppName"),
        "DomainName": Utils.try_to_json(argv, "--DomainName"),
        "StartTime": Utils.try_to_json(argv, "--StartTime"),
        "EndTime": Utils.try_to_json(argv, "--EndTime"),
        "RecordType": Utils.try_to_json(argv, "--RecordType"),
        "FileFormat": Utils.try_to_json(argv, "--FileFormat"),
        "Highlight": Utils.try_to_json(argv, "--Highlight"),
        "MixStream": Utils.try_to_json(argv, "--MixStream"),
        "StreamParam": Utils.try_to_json(argv, "--StreamParam"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.LiveClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.CreateLiveRecordRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CreateLiveRecord(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #12
0
def doCreateAudit(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CreateAudit", g_param[OptionsDefine.Version])
        return

    param = {
        "AuditName": argv.get("--AuditName"),
        "CosBucketName": argv.get("--CosBucketName"),
        "CosRegion": argv.get("--CosRegion"),
        "IsCreateNewBucket": Utils.try_to_json(argv, "--IsCreateNewBucket"),
        "IsEnableCmqNotify": Utils.try_to_json(argv, "--IsEnableCmqNotify"),
        "ReadWriteAttribute": Utils.try_to_json(argv, "--ReadWriteAttribute"),
        "CmqQueueName": argv.get("--CmqQueueName"),
        "CmqRegion": argv.get("--CmqRegion"),
        "IsCreateNewQueue": Utils.try_to_json(argv, "--IsCreateNewQueue"),
        "LogFilePrefix": argv.get("--LogFilePrefix"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.CloudauditClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.CreateAuditRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CreateAudit(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #13
0
def doInvoke(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("Invoke", g_param[OptionsDefine.Version])
        return

    param = {
        "Module": argv.get("--Module"),
        "Operation": argv.get("--Operation"),
        "ClusterId": argv.get("--ClusterId"),
        "ChaincodeName": argv.get("--ChaincodeName"),
        "ChannelName": argv.get("--ChannelName"),
        "Peers": Utils.try_to_json(argv, "--Peers"),
        "FuncName": argv.get("--FuncName"),
        "GroupName": argv.get("--GroupName"),
        "Args": Utils.try_to_json(argv, "--Args"),
        "AsyncFlag": Utils.try_to_json(argv, "--AsyncFlag"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.TbaasClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.InvokeRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.Invoke(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #14
0
def doDescribeAlarmsByTask(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("DescribeAlarmsByTask", g_param[OptionsDefine.Version])
        return

    param = {
        "TaskId": Utils.try_to_json(argv, "--TaskId"),
        "Offset": Utils.try_to_json(argv, "--Offset"),
        "Limit": Utils.try_to_json(argv, "--Limit"),
        "Status": Utils.try_to_json(argv, "--Status"),
        "BeginTime": argv.get("--BeginTime"),
        "EndTime": argv.get("--EndTime"),
        "SortBy": argv.get("--SortBy"),
        "SortType": argv.get("--SortType"),
        "ObjName": argv.get("--ObjName"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.CatClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.DescribeAlarmsByTaskRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.DescribeAlarmsByTask(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #15
0
def doCreateStudioProduct(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CreateStudioProduct", g_param[OptionsDefine.Version])
        return

    param = {
        "ProductName": argv.get("--ProductName"),
        "CategoryId": Utils.try_to_json(argv, "--CategoryId"),
        "ProductType": Utils.try_to_json(argv, "--ProductType"),
        "EncryptionType": argv.get("--EncryptionType"),
        "NetType": argv.get("--NetType"),
        "DataProtocol": Utils.try_to_json(argv, "--DataProtocol"),
        "ProductDesc": argv.get("--ProductDesc"),
        "ProjectId": argv.get("--ProjectId"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.IotexplorerClient(cred, g_param[OptionsDefine.Region],
                                   profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.CreateStudioProductRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CreateStudioProduct(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #16
0
def doInquiryPriceScaleOutInstance(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("InquiryPriceScaleOutInstance",
                  g_param[OptionsDefine.Version])
        return

    param = {
        "TimeUnit": argv.get("--TimeUnit"),
        "TimeSpan": Utils.try_to_json(argv, "--TimeSpan"),
        "ZoneId": Utils.try_to_json(argv, "--ZoneId"),
        "PayMode": Utils.try_to_json(argv, "--PayMode"),
        "InstanceId": argv.get("--InstanceId"),
        "CoreCount": Utils.try_to_json(argv, "--CoreCount"),
        "TaskCount": Utils.try_to_json(argv, "--TaskCount"),
        "Currency": argv.get("--Currency"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.InquiryPriceScaleOutInstanceRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.InquiryPriceScaleOutInstance(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #17
0
def doModifySmsSign(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("ModifySmsSign", g_param[OptionsDefine.Version])
        return

    param = {
        "SignId": Utils.try_to_json(argv, "--SignId"),
        "SignName": argv.get("--SignName"),
        "SignType": Utils.try_to_json(argv, "--SignType"),
        "DocumentType": Utils.try_to_json(argv, "--DocumentType"),
        "International": Utils.try_to_json(argv, "--International"),
        "UsedMethod": Utils.try_to_json(argv, "--UsedMethod"),
        "ProofImage": argv.get("--ProofImage"),
        "CommissionImage": argv.get("--CommissionImage"),
        "Remark": argv.get("--Remark"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.SmsClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.ModifySmsSignRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.ModifySmsSign(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #18
0
def doSpeechTranslate(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("SpeechTranslate", g_param[OptionsDefine.Version])
        return

    param = {
        "SessionUuid": argv.get("--SessionUuid"),
        "Source": argv.get("--Source"),
        "Target": argv.get("--Target"),
        "AudioFormat": Utils.try_to_json(argv, "--AudioFormat"),
        "Seq": Utils.try_to_json(argv, "--Seq"),
        "IsEnd": Utils.try_to_json(argv, "--IsEnd"),
        "Data": argv.get("--Data"),
        "ProjectId": Utils.try_to_json(argv, "--ProjectId"),
        "Mode": argv.get("--Mode"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.TmtClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.SpeechTranslateRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.SpeechTranslate(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #19
0
def doSentenceRecognition(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("SentenceRecognition", g_param[OptionsDefine.Version])
        return

    param = {
        "ProjectId": Utils.try_to_json(argv, "--ProjectId"),
        "SubServiceType": Utils.try_to_json(argv, "--SubServiceType"),
        "EngSerViceType": argv.get("--EngSerViceType"),
        "SourceType": Utils.try_to_json(argv, "--SourceType"),
        "VoiceFormat": argv.get("--VoiceFormat"),
        "UsrAudioKey": argv.get("--UsrAudioKey"),
        "Url": argv.get("--Url"),
        "Data": argv.get("--Data"),
        "DataLen": Utils.try_to_json(argv, "--DataLen"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.AsrClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.SentenceRecognitionRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.SentenceRecognition(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #20
0
def doCreateModel(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CreateModel", g_param[OptionsDefine.Version])
        return

    param = {
        "Name": argv.get("--Name"),
        "Model": argv.get("--Model"),
        "Description": argv.get("--Description"),
        "Cluster": argv.get("--Cluster"),
        "RuntimeVersion": argv.get("--RuntimeVersion"),
        "Replicas": Utils.try_to_json(argv, "--Replicas"),
        "Expose": argv.get("--Expose"),
        "ServType": argv.get("--ServType"),
        "RuntimeConf": Utils.try_to_json(argv, "--RuntimeConf"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.TiaClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.CreateModelRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CreateModel(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #21
0
def doModifyDirectConnectTunnelAttribute(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("ModifyDirectConnectTunnelAttribute",
                  g_param[OptionsDefine.Version])
        return

    param = {
        "DirectConnectTunnelId": argv.get("--DirectConnectTunnelId"),
        "DirectConnectTunnelName": argv.get("--DirectConnectTunnelName"),
        "BgpPeer": Utils.try_to_json(argv, "--BgpPeer"),
        "RouteFilterPrefixes": Utils.try_to_json(argv,
                                                 "--RouteFilterPrefixes"),
        "TencentAddress": argv.get("--TencentAddress"),
        "CustomerAddress": argv.get("--CustomerAddress"),
        "Bandwidth": Utils.try_to_json(argv, "--Bandwidth"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.DcClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.ModifyDirectConnectTunnelAttributeRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.ModifyDirectConnectTunnelAttribute(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #22
0
def doCreateSyncJob(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CreateSyncJob", g_param[OptionsDefine.Version])
        return

    param = {
        "JobName": argv.get("--JobName"),
        "SyncOption": Utils.try_to_json(argv, "--SyncOption"),
        "SrcDatabaseType": argv.get("--SrcDatabaseType"),
        "SrcAccessType": argv.get("--SrcAccessType"),
        "SrcInfo": Utils.try_to_json(argv, "--SrcInfo"),
        "DstDatabaseType": argv.get("--DstDatabaseType"),
        "DstAccessType": argv.get("--DstAccessType"),
        "DstInfo": Utils.try_to_json(argv, "--DstInfo"),
        "DatabaseInfo": argv.get("--DatabaseInfo"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.DtsClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.CreateSyncJobRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CreateSyncJob(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #23
0
def doCreateModule(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CreateModule", g_param[OptionsDefine.Version])
        return

    param = {
        "ModuleName": argv.get("--ModuleName"),
        "DefaultBandWidth": Utils.try_to_json(argv, "--DefaultBandWidth"),
        "DefaultImageId": argv.get("--DefaultImageId"),
        "InstanceType": argv.get("--InstanceType"),
        "DefaultSystemDiskSize": Utils.try_to_json(argv,
                                                   "--DefaultSystemDiskSize"),
        "DefaultDataDiskSize": Utils.try_to_json(argv,
                                                 "--DefaultDataDiskSize"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.EcmClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.CreateModuleRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CreateModule(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #24
0
def doDetectFace(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("DetectFace", g_param[OptionsDefine.Version])
        return

    param = {
        "MaxFaceNum": Utils.try_to_json(argv, "--MaxFaceNum"),
        "MinFaceSize": Utils.try_to_json(argv, "--MinFaceSize"),
        "Image": argv.get("--Image"),
        "Url": argv.get("--Url"),
        "NeedFaceAttributes": Utils.try_to_json(argv, "--NeedFaceAttributes"),
        "NeedQualityDetection": Utils.try_to_json(argv,
                                                  "--NeedQualityDetection"),
        "FaceModelVersion": argv.get("--FaceModelVersion"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.IaiClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.DetectFaceRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.DetectFace(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #25
0
def doCreateSubscribe(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CreateSubscribe", g_param[OptionsDefine.Version])
        return

    param = {
        "TopicName": argv.get("--TopicName"),
        "SubscriptionName": argv.get("--SubscriptionName"),
        "Protocol": argv.get("--Protocol"),
        "Endpoint": argv.get("--Endpoint"),
        "NotifyStrategy": argv.get("--NotifyStrategy"),
        "FilterTag": Utils.try_to_json(argv, "--FilterTag"),
        "BindingKey": Utils.try_to_json(argv, "--BindingKey"),
        "NotifyContentFormat": argv.get("--NotifyContentFormat"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.CmqClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.CreateSubscribeRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CreateSubscribe(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #26
0
def doListTopData(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("ListTopData", g_param[OptionsDefine.Version])
        return

    param = {
        "StartTime": argv.get("--StartTime"),
        "EndTime": argv.get("--EndTime"),
        "Metric": argv.get("--Metric"),
        "Filter": argv.get("--Filter"),
        "Domains": Utils.try_to_json(argv, "--Domains"),
        "Project": Utils.try_to_json(argv, "--Project"),
        "Detail": Utils.try_to_json(argv, "--Detail"),
        "Code": argv.get("--Code"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.CdnClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.ListTopDataRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.ListTopData(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #27
0
def doUpdateCaptchaAppIdInfo(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("UpdateCaptchaAppIdInfo", g_param[OptionsDefine.Version])
        return

    param = {
        "CaptchaAppId": Utils.try_to_json(argv, "--CaptchaAppId"),
        "AppName": argv.get("--AppName"),
        "DomainLimit": argv.get("--DomainLimit"),
        "SceneType": Utils.try_to_json(argv, "--SceneType"),
        "CapType": Utils.try_to_json(argv, "--CapType"),
        "EvilInterceptGrade": Utils.try_to_json(argv, "--EvilInterceptGrade"),
        "SmartVerify": Utils.try_to_json(argv, "--SmartVerify"),
        "SmartEngine": Utils.try_to_json(argv, "--SmartEngine"),
        "SchemeColor": argv.get("--SchemeColor"),
        "CaptchaLanguage": Utils.try_to_json(argv, "--CaptchaLanguage"),
        "MailAlarm": argv.get("--MailAlarm"),
        "TopFullScreen": Utils.try_to_json(argv, "--TopFullScreen"),
        "TrafficThreshold": Utils.try_to_json(argv, "--TrafficThreshold"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.CaptchaClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.UpdateCaptchaAppIdInfoRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.UpdateCaptchaAppIdInfo(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #28
0
def doDescribeDeviceDataHistory(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("DescribeDeviceDataHistory", g_param[OptionsDefine.Version])
        return

    param = {
        "MinTime": Utils.try_to_json(argv, "--MinTime"),
        "MaxTime": Utils.try_to_json(argv, "--MaxTime"),
        "ProductId": argv.get("--ProductId"),
        "DeviceName": argv.get("--DeviceName"),
        "FieldName": argv.get("--FieldName"),
        "Limit": Utils.try_to_json(argv, "--Limit"),
        "Context": argv.get("--Context"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.IotexplorerClient(cred, g_param[OptionsDefine.Region],
                                   profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.DescribeDeviceDataHistoryRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.DescribeDeviceDataHistory(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #29
0
def doSendSms(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("SendSms", g_param[OptionsDefine.Version])
        return

    param = {
        "PhoneNumberSet": Utils.try_to_json(argv, "--PhoneNumberSet"),
        "TemplateID": argv.get("--TemplateID"),
        "SmsSdkAppid": argv.get("--SmsSdkAppid"),
        "Sign": argv.get("--Sign"),
        "TemplateParamSet": Utils.try_to_json(argv, "--TemplateParamSet"),
        "ExtendCode": argv.get("--ExtendCode"),
        "SessionContext": argv.get("--SessionContext"),
        "SenderId": argv.get("--SenderId"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.SmsClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.SendSmsRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.SendSms(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])
Пример #30
0
def doCopyFunction(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CopyFunction", g_param[OptionsDefine.Version])
        return

    param = {
        "FunctionName": argv.get("--FunctionName"),
        "NewFunctionName": argv.get("--NewFunctionName"),
        "Namespace": argv.get("--Namespace"),
        "TargetNamespace": argv.get("--TargetNamespace"),
        "Description": argv.get("--Description"),
        "TargetRegion": argv.get("--TargetRegion"),
        "Override": Utils.try_to_json(argv, "--Override"),
        "CopyConfiguration": Utils.try_to_json(argv, "--CopyConfiguration"),
    }
    cred = credential.Credential(g_param[OptionsDefine.SecretId],
                                 g_param[OptionsDefine.SecretKey])
    http_profile = HttpProfile(
        reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(
            g_param[OptionsDefine.Timeout]),
        reqMethod="POST",
        endpoint=g_param[OptionsDefine.Endpoint])
    profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
    mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
    client = mod.ScfClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.CopyFunctionRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CopyFunction(model)
    result = rsp.to_json_string()
    jsonobj = None
    try:
        jsonobj = json.loads(result)
    except TypeError as e:
        jsonobj = json.loads(result.decode('utf-8'))  # python3.3
    FormatOutput.output("action", jsonobj, g_param[OptionsDefine.Output],
                        g_param[OptionsDefine.Filter])