github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ebs/snapshot.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 ebs 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 of an EBS Volume. 16 // 17 // ## Example Usage 18 // 19 // <!--Start PulumiCodeChooser --> 20 // ```go 21 // package main 22 // 23 // import ( 24 // 25 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ebs" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // example, err := ebs.NewVolume(ctx, "example", &ebs.VolumeArgs{ 33 // AvailabilityZone: pulumi.String("us-west-2a"), 34 // Size: pulumi.Int(40), 35 // Tags: pulumi.StringMap{ 36 // "Name": pulumi.String("HelloWorld"), 37 // }, 38 // }) 39 // if err != nil { 40 // return err 41 // } 42 // _, err = ebs.NewSnapshot(ctx, "example_snapshot", &ebs.SnapshotArgs{ 43 // VolumeId: example.ID(), 44 // Tags: pulumi.StringMap{ 45 // "Name": pulumi.String("HelloWorld_snap"), 46 // }, 47 // }) 48 // if err != nil { 49 // return err 50 // } 51 // return nil 52 // }) 53 // } 54 // 55 // ``` 56 // <!--End PulumiCodeChooser --> 57 // 58 // ## Import 59 // 60 // Using `pulumi import`, import EBS Snapshot using the `id`. For example: 61 // 62 // ```sh 63 // $ pulumi import aws:ebs/snapshot:Snapshot id snap-049df61146c4d7901 64 // ``` 65 type Snapshot struct { 66 pulumi.CustomResourceState 67 68 // Amazon Resource Name (ARN) of the EBS Snapshot. 69 Arn pulumi.StringOutput `pulumi:"arn"` 70 // The data encryption key identifier for the snapshot. 71 DataEncryptionKeyId pulumi.StringOutput `pulumi:"dataEncryptionKeyId"` 72 // A description of what the snapshot is. 73 Description pulumi.StringPtrOutput `pulumi:"description"` 74 // Whether the snapshot is encrypted. 75 Encrypted pulumi.BoolOutput `pulumi:"encrypted"` 76 // The ARN for the KMS encryption key. 77 KmsKeyId pulumi.StringOutput `pulumi:"kmsKeyId"` 78 // The Amazon Resource Name (ARN) of the Outpost on which to create a local snapshot. 79 OutpostArn pulumi.StringPtrOutput `pulumi:"outpostArn"` 80 // Value from an Amazon-maintained list (`amazon`, `aws-marketplace`, `microsoft`) of snapshot owners. 81 OwnerAlias pulumi.StringOutput `pulumi:"ownerAlias"` 82 // The AWS account ID of the EBS snapshot owner. 83 OwnerId pulumi.StringOutput `pulumi:"ownerId"` 84 // Indicates whether to permanently restore an archived snapshot. 85 PermanentRestore pulumi.BoolPtrOutput `pulumi:"permanentRestore"` 86 // The name of the storage tier. Valid values are `archive` and `standard`. Default value is `standard`. 87 StorageTier pulumi.StringOutput `pulumi:"storageTier"` 88 // A map of tags to assign to the snapshot. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 89 Tags pulumi.StringMapOutput `pulumi:"tags"` 90 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 91 // 92 // Deprecated: Please use `tags` instead. 93 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 94 // Specifies the number of days for which to temporarily restore an archived snapshot. Required for temporary restores only. The snapshot will be automatically re-archived after this period. 95 TemporaryRestoreDays pulumi.IntPtrOutput `pulumi:"temporaryRestoreDays"` 96 // The Volume ID of which to make a snapshot. 97 VolumeId pulumi.StringOutput `pulumi:"volumeId"` 98 // The size of the drive in GiBs. 99 VolumeSize pulumi.IntOutput `pulumi:"volumeSize"` 100 } 101 102 // NewSnapshot registers a new resource with the given unique name, arguments, and options. 103 func NewSnapshot(ctx *pulumi.Context, 104 name string, args *SnapshotArgs, opts ...pulumi.ResourceOption) (*Snapshot, error) { 105 if args == nil { 106 return nil, errors.New("missing one or more required arguments") 107 } 108 109 if args.VolumeId == nil { 110 return nil, errors.New("invalid value for required argument 'VolumeId'") 111 } 112 opts = internal.PkgResourceDefaultOpts(opts) 113 var resource Snapshot 114 err := ctx.RegisterResource("aws:ebs/snapshot:Snapshot", name, args, &resource, opts...) 115 if err != nil { 116 return nil, err 117 } 118 return &resource, nil 119 } 120 121 // GetSnapshot gets an existing Snapshot resource's state with the given name, ID, and optional 122 // state properties that are used to uniquely qualify the lookup (nil if not required). 123 func GetSnapshot(ctx *pulumi.Context, 124 name string, id pulumi.IDInput, state *SnapshotState, opts ...pulumi.ResourceOption) (*Snapshot, error) { 125 var resource Snapshot 126 err := ctx.ReadResource("aws:ebs/snapshot:Snapshot", name, id, state, &resource, opts...) 127 if err != nil { 128 return nil, err 129 } 130 return &resource, nil 131 } 132 133 // Input properties used for looking up and filtering Snapshot resources. 134 type snapshotState struct { 135 // Amazon Resource Name (ARN) of the EBS Snapshot. 136 Arn *string `pulumi:"arn"` 137 // The data encryption key identifier for the snapshot. 138 DataEncryptionKeyId *string `pulumi:"dataEncryptionKeyId"` 139 // A description of what the snapshot is. 140 Description *string `pulumi:"description"` 141 // Whether the snapshot is encrypted. 142 Encrypted *bool `pulumi:"encrypted"` 143 // The ARN for the KMS encryption key. 144 KmsKeyId *string `pulumi:"kmsKeyId"` 145 // The Amazon Resource Name (ARN) of the Outpost on which to create a local snapshot. 146 OutpostArn *string `pulumi:"outpostArn"` 147 // Value from an Amazon-maintained list (`amazon`, `aws-marketplace`, `microsoft`) of snapshot owners. 148 OwnerAlias *string `pulumi:"ownerAlias"` 149 // The AWS account ID of the EBS snapshot owner. 150 OwnerId *string `pulumi:"ownerId"` 151 // Indicates whether to permanently restore an archived snapshot. 152 PermanentRestore *bool `pulumi:"permanentRestore"` 153 // The name of the storage tier. Valid values are `archive` and `standard`. Default value is `standard`. 154 StorageTier *string `pulumi:"storageTier"` 155 // A map of tags to assign to the snapshot. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 156 Tags map[string]string `pulumi:"tags"` 157 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 158 // 159 // Deprecated: Please use `tags` instead. 160 TagsAll map[string]string `pulumi:"tagsAll"` 161 // Specifies the number of days for which to temporarily restore an archived snapshot. Required for temporary restores only. The snapshot will be automatically re-archived after this period. 162 TemporaryRestoreDays *int `pulumi:"temporaryRestoreDays"` 163 // The Volume ID of which to make a snapshot. 164 VolumeId *string `pulumi:"volumeId"` 165 // The size of the drive in GiBs. 166 VolumeSize *int `pulumi:"volumeSize"` 167 } 168 169 type SnapshotState struct { 170 // Amazon Resource Name (ARN) of the EBS Snapshot. 171 Arn pulumi.StringPtrInput 172 // The data encryption key identifier for the snapshot. 173 DataEncryptionKeyId pulumi.StringPtrInput 174 // A description of what the snapshot is. 175 Description pulumi.StringPtrInput 176 // Whether the snapshot is encrypted. 177 Encrypted pulumi.BoolPtrInput 178 // The ARN for the KMS encryption key. 179 KmsKeyId pulumi.StringPtrInput 180 // The Amazon Resource Name (ARN) of the Outpost on which to create a local snapshot. 181 OutpostArn pulumi.StringPtrInput 182 // Value from an Amazon-maintained list (`amazon`, `aws-marketplace`, `microsoft`) of snapshot owners. 183 OwnerAlias pulumi.StringPtrInput 184 // The AWS account ID of the EBS snapshot owner. 185 OwnerId pulumi.StringPtrInput 186 // Indicates whether to permanently restore an archived snapshot. 187 PermanentRestore pulumi.BoolPtrInput 188 // The name of the storage tier. Valid values are `archive` and `standard`. Default value is `standard`. 189 StorageTier pulumi.StringPtrInput 190 // A map of tags to assign to the snapshot. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 191 Tags pulumi.StringMapInput 192 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 193 // 194 // Deprecated: Please use `tags` instead. 195 TagsAll pulumi.StringMapInput 196 // Specifies the number of days for which to temporarily restore an archived snapshot. Required for temporary restores only. The snapshot will be automatically re-archived after this period. 197 TemporaryRestoreDays pulumi.IntPtrInput 198 // The Volume ID of which to make a snapshot. 199 VolumeId pulumi.StringPtrInput 200 // The size of the drive in GiBs. 201 VolumeSize pulumi.IntPtrInput 202 } 203 204 func (SnapshotState) ElementType() reflect.Type { 205 return reflect.TypeOf((*snapshotState)(nil)).Elem() 206 } 207 208 type snapshotArgs struct { 209 // A description of what the snapshot is. 210 Description *string `pulumi:"description"` 211 // The Amazon Resource Name (ARN) of the Outpost on which to create a local snapshot. 212 OutpostArn *string `pulumi:"outpostArn"` 213 // Indicates whether to permanently restore an archived snapshot. 214 PermanentRestore *bool `pulumi:"permanentRestore"` 215 // The name of the storage tier. Valid values are `archive` and `standard`. Default value is `standard`. 216 StorageTier *string `pulumi:"storageTier"` 217 // A map of tags to assign to the snapshot. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 218 Tags map[string]string `pulumi:"tags"` 219 // Specifies the number of days for which to temporarily restore an archived snapshot. Required for temporary restores only. The snapshot will be automatically re-archived after this period. 220 TemporaryRestoreDays *int `pulumi:"temporaryRestoreDays"` 221 // The Volume ID of which to make a snapshot. 222 VolumeId string `pulumi:"volumeId"` 223 } 224 225 // The set of arguments for constructing a Snapshot resource. 226 type SnapshotArgs struct { 227 // A description of what the snapshot is. 228 Description pulumi.StringPtrInput 229 // The Amazon Resource Name (ARN) of the Outpost on which to create a local snapshot. 230 OutpostArn pulumi.StringPtrInput 231 // Indicates whether to permanently restore an archived snapshot. 232 PermanentRestore pulumi.BoolPtrInput 233 // The name of the storage tier. Valid values are `archive` and `standard`. Default value is `standard`. 234 StorageTier pulumi.StringPtrInput 235 // A map of tags to assign to the snapshot. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 236 Tags pulumi.StringMapInput 237 // Specifies the number of days for which to temporarily restore an archived snapshot. Required for temporary restores only. The snapshot will be automatically re-archived after this period. 238 TemporaryRestoreDays pulumi.IntPtrInput 239 // The Volume ID of which to make a snapshot. 240 VolumeId pulumi.StringInput 241 } 242 243 func (SnapshotArgs) ElementType() reflect.Type { 244 return reflect.TypeOf((*snapshotArgs)(nil)).Elem() 245 } 246 247 type SnapshotInput interface { 248 pulumi.Input 249 250 ToSnapshotOutput() SnapshotOutput 251 ToSnapshotOutputWithContext(ctx context.Context) SnapshotOutput 252 } 253 254 func (*Snapshot) ElementType() reflect.Type { 255 return reflect.TypeOf((**Snapshot)(nil)).Elem() 256 } 257 258 func (i *Snapshot) ToSnapshotOutput() SnapshotOutput { 259 return i.ToSnapshotOutputWithContext(context.Background()) 260 } 261 262 func (i *Snapshot) ToSnapshotOutputWithContext(ctx context.Context) SnapshotOutput { 263 return pulumi.ToOutputWithContext(ctx, i).(SnapshotOutput) 264 } 265 266 // SnapshotArrayInput is an input type that accepts SnapshotArray and SnapshotArrayOutput values. 267 // You can construct a concrete instance of `SnapshotArrayInput` via: 268 // 269 // SnapshotArray{ SnapshotArgs{...} } 270 type SnapshotArrayInput interface { 271 pulumi.Input 272 273 ToSnapshotArrayOutput() SnapshotArrayOutput 274 ToSnapshotArrayOutputWithContext(context.Context) SnapshotArrayOutput 275 } 276 277 type SnapshotArray []SnapshotInput 278 279 func (SnapshotArray) ElementType() reflect.Type { 280 return reflect.TypeOf((*[]*Snapshot)(nil)).Elem() 281 } 282 283 func (i SnapshotArray) ToSnapshotArrayOutput() SnapshotArrayOutput { 284 return i.ToSnapshotArrayOutputWithContext(context.Background()) 285 } 286 287 func (i SnapshotArray) ToSnapshotArrayOutputWithContext(ctx context.Context) SnapshotArrayOutput { 288 return pulumi.ToOutputWithContext(ctx, i).(SnapshotArrayOutput) 289 } 290 291 // SnapshotMapInput is an input type that accepts SnapshotMap and SnapshotMapOutput values. 292 // You can construct a concrete instance of `SnapshotMapInput` via: 293 // 294 // SnapshotMap{ "key": SnapshotArgs{...} } 295 type SnapshotMapInput interface { 296 pulumi.Input 297 298 ToSnapshotMapOutput() SnapshotMapOutput 299 ToSnapshotMapOutputWithContext(context.Context) SnapshotMapOutput 300 } 301 302 type SnapshotMap map[string]SnapshotInput 303 304 func (SnapshotMap) ElementType() reflect.Type { 305 return reflect.TypeOf((*map[string]*Snapshot)(nil)).Elem() 306 } 307 308 func (i SnapshotMap) ToSnapshotMapOutput() SnapshotMapOutput { 309 return i.ToSnapshotMapOutputWithContext(context.Background()) 310 } 311 312 func (i SnapshotMap) ToSnapshotMapOutputWithContext(ctx context.Context) SnapshotMapOutput { 313 return pulumi.ToOutputWithContext(ctx, i).(SnapshotMapOutput) 314 } 315 316 type SnapshotOutput struct{ *pulumi.OutputState } 317 318 func (SnapshotOutput) ElementType() reflect.Type { 319 return reflect.TypeOf((**Snapshot)(nil)).Elem() 320 } 321 322 func (o SnapshotOutput) ToSnapshotOutput() SnapshotOutput { 323 return o 324 } 325 326 func (o SnapshotOutput) ToSnapshotOutputWithContext(ctx context.Context) SnapshotOutput { 327 return o 328 } 329 330 // Amazon Resource Name (ARN) of the EBS Snapshot. 331 func (o SnapshotOutput) Arn() pulumi.StringOutput { 332 return o.ApplyT(func(v *Snapshot) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 333 } 334 335 // The data encryption key identifier for the snapshot. 336 func (o SnapshotOutput) DataEncryptionKeyId() pulumi.StringOutput { 337 return o.ApplyT(func(v *Snapshot) pulumi.StringOutput { return v.DataEncryptionKeyId }).(pulumi.StringOutput) 338 } 339 340 // A description of what the snapshot is. 341 func (o SnapshotOutput) Description() pulumi.StringPtrOutput { 342 return o.ApplyT(func(v *Snapshot) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput) 343 } 344 345 // Whether the snapshot is encrypted. 346 func (o SnapshotOutput) Encrypted() pulumi.BoolOutput { 347 return o.ApplyT(func(v *Snapshot) pulumi.BoolOutput { return v.Encrypted }).(pulumi.BoolOutput) 348 } 349 350 // The ARN for the KMS encryption key. 351 func (o SnapshotOutput) KmsKeyId() pulumi.StringOutput { 352 return o.ApplyT(func(v *Snapshot) pulumi.StringOutput { return v.KmsKeyId }).(pulumi.StringOutput) 353 } 354 355 // The Amazon Resource Name (ARN) of the Outpost on which to create a local snapshot. 356 func (o SnapshotOutput) OutpostArn() pulumi.StringPtrOutput { 357 return o.ApplyT(func(v *Snapshot) pulumi.StringPtrOutput { return v.OutpostArn }).(pulumi.StringPtrOutput) 358 } 359 360 // Value from an Amazon-maintained list (`amazon`, `aws-marketplace`, `microsoft`) of snapshot owners. 361 func (o SnapshotOutput) OwnerAlias() pulumi.StringOutput { 362 return o.ApplyT(func(v *Snapshot) pulumi.StringOutput { return v.OwnerAlias }).(pulumi.StringOutput) 363 } 364 365 // The AWS account ID of the EBS snapshot owner. 366 func (o SnapshotOutput) OwnerId() pulumi.StringOutput { 367 return o.ApplyT(func(v *Snapshot) pulumi.StringOutput { return v.OwnerId }).(pulumi.StringOutput) 368 } 369 370 // Indicates whether to permanently restore an archived snapshot. 371 func (o SnapshotOutput) PermanentRestore() pulumi.BoolPtrOutput { 372 return o.ApplyT(func(v *Snapshot) pulumi.BoolPtrOutput { return v.PermanentRestore }).(pulumi.BoolPtrOutput) 373 } 374 375 // The name of the storage tier. Valid values are `archive` and `standard`. Default value is `standard`. 376 func (o SnapshotOutput) StorageTier() pulumi.StringOutput { 377 return o.ApplyT(func(v *Snapshot) pulumi.StringOutput { return v.StorageTier }).(pulumi.StringOutput) 378 } 379 380 // A map of tags to assign to the snapshot. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 381 func (o SnapshotOutput) Tags() pulumi.StringMapOutput { 382 return o.ApplyT(func(v *Snapshot) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 383 } 384 385 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 386 // 387 // Deprecated: Please use `tags` instead. 388 func (o SnapshotOutput) TagsAll() pulumi.StringMapOutput { 389 return o.ApplyT(func(v *Snapshot) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 390 } 391 392 // Specifies the number of days for which to temporarily restore an archived snapshot. Required for temporary restores only. The snapshot will be automatically re-archived after this period. 393 func (o SnapshotOutput) TemporaryRestoreDays() pulumi.IntPtrOutput { 394 return o.ApplyT(func(v *Snapshot) pulumi.IntPtrOutput { return v.TemporaryRestoreDays }).(pulumi.IntPtrOutput) 395 } 396 397 // The Volume ID of which to make a snapshot. 398 func (o SnapshotOutput) VolumeId() pulumi.StringOutput { 399 return o.ApplyT(func(v *Snapshot) pulumi.StringOutput { return v.VolumeId }).(pulumi.StringOutput) 400 } 401 402 // The size of the drive in GiBs. 403 func (o SnapshotOutput) VolumeSize() pulumi.IntOutput { 404 return o.ApplyT(func(v *Snapshot) pulumi.IntOutput { return v.VolumeSize }).(pulumi.IntOutput) 405 } 406 407 type SnapshotArrayOutput struct{ *pulumi.OutputState } 408 409 func (SnapshotArrayOutput) ElementType() reflect.Type { 410 return reflect.TypeOf((*[]*Snapshot)(nil)).Elem() 411 } 412 413 func (o SnapshotArrayOutput) ToSnapshotArrayOutput() SnapshotArrayOutput { 414 return o 415 } 416 417 func (o SnapshotArrayOutput) ToSnapshotArrayOutputWithContext(ctx context.Context) SnapshotArrayOutput { 418 return o 419 } 420 421 func (o SnapshotArrayOutput) Index(i pulumi.IntInput) SnapshotOutput { 422 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Snapshot { 423 return vs[0].([]*Snapshot)[vs[1].(int)] 424 }).(SnapshotOutput) 425 } 426 427 type SnapshotMapOutput struct{ *pulumi.OutputState } 428 429 func (SnapshotMapOutput) ElementType() reflect.Type { 430 return reflect.TypeOf((*map[string]*Snapshot)(nil)).Elem() 431 } 432 433 func (o SnapshotMapOutput) ToSnapshotMapOutput() SnapshotMapOutput { 434 return o 435 } 436 437 func (o SnapshotMapOutput) ToSnapshotMapOutputWithContext(ctx context.Context) SnapshotMapOutput { 438 return o 439 } 440 441 func (o SnapshotMapOutput) MapIndex(k pulumi.StringInput) SnapshotOutput { 442 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Snapshot { 443 return vs[0].(map[string]*Snapshot)[vs[1].(string)] 444 }).(SnapshotOutput) 445 } 446 447 func init() { 448 pulumi.RegisterInputType(reflect.TypeOf((*SnapshotInput)(nil)).Elem(), &Snapshot{}) 449 pulumi.RegisterInputType(reflect.TypeOf((*SnapshotArrayInput)(nil)).Elem(), SnapshotArray{}) 450 pulumi.RegisterInputType(reflect.TypeOf((*SnapshotMapInput)(nil)).Elem(), SnapshotMap{}) 451 pulumi.RegisterOutputType(SnapshotOutput{}) 452 pulumi.RegisterOutputType(SnapshotArrayOutput{}) 453 pulumi.RegisterOutputType(SnapshotMapOutput{}) 454 }