tccli 3.0.1169.1__py2.py3-none-any.whl → 3.0.1171.1__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -797,6 +797,58 @@ def doDescribeHBaseTableOverview(args, parsed_globals):
797
797
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
798
798
 
799
799
 
800
+ def doDescribeServiceNodeInfos(args, parsed_globals):
801
+ g_param = parse_global_arg(parsed_globals)
802
+
803
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
804
+ cred = credential.CVMRoleCredential()
805
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
806
+ cred = credential.STSAssumeRoleCredential(
807
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
808
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
809
+ )
810
+ 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):
811
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
812
+ else:
813
+ cred = credential.Credential(
814
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
815
+ )
816
+ http_profile = HttpProfile(
817
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
818
+ reqMethod="POST",
819
+ endpoint=g_param[OptionsDefine.Endpoint],
820
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
821
+ )
822
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
823
+ if g_param[OptionsDefine.Language]:
824
+ profile.language = g_param[OptionsDefine.Language]
825
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
826
+ client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
827
+ client._sdkVersion += ("_CLI_" + __version__)
828
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
829
+ model = models.DescribeServiceNodeInfosRequest()
830
+ model.from_json_string(json.dumps(args))
831
+ start_time = time.time()
832
+ while True:
833
+ rsp = client.DescribeServiceNodeInfos(model)
834
+ result = rsp.to_json_string()
835
+ try:
836
+ json_obj = json.loads(result)
837
+ except TypeError as e:
838
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
839
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
840
+ break
841
+ cur_time = time.time()
842
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
843
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
844
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
845
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
846
+ else:
847
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
848
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
849
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
850
+
851
+
800
852
  def doDescribeInstances(args, parsed_globals):
801
853
  g_param = parse_global_arg(parsed_globals)
802
854
 
@@ -849,7 +901,7 @@ def doDescribeInstances(args, parsed_globals):
849
901
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
850
902
 
851
903
 
852
- def doRunJobFlow(args, parsed_globals):
904
+ def doModifyYarnDeploy(args, parsed_globals):
853
905
  g_param = parse_global_arg(parsed_globals)
854
906
 
855
907
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -878,11 +930,11 @@ def doRunJobFlow(args, parsed_globals):
878
930
  client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
879
931
  client._sdkVersion += ("_CLI_" + __version__)
880
932
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
881
- model = models.RunJobFlowRequest()
933
+ model = models.ModifyYarnDeployRequest()
882
934
  model.from_json_string(json.dumps(args))
883
935
  start_time = time.time()
884
936
  while True:
885
- rsp = client.RunJobFlow(model)
937
+ rsp = client.ModifyYarnDeploy(model)
886
938
  result = rsp.to_json_string()
887
939
  try:
888
940
  json_obj = json.loads(result)
@@ -1629,6 +1681,58 @@ def doAddMetricScaleStrategy(args, parsed_globals):
1629
1681
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1630
1682
 
1631
1683
 
1684
+ def doDescribeYarnScheduleHistory(args, parsed_globals):
1685
+ g_param = parse_global_arg(parsed_globals)
1686
+
1687
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1688
+ cred = credential.CVMRoleCredential()
1689
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1690
+ cred = credential.STSAssumeRoleCredential(
1691
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1692
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1693
+ )
1694
+ 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):
1695
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1696
+ else:
1697
+ cred = credential.Credential(
1698
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1699
+ )
1700
+ http_profile = HttpProfile(
1701
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1702
+ reqMethod="POST",
1703
+ endpoint=g_param[OptionsDefine.Endpoint],
1704
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1705
+ )
1706
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1707
+ if g_param[OptionsDefine.Language]:
1708
+ profile.language = g_param[OptionsDefine.Language]
1709
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1710
+ client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
1711
+ client._sdkVersion += ("_CLI_" + __version__)
1712
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1713
+ model = models.DescribeYarnScheduleHistoryRequest()
1714
+ model.from_json_string(json.dumps(args))
1715
+ start_time = time.time()
1716
+ while True:
1717
+ rsp = client.DescribeYarnScheduleHistory(model)
1718
+ result = rsp.to_json_string()
1719
+ try:
1720
+ json_obj = json.loads(result)
1721
+ except TypeError as e:
1722
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1723
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1724
+ break
1725
+ cur_time = time.time()
1726
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1727
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1728
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1729
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1730
+ else:
1731
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1732
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1733
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1734
+
1735
+
1632
1736
  def doModifyResourceScheduleConfig(args, parsed_globals):
