tccli-intl-en 3.1.6.1__py2.py3-none-any.whl → 3.1.7.1__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
tccli/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '3.1.6.1'
1
+ __version__ = '3.1.7.1'
@@ -313,6 +313,9 @@ SERVICE_VERSIONS = {
313
313
  "ses": [
314
314
  "2020-10-02"
315
315
  ],
316
+ "smh": [
317
+ "2021-07-12"
318
+ ],
316
319
  "sms": [
317
320
  "2021-01-11",
318
321
  "2019-07-11"
@@ -17,6 +17,171 @@ from tencentcloud.controlcenter.v20230110 import models as models_v20230110
17
17
  from jmespath import search
18
18
  import time
19
19
 
20
+ def doListDeployStepTasks(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) \
31
+ and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
32
+ and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
33
+ and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
34
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
35
+ else:
36
+ cred = credential.Credential(
37
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
38
+ )
39
+ http_profile = HttpProfile(
40
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
41
+ reqMethod="POST",
42
+ endpoint=g_param[OptionsDefine.Endpoint],
43
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
44
+ )
45
+ profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
46
+ if g_param[OptionsDefine.Language]:
47
+ profile.language = g_param[OptionsDefine.Language]
48
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
49
+ client = mod.ControlcenterClient(cred, g_param[OptionsDefine.Region], profile)
50
+ client._sdkVersion += ("_CLI_" + __version__)
51
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
52
+ model = models.ListDeployStepTasksRequest()
53
+ model.from_json_string(json.dumps(args))
54
+ start_time = time.time()
55
+ while True:
56
+ rsp = client.ListDeployStepTasks(model)
57
+ result = rsp.to_json_string()
58
+ try:
59
+ json_obj = json.loads(result)
60
+ except TypeError as e:
61
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
62
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
63
+ break
64
+ cur_time = time.time()
65
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
66
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
67
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
68
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
69
+ else:
70
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
71
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
72
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
73
+
74
+
75
+ def doGetAccountFactoryBaseline(args, parsed_globals):
76
+ g_param = parse_global_arg(parsed_globals)
77
+
78
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
79
+ cred = credential.CVMRoleCredential()
80
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
81
+ cred = credential.STSAssumeRoleCredential(
82
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
83
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
84
+ )
85
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
86
+ and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
87
+ and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
88
+ and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
89
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
90
+ else:
91
+ cred = credential.Credential(
92
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
93
+ )
94
+ http_profile = HttpProfile(
95
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
96
+ reqMethod="POST",
97
+ endpoint=g_param[OptionsDefine.Endpoint],
98
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
99
+ )
100
+ profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
101
+ if g_param[OptionsDefine.Language]:
102
+ profile.language = g_param[OptionsDefine.Language]
103
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
104
+ client = mod.ControlcenterClient(cred, g_param[OptionsDefine.Region], profile)
105
+ client._sdkVersion += ("_CLI_" + __version__)
106
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
107
+ model = models.GetAccountFactoryBaselineRequest()
108
+ model.from_json_string(json.dumps(args))
109
+ start_time = time.time()
110
+ while True:
111
+ rsp = client.GetAccountFactoryBaseline(model)
112
+ result = rsp.to_json_string()
113
+ try:
114
+ json_obj = json.loads(result)
115
+ except TypeError as e:
116
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
117
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
118
+ break
119
+ cur_time = time.time()
120
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
121
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
122
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
123
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
124
+ else:
125
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
126
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
127
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
128
+
129
+
130
+ def doListAccountFactoryBaselineItems(args, parsed_globals):
131
+ g_param = parse_global_arg(parsed_globals)
132
+
133
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
134
+ cred = credential.CVMRoleCredential()
135
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
136
+ cred = credential.STSAssumeRoleCredential(
137
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
138
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
139
+ )
140
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
141
+ and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
142
+ and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
143
+ and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
144
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
145
+ else:
146
+ cred = credential.Credential(
147
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
148
+ )
149
+ http_profile = HttpProfile(
150
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
151
+ reqMethod="POST",
152
+ endpoint=g_param[OptionsDefine.Endpoint],
153
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
154
+ )
155
+ profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
156
+ if g_param[OptionsDefine.Language]:
157
+ profile.language = g_param[OptionsDefine.Language]
158
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
159
+ client = mod.ControlcenterClient(cred, g_param[OptionsDefine.Region], profile)
160
+ client._sdkVersion += ("_CLI_" + __version__)
161
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
162
+ model = models.ListAccountFactoryBaselineItemsRequest()
163
+ model.from_json_string(json.dumps(args))
164
+ start_time = time.time()
165
+ while True:
166
+ rsp = client.ListAccountFactoryBaselineItems(model)
167
+ result = rsp.to_json_string()
168
+ try:
169
+ json_obj = json.loads(result)
170
+ except TypeError as e:
171
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
172
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
173
+ break
174
+ cur_time = time.time()
175
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
176
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
177
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
178
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
179
+ else:
180
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
181
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
182
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
183
+
184
+
20
185
  def doBatchApplyAccountBaselines(args, parsed_globals):
21
186
  g_param = parse_global_arg(parsed_globals)
22
187
 
@@ -72,6 +237,61 @@ def doBatchApplyAccountBaselines(args, parsed_globals):
72
237
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
73
238
 
74
239
 
240
+ def doUpdateAccountFactoryBaseline(args, parsed_globals):
241
+ g_param = parse_global_arg(parsed_globals)
242
+
243
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
244
+ cred = credential.CVMRoleCredential()
245
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
246
+ cred = credential.STSAssumeRoleCredential(
247
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
248
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
249
+ )
250
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
251
+ and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
252
+ and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
253
+ and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
254
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
255
+ else:
256
+ cred = credential.Credential(
257
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
258
+ )
259
+ http_profile = HttpProfile(
260
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
261
+ reqMethod="POST",
262
+ endpoint=g_param[OptionsDefine.Endpoint],
263
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
264
+ )
265
+ profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
266
+ if g_param[OptionsDefine.Language]:
267
+ profile.language = g_param[OptionsDefine.Language]
268
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
269
+ client = mod.ControlcenterClient(cred, g_param[OptionsDefine.Region], profile)
270
+ client._sdkVersion += ("_CLI_" + __version__)
271
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
272
+ model = models.UpdateAccountFactoryBaselineRequest()
273
+ model.from_json_string(json.dumps(args))
274
+ start_time = time.time()
275
+ while True:
276
+ rsp = client.UpdateAccountFactoryBaseline(model)
277
+ result = rsp.to_json_string()
278
+ try:
279
+ json_obj = json.loads(result)
280
+ except TypeError as e:
281
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
282
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
283
+ break
284
+ cur_time = time.time()
285
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
286
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
287
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
288
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
289
+ else:
290
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
291
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
292
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
293
+
294
+
75
295
  CLIENT_MAP = {
76
296
  "v20230110": controlcenter_client_v20230110,
77
297
 
@@ -83,7 +303,11 @@ MODELS_MAP = {
83
303
  }
84
304
 
85
305
  ACTION_MAP = {
306
+ "ListDeployStepTasks": doListDeployStepTasks,
307
+ "GetAccountFactoryBaseline": doGetAccountFactoryBaseline,
308
+ "ListAccountFactoryBaselineItems": doListAccountFactoryBaselineItems,
86
309
  "BatchApplyAccountBaselines": doBatchApplyAccountBaselines,
310
+ "UpdateAccountFactoryBaseline": doUpdateAccountFactoryBaseline,
87
311
 
88
312
  }
89
313