/
replicaKey.go
202 lines (170 loc) · 9.83 KB
/
replicaKey.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
// Code generated by pulumi-language-go DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package kms
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aws-native/sdk/go/aws"
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// The AWS::KMS::ReplicaKey resource specifies a multi-region replica AWS KMS key in AWS Key Management Service (AWS KMS).
type ReplicaKey struct {
pulumi.CustomResourceState
Arn pulumi.StringOutput `pulumi:"arn"`
// A description of the AWS KMS key. Use a description that helps you to distinguish this AWS KMS key from others in the account, such as its intended use.
Description pulumi.StringPtrOutput `pulumi:"description"`
// Specifies whether the AWS KMS key is enabled. Disabled AWS KMS keys cannot be used in cryptographic operations.
Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
KeyId pulumi.StringOutput `pulumi:"keyId"`
// The key policy that authorizes use of the AWS KMS key. The key policy must observe the following rules.
//
// Search the [CloudFormation User Guide](https://docs.aws.amazon.com/cloudformation/) for `AWS::KMS::ReplicaKey` for more information about the expected schema for this property.
KeyPolicy pulumi.AnyOutput `pulumi:"keyPolicy"`
// Specifies the number of days in the waiting period before AWS KMS deletes an AWS KMS key that has been removed from a CloudFormation stack. Enter a value between 7 and 30 days. The default value is 30 days.
PendingWindowInDays pulumi.IntPtrOutput `pulumi:"pendingWindowInDays"`
// Identifies the primary AWS KMS key to create a replica of. Specify the Amazon Resource Name (ARN) of the AWS KMS key. You cannot specify an alias or key ID. For help finding the ARN, see Finding the Key ID and ARN in the AWS Key Management Service Developer Guide.
PrimaryKeyArn pulumi.StringOutput `pulumi:"primaryKeyArn"`
// An array of key-value pairs to apply to this resource.
Tags aws.TagArrayOutput `pulumi:"tags"`
}
// NewReplicaKey registers a new resource with the given unique name, arguments, and options.
func NewReplicaKey(ctx *pulumi.Context,
name string, args *ReplicaKeyArgs, opts ...pulumi.ResourceOption) (*ReplicaKey, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.KeyPolicy == nil {
return nil, errors.New("invalid value for required argument 'KeyPolicy'")
}
if args.PrimaryKeyArn == nil {
return nil, errors.New("invalid value for required argument 'PrimaryKeyArn'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"primaryKeyArn",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource ReplicaKey
err := ctx.RegisterResource("aws-native:kms:ReplicaKey", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetReplicaKey gets an existing ReplicaKey resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetReplicaKey(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ReplicaKeyState, opts ...pulumi.ResourceOption) (*ReplicaKey, error) {
var resource ReplicaKey
err := ctx.ReadResource("aws-native:kms:ReplicaKey", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ReplicaKey resources.
type replicaKeyState struct {
}
type ReplicaKeyState struct {
}
func (ReplicaKeyState) ElementType() reflect.Type {
return reflect.TypeOf((*replicaKeyState)(nil)).Elem()
}
type replicaKeyArgs struct {
// A description of the AWS KMS key. Use a description that helps you to distinguish this AWS KMS key from others in the account, such as its intended use.
Description *string `pulumi:"description"`
// Specifies whether the AWS KMS key is enabled. Disabled AWS KMS keys cannot be used in cryptographic operations.
Enabled *bool `pulumi:"enabled"`
// The key policy that authorizes use of the AWS KMS key. The key policy must observe the following rules.
//
// Search the [CloudFormation User Guide](https://docs.aws.amazon.com/cloudformation/) for `AWS::KMS::ReplicaKey` for more information about the expected schema for this property.
KeyPolicy interface{} `pulumi:"keyPolicy"`
// Specifies the number of days in the waiting period before AWS KMS deletes an AWS KMS key that has been removed from a CloudFormation stack. Enter a value between 7 and 30 days. The default value is 30 days.
PendingWindowInDays *int `pulumi:"pendingWindowInDays"`
// Identifies the primary AWS KMS key to create a replica of. Specify the Amazon Resource Name (ARN) of the AWS KMS key. You cannot specify an alias or key ID. For help finding the ARN, see Finding the Key ID and ARN in the AWS Key Management Service Developer Guide.
PrimaryKeyArn string `pulumi:"primaryKeyArn"`
// An array of key-value pairs to apply to this resource.
Tags []aws.Tag `pulumi:"tags"`
}
// The set of arguments for constructing a ReplicaKey resource.
type ReplicaKeyArgs struct {
// A description of the AWS KMS key. Use a description that helps you to distinguish this AWS KMS key from others in the account, such as its intended use.
Description pulumi.StringPtrInput
// Specifies whether the AWS KMS key is enabled. Disabled AWS KMS keys cannot be used in cryptographic operations.
Enabled pulumi.BoolPtrInput
// The key policy that authorizes use of the AWS KMS key. The key policy must observe the following rules.
//
// Search the [CloudFormation User Guide](https://docs.aws.amazon.com/cloudformation/) for `AWS::KMS::ReplicaKey` for more information about the expected schema for this property.
KeyPolicy pulumi.Input
// Specifies the number of days in the waiting period before AWS KMS deletes an AWS KMS key that has been removed from a CloudFormation stack. Enter a value between 7 and 30 days. The default value is 30 days.
PendingWindowInDays pulumi.IntPtrInput
// Identifies the primary AWS KMS key to create a replica of. Specify the Amazon Resource Name (ARN) of the AWS KMS key. You cannot specify an alias or key ID. For help finding the ARN, see Finding the Key ID and ARN in the AWS Key Management Service Developer Guide.
PrimaryKeyArn pulumi.StringInput
// An array of key-value pairs to apply to this resource.
Tags aws.TagArrayInput
}
func (ReplicaKeyArgs) ElementType() reflect.Type {
return reflect.TypeOf((*replicaKeyArgs)(nil)).Elem()
}
type ReplicaKeyInput interface {
pulumi.Input
ToReplicaKeyOutput() ReplicaKeyOutput
ToReplicaKeyOutputWithContext(ctx context.Context) ReplicaKeyOutput
}
func (*ReplicaKey) ElementType() reflect.Type {
return reflect.TypeOf((**ReplicaKey)(nil)).Elem()
}
func (i *ReplicaKey) ToReplicaKeyOutput() ReplicaKeyOutput {
return i.ToReplicaKeyOutputWithContext(context.Background())
}
func (i *ReplicaKey) ToReplicaKeyOutputWithContext(ctx context.Context) ReplicaKeyOutput {
return pulumi.ToOutputWithContext(ctx, i).(ReplicaKeyOutput)
}
type ReplicaKeyOutput struct{ *pulumi.OutputState }
func (ReplicaKeyOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ReplicaKey)(nil)).Elem()
}
func (o ReplicaKeyOutput) ToReplicaKeyOutput() ReplicaKeyOutput {
return o
}
func (o ReplicaKeyOutput) ToReplicaKeyOutputWithContext(ctx context.Context) ReplicaKeyOutput {
return o
}
func (o ReplicaKeyOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v *ReplicaKey) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
}
// A description of the AWS KMS key. Use a description that helps you to distinguish this AWS KMS key from others in the account, such as its intended use.
func (o ReplicaKeyOutput) Description() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ReplicaKey) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
}
// Specifies whether the AWS KMS key is enabled. Disabled AWS KMS keys cannot be used in cryptographic operations.
func (o ReplicaKeyOutput) Enabled() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *ReplicaKey) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput)
}
func (o ReplicaKeyOutput) KeyId() pulumi.StringOutput {
return o.ApplyT(func(v *ReplicaKey) pulumi.StringOutput { return v.KeyId }).(pulumi.StringOutput)
}
// The key policy that authorizes use of the AWS KMS key. The key policy must observe the following rules.
//
// Search the [CloudFormation User Guide](https://docs.aws.amazon.com/cloudformation/) for `AWS::KMS::ReplicaKey` for more information about the expected schema for this property.
func (o ReplicaKeyOutput) KeyPolicy() pulumi.AnyOutput {
return o.ApplyT(func(v *ReplicaKey) pulumi.AnyOutput { return v.KeyPolicy }).(pulumi.AnyOutput)
}
// Specifies the number of days in the waiting period before AWS KMS deletes an AWS KMS key that has been removed from a CloudFormation stack. Enter a value between 7 and 30 days. The default value is 30 days.
func (o ReplicaKeyOutput) PendingWindowInDays() pulumi.IntPtrOutput {
return o.ApplyT(func(v *ReplicaKey) pulumi.IntPtrOutput { return v.PendingWindowInDays }).(pulumi.IntPtrOutput)
}
// Identifies the primary AWS KMS key to create a replica of. Specify the Amazon Resource Name (ARN) of the AWS KMS key. You cannot specify an alias or key ID. For help finding the ARN, see Finding the Key ID and ARN in the AWS Key Management Service Developer Guide.
func (o ReplicaKeyOutput) PrimaryKeyArn() pulumi.StringOutput {
return o.ApplyT(func(v *ReplicaKey) pulumi.StringOutput { return v.PrimaryKeyArn }).(pulumi.StringOutput)
}
// An array of key-value pairs to apply to this resource.
func (o ReplicaKeyOutput) Tags() aws.TagArrayOutput {
return o.ApplyT(func(v *ReplicaKey) aws.TagArrayOutput { return v.Tags }).(aws.TagArrayOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ReplicaKeyInput)(nil)).Elem(), &ReplicaKey{})
pulumi.RegisterOutputType(ReplicaKeyOutput{})
}