tccli 3.0.1149.1__py2.py3-none-any.whl → 3.0.1151.1__py2.py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- tccli/__init__.py +1 -1
- tccli/services/__init__.py +3 -0
- tccli/services/asr/v20190614/api.json +2 -2
- tccli/services/cbs/cbs_client.py +61 -8
- tccli/services/cbs/v20170312/api.json +66 -2
- tccli/services/cbs/v20170312/examples.json +8 -0
- tccli/services/ccc/v20200210/api.json +2 -2
- tccli/services/cdz/__init__.py +4 -0
- tccli/services/cdz/cdz_client.py +248 -0
- tccli/services/cdz/v20221123/api.json +305 -0
- tccli/services/cdz/v20221123/examples.json +21 -0
- tccli/services/clb/v20180317/api.json +9 -0
- tccli/services/cynosdb/v20190107/api.json +3 -3
- tccli/services/dasb/v20191018/api.json +5 -4
- tccli/services/dc/v20180410/api.json +14 -7
- tccli/services/dts/v20211206/api.json +2 -2
- tccli/services/ess/v20201111/api.json +4 -4
- tccli/services/essbasic/v20210526/api.json +2 -2
- tccli/services/essbasic/v20210526/examples.json +1 -1
- tccli/services/facefusion/v20220927/api.json +8 -8
- tccli/services/gaap/v20180529/api.json +11 -1
- tccli/services/gaap/v20180529/examples.json +1 -1
- tccli/services/hunyuan/hunyuan_client.py +65 -12
- tccli/services/hunyuan/v20230901/api.json +89 -0
- tccli/services/hunyuan/v20230901/examples.json +8 -0
- tccli/services/iotexplorer/v20190423/api.json +85 -1
- tccli/services/lke/v20231130/api.json +10 -1
- tccli/services/mongodb/v20190725/api.json +18 -9
- tccli/services/mps/v20190612/api.json +45 -41
- tccli/services/mps/v20190612/examples.json +20 -8
- tccli/services/oceanus/v20190422/api.json +9 -0
- tccli/services/ses/v20201002/api.json +1 -1
- tccli/services/vpc/v20170312/api.json +1357 -57
- tccli/services/vpc/v20170312/examples.json +104 -0
- tccli/services/vpc/vpc_client.py +1974 -1285
- {tccli-3.0.1149.1.dist-info → tccli-3.0.1151.1.dist-info}/METADATA +2 -2
- {tccli-3.0.1149.1.dist-info → tccli-3.0.1151.1.dist-info}/RECORD +40 -36
- {tccli-3.0.1149.1.dist-info → tccli-3.0.1151.1.dist-info}/WHEEL +0 -0
- {tccli-3.0.1149.1.dist-info → tccli-3.0.1151.1.dist-info}/entry_points.txt +0 -0
- {tccli-3.0.1149.1.dist-info → tccli-3.0.1151.1.dist-info}/license_files/LICENSE +0 -0
tccli/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '3.0.
|
1
|
+
__version__ = '3.0.1151.1'
|
tccli/services/__init__.py
CHANGED
@@ -335,7 +335,7 @@
|
|
335
335
|
"members": [
|
336
336
|
{
|
337
337
|
"disabled": false,
|
338
|
-
"document": "引擎模型类型。\n• 16k_zh:中文普通话通用;\n• 16k_en:英语;\n• 16k_yue:粤语;\n• 16k_id:印度尼西亚语;\n• 16k_fil:菲律宾语;\n• 16k_th:泰语;\n• 16k_pt:葡萄牙语;\n• 16k_tr:土耳其语;\n• 16k_ar:阿拉伯语;\n• 16k_es:西班牙语;\n• 16k_hi:印地语;\n• 16k_fr:法语;\n• 16k_de
|
338
|
+
"document": "引擎模型类型。\n• 16k_zh:中文普通话通用;\n• 16k_en:英语;\n• 16k_yue:粤语;\n• 16k_id:印度尼西亚语;\n• 16k_fil:菲律宾语;\n• 16k_th:泰语;\n• 16k_pt:葡萄牙语;\n• 16k_tr:土耳其语;\n• 16k_ar:阿拉伯语;\n• 16k_es:西班牙语;\n• 16k_hi:印地语;\n• 16k_fr:法语;\n• 16k_de:德语;",
|
339
339
|
"example": "16k_zh",
|
340
340
|
"member": "string",
|
341
341
|
"name": "EngineType",
|
@@ -526,7 +526,7 @@
|
|
526
526
|
"members": [
|
527
527
|
{
|
528
528
|
"disabled": false,
|
529
|
-
"document": "引擎模型类型\n识别引擎采用分级计费方案,标记为“大模型版”的引擎适用大模型计费方案,[点击这里](https://cloud.tencent.com/document/product/1093/35686) 查看产品计费说明\n\n电话通讯场景引擎:\n**注意:电话通讯场景,请务必使用以下8k引擎**\n• 8k_zh:中文电话通讯;\n• 8k_en:英文电话通讯;\n• **8k_zh_large:**普方大模型引擎【大模型版】。当前模型同时支持中文、[多种中文方言](https://cloud.tencent.com/document/product/1093/35682)等语言的识别,模型参数量极大,语言模型性能增强,针对电话音频中各类场景、各类中文方言的识别准确率极大提升,[点击这里](https://console.cloud.tencent.com/asr/demonstrate) 对比常规版本与普方大模型版本的识别效果;\n\n注意:如您有电话通讯场景识别需求,但发现需求语种仅支持16k,可将8k音频传入下方16k引擎,亦能获取识别结果。但**16k引擎并非基于电话通讯数据训练,无法承诺此种调用方式的识别效果,需由您自行验证识别结果是否可用**\n\n通用场景引擎:\n**注意:除电话通讯场景以外的其它识别场景,请务必使用以下16k引擎**\n• **16k_zh:**中文普通话通用引擎,支持中文普通话和少量英语,使用丰富的中文普通话语料训练,覆盖场景广泛,适用于除电话通讯外的所有中文普通话识别场景;\n• **16k_zh_large:**普方英大模型引擎【大模型版】。当前模型同时支持中文、英文、[多种中文方言](https://cloud.tencent.com/document/product/1093/35682)等语言的识别,模型参数量极大,语言模型性能增强,针对噪声大、回音大、人声小、人声远等低质量音频的识别准确率极大提升,[点击这里](https://console.cloud.tencent.com/asr/demonstrate) 对比中文普通话常规版本与普方英大模型版本的识别效果;\n• **16k_zh_dialect:**中文普通话+多方言混合引擎,除普通话外支持23种方言(上海话、四川话、武汉话、贵阳话、昆明话、西安话、郑州话、太原话、兰州话、银川话、西宁话、南京话、合肥话、南昌话、长沙话、苏州话、杭州话、济南话、天津话、石家庄话、黑龙江话、吉林话、辽宁话);\n• **16k_en:**英语;\n• **16k_yue:**粤语;\n• **16k_zh-PY:**中英粤混合引擎,使用一个引擎同时识别中文普通话、英语、粤语三个语言;\n• **16k_ja:**日语;\n• **16k_ko:**韩语;\n• **16k_vi:**越南语;\n• **16k_ms:**马来语;\n• **16k_id:**印度尼西亚语;\n• **16k_fil:**菲律宾语;\n• **16k_th:**泰语;\n• **16k_pt:**葡萄牙语;\n• **16k_tr:**土耳其语;\n• **16k_ar:**阿拉伯语;\n• **16k_es:**西班牙语;\n• **16k_hi:**印地语;\n• **16k_fr:**法语;\n• **16k_zh_medical:**中文医疗引擎;\n• **16k_de:**德语;",
|
529
|
+
"document": "引擎模型类型\n识别引擎采用分级计费方案,标记为“大模型版”的引擎适用大模型计费方案,[点击这里](https://cloud.tencent.com/document/product/1093/35686) 查看产品计费说明\n\n电话通讯场景引擎:\n**注意:电话通讯场景,请务必使用以下8k引擎**\n• 8k_zh:中文电话通讯;\n• 8k_en:英文电话通讯;\n• **8k_zh_large:**普方大模型引擎【大模型版】。当前模型同时支持中文、[多种中文方言](https://cloud.tencent.com/document/product/1093/35682)等语言的识别,模型参数量极大,语言模型性能增强,针对电话音频中各类场景、各类中文方言的识别准确率极大提升,[点击这里](https://console.cloud.tencent.com/asr/demonstrate) 对比常规版本与普方大模型版本的识别效果;\n\n注意:如您有电话通讯场景识别需求,但发现需求语种仅支持16k,可将8k音频传入下方16k引擎,亦能获取识别结果。但**16k引擎并非基于电话通讯数据训练,无法承诺此种调用方式的识别效果,需由您自行验证识别结果是否可用**\n\n通用场景引擎:\n**注意:除电话通讯场景以外的其它识别场景,请务必使用以下16k引擎**\n• **16k_zh:**中文普通话通用引擎,支持中文普通话和少量英语,使用丰富的中文普通话语料训练,覆盖场景广泛,适用于除电话通讯外的所有中文普通话识别场景;\n• **16k_zh_large:**普方英大模型引擎【大模型版】。当前模型同时支持中文、英文、[多种中文方言](https://cloud.tencent.com/document/product/1093/35682)等语言的识别,模型参数量极大,语言模型性能增强,针对噪声大、回音大、人声小、人声远等低质量音频的识别准确率极大提升,[点击这里](https://console.cloud.tencent.com/asr/demonstrate) 对比中文普通话常规版本与普方英大模型版本的识别效果;\n• **16k_multi_lang:**多语种大模型引擎【大模型版】。当前模型同时支持英语、日语、韩语、阿拉伯语、菲律宾语、法语、印地语、印尼语、马来语、葡萄牙语、西班牙语、泰语、土耳其语、越南语、德语的识别,可实现15个语种的自动识别(句子/段落级别);\n• **16k_zh_dialect:**中文普通话+多方言混合引擎,除普通话外支持23种方言(上海话、四川话、武汉话、贵阳话、昆明话、西安话、郑州话、太原话、兰州话、银川话、西宁话、南京话、合肥话、南昌话、长沙话、苏州话、杭州话、济南话、天津话、石家庄话、黑龙江话、吉林话、辽宁话);\n• **16k_en:**英语;\n• **16k_yue:**粤语;\n• **16k_zh-PY:**中英粤混合引擎,使用一个引擎同时识别中文普通话、英语、粤语三个语言;\n• **16k_ja:**日语;\n• **16k_ko:**韩语;\n• **16k_vi:**越南语;\n• **16k_ms:**马来语;\n• **16k_id:**印度尼西亚语;\n• **16k_fil:**菲律宾语;\n• **16k_th:**泰语;\n• **16k_pt:**葡萄牙语;\n• **16k_tr:**土耳其语;\n• **16k_ar:**阿拉伯语;\n• **16k_es:**西班牙语;\n• **16k_hi:**印地语;\n• **16k_fr:**法语;\n• **16k_zh_medical:**中文医疗引擎;\n• **16k_de:**德语;",
|
530
530
|
"example": "16k_zh",
|
531
531
|
"member": "string",
|
532
532
|
"name": "EngineModelType",
|
tccli/services/cbs/cbs_client.py
CHANGED
@@ -1889,7 +1889,7 @@ def doModifySnapshotsSharePermission(args, parsed_globals):
|
|
1889
1889
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1890
1890
|
|
1891
1891
|
|
1892
|
-
def
|
1892
|
+
def doDescribeSnapshotOverview(args, parsed_globals):
|
1893
1893
|
g_param = parse_global_arg(parsed_globals)
|
1894
1894
|
|
1895
1895
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -1918,11 +1918,63 @@ def doDetachDisks(args, parsed_globals):
|
|
1918
1918
|
client = mod.CbsClient(cred, g_param[OptionsDefine.Region], profile)
|
1919
1919
|
client._sdkVersion += ("_CLI_" + __version__)
|
1920
1920
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1921
|
-
model = models.
|
1921
|
+
model = models.DescribeSnapshotOverviewRequest()
|
1922
1922
|
model.from_json_string(json.dumps(args))
|
1923
1923
|
start_time = time.time()
|
1924
1924
|
while True:
|
1925
|
-
rsp = client.
|
1925
|
+
rsp = client.DescribeSnapshotOverview(model)
|
1926
|
+
result = rsp.to_json_string()
|
1927
|
+
try:
|
1928
|
+
json_obj = json.loads(result)
|
1929
|
+
except TypeError as e:
|
1930
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
1931
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
1932
|
+
break
|
1933
|
+
cur_time = time.time()
|
1934
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
1935
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
1936
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
1937
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
1938
|
+
else:
|
1939
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
1940
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
1941
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1942
|
+
|
1943
|
+
|
1944
|
+
def doCreateSnapshot(args, parsed_globals):
|
1945
|
+
g_param = parse_global_arg(parsed_globals)
|
1946
|
+
|
1947
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
1948
|
+
cred = credential.CVMRoleCredential()
|
1949
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
1950
|
+
cred = credential.STSAssumeRoleCredential(
|
1951
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
1952
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
1953
|
+
)
|
1954
|
+
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):
|
1955
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
1956
|
+
else:
|
1957
|
+
cred = credential.Credential(
|
1958
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
1959
|
+
)
|
1960
|
+
http_profile = HttpProfile(
|
1961
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
1962
|
+
reqMethod="POST",
|
1963
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
1964
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
1965
|
+
)
|
1966
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
1967
|
+
if g_param[OptionsDefine.Language]:
|
1968
|
+
profile.language = g_param[OptionsDefine.Language]
|
1969
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
1970
|
+
client = mod.CbsClient(cred, g_param[OptionsDefine.Region], profile)
|
1971
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
1972
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1973
|
+
model = models.CreateSnapshotRequest()
|
1974
|
+
model.from_json_string(json.dumps(args))
|
1975
|
+
start_time = time.time()
|
1976
|
+
while True:
|
1977
|
+
rsp = client.CreateSnapshot(model)
|
1926
1978
|
result = rsp.to_json_string()
|
1927
1979
|
try:
|
1928
1980
|
json_obj = json.loads(result)
|
@@ -2045,7 +2097,7 @@ def doResizeDisk(args, parsed_globals):
|
|
2045
2097
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
2046
2098
|
|
2047
2099
|
|
2048
|
-
def
|
2100
|
+
def doDetachDisks(args, parsed_globals):
|
2049
2101
|
g_param = parse_global_arg(parsed_globals)
|
2050
2102
|
|
2051
2103
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -2074,11 +2126,11 @@ def doCreateSnapshot(args, parsed_globals):
|
|
2074
2126
|
client = mod.CbsClient(cred, g_param[OptionsDefine.Region], profile)
|
2075
2127
|
client._sdkVersion += ("_CLI_" + __version__)
|
2076
2128
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
2077
|
-
model = models.
|
2129
|
+
model = models.DetachDisksRequest()
|
2078
2130
|
model.from_json_string(json.dumps(args))
|
2079
2131
|
start_time = time.time()
|
2080
2132
|
while True:
|
2081
|
-
rsp = client.
|
2133
|
+
rsp = client.DetachDisks(model)
|
2082
2134
|
result = rsp.to_json_string()
|
2083
2135
|
try:
|
2084
2136
|
json_obj = json.loads(result)
|
@@ -2196,10 +2248,11 @@ ACTION_MAP = {
|
|
2196
2248
|
"DescribeDiskStoragePool": doDescribeDiskStoragePool,
|
2197
2249
|
"InquirePriceModifyDiskExtraPerformance": doInquirePriceModifyDiskExtraPerformance,
|
2198
2250
|
"ModifySnapshotsSharePermission": doModifySnapshotsSharePermission,
|
2199
|
-
"
|
2251
|
+
"DescribeSnapshotOverview": doDescribeSnapshotOverview,
|
2252
|
+
"CreateSnapshot": doCreateSnapshot,
|
2200
2253
|
"GetSnapOverview": doGetSnapOverview,
|
2201
2254
|
"ResizeDisk": doResizeDisk,
|
2202
|
-
"
|
2255
|
+
"DetachDisks": doDetachDisks,
|
2203
2256
|
"InquiryPriceRenewDisks": doInquiryPriceRenewDisks,
|
2204
2257
|
|
2205
2258
|
}
|
@@ -133,6 +133,13 @@
|
|
133
133
|
"output": "DescribeInstancesDiskNumResponse",
|
134
134
|
"status": "online"
|
135
135
|
},
|
136
|
+
"DescribeSnapshotOverview": {
|
137
|
+
"document": "该接口用于查询用户快照使用概览,包括快照总容量、计费容量等信息。",
|
138
|
+
"input": "DescribeSnapshotOverviewRequest",
|
139
|
+
"name": "查询快照使用概览",
|
140
|
+
"output": "DescribeSnapshotOverviewResponse",
|
141
|
+
"status": "online"
|
142
|
+
},
|
136
143
|
"DescribeSnapshotSharePermission": {
|
137
144
|
"document": "本接口(DescribeSnapshotSharePermission)用于查询快照的分享信息。",
|
138
145
|
"input": "DescribeSnapshotSharePermissionRequest",
|
@@ -155,11 +162,11 @@
|
|
155
162
|
"status": "online"
|
156
163
|
},
|
157
164
|
"GetSnapOverview": {
|
158
|
-
"document": "获取快照概览信息",
|
165
|
+
"document": "为进一步规范化API命名,该接口决定预下线,新接口命名为:DescribeSnapshotOverview\n\n获取快照概览信息",
|
159
166
|
"input": "GetSnapOverviewRequest",
|
160
167
|
"name": "获取快照概览信息",
|
161
168
|
"output": "GetSnapOverviewResponse",
|
162
|
-
"status": "
|
169
|
+
"status": "deprecated"
|
163
170
|
},
|
164
171
|
"InitializeDisks": {
|
165
172
|
"document": "重新初始化云硬盘至云硬盘初始创建时的状态。使用云硬盘的重新初始化功能时需要注意以下4点:\n1. 如果云硬盘是由快照创建的,则重新初始化会通过此快照重新回滚此云硬盘,即将云硬盘恢复为与快照一致的状态;\n2. 如果云硬盘不是通过快照创建的,则重新初始化会清空此云硬盘的数据;请在重新初始化云硬盘前检查并备份必要的数据;\n3. 当前仅未挂载的、非共享属性的数据盘云硬盘支持重新初始化;\n4. 当创建此云硬盘的原始快照被删除时,不再支持重新初始化此云硬盘。",
|
@@ -1991,6 +1998,63 @@
|
|
1991
1998
|
],
|
1992
1999
|
"type": "object"
|
1993
2000
|
},
|
2001
|
+
"DescribeSnapshotOverviewRequest": {
|
2002
|
+
"document": "DescribeSnapshotOverview请求参数结构体",
|
2003
|
+
"members": [],
|
2004
|
+
"type": "object"
|
2005
|
+
},
|
2006
|
+
"DescribeSnapshotOverviewResponse": {
|
2007
|
+
"document": "DescribeSnapshotOverview返回参数结构体",
|
2008
|
+
"members": [
|
2009
|
+
{
|
2010
|
+
"disabled": false,
|
2011
|
+
"document": "当前总有效快照数量",
|
2012
|
+
"example": "11",
|
2013
|
+
"member": "uint64",
|
2014
|
+
"name": "TotalNums",
|
2015
|
+
"output_required": false,
|
2016
|
+
"type": "int",
|
2017
|
+
"value_allowed_null": false
|
2018
|
+
},
|
2019
|
+
{
|
2020
|
+
"disabled": false,
|
2021
|
+
"document": "已使用快照总容量大小,容量单位为GiB",
|
2022
|
+
"example": "12.5",
|
2023
|
+
"member": "float",
|
2024
|
+
"name": "TotalSize",
|
2025
|
+
"output_required": false,
|
2026
|
+
"type": "float",
|
2027
|
+
"value_allowed_null": false
|
2028
|
+
},
|
2029
|
+
{
|
2030
|
+
"disabled": false,
|
2031
|
+
"document": "快照免费额度大小,额度单位为GiB",
|
2032
|
+
"example": "50.0",
|
2033
|
+
"member": "float",
|
2034
|
+
"name": "FreeQuota",
|
2035
|
+
"output_required": false,
|
2036
|
+
"type": "float",
|
2037
|
+
"value_allowed_null": false
|
2038
|
+
},
|
2039
|
+
{
|
2040
|
+
"disabled": false,
|
2041
|
+
"document": "快照真实产生计费的总容量大小,单位为GiB",
|
2042
|
+
"example": "11.0",
|
2043
|
+
"member": "float",
|
2044
|
+
"name": "RealTradeSize",
|
2045
|
+
"output_required": false,
|
2046
|
+
"type": "float",
|
2047
|
+
"value_allowed_null": false
|
2048
|
+
},
|
2049
|
+
{
|
2050
|
+
"document": "唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。",
|
2051
|
+
"member": "string",
|
2052
|
+
"name": "RequestId",
|
2053
|
+
"type": "string"
|
2054
|
+
}
|
2055
|
+
],
|
2056
|
+
"type": "object"
|
2057
|
+
},
|
1994
2058
|
"DescribeSnapshotSharePermissionRequest": {
|
1995
2059
|
"document": "DescribeSnapshotSharePermission请求参数结构体",
|
1996
2060
|
"members": [
|
@@ -164,6 +164,14 @@
|
|
164
164
|
"title": "查询多个实例挂载的云硬盘数量"
|
165
165
|
}
|
166
166
|
],
|
167
|
+
"DescribeSnapshotOverview": [
|
168
|
+
{
|
169
|
+
"document": "",
|
170
|
+
"input": "POST / HTTP/1.1\nHost: cbs.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: DescribeSnapshotOverview\n<公共请求参数>\n\n{}",
|
171
|
+
"output": "{\n \"Response\": {\n \"TotalNums\": 13,\n \"TotalSize\": 92.45,\n \"FreeQuota\": 50,\n \"RealTradeSize\": 42.45,\n \"RequestId\": \"6b5509c3-33dd-4121-835b-bfffd8c2a596\"\n }\n}",
|
172
|
+
"title": "查询用户快照概览"
|
173
|
+
}
|
174
|
+
],
|
167
175
|
"DescribeSnapshotSharePermission": [
|
168
176
|
{
|
169
177
|
"document": "查询某个快照的分享信息",
|
@@ -2199,7 +2199,7 @@
|
|
2199
2199
|
{
|
2200
2200
|
"disabled": false,
|
2201
2201
|
"document": "SDK 登录 Token。",
|
2202
|
-
"example": "
|
2202
|
+
"example": "some_token",
|
2203
2203
|
"member": "string",
|
2204
2204
|
"name": "Token",
|
2205
2205
|
"output_required": true,
|
@@ -2219,7 +2219,7 @@
|
|
2219
2219
|
{
|
2220
2220
|
"disabled": false,
|
2221
2221
|
"document": "SDK 加载路径会随着 SDK 的发布而变动。",
|
2222
|
-
"example": "https://
|
2222
|
+
"example": "https://tccc/sdk.js",
|
2223
2223
|
"member": "string",
|
2224
2224
|
"name": "SdkURL",
|
2225
2225
|
"output_required": true,
|
@@ -0,0 +1,248 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
import os
|
3
|
+
import sys
|
4
|
+
import six
|
5
|
+
import json
|
6
|
+
import tccli.options_define as OptionsDefine
|
7
|
+
import tccli.format_output as FormatOutput
|
8
|
+
from tccli import __version__
|
9
|
+
from tccli.utils import Utils
|
10
|
+
from tccli.exceptions import ConfigurationError, ClientError, ParamError
|
11
|
+
from tencentcloud.common import credential
|
12
|
+
from tencentcloud.common.profile.http_profile import HttpProfile
|
13
|
+
from tencentcloud.common.profile.client_profile import ClientProfile
|
14
|
+
from tencentcloud.cdz.v20221123 import cdz_client as cdz_client_v20221123
|
15
|
+
from tencentcloud.cdz.v20221123 import models as models_v20221123
|
16
|
+
|
17
|
+
from jmespath import search
|
18
|
+
import time
|
19
|
+
|
20
|
+
def doDescribeCloudDedicatedZoneResourceSummary(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.CdzClient(cred, g_param[OptionsDefine.Region], profile)
|
47
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
48
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
49
|
+
model = models.DescribeCloudDedicatedZoneResourceSummaryRequest()
|
50
|
+
model.from_json_string(json.dumps(args))
|
51
|
+
start_time = time.time()
|
52
|
+
while True:
|
53
|
+
rsp = client.DescribeCloudDedicatedZoneResourceSummary(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
|
+
|
72
|
+
def doDescribeCloudDedicatedZoneHosts(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.CdzClient(cred, g_param[OptionsDefine.Region], profile)
|
99
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
100
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
101
|
+
model = models.DescribeCloudDedicatedZoneHostsRequest()
|
102
|
+
model.from_json_string(json.dumps(args))
|
103
|
+
start_time = time.time()
|
104
|
+
while True:
|
105
|
+
rsp = client.DescribeCloudDedicatedZoneHosts(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
|
+
CLIENT_MAP = {
|
125
|
+
"v20221123": cdz_client_v20221123,
|
126
|
+
|
127
|
+
}
|
128
|
+
|
129
|
+
MODELS_MAP = {
|
130
|
+
"v20221123": models_v20221123,
|
131
|
+
|
132
|
+
}
|
133
|
+
|
134
|
+
ACTION_MAP = {
|
135
|
+
"DescribeCloudDedicatedZoneResourceSummary": doDescribeCloudDedicatedZoneResourceSummary,
|
136
|
+
"DescribeCloudDedicatedZoneHosts": doDescribeCloudDedicatedZoneHosts,
|
137
|
+
|
138
|
+
}
|
139
|
+
|
140
|
+
AVAILABLE_VERSION_LIST = [
|
141
|
+
"v20221123",
|
142
|
+
|
143
|
+
]
|
144
|
+
|
145
|
+
|
146
|
+
def action_caller():
|
147
|
+
return ACTION_MAP
|
148
|
+
|
149
|
+
|
150
|
+
def parse_global_arg(parsed_globals):
|
151
|
+
g_param = parsed_globals
|
152
|
+
|
153
|
+
is_exist_profile = True
|
154
|
+
if not parsed_globals["profile"]:
|
155
|
+
is_exist_profile = False
|
156
|
+
g_param["profile"] = os.environ.get("TCCLI_PROFILE", "default")
|
157
|
+
|
158
|
+
configure_path = os.path.join(os.path.expanduser("~"), ".tccli")
|
159
|
+
is_conf_exist, conf_path = Utils.file_existed(configure_path, g_param["profile"] + ".configure")
|
160
|
+
is_cred_exist, cred_path = Utils.file_existed(configure_path, g_param["profile"] + ".credential")
|
161
|
+
|
162
|
+
conf = {}
|
163
|
+
cred = {}
|
164
|
+
|
165
|
+
if is_conf_exist:
|
166
|
+
conf = Utils.load_json_msg(conf_path)
|
167
|
+
if is_cred_exist:
|
168
|
+
cred = Utils.load_json_msg(cred_path)
|
169
|
+
|
170
|
+
if not (isinstance(conf, dict) and isinstance(cred, dict)):
|
171
|
+
raise ConfigurationError(
|
172
|
+
"file: %s or %s is not json format"
|
173
|
+
% (g_param["profile"] + ".configure", g_param["profile"] + ".credential"))
|
174
|
+
|
175
|
+
if OptionsDefine.Token not in cred:
|
176
|
+
cred[OptionsDefine.Token] = None
|
177
|
+
|
178
|
+
if not is_exist_profile:
|
179
|
+
if os.environ.get(OptionsDefine.ENV_SECRET_ID) and os.environ.get(OptionsDefine.ENV_SECRET_KEY):
|
180
|
+
cred[OptionsDefine.SecretId] = os.environ.get(OptionsDefine.ENV_SECRET_ID)
|
181
|
+
cred[OptionsDefine.SecretKey] = os.environ.get(OptionsDefine.ENV_SECRET_KEY)
|
182
|
+
cred[OptionsDefine.Token] = os.environ.get(OptionsDefine.ENV_TOKEN)
|
183
|
+
|
184
|
+
if os.environ.get(OptionsDefine.ENV_REGION):
|
185
|
+
conf[OptionsDefine.SysParam][OptionsDefine.Region] = os.environ.get(OptionsDefine.ENV_REGION)
|
186
|
+
|
187
|
+
if os.environ.get(OptionsDefine.ENV_ROLE_ARN) and os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME):
|
188
|
+
cred[OptionsDefine.RoleArn] = os.environ.get(OptionsDefine.ENV_ROLE_ARN)
|
189
|
+
cred[OptionsDefine.RoleSessionName] = os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME)
|
190
|
+
|
191
|
+
for param in g_param.keys():
|
192
|
+
if g_param[param] is None:
|
193
|
+
if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.Token]:
|
194
|
+
if param in cred:
|
195
|
+
g_param[param] = cred[param]
|
196
|
+
elif not (g_param[OptionsDefine.UseCVMRole.replace('-', '_')]
|
197
|
+
or os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN)):
|
198
|
+
raise ConfigurationError("%s is invalid" % param)
|
199
|
+
elif param in [OptionsDefine.Region, OptionsDefine.Output, OptionsDefine.Language]:
|
200
|
+
if param in conf[OptionsDefine.SysParam]:
|
201
|
+
g_param[param] = conf[OptionsDefine.SysParam][param]
|
202
|
+
elif param != OptionsDefine.Language:
|
203
|
+
raise ConfigurationError("%s is invalid" % param)
|
204
|
+
elif param.replace('_', '-') in [OptionsDefine.RoleArn, OptionsDefine.RoleSessionName]:
|
205
|
+
if param.replace('_', '-') in cred:
|
206
|
+
g_param[param] = cred[param.replace('_', '-')]
|
207
|
+
|
208
|
+
try:
|
209
|
+
if g_param[OptionsDefine.ServiceVersion]:
|
210
|
+
g_param[OptionsDefine.Version] = "v" + g_param[OptionsDefine.ServiceVersion].replace('-', '')
|
211
|
+
else:
|
212
|
+
version = conf["cdz"][OptionsDefine.Version]
|
213
|
+
g_param[OptionsDefine.Version] = "v" + version.replace('-', '')
|
214
|
+
|
215
|
+
if g_param[OptionsDefine.Endpoint] is None:
|
216
|
+
g_param[OptionsDefine.Endpoint] = conf["cdz"][OptionsDefine.Endpoint]
|
217
|
+
g_param["sts_cred_endpoint"] = conf.get("sts", {}).get("endpoint")
|
218
|
+
except Exception as err:
|
219
|
+
raise ConfigurationError("config file:%s error, %s" % (conf_path, str(err)))
|
220
|
+
|
221
|
+
if g_param[OptionsDefine.Version] not in AVAILABLE_VERSION_LIST:
|
222
|
+
raise Exception("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST))
|
223
|
+
|
224
|
+
if g_param[OptionsDefine.Waiter]:
|
225
|
+
param = eval(g_param[OptionsDefine.Waiter])
|
226
|
+
if 'expr' not in param:
|
227
|
+
raise Exception('`expr` in `--waiter` must be defined')
|
228
|
+
if 'to' not in param:
|
229
|
+
raise Exception('`to` in `--waiter` must be defined')
|
230
|
+
if 'timeout' not in param:
|
231
|
+
if 'waiter' in conf and 'timeout' in conf['waiter']:
|
232
|
+
param['timeout'] = conf['waiter']['timeout']
|
233
|
+
else:
|
234
|
+
param['timeout'] = 180
|
235
|
+
if 'interval' not in param:
|
236
|
+
if 'waiter' in conf and 'interval' in conf['waiter']:
|
237
|
+
param['interval'] = conf['waiter']['interval']
|
238
|
+
else:
|
239
|
+
param['interval'] = 5
|
240
|
+
param['interval'] = min(param['interval'], param['timeout'])
|
241
|
+
g_param['OptionsDefine.WaiterInfo'] = param
|
242
|
+
|
243
|
+
if six.PY2:
|
244
|
+
for key, value in g_param.items():
|
245
|
+
if isinstance(value, six.text_type):
|
246
|
+
g_param[key] = value.encode('utf-8')
|
247
|
+
return g_param
|
248
|
+
|