tccli 3.0.1342.1__py2.py3-none-any.whl → 3.0.1343.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.1342.1'
1
+ __version__ = '3.0.1343.1'
@@ -17,6 +17,58 @@ from tencentcloud.apm.v20210622 import models as models_v20210622
17
17
  from jmespath import search
18
18
  import time
19
19
 
20
+ def doCreateProfileTask(args, parsed_globals):
21
+ g_param = parse_global_arg(parsed_globals)
22
+
23
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
24
+ cred = credential.CVMRoleCredential()
25
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
26
+ cred = credential.STSAssumeRoleCredential(
27
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
28
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
29
+ )
30
+ 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):
31
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
32
+ else:
33
+ cred = credential.Credential(
34
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
35
+ )
36
+ http_profile = HttpProfile(
37
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
38
+ reqMethod="POST",
39
+ endpoint=g_param[OptionsDefine.Endpoint],
40
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
41
+ )
42
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
43
+ if g_param[OptionsDefine.Language]:
44
+ profile.language = g_param[OptionsDefine.Language]
45
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
46
+ client = mod.ApmClient(cred, g_param[OptionsDefine.Region], profile)
47
+ client._sdkVersion += ("_CLI_" + __version__)
48
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
49
+ model = models.CreateProfileTaskRequest()
50
+ model.from_json_string(json.dumps(args))
51
+ start_time = time.time()
52
+ while True:
53
+ rsp = client.CreateProfileTask(model)
54
+ result = rsp.to_json_string()
55
+ try:
56
+ json_obj = json.loads(result)
57
+ except TypeError as e:
58
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
59
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
60
+ break
61
+ cur_time = time.time()
62
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
63
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
64
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
65
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
66
+ else:
67
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
68
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
69
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
70
+
71
+
20
72
  def doDescribeGeneralApmApplicationConfig(args, parsed_globals):
21
73
  g_param = parse_global_arg(parsed_globals)
22
74
 
@@ -704,6 +756,7 @@ MODELS_MAP = {
704
756
  }
705
757
 
706
758
  ACTION_MAP = {
759
+ "CreateProfileTask": doCreateProfileTask,
707
760
  "DescribeGeneralApmApplicationConfig": doDescribeGeneralApmApplicationConfig,
708
761
  "DescribeTagValues": doDescribeTagValues,
709
762
  "DescribeGeneralSpanList": doDescribeGeneralSpanList,
@@ -7,6 +7,13 @@
7
7
  "output": "CreateApmInstanceResponse",
8
8
  "status": "online"
9
9
  },
10
+ "CreateProfileTask": {
11
+ "document": "创建事件任务",
12
+ "input": "CreateProfileTaskRequest",
13
+ "name": "创建性能剖析事件任务",
14
+ "output": "CreateProfileTaskResponse",
15
+ "status": "online"
16
+ },
10
17
  "DescribeApmAgent": {
11
18
  "document": "获取 APM 接入点",
12
19
  "input": "DescribeApmAgentRequest",
@@ -1069,6 +1076,106 @@
1069
1076
  ],
1070
1077
  "type": "object"
1071
1078
  },
