tccli 3.0.1154.1__py2.py3-none-any.whl → 3.0.1155.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.
tccli/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '3.0.1154.1'
1
+ __version__ = '3.0.1155.1'
@@ -643,7 +643,7 @@
643
643
  },
644
644
  {
645
645
  "disabled": false,
646
- "document": "任务状态0初始 1运行中 2已完成 3结束中 4已结束",
646
+ "document": "任务状态:\n0初始:任务创建,呼叫未开始\n1运行中\n2 已完成:任务中所有呼叫完成\n3结束中:任务到期,但仍有部分呼叫未结束\n4已结束:任务到期终止",
647
647
  "example": "1",
648
648
  "member": "uint64",
649
649
  "name": "State",
@@ -6172,7 +6172,7 @@
6172
6172
  },
6173
6173
  {
6174
6174
  "disabled": false,
6175
- "document": "是否只预检此次请求。true:发送检查请求,不会创建实例。检查项包括是否填写了必需参数,请求格式,业务限制等。如果检查不通过,则返回对应错误码;如果检查通过,则返回RequestId.默认为false:发送正常请求,通过检查后直接创建实例。",
6175
+ "document": "是否只预检此次请求。true:发送检查请求,不会创建实例。检查项包括是否填写了必需参数,请求格式,业务限制等。如果检查不通过,则返回对应错误码;如果检查通过,则返回 RequestIdfalse:发送正常请求,通过检查后直接创建实例。\n默认为 false。",
6176
6176
  "example": "true",
6177
6177
  "member": "bool",
6178
6178
  "name": "DryRun",
@@ -797,7 +797,7 @@ def doDescribeDatahubGroupOffsets(args, parsed_globals):
797
797
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
798
798
 
799
799
 
800
- def doCreateCdcCluster(args, parsed_globals):
800
+ def doDescribeDatahubTask(args, parsed_globals):
801
801
  g_param = parse_global_arg(parsed_globals)
802
802
 
803
803
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -826,11 +826,11 @@ def doCreateCdcCluster(args, parsed_globals):
826
826
  client = mod.CkafkaClient(cred, g_param[OptionsDefine.Region], profile)
827
827
  client._sdkVersion += ("_CLI_" + __version__)
828
828
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
829
- model = models.CreateCdcClusterRequest()
829
+ model = models.DescribeDatahubTaskRequest()
830
830
  model.from_json_string(json.dumps(args))
831
831
  start_time = time.time()
832
832
  while True:
833
- rsp = client.CreateCdcCluster(model)
833
+ rsp = client.DescribeDatahubTask(model)
834
834
  result = rsp.to_json_string()
835
835
  try:
836
836
  json_obj = json.loads(result)
@@ -1629,6 +1629,58 @@ def doDeleteInstancePost(args, parsed_globals):
1629
1629
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1630
1630
 
1631
1631
 
1632
+ def doModifyPassword(args, parsed_globals):
1633
+ g_param = parse_global_arg(parsed_globals)
1634
+
1635
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1636
+ cred = credential.CVMRoleCredential()
1637
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1638
+ cred = credential.STSAssumeRoleCredential(
1639
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1640
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1641
+ )
1642
+ 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):
1643
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1644
+ else:
1645
+ cred = credential.Credential(
1646
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1647
+ )
1648
+ http_profile = HttpProfile(
1649
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1650
+ reqMethod="POST",
1651
+ endpoint=g_param[OptionsDefine.Endpoint],
1652
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1653
+ )
1654
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1655
+ if g_param[OptionsDefine.Language]:
1656
+ profile.language = g_param[OptionsDefine.Language]
1657
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1658
+ client = mod.CkafkaClient(cred, g_param[OptionsDefine.Region], profile)
1659
+ client._sdkVersion += ("_CLI_" + __version__)
1660
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1661
+ model = models.ModifyPasswordRequest()
1662
+ model.from_json_string(json.dumps(args))
1663
+ start_time = time.time()
1664
+ while True:
1665
+ rsp = client.ModifyPassword(model)
1666
+ result = rsp.to_json_string()
1667
+ try:
1668
+ json_obj = json.loads(result)
1669
+ except TypeError as e:
1670
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1671
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1672
+ break
1673
+ cur_time = time.time()
1674
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1675
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1676
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1677
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1678
+ else:
1679
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1680
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1681
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1682
+
1683
+
1632
1684
  def doDescribeACL(args, parsed_globals):
