Beispiel #1
0
def doDescribeInstanceCategories(args, parsed_globals):
    g_param = parse_global_arg(parsed_globals)

    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.DescribeInstanceCategoriesRequest()
    model.from_json_string(json.dumps(args))
    rsp = client.DescribeInstanceCategories(model)
    result = rsp.to_json_string()
    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])
def doCreateMonitors(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CreateMonitors", g_param[OptionsDefine.Version])
        return

    param = {
        "Urls": Utils.try_to_json(argv, "--Urls"),
        "Name": Utils.try_to_json(argv, "--Name"),
        "ScannerType": Utils.try_to_json(argv, "--ScannerType"),
        "Crontab": Utils.try_to_json(argv, "--Crontab"),
        "RateLimit": Utils.try_to_json(argv, "--RateLimit"),
        "FirstScanStartTime": Utils.try_to_json(argv, "--FirstScanStartTime"),
    }
    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.CwsClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.CreateMonitorsRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CreateMonitors(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])
Beispiel #3
0
def doImageTranslate(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("ImageTranslate", g_param[OptionsDefine.Version])
        return

    param = {
        "SessionUuid": argv.get("--SessionUuid"),
        "Scene": argv.get("--Scene"),
        "Data": argv.get("--Data"),
        "Source": argv.get("--Source"),
        "Target": argv.get("--Target"),
        "ProjectId": Utils.try_to_json(argv, "--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.TmtClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.ImageTranslateRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.ImageTranslate(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])
def doGetBlockListHandler(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("GetBlockListHandler", g_param[OptionsDefine.Version])
        return

    param = {
        "Module": argv.get("--Module"),
        "Operation": argv.get("--Operation"),
        "Offset": Utils.try_to_json(argv, "--Offset"),
        "Limit": Utils.try_to_json(argv, "--Limit"),
        "GroupPk": argv.get("--GroupPk"),
        "BlockHash": argv.get("--BlockHash"),
    }
    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.GetBlockListHandlerRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.GetBlockListHandler(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])
def doCreateRsgAsGroup(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CreateRsgAsGroup", g_param[OptionsDefine.Version])
        return

    param = {
        "RsgId": argv.get("--RsgId"),
        "MaxSize": Utils.try_to_json(argv, "--MaxSize"),
        "MinSize": Utils.try_to_json(argv, "--MinSize"),
        "InstanceType": argv.get("--InstanceType"),
        "Cluster": argv.get("--Cluster"),
        "Name": argv.get("--Name"),
        "DesiredSize": Utils.try_to_json(argv, "--DesiredSize"),

    }
    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.CreateRsgAsGroupRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CreateRsgAsGroup(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])
Beispiel #6
0
def doBeautifyPic(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("BeautifyPic", g_param[OptionsDefine.Version])
        return

    param = {
        "Image": argv.get("--Image"),
        "Url": argv.get("--Url"),
        "Whitening": Utils.try_to_json(argv, "--Whitening"),
        "Smoothing": Utils.try_to_json(argv, "--Smoothing"),
        "FaceLifting": Utils.try_to_json(argv, "--FaceLifting"),
        "EyeEnlarging": Utils.try_to_json(argv, "--EyeEnlarging"),
    }
    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.FmuClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.BeautifyPicRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.BeautifyPic(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])
def doModifyDiskAttributes(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("ModifyDiskAttributes", g_param[OptionsDefine.Version])
        return

    param = {
        "DiskIds": Utils.try_to_json(argv, "--DiskIds"),
        "ProjectId": Utils.try_to_json(argv, "--ProjectId"),
        "DiskName": Utils.try_to_json(argv, "--DiskName"),
        "Portable": Utils.try_to_json(argv, "--Portable"),
        "DeleteWithInstance": Utils.try_to_json(argv, "--DeleteWithInstance"),
        "DiskType": Utils.try_to_json(argv, "--DiskType"),
    }
    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.CbsClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.ModifyDiskAttributesRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.ModifyDiskAttributes(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])
Beispiel #8
0
def doCreateLoadBalancer(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CreateLoadBalancer", g_param[OptionsDefine.Version])
        return

    param = {
        "LoadBalancerType": Utils.try_to_json(argv, "--LoadBalancerType"),
        "Forward": Utils.try_to_json(argv, "--Forward"),
        "LoadBalancerName": Utils.try_to_json(argv, "--LoadBalancerName"),
        "VpcId": Utils.try_to_json(argv, "--VpcId"),
        "SubnetId": Utils.try_to_json(argv, "--SubnetId"),
        "ProjectId": Utils.try_to_json(argv, "--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.ClbClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.CreateLoadBalancerRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CreateLoadBalancer(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])
Beispiel #9
0
def doMarketingValueJudgement(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("MarketingValueJudgement", g_param[OptionsDefine.Version])
        return

    param = {
        "AccountType": Utils.try_to_json(argv, "--AccountType"),
        "Uid": argv.get("--Uid"),
        "UserIp": argv.get("--UserIp"),
        "PostTime": Utils.try_to_json(argv, "--PostTime"),
        "Imei": argv.get("--Imei"),
        "Referer": argv.get("--Referer"),
    }
    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.MvjClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.MarketingValueJudgementRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.MarketingValueJudgement(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])
Beispiel #10
0
def doUpdateCfsRule(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("UpdateCfsRule", g_param[OptionsDefine.Version])
        return

    param = {
        "PGroupId": argv.get("--PGroupId"),
        "RuleId": argv.get("--RuleId"),
        "AuthClientIp": argv.get("--AuthClientIp"),
        "RWPermission": argv.get("--RWPermission"),
        "UserPermission": argv.get("--UserPermission"),
        "Priority": Utils.try_to_json(argv, "--Priority"),
    }
    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.CfsClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.UpdateCfsRuleRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.UpdateCfsRule(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])
Beispiel #11
0
def doDescribeGameServerSessions(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("DescribeGameServerSessions", g_param[OptionsDefine.Version])
        return

    param = {
        "AliasId": argv.get("--AliasId"),
        "FleetId": argv.get("--FleetId"),
        "GameServerSessionId": argv.get("--GameServerSessionId"),
        "Limit": Utils.try_to_json(argv, "--Limit"),
        "NextToken": argv.get("--NextToken"),
        "StatusFilter": argv.get("--StatusFilter"),
    }
    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.GseClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.DescribeGameServerSessionsRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.DescribeGameServerSessions(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])
Beispiel #12
0
def doUpgradeLicense(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("UpgradeLicense", g_param[OptionsDefine.Version])
        return

    param = {
        "InstanceId": argv.get("--InstanceId"),
        "LicenseType": argv.get("--LicenseType"),
        "AutoVoucher": Utils.try_to_json(argv, "--AutoVoucher"),
        "VoucherIds": Utils.try_to_json(argv, "--VoucherIds"),
        "BasicSecurityType": Utils.try_to_json(argv, "--BasicSecurityType"),
        "ForceRestart": Utils.try_to_json(argv, "--ForceRestart"),
    }
    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.EsClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.UpgradeLicenseRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.UpgradeLicense(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])
Beispiel #13
0
def doModifySiteAttribute(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("ModifySiteAttribute", g_param[OptionsDefine.Version])
        return

    param = {
        "SiteId": Utils.try_to_json(argv, "--SiteId"),
        "Name": argv.get("--Name"),
        "NeedLogin": Utils.try_to_json(argv, "--NeedLogin"),
        "LoginCookie": argv.get("--LoginCookie"),
        "LoginCheckUrl": argv.get("--LoginCheckUrl"),
        "LoginCheckKw": argv.get("--LoginCheckKw"),
        "ScanDisallow": argv.get("--ScanDisallow"),

    }
    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.CwsClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.ModifySiteAttributeRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.ModifySiteAttribute(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])
Beispiel #14
0
def doGetDetectInfoEnhanced(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("GetDetectInfoEnhanced", g_param[OptionsDefine.Version])
        return

    param = {
        "BizToken": argv.get("--BizToken"),
        "RuleId": argv.get("--RuleId"),
        "InfoType": argv.get("--InfoType"),
        "BestFramesCount": Utils.try_to_json(argv, "--BestFramesCount"),
        "IsCutIdCardImage": Utils.try_to_json(argv, "--IsCutIdCardImage"),
        "IsNeedIdCardAvatar": Utils.try_to_json(argv, "--IsNeedIdCardAvatar"),
    }
    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.FaceidClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.GetDetectInfoEnhancedRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.GetDetectInfoEnhanced(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])
Beispiel #15
0
def doModifyFairPlayPem(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("ModifyFairPlayPem", g_param[OptionsDefine.Version])
        return

    param = {
        "Pem": argv.get("--Pem"),
        "Ask": argv.get("--Ask"),
        "FairPlayPemId": Utils.try_to_json(argv, "--FairPlayPemId"),
        "PemDecryptKey": argv.get("--PemDecryptKey"),
        "BailorId": Utils.try_to_json(argv, "--BailorId"),
        "Priority": Utils.try_to_json(argv, "--Priority"),
    }
    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.DrmClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.ModifyFairPlayPemRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.ModifyFairPlayPem(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])
def doFaceFusion(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("FaceFusion", g_param[OptionsDefine.Version])
        return

    param = {
        "ProjectId": Utils.try_to_json(argv, "--ProjectId"),
        "ModelId": Utils.try_to_json(argv, "--ModelId"),
        "Image": Utils.try_to_json(argv, "--Image"),
        "RspImgType": Utils.try_to_json(argv, "--RspImgType"),
        "PornDetect": Utils.try_to_json(argv, "--PornDetect"),
        "CelebrityIdentify": Utils.try_to_json(argv, "--CelebrityIdentify"),
    }
    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.FacefusionClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.FaceFusionRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.FaceFusion(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])
def doUpdateFunctionCode(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("UpdateFunctionCode", g_param[OptionsDefine.Version])
        return

    param = {
        "Handler": Utils.try_to_json(argv, "--Handler"),
        "FunctionName": Utils.try_to_json(argv, "--FunctionName"),
        "CosBucketName": Utils.try_to_json(argv, "--CosBucketName"),
        "CosObjectName": Utils.try_to_json(argv, "--CosObjectName"),
        "ZipFile": Utils.try_to_json(argv, "--ZipFile"),
        "CosBucketRegion": Utils.try_to_json(argv, "--CosBucketRegion"),
    }
    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.UpdateFunctionCodeRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.UpdateFunctionCode(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])
def doInquiryPriceBuyVsm(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("InquiryPriceBuyVsm", g_param[OptionsDefine.Version])
        return

    param = {
        "GoodsNum": Utils.try_to_json(argv, "--GoodsNum"),
        "PayMode": Utils.try_to_json(argv, "--PayMode"),
        "TimeSpan": argv.get("--TimeSpan"),
        "TimeUnit": argv.get("--TimeUnit"),
        "Currency": argv.get("--Currency"),
        "Type": argv.get("--Type"),
    }
    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.CloudhsmClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.InquiryPriceBuyVsmRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.InquiryPriceBuyVsm(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])
Beispiel #19
0
def doSearchFaces(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("SearchFaces", g_param[OptionsDefine.Version])
        return

    param = {
        "GroupIds": Utils.try_to_json(argv, "--GroupIds"),
        "Image": Utils.try_to_json(argv, "--Image"),
        "Url": Utils.try_to_json(argv, "--Url"),
        "MaxFaceNum": Utils.try_to_json(argv, "--MaxFaceNum"),
        "MinFaceSize": Utils.try_to_json(argv, "--MinFaceSize"),
        "MaxPersonNum": Utils.try_to_json(argv, "--MaxPersonNum"),
    }
    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.SearchFacesRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.SearchFaces(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])
Beispiel #20
0
def doCreateSession(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CreateSession", g_param[OptionsDefine.Version])
        return

    param = {
        "ClientSession": argv.get("--ClientSession"),
        "GameId": argv.get("--GameId"),
        "UserId": argv.get("--UserId"),
        "GameParas": argv.get("--GameParas"),
        "GameRegion": argv.get("--GameRegion"),
        "ImageUrl": argv.get("--ImageUrl"),
        "Resolution": argv.get("--Resolution"),

    }
    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.BizliveClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.CreateSessionRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CreateSession(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])
Beispiel #21
0
def doLookUpEvents(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("LookUpEvents", g_param[OptionsDefine.Version])
        return

    param = {
        "EndTime": Utils.try_to_json(argv, "--EndTime"),
        "StartTime": Utils.try_to_json(argv, "--StartTime"),
        "LookupAttributes": Utils.try_to_json(argv, "--LookupAttributes"),
        "MaxResults": Utils.try_to_json(argv, "--MaxResults"),
        "Mode": argv.get("--Mode"),
        "NextToken": argv.get("--NextToken"),
    }
    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.LookUpEventsRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.LookUpEvents(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])
def doLivenessRecognition(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("LivenessRecognition", g_param[OptionsDefine.Version])
        return

    param = {
        "IdCard": Utils.try_to_json(argv, "--IdCard"),
        "Name": Utils.try_to_json(argv, "--Name"),
        "VideoBase64": Utils.try_to_json(argv, "--VideoBase64"),
        "LivenessType": Utils.try_to_json(argv, "--LivenessType"),
        "ValidateData": Utils.try_to_json(argv, "--ValidateData"),
        "Optional": Utils.try_to_json(argv, "--Optional"),
    }
    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.FaceidClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.LivenessRecognitionRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.LivenessRecognition(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])
def doDescribeBillResourceSummary(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("DescribeBillResourceSummary",
                  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"),
        "NeedRecordNum": Utils.try_to_json(argv, "--NeedRecordNum"),
    }
    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.DescribeBillResourceSummaryRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.DescribeBillResourceSummary(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])
def doControlDeviceData(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("ControlDeviceData", g_param[OptionsDefine.Version])
        return

    param = {
        "ProductId": argv.get("--ProductId"),
        "DeviceName": argv.get("--DeviceName"),
        "Data": argv.get("--Data"),
        "Method": argv.get("--Method"),
        "DeviceId": argv.get("--DeviceId"),
    }
    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.ControlDeviceDataRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.ControlDeviceData(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])
Beispiel #25
0
def doDescribeCreditResult(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("DescribeCreditResult", g_param[OptionsDefine.Version])
        return

    param = {
        "Module": Utils.try_to_json(argv, "--Module"),
        "Operation": Utils.try_to_json(argv, "--Operation"),
        "InstId": Utils.try_to_json(argv, "--InstId"),
        "ProductId": Utils.try_to_json(argv, "--ProductId"),
        "CaseId": Utils.try_to_json(argv, "--CaseId"),
        "RequestDate": Utils.try_to_json(argv, "--RequestDate"),
    }
    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.DescribeCreditResultRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.DescribeCreditResult(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])
Beispiel #26
0
def doInvoke(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("Invoke", g_param[OptionsDefine.Version])
        return

    param = {
        "FunctionName": argv.get("--FunctionName"),
        "InvocationType": argv.get("--InvocationType"),
        "Qualifier": argv.get("--Qualifier"),
        "ClientContext": argv.get("--ClientContext"),
        "LogType": argv.get("--LogType"),
        "Namespace": argv.get("--Namespace"),
    }
    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.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])
def doGetMonitorData(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("GetMonitorData", g_param[OptionsDefine.Version])
        return

    param = {
        "Namespace": argv.get("--Namespace"),
        "MetricName": argv.get("--MetricName"),
        "Instances": Utils.try_to_json(argv, "--Instances"),
        "Period": Utils.try_to_json(argv, "--Period"),
        "StartTime": argv.get("--StartTime"),
        "EndTime": argv.get("--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.MonitorClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.GetMonitorDataRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.GetMonitorData(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])
def doCreateServiceConfig(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CreateServiceConfig", g_param[OptionsDefine.Version])
        return

    param = {
        "Name": argv.get("--Name"),
        "Runtime": argv.get("--Runtime"),
        "ModelUri": argv.get("--ModelUri"),
        "Cpu": Utils.try_to_json(argv, "--Cpu"),
        "Memory": Utils.try_to_json(argv, "--Memory"),
        "TflopUnits": Utils.try_to_json(argv, "--TflopUnits"),
        "GpuMemory": Utils.try_to_json(argv, "--GpuMemory"),

    }
    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.CreateServiceConfigRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CreateServiceConfig(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])
Beispiel #29
0
def doDescribeUserCmdTaskInfo(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("DescribeUserCmdTaskInfo", 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"),
        "OrderField": Utils.try_to_json(argv, "--OrderField"),
        "Order": Utils.try_to_json(argv, "--Order"),
        "SearchKey": Utils.try_to_json(argv, "--SearchKey"),
    }
    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.BmClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.DescribeUserCmdTaskInfoRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.DescribeUserCmdTaskInfo(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])
Beispiel #30
0
def doCreatePullStreamConfig(argv, arglist):
    g_param = parse_global_arg(argv)
    if "help" in argv:
        show_help("CreatePullStreamConfig", g_param[OptionsDefine.Version])
        return

    param = {
        "FromUrl": Utils.try_to_json(argv, "--FromUrl"),
        "ToUrl": Utils.try_to_json(argv, "--ToUrl"),
        "AreaId": Utils.try_to_json(argv, "--AreaId"),
        "IspId": Utils.try_to_json(argv, "--IspId"),
        "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.LiveClient(cred, g_param[OptionsDefine.Region], profile)
    client._sdkVersion += ("_CLI_" + __version__)
    models = MODELS_MAP[g_param[OptionsDefine.Version]]
    model = models.CreatePullStreamConfigRequest()
    model.from_json_string(json.dumps(param))
    rsp = client.CreatePullStreamConfig(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])