1079
+ "CreateProfileTaskRequest": {
1080
+ "document": "CreateProfileTask请求参数结构体",
1081
+ "members": [
1082
+ {
1083
+ "disabled": false,
1084
+ "document": "应用名称",
1085
+ "example": "springboot-service",
1086
+ "member": "string",
1087
+ "name": "ServiceName",
1088
+ "required": true,
1089
+ "type": "string"
1090
+ },
1091
+ {
1092
+ "disabled": false,
1093
+ "document": "APM业务系统ID",
1094
+ "example": "apm-eQls4MGPr",
1095
+ "member": "string",
1096
+ "name": "InstanceId",
1097
+ "required": true,
1098
+ "type": "string"
1099
+ },
1100
+ {
1101
+ "disabled": false,
1102
+ "document": "应用实例(在线)",
1103
+ "example": "127.0.0.1",
1104
+ "member": "string",
1105
+ "name": "ServiceInstance",
1106
+ "required": true,
1107
+ "type": "string"
1108
+ },
1109
+ {
1110
+ "disabled": false,
1111
+ "document": "事件类型(cpu、alloc)",
1112
+ "example": "cpu",
1113
+ "member": "string",
1114
+ "name": "Event",
1115
+ "required": true,
1116
+ "type": "string"
1117
+ },
1118
+ {
1119
+ "disabled": false,
1120
+ "document": "任务持续时长(单位:毫秒),范围限制在5~180秒",
1121
+ "example": "5000",
1122
+ "member": "int64",
1123
+ "name": "Duration",
1124
+ "required": true,
1125
+ "type": "int"
1126
+ },
1127
+ {
1128
+ "disabled": false,
1129
+ "document": "执行次数,范围限制在1~100次",
1130
+ "example": "1",
1131
+ "member": "int64",
1132
+ "name": "AllTimes",
1133
+ "required": true,
1134
+ "type": "int"
1135
+ },
1136
+ {
1137
+ "disabled": false,
1138
+ "document": "开始时间戳,0代表从当前开始(单位:秒)",
1139
+ "example": "0",
1140
+ "member": "int64",
1141
+ "name": "StartTime",
1142
+ "required": false,
1143
+ "type": "int"
1144
+ },
1145
+ {
1146
+ "disabled": false,
1147
+ "document": "任务执行间隔(单位:毫秒),范围限制在10~600秒,不可小于1.5倍的Duration",
1148
+ "example": "5000",
1149
+ "member": "int64",
1150
+ "name": "TaskInterval",
1151
+ "required": false,
1152
+ "type": "int"
1153
+ }
1154
+ ],
1155
+ "type": "object"
1156
+ },
1157
+ "CreateProfileTaskResponse": {
1158
+ "document": "CreateProfileTask返回参数结构体",
1159
+ "members": [
1160
+ {
1161
+ "disabled": false,
1162
+ "document": "任务ID",
1163
+ "example": "100001",
1164
+ "member": "int64",
1165
+ "name": "TaskId",
1166
+ "output_required": true,
1167
+ "type": "int",
1168
+ "value_allowed_null": false
1169
+ },
1170
+ {
1171
+ "document": "唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。",
1172
+ "member": "string",
1173
+ "name": "RequestId",
1174
+ "type": "string"
1175
+ }
1176
+ ],
1177
+ "type": "object"
1178
+ },
1072
1179
  "DescribeApmAgentRequest": {
1073
1180
  "document": "DescribeApmAgent请求参数结构体",
1074
1181
  "members": [
@@ -8,6 +8,14 @@
8
8
  "title": "创建 APM 业务系统"
9
9
  }
10
10
  ],
