tccli 3.0.1004.1__py2.py3-none-any.whl → 3.0.1005.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/examples/cvm/v20170312/CreateLaunchTemplate.md +1 -1
- tccli/examples/cvm/v20170312/RenewInstances.md +2 -2
- tccli/examples/cvm/v20170312/ResetInstancesPassword.md +1 -1
- tccli/examples/cvm/v20170312/StopInstances.md +1 -1
- tccli/examples/cwp/v20180228/DescribeMachineInfo.md +20 -20
- tccli/examples/cynosdb/v20190107/CreateClusterDatabase.md +9 -9
- tccli/examples/cynosdb/v20190107/DescribeClusterParams.md +18 -28
- tccli/examples/cynosdb/v20190107/DescribeClusters.md +70 -77
- tccli/examples/cynosdb/v20190107/DescribeZones.md +27 -29
- tccli/examples/cynosdb/v20190107/ModifyAccountHost.md +5 -5
- tccli/examples/cynosdb/v20190107/ModifyProxyDesc.md +4 -4
- tccli/examples/cynosdb/v20190107/ReloadBalanceProxyNode.md +5 -5
- tccli/examples/essbasic/v20210526/OperateChannelTemplate.md +22 -22
- tccli/examples/hai/v20230812/DescribeApplications.md +2 -1
- tccli/examples/sqlserver/v20180328/BalanceReadOnlyGroup.md +21 -0
- tccli/examples/sqlserver/v20180328/DeleteRestoreTask.md +21 -0
- tccli/examples/sqlserver/v20180328/DescribeAccountPrivilegeByDB.md +31 -0
- tccli/examples/sqlserver/v20180328/DescribeCollationTimeZone.md +24 -0
- tccli/examples/sqlserver/v20180328/DescribeCrossRegions.md +27 -0
- tccli/examples/sqlserver/v20180328/DescribeDBPrivilegeByAccount.md +46 -0
- tccli/examples/sqlserver/v20180328/DescribeDBRestoreTime.md +31 -0
- tccli/examples/sqlserver/v20180328/DescribeDatabaseNames.md +27 -0
- tccli/examples/sqlserver/v20180328/DescribeInquiryPriceParameter.md +30 -0
- tccli/examples/sqlserver/v20180328/DescribeInstanceTasks.md +36 -0
- tccli/examples/sqlserver/v20180328/DescribeInstanceTradeParameter.md +37 -0
- tccli/examples/sqlserver/v20180328/DescribeProductSpec.md +81 -0
- tccli/examples/sqlserver/v20180328/DescribeReadOnlyGroupAutoWeight.md +60 -0
- tccli/examples/sqlserver/v20180328/DescribeRestoreTask.md +46 -0
- tccli/examples/sqlserver/v20180328/DescribeSpecSellStatus.md +124 -0
- tccli/examples/sqlserver/v20180328/DescribeUpgradeInstanceCheck.md +71 -0
- tccli/examples/sqlserver/v20180328/ModifyCloseWanIp.md +21 -0
- tccli/examples/sqlserver/v20180328/ModifyDBInstanceNote.md +21 -0
- tccli/examples/sqlserver/v20180328/ModifyOpenWanIp.md +21 -0
- tccli/examples/sqlserver/v20180328/ModifyPublishSubscribe.md +51 -0
- tccli/examples/tbaas/v20180416/DescribeFabricBlock.md +37 -0
- tccli/examples/tbaas/v20180416/DescribeFabricTransaction.md +33 -0
- tccli/examples/tbaas/v20180416/InvokeFabricChaincode.md +28 -0
- tccli/examples/tbaas/v20180416/QueryFabricChaincode.md +27 -0
- tccli/examples/tcss/v20201101/AddEditImageAutoAuthorizedRule.md +1 -1
- tccli/examples/tcss/v20201101/CreateAssetImageScanSetting.md +4 -4
- tccli/examples/tcss/v20201101/DescribeAssetImageDetail.md +28 -27
- tccli/examples/tcss/v20201101/DescribeImageAutoAuthorizedRule.md +2 -2
- tccli/examples/tcss/v20201101/RenewImageAuthorizeState.md +2 -2
- tccli/examples/tke/v20180525/DescribeClusterEndpoints.md +1 -0
- tccli/examples/tke/v20180525/DescribeClusterExtraArgs.md +31 -0
- tccli/examples/tke/v20180525/DescribeExternalNodeSupportConfig.md +81 -0
- tccli/examples/tke/v20180525/DescribeIPAMD.md +26 -0
- tccli/examples/trocket/v20230308/ImportSourceClusterConsumerGroups.md +23 -0
- tccli/examples/trocket/v20230308/ImportSourceClusterTopics.md +25 -0
- tccli/examples/wedata/v20210820/DescribeApproveList.md +43 -161
- tccli/examples/wedata/v20210820/DescribeApproveTypeList.md +64 -0
- tccli/services/__init__.py +1 -5
- tccli/services/billing/v20180709/api.json +10 -10
- tccli/services/cdb/v20170320/api.json +10 -1
- tccli/services/cloudstudio/cloudstudio_client.py +30 -1042
- tccli/services/cvm/v20170312/api.json +68 -68
- tccli/services/cvm/v20170312/examples.json +4 -4
- tccli/services/cwp/v20180228/api.json +20 -0
- tccli/services/cwp/v20180228/examples.json +1 -1
- tccli/services/cynosdb/v20190107/api.json +10 -11
- tccli/services/cynosdb/v20190107/examples.json +14 -14
- tccli/services/dsgc/v20190723/api.json +48 -41
- tccli/services/ess/v20201111/api.json +9 -9
- tccli/services/essbasic/v20210526/api.json +10 -10
- tccli/services/essbasic/v20210526/examples.json +6 -6
- tccli/services/hai/v20230812/api.json +69 -69
- tccli/services/hai/v20230812/examples.json +1 -1
- tccli/services/sqlserver/sqlserver_client.py +1418 -358
- tccli/services/sqlserver/v20180328/api.json +2426 -172
- tccli/services/sqlserver/v20180328/examples.json +166 -0
- tccli/services/tbaas/tbaas_client.py +273 -61
- tccli/services/tbaas/v20180416/api.json +539 -0
- tccli/services/tbaas/v20180416/examples.json +32 -0
- tccli/services/tchd/v20230306/api.json +1 -1
- tccli/services/tcss/v20201101/api.json +443 -87
- tccli/services/tcss/v20201101/examples.json +7 -7
- tccli/services/tdmq/v20200217/api.json +9 -9
- tccli/services/tke/tke_client.py +159 -0
- tccli/services/tke/v20180525/api.json +375 -0
- tccli/services/tke/v20180525/examples.json +25 -1
- tccli/services/trocket/trocket_client.py +171 -65
- tccli/services/trocket/v20230308/api.json +230 -0
- tccli/services/trocket/v20230308/examples.json +16 -0
- tccli/services/tse/v20201207/api.json +57 -35
- tccli/services/vrs/v20200824/api.json +10 -0
- tccli/services/waf/v20180125/api.json +201 -54
- tccli/services/wedata/v20210820/api.json +144 -14
- tccli/services/wedata/v20210820/examples.json +16 -2
- tccli/services/wedata/wedata_client.py +53 -0
- tccli/services/weilingwith/v20230427/api.json +13 -13
- {tccli-3.0.1004.1.dist-info → tccli-3.0.1005.1.dist-info}/METADATA +2 -2
- {tccli-3.0.1004.1.dist-info → tccli-3.0.1005.1.dist-info}/RECORD +96 -72
- tccli/services/casb/__init__.py +0 -4
- tccli/services/casb/casb_client.py +0 -194
- tccli/services/casb/v20200507/api.json +0 -110
- tccli/services/casb/v20200507/examples.json +0 -19
- tccli/services/cloudstudio/v20210524/api.json +0 -2604
- tccli/services/cloudstudio/v20210524/examples.json +0 -205
- {tccli-3.0.1004.1.dist-info → tccli-3.0.1005.1.dist-info}/WHEEL +0 -0
- {tccli-3.0.1004.1.dist-info → tccli-3.0.1005.1.dist-info}/entry_points.txt +0 -0
- {tccli-3.0.1004.1.dist-info → tccli-3.0.1005.1.dist-info}/license_files/LICENSE +0 -0
@@ -13,1001 +13,11 @@ from tencentcloud.common.profile.http_profile import HttpProfile
|
|
13
13
|
from tencentcloud.common.profile.client_profile import ClientProfile
|
14
14
|
from tencentcloud.cloudstudio.v20230508 import cloudstudio_client as cloudstudio_client_v20230508
|
15
15
|
from tencentcloud.cloudstudio.v20230508 import models as models_v20230508
|
16
|
-
from tencentcloud.cloudstudio.v20210524 import cloudstudio_client as cloudstudio_client_v20210524
|
17
|
-
from tencentcloud.cloudstudio.v20210524 import models as models_v20210524
|
18
16
|
|
19
17
|
from jmespath import search
|
20
18
|
import time
|
21
19
|
|
22
|
-
def
|
23
|
-
g_param = parse_global_arg(parsed_globals)
|
24
|
-
|
25
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
26
|
-
cred = credential.CVMRoleCredential()
|
27
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
28
|
-
cred = credential.STSAssumeRoleCredential(
|
29
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
30
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
31
|
-
)
|
32
|
-
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):
|
33
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
34
|
-
else:
|
35
|
-
cred = credential.Credential(
|
36
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
37
|
-
)
|
38
|
-
http_profile = HttpProfile(
|
39
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
40
|
-
reqMethod="POST",
|
41
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
42
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
43
|
-
)
|
44
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
45
|
-
if g_param[OptionsDefine.Language]:
|
46
|
-
profile.language = g_param[OptionsDefine.Language]
|
47
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
48
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
49
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
50
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
51
|
-
model = models.DescribeCustomizeTemplatesByIdRequest()
|
52
|
-
model.from_json_string(json.dumps(args))
|
53
|
-
start_time = time.time()
|
54
|
-
while True:
|
55
|
-
rsp = client.DescribeCustomizeTemplatesById(model)
|
56
|
-
result = rsp.to_json_string()
|
57
|
-
try:
|
58
|
-
json_obj = json.loads(result)
|
59
|
-
except TypeError as e:
|
60
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
61
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
62
|
-
break
|
63
|
-
cur_time = time.time()
|
64
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
65
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
66
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
67
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
68
|
-
else:
|
69
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
70
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
71
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
72
|
-
|
73
|
-
|
74
|
-
def doDescribeConfig(args, parsed_globals):
|
75
|
-
g_param = parse_global_arg(parsed_globals)
|
76
|
-
|
77
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
78
|
-
cred = credential.CVMRoleCredential()
|
79
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
80
|
-
cred = credential.STSAssumeRoleCredential(
|
81
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
82
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
83
|
-
)
|
84
|
-
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):
|
85
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
86
|
-
else:
|
87
|
-
cred = credential.Credential(
|
88
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
89
|
-
)
|
90
|
-
http_profile = HttpProfile(
|
91
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
92
|
-
reqMethod="POST",
|
93
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
94
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
95
|
-
)
|
96
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
97
|
-
if g_param[OptionsDefine.Language]:
|
98
|
-
profile.language = g_param[OptionsDefine.Language]
|
99
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
100
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
101
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
102
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
103
|
-
model = models.DescribeConfigRequest()
|
104
|
-
model.from_json_string(json.dumps(args))
|
105
|
-
start_time = time.time()
|
106
|
-
while True:
|
107
|
-
rsp = client.DescribeConfig(model)
|
108
|
-
result = rsp.to_json_string()
|
109
|
-
try:
|
110
|
-
json_obj = json.loads(result)
|
111
|
-
except TypeError as e:
|
112
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
113
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
114
|
-
break
|
115
|
-
cur_time = time.time()
|
116
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
117
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
118
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
119
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
120
|
-
else:
|
121
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
122
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
123
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
124
|
-
|
125
|
-
|
126
|
-
def doModifyWorkspace(args, parsed_globals):
|
127
|
-
g_param = parse_global_arg(parsed_globals)
|
128
|
-
|
129
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
130
|
-
cred = credential.CVMRoleCredential()
|
131
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
132
|
-
cred = credential.STSAssumeRoleCredential(
|
133
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
134
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
135
|
-
)
|
136
|
-
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):
|
137
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
138
|
-
else:
|
139
|
-
cred = credential.Credential(
|
140
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
141
|
-
)
|
142
|
-
http_profile = HttpProfile(
|
143
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
144
|
-
reqMethod="POST",
|
145
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
146
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
147
|
-
)
|
148
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
149
|
-
if g_param[OptionsDefine.Language]:
|
150
|
-
profile.language = g_param[OptionsDefine.Language]
|
151
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
152
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
153
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
154
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
155
|
-
model = models.ModifyWorkspaceRequest()
|
156
|
-
model.from_json_string(json.dumps(args))
|
157
|
-
start_time = time.time()
|
158
|
-
while True:
|
159
|
-
rsp = client.ModifyWorkspace(model)
|
160
|
-
result = rsp.to_json_string()
|
161
|
-
try:
|
162
|
-
json_obj = json.loads(result)
|
163
|
-
except TypeError as e:
|
164
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
165
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
166
|
-
break
|
167
|
-
cur_time = time.time()
|
168
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
169
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
170
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
171
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
172
|
-
else:
|
173
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
174
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
175
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
176
|
-
|
177
|
-
|
178
|
-
def doModifyCustomizeTemplatesPartById(args, parsed_globals):
|
179
|
-
g_param = parse_global_arg(parsed_globals)
|
180
|
-
|
181
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
182
|
-
cred = credential.CVMRoleCredential()
|
183
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
184
|
-
cred = credential.STSAssumeRoleCredential(
|
185
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
186
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
187
|
-
)
|
188
|
-
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):
|
189
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
190
|
-
else:
|
191
|
-
cred = credential.Credential(
|
192
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
193
|
-
)
|
194
|
-
http_profile = HttpProfile(
|
195
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
196
|
-
reqMethod="POST",
|
197
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
198
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
199
|
-
)
|
200
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
201
|
-
if g_param[OptionsDefine.Language]:
|
202
|
-
profile.language = g_param[OptionsDefine.Language]
|
203
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
204
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
205
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
206
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
207
|
-
model = models.ModifyCustomizeTemplatesPartByIdRequest()
|
208
|
-
model.from_json_string(json.dumps(args))
|
209
|
-
start_time = time.time()
|
210
|
-
while True:
|
211
|
-
rsp = client.ModifyCustomizeTemplatesPartById(model)
|
212
|
-
result = rsp.to_json_string()
|
213
|
-
try:
|
214
|
-
json_obj = json.loads(result)
|
215
|
-
except TypeError as e:
|
216
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
217
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
218
|
-
break
|
219
|
-
cur_time = time.time()
|
220
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
221
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
222
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
223
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
224
|
-
else:
|
225
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
226
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
227
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
228
|
-
|
229
|
-
|
230
|
-
def doCreateWorkspaceToken(args, parsed_globals):
|
231
|
-
g_param = parse_global_arg(parsed_globals)
|
232
|
-
|
233
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
234
|
-
cred = credential.CVMRoleCredential()
|
235
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
236
|
-
cred = credential.STSAssumeRoleCredential(
|
237
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
238
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
239
|
-
)
|
240
|
-
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):
|
241
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
242
|
-
else:
|
243
|
-
cred = credential.Credential(
|
244
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
245
|
-
)
|
246
|
-
http_profile = HttpProfile(
|
247
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
248
|
-
reqMethod="POST",
|
249
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
250
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
251
|
-
)
|
252
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
253
|
-
if g_param[OptionsDefine.Language]:
|
254
|
-
profile.language = g_param[OptionsDefine.Language]
|
255
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
256
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
257
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
258
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
259
|
-
model = models.CreateWorkspaceTokenRequest()
|
260
|
-
model.from_json_string(json.dumps(args))
|
261
|
-
start_time = time.time()
|
262
|
-
while True:
|
263
|
-
rsp = client.CreateWorkspaceToken(model)
|
264
|
-
result = rsp.to_json_string()
|
265
|
-
try:
|
266
|
-
json_obj = json.loads(result)
|
267
|
-
except TypeError as e:
|
268
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
269
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
270
|
-
break
|
271
|
-
cur_time = time.time()
|
272
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
273
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
274
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
275
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
276
|
-
else:
|
277
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
278
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
279
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
280
|
-
|
281
|
-
|
282
|
-
def doDescribeWorkspaceIsReady(args, parsed_globals):
|
283
|
-
g_param = parse_global_arg(parsed_globals)
|
284
|
-
|
285
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
286
|
-
cred = credential.CVMRoleCredential()
|
287
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
288
|
-
cred = credential.STSAssumeRoleCredential(
|
289
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
290
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
291
|
-
)
|
292
|
-
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):
|
293
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
294
|
-
else:
|
295
|
-
cred = credential.Credential(
|
296
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
297
|
-
)
|
298
|
-
http_profile = HttpProfile(
|
299
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
300
|
-
reqMethod="POST",
|
301
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
302
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
303
|
-
)
|
304
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
305
|
-
if g_param[OptionsDefine.Language]:
|
306
|
-
profile.language = g_param[OptionsDefine.Language]
|
307
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
308
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
309
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
310
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
311
|
-
model = models.DescribeWorkspaceIsReadyRequest()
|
312
|
-
model.from_json_string(json.dumps(args))
|
313
|
-
start_time = time.time()
|
314
|
-
while True:
|
315
|
-
rsp = client.DescribeWorkspaceIsReady(model)
|
316
|
-
result = rsp.to_json_string()
|
317
|
-
try:
|
318
|
-
json_obj = json.loads(result)
|
319
|
-
except TypeError as e:
|
320
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
321
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
322
|
-
break
|
323
|
-
cur_time = time.time()
|
324
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
325
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
326
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
327
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
328
|
-
else:
|
329
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
330
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
331
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
332
|
-
|
333
|
-
|
334
|
-
def doRunWorkspace(args, parsed_globals):
|
335
|
-
g_param = parse_global_arg(parsed_globals)
|
336
|
-
|
337
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
338
|
-
cred = credential.CVMRoleCredential()
|
339
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
340
|
-
cred = credential.STSAssumeRoleCredential(
|
341
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
342
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
343
|
-
)
|
344
|
-
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):
|
345
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
346
|
-
else:
|
347
|
-
cred = credential.Credential(
|
348
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
349
|
-
)
|
350
|
-
http_profile = HttpProfile(
|
351
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
352
|
-
reqMethod="POST",
|
353
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
354
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
355
|
-
)
|
356
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
357
|
-
if g_param[OptionsDefine.Language]:
|
358
|
-
profile.language = g_param[OptionsDefine.Language]
|
359
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
360
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
361
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
362
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
363
|
-
model = models.RunWorkspaceRequest()
|
364
|
-
model.from_json_string(json.dumps(args))
|
365
|
-
start_time = time.time()
|
366
|
-
while True:
|
367
|
-
rsp = client.RunWorkspace(model)
|
368
|
-
result = rsp.to_json_string()
|
369
|
-
try:
|
370
|
-
json_obj = json.loads(result)
|
371
|
-
except TypeError as e:
|
372
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
373
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
374
|
-
break
|
375
|
-
cur_time = time.time()
|
376
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
377
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
378
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
379
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
380
|
-
else:
|
381
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
382
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
383
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
384
|
-
|
385
|
-
|
386
|
-
def doDescribeCustomizeTemplates(args, parsed_globals):
|
387
|
-
g_param = parse_global_arg(parsed_globals)
|
388
|
-
|
389
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
390
|
-
cred = credential.CVMRoleCredential()
|
391
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
392
|
-
cred = credential.STSAssumeRoleCredential(
|
393
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
394
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
395
|
-
)
|
396
|
-
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):
|
397
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
398
|
-
else:
|
399
|
-
cred = credential.Credential(
|
400
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
401
|
-
)
|
402
|
-
http_profile = HttpProfile(
|
403
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
404
|
-
reqMethod="POST",
|
405
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
406
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
407
|
-
)
|
408
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
409
|
-
if g_param[OptionsDefine.Language]:
|
410
|
-
profile.language = g_param[OptionsDefine.Language]
|
411
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
412
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
413
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
414
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
415
|
-
model = models.DescribeCustomizeTemplatesRequest()
|
416
|
-
model.from_json_string(json.dumps(args))
|
417
|
-
start_time = time.time()
|
418
|
-
while True:
|
419
|
-
rsp = client.DescribeCustomizeTemplates(model)
|
420
|
-
result = rsp.to_json_string()
|
421
|
-
try:
|
422
|
-
json_obj = json.loads(result)
|
423
|
-
except TypeError as e:
|
424
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
425
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
426
|
-
break
|
427
|
-
cur_time = time.time()
|
428
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
429
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
430
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
431
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
432
|
-
else:
|
433
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
434
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
435
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
436
|
-
|
437
|
-
|
438
|
-
def doRecoverWorkspace(args, parsed_globals):
|
439
|
-
g_param = parse_global_arg(parsed_globals)
|
440
|
-
|
441
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
442
|
-
cred = credential.CVMRoleCredential()
|
443
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
444
|
-
cred = credential.STSAssumeRoleCredential(
|
445
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
446
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
447
|
-
)
|
448
|
-
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):
|
449
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
450
|
-
else:
|
451
|
-
cred = credential.Credential(
|
452
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
453
|
-
)
|
454
|
-
http_profile = HttpProfile(
|
455
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
456
|
-
reqMethod="POST",
|
457
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
458
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
459
|
-
)
|
460
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
461
|
-
if g_param[OptionsDefine.Language]:
|
462
|
-
profile.language = g_param[OptionsDefine.Language]
|
463
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
464
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
465
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
466
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
467
|
-
model = models.RecoverWorkspaceRequest()
|
468
|
-
model.from_json_string(json.dumps(args))
|
469
|
-
start_time = time.time()
|
470
|
-
while True:
|
471
|
-
rsp = client.RecoverWorkspace(model)
|
472
|
-
result = rsp.to_json_string()
|
473
|
-
try:
|
474
|
-
json_obj = json.loads(result)
|
475
|
-
except TypeError as e:
|
476
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
477
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
478
|
-
break
|
479
|
-
cur_time = time.time()
|
480
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
481
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
482
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
483
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
484
|
-
else:
|
485
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
486
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
487
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
488
|
-
|
489
|
-
|
490
|
-
def doCreateWorkspaceByVersionControl(args, parsed_globals):
|
491
|
-
g_param = parse_global_arg(parsed_globals)
|
492
|
-
|
493
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
494
|
-
cred = credential.CVMRoleCredential()
|
495
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
496
|
-
cred = credential.STSAssumeRoleCredential(
|
497
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
498
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
499
|
-
)
|
500
|
-
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):
|
501
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
502
|
-
else:
|
503
|
-
cred = credential.Credential(
|
504
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
505
|
-
)
|
506
|
-
http_profile = HttpProfile(
|
507
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
508
|
-
reqMethod="POST",
|
509
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
510
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
511
|
-
)
|
512
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
513
|
-
if g_param[OptionsDefine.Language]:
|
514
|
-
profile.language = g_param[OptionsDefine.Language]
|
515
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
516
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
517
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
518
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
519
|
-
model = models.CreateWorkspaceByVersionControlRequest()
|
520
|
-
model.from_json_string(json.dumps(args))
|
521
|
-
start_time = time.time()
|
522
|
-
while True:
|
523
|
-
rsp = client.CreateWorkspaceByVersionControl(model)
|
524
|
-
result = rsp.to_json_string()
|
525
|
-
try:
|
526
|
-
json_obj = json.loads(result)
|
527
|
-
except TypeError as e:
|
528
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
529
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
530
|
-
break
|
531
|
-
cur_time = time.time()
|
532
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
533
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
534
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
535
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
536
|
-
else:
|
537
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
538
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
539
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
540
|
-
|
541
|
-
|
542
|
-
def doModifyCustomizeTemplateVersionControl(args, parsed_globals):
|
543
|
-
g_param = parse_global_arg(parsed_globals)
|
544
|
-
|
545
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
546
|
-
cred = credential.CVMRoleCredential()
|
547
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
548
|
-
cred = credential.STSAssumeRoleCredential(
|
549
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
550
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
551
|
-
)
|
552
|
-
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):
|
553
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
554
|
-
else:
|
555
|
-
cred = credential.Credential(
|
556
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
557
|
-
)
|
558
|
-
http_profile = HttpProfile(
|
559
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
560
|
-
reqMethod="POST",
|
561
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
562
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
563
|
-
)
|
564
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
565
|
-
if g_param[OptionsDefine.Language]:
|
566
|
-
profile.language = g_param[OptionsDefine.Language]
|
567
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
568
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
569
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
570
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
571
|
-
model = models.ModifyCustomizeTemplateVersionControlRequest()
|
572
|
-
model.from_json_string(json.dumps(args))
|
573
|
-
start_time = time.time()
|
574
|
-
while True:
|
575
|
-
rsp = client.ModifyCustomizeTemplateVersionControl(model)
|
576
|
-
result = rsp.to_json_string()
|
577
|
-
try:
|
578
|
-
json_obj = json.loads(result)
|
579
|
-
except TypeError as e:
|
580
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
581
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
582
|
-
break
|
583
|
-
cur_time = time.time()
|
584
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
585
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
586
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
587
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
588
|
-
else:
|
589
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
590
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
591
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
592
|
-
|
593
|
-
|
594
|
-
def doDescribeWorkspaces(args, parsed_globals):
|
595
|
-
g_param = parse_global_arg(parsed_globals)
|
596
|
-
|
597
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
598
|
-
cred = credential.CVMRoleCredential()
|
599
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
600
|
-
cred = credential.STSAssumeRoleCredential(
|
601
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
602
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
603
|
-
)
|
604
|
-
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):
|
605
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
606
|
-
else:
|
607
|
-
cred = credential.Credential(
|
608
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
609
|
-
)
|
610
|
-
http_profile = HttpProfile(
|
611
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
612
|
-
reqMethod="POST",
|
613
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
614
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
615
|
-
)
|
616
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
617
|
-
if g_param[OptionsDefine.Language]:
|
618
|
-
profile.language = g_param[OptionsDefine.Language]
|
619
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
620
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
621
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
622
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
623
|
-
model = models.DescribeWorkspacesRequest()
|
624
|
-
model.from_json_string(json.dumps(args))
|
625
|
-
start_time = time.time()
|
626
|
-
while True:
|
627
|
-
rsp = client.DescribeWorkspaces(model)
|
628
|
-
result = rsp.to_json_string()
|
629
|
-
try:
|
630
|
-
json_obj = json.loads(result)
|
631
|
-
except TypeError as e:
|
632
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
633
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
634
|
-
break
|
635
|
-
cur_time = time.time()
|
636
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
637
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
638
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
639
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
640
|
-
else:
|
641
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
642
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
643
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
644
|
-
|
645
|
-
|
646
|
-
def doCreateWorkspace(args, parsed_globals):
|
647
|
-
g_param = parse_global_arg(parsed_globals)
|
648
|
-
|
649
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
650
|
-
cred = credential.CVMRoleCredential()
|
651
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
652
|
-
cred = credential.STSAssumeRoleCredential(
|
653
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
654
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
655
|
-
)
|
656
|
-
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):
|
657
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
658
|
-
else:
|
659
|
-
cred = credential.Credential(
|
660
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
661
|
-
)
|
662
|
-
http_profile = HttpProfile(
|
663
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
664
|
-
reqMethod="POST",
|
665
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
666
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
667
|
-
)
|
668
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
669
|
-
if g_param[OptionsDefine.Language]:
|
670
|
-
profile.language = g_param[OptionsDefine.Language]
|
671
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
672
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
673
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
674
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
675
|
-
model = models.CreateWorkspaceRequest()
|
676
|
-
model.from_json_string(json.dumps(args))
|
677
|
-
start_time = time.time()
|
678
|
-
while True:
|
679
|
-
rsp = client.CreateWorkspace(model)
|
680
|
-
result = rsp.to_json_string()
|
681
|
-
try:
|
682
|
-
json_obj = json.loads(result)
|
683
|
-
except TypeError as e:
|
684
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
685
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
686
|
-
break
|
687
|
-
cur_time = time.time()
|
688
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
689
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
690
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
691
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
692
|
-
else:
|
693
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
694
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
695
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
696
|
-
|
697
|
-
|
698
|
-
def doRemoveWorkspace(args, parsed_globals):
|
699
|
-
g_param = parse_global_arg(parsed_globals)
|
700
|
-
|
701
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
702
|
-
cred = credential.CVMRoleCredential()
|
703
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
704
|
-
cred = credential.STSAssumeRoleCredential(
|
705
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
706
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
707
|
-
)
|
708
|
-
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):
|
709
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
710
|
-
else:
|
711
|
-
cred = credential.Credential(
|
712
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
713
|
-
)
|
714
|
-
http_profile = HttpProfile(
|
715
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
716
|
-
reqMethod="POST",
|
717
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
718
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
719
|
-
)
|
720
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
721
|
-
if g_param[OptionsDefine.Language]:
|
722
|
-
profile.language = g_param[OptionsDefine.Language]
|
723
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
724
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
725
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
726
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
727
|
-
model = models.RemoveWorkspaceRequest()
|
728
|
-
model.from_json_string(json.dumps(args))
|
729
|
-
start_time = time.time()
|
730
|
-
while True:
|
731
|
-
rsp = client.RemoveWorkspace(model)
|
732
|
-
result = rsp.to_json_string()
|
733
|
-
try:
|
734
|
-
json_obj = json.loads(result)
|
735
|
-
except TypeError as e:
|
736
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
737
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
738
|
-
break
|
739
|
-
cur_time = time.time()
|
740
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
741
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
742
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
743
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
744
|
-
else:
|
745
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
746
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
747
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
748
|
-
|
749
|
-
|
750
|
-
def doDescribeWorkspaceEnvList(args, parsed_globals):
|
751
|
-
g_param = parse_global_arg(parsed_globals)
|
752
|
-
|
753
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
754
|
-
cred = credential.CVMRoleCredential()
|
755
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
756
|
-
cred = credential.STSAssumeRoleCredential(
|
757
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
758
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
759
|
-
)
|
760
|
-
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):
|
761
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
762
|
-
else:
|
763
|
-
cred = credential.Credential(
|
764
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
765
|
-
)
|
766
|
-
http_profile = HttpProfile(
|
767
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
768
|
-
reqMethod="POST",
|
769
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
770
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
771
|
-
)
|
772
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
773
|
-
if g_param[OptionsDefine.Language]:
|
774
|
-
profile.language = g_param[OptionsDefine.Language]
|
775
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
776
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
777
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
778
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
779
|
-
model = models.DescribeWorkspaceEnvListRequest()
|
780
|
-
model.from_json_string(json.dumps(args))
|
781
|
-
start_time = time.time()
|
782
|
-
while True:
|
783
|
-
rsp = client.DescribeWorkspaceEnvList(model)
|
784
|
-
result = rsp.to_json_string()
|
785
|
-
try:
|
786
|
-
json_obj = json.loads(result)
|
787
|
-
except TypeError as e:
|
788
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
789
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
790
|
-
break
|
791
|
-
cur_time = time.time()
|
792
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
793
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
794
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
795
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
796
|
-
else:
|
797
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
798
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
799
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
800
|
-
|
801
|
-
|
802
|
-
def doCreateWorkspaceTemporaryToken(args, parsed_globals):
|
803
|
-
g_param = parse_global_arg(parsed_globals)
|
804
|
-
|
805
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
806
|
-
cred = credential.CVMRoleCredential()
|
807
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
808
|
-
cred = credential.STSAssumeRoleCredential(
|
809
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
810
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
811
|
-
)
|
812
|
-
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):
|
813
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
814
|
-
else:
|
815
|
-
cred = credential.Credential(
|
816
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
817
|
-
)
|
818
|
-
http_profile = HttpProfile(
|
819
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
820
|
-
reqMethod="POST",
|
821
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
822
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
823
|
-
)
|
824
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
825
|
-
if g_param[OptionsDefine.Language]:
|
826
|
-
profile.language = g_param[OptionsDefine.Language]
|
827
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
828
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
829
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
830
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
831
|
-
model = models.CreateWorkspaceTemporaryTokenRequest()
|
832
|
-
model.from_json_string(json.dumps(args))
|
833
|
-
start_time = time.time()
|
834
|
-
while True:
|
835
|
-
rsp = client.CreateWorkspaceTemporaryToken(model)
|
836
|
-
result = rsp.to_json_string()
|
837
|
-
try:
|
838
|
-
json_obj = json.loads(result)
|
839
|
-
except TypeError as e:
|
840
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
841
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
842
|
-
break
|
843
|
-
cur_time = time.time()
|
844
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
845
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
846
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
847
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
848
|
-
else:
|
849
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
850
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
851
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
852
|
-
|
853
|
-
|
854
|
-
def doDescribeWorkspaceNameExist(args, parsed_globals):
|
855
|
-
g_param = parse_global_arg(parsed_globals)
|
856
|
-
|
857
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
858
|
-
cred = credential.CVMRoleCredential()
|
859
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
860
|
-
cred = credential.STSAssumeRoleCredential(
|
861
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
862
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
863
|
-
)
|
864
|
-
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):
|
865
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
866
|
-
else:
|
867
|
-
cred = credential.Credential(
|
868
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
869
|
-
)
|
870
|
-
http_profile = HttpProfile(
|
871
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
872
|
-
reqMethod="POST",
|
873
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
874
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
875
|
-
)
|
876
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
877
|
-
if g_param[OptionsDefine.Language]:
|
878
|
-
profile.language = g_param[OptionsDefine.Language]
|
879
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
880
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
881
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
882
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
883
|
-
model = models.DescribeWorkspaceNameExistRequest()
|
884
|
-
model.from_json_string(json.dumps(args))
|
885
|
-
start_time = time.time()
|
886
|
-
while True:
|
887
|
-
rsp = client.DescribeWorkspaceNameExist(model)
|
888
|
-
result = rsp.to_json_string()
|
889
|
-
try:
|
890
|
-
json_obj = json.loads(result)
|
891
|
-
except TypeError as e:
|
892
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
893
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
894
|
-
break
|
895
|
-
cur_time = time.time()
|
896
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
897
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
898
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
899
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
900
|
-
else:
|
901
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
902
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
903
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
904
|
-
|
905
|
-
|
906
|
-
def doDeleteCustomizeTemplatesById(args, parsed_globals):
|
907
|
-
g_param = parse_global_arg(parsed_globals)
|
908
|
-
|
909
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
910
|
-
cred = credential.CVMRoleCredential()
|
911
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
912
|
-
cred = credential.STSAssumeRoleCredential(
|
913
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
914
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
915
|
-
)
|
916
|
-
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):
|
917
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
918
|
-
else:
|
919
|
-
cred = credential.Credential(
|
920
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
921
|
-
)
|
922
|
-
http_profile = HttpProfile(
|
923
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
924
|
-
reqMethod="POST",
|
925
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
926
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
927
|
-
)
|
928
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
929
|
-
if g_param[OptionsDefine.Language]:
|
930
|
-
profile.language = g_param[OptionsDefine.Language]
|
931
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
932
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
933
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
934
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
935
|
-
model = models.DeleteCustomizeTemplatesByIdRequest()
|
936
|
-
model.from_json_string(json.dumps(args))
|
937
|
-
start_time = time.time()
|
938
|
-
while True:
|
939
|
-
rsp = client.DeleteCustomizeTemplatesById(model)
|
940
|
-
result = rsp.to_json_string()
|
941
|
-
try:
|
942
|
-
json_obj = json.loads(result)
|
943
|
-
except TypeError as e:
|
944
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
945
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
946
|
-
break
|
947
|
-
cur_time = time.time()
|
948
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
949
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
950
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
951
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
952
|
-
else:
|
953
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
954
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
955
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
956
|
-
|
957
|
-
|
958
|
-
def doStopWorkspace(args, parsed_globals):
|
959
|
-
g_param = parse_global_arg(parsed_globals)
|
960
|
-
|
961
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
962
|
-
cred = credential.CVMRoleCredential()
|
963
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
964
|
-
cred = credential.STSAssumeRoleCredential(
|
965
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
966
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
|
967
|
-
)
|
968
|
-
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):
|
969
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
970
|
-
else:
|
971
|
-
cred = credential.Credential(
|
972
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
973
|
-
)
|
974
|
-
http_profile = HttpProfile(
|
975
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
976
|
-
reqMethod="POST",
|
977
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
978
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
979
|
-
)
|
980
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
981
|
-
if g_param[OptionsDefine.Language]:
|
982
|
-
profile.language = g_param[OptionsDefine.Language]
|
983
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
984
|
-
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
985
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
986
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
987
|
-
model = models.StopWorkspaceRequest()
|
988
|
-
model.from_json_string(json.dumps(args))
|
989
|
-
start_time = time.time()
|
990
|
-
while True:
|
991
|
-
rsp = client.StopWorkspace(model)
|
992
|
-
result = rsp.to_json_string()
|
993
|
-
try:
|
994
|
-
json_obj = json.loads(result)
|
995
|
-
except TypeError as e:
|
996
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
997
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
998
|
-
break
|
999
|
-
cur_time = time.time()
|
1000
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
1001
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
1002
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
1003
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
1004
|
-
else:
|
1005
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
1006
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
1007
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1008
|
-
|
1009
|
-
|
1010
|
-
def doDescribeWorkspaceStatus(args, parsed_globals):
|
20
|
+
def doDescribeConfig(args, parsed_globals):
|
1011
21
|
g_param = parse_global_arg(parsed_globals)
|
1012
22
|
|
1013
23
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -1036,11 +46,11 @@ def doDescribeWorkspaceStatus(args, parsed_globals):
|
|
1036
46
|
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
1037
47
|
client._sdkVersion += ("_CLI_" + __version__)
|
1038
48
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1039
|
-
model = models.
|
49
|
+
model = models.DescribeConfigRequest()
|
1040
50
|
model.from_json_string(json.dumps(args))
|
1041
51
|
start_time = time.time()
|
1042
52
|
while True:
|
1043
|
-
rsp = client.
|
53
|
+
rsp = client.DescribeConfig(model)
|
1044
54
|
result = rsp.to_json_string()
|
1045
55
|
try:
|
1046
56
|
json_obj = json.loads(result)
|
@@ -1059,7 +69,7 @@ def doDescribeWorkspaceStatus(args, parsed_globals):
|
|
1059
69
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1060
70
|
|
1061
71
|
|
1062
|
-
def
|
72
|
+
def doModifyWorkspace(args, parsed_globals):
|
1063
73
|
g_param = parse_global_arg(parsed_globals)
|
1064
74
|
|
1065
75
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -1088,11 +98,11 @@ def doCreateWorkspaceByAgent(args, parsed_globals):
|
|
1088
98
|
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
1089
99
|
client._sdkVersion += ("_CLI_" + __version__)
|
1090
100
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1091
|
-
model = models.
|
101
|
+
model = models.ModifyWorkspaceRequest()
|
1092
102
|
model.from_json_string(json.dumps(args))
|
1093
103
|
start_time = time.time()
|
1094
104
|
while True:
|
1095
|
-
rsp = client.
|
105
|
+
rsp = client.ModifyWorkspace(model)
|
1096
106
|
result = rsp.to_json_string()
|
1097
107
|
try:
|
1098
108
|
json_obj = json.loads(result)
|
@@ -1111,7 +121,7 @@ def doCreateWorkspaceByAgent(args, parsed_globals):
|
|
1111
121
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1112
122
|
|
1113
123
|
|
1114
|
-
def
|
124
|
+
def doDescribeWorkspaces(args, parsed_globals):
|
1115
125
|
g_param = parse_global_arg(parsed_globals)
|
1116
126
|
|
1117
127
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -1140,11 +150,11 @@ def doCreateCustomizeTemplates(args, parsed_globals):
|
|
1140
150
|
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
1141
151
|
client._sdkVersion += ("_CLI_" + __version__)
|
1142
152
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1143
|
-
model = models.
|
153
|
+
model = models.DescribeWorkspacesRequest()
|
1144
154
|
model.from_json_string(json.dumps(args))
|
1145
155
|
start_time = time.time()
|
1146
156
|
while True:
|
1147
|
-
rsp = client.
|
157
|
+
rsp = client.DescribeWorkspaces(model)
|
1148
158
|
result = rsp.to_json_string()
|
1149
159
|
try:
|
1150
160
|
json_obj = json.loads(result)
|
@@ -1163,7 +173,7 @@ def doCreateCustomizeTemplates(args, parsed_globals):
|
|
1163
173
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1164
174
|
|
1165
175
|
|
1166
|
-
def
|
176
|
+
def doDescribeImages(args, parsed_globals):
|
1167
177
|
g_param = parse_global_arg(parsed_globals)
|
1168
178
|
|
1169
179
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -1192,11 +202,11 @@ def doModifyCustomizeTemplatesFullById(args, parsed_globals):
|
|
1192
202
|
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
1193
203
|
client._sdkVersion += ("_CLI_" + __version__)
|
1194
204
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1195
|
-
model = models.
|
205
|
+
model = models.DescribeImagesRequest()
|
1196
206
|
model.from_json_string(json.dumps(args))
|
1197
207
|
start_time = time.time()
|
1198
208
|
while True:
|
1199
|
-
rsp = client.
|
209
|
+
rsp = client.DescribeImages(model)
|
1200
210
|
result = rsp.to_json_string()
|
1201
211
|
try:
|
1202
212
|
json_obj = json.loads(result)
|
@@ -1215,7 +225,7 @@ def doModifyCustomizeTemplatesFullById(args, parsed_globals):
|
|
1215
225
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1216
226
|
|
1217
227
|
|
1218
|
-
def
|
228
|
+
def doCreateWorkspace(args, parsed_globals):
|
1219
229
|
g_param = parse_global_arg(parsed_globals)
|
1220
230
|
|
1221
231
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -1244,11 +254,11 @@ def doCreateWorkspaceByTemplate(args, parsed_globals):
|
|
1244
254
|
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
1245
255
|
client._sdkVersion += ("_CLI_" + __version__)
|
1246
256
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1247
|
-
model = models.
|
257
|
+
model = models.CreateWorkspaceRequest()
|
1248
258
|
model.from_json_string(json.dumps(args))
|
1249
259
|
start_time = time.time()
|
1250
260
|
while True:
|
1251
|
-
rsp = client.
|
261
|
+
rsp = client.CreateWorkspace(model)
|
1252
262
|
result = rsp.to_json_string()
|
1253
263
|
try:
|
1254
264
|
json_obj = json.loads(result)
|
@@ -1267,7 +277,7 @@ def doCreateWorkspaceByTemplate(args, parsed_globals):
|
|
1267
277
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1268
278
|
|
1269
279
|
|
1270
|
-
def
|
280
|
+
def doCreateWorkspaceToken(args, parsed_globals):
|
1271
281
|
g_param = parse_global_arg(parsed_globals)
|
1272
282
|
|
1273
283
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -1296,11 +306,11 @@ def doDescribeWorkspaceStatusList(args, parsed_globals):
|
|
1296
306
|
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
1297
307
|
client._sdkVersion += ("_CLI_" + __version__)
|
1298
308
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1299
|
-
model = models.
|
309
|
+
model = models.CreateWorkspaceTokenRequest()
|
1300
310
|
model.from_json_string(json.dumps(args))
|
1301
311
|
start_time = time.time()
|
1302
312
|
while True:
|
1303
|
-
rsp = client.
|
313
|
+
rsp = client.CreateWorkspaceToken(model)
|
1304
314
|
result = rsp.to_json_string()
|
1305
315
|
try:
|
1306
316
|
json_obj = json.loads(result)
|
@@ -1319,7 +329,7 @@ def doDescribeWorkspaceStatusList(args, parsed_globals):
|
|
1319
329
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1320
330
|
|
1321
331
|
|
1322
|
-
def
|
332
|
+
def doRemoveWorkspace(args, parsed_globals):
|
1323
333
|
g_param = parse_global_arg(parsed_globals)
|
1324
334
|
|
1325
335
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -1348,11 +358,11 @@ def doDescribeImages(args, parsed_globals):
|
|
1348
358
|
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
1349
359
|
client._sdkVersion += ("_CLI_" + __version__)
|
1350
360
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1351
|
-
model = models.
|
361
|
+
model = models.RemoveWorkspaceRequest()
|
1352
362
|
model.from_json_string(json.dumps(args))
|
1353
363
|
start_time = time.time()
|
1354
364
|
while True:
|
1355
|
-
rsp = client.
|
365
|
+
rsp = client.RemoveWorkspace(model)
|
1356
366
|
result = rsp.to_json_string()
|
1357
367
|
try:
|
1358
368
|
json_obj = json.loads(result)
|
@@ -1371,7 +381,7 @@ def doDescribeImages(args, parsed_globals):
|
|
1371
381
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1372
382
|
|
1373
383
|
|
1374
|
-
def
|
384
|
+
def doStopWorkspace(args, parsed_globals):
|
1375
385
|
g_param = parse_global_arg(parsed_globals)
|
1376
386
|
|
1377
387
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -1400,11 +410,11 @@ def doDescribeCustomizeTemplatesPresets(args, parsed_globals):
|
|
1400
410
|
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
1401
411
|
client._sdkVersion += ("_CLI_" + __version__)
|
1402
412
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1403
|
-
model = models.
|
413
|
+
model = models.StopWorkspaceRequest()
|
1404
414
|
model.from_json_string(json.dumps(args))
|
1405
415
|
start_time = time.time()
|
1406
416
|
while True:
|
1407
|
-
rsp = client.
|
417
|
+
rsp = client.StopWorkspace(model)
|
1408
418
|
result = rsp.to_json_string()
|
1409
419
|
try:
|
1410
420
|
json_obj = json.loads(result)
|
@@ -1423,7 +433,7 @@ def doDescribeCustomizeTemplatesPresets(args, parsed_globals):
|
|
1423
433
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1424
434
|
|
1425
435
|
|
1426
|
-
def
|
436
|
+
def doRunWorkspace(args, parsed_globals):
|
1427
437
|
g_param = parse_global_arg(parsed_globals)
|
1428
438
|
|
1429
439
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -1452,11 +462,11 @@ def doModifyWorkspaceAttributes(args, parsed_globals):
|
|
1452
462
|
client = mod.CloudstudioClient(cred, g_param[OptionsDefine.Region], profile)
|
1453
463
|
client._sdkVersion += ("_CLI_" + __version__)
|
1454
464
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1455
|
-
model = models.
|
465
|
+
model = models.RunWorkspaceRequest()
|
1456
466
|
model.from_json_string(json.dumps(args))
|
1457
467
|
start_time = time.time()
|
1458
468
|
while True:
|
1459
|
-
rsp = client.
|
469
|
+
rsp = client.RunWorkspace(model)
|
1460
470
|
result = rsp.to_json_string()
|
1461
471
|
try:
|
1462
472
|
json_obj = json.loads(result)
|
@@ -1477,51 +487,29 @@ def doModifyWorkspaceAttributes(args, parsed_globals):
|
|
1477
487
|
|
1478
488
|
CLIENT_MAP = {
|
1479
489
|
"v20230508": cloudstudio_client_v20230508,
|
1480
|
-
"v20210524": cloudstudio_client_v20210524,
|
1481
490
|
|
1482
491
|
}
|
1483
492
|
|
1484
493
|
MODELS_MAP = {
|
1485
494
|
"v20230508": models_v20230508,
|
1486
|
-
"v20210524": models_v20210524,
|
1487
495
|
|
1488
496
|
}
|
1489
497
|
|
1490
498
|
ACTION_MAP = {
|
1491
|
-
"DescribeCustomizeTemplatesById": doDescribeCustomizeTemplatesById,
|
1492
499
|
"DescribeConfig": doDescribeConfig,
|
1493
500
|
"ModifyWorkspace": doModifyWorkspace,
|
1494
|
-
"ModifyCustomizeTemplatesPartById": doModifyCustomizeTemplatesPartById,
|
1495
|
-
"CreateWorkspaceToken": doCreateWorkspaceToken,
|
1496
|
-
"DescribeWorkspaceIsReady": doDescribeWorkspaceIsReady,
|
1497
|
-
"RunWorkspace": doRunWorkspace,
|
1498
|
-
"DescribeCustomizeTemplates": doDescribeCustomizeTemplates,
|
1499
|
-
"RecoverWorkspace": doRecoverWorkspace,
|
1500
|
-
"CreateWorkspaceByVersionControl": doCreateWorkspaceByVersionControl,
|
1501
|
-
"ModifyCustomizeTemplateVersionControl": doModifyCustomizeTemplateVersionControl,
|
1502
501
|
"DescribeWorkspaces": doDescribeWorkspaces,
|
502
|
+
"DescribeImages": doDescribeImages,
|
1503
503
|
"CreateWorkspace": doCreateWorkspace,
|
504
|
+
"CreateWorkspaceToken": doCreateWorkspaceToken,
|
1504
505
|
"RemoveWorkspace": doRemoveWorkspace,
|
1505
|
-
"DescribeWorkspaceEnvList": doDescribeWorkspaceEnvList,
|
1506
|
-
"CreateWorkspaceTemporaryToken": doCreateWorkspaceTemporaryToken,
|
1507
|
-
"DescribeWorkspaceNameExist": doDescribeWorkspaceNameExist,
|
1508
|
-
"DeleteCustomizeTemplatesById": doDeleteCustomizeTemplatesById,
|
1509
506
|
"StopWorkspace": doStopWorkspace,
|
1510
|
-
"
|
1511
|
-
"CreateWorkspaceByAgent": doCreateWorkspaceByAgent,
|
1512
|
-
"CreateCustomizeTemplates": doCreateCustomizeTemplates,
|
1513
|
-
"ModifyCustomizeTemplatesFullById": doModifyCustomizeTemplatesFullById,
|
1514
|
-
"CreateWorkspaceByTemplate": doCreateWorkspaceByTemplate,
|
1515
|
-
"DescribeWorkspaceStatusList": doDescribeWorkspaceStatusList,
|
1516
|
-
"DescribeImages": doDescribeImages,
|
1517
|
-
"DescribeCustomizeTemplatesPresets": doDescribeCustomizeTemplatesPresets,
|
1518
|
-
"ModifyWorkspaceAttributes": doModifyWorkspaceAttributes,
|
507
|
+
"RunWorkspace": doRunWorkspace,
|
1519
508
|
|
1520
509
|
}
|
1521
510
|
|
1522
511
|
AVAILABLE_VERSION_LIST = [
|
1523
512
|
"v20230508",
|
1524
|
-
"v20210524",
|
1525
513
|
|
1526
514
|
]
|
1527
515
|
|