forked from aws/aws-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
api.go
1926 lines (1536 loc) · 61.7 KB
/
api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package kms provides a client for AWS Key Management Service.
package kms
import (
"sync"
"time"
"github.com/aws/aws-sdk-go/aws"
)
var oprw sync.Mutex
// CreateAliasRequest generates a request for the CreateAlias operation.
func (c *KMS) CreateAliasRequest(input *CreateAliasInput) (req *aws.Request, output *CreateAliasOutput) {
oprw.Lock()
defer oprw.Unlock()
if opCreateAlias == nil {
opCreateAlias = &aws.Operation{
Name: "CreateAlias",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &CreateAliasInput{}
}
req = c.newRequest(opCreateAlias, input, output)
output = &CreateAliasOutput{}
req.Data = output
return
}
// Creates a display name for a customer master key. An alias can be used to
// identify a key and should be unique. The console enforces a one-to-one mapping
// between the alias and a key. An alias name can contain only alphanumeric
// characters, forward slashes (/), underscores (_), and dashes (-). An alias
// must start with the word "alias" followed by a forward slash (alias/). An
// alias that begins with "aws" after the forward slash (alias/aws...) is reserved
// by Amazon Web Services (AWS).
//
// To associate an alias with a different key, call UpdateAlias.
//
// Note that you cannot create or update an alias that represents a key in
// another account.
func (c *KMS) CreateAlias(input *CreateAliasInput) (*CreateAliasOutput, error) {
req, out := c.CreateAliasRequest(input)
err := req.Send()
return out, err
}
var opCreateAlias *aws.Operation
// CreateGrantRequest generates a request for the CreateGrant operation.
func (c *KMS) CreateGrantRequest(input *CreateGrantInput) (req *aws.Request, output *CreateGrantOutput) {
oprw.Lock()
defer oprw.Unlock()
if opCreateGrant == nil {
opCreateGrant = &aws.Operation{
Name: "CreateGrant",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &CreateGrantInput{}
}
req = c.newRequest(opCreateGrant, input, output)
output = &CreateGrantOutput{}
req.Data = output
return
}
// Adds a grant to a key to specify who can access the key and under what conditions.
// Grants are alternate permission mechanisms to key policies. For more information
// about grants, see Grants (http://docs.aws.amazon.com/kms/latest/developerguide/grants.html)
// in the developer guide. If a grant is absent, access to the key is evaluated
// based on IAM policies attached to the user. ListGrants RetireGrant RevokeGrant
func (c *KMS) CreateGrant(input *CreateGrantInput) (*CreateGrantOutput, error) {
req, out := c.CreateGrantRequest(input)
err := req.Send()
return out, err
}
var opCreateGrant *aws.Operation
// CreateKeyRequest generates a request for the CreateKey operation.
func (c *KMS) CreateKeyRequest(input *CreateKeyInput) (req *aws.Request, output *CreateKeyOutput) {
oprw.Lock()
defer oprw.Unlock()
if opCreateKey == nil {
opCreateKey = &aws.Operation{
Name: "CreateKey",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &CreateKeyInput{}
}
req = c.newRequest(opCreateKey, input, output)
output = &CreateKeyOutput{}
req.Data = output
return
}
// Creates a customer master key. Customer master keys can be used to encrypt
// small amounts of data (less than 4K) directly, but they are most commonly
// used to encrypt or envelope data keys that are then used to encrypt customer
// data. For more information about data keys, see GenerateDataKey and GenerateDataKeyWithoutPlaintext.
func (c *KMS) CreateKey(input *CreateKeyInput) (*CreateKeyOutput, error) {
req, out := c.CreateKeyRequest(input)
err := req.Send()
return out, err
}
var opCreateKey *aws.Operation
// DecryptRequest generates a request for the Decrypt operation.
func (c *KMS) DecryptRequest(input *DecryptInput) (req *aws.Request, output *DecryptOutput) {
oprw.Lock()
defer oprw.Unlock()
if opDecrypt == nil {
opDecrypt = &aws.Operation{
Name: "Decrypt",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &DecryptInput{}
}
req = c.newRequest(opDecrypt, input, output)
output = &DecryptOutput{}
req.Data = output
return
}
// Decrypts ciphertext. Ciphertext is plaintext that has been previously encrypted
// by using any of the following functions: GenerateDataKey GenerateDataKeyWithoutPlaintext
// Encrypt
//
// Note that if a caller has been granted access permissions to all keys (through,
// for example, IAM user policies that grant Decrypt permission on all resources),
// then ciphertext encrypted by using keys in other accounts where the key grants
// access to the caller can be decrypted. To remedy this, we recommend that
// you do not grant Decrypt access in an IAM user policy. Instead grant Decrypt
// access only in key policies. If you must grant Decrypt access in an IAM user
// policy, you should scope the resource to specific keys or to specific trusted
// accounts.
func (c *KMS) Decrypt(input *DecryptInput) (*DecryptOutput, error) {
req, out := c.DecryptRequest(input)
err := req.Send()
return out, err
}
var opDecrypt *aws.Operation
// DeleteAliasRequest generates a request for the DeleteAlias operation.
func (c *KMS) DeleteAliasRequest(input *DeleteAliasInput) (req *aws.Request, output *DeleteAliasOutput) {
oprw.Lock()
defer oprw.Unlock()
if opDeleteAlias == nil {
opDeleteAlias = &aws.Operation{
Name: "DeleteAlias",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &DeleteAliasInput{}
}
req = c.newRequest(opDeleteAlias, input, output)
output = &DeleteAliasOutput{}
req.Data = output
return
}
// Deletes the specified alias. To associate an alias with a different key,
// call UpdateAlias.
func (c *KMS) DeleteAlias(input *DeleteAliasInput) (*DeleteAliasOutput, error) {
req, out := c.DeleteAliasRequest(input)
err := req.Send()
return out, err
}
var opDeleteAlias *aws.Operation
// DescribeKeyRequest generates a request for the DescribeKey operation.
func (c *KMS) DescribeKeyRequest(input *DescribeKeyInput) (req *aws.Request, output *DescribeKeyOutput) {
oprw.Lock()
defer oprw.Unlock()
if opDescribeKey == nil {
opDescribeKey = &aws.Operation{
Name: "DescribeKey",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &DescribeKeyInput{}
}
req = c.newRequest(opDescribeKey, input, output)
output = &DescribeKeyOutput{}
req.Data = output
return
}
// Provides detailed information about the specified customer master key.
func (c *KMS) DescribeKey(input *DescribeKeyInput) (*DescribeKeyOutput, error) {
req, out := c.DescribeKeyRequest(input)
err := req.Send()
return out, err
}
var opDescribeKey *aws.Operation
// DisableKeyRequest generates a request for the DisableKey operation.
func (c *KMS) DisableKeyRequest(input *DisableKeyInput) (req *aws.Request, output *DisableKeyOutput) {
oprw.Lock()
defer oprw.Unlock()
if opDisableKey == nil {
opDisableKey = &aws.Operation{
Name: "DisableKey",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &DisableKeyInput{}
}
req = c.newRequest(opDisableKey, input, output)
output = &DisableKeyOutput{}
req.Data = output
return
}
// Marks a key as disabled, thereby preventing its use.
func (c *KMS) DisableKey(input *DisableKeyInput) (*DisableKeyOutput, error) {
req, out := c.DisableKeyRequest(input)
err := req.Send()
return out, err
}
var opDisableKey *aws.Operation
// DisableKeyRotationRequest generates a request for the DisableKeyRotation operation.
func (c *KMS) DisableKeyRotationRequest(input *DisableKeyRotationInput) (req *aws.Request, output *DisableKeyRotationOutput) {
oprw.Lock()
defer oprw.Unlock()
if opDisableKeyRotation == nil {
opDisableKeyRotation = &aws.Operation{
Name: "DisableKeyRotation",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &DisableKeyRotationInput{}
}
req = c.newRequest(opDisableKeyRotation, input, output)
output = &DisableKeyRotationOutput{}
req.Data = output
return
}
// Disables rotation of the specified key.
func (c *KMS) DisableKeyRotation(input *DisableKeyRotationInput) (*DisableKeyRotationOutput, error) {
req, out := c.DisableKeyRotationRequest(input)
err := req.Send()
return out, err
}
var opDisableKeyRotation *aws.Operation
// EnableKeyRequest generates a request for the EnableKey operation.
func (c *KMS) EnableKeyRequest(input *EnableKeyInput) (req *aws.Request, output *EnableKeyOutput) {
oprw.Lock()
defer oprw.Unlock()
if opEnableKey == nil {
opEnableKey = &aws.Operation{
Name: "EnableKey",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &EnableKeyInput{}
}
req = c.newRequest(opEnableKey, input, output)
output = &EnableKeyOutput{}
req.Data = output
return
}
// Marks a key as enabled, thereby permitting its use. You can have up to 25
// enabled keys at one time.
func (c *KMS) EnableKey(input *EnableKeyInput) (*EnableKeyOutput, error) {
req, out := c.EnableKeyRequest(input)
err := req.Send()
return out, err
}
var opEnableKey *aws.Operation
// EnableKeyRotationRequest generates a request for the EnableKeyRotation operation.
func (c *KMS) EnableKeyRotationRequest(input *EnableKeyRotationInput) (req *aws.Request, output *EnableKeyRotationOutput) {
oprw.Lock()
defer oprw.Unlock()
if opEnableKeyRotation == nil {
opEnableKeyRotation = &aws.Operation{
Name: "EnableKeyRotation",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &EnableKeyRotationInput{}
}
req = c.newRequest(opEnableKeyRotation, input, output)
output = &EnableKeyRotationOutput{}
req.Data = output
return
}
// Enables rotation of the specified customer master key.
func (c *KMS) EnableKeyRotation(input *EnableKeyRotationInput) (*EnableKeyRotationOutput, error) {
req, out := c.EnableKeyRotationRequest(input)
err := req.Send()
return out, err
}
var opEnableKeyRotation *aws.Operation
// EncryptRequest generates a request for the Encrypt operation.
func (c *KMS) EncryptRequest(input *EncryptInput) (req *aws.Request, output *EncryptOutput) {
oprw.Lock()
defer oprw.Unlock()
if opEncrypt == nil {
opEncrypt = &aws.Operation{
Name: "Encrypt",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &EncryptInput{}
}
req = c.newRequest(opEncrypt, input, output)
output = &EncryptOutput{}
req.Data = output
return
}
// Encrypts plaintext into ciphertext by using a customer master key. The Encrypt
// function has two primary use cases: You can encrypt up to 4 KB of arbitrary
// data such as an RSA key, a database password, or other sensitive customer
// information. If you are moving encrypted data from one region to another,
// you can use this API to encrypt in the new region the plaintext data key
// that was used to encrypt the data in the original region. This provides you
// with an encrypted copy of the data key that can be decrypted in the new region
// and used there to decrypt the encrypted data.
//
// Unless you are moving encrypted data from one region to another, you don't
// use this function to encrypt a generated data key within a region. You retrieve
// data keys already encrypted by calling the GenerateDataKey or GenerateDataKeyWithoutPlaintext
// function. Data keys don't need to be encrypted again by calling Encrypt.
//
// If you want to encrypt data locally in your application, you can use the
// GenerateDataKey function to return a plaintext data encryption key and a
// copy of the key encrypted under the customer master key (CMK) of your choosing.
func (c *KMS) Encrypt(input *EncryptInput) (*EncryptOutput, error) {
req, out := c.EncryptRequest(input)
err := req.Send()
return out, err
}
var opEncrypt *aws.Operation
// GenerateDataKeyRequest generates a request for the GenerateDataKey operation.
func (c *KMS) GenerateDataKeyRequest(input *GenerateDataKeyInput) (req *aws.Request, output *GenerateDataKeyOutput) {
oprw.Lock()
defer oprw.Unlock()
if opGenerateDataKey == nil {
opGenerateDataKey = &aws.Operation{
Name: "GenerateDataKey",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &GenerateDataKeyInput{}
}
req = c.newRequest(opGenerateDataKey, input, output)
output = &GenerateDataKeyOutput{}
req.Data = output
return
}
// Generates a data key that you can use in your application to locally encrypt
// data. This call returns a plaintext version of the key in the Plaintext field
// of the response object and an encrypted copy of the key in the CiphertextBlob
// field. The key is encrypted by using the master key specified by the KeyId
// field. To decrypt the encrypted key, pass it to the Decrypt API.
//
// We recommend that you use the following pattern to locally encrypt data:
// call the GenerateDataKey API, use the key returned in the Plaintext response
// field to locally encrypt data, and then erase the plaintext data key from
// memory. Store the encrypted data key (contained in the CiphertextBlob field)
// alongside of the locally encrypted data.
//
// You should not call the Encrypt function to re-encrypt your data keys within
// a region. GenerateDataKey always returns the data key encrypted and tied
// to the customer master key that will be used to decrypt it. There is no need
// to decrypt it twice. If you decide to use the optional EncryptionContext
// parameter, you must also store the context in full or at least store enough
// information along with the encrypted data to be able to reconstruct the context
// when submitting the ciphertext to the Decrypt API. It is a good practice
// to choose a context that you can reconstruct on the fly to better secure
// the ciphertext. For more information about how this parameter is used, see
// Encryption Context (http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html).
//
// To decrypt data, pass the encrypted data key to the Decrypt API. Decrypt
// uses the associated master key to decrypt the encrypted data key and returns
// it as plaintext. Use the plaintext data key to locally decrypt your data
// and then erase the key from memory. You must specify the encryption context,
// if any, that you specified when you generated the key. The encryption context
// is logged by CloudTrail, and you can use this log to help track the use of
// particular data.
func (c *KMS) GenerateDataKey(input *GenerateDataKeyInput) (*GenerateDataKeyOutput, error) {
req, out := c.GenerateDataKeyRequest(input)
err := req.Send()
return out, err
}
var opGenerateDataKey *aws.Operation
// GenerateDataKeyWithoutPlaintextRequest generates a request for the GenerateDataKeyWithoutPlaintext operation.
func (c *KMS) GenerateDataKeyWithoutPlaintextRequest(input *GenerateDataKeyWithoutPlaintextInput) (req *aws.Request, output *GenerateDataKeyWithoutPlaintextOutput) {
oprw.Lock()
defer oprw.Unlock()
if opGenerateDataKeyWithoutPlaintext == nil {
opGenerateDataKeyWithoutPlaintext = &aws.Operation{
Name: "GenerateDataKeyWithoutPlaintext",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &GenerateDataKeyWithoutPlaintextInput{}
}
req = c.newRequest(opGenerateDataKeyWithoutPlaintext, input, output)
output = &GenerateDataKeyWithoutPlaintextOutput{}
req.Data = output
return
}
// Returns a data key encrypted by a customer master key without the plaintext
// copy of that key. Otherwise, this API functions exactly like GenerateDataKey.
// You can use this API to, for example, satisfy an audit requirement that an
// encrypted key be made available without exposing the plaintext copy of that
// key.
func (c *KMS) GenerateDataKeyWithoutPlaintext(input *GenerateDataKeyWithoutPlaintextInput) (*GenerateDataKeyWithoutPlaintextOutput, error) {
req, out := c.GenerateDataKeyWithoutPlaintextRequest(input)
err := req.Send()
return out, err
}
var opGenerateDataKeyWithoutPlaintext *aws.Operation
// GenerateRandomRequest generates a request for the GenerateRandom operation.
func (c *KMS) GenerateRandomRequest(input *GenerateRandomInput) (req *aws.Request, output *GenerateRandomOutput) {
oprw.Lock()
defer oprw.Unlock()
if opGenerateRandom == nil {
opGenerateRandom = &aws.Operation{
Name: "GenerateRandom",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &GenerateRandomInput{}
}
req = c.newRequest(opGenerateRandom, input, output)
output = &GenerateRandomOutput{}
req.Data = output
return
}
// Generates an unpredictable byte string.
func (c *KMS) GenerateRandom(input *GenerateRandomInput) (*GenerateRandomOutput, error) {
req, out := c.GenerateRandomRequest(input)
err := req.Send()
return out, err
}
var opGenerateRandom *aws.Operation
// GetKeyPolicyRequest generates a request for the GetKeyPolicy operation.
func (c *KMS) GetKeyPolicyRequest(input *GetKeyPolicyInput) (req *aws.Request, output *GetKeyPolicyOutput) {
oprw.Lock()
defer oprw.Unlock()
if opGetKeyPolicy == nil {
opGetKeyPolicy = &aws.Operation{
Name: "GetKeyPolicy",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &GetKeyPolicyInput{}
}
req = c.newRequest(opGetKeyPolicy, input, output)
output = &GetKeyPolicyOutput{}
req.Data = output
return
}
// Retrieves a policy attached to the specified key.
func (c *KMS) GetKeyPolicy(input *GetKeyPolicyInput) (*GetKeyPolicyOutput, error) {
req, out := c.GetKeyPolicyRequest(input)
err := req.Send()
return out, err
}
var opGetKeyPolicy *aws.Operation
// GetKeyRotationStatusRequest generates a request for the GetKeyRotationStatus operation.
func (c *KMS) GetKeyRotationStatusRequest(input *GetKeyRotationStatusInput) (req *aws.Request, output *GetKeyRotationStatusOutput) {
oprw.Lock()
defer oprw.Unlock()
if opGetKeyRotationStatus == nil {
opGetKeyRotationStatus = &aws.Operation{
Name: "GetKeyRotationStatus",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &GetKeyRotationStatusInput{}
}
req = c.newRequest(opGetKeyRotationStatus, input, output)
output = &GetKeyRotationStatusOutput{}
req.Data = output
return
}
// Retrieves a Boolean value that indicates whether key rotation is enabled
// for the specified key.
func (c *KMS) GetKeyRotationStatus(input *GetKeyRotationStatusInput) (*GetKeyRotationStatusOutput, error) {
req, out := c.GetKeyRotationStatusRequest(input)
err := req.Send()
return out, err
}
var opGetKeyRotationStatus *aws.Operation
// ListAliasesRequest generates a request for the ListAliases operation.
func (c *KMS) ListAliasesRequest(input *ListAliasesInput) (req *aws.Request, output *ListAliasesOutput) {
oprw.Lock()
defer oprw.Unlock()
if opListAliases == nil {
opListAliases = &aws.Operation{
Name: "ListAliases",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &ListAliasesInput{}
}
req = c.newRequest(opListAliases, input, output)
output = &ListAliasesOutput{}
req.Data = output
return
}
// Lists all of the key aliases in the account.
func (c *KMS) ListAliases(input *ListAliasesInput) (*ListAliasesOutput, error) {
req, out := c.ListAliasesRequest(input)
err := req.Send()
return out, err
}
var opListAliases *aws.Operation
// ListGrantsRequest generates a request for the ListGrants operation.
func (c *KMS) ListGrantsRequest(input *ListGrantsInput) (req *aws.Request, output *ListGrantsOutput) {
oprw.Lock()
defer oprw.Unlock()
if opListGrants == nil {
opListGrants = &aws.Operation{
Name: "ListGrants",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &ListGrantsInput{}
}
req = c.newRequest(opListGrants, input, output)
output = &ListGrantsOutput{}
req.Data = output
return
}
// List the grants for a specified key.
func (c *KMS) ListGrants(input *ListGrantsInput) (*ListGrantsOutput, error) {
req, out := c.ListGrantsRequest(input)
err := req.Send()
return out, err
}
var opListGrants *aws.Operation
// ListKeyPoliciesRequest generates a request for the ListKeyPolicies operation.
func (c *KMS) ListKeyPoliciesRequest(input *ListKeyPoliciesInput) (req *aws.Request, output *ListKeyPoliciesOutput) {
oprw.Lock()
defer oprw.Unlock()
if opListKeyPolicies == nil {
opListKeyPolicies = &aws.Operation{
Name: "ListKeyPolicies",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &ListKeyPoliciesInput{}
}
req = c.newRequest(opListKeyPolicies, input, output)
output = &ListKeyPoliciesOutput{}
req.Data = output
return
}
// Retrieves a list of policies attached to a key.
func (c *KMS) ListKeyPolicies(input *ListKeyPoliciesInput) (*ListKeyPoliciesOutput, error) {
req, out := c.ListKeyPoliciesRequest(input)
err := req.Send()
return out, err
}
var opListKeyPolicies *aws.Operation
// ListKeysRequest generates a request for the ListKeys operation.
func (c *KMS) ListKeysRequest(input *ListKeysInput) (req *aws.Request, output *ListKeysOutput) {
oprw.Lock()
defer oprw.Unlock()
if opListKeys == nil {
opListKeys = &aws.Operation{
Name: "ListKeys",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &ListKeysInput{}
}
req = c.newRequest(opListKeys, input, output)
output = &ListKeysOutput{}
req.Data = output
return
}
// Lists the customer master keys.
func (c *KMS) ListKeys(input *ListKeysInput) (*ListKeysOutput, error) {
req, out := c.ListKeysRequest(input)
err := req.Send()
return out, err
}
var opListKeys *aws.Operation
// PutKeyPolicyRequest generates a request for the PutKeyPolicy operation.
func (c *KMS) PutKeyPolicyRequest(input *PutKeyPolicyInput) (req *aws.Request, output *PutKeyPolicyOutput) {
oprw.Lock()
defer oprw.Unlock()
if opPutKeyPolicy == nil {
opPutKeyPolicy = &aws.Operation{
Name: "PutKeyPolicy",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &PutKeyPolicyInput{}
}
req = c.newRequest(opPutKeyPolicy, input, output)
output = &PutKeyPolicyOutput{}
req.Data = output
return
}
// Attaches a policy to the specified key.
func (c *KMS) PutKeyPolicy(input *PutKeyPolicyInput) (*PutKeyPolicyOutput, error) {
req, out := c.PutKeyPolicyRequest(input)
err := req.Send()
return out, err
}
var opPutKeyPolicy *aws.Operation
// ReEncryptRequest generates a request for the ReEncrypt operation.
func (c *KMS) ReEncryptRequest(input *ReEncryptInput) (req *aws.Request, output *ReEncryptOutput) {
oprw.Lock()
defer oprw.Unlock()
if opReEncrypt == nil {
opReEncrypt = &aws.Operation{
Name: "ReEncrypt",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &ReEncryptInput{}
}
req = c.newRequest(opReEncrypt, input, output)
output = &ReEncryptOutput{}
req.Data = output
return
}
// Encrypts data on the server side with a new customer master key without exposing
// the plaintext of the data on the client side. The data is first decrypted
// and then encrypted. This operation can also be used to change the encryption
// context of a ciphertext.
//
// Unlike other actions, ReEncrypt is authorized twice - once as ReEncryptFrom
// on the source key and once as ReEncryptTo on the destination key. We therefore
// recommend that you include the "action":"kms:ReEncrypt*" statement in your
// key policies to permit re-encryption from or to the key. The statement is
// included automatically when you authorize use of the key through the console
// but must be included manually when you set a policy by using the PutKeyPolicy
// function.
func (c *KMS) ReEncrypt(input *ReEncryptInput) (*ReEncryptOutput, error) {
req, out := c.ReEncryptRequest(input)
err := req.Send()
return out, err
}
var opReEncrypt *aws.Operation
// RetireGrantRequest generates a request for the RetireGrant operation.
func (c *KMS) RetireGrantRequest(input *RetireGrantInput) (req *aws.Request, output *RetireGrantOutput) {
oprw.Lock()
defer oprw.Unlock()
if opRetireGrant == nil {
opRetireGrant = &aws.Operation{
Name: "RetireGrant",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &RetireGrantInput{}
}
req = c.newRequest(opRetireGrant, input, output)
output = &RetireGrantOutput{}
req.Data = output
return
}
// Retires a grant. You can retire a grant when you're done using it to clean
// up. You should revoke a grant when you intend to actively deny operations
// that depend on it. The following are permitted to call this API: The account
// that created the grant The RetiringPrincipal, if present The GranteePrincipal,
// if RetireGrant is a grantee operation The grant to retire must be identified
// by its grant token or by a combination of the key ARN and the grant ID. A
// grant token is a unique variable-length base64-encoded string. A grant ID
// is a 64 character unique identifier of a grant. Both are returned by the
// CreateGrant function.
func (c *KMS) RetireGrant(input *RetireGrantInput) (*RetireGrantOutput, error) {
req, out := c.RetireGrantRequest(input)
err := req.Send()
return out, err
}
var opRetireGrant *aws.Operation
// RevokeGrantRequest generates a request for the RevokeGrant operation.
func (c *KMS) RevokeGrantRequest(input *RevokeGrantInput) (req *aws.Request, output *RevokeGrantOutput) {
oprw.Lock()
defer oprw.Unlock()
if opRevokeGrant == nil {
opRevokeGrant = &aws.Operation{
Name: "RevokeGrant",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &RevokeGrantInput{}
}
req = c.newRequest(opRevokeGrant, input, output)
output = &RevokeGrantOutput{}
req.Data = output
return
}
// Revokes a grant. You can revoke a grant to actively deny operations that
// depend on it.
func (c *KMS) RevokeGrant(input *RevokeGrantInput) (*RevokeGrantOutput, error) {
req, out := c.RevokeGrantRequest(input)
err := req.Send()
return out, err
}
var opRevokeGrant *aws.Operation
// UpdateAliasRequest generates a request for the UpdateAlias operation.
func (c *KMS) UpdateAliasRequest(input *UpdateAliasInput) (req *aws.Request, output *UpdateAliasOutput) {
oprw.Lock()
defer oprw.Unlock()
if opUpdateAlias == nil {
opUpdateAlias = &aws.Operation{
Name: "UpdateAlias",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &UpdateAliasInput{}
}
req = c.newRequest(opUpdateAlias, input, output)
output = &UpdateAliasOutput{}
req.Data = output
return
}
// Updates an alias to associate it with a different key.
//
// An alias name can contain only alphanumeric characters, forward slashes
// (/), underscores (_), and dashes (-). An alias must start with the word "alias"
// followed by a forward slash (alias/). An alias that begins with "aws" after
// the forward slash (alias/aws...) is reserved by Amazon Web Services (AWS).
//
// An alias is not a property of a key. Therefore, an alias can be associated
// with and disassociated from an existing key without changing the properties
// of the key.
//
// Note that you cannot create or update an alias that represents a key in
// another account.
func (c *KMS) UpdateAlias(input *UpdateAliasInput) (*UpdateAliasOutput, error) {
req, out := c.UpdateAliasRequest(input)
err := req.Send()
return out, err
}
var opUpdateAlias *aws.Operation
// UpdateKeyDescriptionRequest generates a request for the UpdateKeyDescription operation.
func (c *KMS) UpdateKeyDescriptionRequest(input *UpdateKeyDescriptionInput) (req *aws.Request, output *UpdateKeyDescriptionOutput) {
oprw.Lock()
defer oprw.Unlock()
if opUpdateKeyDescription == nil {
opUpdateKeyDescription = &aws.Operation{
Name: "UpdateKeyDescription",
HTTPMethod: "POST",
HTTPPath: "/",
}
}
if input == nil {
input = &UpdateKeyDescriptionInput{}
}
req = c.newRequest(opUpdateKeyDescription, input, output)
output = &UpdateKeyDescriptionOutput{}
req.Data = output
return
}
// Updates the description of a key.
func (c *KMS) UpdateKeyDescription(input *UpdateKeyDescriptionInput) (*UpdateKeyDescriptionOutput, error) {
req, out := c.UpdateKeyDescriptionRequest(input)
err := req.Send()
return out, err
}
var opUpdateKeyDescription *aws.Operation
// Contains information about an alias.
type AliasListEntry struct {
// String that contains the key ARN.
AliasARN *string `locationName:"AliasArn" type:"string"`
// String that contains the alias.
AliasName *string `type:"string"`
// String that contains the key identifier pointed to by the alias.
TargetKeyID *string `locationName:"TargetKeyId" type:"string"`
metadataAliasListEntry `json:"-" xml:"-"`
}
type metadataAliasListEntry struct {
SDKShapeTraits bool `type:"structure"`
}
type CreateAliasInput struct {
// String that contains the display name. The name must start with the word
// "alias" followed by a forward slash (alias/). Aliases that begin with "alias/AWS"
// are reserved.
AliasName *string `type:"string" required:"true"`
// An identifier of the key for which you are creating the alias. This value
// cannot be another alias but can be a globally unique identifier or a fully
// specified ARN to a key. Key ARN Example - arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
// Globally Unique Key ID Example - 12345678-1234-1234-1234-123456789012
TargetKeyID *string `locationName:"TargetKeyId" type:"string" required:"true"`
metadataCreateAliasInput `json:"-" xml:"-"`
}
type metadataCreateAliasInput struct {
SDKShapeTraits bool `type:"structure"`
}
type CreateAliasOutput struct {
metadataCreateAliasOutput `json:"-" xml:"-"`
}