1633
1685
  g_param = parse_global_arg(parsed_globals)
1634
1686
 
@@ -2253,7 +2305,7 @@ def doCreateConnectResource(args, parsed_globals):
2253
2305
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
2254
2306
 
2255
2307
 
2256
- def doDescribeDatahubTask(args, parsed_globals):
2308
+ def doModifyRoutineMaintenanceTask(args, parsed_globals):
2257
2309
  g_param = parse_global_arg(parsed_globals)
2258
2310
 
2259
2311
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -2282,11 +2334,11 @@ def doDescribeDatahubTask(args, parsed_globals):
2282
2334
  client = mod.CkafkaClient(cred, g_param[OptionsDefine.Region], profile)
2283
2335
  client._sdkVersion += ("_CLI_" + __version__)
2284
2336
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
2285
- model = models.DescribeDatahubTaskRequest()
2337
+ model = models.ModifyRoutineMaintenanceTaskRequest()
2286
2338
  model.from_json_string(json.dumps(args))
2287
2339
  start_time = time.time()
2288
2340
  while True:
2289
- rsp = client.DescribeDatahubTask(model)
2341
+ rsp = client.ModifyRoutineMaintenanceTask(model)
2290
2342
  result = rsp.to_json_string()
2291
2343
  try:
2292
2344
  json_obj = json.loads(result)
@@ -4177,7 +4229,7 @@ def doDeleteTopic(args, parsed_globals):
4177
4229
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
4178
4230
 
4179
4231
 
4180
- def doModifyPassword(args, parsed_globals):
4232
+ def doCreateCdcCluster(args, parsed_globals):
4181
4233
  g_param = parse_global_arg(parsed_globals)
4182
4234
 
4183
4235
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -4206,11 +4258,11 @@ def doModifyPassword(args, parsed_globals):
4206
4258
  client = mod.CkafkaClient(cred, g_param[OptionsDefine.Region], profile)
4207
4259
  client._sdkVersion += ("_CLI_" + __version__)
4208
4260
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
4209
- model = models.ModifyPasswordRequest()
4261
+ model = models.CreateCdcClusterRequest()
4210
4262
  model.from_json_string(json.dumps(args))
4211
4263
  start_time = time.time()
4212
4264
  while True:
4213
- rsp = client.ModifyPassword(model)
4265
+ rsp = client.CreateCdcCluster(model)
4214
4266
  result = rsp.to_json_string()
4215
4267
  try:
4216
4268
  json_obj = json.loads(result)
