tencentcloud-sdk-kms 1.0.200

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1214 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require 'json'
18
+
19
+ module TencentCloud
20
+ module Kms
21
+ module V20190118
22
+ class Client < TencentCloud::Common::AbstractClient
23
+
24
+ def initialize(credential, region, profile = nil)
25
+ api_version = '2019-01-18'
26
+ api_endpoint = 'kms.tencentcloudapi.com'
27
+ sdk_version = 'KMS_' + File.read(File.expand_path('../VERSION', __dir__)).strip
28
+ super(credential, region, api_version, api_endpoint, sdk_version, profile)
29
+ end
30
+
31
+
32
+ # 对密钥进行归档,被归档的密钥只能用于解密,不能加密
33
+
34
+ # @param request: Request instance for ArchiveKey.
35
+ # @type request: :class:`Tencentcloud::kms::V20190118::ArchiveKeyRequest`
36
+ # @rtype: :class:`Tencentcloud::kms::V20190118::ArchiveKeyResponse`
37
+ def ArchiveKey(request)
38
+ body = send_request('ArchiveKey', request.serialize)
39
+ response = JSON.parse(body)
40
+ if response['Response'].key?('Error') == false
41
+ model = ArchiveKeyResponse.new
42
+ model.deserialize(response['Response'])
43
+ model
44
+ else
45
+ code = response['Response']['Error']['Code']
46
+ message = response['Response']['Error']['Message']
47
+ reqid = response['Response']['RequestId']
48
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
49
+ end
50
+ rescue TencentCloud::Common::TencentCloudSDKException => e
51
+ raise e
52
+ rescue StandardError => e
53
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
54
+ end
55
+
56
+ # 使用指定的RSA非对称密钥的私钥进行数据解密,密文必须是使用对应公钥加密的。处于Enabled 状态的非对称密钥才能进行解密操作。
57
+
58
+ # @param request: Request instance for AsymmetricRsaDecrypt.
59
+ # @type request: :class:`Tencentcloud::kms::V20190118::AsymmetricRsaDecryptRequest`
60
+ # @rtype: :class:`Tencentcloud::kms::V20190118::AsymmetricRsaDecryptResponse`
61
+ def AsymmetricRsaDecrypt(request)
62
+ body = send_request('AsymmetricRsaDecrypt', request.serialize)
63
+ response = JSON.parse(body)
64
+ if response['Response'].key?('Error') == false
65
+ model = AsymmetricRsaDecryptResponse.new
66
+ model.deserialize(response['Response'])
67
+ model
68
+ else
69
+ code = response['Response']['Error']['Code']
70
+ message = response['Response']['Error']['Message']
71
+ reqid = response['Response']['RequestId']
72
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
73
+ end
74
+ rescue TencentCloud::Common::TencentCloudSDKException => e
75
+ raise e
76
+ rescue StandardError => e
77
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
78
+ end
79
+
80
+ # 使用指定的SM2非对称密钥的私钥进行数据解密,密文必须是使用对应公钥加密的。处于Enabled 状态的非对称密钥才能进行解密操作。传入的密文的长度不能超过256字节。
81
+
82
+ # @param request: Request instance for AsymmetricSm2Decrypt.
83
+ # @type request: :class:`Tencentcloud::kms::V20190118::AsymmetricSm2DecryptRequest`
84
+ # @rtype: :class:`Tencentcloud::kms::V20190118::AsymmetricSm2DecryptResponse`
85
+ def AsymmetricSm2Decrypt(request)
86
+ body = send_request('AsymmetricSm2Decrypt', request.serialize)
87
+ response = JSON.parse(body)
88
+ if response['Response'].key?('Error') == false
89
+ model = AsymmetricSm2DecryptResponse.new
90
+ model.deserialize(response['Response'])
91
+ model
92
+ else
93
+ code = response['Response']['Error']['Code']
94
+ message = response['Response']['Error']['Message']
95
+ reqid = response['Response']['RequestId']
96
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
97
+ end
98
+ rescue TencentCloud::Common::TencentCloudSDKException => e
99
+ raise e
100
+ rescue StandardError => e
101
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
102
+ end
103
+
104
+ # 记录当前key被哪个云产品的那个资源所使用。如果当前key设置了自动过期,则取消该设置,确保当前key不会自动失效。如果当前关联关系已经创建,也返回成功。
105
+
106
+ # @param request: Request instance for BindCloudResource.
107
+ # @type request: :class:`Tencentcloud::kms::V20190118::BindCloudResourceRequest`
108
+ # @rtype: :class:`Tencentcloud::kms::V20190118::BindCloudResourceResponse`
109
+ def BindCloudResource(request)
110
+ body = send_request('BindCloudResource', request.serialize)
111
+ response = JSON.parse(body)
112
+ if response['Response'].key?('Error') == false
113
+ model = BindCloudResourceResponse.new
114
+ model.deserialize(response['Response'])
115
+ model
116
+ else
117
+ code = response['Response']['Error']['Code']
118
+ message = response['Response']['Error']['Message']
119
+ reqid = response['Response']['RequestId']
120
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
121
+ end
122
+ rescue TencentCloud::Common::TencentCloudSDKException => e
123
+ raise e
124
+ rescue StandardError => e
125
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
126
+ end
127
+
128
+ # 取消密钥归档,取消后密钥的状态变为Enabled。
129
+
130
+ # @param request: Request instance for CancelKeyArchive.
131
+ # @type request: :class:`Tencentcloud::kms::V20190118::CancelKeyArchiveRequest`
132
+ # @rtype: :class:`Tencentcloud::kms::V20190118::CancelKeyArchiveResponse`
133
+ def CancelKeyArchive(request)
134
+ body = send_request('CancelKeyArchive', request.serialize)
135
+ response = JSON.parse(body)
136
+ if response['Response'].key?('Error') == false
137
+ model = CancelKeyArchiveResponse.new
138
+ model.deserialize(response['Response'])
139
+ model
140
+ else
141
+ code = response['Response']['Error']['Code']
142
+ message = response['Response']['Error']['Message']
143
+ reqid = response['Response']['RequestId']
144
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
145
+ end
146
+ rescue TencentCloud::Common::TencentCloudSDKException => e
147
+ raise e
148
+ rescue StandardError => e
149
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
150
+ end
151
+
152
+ # 取消CMK的计划删除操作
153
+
154
+ # @param request: Request instance for CancelKeyDeletion.
155
+ # @type request: :class:`Tencentcloud::kms::V20190118::CancelKeyDeletionRequest`
156
+ # @rtype: :class:`Tencentcloud::kms::V20190118::CancelKeyDeletionResponse`
157
+ def CancelKeyDeletion(request)
158
+ body = send_request('CancelKeyDeletion', request.serialize)
159
+ response = JSON.parse(body)
160
+ if response['Response'].key?('Error') == false
161
+ model = CancelKeyDeletionResponse.new
162
+ model.deserialize(response['Response'])
163
+ model
164
+ else
165
+ code = response['Response']['Error']['Code']
166
+ message = response['Response']['Error']['Message']
167
+ reqid = response['Response']['RequestId']
168
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
169
+ end
170
+ rescue TencentCloud::Common::TencentCloudSDKException => e
171
+ raise e
172
+ rescue StandardError => e
173
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
174
+ end
175
+
176
+ # 创建用户管理数据密钥的主密钥CMK(Custom Master Key)。
177
+
178
+ # @param request: Request instance for CreateKey.
179
+ # @type request: :class:`Tencentcloud::kms::V20190118::CreateKeyRequest`
180
+ # @rtype: :class:`Tencentcloud::kms::V20190118::CreateKeyResponse`
181
+ def CreateKey(request)
182
+ body = send_request('CreateKey', request.serialize)
183
+ response = JSON.parse(body)
184
+ if response['Response'].key?('Error') == false
185
+ model = CreateKeyResponse.new
186
+ model.deserialize(response['Response'])
187
+ model
188
+ else
189
+ code = response['Response']['Error']['Code']
190
+ message = response['Response']['Error']['Message']
191
+ reqid = response['Response']['RequestId']
192
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
193
+ end
194
+ rescue TencentCloud::Common::TencentCloudSDKException => e
195
+ raise e
196
+ rescue StandardError => e
197
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
198
+ end
199
+
200
+ # 创建白盒密钥。 密钥个数的上限为 50。
201
+
202
+ # @param request: Request instance for CreateWhiteBoxKey.
203
+ # @type request: :class:`Tencentcloud::kms::V20190118::CreateWhiteBoxKeyRequest`
204
+ # @rtype: :class:`Tencentcloud::kms::V20190118::CreateWhiteBoxKeyResponse`
205
+ def CreateWhiteBoxKey(request)
206
+ body = send_request('CreateWhiteBoxKey', request.serialize)
207
+ response = JSON.parse(body)
208
+ if response['Response'].key?('Error') == false
209
+ model = CreateWhiteBoxKeyResponse.new
210
+ model.deserialize(response['Response'])
211
+ model
212
+ else
213
+ code = response['Response']['Error']['Code']
214
+ message = response['Response']['Error']['Message']
215
+ reqid = response['Response']['RequestId']
216
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
217
+ end
218
+ rescue TencentCloud::Common::TencentCloudSDKException => e
219
+ raise e
220
+ rescue StandardError => e
221
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
222
+ end
223
+
224
+ # 本接口用于解密密文,得到明文数据。
225
+
226
+ # @param request: Request instance for Decrypt.
227
+ # @type request: :class:`Tencentcloud::kms::V20190118::DecryptRequest`
228
+ # @rtype: :class:`Tencentcloud::kms::V20190118::DecryptResponse`
229
+ def Decrypt(request)
230
+ body = send_request('Decrypt', request.serialize)
231
+ response = JSON.parse(body)
232
+ if response['Response'].key?('Error') == false
233
+ model = DecryptResponse.new
234
+ model.deserialize(response['Response'])
235
+ model
236
+ else
237
+ code = response['Response']['Error']['Code']
238
+ message = response['Response']['Error']['Message']
239
+ reqid = response['Response']['RequestId']
240
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
241
+ end
242
+ rescue TencentCloud::Common::TencentCloudSDKException => e
243
+ raise e
244
+ rescue StandardError => e
245
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
246
+ end
247
+
248
+ # 用于删除导入的密钥材料,仅对EXTERNAL类型的CMK有效,该接口将CMK设置为PendingImport 状态,并不会删除CMK,在重新进行密钥导入后可继续使用。彻底删除CMK请使用 ScheduleKeyDeletion 接口。
249
+
250
+ # @param request: Request instance for DeleteImportedKeyMaterial.
251
+ # @type request: :class:`Tencentcloud::kms::V20190118::DeleteImportedKeyMaterialRequest`
252
+ # @rtype: :class:`Tencentcloud::kms::V20190118::DeleteImportedKeyMaterialResponse`
253
+ def DeleteImportedKeyMaterial(request)
254
+ body = send_request('DeleteImportedKeyMaterial', request.serialize)
255
+ response = JSON.parse(body)
256
+ if response['Response'].key?('Error') == false
257
+ model = DeleteImportedKeyMaterialResponse.new
258
+ model.deserialize(response['Response'])
259
+ model
260
+ else
261
+ code = response['Response']['Error']['Code']
262
+ message = response['Response']['Error']['Message']
263
+ reqid = response['Response']['RequestId']
264
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
265
+ end
266
+ rescue TencentCloud::Common::TencentCloudSDKException => e
267
+ raise e
268
+ rescue StandardError => e
269
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
270
+ end
271
+
272
+ # 删除白盒密钥, 注意:必须先禁用后,才可以删除。
273
+
274
+ # @param request: Request instance for DeleteWhiteBoxKey.
275
+ # @type request: :class:`Tencentcloud::kms::V20190118::DeleteWhiteBoxKeyRequest`
276
+ # @rtype: :class:`Tencentcloud::kms::V20190118::DeleteWhiteBoxKeyResponse`
277
+ def DeleteWhiteBoxKey(request)
278
+ body = send_request('DeleteWhiteBoxKey', request.serialize)
279
+ response = JSON.parse(body)
280
+ if response['Response'].key?('Error') == false
281
+ model = DeleteWhiteBoxKeyResponse.new
282
+ model.deserialize(response['Response'])
283
+ model
284
+ else
285
+ code = response['Response']['Error']['Code']
286
+ message = response['Response']['Error']['Message']
287
+ reqid = response['Response']['RequestId']
288
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
289
+ end
290
+ rescue TencentCloud::Common::TencentCloudSDKException => e
291
+ raise e
292
+ rescue StandardError => e
293
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
294
+ end
295
+
296
+ # 用于获取指定KeyId的主密钥属性详情信息。
297
+
298
+ # @param request: Request instance for DescribeKey.
299
+ # @type request: :class:`Tencentcloud::kms::V20190118::DescribeKeyRequest`
300
+ # @rtype: :class:`Tencentcloud::kms::V20190118::DescribeKeyResponse`
301
+ def DescribeKey(request)
302
+ body = send_request('DescribeKey', request.serialize)
303
+ response = JSON.parse(body)
304
+ if response['Response'].key?('Error') == false
305
+ model = DescribeKeyResponse.new
306
+ model.deserialize(response['Response'])
307
+ model
308
+ else
309
+ code = response['Response']['Error']['Code']
310
+ message = response['Response']['Error']['Message']
311
+ reqid = response['Response']['RequestId']
312
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
313
+ end
314
+ rescue TencentCloud::Common::TencentCloudSDKException => e
315
+ raise e
316
+ rescue StandardError => e
317
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
318
+ end
319
+
320
+ # 该接口用于批量获取主密钥属性信息。
321
+
322
+ # @param request: Request instance for DescribeKeys.
323
+ # @type request: :class:`Tencentcloud::kms::V20190118::DescribeKeysRequest`
324
+ # @rtype: :class:`Tencentcloud::kms::V20190118::DescribeKeysResponse`
325
+ def DescribeKeys(request)
326
+ body = send_request('DescribeKeys', request.serialize)
327
+ response = JSON.parse(body)
328
+ if response['Response'].key?('Error') == false
329
+ model = DescribeKeysResponse.new
330
+ model.deserialize(response['Response'])
331
+ model
332
+ else
333
+ code = response['Response']['Error']['Code']
334
+ message = response['Response']['Error']['Message']
335
+ reqid = response['Response']['RequestId']
336
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
337
+ end
338
+ rescue TencentCloud::Common::TencentCloudSDKException => e
339
+ raise e
340
+ rescue StandardError => e
341
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
342
+ end
343
+
344
+ # 获取白盒解密密钥
345
+
346
+ # @param request: Request instance for DescribeWhiteBoxDecryptKey.
347
+ # @type request: :class:`Tencentcloud::kms::V20190118::DescribeWhiteBoxDecryptKeyRequest`
348
+ # @rtype: :class:`Tencentcloud::kms::V20190118::DescribeWhiteBoxDecryptKeyResponse`
349
+ def DescribeWhiteBoxDecryptKey(request)
350
+ body = send_request('DescribeWhiteBoxDecryptKey', request.serialize)
351
+ response = JSON.parse(body)
352
+ if response['Response'].key?('Error') == false
353
+ model = DescribeWhiteBoxDecryptKeyResponse.new
354
+ model.deserialize(response['Response'])
355
+ model
356
+ else
357
+ code = response['Response']['Error']['Code']
358
+ message = response['Response']['Error']['Message']
359
+ reqid = response['Response']['RequestId']
360
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
361
+ end
362
+ rescue TencentCloud::Common::TencentCloudSDKException => e
363
+ raise e
364
+ rescue StandardError => e
365
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
366
+ end
367
+
368
+ # 获取指定密钥的设备指纹列表
369
+
370
+ # @param request: Request instance for DescribeWhiteBoxDeviceFingerprints.
371
+ # @type request: :class:`Tencentcloud::kms::V20190118::DescribeWhiteBoxDeviceFingerprintsRequest`
372
+ # @rtype: :class:`Tencentcloud::kms::V20190118::DescribeWhiteBoxDeviceFingerprintsResponse`
373
+ def DescribeWhiteBoxDeviceFingerprints(request)
374
+ body = send_request('DescribeWhiteBoxDeviceFingerprints', request.serialize)
375
+ response = JSON.parse(body)
376
+ if response['Response'].key?('Error') == false
377
+ model = DescribeWhiteBoxDeviceFingerprintsResponse.new
378
+ model.deserialize(response['Response'])
379
+ model
380
+ else
381
+ code = response['Response']['Error']['Code']
382
+ message = response['Response']['Error']['Message']
383
+ reqid = response['Response']['RequestId']
384
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
385
+ end
386
+ rescue TencentCloud::Common::TencentCloudSDKException => e
387
+ raise e
388
+ rescue StandardError => e
389
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
390
+ end
391
+
392
+ # 展示白盒密钥的信息
393
+
394
+ # @param request: Request instance for DescribeWhiteBoxKey.
395
+ # @type request: :class:`Tencentcloud::kms::V20190118::DescribeWhiteBoxKeyRequest`
396
+ # @rtype: :class:`Tencentcloud::kms::V20190118::DescribeWhiteBoxKeyResponse`
397
+ def DescribeWhiteBoxKey(request)
398
+ body = send_request('DescribeWhiteBoxKey', request.serialize)
399
+ response = JSON.parse(body)
400
+ if response['Response'].key?('Error') == false
401
+ model = DescribeWhiteBoxKeyResponse.new
402
+ model.deserialize(response['Response'])
403
+ model
404
+ else
405
+ code = response['Response']['Error']['Code']
406
+ message = response['Response']['Error']['Message']
407
+ reqid = response['Response']['RequestId']
408
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
409
+ end
410
+ rescue TencentCloud::Common::TencentCloudSDKException => e
411
+ raise e
412
+ rescue StandardError => e
413
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
414
+ end
415
+
416
+ # 获取白盒密钥列表
417
+
418
+ # @param request: Request instance for DescribeWhiteBoxKeyDetails.
419
+ # @type request: :class:`Tencentcloud::kms::V20190118::DescribeWhiteBoxKeyDetailsRequest`
420
+ # @rtype: :class:`Tencentcloud::kms::V20190118::DescribeWhiteBoxKeyDetailsResponse`
421
+ def DescribeWhiteBoxKeyDetails(request)
422
+ body = send_request('DescribeWhiteBoxKeyDetails', request.serialize)
423
+ response = JSON.parse(body)
424
+ if response['Response'].key?('Error') == false
425
+ model = DescribeWhiteBoxKeyDetailsResponse.new
426
+ model.deserialize(response['Response'])
427
+ model
428
+ else
429
+ code = response['Response']['Error']['Code']
430
+ message = response['Response']['Error']['Message']
431
+ reqid = response['Response']['RequestId']
432
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
433
+ end
434
+ rescue TencentCloud::Common::TencentCloudSDKException => e
435
+ raise e
436
+ rescue StandardError => e
437
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
438
+ end
439
+
440
+ # 获取白盒密钥服务状态
441
+
442
+ # @param request: Request instance for DescribeWhiteBoxServiceStatus.
443
+ # @type request: :class:`Tencentcloud::kms::V20190118::DescribeWhiteBoxServiceStatusRequest`
444
+ # @rtype: :class:`Tencentcloud::kms::V20190118::DescribeWhiteBoxServiceStatusResponse`
445
+ def DescribeWhiteBoxServiceStatus(request)
446
+ body = send_request('DescribeWhiteBoxServiceStatus', request.serialize)
447
+ response = JSON.parse(body)
448
+ if response['Response'].key?('Error') == false
449
+ model = DescribeWhiteBoxServiceStatusResponse.new
450
+ model.deserialize(response['Response'])
451
+ model
452
+ else
453
+ code = response['Response']['Error']['Code']
454
+ message = response['Response']['Error']['Message']
455
+ reqid = response['Response']['RequestId']
456
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
457
+ end
458
+ rescue TencentCloud::Common::TencentCloudSDKException => e
459
+ raise e
460
+ rescue StandardError => e
461
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
462
+ end
463
+
464
+ # 本接口用于禁用一个主密钥,处于禁用状态的Key无法用于加密、解密操作。
465
+
466
+ # @param request: Request instance for DisableKey.
467
+ # @type request: :class:`Tencentcloud::kms::V20190118::DisableKeyRequest`
468
+ # @rtype: :class:`Tencentcloud::kms::V20190118::DisableKeyResponse`
469
+ def DisableKey(request)
470
+ body = send_request('DisableKey', request.serialize)
471
+ response = JSON.parse(body)
472
+ if response['Response'].key?('Error') == false
473
+ model = DisableKeyResponse.new
474
+ model.deserialize(response['Response'])
475
+ model
476
+ else
477
+ code = response['Response']['Error']['Code']
478
+ message = response['Response']['Error']['Message']
479
+ reqid = response['Response']['RequestId']
480
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
481
+ end
482
+ rescue TencentCloud::Common::TencentCloudSDKException => e
483
+ raise e
484
+ rescue StandardError => e
485
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
486
+ end
487
+
488
+ # 对指定的CMK禁止密钥轮换功能。
489
+
490
+ # @param request: Request instance for DisableKeyRotation.
491
+ # @type request: :class:`Tencentcloud::kms::V20190118::DisableKeyRotationRequest`
492
+ # @rtype: :class:`Tencentcloud::kms::V20190118::DisableKeyRotationResponse`
493
+ def DisableKeyRotation(request)
494
+ body = send_request('DisableKeyRotation', request.serialize)
495
+ response = JSON.parse(body)
496
+ if response['Response'].key?('Error') == false
497
+ model = DisableKeyRotationResponse.new
498
+ model.deserialize(response['Response'])
499
+ model
500
+ else
501
+ code = response['Response']['Error']['Code']
502
+ message = response['Response']['Error']['Message']
503
+ reqid = response['Response']['RequestId']
504
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
505
+ end
506
+ rescue TencentCloud::Common::TencentCloudSDKException => e
507
+ raise e
508
+ rescue StandardError => e
509
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
510
+ end
511
+
512
+ # 该接口用于批量禁止CMK的使用。
513
+
514
+ # @param request: Request instance for DisableKeys.
515
+ # @type request: :class:`Tencentcloud::kms::V20190118::DisableKeysRequest`
516
+ # @rtype: :class:`Tencentcloud::kms::V20190118::DisableKeysResponse`
517
+ def DisableKeys(request)
518
+ body = send_request('DisableKeys', request.serialize)
519
+ response = JSON.parse(body)
520
+ if response['Response'].key?('Error') == false
521
+ model = DisableKeysResponse.new
522
+ model.deserialize(response['Response'])
523
+ model
524
+ else
525
+ code = response['Response']['Error']['Code']
526
+ message = response['Response']['Error']['Message']
527
+ reqid = response['Response']['RequestId']
528
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
529
+ end
530
+ rescue TencentCloud::Common::TencentCloudSDKException => e
531
+ raise e
532
+ rescue StandardError => e
533
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
534
+ end
535
+
536
+ # 禁用白盒密钥
537
+
538
+ # @param request: Request instance for DisableWhiteBoxKey.
539
+ # @type request: :class:`Tencentcloud::kms::V20190118::DisableWhiteBoxKeyRequest`
540
+ # @rtype: :class:`Tencentcloud::kms::V20190118::DisableWhiteBoxKeyResponse`
541
+ def DisableWhiteBoxKey(request)
542
+ body = send_request('DisableWhiteBoxKey', request.serialize)
543
+ response = JSON.parse(body)
544
+ if response['Response'].key?('Error') == false
545
+ model = DisableWhiteBoxKeyResponse.new
546
+ model.deserialize(response['Response'])
547
+ model
548
+ else
549
+ code = response['Response']['Error']['Code']
550
+ message = response['Response']['Error']['Message']
551
+ reqid = response['Response']['RequestId']
552
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
553
+ end
554
+ rescue TencentCloud::Common::TencentCloudSDKException => e
555
+ raise e
556
+ rescue StandardError => e
557
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
558
+ end
559
+
560
+ # 批量禁用白盒密钥
561
+
562
+ # @param request: Request instance for DisableWhiteBoxKeys.
563
+ # @type request: :class:`Tencentcloud::kms::V20190118::DisableWhiteBoxKeysRequest`
564
+ # @rtype: :class:`Tencentcloud::kms::V20190118::DisableWhiteBoxKeysResponse`
565
+ def DisableWhiteBoxKeys(request)
566
+ body = send_request('DisableWhiteBoxKeys', request.serialize)
567
+ response = JSON.parse(body)
568
+ if response['Response'].key?('Error') == false
569
+ model = DisableWhiteBoxKeysResponse.new
570
+ model.deserialize(response['Response'])
571
+ model
572
+ else
573
+ code = response['Response']['Error']['Code']
574
+ message = response['Response']['Error']['Message']
575
+ reqid = response['Response']['RequestId']
576
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
577
+ end
578
+ rescue TencentCloud::Common::TencentCloudSDKException => e
579
+ raise e
580
+ rescue StandardError => e
581
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
582
+ end
583
+
584
+ # 用于启用一个指定的CMK。
585
+
586
+ # @param request: Request instance for EnableKey.
587
+ # @type request: :class:`Tencentcloud::kms::V20190118::EnableKeyRequest`
588
+ # @rtype: :class:`Tencentcloud::kms::V20190118::EnableKeyResponse`
589
+ def EnableKey(request)
590
+ body = send_request('EnableKey', request.serialize)
591
+ response = JSON.parse(body)
592
+ if response['Response'].key?('Error') == false
593
+ model = EnableKeyResponse.new
594
+ model.deserialize(response['Response'])
595
+ model
596
+ else
597
+ code = response['Response']['Error']['Code']
598
+ message = response['Response']['Error']['Message']
599
+ reqid = response['Response']['RequestId']
600
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
601
+ end
602
+ rescue TencentCloud::Common::TencentCloudSDKException => e
603
+ raise e
604
+ rescue StandardError => e
605
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
606
+ end
607
+
608
+ # 对指定的CMK开启密钥轮换功能。
609
+
610
+ # @param request: Request instance for EnableKeyRotation.
611
+ # @type request: :class:`Tencentcloud::kms::V20190118::EnableKeyRotationRequest`
612
+ # @rtype: :class:`Tencentcloud::kms::V20190118::EnableKeyRotationResponse`
613
+ def EnableKeyRotation(request)
614
+ body = send_request('EnableKeyRotation', request.serialize)
615
+ response = JSON.parse(body)
616
+ if response['Response'].key?('Error') == false
617
+ model = EnableKeyRotationResponse.new
618
+ model.deserialize(response['Response'])
619
+ model
620
+ else
621
+ code = response['Response']['Error']['Code']
622
+ message = response['Response']['Error']['Message']
623
+ reqid = response['Response']['RequestId']
624
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
625
+ end
626
+ rescue TencentCloud::Common::TencentCloudSDKException => e
627
+ raise e
628
+ rescue StandardError => e
629
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
630
+ end
631
+
632
+ # 该接口用于批量启用CMK。
633
+
634
+ # @param request: Request instance for EnableKeys.
635
+ # @type request: :class:`Tencentcloud::kms::V20190118::EnableKeysRequest`
636
+ # @rtype: :class:`Tencentcloud::kms::V20190118::EnableKeysResponse`
637
+ def EnableKeys(request)
638
+ body = send_request('EnableKeys', request.serialize)
639
+ response = JSON.parse(body)
640
+ if response['Response'].key?('Error') == false
641
+ model = EnableKeysResponse.new
642
+ model.deserialize(response['Response'])
643
+ model
644
+ else
645
+ code = response['Response']['Error']['Code']
646
+ message = response['Response']['Error']['Message']
647
+ reqid = response['Response']['RequestId']
648
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
649
+ end
650
+ rescue TencentCloud::Common::TencentCloudSDKException => e
651
+ raise e
652
+ rescue StandardError => e
653
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
654
+ end
655
+
656
+ # 启用白盒密钥
657
+
658
+ # @param request: Request instance for EnableWhiteBoxKey.
659
+ # @type request: :class:`Tencentcloud::kms::V20190118::EnableWhiteBoxKeyRequest`
660
+ # @rtype: :class:`Tencentcloud::kms::V20190118::EnableWhiteBoxKeyResponse`
661
+ def EnableWhiteBoxKey(request)
662
+ body = send_request('EnableWhiteBoxKey', request.serialize)
663
+ response = JSON.parse(body)
664
+ if response['Response'].key?('Error') == false
665
+ model = EnableWhiteBoxKeyResponse.new
666
+ model.deserialize(response['Response'])
667
+ model
668
+ else
669
+ code = response['Response']['Error']['Code']
670
+ message = response['Response']['Error']['Message']
671
+ reqid = response['Response']['RequestId']
672
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
673
+ end
674
+ rescue TencentCloud::Common::TencentCloudSDKException => e
675
+ raise e
676
+ rescue StandardError => e
677
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
678
+ end
679
+
680
+ # 批量启用白盒密钥
681
+
682
+ # @param request: Request instance for EnableWhiteBoxKeys.
683
+ # @type request: :class:`Tencentcloud::kms::V20190118::EnableWhiteBoxKeysRequest`
684
+ # @rtype: :class:`Tencentcloud::kms::V20190118::EnableWhiteBoxKeysResponse`
685
+ def EnableWhiteBoxKeys(request)
686
+ body = send_request('EnableWhiteBoxKeys', request.serialize)
687
+ response = JSON.parse(body)
688
+ if response['Response'].key?('Error') == false
689
+ model = EnableWhiteBoxKeysResponse.new
690
+ model.deserialize(response['Response'])
691
+ model
692
+ else
693
+ code = response['Response']['Error']['Code']
694
+ message = response['Response']['Error']['Message']
695
+ reqid = response['Response']['RequestId']
696
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
697
+ end
698
+ rescue TencentCloud::Common::TencentCloudSDKException => e
699
+ raise e
700
+ rescue StandardError => e
701
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
702
+ end
703
+
704
+ # 本接口用于加密最多为4KB任意数据,可用于加密数据库密码,RSA Key,或其它较小的敏感信息。对于应用的数据加密,使用GenerateDataKey生成的DataKey进行本地数据的加解密操作
705
+
706
+ # @param request: Request instance for Encrypt.
707
+ # @type request: :class:`Tencentcloud::kms::V20190118::EncryptRequest`
708
+ # @rtype: :class:`Tencentcloud::kms::V20190118::EncryptResponse`
709
+ def Encrypt(request)
710
+ body = send_request('Encrypt', request.serialize)
711
+ response = JSON.parse(body)
712
+ if response['Response'].key?('Error') == false
713
+ model = EncryptResponse.new
714
+ model.deserialize(response['Response'])
715
+ model
716
+ else
717
+ code = response['Response']['Error']['Code']
718
+ message = response['Response']['Error']['Message']
719
+ reqid = response['Response']['RequestId']
720
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
721
+ end
722
+ rescue TencentCloud::Common::TencentCloudSDKException => e
723
+ raise e
724
+ rescue StandardError => e
725
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
726
+ end
727
+
728
+ # 使用白盒密钥进行加密
729
+
730
+ # @param request: Request instance for EncryptByWhiteBox.
731
+ # @type request: :class:`Tencentcloud::kms::V20190118::EncryptByWhiteBoxRequest`
732
+ # @rtype: :class:`Tencentcloud::kms::V20190118::EncryptByWhiteBoxResponse`
733
+ def EncryptByWhiteBox(request)
734
+ body = send_request('EncryptByWhiteBox', request.serialize)
735
+ response = JSON.parse(body)
736
+ if response['Response'].key?('Error') == false
737
+ model = EncryptByWhiteBoxResponse.new
738
+ model.deserialize(response['Response'])
739
+ model
740
+ else
741
+ code = response['Response']['Error']['Code']
742
+ message = response['Response']['Error']['Message']
743
+ reqid = response['Response']['RequestId']
744
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
745
+ end
746
+ rescue TencentCloud::Common::TencentCloudSDKException => e
747
+ raise e
748
+ rescue StandardError => e
749
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
750
+ end
751
+
752
+ # 本接口生成一个数据密钥,您可以用这个密钥进行本地数据的加密。
753
+
754
+ # @param request: Request instance for GenerateDataKey.
755
+ # @type request: :class:`Tencentcloud::kms::V20190118::GenerateDataKeyRequest`
756
+ # @rtype: :class:`Tencentcloud::kms::V20190118::GenerateDataKeyResponse`
757
+ def GenerateDataKey(request)
758
+ body = send_request('GenerateDataKey', request.serialize)
759
+ response = JSON.parse(body)
760
+ if response['Response'].key?('Error') == false
761
+ model = GenerateDataKeyResponse.new
762
+ model.deserialize(response['Response'])
763
+ model
764
+ else
765
+ code = response['Response']['Error']['Code']
766
+ message = response['Response']['Error']['Message']
767
+ reqid = response['Response']['RequestId']
768
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
769
+ end
770
+ rescue TencentCloud::Common::TencentCloudSDKException => e
771
+ raise e
772
+ rescue StandardError => e
773
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
774
+ end
775
+
776
+ # 随机数生成接口。
777
+
778
+ # @param request: Request instance for GenerateRandom.
779
+ # @type request: :class:`Tencentcloud::kms::V20190118::GenerateRandomRequest`
780
+ # @rtype: :class:`Tencentcloud::kms::V20190118::GenerateRandomResponse`
781
+ def GenerateRandom(request)
782
+ body = send_request('GenerateRandom', request.serialize)
783
+ response = JSON.parse(body)
784
+ if response['Response'].key?('Error') == false
785
+ model = GenerateRandomResponse.new
786
+ model.deserialize(response['Response'])
787
+ model
788
+ else
789
+ code = response['Response']['Error']['Code']
790
+ message = response['Response']['Error']['Message']
791
+ reqid = response['Response']['RequestId']
792
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
793
+ end
794
+ rescue TencentCloud::Common::TencentCloudSDKException => e
795
+ raise e
796
+ rescue StandardError => e
797
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
798
+ end
799
+
800
+ # 查询指定的CMK是否开启了密钥轮换功能。
801
+
802
+ # @param request: Request instance for GetKeyRotationStatus.
803
+ # @type request: :class:`Tencentcloud::kms::V20190118::GetKeyRotationStatusRequest`
804
+ # @rtype: :class:`Tencentcloud::kms::V20190118::GetKeyRotationStatusResponse`
805
+ def GetKeyRotationStatus(request)
806
+ body = send_request('GetKeyRotationStatus', request.serialize)
807
+ response = JSON.parse(body)
808
+ if response['Response'].key?('Error') == false
809
+ model = GetKeyRotationStatusResponse.new
810
+ model.deserialize(response['Response'])
811
+ model
812
+ else
813
+ code = response['Response']['Error']['Code']
814
+ message = response['Response']['Error']['Message']
815
+ reqid = response['Response']['RequestId']
816
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
817
+ end
818
+ rescue TencentCloud::Common::TencentCloudSDKException => e
819
+ raise e
820
+ rescue StandardError => e
821
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
822
+ end
823
+
824
+ # 获取导入主密钥(CMK)材料的参数,返回的Token作为执行ImportKeyMaterial的参数之一,返回的PublicKey用于对自主导入密钥材料进行加密。返回的Token和PublicKey 24小时后失效,失效后如需重新导入,需要再次调用该接口获取新的Token和PublicKey。
825
+
826
+ # @param request: Request instance for GetParametersForImport.
827
+ # @type request: :class:`Tencentcloud::kms::V20190118::GetParametersForImportRequest`
828
+ # @rtype: :class:`Tencentcloud::kms::V20190118::GetParametersForImportResponse`
829
+ def GetParametersForImport(request)
830
+ body = send_request('GetParametersForImport', request.serialize)
831
+ response = JSON.parse(body)
832
+ if response['Response'].key?('Error') == false
833
+ model = GetParametersForImportResponse.new
834
+ model.deserialize(response['Response'])
835
+ model
836
+ else
837
+ code = response['Response']['Error']['Code']
838
+ message = response['Response']['Error']['Message']
839
+ reqid = response['Response']['RequestId']
840
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
841
+ end
842
+ rescue TencentCloud::Common::TencentCloudSDKException => e
843
+ raise e
844
+ rescue StandardError => e
845
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
846
+ end
847
+
848
+ # 该接口用于获取非对称密钥的公钥信息,可用于本地数据加密或验签。只有处于Enabled状态的非对称密钥才可能获取公钥。
849
+
850
+ # @param request: Request instance for GetPublicKey.
851
+ # @type request: :class:`Tencentcloud::kms::V20190118::GetPublicKeyRequest`
852
+ # @rtype: :class:`Tencentcloud::kms::V20190118::GetPublicKeyResponse`
853
+ def GetPublicKey(request)
854
+ body = send_request('GetPublicKey', request.serialize)
855
+ response = JSON.parse(body)
856
+ if response['Response'].key?('Error') == false
857
+ model = GetPublicKeyResponse.new
858
+ model.deserialize(response['Response'])
859
+ model
860
+ else
861
+ code = response['Response']['Error']['Code']
862
+ message = response['Response']['Error']['Message']
863
+ reqid = response['Response']['RequestId']
864
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
865
+ end
866
+ rescue TencentCloud::Common::TencentCloudSDKException => e
867
+ raise e
868
+ rescue StandardError => e
869
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
870
+ end
871
+
872
+ # 获取支持的地域列表
873
+
874
+ # @param request: Request instance for GetRegions.
875
+ # @type request: :class:`Tencentcloud::kms::V20190118::GetRegionsRequest`
876
+ # @rtype: :class:`Tencentcloud::kms::V20190118::GetRegionsResponse`
877
+ def GetRegions(request)
878
+ body = send_request('GetRegions', request.serialize)
879
+ response = JSON.parse(body)
880
+ if response['Response'].key?('Error') == false
881
+ model = GetRegionsResponse.new
882
+ model.deserialize(response['Response'])
883
+ model
884
+ else
885
+ code = response['Response']['Error']['Code']
886
+ message = response['Response']['Error']['Message']
887
+ reqid = response['Response']['RequestId']
888
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
889
+ end
890
+ rescue TencentCloud::Common::TencentCloudSDKException => e
891
+ raise e
892
+ rescue StandardError => e
893
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
894
+ end
895
+
896
+ # 用于查询该用户是否已开通KMS服务
897
+
898
+ # @param request: Request instance for GetServiceStatus.
899
+ # @type request: :class:`Tencentcloud::kms::V20190118::GetServiceStatusRequest`
900
+ # @rtype: :class:`Tencentcloud::kms::V20190118::GetServiceStatusResponse`
901
+ def GetServiceStatus(request)
902
+ body = send_request('GetServiceStatus', request.serialize)
903
+ response = JSON.parse(body)
904
+ if response['Response'].key?('Error') == false
905
+ model = GetServiceStatusResponse.new
906
+ model.deserialize(response['Response'])
907
+ model
908
+ else
909
+ code = response['Response']['Error']['Code']
910
+ message = response['Response']['Error']['Message']
911
+ reqid = response['Response']['RequestId']
912
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
913
+ end
914
+ rescue TencentCloud::Common::TencentCloudSDKException => e
915
+ raise e
916
+ rescue StandardError => e
917
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
918
+ end
919
+
920
+ # 用于导入密钥材料。只有类型为EXTERNAL 的CMK 才可以导入,导入的密钥材料使用 GetParametersForImport 获取的密钥进行加密。可以为指定的 CMK 重新导入密钥材料,并重新指定过期时间,但必须导入相同的密钥材料。CMK 密钥材料导入后不可以更换密钥材料。导入的密钥材料过期或者被删除后,指定的CMK将无法使用,需要再次导入相同的密钥材料才能正常使用。CMK是独立的,同样的密钥材料可导入不同的 CMK 中,但使用其中一个 CMK 加密的数据无法使用另一个 CMK解密。
921
+ # 只有Enabled 和 PendingImport状态的CMK可以导入密钥材料。
922
+
923
+ # @param request: Request instance for ImportKeyMaterial.
924
+ # @type request: :class:`Tencentcloud::kms::V20190118::ImportKeyMaterialRequest`
925
+ # @rtype: :class:`Tencentcloud::kms::V20190118::ImportKeyMaterialResponse`
926
+ def ImportKeyMaterial(request)
927
+ body = send_request('ImportKeyMaterial', request.serialize)
928
+ response = JSON.parse(body)
929
+ if response['Response'].key?('Error') == false
930
+ model = ImportKeyMaterialResponse.new
931
+ model.deserialize(response['Response'])
932
+ model
933
+ else
934
+ code = response['Response']['Error']['Code']
935
+ message = response['Response']['Error']['Message']
936
+ reqid = response['Response']['RequestId']
937
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
938
+ end
939
+ rescue TencentCloud::Common::TencentCloudSDKException => e
940
+ raise e
941
+ rescue StandardError => e
942
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
943
+ end
944
+
945
+ # 列出当前Region支持的加密方式
946
+
947
+ # @param request: Request instance for ListAlgorithms.
948
+ # @type request: :class:`Tencentcloud::kms::V20190118::ListAlgorithmsRequest`
949
+ # @rtype: :class:`Tencentcloud::kms::V20190118::ListAlgorithmsResponse`
950
+ def ListAlgorithms(request)
951
+ body = send_request('ListAlgorithms', request.serialize)
952
+ response = JSON.parse(body)
953
+ if response['Response'].key?('Error') == false
954
+ model = ListAlgorithmsResponse.new
955
+ model.deserialize(response['Response'])
956
+ model
957
+ else
958
+ code = response['Response']['Error']['Code']
959
+ message = response['Response']['Error']['Message']
960
+ reqid = response['Response']['RequestId']
961
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
962
+ end
963
+ rescue TencentCloud::Common::TencentCloudSDKException => e
964
+ raise e
965
+ rescue StandardError => e
966
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
967
+ end
968
+
969
+ # 根据指定Offset和Limit获取主密钥列表详情。
970
+
971
+ # @param request: Request instance for ListKeyDetail.
972
+ # @type request: :class:`Tencentcloud::kms::V20190118::ListKeyDetailRequest`
973
+ # @rtype: :class:`Tencentcloud::kms::V20190118::ListKeyDetailResponse`
974
+ def ListKeyDetail(request)
975
+ body = send_request('ListKeyDetail', request.serialize)
976
+ response = JSON.parse(body)
977
+ if response['Response'].key?('Error') == false
978
+ model = ListKeyDetailResponse.new
979
+ model.deserialize(response['Response'])
980
+ model
981
+ else
982
+ code = response['Response']['Error']['Code']
983
+ message = response['Response']['Error']['Message']
984
+ reqid = response['Response']['RequestId']
985
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
986
+ end
987
+ rescue TencentCloud::Common::TencentCloudSDKException => e
988
+ raise e
989
+ rescue StandardError => e
990
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
991
+ end
992
+
993
+ # 列出账号下面状态为Enabled, Disabled 和 PendingImport 的CMK KeyId 列表
994
+
995
+ # @param request: Request instance for ListKeys.
996
+ # @type request: :class:`Tencentcloud::kms::V20190118::ListKeysRequest`
997
+ # @rtype: :class:`Tencentcloud::kms::V20190118::ListKeysResponse`
998
+ def ListKeys(request)
999
+ body = send_request('ListKeys', request.serialize)
1000
+ response = JSON.parse(body)
1001
+ if response['Response'].key?('Error') == false
1002
+ model = ListKeysResponse.new
1003
+ model.deserialize(response['Response'])
1004
+ model
1005
+ else
1006
+ code = response['Response']['Error']['Code']
1007
+ message = response['Response']['Error']['Message']
1008
+ reqid = response['Response']['RequestId']
1009
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1010
+ end
1011
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1012
+ raise e
1013
+ rescue StandardError => e
1014
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1015
+ end
1016
+
1017
+ # 覆盖指定密钥的设备指纹信息
1018
+
1019
+ # @param request: Request instance for OverwriteWhiteBoxDeviceFingerprints.
1020
+ # @type request: :class:`Tencentcloud::kms::V20190118::OverwriteWhiteBoxDeviceFingerprintsRequest`
1021
+ # @rtype: :class:`Tencentcloud::kms::V20190118::OverwriteWhiteBoxDeviceFingerprintsResponse`
1022
+ def OverwriteWhiteBoxDeviceFingerprints(request)
1023
+ body = send_request('OverwriteWhiteBoxDeviceFingerprints', request.serialize)
1024
+ response = JSON.parse(body)
1025
+ if response['Response'].key?('Error') == false
1026
+ model = OverwriteWhiteBoxDeviceFingerprintsResponse.new
1027
+ model.deserialize(response['Response'])
1028
+ model
1029
+ else
1030
+ code = response['Response']['Error']['Code']
1031
+ message = response['Response']['Error']['Message']
1032
+ reqid = response['Response']['RequestId']
1033
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1034
+ end
1035
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1036
+ raise e
1037
+ rescue StandardError => e
1038
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1039
+ end
1040
+
1041
+ # 使用指定CMK对密文重新加密。
1042
+
1043
+ # @param request: Request instance for ReEncrypt.
1044
+ # @type request: :class:`Tencentcloud::kms::V20190118::ReEncryptRequest`
1045
+ # @rtype: :class:`Tencentcloud::kms::V20190118::ReEncryptResponse`
1046
+ def ReEncrypt(request)
1047
+ body = send_request('ReEncrypt', request.serialize)
1048
+ response = JSON.parse(body)
1049
+ if response['Response'].key?('Error') == false
1050
+ model = ReEncryptResponse.new
1051
+ model.deserialize(response['Response'])
1052
+ model
1053
+ else
1054
+ code = response['Response']['Error']['Code']
1055
+ message = response['Response']['Error']['Message']
1056
+ reqid = response['Response']['RequestId']
1057
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1058
+ end
1059
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1060
+ raise e
1061
+ rescue StandardError => e
1062
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1063
+ end
1064
+
1065
+ # CMK计划删除接口,用于指定CMK删除的时间,可选时间区间为[7,30]天
1066
+
1067
+ # @param request: Request instance for ScheduleKeyDeletion.
1068
+ # @type request: :class:`Tencentcloud::kms::V20190118::ScheduleKeyDeletionRequest`
1069
+ # @rtype: :class:`Tencentcloud::kms::V20190118::ScheduleKeyDeletionResponse`
1070
+ def ScheduleKeyDeletion(request)
1071
+ body = send_request('ScheduleKeyDeletion', request.serialize)
1072
+ response = JSON.parse(body)
1073
+ if response['Response'].key?('Error') == false
1074
+ model = ScheduleKeyDeletionResponse.new
1075
+ model.deserialize(response['Response'])
1076
+ model
1077
+ else
1078
+ code = response['Response']['Error']['Code']
1079
+ message = response['Response']['Error']['Message']
1080
+ reqid = response['Response']['RequestId']
1081
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1082
+ end
1083
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1084
+ raise e
1085
+ rescue StandardError => e
1086
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1087
+ end
1088
+
1089
+ # 非对称密钥签名。
1090
+ # 注意:只有成功创建了KeyUsage= ASYMMETRIC_SIGN_VERIFY_SM2、ASYMMETRIC_SIGN_VERIFY_ECC 或 ASYMMETRIC_SIGN_VERIFY_RSA_2048 的密钥才可以使用签名功能
1091
+
1092
+ # @param request: Request instance for SignByAsymmetricKey.
1093
+ # @type request: :class:`Tencentcloud::kms::V20190118::SignByAsymmetricKeyRequest`
1094
+ # @rtype: :class:`Tencentcloud::kms::V20190118::SignByAsymmetricKeyResponse`
1095
+ def SignByAsymmetricKey(request)
1096
+ body = send_request('SignByAsymmetricKey', request.serialize)
1097
+ response = JSON.parse(body)
1098
+ if response['Response'].key?('Error') == false
1099
+ model = SignByAsymmetricKeyResponse.new
1100
+ model.deserialize(response['Response'])
1101
+ model
1102
+ else
1103
+ code = response['Response']['Error']['Code']
1104
+ message = response['Response']['Error']['Message']
1105
+ reqid = response['Response']['RequestId']
1106
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1107
+ end
1108
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1109
+ raise e
1110
+ rescue StandardError => e
1111
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1112
+ end
1113
+
1114
+ # 删除指定(key, 资源,云产品)的记录,以表明:指定的云产品的资源已不再使用当前的key。
1115
+
1116
+ # @param request: Request instance for UnbindCloudResource.
1117
+ # @type request: :class:`Tencentcloud::kms::V20190118::UnbindCloudResourceRequest`
1118
+ # @rtype: :class:`Tencentcloud::kms::V20190118::UnbindCloudResourceResponse`
1119
+ def UnbindCloudResource(request)
1120
+ body = send_request('UnbindCloudResource', request.serialize)
1121
+ response = JSON.parse(body)
1122
+ if response['Response'].key?('Error') == false
1123
+ model = UnbindCloudResourceResponse.new
1124
+ model.deserialize(response['Response'])
1125
+ model
1126
+ else
1127
+ code = response['Response']['Error']['Code']
1128
+ message = response['Response']['Error']['Message']
1129
+ reqid = response['Response']['RequestId']
1130
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1131
+ end
1132
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1133
+ raise e
1134
+ rescue StandardError => e
1135
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1136
+ end
1137
+
1138
+ # 用于修改CMK的别名。对于处于PendingDelete状态的CMK禁止修改。
1139
+
1140
+ # @param request: Request instance for UpdateAlias.
1141
+ # @type request: :class:`Tencentcloud::kms::V20190118::UpdateAliasRequest`
1142
+ # @rtype: :class:`Tencentcloud::kms::V20190118::UpdateAliasResponse`
1143
+ def UpdateAlias(request)
1144
+ body = send_request('UpdateAlias', request.serialize)
1145
+ response = JSON.parse(body)
1146
+ if response['Response'].key?('Error') == false
1147
+ model = UpdateAliasResponse.new
1148
+ model.deserialize(response['Response'])
1149
+ model
1150
+ else
1151
+ code = response['Response']['Error']['Code']
1152
+ message = response['Response']['Error']['Message']
1153
+ reqid = response['Response']['RequestId']
1154
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1155
+ end
1156
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1157
+ raise e
1158
+ rescue StandardError => e
1159
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1160
+ end
1161
+
1162
+ # 该接口用于对指定的cmk修改描述信息。对于处于PendingDelete状态的CMK禁止修改。
1163
+
1164
+ # @param request: Request instance for UpdateKeyDescription.
1165
+ # @type request: :class:`Tencentcloud::kms::V20190118::UpdateKeyDescriptionRequest`
1166
+ # @rtype: :class:`Tencentcloud::kms::V20190118::UpdateKeyDescriptionResponse`
1167
+ def UpdateKeyDescription(request)
1168
+ body = send_request('UpdateKeyDescription', request.serialize)
1169
+ response = JSON.parse(body)
1170
+ if response['Response'].key?('Error') == false
1171
+ model = UpdateKeyDescriptionResponse.new
1172
+ model.deserialize(response['Response'])
1173
+ model
1174
+ else
1175
+ code = response['Response']['Error']['Code']
1176
+ message = response['Response']['Error']['Message']
1177
+ reqid = response['Response']['RequestId']
1178
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1179
+ end
1180
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1181
+ raise e
1182
+ rescue StandardError => e
1183
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1184
+ end
1185
+
1186
+ # 使用非对称密钥验签
1187
+
1188
+ # @param request: Request instance for VerifyByAsymmetricKey.
1189
+ # @type request: :class:`Tencentcloud::kms::V20190118::VerifyByAsymmetricKeyRequest`
1190
+ # @rtype: :class:`Tencentcloud::kms::V20190118::VerifyByAsymmetricKeyResponse`
1191
+ def VerifyByAsymmetricKey(request)
1192
+ body = send_request('VerifyByAsymmetricKey', request.serialize)
1193
+ response = JSON.parse(body)
1194
+ if response['Response'].key?('Error') == false
1195
+ model = VerifyByAsymmetricKeyResponse.new
1196
+ model.deserialize(response['Response'])
1197
+ model
1198
+ else
1199
+ code = response['Response']['Error']['Code']
1200
+ message = response['Response']['Error']['Message']
1201
+ reqid = response['Response']['RequestId']
1202
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1203
+ end
1204
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1205
+ raise e
1206
+ rescue StandardError => e
1207
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1208
+ end
1209
+
1210
+
1211
+ end
1212
+ end
1213
+ end
1214
+ end