tccli 3.0.1196.1__py2.py3-none-any.whl → 3.0.1198.1__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. tccli/__init__.py +1 -1
  2. tccli/services/apigateway/apigateway_client.py +57 -4
  3. tccli/services/apigateway/v20180808/api.json +24 -0
  4. tccli/services/apigateway/v20180808/examples.json +8 -0
  5. tccli/services/cvm/v20170312/api.json +24 -24
  6. tccli/services/emr/emr_client.py +114 -8
  7. tccli/services/emr/v20190103/api.json +296 -3
  8. tccli/services/emr/v20190103/examples.json +16 -0
  9. tccli/services/ess/v20201111/api.json +19 -1
  10. tccli/services/ess/v20201111/examples.json +1 -1
  11. tccli/services/essbasic/v20210526/api.json +18 -0
  12. tccli/services/essbasic/v20210526/examples.json +1 -1
  13. tccli/services/faceid/v20180301/api.json +9 -0
  14. tccli/services/hunyuan/v20230901/api.json +1 -1
  15. tccli/services/organization/organization_client.py +106 -0
  16. tccli/services/organization/v20210331/api.json +324 -27
  17. tccli/services/organization/v20210331/examples.json +17 -1
  18. tccli/services/postgres/postgres_client.py +106 -0
  19. tccli/services/postgres/v20170312/api.json +236 -9
  20. tccli/services/postgres/v20170312/examples.json +24 -2
  21. tccli/services/sms/v20190711/api.json +8 -8
  22. tccli/services/sms/v20210111/api.json +13 -13
  23. tccli/services/teo/v20220901/api.json +6 -6
  24. tccli/services/vod/v20180717/api.json +3 -3
  25. {tccli-3.0.1196.1.dist-info → tccli-3.0.1198.1.dist-info}/METADATA +2 -2
  26. {tccli-3.0.1196.1.dist-info → tccli-3.0.1198.1.dist-info}/RECORD +29 -29
  27. {tccli-3.0.1196.1.dist-info → tccli-3.0.1198.1.dist-info}/WHEEL +0 -0
  28. {tccli-3.0.1196.1.dist-info → tccli-3.0.1198.1.dist-info}/entry_points.txt +0 -0
  29. {tccli-3.0.1196.1.dist-info → tccli-3.0.1198.1.dist-info}/license_files/LICENSE +0 -0
tccli/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '3.0.1196.1'
1
+ __version__ = '3.0.1198.1'
@@ -2721,6 +2721,58 @@ def doCreateApi(args, parsed_globals):
2721
2721
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
2722
2722
 
2723
2723
 
2724
+ def doDescribeServiceSubDomainMappings(args, parsed_globals):
2725
+ g_param = parse_global_arg(parsed_globals)
2726
+
2727
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
2728
+ cred = credential.CVMRoleCredential()
2729
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
2730
+ cred = credential.STSAssumeRoleCredential(
2731
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
2732
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
2733
+ )
2734
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
2735
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
2736
+ else:
2737
+ cred = credential.Credential(
2738
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
2739
+ )
2740
+ http_profile = HttpProfile(
2741
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
2742
+ reqMethod="POST",
2743
+ endpoint=g_param[OptionsDefine.Endpoint],
2744
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
2745
+ )
2746
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
2747
+ if g_param[OptionsDefine.Language]:
2748
+ profile.language = g_param[OptionsDefine.Language]
2749
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
2750
+ client = mod.ApigatewayClient(cred, g_param[OptionsDefine.Region], profile)
2751
+ client._sdkVersion += ("_CLI_" + __version__)
2752
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
2753
+ model = models.DescribeServiceSubDomainMappingsRequest()
2754
+ model.from_json_string(json.dumps(args))
2755
+ start_time = time.time()
2756
+ while True:
2757
+ rsp = client.DescribeServiceSubDomainMappings(model)
2758
+ result = rsp.to_json_string()
2759
+ try:
2760
+ json_obj = json.loads(result)
2761
+ except TypeError as e:
2762
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
2763
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
2764
+ break
2765
+ cur_time = time.time()
2766
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
2767
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
2768
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
2769
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
2770
+ else:
2771
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
2772
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
2773
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
2774
+
2775
+
2724
2776
  def doDescribeExclusiveInstanceDetail(args, parsed_globals):
2725
2777
  g_param = parse_global_arg(parsed_globals)
2726
2778
 
