def doDescribeGameServerSessionDetails(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("DescribeGameServerSessionDetails", 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.DescribeGameServerSessionDetailsRequest() model.from_json_string(json.dumps(param)) rsp = client.DescribeGameServerSessionDetails(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"), "DataTimestamp": Utils.try_to_json(argv, "--DataTimestamp"), } 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])
def doCreateContractByUpload(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("CreateContractByUpload", g_param[OptionsDefine.Version]) return param = { "Module": argv.get("--Module"), "Operation": argv.get("--Operation"), "SignInfos": Utils.try_to_json(argv, "--SignInfos"), "ContractFile": argv.get("--ContractFile"), "ContractName": argv.get("--ContractName"), "Remarks": argv.get("--Remarks"), "Initiator": argv.get("--Initiator"), "ExpireTime": argv.get("--ExpireTime"), } 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.CreateContractByUploadRequest() model.from_json_string(json.dumps(param)) rsp = client.CreateContractByUpload(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 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"), "UserId": argv.get("--UserId"), "GameId": argv.get("--GameId"), "GameRegion": argv.get("--GameRegion"), "GameParas": argv.get("--GameParas"), "Resolution": argv.get("--Resolution"), "ImageUrl": argv.get("--ImageUrl"), "SetNo": Utils.try_to_json(argv, "--SetNo"), "Bitrate": Utils.try_to_json(argv, "--Bitrate"), "MaxBitrate": Utils.try_to_json(argv, "--MaxBitrate"), "MinBitrate": Utils.try_to_json(argv, "--MinBitrate"), "Fps": Utils.try_to_json(argv, "--Fps"), "UserIp": argv.get("--UserIp"), "Optimization": Utils.try_to_json(argv, "--Optimization"), } 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.GsClient(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])
def doCreateTrainingJob(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("CreateTrainingJob", g_param[OptionsDefine.Version]) return param = { "AlgorithmSpecification": Utils.try_to_json(argv, "--AlgorithmSpecification"), "InputDataConfig": Utils.try_to_json(argv, "--InputDataConfig"), "OutputDataConfig": Utils.try_to_json(argv, "--OutputDataConfig"), "ResourceConfig": Utils.try_to_json(argv, "--ResourceConfig"), "TrainingJobName": argv.get("--TrainingJobName"), "StoppingCondition": Utils.try_to_json(argv, "--StoppingCondition"), "VpcConfig": Utils.try_to_json(argv, "--VpcConfig"), "HyperParameters": argv.get("--HyperParameters"), "EnvConfig": Utils.try_to_json(argv, "--EnvConfig"), "RoleName": argv.get("--RoleName"), } 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.CreateTrainingJobRequest() model.from_json_string(json.dumps(param)) rsp = client.CreateTrainingJob(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 doCreateCluster(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("CreateCluster", g_param[OptionsDefine.Version]) return param = { "ClusterCIDRSettings": Utils.try_to_json(argv, "--ClusterCIDRSettings"), "ClusterType": argv.get("--ClusterType"), "RunInstancesForNode": Utils.try_to_json(argv, "--RunInstancesForNode"), "ClusterBasicSettings": Utils.try_to_json(argv, "--ClusterBasicSettings"), "ClusterAdvancedSettings": Utils.try_to_json(argv, "--ClusterAdvancedSettings"), "InstanceAdvancedSettings": Utils.try_to_json(argv, "--InstanceAdvancedSettings"), "ExistedInstancesForNode": Utils.try_to_json(argv, "--ExistedInstancesForNode"), } 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.CreateClusterRequest() model.from_json_string(json.dumps(param)) rsp = client.CreateCluster(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 doDescribeAgentDealsCache(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("DescribeAgentDealsCache", g_param[OptionsDefine.Version]) return param = { "Offset": Utils.try_to_json(argv, "--Offset"), "Limit": Utils.try_to_json(argv, "--Limit"), "CreatTimeRangeStart": argv.get("--CreatTimeRangeStart"), "CreatTimeRangeEnd": argv.get("--CreatTimeRangeEnd"), "Order": Utils.try_to_json(argv, "--Order"), "Status": Utils.try_to_json(argv, "--Status"), "OwnerUins": Utils.try_to_json(argv, "--OwnerUins"), "DealNames": Utils.try_to_json(argv, "--DealNames"), "PayerMode": Utils.try_to_json(argv, "--PayerMode"), } 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.PartnersClient(cred, g_param[OptionsDefine.Region], profile) client._sdkVersion += ("_CLI_" + __version__) models = MODELS_MAP[g_param[OptionsDefine.Version]] model = models.DescribeAgentDealsCacheRequest() model.from_json_string(json.dumps(param)) rsp = client.DescribeAgentDealsCache(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 doInquiryPriceCreateInstance(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("InquiryPriceCreateInstance", g_param[OptionsDefine.Version]) return param = { "TimeUnit": argv.get("--TimeUnit"), "TimeSpan": Utils.try_to_json(argv, "--TimeSpan"), "ResourceSpec": Utils.try_to_json(argv, "--ResourceSpec"), "Currency": argv.get("--Currency"), "PayMode": Utils.try_to_json(argv, "--PayMode"), "SupportHA": Utils.try_to_json(argv, "--SupportHA"), "Software": Utils.try_to_json(argv, "--Software"), "Placement": Utils.try_to_json(argv, "--Placement"), "VPCSettings": Utils.try_to_json(argv, "--VPCSettings"), } 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.InquiryPriceCreateInstanceRequest() model.from_json_string(json.dumps(param)) rsp = client.InquiryPriceCreateInstance(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 doTextToVoice(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("TextToVoice", g_param[OptionsDefine.Version]) return param = { "Text": argv.get("--Text"), "SessionId": argv.get("--SessionId"), "ModelType": Utils.try_to_json(argv, "--ModelType"), "Volume": Utils.try_to_json(argv, "--Volume"), "Speed": Utils.try_to_json(argv, "--Speed"), "ProjectId": Utils.try_to_json(argv, "--ProjectId"), "VoiceType": Utils.try_to_json(argv, "--VoiceType"), "PrimaryLanguage": Utils.try_to_json(argv, "--PrimaryLanguage"), "SampleRate": Utils.try_to_json(argv, "--SampleRate"), "Codec": argv.get("--Codec"), } 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.AaiClient(cred, g_param[OptionsDefine.Region], profile) client._sdkVersion += ("_CLI_" + __version__) models = MODELS_MAP[g_param[OptionsDefine.Version]] model = models.TextToVoiceRequest() model.from_json_string(json.dumps(param)) rsp = client.TextToVoice(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 doQueryLogs(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("QueryLogs", g_param[OptionsDefine.Version]) return param = { "JobName": argv.get("--JobName"), "Cluster": argv.get("--Cluster"), "StartTime": argv.get("--StartTime"), "EndTime": argv.get("--EndTime"), "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.TiaClient(cred, g_param[OptionsDefine.Region], profile) client._sdkVersion += ("_CLI_" + __version__) models = MODELS_MAP[g_param[OptionsDefine.Version]] model = models.QueryLogsRequest() model.from_json_string(json.dumps(param)) rsp = client.QueryLogs(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 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])
def doDownloadUserCert(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("DownloadUserCert", g_param[OptionsDefine.Version]) return param = { "Module": argv.get("--Module"), "Operation": argv.get("--Operation"), "CertId": Utils.try_to_json(argv, "--CertId"), "CertDn": argv.get("--CertDn"), "ClusterId": argv.get("--ClusterId"), "GroupName": argv.get("--GroupName"), } 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.DownloadUserCertRequest() model.from_json_string(json.dumps(param)) rsp = client.DownloadUserCert(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 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 doUpdateFunctionConfiguration(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("UpdateFunctionConfiguration", g_param[OptionsDefine.Version]) return param = { "FunctionName": Utils.try_to_json(argv, "--FunctionName"), "Description": Utils.try_to_json(argv, "--Description"), "MemorySize": Utils.try_to_json(argv, "--MemorySize"), "Timeout": Utils.try_to_json(argv, "--Timeout"), "Runtime": Utils.try_to_json(argv, "--Runtime"), "Environment": Utils.try_to_json(argv, "--Environment"), "VpcConfig": Utils.try_to_json(argv, "--VpcConfig"), } 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.UpdateFunctionConfigurationRequest() model.from_json_string(json.dumps(param)) rsp = client.UpdateFunctionConfiguration(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 doInquiryPriceCreateDBInstances(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("InquiryPriceCreateDBInstances", g_param[OptionsDefine.Version]) return param = { "Zone": Utils.try_to_json(argv, "--Zone"), "SpecCode": Utils.try_to_json(argv, "--SpecCode"), "Storage": Utils.try_to_json(argv, "--Storage"), "InstanceCount": Utils.try_to_json(argv, "--InstanceCount"), "Period": Utils.try_to_json(argv, "--Period"), "Pid": Utils.try_to_json(argv, "--Pid"), "InstanceChargeType": Utils.try_to_json(argv, "--InstanceChargeType"), } 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.PostgresClient(cred, g_param[OptionsDefine.Region], profile) client._sdkVersion += ("_CLI_" + __version__) models = MODELS_MAP[g_param[OptionsDefine.Version]] model = models.InquiryPriceCreateDBInstancesRequest() model.from_json_string(json.dumps(param)) rsp = client.InquiryPriceCreateDBInstances(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 doAssumeRoleWithSAML(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("AssumeRoleWithSAML", g_param[OptionsDefine.Version]) return param = { "SAMLAssertion": argv.get("--SAMLAssertion"), "PrincipalArn": argv.get("--PrincipalArn"), "RoleArn": argv.get("--RoleArn"), "RoleSessionName": argv.get("--RoleSessionName"), "DurationSeconds": Utils.try_to_json(argv, "--DurationSeconds"), } 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.StsClient(cred, g_param[OptionsDefine.Region], profile) client._sdkVersion += ("_CLI_" + __version__) models = MODELS_MAP[g_param[OptionsDefine.Version]] model = models.AssumeRoleWithSAMLRequest() model.from_json_string(json.dumps(param)) rsp = client.AssumeRoleWithSAML(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 bm_action(argv, arglist): if "help" in argv: versions = sorted(AVAILABLE_VERSIONS.keys()) opt_v = "--" + OptionsDefine.Version version = versions[-1] if opt_v in argv: version = 'v' + argv[opt_v].replace('-', '') if version not in versions: print("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST)) return action_str = "" docs = AVAILABLE_VERSIONS[version]["help"] desc = AVAILABLE_VERSIONS[version]["desc"] for action, info in docs.items(): action_str += " %s\n" % action action_str += Utils.split_str(" ", info["desc"], 120) helpstr = HelpTemplate.SERVICE % { "name": "bm", "desc": desc, "actions": action_str } print(helpstr) else: print(ErrorMsg.FEW_ARG)
def doUpdateAsrVocab(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("UpdateAsrVocab", g_param[OptionsDefine.Version]) return param = { "VocabId": argv.get("--VocabId"), "Name": argv.get("--Name"), "WordWeights": Utils.try_to_json(argv, "--WordWeights"), "WordWeightStr": argv.get("--WordWeightStr"), "Description": argv.get("--Description"), } 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.UpdateAsrVocabRequest() model.from_json_string(json.dumps(param)) rsp = client.UpdateAsrVocab(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 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": Utils.try_to_json(argv, "--Name"), "NeedLogin": Utils.try_to_json(argv, "--NeedLogin"), "LoginCookie": Utils.try_to_json(argv, "--LoginCookie"), "LoginCheckUrl": Utils.try_to_json(argv, "--LoginCheckUrl"), "LoginCheckKw": Utils.try_to_json(argv, "--LoginCheckKw"), "ScanDisallow": Utils.try_to_json(argv, "--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])
def doModifyPullStreamConfig(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("ModifyPullStreamConfig", g_param[OptionsDefine.Version]) return param = { "ConfigId": Utils.try_to_json(argv, "--ConfigId"), "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.ModifyPullStreamConfigRequest() model.from_json_string(json.dumps(param)) rsp = client.ModifyPullStreamConfig(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 doCreateApp(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("CreateApp", g_param[OptionsDefine.Version]) return param = { "AppName": argv.get("--AppName"), "ProjectId": Utils.try_to_json(argv, "--ProjectId"), "EngineList": Utils.try_to_json(argv, "--EngineList"), "RegionList": Utils.try_to_json(argv, "--RegionList"), "RealtimeSpeechConf": Utils.try_to_json(argv, "--RealtimeSpeechConf"), "VoiceMessageConf": Utils.try_to_json(argv, "--VoiceMessageConf"), "VoiceFilterConf": Utils.try_to_json(argv, "--VoiceFilterConf"), "Tags": Utils.try_to_json(argv, "--Tags"), } 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.GmeClient(cred, g_param[OptionsDefine.Region], profile) client._sdkVersion += ("_CLI_" + __version__) models = MODELS_MAP[g_param[OptionsDefine.Version]] model = models.CreateAppRequest() model.from_json_string(json.dumps(param)) rsp = client.CreateApp(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 doDescribeOriginData(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("DescribeOriginData", g_param[OptionsDefine.Version]) return param = { "StartTime": Utils.try_to_json(argv, "--StartTime"), "EndTime": Utils.try_to_json(argv, "--EndTime"), "Metric": Utils.try_to_json(argv, "--Metric"), "Domains": Utils.try_to_json(argv, "--Domains"), "Project": Utils.try_to_json(argv, "--Project"), "Interval": Utils.try_to_json(argv, "--Interval"), "Detail": Utils.try_to_json(argv, "--Detail"), } 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.DescribeOriginDataRequest() model.from_json_string(json.dumps(param)) rsp = client.DescribeOriginData(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 doDetectAuth(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("DetectAuth", g_param[OptionsDefine.Version]) return param = { "RuleId": Utils.try_to_json(argv, "--RuleId"), "TerminalType": Utils.try_to_json(argv, "--TerminalType"), "IdCard": Utils.try_to_json(argv, "--IdCard"), "Name": Utils.try_to_json(argv, "--Name"), "RedirectUrl": Utils.try_to_json(argv, "--RedirectUrl"), "Extra": Utils.try_to_json(argv, "--Extra"), "ImageBase64": Utils.try_to_json(argv, "--ImageBase64"), } 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.DetectAuthRequest() model.from_json_string(json.dumps(param)) rsp = client.DetectAuth(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 doCreateAutoSnapshotPolicy(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("CreateAutoSnapshotPolicy", g_param[OptionsDefine.Version]) return param = { "Policy": Utils.try_to_json(argv, "--Policy"), "AutoSnapshotPolicyName": Utils.try_to_json(argv, "--AutoSnapshotPolicyName"), "IsActivated": Utils.try_to_json(argv, "--IsActivated"), "IsPermanent": Utils.try_to_json(argv, "--IsPermanent"), "RetentionDays": Utils.try_to_json(argv, "--RetentionDays"), "DryRun": Utils.try_to_json(argv, "--DryRun"), } 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.CreateAutoSnapshotPolicyRequest() model.from_json_string(json.dumps(param)) rsp = client.CreateAutoSnapshotPolicy(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 doModifyTargetPort(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("ModifyTargetPort", g_param[OptionsDefine.Version]) return param = { "LoadBalancerId": Utils.try_to_json(argv, "--LoadBalancerId"), "ListenerId": Utils.try_to_json(argv, "--ListenerId"), "Targets": Utils.try_to_json(argv, "--Targets"), "NewPort": Utils.try_to_json(argv, "--NewPort"), "LocationId": Utils.try_to_json(argv, "--LocationId"), "Domain": Utils.try_to_json(argv, "--Domain"), "Url": Utils.try_to_json(argv, "--Url"), } 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.ModifyTargetPortRequest() model.from_json_string(json.dumps(param)) rsp = client.ModifyTargetPort(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 doCreateEip(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("CreateEip", g_param[OptionsDefine.Version]) return param = { "GoodsNum": Utils.try_to_json(argv, "--GoodsNum"), "PayMode": Utils.try_to_json(argv, "--PayMode"), "Bandwidth": Utils.try_to_json(argv, "--Bandwidth"), "SetType": Utils.try_to_json(argv, "--SetType"), "Exclusive": Utils.try_to_json(argv, "--Exclusive"), "VpcId": Utils.try_to_json(argv, "--VpcId"), "IpList": Utils.try_to_json(argv, "--IpList"), } 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.BmeipClient(cred, g_param[OptionsDefine.Region], profile) client._sdkVersion += ("_CLI_" + __version__) models = MODELS_MAP[g_param[OptionsDefine.Version]] model = models.CreateEipRequest() model.from_json_string(json.dumps(param)) rsp = client.CreateEip(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 doListFunctions(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("ListFunctions", g_param[OptionsDefine.Version]) return param = { "Order": Utils.try_to_json(argv, "--Order"), "Orderby": Utils.try_to_json(argv, "--Orderby"), "Offset": Utils.try_to_json(argv, "--Offset"), "Limit": Utils.try_to_json(argv, "--Limit"), "SearchKey": Utils.try_to_json(argv, "--SearchKey"), "Description": Utils.try_to_json(argv, "--Description"), "Filters": Utils.try_to_json(argv, "--Filters"), } 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.ListFunctionsRequest() model.from_json_string(json.dumps(param)) rsp = client.ListFunctions(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 doCreateRecTask(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("CreateRecTask", g_param[OptionsDefine.Version]) return param = { "EngineModelType": argv.get("--EngineModelType"), "ChannelNum": Utils.try_to_json(argv, "--ChannelNum"), "ResTextFormat": Utils.try_to_json(argv, "--ResTextFormat"), "SourceType": Utils.try_to_json(argv, "--SourceType"), "CallbackUrl": argv.get("--CallbackUrl"), "Url": argv.get("--Url"), "Data": argv.get("--Data"), "DataLen": Utils.try_to_json(argv, "--DataLen"), "HotwordId": argv.get("--HotwordId"), "FilterDirty": Utils.try_to_json(argv, "--FilterDirty"), "FilterModal": Utils.try_to_json(argv, "--FilterModal"), } 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.CreateRecTaskRequest() model.from_json_string(json.dumps(param)) rsp = client.CreateRecTask(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 doKeywordEvaluate(argv, arglist): g_param = parse_global_arg(argv) if "help" in argv: show_help("KeywordEvaluate", g_param[OptionsDefine.Version]) return param = { "SeqId": Utils.try_to_json(argv, "--SeqId"), "IsEnd": Utils.try_to_json(argv, "--IsEnd"), "VoiceFileType": Utils.try_to_json(argv, "--VoiceFileType"), "VoiceEncodeType": Utils.try_to_json(argv, "--VoiceEncodeType"), "UserVoiceData": argv.get("--UserVoiceData"), "SessionId": argv.get("--SessionId"), "Keywords": Utils.try_to_json(argv, "--Keywords"), "SoeAppId": argv.get("--SoeAppId"), "IsQuery": Utils.try_to_json(argv, "--IsQuery"), } 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.SoeClient(cred, g_param[OptionsDefine.Region], profile) client._sdkVersion += ("_CLI_" + __version__) models = MODELS_MAP[g_param[OptionsDefine.Version]] model = models.KeywordEvaluateRequest() model.from_json_string(json.dumps(param)) rsp = client.KeywordEvaluate(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 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": Utils.try_to_json(argv, "--Image"), "Url": Utils.try_to_json(argv, "--Url"), "NeedFaceAttributes": Utils.try_to_json(argv, "--NeedFaceAttributes"), "NeedQualityDetection": Utils.try_to_json(argv, "--NeedQualityDetection"), } 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])