1633
1737
  g_param = parse_global_arg(parsed_globals)
1634
1738
 
@@ -2357,6 +2461,58 @@ def doScaleOutCluster(args, parsed_globals):
2357
2461
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
2358
2462
 
2359
2463
 
2464
+ def doRunJobFlow(args, parsed_globals):
2465
+ g_param = parse_global_arg(parsed_globals)
2466
+
2467
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
2468
+ cred = credential.CVMRoleCredential()
2469
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
2470
+ cred = credential.STSAssumeRoleCredential(
2471
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
2472
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
2473
+ )
2474
+ 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):
2475
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
2476
+ else:
2477
+ cred = credential.Credential(
2478
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
2479
+ )
2480
+ http_profile = HttpProfile(
2481
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
2482
+ reqMethod="POST",
2483
+ endpoint=g_param[OptionsDefine.Endpoint],
2484
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
2485
+ )
2486
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
2487
+ if g_param[OptionsDefine.Language]:
2488
+ profile.language = g_param[OptionsDefine.Language]
2489
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
2490
+ client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
2491
+ client._sdkVersion += ("_CLI_" + __version__)
2492
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
2493
+ model = models.RunJobFlowRequest()
2494
+ model.from_json_string(json.dumps(args))
2495
+ start_time = time.time()
2496
+ while True:
2497
+ rsp = client.RunJobFlow(model)
2498
+ result = rsp.to_json_string()
2499
+ try:
2500
+ json_obj = json.loads(result)
2501
+ except TypeError as e:
2502
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
2503
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
2504
+ break
2505
+ cur_time = time.time()
2506
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
2507
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
2508
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
2509
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
2510
+ else:
2511
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
2512
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
2513
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
2514
+
2515
+
2360
2516
  CLIENT_MAP = {
2361
2517
  "v20190103": emr_client_v20190103,
2362
2518
 
@@ -2383,8 +2539,9 @@ ACTION_MAP = {
2383
2539
  "ScaleOutInstance": doScaleOutInstance,
2384
2540
  "ModifyUserManagerPwd": doModifyUserManagerPwd,
2385
2541
  "DescribeHBaseTableOverview": doDescribeHBaseTableOverview,
2542
+ "DescribeServiceNodeInfos": doDescribeServiceNodeInfos,
2386
2543
  "DescribeInstances": doDescribeInstances,
2387
- "RunJobFlow": doRunJobFlow,
2544
+ "ModifyYarnDeploy": doModifyYarnDeploy,
2388
2545
  "TerminateClusterNodes": doTerminateClusterNodes,
2389
2546
  "DescribeEmrOverviewMetrics": doDescribeEmrOverviewMetrics,
2390
2547
  "DescribeUsersForUserManager": doDescribeUsersForUserManager,
@@ -2399,6 +2556,7 @@ ACTION_MAP = {
2399
2556
  "CreateInstance": doCreateInstance,
2400
2557
  "InquiryPriceCreateInstance": doInquiryPriceCreateInstance,
2401
2558
  "AddMetricScaleStrategy": doAddMetricScaleStrategy,
2559
+ "DescribeYarnScheduleHistory": doDescribeYarnScheduleHistory,
2402
2560
  "ModifyResourceScheduleConfig": doModifyResourceScheduleConfig,
2403
2561
  "DescribeHiveQueries": doDescribeHiveQueries,
2404
2562
  "StartStopServiceOrMonitor": doStartStopServiceOrMonitor,
@@ -2413,6 +2571,7 @@ ACTION_MAP = {
2413
2571
  "ModifyResourcePools": doModifyResourcePools,
2414
2572
  "DescribeInsightList": doDescribeInsightList,
2415
2573
  "ScaleOutCluster": doScaleOutCluster,
2574
+ "RunJobFlow": doRunJobFlow,
2416
2575
 
2417
2576
  }
2418
2577