@@ -4385,7 +4437,7 @@ def doDescribeServiceUsagePlan(args, parsed_globals):
4385
4437
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
4386
4438
 
4387
4439
 
4388
- def doDescribeServiceSubDomainMappings(args, parsed_globals):
4440
+ def doDescribeExclusiveInstanceRegions(args, parsed_globals):
4389
4441
  g_param = parse_global_arg(parsed_globals)
4390
4442
 
4391
4443
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -4414,11 +4466,11 @@ def doDescribeServiceSubDomainMappings(args, parsed_globals):
4414
4466
  client = mod.ApigatewayClient(cred, g_param[OptionsDefine.Region], profile)
4415
4467
  client._sdkVersion += ("_CLI_" + __version__)
4416
4468
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
4417
- model = models.DescribeServiceSubDomainMappingsRequest()
4469
+ model = models.DescribeExclusiveInstanceRegionsRequest()
4418
4470
  model.from_json_string(json.dumps(args))
4419
4471
  start_time = time.time()
4420
4472
  while True:
4421
- rsp = client.DescribeServiceSubDomainMappings(model)
4473
+ rsp = client.DescribeExclusiveInstanceRegions(model)
4422
4474
  result = rsp.to_json_string()
4423
4475
  try:
4424
4476
  json_obj = json.loads(result)
@@ -5072,6 +5124,7 @@ ACTION_MAP = {
5072
5124
  "DescribePlugins": doDescribePlugins,
5073
5125
  "DeleteApiKey": doDeleteApiKey,
5074
5126
  "CreateApi": doCreateApi,
5127
+ "DescribeServiceSubDomainMappings": doDescribeServiceSubDomainMappings,
5075
5128
  "DescribeExclusiveInstanceDetail": doDescribeExclusiveInstanceDetail,
5076
5129
  "AttachPlugin": doAttachPlugin,
5077
5130
  "DescribePluginsByApi": doDescribePluginsByApi,
@@ -5104,7 +5157,7 @@ ACTION_MAP = {
5104
5157
  "DemoteServiceUsagePlan": doDemoteServiceUsagePlan,
5105
5158
  "DescribeServiceSubDomains": doDescribeServiceSubDomains,
5106
5159
  "DescribeServiceUsagePlan": doDescribeServiceUsagePlan,
5107
- "DescribeServiceSubDomainMappings": doDescribeServiceSubDomainMappings,
5160
+ "DescribeExclusiveInstanceRegions": doDescribeExclusiveInstanceRegions,
5108
5161
  "UpdateApiKey": doUpdateApiKey,
5109
5162
  "DeletePlugin": doDeletePlugin,
5110
5163
  "BindIPStrategy": doBindIPStrategy,
@@ -294,6 +294,13 @@
294
294
  "output": "DescribeExclusiveInstanceDetailResponse",
295
295
  "status": "online"
296
296
  },
297
+ "DescribeExclusiveInstanceRegions": {
298
+ "document": "Get the list of supported regions for dedicated instances",
299
+ "input": "DescribeExclusiveInstanceRegionsRequest",
300
+ "name": "获取专享实例支持地域列表",
301
+ "output": "DescribeExclusiveInstanceRegionsResponse",
302
+ "status": "online"
303
+ },
297
304
  "DescribeExclusiveInstances": {
298
305
  "document": "本接口(DescribeExclusiveInstances)用于查询独享实例列表信息。",
299
306
  "input": "DescribeExclusiveInstancesRequest",
@@ -6336,6 +6343,23 @@
6336
6343
  ],
6337
6344
  "type": "object"
6338
6345
  },
6346
+ "DescribeExclusiveInstanceRegionsRequest": {
6347
+ "document": "DescribeExclusiveInstanceRegions请求参数结构体",
6348
+ "members": [],
6349
+ "type": "object"
6350
+ },
6351
+ "DescribeExclusiveInstanceRegionsResponse": {
6352
+ "document": "DescribeExclusiveInstanceRegions返回参数结构体",
6353
+ "members": [
6354
+ {
6355
+ "document": "唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。",
6356
+ "member": "string",
6357
+ "name": "RequestId",
6358
+ "type": "string"
6359
+ }
6360
+ ],
6361
+ "type": "object"
6362
+ },
6339
6363
  "DescribeExclusiveInstancesRequest": {
6340
6364
  "document": "DescribeExclusiveInstances请求参数结构体",
6341
6365
  "members": [
@@ -342,6 +342,14 @@
342
342
  "title": "DescribeExclusiveInstanceDetail"
343
343
  }
344
344
  ],
