tccli-intl-en 3.0.1264.1__py2.py3-none-any.whl → 3.0.1266.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 +1 -1
- tccli/services/dlc/dlc_client.py +53 -0
- tccli/services/dlc/v20210125/api.json +103 -0
- tccli/services/dlc/v20210125/examples.json +8 -0
- tccli/services/quota/quota_client.py +212 -0
- tccli/services/quota/v20241204/api.json +438 -0
- tccli/services/quota/v20241204/examples.json +38 -0
- tccli/services/teo/v20220901/api.json +6 -6
- tccli/services/trtc/v20190722/api.json +114 -10
- {tccli_intl_en-3.0.1264.1.dist-info → tccli_intl_en-3.0.1266.1.dist-info}/METADATA +2 -2
- {tccli_intl_en-3.0.1264.1.dist-info → tccli_intl_en-3.0.1266.1.dist-info}/RECORD +15 -15
- {tccli_intl_en-3.0.1264.1.dist-info → tccli_intl_en-3.0.1266.1.dist-info}/LICENSE +0 -0
- {tccli_intl_en-3.0.1264.1.dist-info → tccli_intl_en-3.0.1266.1.dist-info}/WHEEL +0 -0
- {tccli_intl_en-3.0.1264.1.dist-info → tccli_intl_en-3.0.1266.1.dist-info}/entry_points.txt +0 -0
- {tccli_intl_en-3.0.1264.1.dist-info → tccli_intl_en-3.0.1266.1.dist-info}/top_level.txt +0 -0
tccli/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '3.0.
|
|
1
|
+
__version__ = '3.0.1266.1'
|
tccli/services/dlc/dlc_client.py
CHANGED
|
@@ -2149,6 +2149,58 @@ def doRollbackDataEngineImage(args, parsed_globals):
|
|
|
2149
2149
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2150
2150
|
|
|
2151
2151
|
|
|
2152
|
+
def doDescribeSessionImageVersion(args, parsed_globals):
|
|
2153
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2154
|
+
|
|
2155
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2156
|
+
cred = credential.CVMRoleCredential()
|
|
2157
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2158
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2159
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2160
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2161
|
+
)
|
|
2162
|
+
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):
|
|
2163
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2164
|
+
else:
|
|
2165
|
+
cred = credential.Credential(
|
|
2166
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2167
|
+
)
|
|
2168
|
+
http_profile = HttpProfile(
|
|
2169
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2170
|
+
reqMethod="POST",
|
|
2171
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2172
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2173
|
+
)
|
|
2174
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2175
|
+
if g_param[OptionsDefine.Language]:
|
|
2176
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2177
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2178
|
+
client = mod.DlcClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2179
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2180
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2181
|
+
model = models.DescribeSessionImageVersionRequest()
|
|
2182
|
+
model.from_json_string(json.dumps(args))
|
|
2183
|
+
start_time = time.time()
|
|
2184
|
+
while True:
|
|
2185
|
+
rsp = client.DescribeSessionImageVersion(model)
|
|
2186
|
+
result = rsp.to_json_string()
|
|
2187
|
+
try:
|
|
2188
|
+
json_obj = json.loads(result)
|
|
2189
|
+
except TypeError as e:
|
|
2190
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2191
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2192
|
+
break
|
|
2193
|
+
cur_time = time.time()
|
|
2194
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2195
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2196
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2197
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2198
|
+
else:
|
|
2199
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2200
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2201
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2202
|
+
|
|
2203
|
+
|
|
2152
2204
|
def doDescribeSubUserAccessPolicy(args, parsed_globals):
|
|
2153
2205
|
g_param = parse_global_arg(parsed_globals)
|
|
2154
2206
|
|
|
@@ -5425,6 +5477,7 @@ ACTION_MAP = {
|
|
|
5425
5477
|
"CreateSparkApp": doCreateSparkApp,
|
|
5426
5478
|
"DescribeThirdPartyAccessUser": doDescribeThirdPartyAccessUser,
|
|
5427
5479
|
"RollbackDataEngineImage": doRollbackDataEngineImage,
|
|
5480
|
+
"DescribeSessionImageVersion": doDescribeSessionImageVersion,
|
|
5428
5481
|
"DescribeSubUserAccessPolicy": doDescribeSubUserAccessPolicy,
|
|
5429
5482
|
"DescribeDLCTableList": doDescribeDLCTableList,
|
|
5430
5483
|
"CreateSparkSessionBatchSQL": doCreateSparkSessionBatchSQL,
|
|
@@ -364,6 +364,13 @@
|
|
|
364
364
|
"output": "DescribeResultDownloadResponse",
|
|
365
365
|
"status": "online"
|
|
366
366
|
},
|
|
367
|
+
"DescribeSessionImageVersion": {
|
|
368
|
+
"document": "This API is used to retrieve all built-in images of all minor versions under a specified major version.",
|
|
369
|
+
"input": "DescribeSessionImageVersionRequest",
|
|
370
|
+
"name": "Retrieve built-in mirror information",
|
|
371
|
+
"output": "DescribeSessionImageVersionResponse",
|
|
372
|
+
"status": "online"
|
|
373
|
+
},
|
|
367
374
|
"DescribeSparkAppJob": {
|
|
368
375
|
"document": "u200cThis API is used to query the information of a Spark job.",
|
|
369
376
|
"input": "DescribeSparkAppJobRequest",
|
|
@@ -6326,6 +6333,52 @@
|
|
|
6326
6333
|
],
|
|
6327
6334
|
"type": "object"
|
|
6328
6335
|
},
|
|
6336
|
+
"DescribeSessionImageVersionRequest": {
|
|
6337
|
+
"document": "DescribeSessionImageVersion request structure.",
|
|
6338
|
+
"members": [
|
|
6339
|
+
{
|
|
6340
|
+
"disabled": false,
|
|
6341
|
+
"document": "Engine Id.",
|
|
6342
|
+
"example": "DataEngine-e482ijv6",
|
|
6343
|
+
"member": "string",
|
|
6344
|
+
"name": "DataEngineId",
|
|
6345
|
+
"required": true,
|
|
6346
|
+
"type": "string"
|
|
6347
|
+
},
|
|
6348
|
+
{
|
|
6349
|
+
"disabled": false,
|
|
6350
|
+
"document": "Framework type: machine-learning, python, spark-ml.",
|
|
6351
|
+
"example": "machine-learning",
|
|
6352
|
+
"member": "string",
|
|
6353
|
+
"name": "FrameworkType",
|
|
6354
|
+
"required": true,
|
|
6355
|
+
"type": "string"
|
|
6356
|
+
}
|
|
6357
|
+
],
|
|
6358
|
+
"type": "object"
|
|
6359
|
+
},
|
|
6360
|
+
"DescribeSessionImageVersionResponse": {
|
|
6361
|
+
"document": "DescribeSessionImageVersion response structure.",
|
|
6362
|
+
"members": [
|
|
6363
|
+
{
|
|
6364
|
+
"disabled": false,
|
|
6365
|
+
"document": "Expands the image list.\nNote: This field may return null, indicating that no valid values can be obtained.",
|
|
6366
|
+
"example": "无",
|
|
6367
|
+
"member": "EngineSessionImage",
|
|
6368
|
+
"name": "EngineSessionImages",
|
|
6369
|
+
"output_required": true,
|
|
6370
|
+
"type": "list",
|
|
6371
|
+
"value_allowed_null": true
|
|
6372
|
+
},
|
|
6373
|
+
{
|
|
6374
|
+
"document": "The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.",
|
|
6375
|
+
"member": "string",
|
|
6376
|
+
"name": "RequestId",
|
|
6377
|
+
"type": "string"
|
|
6378
|
+
}
|
|
6379
|
+
],
|
|
6380
|
+
"type": "object"
|
|
6381
|
+
},
|
|
6329
6382
|
"DescribeSparkAppJobRequest": {
|
|
6330
6383
|
"document": "DescribeSparkAppJob request structure.",
|
|
6331
6384
|
"members": [
|
|
@@ -7966,6 +8019,56 @@
|
|
|
7966
8019
|
],
|
|
7967
8020
|
"type": "object"
|
|
7968
8021
|
},
|
|
8022
|
+
"EngineSessionImage": {
|
|
8023
|
+
"document": "TensorFlow, Pytorch, SK-learn image information list.",
|
|
8024
|
+
"members": [
|
|
8025
|
+
{
|
|
8026
|
+
"disabled": false,
|
|
8027
|
+
"document": "Specifies the unique id of the Spark mirror.\nNote: This field may return null, indicating that no valid values can be obtained.",
|
|
8028
|
+
"example": "无",
|
|
8029
|
+
"member": "string",
|
|
8030
|
+
"name": "SparkImageId",
|
|
8031
|
+
"output_required": true,
|
|
8032
|
+
"required": false,
|
|
8033
|
+
"type": "string",
|
|
8034
|
+
"value_allowed_null": true
|
|
8035
|
+
},
|
|
8036
|
+
{
|
|
8037
|
+
"disabled": false,
|
|
8038
|
+
"document": "Spark image version name.\nNote: This field may return null, indicating that no valid values can be obtained.",
|
|
8039
|
+
"example": "无",
|
|
8040
|
+
"member": "string",
|
|
8041
|
+
"name": "SparkImageVersion",
|
|
8042
|
+
"output_required": true,
|
|
8043
|
+
"required": false,
|
|
8044
|
+
"type": "string",
|
|
8045
|
+
"value_allowed_null": true
|
|
8046
|
+
},
|
|
8047
|
+
{
|
|
8048
|
+
"disabled": false,
|
|
8049
|
+
"document": "Minor version image type. 1: TensorFlow, 2: Pytorch, 3: SK-learn.\n\nNote: This field may return null, indicating that no valid values can be obtained.",
|
|
8050
|
+
"example": "1",
|
|
8051
|
+
"member": "int64",
|
|
8052
|
+
"name": "SparkImageType",
|
|
8053
|
+
"output_required": true,
|
|
8054
|
+
"required": false,
|
|
8055
|
+
"type": "int",
|
|
8056
|
+
"value_allowed_null": true
|
|
8057
|
+
},
|
|
8058
|
+
{
|
|
8059
|
+
"disabled": false,
|
|
8060
|
+
"document": "Image address.\n\nNote: This field may return null, indicating that no valid values can be obtained.",
|
|
8061
|
+
"example": "无",
|
|
8062
|
+
"member": "string",
|
|
8063
|
+
"name": "SparkImageTag",
|
|
8064
|
+
"output_required": true,
|
|
8065
|
+
"required": false,
|
|
8066
|
+
"type": "string",
|
|
8067
|
+
"value_allowed_null": true
|
|
8068
|
+
}
|
|
8069
|
+
],
|
|
8070
|
+
"usage": "both"
|
|
8071
|
+
},
|
|
7969
8072
|
"Execution": {
|
|
7970
8073
|
"document": "SQL statement objects",
|
|
7971
8074
|
"members": [
|
|
@@ -422,6 +422,14 @@
|
|
|
422
422
|
"title": "Example 1"
|
|
423
423
|
}
|
|
424
424
|
],
|
|
425
|
+
"DescribeSessionImageVersion": [
|
|
426
|
+
{
|
|
427
|
+
"document": "Current engine: DataEngine-b0jt6fvk\nThis example shows you how to choose machine-learning as the framework type.",
|
|
428
|
+
"input": "POST / HTTP/1.1\nHost: dlc.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: DescribeSessionImageVersion\n<Common request parameters>\n\n{\n \"DataEngineId\": \"DataEngine-b0jt6fvk\",\n \"FrameworkType\": \"machine-learning\"\n}",
|
|
429
|
+
"output": "{\n \"Response\": {\n \"EngineSessionImages\": [\n {\n \"SparkImageId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"SparkImageTag\": \"ccr.ccs.tencentyun.com/dlc_cloud/tensorflow:dev-v20241218\",\n \"SparkImageType\": 1,\n \"SparkImageVersion\": \"tensorflow-v2.18.0\"\n },\n {\n \"SparkImageId\": \"1a2b3c4d-5e6f-7g8h-9i0j-k1l2m3n4o5p6\",\n \"SparkImageTag\": \"ccr.ccs.tencentyun.com/dlc_cloud/scikit-learn:dev-v20241218\",\n \"SparkImageType\": 1,\n \"SparkImageVersion\": \"scikit-learn-v1.6.0\"\n },\n {\n \"SparkImageId\": \"98765432-10fe-bcd1-9a8b-0123456789ab\",\n \"SparkImageTag\": \"ccr.ccs.tencentyun.com/dlc_cloud/pytorch:dev-v20241218\",\n \"SparkImageType\": 1,\n \"SparkImageVersion\": \"pytorch-v2.5.1\"\n }\n ],\n \"RequestId\": \"c06478c4-bbc6-4cec-934b-6f9e2ff121ae\"\n }\n}",
|
|
430
|
+
"title": "Built-In Image"
|
|
431
|
+
}
|
|
432
|
+
],
|
|
425
433
|
"DescribeSparkAppJob": [
|
|
426
434
|
{
|
|
427
435
|
"document": "This example shows you how to query the information of a Spark job.",
|
|
@@ -69,6 +69,214 @@ def doCreateAlarm(args, parsed_globals):
|
|
|
69
69
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
70
70
|
|
|
71
71
|
|
|
72
|
+
def doUpdateAlarm(args, parsed_globals):
|
|
73
|
+
g_param = parse_global_arg(parsed_globals)
|
|
74
|
+
|
|
75
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
76
|
+
cred = credential.CVMRoleCredential()
|
|
77
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
78
|
+
cred = credential.STSAssumeRoleCredential(
|
|
79
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
80
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
81
|
+
)
|
|
82
|
+
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):
|
|
83
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
84
|
+
else:
|
|
85
|
+
cred = credential.Credential(
|
|
86
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
87
|
+
)
|
|
88
|
+
http_profile = HttpProfile(
|
|
89
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
90
|
+
reqMethod="POST",
|
|
91
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
92
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
93
|
+
)
|
|
94
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
95
|
+
if g_param[OptionsDefine.Language]:
|
|
96
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
97
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
98
|
+
client = mod.QuotaClient(cred, g_param[OptionsDefine.Region], profile)
|
|
99
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
100
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
101
|
+
model = models.UpdateAlarmRequest()
|
|
102
|
+
model.from_json_string(json.dumps(args))
|
|
103
|
+
start_time = time.time()
|
|
104
|
+
while True:
|
|
105
|
+
rsp = client.UpdateAlarm(model)
|
|
106
|
+
result = rsp.to_json_string()
|
|
107
|
+
try:
|
|
108
|
+
json_obj = json.loads(result)
|
|
109
|
+
except TypeError as e:
|
|
110
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
111
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
112
|
+
break
|
|
113
|
+
cur_time = time.time()
|
|
114
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
115
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
116
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
117
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
118
|
+
else:
|
|
119
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
120
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
121
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def doDeleteAlarm(args, parsed_globals):
|
|
125
|
+
g_param = parse_global_arg(parsed_globals)
|
|
126
|
+
|
|
127
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
128
|
+
cred = credential.CVMRoleCredential()
|
|
129
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
130
|
+
cred = credential.STSAssumeRoleCredential(
|
|
131
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
132
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
133
|
+
)
|
|
134
|
+
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):
|
|
135
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
136
|
+
else:
|
|
137
|
+
cred = credential.Credential(
|
|
138
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
139
|
+
)
|
|
140
|
+
http_profile = HttpProfile(
|
|
141
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
142
|
+
reqMethod="POST",
|
|
143
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
144
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
145
|
+
)
|
|
146
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
147
|
+
if g_param[OptionsDefine.Language]:
|
|
148
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
149
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
150
|
+
client = mod.QuotaClient(cred, g_param[OptionsDefine.Region], profile)
|
|
151
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
152
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
153
|
+
model = models.DeleteAlarmRequest()
|
|
154
|
+
model.from_json_string(json.dumps(args))
|
|
155
|
+
start_time = time.time()
|
|
156
|
+
while True:
|
|
157
|
+
rsp = client.DeleteAlarm(model)
|
|
158
|
+
result = rsp.to_json_string()
|
|
159
|
+
try:
|
|
160
|
+
json_obj = json.loads(result)
|
|
161
|
+
except TypeError as e:
|
|
162
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
163
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
164
|
+
break
|
|
165
|
+
cur_time = time.time()
|
|
166
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
167
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
168
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
169
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
170
|
+
else:
|
|
171
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
172
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
173
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def doDescribeAlarms(args, parsed_globals):
|
|
177
|
+
g_param = parse_global_arg(parsed_globals)
|
|
178
|
+
|
|
179
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
180
|
+
cred = credential.CVMRoleCredential()
|
|
181
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
182
|
+
cred = credential.STSAssumeRoleCredential(
|
|
183
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
184
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
185
|
+
)
|
|
186
|
+
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):
|
|
187
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
188
|
+
else:
|
|
189
|
+
cred = credential.Credential(
|
|
190
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
191
|
+
)
|
|
192
|
+
http_profile = HttpProfile(
|
|
193
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
194
|
+
reqMethod="POST",
|
|
195
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
196
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
197
|
+
)
|
|
198
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
199
|
+
if g_param[OptionsDefine.Language]:
|
|
200
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
201
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
202
|
+
client = mod.QuotaClient(cred, g_param[OptionsDefine.Region], profile)
|
|
203
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
204
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
205
|
+
model = models.DescribeAlarmsRequest()
|
|
206
|
+
model.from_json_string(json.dumps(args))
|
|
207
|
+
start_time = time.time()
|
|
208
|
+
while True:
|
|
209
|
+
rsp = client.DescribeAlarms(model)
|
|
210
|
+
result = rsp.to_json_string()
|
|
211
|
+
try:
|
|
212
|
+
json_obj = json.loads(result)
|
|
213
|
+
except TypeError as e:
|
|
214
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
215
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
216
|
+
break
|
|
217
|
+
cur_time = time.time()
|
|
218
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
219
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
220
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
221
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
222
|
+
else:
|
|
223
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
224
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
225
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def doEnableAlarm(args, parsed_globals):
|
|
229
|
+
g_param = parse_global_arg(parsed_globals)
|
|
230
|
+
|
|
231
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
232
|
+
cred = credential.CVMRoleCredential()
|
|
233
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
234
|
+
cred = credential.STSAssumeRoleCredential(
|
|
235
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
236
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
237
|
+
)
|
|
238
|
+
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):
|
|
239
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
240
|
+
else:
|
|
241
|
+
cred = credential.Credential(
|
|
242
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
243
|
+
)
|
|
244
|
+
http_profile = HttpProfile(
|
|
245
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
246
|
+
reqMethod="POST",
|
|
247
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
248
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
249
|
+
)
|
|
250
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
251
|
+
if g_param[OptionsDefine.Language]:
|
|
252
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
253
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
254
|
+
client = mod.QuotaClient(cred, g_param[OptionsDefine.Region], profile)
|
|
255
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
256
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
257
|
+
model = models.EnableAlarmRequest()
|
|
258
|
+
model.from_json_string(json.dumps(args))
|
|
259
|
+
start_time = time.time()
|
|
260
|
+
while True:
|
|
261
|
+
rsp = client.EnableAlarm(model)
|
|
262
|
+
result = rsp.to_json_string()
|
|
263
|
+
try:
|
|
264
|
+
json_obj = json.loads(result)
|
|
265
|
+
except TypeError as e:
|
|
266
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
267
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
268
|
+
break
|
|
269
|
+
cur_time = time.time()
|
|
270
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
271
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
272
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
273
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
274
|
+
else:
|
|
275
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
276
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
277
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
278
|
+
|
|
279
|
+
|
|
72
280
|
CLIENT_MAP = {
|
|
73
281
|
"v20241204": quota_client_v20241204,
|
|
74
282
|
|
|
@@ -81,6 +289,10 @@ MODELS_MAP = {
|
|
|
81
289
|
|
|
82
290
|
ACTION_MAP = {
|
|
83
291
|
"CreateAlarm": doCreateAlarm,
|
|
292
|
+
"UpdateAlarm": doUpdateAlarm,
|
|
293
|
+
"DeleteAlarm": doDeleteAlarm,
|
|
294
|
+
"DescribeAlarms": doDescribeAlarms,
|
|
295
|
+
"EnableAlarm": doEnableAlarm,
|
|
84
296
|
|
|
85
297
|
}
|
|
86
298
|
|