11
+ "CreateProfileTask": [
12
+ {
13
+ "document": "成功示例",
14
+ "input": "POST / HTTP/1.1\nHost: apm.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: CreateProfileTask\n<公共请求参数>\n\n{\n \"ServiceName\": \"springboot-service\",\n \"InstanceId\": \"apm-ewyzCXlxj\",\n \"ServiceInstance\": \"127.0.0.1\",\n \"StartTime\": 0,\n \"Duration\": 5000,\n \"Event\": \"cpu\",\n \"AllTimes\": 1,\n \"TaskInterval\": 10000\n}",
15
+ "output": "{\n \"Response\": {\n \"RequestId\": \"eac7cf53-1900-4367-9076-a5649ddd4dbb\",\n \"TaskId\": 10001\n }\n}",
16
+ "title": "成功示例"
17
+ }
18
+ ],
11
19
  "DescribeApmAgent": [
12
20
  {
13
21
  "document": "获取 APM 接入点示例",
@@ -19241,8 +19241,8 @@
19241
19241
  "members": [
19242
19242
  {
19243
19243
  "disabled": false,
19244
- "document": "实例id",
19245
- "example": "cdb-xxxx",
19244
+ "document": "实例 ID。可通过 [DescribeDBInstances](https://cloud.tencent.com/document/product/236/15872) 接口获取。",
19245
+ "example": "cdb-4t34ozl0",
19246
19246
  "member": "string",
19247
19247
  "name": "InstanceId",
19248
19248
  "required": true,
@@ -2227,6 +2227,7 @@
2227
2227
  "example": "\\\\",
2228
2228
  "member": "string",
2229
2229
  "name": "Escape",
2230
+ "output_required": false,
2230
2231
  "required": false,
2231
2232
  "type": "string",
2232
2233
  "value_allowed_null": false
@@ -2237,6 +2238,7 @@
2237
2238
  "example": "\"",
2238
2239
  "member": "string",
2239
2240
  "name": "Quote",
2241
+ "output_required": false,
2240
2242
  "required": false,
2241
2243
  "type": "string",
2242
2244
  "value_allowed_null": false
@@ -2247,12 +2249,13 @@
2247
2249
  "example": ",",
2248
2250
  "member": "string",
2249
2251
  "name": "Separator",
2252
+ "output_required": false,
2250
2253
  "required": false,
2251
2254
  "type": "string",
2252
2255
  "value_allowed_null": false
2253
2256
  }
2254
2257
  ],
2255
- "usage": "in"
2258
+ "usage": "both"
2256
2259
  },
2257
2260
  "CancelNotebookSessionStatementBatchRequest": {
2258
2261
  "document": "CancelNotebookSessionStatementBatch请求参数结构体",
@@ -64,11 +64,11 @@
64
64
  "status": "online"
65
65
  },
66
66
  "AttachDisks": {
67
- "document": "本接口(AttachDisks)用于挂载云硬盘。\n \n* 支持批量操作,将多块云盘挂载到同一云主机。如果多个云盘中存在不允许挂载的云盘,则操作不执行,返回特定的错误码。\n* 本接口为异步接口,当挂载云盘的请求成功返回时,表示后台已发起挂载云盘的操作,可通过接口[DescribeDisks](/document/product/362/16315)来查询对应云盘的状态,如果云盘的状态由“ATTACHING”变为“ATTACHED”,则为挂载成功。",
67
+ "document": "CBS在ECM早已下线\n\n本接口(AttachDisks)用于挂载云硬盘。\n \n* 支持批量操作,将多块云盘挂载到同一云主机。如果多个云盘中存在不允许挂载的云盘,则操作不执行,返回特定的错误码。\n* 本接口为异步接口,当挂载云盘的请求成功返回时,表示后台已发起挂载云盘的操作,可通过接口[DescribeDisks](/document/product/362/16315)来查询对应云盘的状态,如果云盘的状态由“ATTACHING”变为“ATTACHED”,则为挂载成功。",
68
68
  "input": "AttachDisksRequest",
69
69
  "name": "挂载云硬盘",
70
70
  "output": "AttachDisksResponse",
71
- "status": "online"
71
+ "status": "deprecated"
72
72
  },
73
73
  "AttachNetworkInterface": {
74
74
  "document": "弹性网卡绑定云主机",
@@ -99,11 +99,11 @@
99
99
  "status": "online"
100
100
  },
101
101
  "CreateDisks": {
102
- "document": "本接口(CreateDisks)用于创建云硬盘。\n\n* 预付费云盘的购买会预先扣除本次云盘购买所需金额,在调用本接口前请确保账户余额充足。\n* 本接口支持传入数据盘快照来创建云盘,实现将快照数据复制到新购云盘上。\n* 本接口为异步接口,当创建请求下发成功后会返回一个新建的云盘ID列表,此时云盘的创建并未立即完成。可以通过调用[DescribeDisks](/document/product/362/16315)接口根据DiskId查询对应云盘,如果能查到云盘,且状态为'UNATTACHED'或'ATTACHED',则表示创建成功。",
102
+ "document": "CBS在ECM早已下线\n\n本接口(CreateDisks)用于创建云硬盘。\n\n* 预付费云盘的购买会预先扣除本次云盘购买所需金额,在调用本接口前请确保账户余额充足。\n* 本接口支持传入数据盘快照来创建云盘,实现将快照数据复制到新购云盘上。\n* 本接口为异步接口,当创建请求下发成功后会返回一个新建的云盘ID列表,此时云盘的创建并未立即完成。可以通过调用[DescribeDisks](/document/product/362/16315)接口根据DiskId查询对应云盘,如果能查到云盘,且状态为'UNATTACHED'或'ATTACHED',则表示创建成功。",
103
103
  "input": "CreateDisksRequest",
104
104
  "name": "创建云硬盘",
105
105
  "output": "CreateDisksResponse",
106
- "status": "online"
106
+ "status": "deprecated"
107
107
  },
108
108
  "CreateHaVip": {
109
109
  "document": "本接口(CreateHaVip)用于创建高可用虚拟IP(HAVIP)",
@@ -274,11 +274,11 @@
274
274
  "status": "online"
275
275
  },
276
276
  "DeleteSnapshots": {
277
- "document": "本接口(DeleteSnapshots)用于删除快照。\n\n* 快照必须处于NORMAL状态,快照状态可以通过[DescribeSnapshots](/document/product/362/15647)接口查询,见输出参数中SnapshotState字段解释。\n* 支持批量操作。如果多个快照存在无法删除的快照,则操作不执行,以返回特定的错误码返回。",
277
+ "document": "CBS在ECM早已下线\n\n本接口(DeleteSnapshots)用于删除快照。\n\n* 快照必须处于NORMAL状态,快照状态可以通过[DescribeSnapshots](/document/product/362/15647)接口查询,见输出参数中SnapshotState字段解释。\n* 支持批量操作。如果多个快照存在无法删除的快照,则操作不执行,以返回特定的错误码返回。",
278
278
  "input": "DeleteSnapshotsRequest",
279
279
  "name": "删除快照",
280
280
  "output": "DeleteSnapshotsResponse",
281
- "status": "online"
281
+ "status": "deprecated"
282
282
  },
283
283
  "DeleteSubnet": {
284
284
  "document": "删除子网,若子网为可用区下的默认子网,则默认子网会回退到系统自动创建的默认子网,非用户最新创建的子网。若默认子网不满足需求,可调用设置默认子网接口设置。",
@@ -337,11 +337,11 @@
337
337
  "status": "online"
338
338
  },
339
339
  "DescribeDisks": {
340
- "document": "本接口(DescribeDisks)用于查询云硬盘列表。\n\n* 可以根据云硬盘ID、云硬盘类型或者云硬盘状态等信息来查询云硬盘的详细信息,不同条件之间为与(AND)的关系,过滤信息详细请见过滤器`Filter`。\n* 如果参数为空,返回当前用户一定数量(`Limit`所指定的数量,默认为20)的云硬盘列表。",
340
+ "document": "CBS在ECM早已下线\n\n本接口(DescribeDisks)用于查询云硬盘列表。\n\n* 可以根据云硬盘ID、云硬盘类型或者云硬盘状态等信息来查询云硬盘的详细信息,不同条件之间为与(AND)的关系,过滤信息详细请见过滤器`Filter`。\n* 如果参数为空,返回当前用户一定数量(`Limit`所指定的数量,默认为20)的云硬盘列表。",
341
341
  "input": "DescribeDisksRequest",
342
342
  "name": "查询云硬盘列表",
343
343
  "output": "DescribeDisksResponse",
344
- "status": "online"
344
+ "status": "deprecated"
345
345
  },
346
346
  "DescribeHaVips": {
347
347
  "document": "用于查询高可用虚拟IP(HAVIP)列表。",
@@ -526,11 +526,11 @@
526
526
  "status": "online"
527
527
  },
528
528
  "DescribeSnapshots": {
529
- "document": "本接口(DescribeSnapshots)用于查询快照的详细信息。\n\n* 根据快照ID、创建快照的云硬盘ID、创建快照的云硬盘类型等对结果进行过滤,不同条件之间为与(AND)的关系,过滤信息详细请见过滤器`Filter`。\n* 如果参数为空,返回当前用户一定数量(`Limit`所指定的数量,默认为20)的快照列表。",
529
+ "document": "CBS在ECM早已下线\n\n本接口(DescribeSnapshots)用于查询快照的详细信息。\n\n* 根据快照ID、创建快照的云硬盘ID、创建快照的云硬盘类型等对结果进行过滤,不同条件之间为与(AND)的关系,过滤信息详细请见过滤器`Filter`。\n* 如果参数为空,返回当前用户一定数量(`Limit`所指定的数量,默认为20)的快照列表。",
530
530
  "input": "DescribeSnapshotsRequest",
531
531
  "name": "查询快照列表",
532
532
  "output": "DescribeSnapshotsResponse",
533
- "status": "online"
533
+ "status": "deprecated"
534
534
  },
535
535
  "DescribeSubnets": {
536
536
  "document": "查询子网列表",
@@ -575,11 +575,11 @@
575
575
  "status": "online"
576
576
  },
577
577
  "DetachDisks": {
578
- "document": "本接口(DetachDisks)用于卸载云硬盘。\n\n* 支持批量操作,卸载挂载在同一主机上的多块云盘。如果多块云盘中存在不允许卸载的云盘,则操作不执行,返回特定的错误码。\n* 本接口为异步接口,当请求成功返回时,云盘并未立即从主机卸载,可通过接口[DescribeDisks](/document/product/362/16315)来查询对应云盘的状态,如果云盘的状态由“ATTACHED”变为“UNATTACHED”,则为卸载成功。",
578
+ "document": "CBS在ECM早已下线\n\n本接口(DetachDisks)用于卸载云硬盘。\n\n* 支持批量操作,卸载挂载在同一主机上的多块云盘。如果多块云盘中存在不允许卸载的云盘,则操作不执行,返回特定的错误码。\n* 本接口为异步接口,当请求成功返回时,云盘并未立即从主机卸载,可通过接口[DescribeDisks](/document/product/362/16315)来查询对应云盘的状态,如果云盘的状态由“ATTACHED”变为“UNATTACHED”,则为卸载成功。",
579
579
  "input": "DetachDisksRequest",
580
580
  "name": "卸载云硬盘",
581
581
  "output": "DetachDisksResponse",
582
- "status": "online"
582
+ "status": "deprecated"
583
583
  },
584
584
  "DetachNetworkInterface": {
585
585
  "document": "弹性网卡解绑云主机",
@@ -953,11 +953,11 @@
953
953
  "status": "online"
954
954
  },
955
955
  "TerminateDisks": {
956
- "document": "本接口(TerminateDisks)用于退还云硬盘。\n\n* 不再使用的云盘,可通过本接口主动退还。\n* 本接口支持退还预付费云盘和按小时后付费云盘。按小时后付费云盘可直接退还,预付费云盘需符合退还规则。\n* 支持批量操作,每次请求批量云硬盘的上限为50。如果批量云盘存在不允许操作的,请求会以特定错误码返回。",
956
+ "document": "CBS在ECM早已下线\n\n本接口(TerminateDisks)用于退还云硬盘。\n\n* 不再使用的云盘,可通过本接口主动退还。\n* 本接口支持退还预付费云盘和按小时后付费云盘。按小时后付费云盘可直接退还,预付费云盘需符合退还规则。\n* 支持批量操作,每次请求批量云硬盘的上限为50。如果批量云盘存在不允许操作的,请求会以特定错误码返回。",
957
957
  "input": "TerminateDisksRequest",
958
958
  "name": "退还云硬盘",
959
959
  "output": "TerminateDisksResponse",
960
- "status": "online"
960
+ "status": "deprecated"
961
961
  },
962
962
  "TerminateInstances": {
963
963
  "document": "销毁实例",
@@ -2318,7 +2318,7 @@
2318
2318
  },
2319
2319
  {
2320
2320
  "disabled": false,
2321
- "document": "**web嵌入发起合同场景下**, 是否锁定填写和签署控件值不允许嵌入页面进行编辑\n<ul><li>false(默认):不锁定控件值,允许在页面编辑控件值</li>\n<li>true:锁定控件值,在页面编辑控件值</li></ul>",
2321
+ "document": "**web嵌入发起合同场景下**, 是否锁定填写和签署控件值不允许嵌入页面进行编辑\n<ul><li>false(默认):不锁定控件值,允许在页面编辑控件值</li>\n<li>true:锁定控件值,在页面无法编辑控件值</li></ul>",
2322
2322
  "example": "false",
2323
2323
  "member": "bool",
2324
2324
  "name": "LockComponentValue",
@@ -6481,7 +6481,7 @@
6481
6481
  },
6482
6482
  {
6483
6483
  "disabled": false,
6484
- "document": "**web嵌入发起合同场景下**, 是否锁定填写和签署控件值不允许嵌入页面进行编辑\n<ul><li>false(默认):不锁定控件值,允许在页面编辑控件值</li>\n<li>true:锁定控件值,在页面编辑控件值</li></ul>",
6484
+ "document": "**web嵌入发起合同场景下**, 是否锁定填写和签署控件值不允许嵌入页面进行编辑\n<ul><li>false(默认):不锁定控件值,允许在页面编辑控件值</li>\n<li>true:锁定控件值,在页面无法编辑控件值</li></ul>",
6485
6485
  "example": "false",
6486
6486
  "member": "bool",
6487
6487
  "name": "LockComponentValue",
@@ -799,7 +799,7 @@ def doSetAutoRenew(args, parsed_globals):
799
799
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
800
800
 
801
801
 
802
- def doIsolateDBInstance(args, parsed_globals):
802
+ def doDescribeDetailedSlowLogs(args, parsed_globals):
803
803
  g_param = parse_global_arg(parsed_globals)
804
804
 
805
805
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -828,11 +828,11 @@ def doIsolateDBInstance(args, parsed_globals):
828
828
  client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
829
829
  client._sdkVersion += ("_CLI_" + __version__)
830
830
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
831
- model = models.IsolateDBInstanceRequest()
831
+ model = models.DescribeDetailedSlowLogsRequest()
832
832
  model.from_json_string(json.dumps(args))
833
833
  start_time = time.time()
834
834
  while True:
835
- rsp = client.IsolateDBInstance(model)
835
+ rsp = client.DescribeDetailedSlowLogs(model)
836
836
  result = rsp.to_json_string()
837
837
  try:
838
838
  json_obj = json.loads(result)
@@ -2723,6 +2723,58 @@ def doKillOps(args, parsed_globals):
2723
2723
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
2724
2724
 
2725
2725
 
2726
+ def doIsolateDBInstance(args, parsed_globals):
2727
+ g_param = parse_global_arg(parsed_globals)
2728
+
2729
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
2730
+ cred = credential.CVMRoleCredential()
2731
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
2732
+ cred = credential.STSAssumeRoleCredential(
2733
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
2734
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
2735
+ )
2736
+ 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):
2737
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
2738
+ else:
2739
+ cred = credential.Credential(
2740
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
2741
+ )
2742
+ http_profile = HttpProfile(
2743
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
2744
+ reqMethod="POST",
2745
+ endpoint=g_param[OptionsDefine.Endpoint],
2746
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
2747
+ )
2748
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
2749
+ if g_param[OptionsDefine.Language]:
2750
+ profile.language = g_param[OptionsDefine.Language]
2751
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
2752
+ client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
2753
+ client._sdkVersion += ("_CLI_" + __version__)
2754
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
2755
+ model = models.IsolateDBInstanceRequest()
2756
+ model.from_json_string(json.dumps(args))
2757
+ start_time = time.time()
2758
+ while True:
2759
+ rsp = client.IsolateDBInstance(model)
2760
+ result = rsp.to_json_string()
2761
+ try:
2762
+ json_obj = json.loads(result)
2763
+ except TypeError as e:
2764
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
2765
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
2766
+ break
2767
+ cur_time = time.time()
2768
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
2769
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
2770
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
2771
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
2772
+ else:
2773
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
2774
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
2775
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
2776
+
2777
+
2726
2778
  def doEnableTransparentDataEncryption(args, parsed_globals):
2727
2779
  g_param = parse_global_arg(parsed_globals)
2728
2780
 
@@ -3011,7 +3063,7 @@ ACTION_MAP = {
3011
3063
  "UpgradeDBInstance": doUpgradeDBInstance,
3012
3064
  "DescribeDBBackups": doDescribeDBBackups,
3013
3065
  "SetAutoRenew": doSetAutoRenew,
3014
- "IsolateDBInstance": doIsolateDBInstance,
3066
+ "DescribeDetailedSlowLogs": doDescribeDetailedSlowLogs,
3015
3067
  "SetBackupRules": doSetBackupRules,
3016
3068
  "InquirePriceModifyDBInstanceSpec": doInquirePriceModifyDBInstanceSpec,
3017
3069
  "RestartNodes": doRestartNodes,
@@ -3048,6 +3100,7 @@ ACTION_MAP = {
3048
3100
  "ModifyInstanceParams": doModifyInstanceParams,
3049
3101
  "DescribeDBInstanceParamTplDetail": doDescribeDBInstanceParamTplDetail,
3050
3102
  "KillOps": doKillOps,
3103
+ "IsolateDBInstance": doIsolateDBInstance,
3051
3104
  "EnableTransparentDataEncryption": doEnableTransparentDataEncryption,
3052
3105
  "CreateBackupDBInstance": doCreateBackupDBInstance,
3053
3106
  "InquirePriceRenewDBInstances": doInquirePriceRenewDBInstances,