345
+ "DescribeExclusiveInstanceRegions": [
346
+ {
347
+ "document": "",
348
+ "input": "POST / HTTP/1.1\nHost: apigateway.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: DescribeExclusiveInstanceRegions\n<公共请求参数>\n\n{}",
349
+ "output": "{\n \"Response\": {\n \"RequestId\": \"8e6e4a58-8059-4734-a2bf-c8fb3dfe0b19\"\n }\n}",
350
+ "title": "获取地域列表"
351
+ }
352
+ ],
345
353
  "DescribeExclusiveInstances": [
346
354
  {
347
355
  "document": "查询独享实例列表",
@@ -9871,7 +9871,7 @@
9871
9871
  "example": "rep-xxxxxxxx",
9872
9872
  "member": "string",
9873
9873
  "name": "TaskId",
9874
- "required": true,
9874
+ "output_required": true,
9875
9875
  "type": "string",
9876
9876
  "value_allowed_null": false
9877
9877
  },
@@ -9881,7 +9881,7 @@
9881
9881
  "example": "ins-xxxxxxxx",
9882
9882
  "member": "string",
9883
9883
  "name": "InstanceId",
9884
- "required": true,
9884
+ "output_required": true,
9885
9885
  "type": "string",
9886
9886
  "value_allowed_null": false
9887
9887
  },
@@ -9891,7 +9891,7 @@
9891
9891
  "example": "test",
9892
9892
  "member": "string",
9893
9893
  "name": "Alias",
9894
- "required": true,
9894
+ "output_required": true,
9895
9895
  "type": "string",
9896
9896
  "value_allowed_null": true
9897
9897
  },
@@ -9901,7 +9901,7 @@
9901
9901
  "example": "101",
9902
9902
  "member": "uint64",
9903
9903
  "name": "TaskTypeId",
9904
- "required": true,
9904
+ "output_required": true,
9905
9905
  "type": "int",
9906
9906
  "value_allowed_null": false
9907
9907
  },
@@ -9911,7 +9911,7 @@
9911
9911
  "example": "实例运行隐患",
9912
9912
  "member": "string",
9913
9913
  "name": "TaskTypeName",
9914
- "required": false,
9914
+ "output_required": true,
9915
9915
  "type": "string",
9916
9916
  "value_allowed_null": false
9917
9917
  },
@@ -9921,7 +9921,7 @@
9921
9921
  "example": "1",
9922
9922
  "member": "uint64",
9923
9923
  "name": "TaskStatus",
9924
- "required": true,
9924
+ "output_required": true,
9925
9925
  "type": "int",
9926
9926
  "value_allowed_null": false
9927
9927
  },
@@ -9931,7 +9931,7 @@
9931
9931
  "example": "1",
9932
9932
  "member": "uint64",
9933
9933
  "name": "DeviceStatus",
9934
- "required": false,
9934
+ "output_required": true,
9935
9935
  "type": "int",
9936
9936
  "value_allowed_null": false
9937
9937
  },
@@ -9941,7 +9941,7 @@
9941
9941
  "example": "1",
9942
9942
  "member": "uint64",
9943
9943
  "name": "OperateStatus",
9944
- "required": false,
9944
+ "output_required": true,
9945
9945
  "type": "int",
9946
9946
  "value_allowed_null": false
9947
9947
  },
@@ -9951,7 +9951,7 @@
9951
9951
  "example": "2017-01-01 12:00:00",
9952
9952
  "member": "datetime",
9953
9953
  "name": "CreateTime",
9954
- "required": true,
9954
+ "output_required": true,
9955
9955
  "type": "string",
9956
9956
  "value_allowed_null": false
9957
9957
  },
@@ -9961,7 +9961,7 @@
9961
9961
  "example": "2017-01-03 12:00:00",
9962
9962
  "member": "datetime",
9963
9963
  "name": "AuthTime",
9964
- "required": true,
9964
+ "output_required": true,
9965
9965
  "type": "string",
9966
9966
  "value_allowed_null": true
9967
9967
  },
@@ -9971,7 +9971,7 @@
9971
9971
  "example": "2017-01-03 14:00:00",
9972
9972
  "member": "datetime",
9973
9973
  "name": "EndTime",
9974
- "required": true,
9974
+ "output_required": true,
9975
9975
  "type": "string",
