github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/redshift/snapshotCopy.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 // Resource for managing an AWS Redshift Snapshot Copy. 16 // 17 // ## Example Usage 18 // 19 // ### Basic 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 // _, err := redshift.NewSnapshotCopy(ctx, "example", &redshift.SnapshotCopyArgs{ 35 // ClusterIdentifier: pulumi.Any(exampleAwsRedshiftCluster.Id), 36 // DestinationRegion: pulumi.String("us-east-1"), 37 // }) 38 // if err != nil { 39 // return err 40 // } 41 // return nil 42 // }) 43 // } 44 // 45 // ``` 46 // <!--End PulumiCodeChooser --> 47 // 48 // ## Import 49 // 50 // Using `pulumi import`, import Redshift Snapshot Copy using the `id`. For example: 51 // 52 // ```sh 53 // $ pulumi import aws:redshift/snapshotCopy:SnapshotCopy example cluster-id-12345678 54 // ``` 55 type SnapshotCopy struct { 56 pulumi.CustomResourceState 57 58 // Identifier of the source cluster. 59 ClusterIdentifier pulumi.StringOutput `pulumi:"clusterIdentifier"` 60 // AWS Region to copy snapshots to. 61 // 62 // The following arguments are optional: 63 DestinationRegion pulumi.StringOutput `pulumi:"destinationRegion"` 64 // Number of days to retain newly copied snapshots in the destination AWS Region after they are copied from the source AWS Region. If the value is `-1`, the manual snapshot is retained indefinitely. 65 ManualSnapshotRetentionPeriod pulumi.IntOutput `pulumi:"manualSnapshotRetentionPeriod"` 66 // Number of days to retain automated snapshots in the destination region after they are copied from the source region. 67 RetentionPeriod pulumi.IntOutput `pulumi:"retentionPeriod"` 68 // Name of the snapshot copy grant to use when snapshots of an AWS KMS-encrypted cluster are copied to the destination region. 69 SnapshotCopyGrantName pulumi.StringPtrOutput `pulumi:"snapshotCopyGrantName"` 70 } 71 72 // NewSnapshotCopy registers a new resource with the given unique name, arguments, and options. 73 func NewSnapshotCopy(ctx *pulumi.Context, 74 name string, args *SnapshotCopyArgs, opts ...pulumi.ResourceOption) (*SnapshotCopy, error) { 75 if args == nil { 76 return nil, errors.New("missing one or more required arguments") 77 } 78 79 if args.ClusterIdentifier == nil { 80 return nil, errors.New("invalid value for required argument 'ClusterIdentifier'") 81 } 82 if args.DestinationRegion == nil { 83 return nil, errors.New("invalid value for required argument 'DestinationRegion'") 84 } 85 opts = internal.PkgResourceDefaultOpts(opts) 86 var resource SnapshotCopy 87 err := ctx.RegisterResource("aws:redshift/snapshotCopy:SnapshotCopy", name, args, &resource, opts...) 88 if err != nil { 89 return nil, err 90 } 91 return &resource, nil 92 } 93 94 // GetSnapshotCopy gets an existing SnapshotCopy resource's state with the given name, ID, and optional 95 // state properties that are used to uniquely qualify the lookup (nil if not required). 96 func GetSnapshotCopy(ctx *pulumi.Context, 97 name string, id pulumi.IDInput, state *SnapshotCopyState, opts ...pulumi.ResourceOption) (*SnapshotCopy, error) { 98 var resource SnapshotCopy 99 err := ctx.ReadResource("aws:redshift/snapshotCopy:SnapshotCopy", name, id, state, &resource, opts...) 100 if err != nil { 101 return nil, err 102 } 103 return &resource, nil 104 } 105 106 // Input properties used for looking up and filtering SnapshotCopy resources. 107 type snapshotCopyState struct { 108 // Identifier of the source cluster. 109 ClusterIdentifier *string `pulumi:"clusterIdentifier"` 110 // AWS Region to copy snapshots to. 111 // 112 // The following arguments are optional: 113 DestinationRegion *string `pulumi:"destinationRegion"` 114 // Number of days to retain newly copied snapshots in the destination AWS Region after they are copied from the source AWS Region. If the value is `-1`, the manual snapshot is retained indefinitely. 115 ManualSnapshotRetentionPeriod *int `pulumi:"manualSnapshotRetentionPeriod"` 116 // Number of days to retain automated snapshots in the destination region after they are copied from the source region. 117 RetentionPeriod *int `pulumi:"retentionPeriod"` 118 // Name of the snapshot copy grant to use when snapshots of an AWS KMS-encrypted cluster are copied to the destination region. 119 SnapshotCopyGrantName *string `pulumi:"snapshotCopyGrantName"` 120 } 121 122 type SnapshotCopyState struct { 123 // Identifier of the source cluster. 124 ClusterIdentifier pulumi.StringPtrInput 125 // AWS Region to copy snapshots to. 126 // 127 // The following arguments are optional: 128 DestinationRegion pulumi.StringPtrInput 129 // Number of days to retain newly copied snapshots in the destination AWS Region after they are copied from the source AWS Region. If the value is `-1`, the manual snapshot is retained indefinitely. 130 ManualSnapshotRetentionPeriod pulumi.IntPtrInput 131 // Number of days to retain automated snapshots in the destination region after they are copied from the source region. 132 RetentionPeriod pulumi.IntPtrInput 133 // Name of the snapshot copy grant to use when snapshots of an AWS KMS-encrypted cluster are copied to the destination region. 134 SnapshotCopyGrantName pulumi.StringPtrInput 135 } 136 137 func (SnapshotCopyState) ElementType() reflect.Type { 138 return reflect.TypeOf((*snapshotCopyState)(nil)).Elem() 139 } 140 141 type snapshotCopyArgs struct { 142 // Identifier of the source cluster. 143 ClusterIdentifier string `pulumi:"clusterIdentifier"` 144 // AWS Region to copy snapshots to. 145 // 146 // The following arguments are optional: 147 DestinationRegion string `pulumi:"destinationRegion"` 148 // Number of days to retain newly copied snapshots in the destination AWS Region after they are copied from the source AWS Region. If the value is `-1`, the manual snapshot is retained indefinitely. 149 ManualSnapshotRetentionPeriod *int `pulumi:"manualSnapshotRetentionPeriod"` 150 // Number of days to retain automated snapshots in the destination region after they are copied from the source region. 151 RetentionPeriod *int `pulumi:"retentionPeriod"` 152 // Name of the snapshot copy grant to use when snapshots of an AWS KMS-encrypted cluster are copied to the destination region. 153 SnapshotCopyGrantName *string `pulumi:"snapshotCopyGrantName"` 154 } 155 156 // The set of arguments for constructing a SnapshotCopy resource. 157 type SnapshotCopyArgs struct { 158 // Identifier of the source cluster. 159 ClusterIdentifier pulumi.StringInput 160 // AWS Region to copy snapshots to. 161 // 162 // The following arguments are optional: 163 DestinationRegion pulumi.StringInput 164 // Number of days to retain newly copied snapshots in the destination AWS Region after they are copied from the source AWS Region. If the value is `-1`, the manual snapshot is retained indefinitely. 165 ManualSnapshotRetentionPeriod pulumi.IntPtrInput 166 // Number of days to retain automated snapshots in the destination region after they are copied from the source region. 167 RetentionPeriod pulumi.IntPtrInput 168 // Name of the snapshot copy grant to use when snapshots of an AWS KMS-encrypted cluster are copied to the destination region. 169 SnapshotCopyGrantName pulumi.StringPtrInput 170 } 171 172 func (SnapshotCopyArgs) ElementType() reflect.Type { 173 return reflect.TypeOf((*snapshotCopyArgs)(nil)).Elem() 174 } 175 176 type SnapshotCopyInput interface { 177 pulumi.Input 178 179 ToSnapshotCopyOutput() SnapshotCopyOutput 180 ToSnapshotCopyOutputWithContext(ctx context.Context) SnapshotCopyOutput 181 } 182 183 func (*SnapshotCopy) ElementType() reflect.Type { 184 return reflect.TypeOf((**SnapshotCopy)(nil)).Elem() 185 } 186 187 func (i *SnapshotCopy) ToSnapshotCopyOutput() SnapshotCopyOutput { 188 return i.ToSnapshotCopyOutputWithContext(context.Background()) 189 } 190 191 func (i *SnapshotCopy) ToSnapshotCopyOutputWithContext(ctx context.Context) SnapshotCopyOutput { 192 return pulumi.ToOutputWithContext(ctx, i).(SnapshotCopyOutput) 193 } 194 195 // SnapshotCopyArrayInput is an input type that accepts SnapshotCopyArray and SnapshotCopyArrayOutput values. 196 // You can construct a concrete instance of `SnapshotCopyArrayInput` via: 197 // 198 // SnapshotCopyArray{ SnapshotCopyArgs{...} } 199 type SnapshotCopyArrayInput interface { 200 pulumi.Input 201 202 ToSnapshotCopyArrayOutput() SnapshotCopyArrayOutput 203 ToSnapshotCopyArrayOutputWithContext(context.Context) SnapshotCopyArrayOutput 204 } 205 206 type SnapshotCopyArray []SnapshotCopyInput 207 208 func (SnapshotCopyArray) ElementType() reflect.Type { 209 return reflect.TypeOf((*[]*SnapshotCopy)(nil)).Elem() 210 } 211 212 func (i SnapshotCopyArray) ToSnapshotCopyArrayOutput() SnapshotCopyArrayOutput { 213 return i.ToSnapshotCopyArrayOutputWithContext(context.Background()) 214 } 215 216 func (i SnapshotCopyArray) ToSnapshotCopyArrayOutputWithContext(ctx context.Context) SnapshotCopyArrayOutput { 217 return pulumi.ToOutputWithContext(ctx, i).(SnapshotCopyArrayOutput) 218 } 219 220 // SnapshotCopyMapInput is an input type that accepts SnapshotCopyMap and SnapshotCopyMapOutput values. 221 // You can construct a concrete instance of `SnapshotCopyMapInput` via: 222 // 223 // SnapshotCopyMap{ "key": SnapshotCopyArgs{...} } 224 type SnapshotCopyMapInput interface { 225 pulumi.Input 226 227 ToSnapshotCopyMapOutput() SnapshotCopyMapOutput 228 ToSnapshotCopyMapOutputWithContext(context.Context) SnapshotCopyMapOutput 229 } 230 231 type SnapshotCopyMap map[string]SnapshotCopyInput 232 233 func (SnapshotCopyMap) ElementType() reflect.Type { 234 return reflect.TypeOf((*map[string]*SnapshotCopy)(nil)).Elem() 235 } 236 237 func (i SnapshotCopyMap) ToSnapshotCopyMapOutput() SnapshotCopyMapOutput { 238 return i.ToSnapshotCopyMapOutputWithContext(context.Background()) 239 } 240 241 func (i SnapshotCopyMap) ToSnapshotCopyMapOutputWithContext(ctx context.Context) SnapshotCopyMapOutput { 242 return pulumi.ToOutputWithContext(ctx, i).(SnapshotCopyMapOutput) 243 } 244 245 type SnapshotCopyOutput struct{ *pulumi.OutputState } 246 247 func (SnapshotCopyOutput) ElementType() reflect.Type { 248 return reflect.TypeOf((**SnapshotCopy)(nil)).Elem() 249 } 250 251 func (o SnapshotCopyOutput) ToSnapshotCopyOutput() SnapshotCopyOutput { 252 return o 253 } 254 255 func (o SnapshotCopyOutput) ToSnapshotCopyOutputWithContext(ctx context.Context) SnapshotCopyOutput { 256 return o 257 } 258 259 // Identifier of the source cluster. 260 func (o SnapshotCopyOutput) ClusterIdentifier() pulumi.StringOutput { 261 return o.ApplyT(func(v *SnapshotCopy) pulumi.StringOutput { return v.ClusterIdentifier }).(pulumi.StringOutput) 262 } 263 264 // AWS Region to copy snapshots to. 265 // 266 // The following arguments are optional: 267 func (o SnapshotCopyOutput) DestinationRegion() pulumi.StringOutput { 268 return o.ApplyT(func(v *SnapshotCopy) pulumi.StringOutput { return v.DestinationRegion }).(pulumi.StringOutput) 269 } 270 271 // Number of days to retain newly copied snapshots in the destination AWS Region after they are copied from the source AWS Region. If the value is `-1`, the manual snapshot is retained indefinitely. 272 func (o SnapshotCopyOutput) ManualSnapshotRetentionPeriod() pulumi.IntOutput { 273 return o.ApplyT(func(v *SnapshotCopy) pulumi.IntOutput { return v.ManualSnapshotRetentionPeriod }).(pulumi.IntOutput) 274 } 275 276 // Number of days to retain automated snapshots in the destination region after they are copied from the source region. 277 func (o SnapshotCopyOutput) RetentionPeriod() pulumi.IntOutput { 278 return o.ApplyT(func(v *SnapshotCopy) pulumi.IntOutput { return v.RetentionPeriod }).(pulumi.IntOutput) 279 } 280 281 // Name of the snapshot copy grant to use when snapshots of an AWS KMS-encrypted cluster are copied to the destination region. 282 func (o SnapshotCopyOutput) SnapshotCopyGrantName() pulumi.StringPtrOutput { 283 return o.ApplyT(func(v *SnapshotCopy) pulumi.StringPtrOutput { return v.SnapshotCopyGrantName }).(pulumi.StringPtrOutput) 284 } 285 286 type SnapshotCopyArrayOutput struct{ *pulumi.OutputState } 287 288 func (SnapshotCopyArrayOutput) ElementType() reflect.Type { 289 return reflect.TypeOf((*[]*SnapshotCopy)(nil)).Elem() 290 } 291 292 func (o SnapshotCopyArrayOutput) ToSnapshotCopyArrayOutput() SnapshotCopyArrayOutput { 293 return o 294 } 295 296 func (o SnapshotCopyArrayOutput) ToSnapshotCopyArrayOutputWithContext(ctx context.Context) SnapshotCopyArrayOutput { 297 return o 298 } 299 300 func (o SnapshotCopyArrayOutput) Index(i pulumi.IntInput) SnapshotCopyOutput { 301 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SnapshotCopy { 302 return vs[0].([]*SnapshotCopy)[vs[1].(int)] 303 }).(SnapshotCopyOutput) 304 } 305 306 type SnapshotCopyMapOutput struct{ *pulumi.OutputState } 307 308 func (SnapshotCopyMapOutput) ElementType() reflect.Type { 309 return reflect.TypeOf((*map[string]*SnapshotCopy)(nil)).Elem() 310 } 311 312 func (o SnapshotCopyMapOutput) ToSnapshotCopyMapOutput() SnapshotCopyMapOutput { 313 return o 314 } 315 316 func (o SnapshotCopyMapOutput) ToSnapshotCopyMapOutputWithContext(ctx context.Context) SnapshotCopyMapOutput { 317 return o 318 } 319 320 func (o SnapshotCopyMapOutput) MapIndex(k pulumi.StringInput) SnapshotCopyOutput { 321 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SnapshotCopy { 322 return vs[0].(map[string]*SnapshotCopy)[vs[1].(string)] 323 }).(SnapshotCopyOutput) 324 } 325 326 func init() { 327 pulumi.RegisterInputType(reflect.TypeOf((*SnapshotCopyInput)(nil)).Elem(), &SnapshotCopy{}) 328 pulumi.RegisterInputType(reflect.TypeOf((*SnapshotCopyArrayInput)(nil)).Elem(), SnapshotCopyArray{}) 329 pulumi.RegisterInputType(reflect.TypeOf((*SnapshotCopyMapInput)(nil)).Elem(), SnapshotCopyMap{}) 330 pulumi.RegisterOutputType(SnapshotCopyOutput{}) 331 pulumi.RegisterOutputType(SnapshotCopyArrayOutput{}) 332 pulumi.RegisterOutputType(SnapshotCopyMapOutput{}) 333 }