@@ -4359,7 +4411,7 @@ ACTION_MAP = {
4359
4411
  "SendMessage": doSendMessage,
4360
4412
  "DescribeUser": doDescribeUser,
4361
4413
  "DescribeDatahubGroupOffsets": doDescribeDatahubGroupOffsets,
4362
- "CreateCdcCluster": doCreateCdcCluster,
4414
+ "DescribeDatahubTask": doDescribeDatahubTask,
4363
4415
  "CreateTopicIpWhiteList": doCreateTopicIpWhiteList,
4364
4416
  "DeleteConnectResource": doDeleteConnectResource,
4365
4417
  "DescribeGroup": doDescribeGroup,
@@ -4375,6 +4427,7 @@ ACTION_MAP = {
4375
4427
  "FetchMessageListByOffset": doFetchMessageListByOffset,
4376
4428
  "CreateDatahubTopic": doCreateDatahubTopic,
4377
4429
  "DeleteInstancePost": doDeleteInstancePost,
4430
+ "ModifyPassword": doModifyPassword,
4378
4431
  "DescribeACL": doDescribeACL,
4379
4432
  "DescribeDatahubTopics": doDescribeDatahubTopics,
4380
4433
  "DescribeTopicDetail": doDescribeTopicDetail,
@@ -4387,7 +4440,7 @@ ACTION_MAP = {
4387
4440
  "DescribeConsumerGroup": doDescribeConsumerGroup,
4388
4441
  "DescribeTopicSubscribeGroup": doDescribeTopicSubscribeGroup,
4389
4442
  "CreateConnectResource": doCreateConnectResource,
4390
- "DescribeDatahubTask": doDescribeDatahubTask,
4443
+ "ModifyRoutineMaintenanceTask": doModifyRoutineMaintenanceTask,
4391
4444
  "CheckCdcCluster": doCheckCdcCluster,
4392
4445
  "DescribeTopicFlowRanking": doDescribeTopicFlowRanking,
4393
4446
  "DeleteRouteTriggerTime": doDeleteRouteTriggerTime,
@@ -4424,7 +4477,7 @@ ACTION_MAP = {
4424
4477
  "DescribeConnectResources": doDescribeConnectResources,
4425
4478
  "DescribeTopic": doDescribeTopic,
4426
4479
  "DeleteTopic": doDeleteTopic,
4427
- "ModifyPassword": doModifyPassword,
4480
+ "CreateCdcCluster": doCreateCdcCluster,
4428
4481
  "InquireCkafkaPrice": doInquireCkafkaPrice,
4429
4482
  "ModifyTopicAttributes": doModifyTopicAttributes,
4430
4483
 
@@ -560,6 +560,13 @@
560
560
  "output": "ModifyPasswordResponse",
561
561
  "status": "online"
562
562
  },
563
+ "ModifyRoutineMaintenanceTask": {
564
+ "document": "设置自动化运维属性",
565
+ "input": "ModifyRoutineMaintenanceTaskRequest",
566
+ "name": "设置自动化运维属性",
567
+ "output": "ModifyRoutineMaintenanceTaskResponse",
568
+ "status": "online"
569
+ },
563
570
  "ModifyTopicAttributes": {
564
571
  "document": "本接口用于修改主题属性。",
565
572
  "input": "ModifyTopicAttributesRequest",
@@ -13421,6 +13428,133 @@
13421
13428
  ],
13422
13429
  "type": "object"
13423
13430
  },
13431
+ "ModifyRoutineMaintenanceTaskRequest": {
13432
+ "document": "ModifyRoutineMaintenanceTask请求参数结构体",
13433
+ "members": [
13434
+ {
13435
+ "disabled": false,
13436
+ "document": "实例id",
13437
+ "example": "ckafka-pkbw2qkq",
13438
+ "member": "string",
13439
+ "name": "InstanceId",
13440
+ "required": true,
13441
+ "type": "string"
13442
+ },
13443
+ {
13444
+ "disabled": false,
13445
+ "document": "自动化运维类别",
13446
+ "example": "QUOTA",
13447
+ "member": "string",
13448
+ "name": "MaintenanceType",
13449
+ "required": true,
13450
+ "type": "string"
13451
+ },
13452
+ {
13453
+ "disabled": false,
13454
+ "document": "自动化运维子类别",
13455
+ "example": "INSTANCE_STORAGE_CAPACITY",
13456
+ "member": "string",
13457
+ "name": "MaintenanceSubtype",
13458
+ "required": true,
13459
+ "type": "string"
13460
+ },
13461
+ {
13462
+ "disabled": false,
13463
+ "document": "主题名称",
13464
+ "example": "test",
13465
+ "member": "string",
13466
+ "name": "TopicName",
13467
+ "required": false,
13468
+ "type": "string"
13469
+ },
13470
+ {
13471
+ "disabled": false,
13472
+ "document": "任务触发阈值",
13473
+ "example": "60",
13474
+ "member": "int64",
13475
+ "name": "ConfigureThreshold",
13476
+ "required": false,
13477
+ "type": "int"
13478
+ },
13479
+ {
13480
+ "disabled": false,
13481
+ "document": "任务调整步长",
13482
+ "example": "30",
13483
+ "member": "int64",
13484
+ "name": "ConfigureStepSize",
13485
+ "required": false,
13486
+ "type": "int"
13487
+ },
13488
+ {
13489
+ "disabled": false,
13490
+ "document": "任务调整上限",
13491
+ "example": "70",
13492
+ "member": "int64",
13493
+ "name": "ConfigureLimit",
13494
+ "required": false,
13495
+ "type": "int"
13496
+ },
13497
+ {
13498
+ "disabled": false,
13499
+ "document": "任务预期触发时间,存储从当日 0AM 开始偏移的秒数",
13500
+ "example": "9600",
13501
+ "member": "int64",
13502
+ "name": "PlannedTime",
13503
+ "required": false,
13504
+ "type": "int"
13505
+ },
13506
+ {
13507
+ "disabled": false,
13508
+ "document": "任务额外信息",
13509
+ "example": "{\"key\":\"value\"}",
13510
+ "member": "string",
13511
+ "name": "ExtraConfig",
13512
+ "required": false,
13513
+ "type": "string"
13514
+ },
13515
+ {
13516
+ "disabled": false,
13517
+ "document": "任务状态",
13518
+ "example": "1",
13519
+ "member": "int64",
13520
+ "name": "Status",
13521
+ "required": false,
13522
+ "type": "int"
13523
+ },
13524
+ {
13525
+ "disabled": false,
13526
+ "document": "执行week day",
13527
+ "example": "1,2,3,4,5,6,7",
13528
+ "member": "string",
13529
+ "name": "Week",
13530
+ "required": false,
13531
+ "type": "string"
13532
+ }
13533
+ ],
13534
+ "type": "object"
13535
+ },
13536
+ "ModifyRoutineMaintenanceTaskResponse": {
13537
+ "document": "ModifyRoutineMaintenanceTask返回参数结构体",
13538
+ "members": [
13539
+ {
13540
+ "disabled": false,
13541
+ "document": "返回结果",
13542
+ "example": "无",
13543
+ "member": "JgwOperateResponse",
13544
+ "name": "Result",
13545
+ "output_required": true,
13546
+ "type": "object",
13547
+ "value_allowed_null": false
13548
+ },
13549
+ {
13550
+ "document": "唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。",
13551
+ "member": "string",
13552
+ "name": "RequestId",
13553
+ "type": "string"
13554
+ }
13555
+ ],
13556
+ "type": "object"
13557
+ },
13424
13558
  "ModifyTopicAttributesRequest": {
13425
13559
  "document": "ModifyTopicAttributes请求参数结构体",
13426
13560
  "members": [
@@ -682,6 +682,14 @@
682
682
  "title": "修改密码"
683
683
  }
684
684
  ],
685
+ "ModifyRoutineMaintenanceTask": [
686
+ {
687
+ "document": "",
688
+ "input": "POST / HTTP/1.1\nHost: ckafka.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ModifyRoutineMaintenanceTask\n<公共请求参数>\n\n{\n \"InstanceId\": \"ckafka-9jnejnb9\",\n \"MaintenanceType\": \"RE_BALANCE\",\n \"MaintenanceSubtype\": \"INSTANCE_PARTITION_RE_BALANCE\",\n \"PlannedTime\": 79200,\n \"Status\": 1,\n \"Week\": \"1,2,3,4,5,6,7\"\n}",
689
+ "output": "{\n \"Response\": {\n \"Result\": {\n \"ReturnCode\": \"abc\",\n \"ReturnMessage\": \"abc\",\n \"Data\": {\n \"FlowId\": 0,\n \"RouteDTO\": {\n \"RouteId\": 0\n }\n }\n },\n \"RequestId\": \"abc\"\n }\n}",
690
+ "title": "设置实例属性"
691
+ }
692
+ ],
685
693
  "ModifyTopicAttributes": [
686
694
  {
687
695
  "document": "",
@@ -1421,6 +1421,58 @@ def doDescribeInstancesModification(args, parsed_globals):
1421
1421
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1422
1422
 
1423
1423
 
1424
+ def doCreateKeyPair(args, parsed_globals):
1425
+ g_param = parse_global_arg(parsed_globals)
1426
+
1427
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1428
+ cred = credential.CVMRoleCredential()
1429
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1430
+ cred = credential.STSAssumeRoleCredential(
1431
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1432
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1433
+ )
1434
+ 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):
1435
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1436
+ else:
1437
+ cred = credential.Credential(
1438
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1439
+ )
1440
+ http_profile = HttpProfile(
1441
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1442
+ reqMethod="POST",
1443
+ endpoint=g_param[OptionsDefine.Endpoint],
1444
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1445
+ )
1446
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1447
+ if g_param[OptionsDefine.Language]:
1448
+ profile.language = g_param[OptionsDefine.Language]
1449
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1450
+ client = mod.CvmClient(cred, g_param[OptionsDefine.Region], profile)
1451
+ client._sdkVersion += ("_CLI_" + __version__)
1452
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1453
+ model = models.CreateKeyPairRequest()
1454
+ model.from_json_string(json.dumps(args))
1455
+ start_time = time.time()
1456
+ while True:
1457
+ rsp = client.CreateKeyPair(model)
1458
+ result = rsp.to_json_string()
1459
+ try:
1460
+ json_obj = json.loads(result)
1461
+ except TypeError as e:
1462
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1463
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1464
+ break
1465
+ cur_time = time.time()
1466
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1467
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1468
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1469
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1470
+ else:
1471
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1472
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1473
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1474
+
1475
+
1424
1476
  def doAssociateInstancesKeyPairs(args, parsed_globals):
1425
1477
  g_param = parse_global_arg(parsed_globals)
1426
1478
 
@@ -2253,6 +2305,58 @@ def doDescribeHosts(args, parsed_globals):
2253
2305
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
2254
2306
 
2255
2307
 
2308
+ def doEnterRescueMode(args, parsed_globals):
2309
+ g_param = parse_global_arg(parsed_globals)
2310
+
2311
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
2312
+ cred = credential.CVMRoleCredential()
2313
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
2314
+ cred = credential.STSAssumeRoleCredential(
2315
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
2316
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
2317
+ )
2318
+ 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):
2319
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
2320
+ else:
2321
+ cred = credential.Credential(
2322
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
2323
+ )
2324
+ http_profile = HttpProfile(
2325
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
2326
+ reqMethod="POST",
2327
+ endpoint=g_param[OptionsDefine.Endpoint],
2328
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
2329
+ )
2330
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
2331
+ if g_param[OptionsDefine.Language]:
2332
+ profile.language = g_param[OptionsDefine.Language]
2333
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
2334
+ client = mod.CvmClient(cred, g_param[OptionsDefine.Region], profile)
2335
+ client._sdkVersion += ("_CLI_" + __version__)
2336
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
2337
+ model = models.EnterRescueModeRequest()
2338
+ model.from_json_string(json.dumps(args))
2339
+ start_time = time.time()
2340
+ while True:
2341
+ rsp = client.EnterRescueMode(model)
2342
+ result = rsp.to_json_string()
2343
+ try:
2344
+ json_obj = json.loads(result)
2345
+ except TypeError as e:
2346
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
2347
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
2348
+ break
2349
+ cur_time = time.time()
2350
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
2351
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
2352
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
2353
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
2354
+ else:
2355
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
2356
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
2357
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
2358
+
2359
+
2256
2360
  def doDescribeInstancesStatus(args, parsed_globals):
2257
2361
  g_param = parse_global_arg(parsed_globals)
2258
2362
 
@@ -2461,7 +2565,7 @@ def doModifyLaunchTemplateDefaultVersion(args, parsed_globals):
2461
2565
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
2462
2566
 
2463
2567
 
2464
- def doCreateKeyPair(args, parsed_globals):
2568
+ def doExitRescueMode(args, parsed_globals):
2465
2569
  g_param = parse_global_arg(parsed_globals)
2466
2570
 
2467
2571
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -2490,11 +2594,11 @@ def doCreateKeyPair(args, parsed_globals):
2490
2594
  client = mod.CvmClient(cred, g_param[OptionsDefine.Region], profile)
2491
2595
  client._sdkVersion += ("_CLI_" + __version__)
2492
2596
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
2493
- model = models.CreateKeyPairRequest()
2597
+ model = models.ExitRescueModeRequest()
2494
2598
  model.from_json_string(json.dumps(args))
2495
2599
  start_time = time.time()
2496
2600
  while True:
2497
- rsp = client.CreateKeyPair(model)
2601
+ rsp = client.ExitRescueMode(model)
2498
2602
  result = rsp.to_json_string()
2499
2603
  try:
2500
2604
  json_obj = json.loads(result)
@@ -5099,6 +5203,7 @@ ACTION_MAP = {
5099
5203
  "DescribeImageSharePermission": doDescribeImageSharePermission,
5100
5204
  "DescribeRegions": doDescribeRegions,
5101
5205
  "DescribeInstancesModification": doDescribeInstancesModification,
5206
+ "CreateKeyPair": doCreateKeyPair,
5102
5207
  "AssociateInstancesKeyPairs": doAssociateInstancesKeyPairs,
5103
5208
  "DisassociateInstancesKeyPairs": doDisassociateInstancesKeyPairs,
5104
5209
  "DeleteInstancesActionTimer": doDeleteInstancesActionTimer,
@@ -5115,11 +5220,12 @@ ACTION_MAP = {
5115
5220
  "RenewHosts": doRenewHosts,
5116
5221
  "RepairTaskControl": doRepairTaskControl,
5117
5222
  "DescribeHosts": doDescribeHosts,
5223
+ "EnterRescueMode": doEnterRescueMode,
5118
5224
  "DescribeInstancesStatus": doDescribeInstancesStatus,
5119
5225
  "ModifyImageSharePermission": doModifyImageSharePermission,
5120
5226
  "ImportInstancesActionTimer": doImportInstancesActionTimer,
5121
5227
  "ModifyLaunchTemplateDefaultVersion": doModifyLaunchTemplateDefaultVersion,
5122
- "CreateKeyPair": doCreateKeyPair,
5228
+ "ExitRescueMode": doExitRescueMode,
5123
5229
  "DescribeInstancesActionTimer": doDescribeInstancesActionTimer,
5124
5230
  "InquiryPriceResizeInstanceDisks": doInquiryPriceResizeInstanceDisks,
5125
5231
  "InquiryPriceResetInstance": doInquiryPriceResetInstance,
@@ -357,6 +357,20 @@
357
357
  "output": "DisassociateSecurityGroupsResponse",
358
358
  "status": "online"
359
359
  },
360
+ "EnterRescueMode": {
361
+ "document": "进入救援模式",
362
+ "input": "EnterRescueModeRequest",
363
+ "name": "进入救援模式",
364
+ "output": "EnterRescueModeResponse",
365
+ "status": "online"
366
+ },
367
+ "ExitRescueMode": {
368
+ "document": "退出救援模式",
369
+ "input": "ExitRescueModeRequest",
370
+ "name": "退出救援模式",
371
+ "output": "ExitRescueModeResponse",
372
+ "status": "online"
373
+ },
360
374
  "ExportImages": {
361
375
  "document": "提供导出自定义镜像到指定COS存储桶的能力",
362
376
  "input": "ExportImagesRequest",
@@ -4702,6 +4716,87 @@
4702
4716
  ],
4703
4717
  "usage": "both"
4704
4718
  },
4719
+ "EnterRescueModeRequest": {
4720
+ "document": "EnterRescueMode请求参数结构体",
4721
+ "members": [
4722
+ {
4723
+ "disabled": false,
4724
+ "document": "需要进入救援模式的实例id",
4725
+ "example": "'ins-abcdefg'",
4726
+ "member": "string",
4727
+ "name": "InstanceId",
4728
+ "required": true,
4729
+ "type": "string"
4730
+ },
4731
+ {
4732
+ "disabled": false,
4733
+ "document": "救援模式下系统密码",
4734
+ "example": "'hello123456789'",
4735
+ "member": "string",
4736
+ "name": "Password",
4737
+ "required": true,
4738
+ "type": "string"
4739
+ },
4740
+ {
4741
+ "disabled": false,
4742
+ "document": "救援模式下系统用户名",
4743
+ "example": "'root'",
4744
+ "member": "string",
4745
+ "name": "Username",
4746
+ "required": false,
4747
+ "type": "string"
4748
+ },
4749
+ {
4750
+ "disabled": false,
4751
+ "document": "是否强制关机",
4752
+ "example": "False",
4753
+ "member": "bool",
4754
+ "name": "ForceStop",
4755
+ "required": false,
4756
+ "type": "bool"
4757
+ }
4758
+ ],
4759
+ "type": "object"
4760
+ },
4761
+ "EnterRescueModeResponse": {
4762
+ "document": "EnterRescueMode返回参数结构体",
4763
+ "members": [
4764
+ {
4765
+ "document": "唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。",
4766
+ "member": "string",
4767
+ "name": "RequestId",
4768
+ "type": "string"
4769
+ }
4770
+ ],
4771
+ "type": "object"
4772
+ },
4773
+ "ExitRescueModeRequest": {
4774
+ "document": "ExitRescueMode请求参数结构体",
4775
+ "members": [
4776
+ {
4777
+ "disabled": false,
4778
+ "document": "退出救援模式的实例id",
4779
+ "example": "instance_Id",
4780
+ "member": "string",
4781
+ "name": "InstanceId",
4782
+ "required": true,
4783
+ "type": "string"
4784
+ }
4785
+ ],
4786
+ "type": "object"
4787
+ },
4788
+ "ExitRescueModeResponse": {
4789
+ "document": "ExitRescueMode返回参数结构体",
4790
+ "members": [
4791
+ {
4792
+ "document": "唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。",
4793
+ "member": "string",
4794
+ "name": "RequestId",
4795
+ "type": "string"
4796
+ }
4797
+ ],
4798
+ "type": "object"
4799
+ },
4705
4800
  "ExportImagesRequest": {
4706
4801
  "document": "ExportImages请求参数结构体",
4707
4802
  "members": [
@@ -438,6 +438,22 @@
438
438
  "title": "解绑实例安全组"
439
439
  }
440
440
  ],
441
+ "EnterRescueMode": [
442
+ {
443
+ "document": "",
444
+ "input": "POST / HTTP/1.1\nHost: cvm.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: EnterRescueMode\n<公共请求参数>\n\n{\n \"InstanceId\": \"instance_Id\",\n \"Password\": \"\\\"uu7797UUX\\\"\"\n}",
445
+ "output": "{\n \"Response\": {\n \"RequestId\": \"5920380e-277a-420a-a221-0caac3eb7159\"\n }\n}",
446
+ "title": "进入救援模式"
447
+ }
448
+ ],
449
+ "ExitRescueMode": [
450
+ {
451
+ "document": "",
452
+ "input": "https://cvm.tencentcloudapi.com/?Action=ExitRescueMode\n&InstanceId=instance_Id\n&<公共请求参数>",
453
+ "output": "{\n \"Response\": {\n \"RequestId\": \"5920380e-277a-420a-a221-0caac3eb7159\"\n }\n}",
454
+ "title": "退出救援模式"
455
+ }
456
+ ],
441
457
  "ExportImages": [
442
458
  {
443
459
  "document": "导出自定义镜像",