9976
9976
  "value_allowed_null": true
9977
9977
  },
@@ -9981,7 +9981,7 @@
9981
9981
  "example": "监控到您的云服务器存在隐患,可能导致云服务器高负载或宕机。为尽快修复隐患,需要您授权我们在线迁移。感谢您的支持与理解。",
9982
9982
  "member": "string",
9983
9983
  "name": "TaskDetail",
9984
- "required": true,
9984
+ "output_required": true,
9985
9985
  "type": "string",
9986
9986
  "value_allowed_null": true
9987
9987
  },
@@ -9991,7 +9991,7 @@
9991
9991
  "example": "ap-guangzhou-7",
9992
9992
  "member": "string",
9993
9993
  "name": "Zone",
9994
- "required": true,
9994
+ "output_required": true,
9995
9995
  "type": "string",
9996
9996
  "value_allowed_null": true
9997
9997
  },
@@ -10001,7 +10001,7 @@
10001
10001
  "example": "ap-guangzhou",
10002
10002
  "member": "string",
10003
10003
  "name": "Region",
10004
- "required": true,
10004
+ "output_required": true,
10005
10005
  "type": "string",
10006
10006
  "value_allowed_null": true
10007
10007
  },
@@ -10011,7 +10011,7 @@
10011
10011
  "example": "vpc-xxxxxxxx",
10012
10012
  "member": "string",
10013
10013
  "name": "VpcId",
10014
- "required": false,
10014
+ "output_required": true,
10015
10015
  "type": "string",
10016
10016
  "value_allowed_null": true
10017
10017
  },
@@ -10021,7 +10021,7 @@
10021
10021
  "example": "Default-VPC",
10022
10022
  "member": "string",
10023
10023
  "name": "VpcName",
10024
- "required": false,
10024
+ "output_required": true,
10025
10025
  "type": "string",
10026
10026
  "value_allowed_null": true
10027
10027
  },
@@ -10031,7 +10031,7 @@
10031
10031
  "example": "subnet-xxxxxxxx",
10032
10032
  "member": "string",
10033
10033
  "name": "SubnetId",
10034
- "required": false,
10034
+ "output_required": true,
10035
10035
  "type": "string",
10036
10036
  "value_allowed_null": true
10037
10037
  },
@@ -10041,7 +10041,7 @@
10041
10041
  "example": "Default-Subnet",
10042
10042
  "member": "string",
10043
10043
  "name": "SubnetName",
10044
- "required": false,
10044
+ "output_required": true,
10045
10045
  "type": "string",
10046
10046
  "value_allowed_null": true
10047
10047
  },
@@ -10051,7 +10051,7 @@
10051
10051
  "example": "11.22.33.44",
10052
10052
  "member": "string",
10053
10053
  "name": "WanIp",
10054
- "required": false,
10054
+ "output_required": true,
10055
10055
  "type": "string",
10056
10056
  "value_allowed_null": true
10057
10057
  },
@@ -10061,7 +10061,7 @@
10061
10061
  "example": "10.10.1.9",
10062
10062
  "member": "string",
10063
10063
  "name": "LanIp",
10064
- "required": false,
10064
+ "output_required": true,
10065
10065
  "type": "string",
10066
10066
  "value_allowed_null": true
10067
10067
  },
@@ -10071,7 +10071,7 @@
10071
10071
  "example": "CVM",
10072
10072
  "member": "string",
10073
10073
  "name": "Product",
10074
- "required": false,
10074
+ "output_required": true,
10075
10075
  "type": "string",
10076
10076
  "value_allowed_null": true
10077
10077
  },
@@ -10081,7 +10081,7 @@
10081
10081
  "example": "NA",
10082
10082
  "member": "string",
10083
10083
  "name": "TaskSubType",
10084
- "required": false,
10084
+ "output_required": true,
10085
10085
  "type": "string",
10086
10086
  "value_allowed_null": true
10087
10087
  },
@@ -10091,7 +10091,7 @@
10091
10091
  "example": "1",
10092
10092
  "member": "uint64",
10093
10093
  "name": "AuthType",
10094
- "required": false,
10094
+ "output_required": true,
10095
10095
  "type": "int",
10096
10096
  "value_allowed_null": false
10097
10097
  },
@@ -10101,7 +10101,7 @@
10101
10101
  "example": "Customer_auth",
10102
10102
  "member": "string",
