github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/redshift/snapshotCopyGrant.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package redshift 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Creates a snapshot copy grant that allows AWS Redshift to encrypt copied snapshots with a customer master key from AWS KMS in a destination region. 16 // 17 // Note that the grant must exist in the destination region, and not in the region of the cluster. 18 // 19 // ## Example Usage 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/redshift" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // 32 // func main() { 33 // pulumi.Run(func(ctx *pulumi.Context) error { 34 // test, err := redshift.NewSnapshotCopyGrant(ctx, "test", &redshift.SnapshotCopyGrantArgs{ 35 // SnapshotCopyGrantName: pulumi.String("my-grant"), 36 // }) 37 // if err != nil { 38 // return err 39 // } 40 // _, err = redshift.NewCluster(ctx, "test", &redshift.ClusterArgs{ 41 // SnapshotCopy: &redshift.ClusterSnapshotCopyArgs{ 42 // DestinationRegion: pulumi.String("us-east-2"), 43 // GrantName: test.SnapshotCopyGrantName, 44 // }, 45 // }) 46 // if err != nil { 47 // return err 48 // } 49 // return nil 50 // }) 51 // } 52 // 53 // ``` 54 // <!--End PulumiCodeChooser --> 55 // 56 // ## Import 57 // 58 // Using `pulumi import`, import Redshift Snapshot Copy Grants by name. For example: 59 // 60 // ```sh 61 // $ pulumi import aws:redshift/snapshotCopyGrant:SnapshotCopyGrant test my-grant 62 // ``` 63 type SnapshotCopyGrant struct { 64 pulumi.CustomResourceState 65 66 // Amazon Resource Name (ARN) of snapshot copy grant 67 Arn pulumi.StringOutput `pulumi:"arn"` 68 // The unique identifier for the customer master key (CMK) that the grant applies to. Specify the key ID or the Amazon Resource Name (ARN) of the CMK. To specify a CMK in a different AWS account, you must use the key ARN. If not specified, the default key is used. 69 KmsKeyId pulumi.StringOutput `pulumi:"kmsKeyId"` 70 // A friendly name for identifying the grant. 71 SnapshotCopyGrantName pulumi.StringOutput `pulumi:"snapshotCopyGrantName"` 72 // A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 73 Tags pulumi.StringMapOutput `pulumi:"tags"` 74 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 75 // 76 // Deprecated: Please use `tags` instead. 77 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 78 } 79 80 // NewSnapshotCopyGrant registers a new resource with the given unique name, arguments, and options. 81 func NewSnapshotCopyGrant(ctx *pulumi.Context, 82 name string, args *SnapshotCopyGrantArgs, opts ...pulumi.ResourceOption) (*SnapshotCopyGrant, error) { 83 if args == nil { 84 return nil, errors.New("missing one or more required arguments") 85 } 86 87 if args.SnapshotCopyGrantName == nil { 88 return nil, errors.New("invalid value for required argument 'SnapshotCopyGrantName'") 89 } 90 opts = internal.PkgResourceDefaultOpts(opts) 91 var resource SnapshotCopyGrant 92 err := ctx.RegisterResource("aws:redshift/snapshotCopyGrant:SnapshotCopyGrant", name, args, &resource, opts...) 93 if err != nil { 94 return nil, err 95 } 96 return &resource, nil 97 } 98 99 // GetSnapshotCopyGrant gets an existing SnapshotCopyGrant resource's state with the given name, ID, and optional 100 // state properties that are used to uniquely qualify the lookup (nil if not required). 101 func GetSnapshotCopyGrant(ctx *pulumi.Context, 102 name string, id pulumi.IDInput, state *SnapshotCopyGrantState, opts ...pulumi.ResourceOption) (*SnapshotCopyGrant, error) { 103 var resource SnapshotCopyGrant 104 err := ctx.ReadResource("aws:redshift/snapshotCopyGrant:SnapshotCopyGrant", name, id, state, &resource, opts...) 105 if err != nil { 106 return nil, err 107 } 108 return &resource, nil 109 } 110 111 // Input properties used for looking up and filtering SnapshotCopyGrant resources. 112 type snapshotCopyGrantState struct { 113 // Amazon Resource Name (ARN) of snapshot copy grant 114 Arn *string `pulumi:"arn"` 115 // The unique identifier for the customer master key (CMK) that the grant applies to. Specify the key ID or the Amazon Resource Name (ARN) of the CMK. To specify a CMK in a different AWS account, you must use the key ARN. If not specified, the default key is used. 116 KmsKeyId *string `pulumi:"kmsKeyId"` 117 // A friendly name for identifying the grant. 118 SnapshotCopyGrantName *string `pulumi:"snapshotCopyGrantName"` 119 // A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 120 Tags map[string]string `pulumi:"tags"` 121 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 122 // 123 // Deprecated: Please use `tags` instead. 124 TagsAll map[string]string `pulumi:"tagsAll"` 125 } 126 127 type SnapshotCopyGrantState struct { 128 // Amazon Resource Name (ARN) of snapshot copy grant 129 Arn pulumi.StringPtrInput 130 // The unique identifier for the customer master key (CMK) that the grant applies to. Specify the key ID or the Amazon Resource Name (ARN) of the CMK. To specify a CMK in a different AWS account, you must use the key ARN. If not specified, the default key is used. 131 KmsKeyId pulumi.StringPtrInput 132 // A friendly name for identifying the grant. 133 SnapshotCopyGrantName pulumi.StringPtrInput 134 // A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 135 Tags pulumi.StringMapInput 136 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 137 // 138 // Deprecated: Please use `tags` instead. 139 TagsAll pulumi.StringMapInput 140 } 141 142 func (SnapshotCopyGrantState) ElementType() reflect.Type { 143 return reflect.TypeOf((*snapshotCopyGrantState)(nil)).Elem() 144 } 145 146 type snapshotCopyGrantArgs struct { 147 // The unique identifier for the customer master key (CMK) that the grant applies to. Specify the key ID or the Amazon Resource Name (ARN) of the CMK. To specify a CMK in a different AWS account, you must use the key ARN. If not specified, the default key is used. 148 KmsKeyId *string `pulumi:"kmsKeyId"` 149 // A friendly name for identifying the grant. 150 SnapshotCopyGrantName string `pulumi:"snapshotCopyGrantName"` 151 // A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 152 Tags map[string]string `pulumi:"tags"` 153 } 154 155 // The set of arguments for constructing a SnapshotCopyGrant resource. 156 type SnapshotCopyGrantArgs struct { 157 // The unique identifier for the customer master key (CMK) that the grant applies to. Specify the key ID or the Amazon Resource Name (ARN) of the CMK. To specify a CMK in a different AWS account, you must use the key ARN. If not specified, the default key is used. 158 KmsKeyId pulumi.StringPtrInput 159 // A friendly name for identifying the grant. 160 SnapshotCopyGrantName pulumi.StringInput 161 // A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 162 Tags pulumi.StringMapInput 163 } 164 165 func (SnapshotCopyGrantArgs) ElementType() reflect.Type { 166 return reflect.TypeOf((*snapshotCopyGrantArgs)(nil)).Elem() 167 } 168 169 type SnapshotCopyGrantInput interface { 170 pulumi.Input 171 172 ToSnapshotCopyGrantOutput() SnapshotCopyGrantOutput 173 ToSnapshotCopyGrantOutputWithContext(ctx context.Context) SnapshotCopyGrantOutput 174 } 175 176 func (*SnapshotCopyGrant) ElementType() reflect.Type { 177 return reflect.TypeOf((**SnapshotCopyGrant)(nil)).Elem() 178 } 179 180 func (i *SnapshotCopyGrant) ToSnapshotCopyGrantOutput() SnapshotCopyGrantOutput { 181 return i.ToSnapshotCopyGrantOutputWithContext(context.Background()) 182 } 183 184 func (i *SnapshotCopyGrant) ToSnapshotCopyGrantOutputWithContext(ctx context.Context) SnapshotCopyGrantOutput { 185 return pulumi.ToOutputWithContext(ctx, i).(SnapshotCopyGrantOutput) 186 } 187 188 // SnapshotCopyGrantArrayInput is an input type that accepts SnapshotCopyGrantArray and SnapshotCopyGrantArrayOutput values. 189 // You can construct a concrete instance of `SnapshotCopyGrantArrayInput` via: 190 // 191 // SnapshotCopyGrantArray{ SnapshotCopyGrantArgs{...} } 192 type SnapshotCopyGrantArrayInput interface { 193 pulumi.Input 194 195 ToSnapshotCopyGrantArrayOutput() SnapshotCopyGrantArrayOutput 196 ToSnapshotCopyGrantArrayOutputWithContext(context.Context) SnapshotCopyGrantArrayOutput 197 } 198 199 type SnapshotCopyGrantArray []SnapshotCopyGrantInput 200 201 func (SnapshotCopyGrantArray) ElementType() reflect.Type { 202 return reflect.TypeOf((*[]*SnapshotCopyGrant)(nil)).Elem() 203 } 204 205 func (i SnapshotCopyGrantArray) ToSnapshotCopyGrantArrayOutput() SnapshotCopyGrantArrayOutput { 206 return i.ToSnapshotCopyGrantArrayOutputWithContext(context.Background()) 207 } 208 209 func (i SnapshotCopyGrantArray) ToSnapshotCopyGrantArrayOutputWithContext(ctx context.Context) SnapshotCopyGrantArrayOutput { 210 return pulumi.ToOutputWithContext(ctx, i).(SnapshotCopyGrantArrayOutput) 211 } 212 213 // SnapshotCopyGrantMapInput is an input type that accepts SnapshotCopyGrantMap and SnapshotCopyGrantMapOutput values. 214 // You can construct a concrete instance of `SnapshotCopyGrantMapInput` via: 215 // 216 // SnapshotCopyGrantMap{ "key": SnapshotCopyGrantArgs{...} } 217 type SnapshotCopyGrantMapInput interface { 218 pulumi.Input 219 220 ToSnapshotCopyGrantMapOutput() SnapshotCopyGrantMapOutput 221 ToSnapshotCopyGrantMapOutputWithContext(context.Context) SnapshotCopyGrantMapOutput 222 } 223 224 type SnapshotCopyGrantMap map[string]SnapshotCopyGrantInput 225 226 func (SnapshotCopyGrantMap) ElementType() reflect.Type { 227 return reflect.TypeOf((*map[string]*SnapshotCopyGrant)(nil)).Elem() 228 } 229 230 func (i SnapshotCopyGrantMap) ToSnapshotCopyGrantMapOutput() SnapshotCopyGrantMapOutput { 231 return i.ToSnapshotCopyGrantMapOutputWithContext(context.Background()) 232 } 233 234 func (i SnapshotCopyGrantMap) ToSnapshotCopyGrantMapOutputWithContext(ctx context.Context) SnapshotCopyGrantMapOutput { 235 return pulumi.ToOutputWithContext(ctx, i).(SnapshotCopyGrantMapOutput) 236 } 237 238 type SnapshotCopyGrantOutput struct{ *pulumi.OutputState } 239 240 func (SnapshotCopyGrantOutput) ElementType() reflect.Type { 241 return reflect.TypeOf((**SnapshotCopyGrant)(nil)).Elem() 242 } 243 244 func (o SnapshotCopyGrantOutput) ToSnapshotCopyGrantOutput() SnapshotCopyGrantOutput { 245 return o 246 } 247 248 func (o SnapshotCopyGrantOutput) ToSnapshotCopyGrantOutputWithContext(ctx context.Context) SnapshotCopyGrantOutput { 249 return o 250 } 251 252 // Amazon Resource Name (ARN) of snapshot copy grant 253 func (o SnapshotCopyGrantOutput) Arn() pulumi.StringOutput { 254 return o.ApplyT(func(v *SnapshotCopyGrant) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 255 } 256 257 // The unique identifier for the customer master key (CMK) that the grant applies to. Specify the key ID or the Amazon Resource Name (ARN) of the CMK. To specify a CMK in a different AWS account, you must use the key ARN. If not specified, the default key is used. 258 func (o SnapshotCopyGrantOutput) KmsKeyId() pulumi.StringOutput { 259 return o.ApplyT(func(v *SnapshotCopyGrant) pulumi.StringOutput { return v.KmsKeyId }).(pulumi.StringOutput) 260 } 261 262 // A friendly name for identifying the grant. 263 func (o SnapshotCopyGrantOutput) SnapshotCopyGrantName() pulumi.StringOutput { 264 return o.ApplyT(func(v *SnapshotCopyGrant) pulumi.StringOutput { return v.SnapshotCopyGrantName }).(pulumi.StringOutput) 265 } 266 267 // A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 268 func (o SnapshotCopyGrantOutput) Tags() pulumi.StringMapOutput { 269 return o.ApplyT(func(v *SnapshotCopyGrant) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 270 } 271 272 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 273 // 274 // Deprecated: Please use `tags` instead. 275 func (o SnapshotCopyGrantOutput) TagsAll() pulumi.StringMapOutput { 276 return o.ApplyT(func(v *SnapshotCopyGrant) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 277 } 278 279 type SnapshotCopyGrantArrayOutput struct{ *pulumi.OutputState } 280 281 func (SnapshotCopyGrantArrayOutput) ElementType() reflect.Type { 282 return reflect.TypeOf((*[]*SnapshotCopyGrant)(nil)).Elem() 283 } 284 285 func (o SnapshotCopyGrantArrayOutput) ToSnapshotCopyGrantArrayOutput() SnapshotCopyGrantArrayOutput { 286 return o 287 } 288 289 func (o SnapshotCopyGrantArrayOutput) ToSnapshotCopyGrantArrayOutputWithContext(ctx context.Context) SnapshotCopyGrantArrayOutput { 290 return o 291 } 292 293 func (o SnapshotCopyGrantArrayOutput) Index(i pulumi.IntInput) SnapshotCopyGrantOutput { 294 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SnapshotCopyGrant { 295 return vs[0].([]*SnapshotCopyGrant)[vs[1].(int)] 296 }).(SnapshotCopyGrantOutput) 297 } 298 299 type SnapshotCopyGrantMapOutput struct{ *pulumi.OutputState } 300 301 func (SnapshotCopyGrantMapOutput) ElementType() reflect.Type { 302 return reflect.TypeOf((*map[string]*SnapshotCopyGrant)(nil)).Elem() 303 } 304 305 func (o SnapshotCopyGrantMapOutput) ToSnapshotCopyGrantMapOutput() SnapshotCopyGrantMapOutput { 306 return o 307 } 308 309 func (o SnapshotCopyGrantMapOutput) ToSnapshotCopyGrantMapOutputWithContext(ctx context.Context) SnapshotCopyGrantMapOutput { 310 return o 311 } 312 313 func (o SnapshotCopyGrantMapOutput) MapIndex(k pulumi.StringInput) SnapshotCopyGrantOutput { 314 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SnapshotCopyGrant { 315 return vs[0].(map[string]*SnapshotCopyGrant)[vs[1].(string)] 316 }).(SnapshotCopyGrantOutput) 317 } 318 319 func init() { 320 pulumi.RegisterInputType(reflect.TypeOf((*SnapshotCopyGrantInput)(nil)).Elem(), &SnapshotCopyGrant{}) 321 pulumi.RegisterInputType(reflect.TypeOf((*SnapshotCopyGrantArrayInput)(nil)).Elem(), SnapshotCopyGrantArray{}) 322 pulumi.RegisterInputType(reflect.TypeOf((*SnapshotCopyGrantMapInput)(nil)).Elem(), SnapshotCopyGrantMap{}) 323 pulumi.RegisterOutputType(SnapshotCopyGrantOutput{}) 324 pulumi.RegisterOutputType(SnapshotCopyGrantArrayOutput{}) 325 pulumi.RegisterOutputType(SnapshotCopyGrantMapOutput{}) 326 }