| 1 |
package kms |
| 2 |
|
| 3 |
import "github.com/denverdino/aliyungo/common" |
| 4 |
|
| 5 |
|
| 6 |
type CancelKeyDeletionArgs struct { |
| 7 |
KeyId string |
| 8 |
} |
| 9 |
|
| 10 |
type CancelKeyDeletionResponse struct { |
| 11 |
common.Response |
| 12 |
} |
| 13 |
|
| 14 |
func (client *Client) CancelKeyDeletion(keyId string) (*CancelKeyDeletionResponse, error) { |
| 15 |
args := &CancelKeyDeletionArgs{ |
| 16 |
KeyId: keyId, |
| 17 |
} |
| 18 |
response := &CancelKeyDeletionResponse{} |
| 19 |
err := client.Invoke("CancelKeyDeletion", args, response) |
| 20 |
return response, err |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
type KeyUsage string |
| 25 |
|
| 26 |
const ( |
| 27 |
KEY_USAGE_ENCRYPT_DECRYPT = KeyUsage("ENCRYPT/DECRYPT") |
| 28 |
) |
| 29 |
|
| 30 |
type CreateKeyArgs struct { |
| 31 |
KeyUsage KeyUsage |
| 32 |
Description string |
| 33 |
} |
| 34 |
|
| 35 |
type KeyMetadata struct { |
| 36 |
CreationDate string |
| 37 |
Description string |
| 38 |
KeyId string |
| 39 |
KeyState string |
| 40 |
KeyUsage string |
| 41 |
DeleteDate string |
| 42 |
Creator string |
| 43 |
Arn string |
| 44 |
} |
| 45 |
|
| 46 |
type CreateKeyResponse struct { |
| 47 |
common.Response |
| 48 |
KeyMetadata KeyMetadata |
| 49 |
} |
| 50 |
|
| 51 |
func (client *Client) CreateKey(args *CreateKeyArgs) (*CreateKeyResponse, error) { |
| 52 |
response := &CreateKeyResponse{} |
| 53 |
err := client.Invoke("CreateKey", args, response) |
| 54 |
return response, err |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
type DescribeKeyArgs struct { |
| 59 |
KeyId string |
| 60 |
} |
| 61 |
|
| 62 |
type DescribeKeyResponse struct { |
| 63 |
common.Response |
| 64 |
KeyMetadata KeyMetadata |
| 65 |
} |
| 66 |
|
| 67 |
func (client *Client) DescribeKey(keyId string) (*DescribeKeyResponse, error) { |
| 68 |
response := &DescribeKeyResponse{} |
| 69 |
err := client.Invoke("DescribeKey", &DescribeKeyArgs{KeyId: keyId}, response) |
| 70 |
return response, err |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
type DisableKeyArgs struct { |
| 75 |
KeyId string |
| 76 |
} |
| 77 |
|
| 78 |
type DisableKeyResponse struct { |
| 79 |
common.Response |
| 80 |
} |
| 81 |
|
| 82 |
func (client *Client) DisableKey(keyId string) (*DisableKeyResponse, error) { |
| 83 |
response := &DisableKeyResponse{} |
| 84 |
err := client.Invoke("DisableKey", &DisableKeyArgs{KeyId: keyId}, response) |
| 85 |
return response, err |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
type EnableKeyArgs struct { |
| 90 |
KeyId string |
| 91 |
} |
| 92 |
|
| 93 |
type EnableKeyResponse struct { |
| 94 |
common.Response |
| 95 |
} |
| 96 |
|
| 97 |
func (client *Client) EnableKey(keyId string) (*EnableKeyResponse, error) { |
| 98 |
response := &EnableKeyResponse{} |
| 99 |
err := client.Invoke("EnableKey", &EnableKeyArgs{KeyId: keyId}, response) |
| 100 |
return response, err |
| 101 |
} |
| 102 |
|
| 103 |
|
| 104 |
type KeySpec string |
| 105 |
|
| 106 |
const ( |
| 107 |
KeySpec_AES_256 = KeySpec("AES_256") |
| 108 |
KeySpec_AES_128 = KeySpec("AES_128") |
| 109 |
) |
| 110 |
|
| 111 |
type GenerateDataKeyArgs struct { |
| 112 |
KeyId string |
| 113 |
KeySpec KeySpec |
| 114 |
NumberOfBytes int |
| 115 |
EncryptionContext map[string]string |
| 116 |
} |
| 117 |
|
| 118 |
type GenerateDataKeyResponse struct { |
| 119 |
common.Response |
| 120 |
CiphertextBlob string |
| 121 |
KeyId string |
| 122 |
RequestId string |
| 123 |
} |
| 124 |
|
| 125 |
func (client *Client) GenerateDataKey(args *GenerateDataKeyArgs) (*GenerateDataKeyResponse, error) { |
| 126 |
response := &GenerateDataKeyResponse{} |
| 127 |
err := client.Invoke("GenerateDataKey", args, response) |
| 128 |
return response, err |
| 129 |
} |
| 130 |
|
| 131 |
|
| 132 |
type ListKeysArgs struct { |
| 133 |
common.Pagination |
| 134 |
} |
| 135 |
|
| 136 |
type Keys struct { |
| 137 |
Key []Key |
| 138 |
} |
| 139 |
|
| 140 |
type Key struct { |
| 141 |
KeyId string |
| 142 |
KeyArn string |
| 143 |
} |
| 144 |
|
| 145 |
type ListKeysResponse struct { |
| 146 |
common.Response |
| 147 |
common.PaginationResult |
| 148 |
Keys Keys |
| 149 |
} |
| 150 |
|
| 151 |
func (client *Client) ListKeys(args *ListKeysArgs) (*ListKeysResponse, error) { |
| 152 |
response := &ListKeysResponse{} |
| 153 |
err := client.Invoke("ListKeys", args, response) |
| 154 |
return response, err |
| 155 |
} |
| 156 |
|
| 157 |
|
| 158 |
type ScheduleKeyDeletionArgs struct { |
| 159 |
KeyId string |
| 160 |
PendingWindowInDays int |
| 161 |
} |
| 162 |
|
| 163 |
type ScheduleKeyDeletionResponse struct { |
| 164 |
common.Response |
| 165 |
} |
| 166 |
|
| 167 |
func (client *Client) ScheduleKeyDeletion(args *ScheduleKeyDeletionArgs) (*ScheduleKeyDeletionResponse, error) { |
| 168 |
response := &ScheduleKeyDeletionResponse{} |
| 169 |
err := client.Invoke("ScheduleKeyDeletion", args, response) |
| 170 |
return response, err |
| 171 |
} |