10103
10103
  "name": "AuthSource",
10104
- "required": false,
10104
+ "output_required": true,
10105
10105
  "type": "string",
10106
10106
  "value_allowed_null": false
10107
10107
  }
@@ -693,6 +693,58 @@ def doDescribeCvmQuota(args, parsed_globals):
693
693
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
694
694
 
695
695
 
696
+ def doModifyGlobalConfig(args, parsed_globals):
697
+ g_param = parse_global_arg(parsed_globals)
698
+
699
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
700
+ cred = credential.CVMRoleCredential()
701
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
702
+ cred = credential.STSAssumeRoleCredential(
703
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
704
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
705
+ )
706
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
707
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
708
+ else:
709
+ cred = credential.Credential(
710
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
711
+ )
712
+ http_profile = HttpProfile(
713
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
714
+ reqMethod="POST",
715
+ endpoint=g_param[OptionsDefine.Endpoint],
716
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
717
+ )
718
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
719
+ if g_param[OptionsDefine.Language]:
720
+ profile.language = g_param[OptionsDefine.Language]
721
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
722
+ client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
723
+ client._sdkVersion += ("_CLI_" + __version__)
724
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
725
+ model = models.ModifyGlobalConfigRequest()
726
+ model.from_json_string(json.dumps(args))
727
+ start_time = time.time()
728
+ while True:
729
+ rsp = client.ModifyGlobalConfig(model)
730
+ result = rsp.to_json_string()
731
+ try:
732
+ json_obj = json.loads(result)
733
+ except TypeError as e:
734
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
735
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
736
+ break
737
+ cur_time = time.time()
738
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
739
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
740
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
741
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
742
+ else:
743
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
744
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
745
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
746
+
747
+
696
748
  def doScaleOutInstance(args, parsed_globals):
697
749
  g_param = parse_global_arg(parsed_globals)
698
750
 
@@ -1161,6 +1213,58 @@ def doDescribeUsersForUserManager(args, parsed_globals):
1161
1213
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1162
1214
 
1163
1215
 
1216
+ def doAddMetricScaleStrategy(args, parsed_globals):
1217
+ g_param = parse_global_arg(parsed_globals)
1218
+
1219
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1220
+ cred = credential.CVMRoleCredential()
1221
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1222
+ cred = credential.STSAssumeRoleCredential(
1223
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1224
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1225
+ )
1226
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
1227
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1228
+ else:
1229
+ cred = credential.Credential(
1230
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1231
+ )
1232
+ http_profile = HttpProfile(
1233
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1234
+ reqMethod="POST",
1235
+ endpoint=g_param[OptionsDefine.Endpoint],
1236
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1237
+ )
1238
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1239
+ if g_param[OptionsDefine.Language]:
1240
+ profile.language = g_param[OptionsDefine.Language]
1241
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1242
+ client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
1243
+ client._sdkVersion += ("_CLI_" + __version__)
1244
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1245
+ model = models.AddMetricScaleStrategyRequest()
1246
+ model.from_json_string(json.dumps(args))
1247
+ start_time = time.time()
1248
+ while True:
1249
+ rsp = client.AddMetricScaleStrategy(model)
1250
+ result = rsp.to_json_string()
1251
+ try:
1252
+ json_obj = json.loads(result)
1253
+ except TypeError as e:
1254
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1255
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1256
+ break
1257
+ cur_time = time.time()
1258
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1259
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1260
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1261
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1262
+ else:
1263
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1264
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1265
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1266
+
1267
+
1164
1268
  def doDeleteUserManagerUserList(args, parsed_globals):
1165
1269
  g_param = parse_global_arg(parsed_globals)
1166
1270
 
@@ -2097,7 +2201,7 @@ def doInquirePriceRenewEmr(args, parsed_globals):
2097
2201
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
2098
2202
 
2099
2203
 
2100
- def doAddMetricScaleStrategy(args, parsed_globals):
2204
+ def doDescribeResourceSchedule(args, parsed_globals):
2101
2205
  g_param = parse_global_arg(parsed_globals)
2102
2206
 
2103
2207
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -2126,11 +2230,11 @@ def doAddMetricScaleStrategy(args, parsed_globals):
2126
2230
  client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
2127
2231
  client._sdkVersion += ("_CLI_" + __version__)
2128
2232
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
2129
- model = models.AddMetricScaleStrategyRequest()
2233
+ model = models.DescribeResourceScheduleRequest()
2130
2234
  model.from_json_string(json.dumps(args))
2131
2235
  start_time = time.time()
2132
2236
  while True:
2133
- rsp = client.AddMetricScaleStrategy(model)
2237
+ rsp = client.DescribeResourceSchedule(model)
2134
2238
  result = rsp.to_json_string()
2135
2239
  try:
2136
2240
  json_obj = json.loads(result)
@@ -2565,7 +2669,7 @@ def doDescribeAutoScaleStrategies(args, parsed_globals):
2565
2669
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
2566
2670
 
2567
2671
 
2568
- def doDescribeResourceSchedule(args, parsed_globals):
2672
+ def doDescribeGlobalConfig(args, parsed_globals):
2569
2673
  g_param = parse_global_arg(parsed_globals)
2570
2674
 
2571
2675
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -2594,11 +2698,11 @@ def doDescribeResourceSchedule(args, parsed_globals):
2594
2698
  client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
2595
2699
  client._sdkVersion += ("_CLI_" + __version__)
2596
2700
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
2597
- model = models.DescribeResourceScheduleRequest()
2701
+ model = models.DescribeGlobalConfigRequest()
2598
2702
  model.from_json_string(json.dumps(args))
2599
2703
  start_time = time.time()
2600
2704
  while True:
2601
- rsp = client.DescribeResourceSchedule(model)
2705
+ rsp = client.DescribeGlobalConfig(model)
2602
2706
  result = rsp.to_json_string()
2603
2707
  try:
2604
2708
  json_obj = json.loads(result)
@@ -3109,6 +3213,7 @@ ACTION_MAP = {
3109
3213
  "InquiryPriceScaleOutInstance": doInquiryPriceScaleOutInstance,
3110
3214
  "DescribeAutoScaleRecords": doDescribeAutoScaleRecords,
3111
3215
  "DescribeCvmQuota": doDescribeCvmQuota,
3216
+ "ModifyGlobalConfig": doModifyGlobalConfig,
3112
3217
  "ScaleOutInstance": doScaleOutInstance,
3113
3218
  "ModifyUserManagerPwd": doModifyUserManagerPwd,
3114
3219
  "DescribeHBaseTableOverview": doDescribeHBaseTableOverview,
@@ -3118,6 +3223,7 @@ ACTION_MAP = {
3118
3223
  "TerminateClusterNodes": doTerminateClusterNodes,
3119
3224
  "ResetYarnConfig": doResetYarnConfig,
3120
3225
  "DescribeUsersForUserManager": doDescribeUsersForUserManager,
3226
+ "AddMetricScaleStrategy": doAddMetricScaleStrategy,
3121
3227
  "DeleteUserManagerUserList": doDeleteUserManagerUserList,
3122
3228
  "TerminateSLInstance": doTerminateSLInstance,
3123
3229
  "AddUsersForUserManager": doAddUsersForUserManager,
@@ -3136,7 +3242,7 @@ ACTION_MAP = {
3136
3242
  "CreateInstance": doCreateInstance,
3137
3243
  "InquiryPriceCreateInstance": doInquiryPriceCreateInstance,
3138
3244
  "InquirePriceRenewEmr": doInquirePriceRenewEmr,
3139
- "AddMetricScaleStrategy": doAddMetricScaleStrategy,
3245
+ "DescribeResourceSchedule": doDescribeResourceSchedule,
3140
3246
  "DescribeYarnScheduleHistory": doDescribeYarnScheduleHistory,
3141
3247
  "ModifyResourceScheduleConfig": doModifyResourceScheduleConfig,
3142
3248
  "DescribeHiveQueries": doDescribeHiveQueries,
@@ -3145,7 +3251,7 @@ ACTION_MAP = {
3145
3251
  "TerminateTasks": doTerminateTasks,
3146
3252
  "TerminateInstance": doTerminateInstance,
3147
3253
  "DescribeAutoScaleStrategies": doDescribeAutoScaleStrategies,
3148
- "DescribeResourceSchedule": doDescribeResourceSchedule,
3254
+ "DescribeGlobalConfig": doDescribeGlobalConfig,
3149
3255
  "DescribeAutoScaleGroupGlobalConf": doDescribeAutoScaleGroupGlobalConf,
3150
3256
  "DescribeClusterNodes": doDescribeClusterNodes,
3151
3257
  "DescribeTrinoQueryInfo": doDescribeTrinoQueryInfo,