github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/fsx/backup.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 fsx
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Provides a FSx Backup resource.
    15  //
    16  // ## Lustre Example
    17  //
    18  // <!--Start PulumiCodeChooser -->
    19  // ```go
    20  // package main
    21  //
    22  // import (
    23  //
    24  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/fsx"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			exampleLustreFileSystem, err := fsx.NewLustreFileSystem(ctx, "example", &fsx.LustreFileSystemArgs{
    32  //				StorageCapacity:          pulumi.Int(1200),
    33  //				SubnetIds:                pulumi.Any(exampleAwsSubnet.Id),
    34  //				DeploymentType:           pulumi.String("PERSISTENT_1"),
    35  //				PerUnitStorageThroughput: pulumi.Int(50),
    36  //			})
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			_, err = fsx.NewBackup(ctx, "example", &fsx.BackupArgs{
    41  //				FileSystemId: exampleLustreFileSystem.ID(),
    42  //			})
    43  //			if err != nil {
    44  //				return err
    45  //			}
    46  //			return nil
    47  //		})
    48  //	}
    49  //
    50  // ```
    51  // <!--End PulumiCodeChooser -->
    52  //
    53  // ## Windows Example
    54  //
    55  // <!--Start PulumiCodeChooser -->
    56  // ```go
    57  // package main
    58  //
    59  // import (
    60  //
    61  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/fsx"
    62  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    63  //
    64  // )
    65  //
    66  //	func main() {
    67  //		pulumi.Run(func(ctx *pulumi.Context) error {
    68  //			exampleWindowsFileSystem, err := fsx.NewWindowsFileSystem(ctx, "example", &fsx.WindowsFileSystemArgs{
    69  //				ActiveDirectoryId: pulumi.Any(eample.Id),
    70  //				SkipFinalBackup:   pulumi.Bool(true),
    71  //				StorageCapacity:   pulumi.Int(32),
    72  //				SubnetIds: pulumi.StringArray{
    73  //					example1.Id,
    74  //				},
    75  //				ThroughputCapacity: pulumi.Int(8),
    76  //			})
    77  //			if err != nil {
    78  //				return err
    79  //			}
    80  //			_, err = fsx.NewBackup(ctx, "example", &fsx.BackupArgs{
    81  //				FileSystemId: exampleWindowsFileSystem.ID(),
    82  //			})
    83  //			if err != nil {
    84  //				return err
    85  //			}
    86  //			return nil
    87  //		})
    88  //	}
    89  //
    90  // ```
    91  // <!--End PulumiCodeChooser -->
    92  //
    93  // ## ONTAP Example
    94  //
    95  // <!--Start PulumiCodeChooser -->
    96  // ```go
    97  // package main
    98  //
    99  // import (
   100  //
   101  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/fsx"
   102  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   103  //
   104  // )
   105  //
   106  //	func main() {
   107  //		pulumi.Run(func(ctx *pulumi.Context) error {
   108  //			exampleOntapVolume, err := fsx.NewOntapVolume(ctx, "example", &fsx.OntapVolumeArgs{
   109  //				Name:                     pulumi.String("example"),
   110  //				JunctionPath:             pulumi.String("/example"),
   111  //				SizeInMegabytes:          pulumi.Int(1024),
   112  //				StorageEfficiencyEnabled: pulumi.Bool(true),
   113  //				StorageVirtualMachineId:  pulumi.Any(test.Id),
   114  //			})
   115  //			if err != nil {
   116  //				return err
   117  //			}
   118  //			_, err = fsx.NewBackup(ctx, "example", &fsx.BackupArgs{
   119  //				VolumeId: exampleOntapVolume.ID(),
   120  //			})
   121  //			if err != nil {
   122  //				return err
   123  //			}
   124  //			return nil
   125  //		})
   126  //	}
   127  //
   128  // ```
   129  // <!--End PulumiCodeChooser -->
   130  //
   131  // ## OpenZFS Example
   132  //
   133  // <!--Start PulumiCodeChooser -->
   134  // ```go
   135  // package main
   136  //
   137  // import (
   138  //
   139  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/fsx"
   140  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   141  //
   142  // )
   143  //
   144  //	func main() {
   145  //		pulumi.Run(func(ctx *pulumi.Context) error {
   146  //			exampleOpenZfsFileSystem, err := fsx.NewOpenZfsFileSystem(ctx, "example", &fsx.OpenZfsFileSystemArgs{
   147  //				StorageCapacity:    pulumi.Int(64),
   148  //				SubnetIds:          pulumi.Any(exampleAwsSubnet.Id),
   149  //				DeploymentType:     pulumi.String("SINGLE_AZ_1"),
   150  //				ThroughputCapacity: pulumi.Int(64),
   151  //			})
   152  //			if err != nil {
   153  //				return err
   154  //			}
   155  //			_, err = fsx.NewBackup(ctx, "example", &fsx.BackupArgs{
   156  //				FileSystemId: exampleOpenZfsFileSystem.ID(),
   157  //			})
   158  //			if err != nil {
   159  //				return err
   160  //			}
   161  //			return nil
   162  //		})
   163  //	}
   164  //
   165  // ```
   166  // <!--End PulumiCodeChooser -->
   167  //
   168  // ## Import
   169  //
   170  // Using `pulumi import`, import FSx Backups using the `id`. For example:
   171  //
   172  // ```sh
   173  // $ pulumi import aws:fsx/backup:Backup example fs-543ab12b1ca672f33
   174  // ```
   175  type Backup struct {
   176  	pulumi.CustomResourceState
   177  
   178  	// Amazon Resource Name of the backup.
   179  	Arn pulumi.StringOutput `pulumi:"arn"`
   180  	// The ID of the file system to back up. Required if backing up Lustre or Windows file systems.
   181  	FileSystemId pulumi.StringPtrOutput `pulumi:"fileSystemId"`
   182  	// The ID of the AWS Key Management Service (AWS KMS) key used to encrypt the backup of the Amazon FSx file system's data at rest.
   183  	KmsKeyId pulumi.StringOutput `pulumi:"kmsKeyId"`
   184  	// AWS account identifier that created the file system.
   185  	OwnerId pulumi.StringOutput `pulumi:"ownerId"`
   186  	// A map of tags to assign to the file system. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. If you have set `copyTagsToBackups` to true, and you specify one or more tags, no existing file system tags are copied from the file system to the backup.
   187  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   188  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   189  	//
   190  	// Deprecated: Please use `tags` instead.
   191  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   192  	// The type of the file system backup.
   193  	Type pulumi.StringOutput `pulumi:"type"`
   194  	// The ID of the volume to back up. Required if backing up a ONTAP Volume.
   195  	VolumeId pulumi.StringPtrOutput `pulumi:"volumeId"`
   196  }
   197  
   198  // NewBackup registers a new resource with the given unique name, arguments, and options.
   199  func NewBackup(ctx *pulumi.Context,
   200  	name string, args *BackupArgs, opts ...pulumi.ResourceOption) (*Backup, error) {
   201  	if args == nil {
   202  		args = &BackupArgs{}
   203  	}
   204  
   205  	opts = internal.PkgResourceDefaultOpts(opts)
   206  	var resource Backup
   207  	err := ctx.RegisterResource("aws:fsx/backup:Backup", name, args, &resource, opts...)
   208  	if err != nil {
   209  		return nil, err
   210  	}
   211  	return &resource, nil
   212  }
   213  
   214  // GetBackup gets an existing Backup resource's state with the given name, ID, and optional
   215  // state properties that are used to uniquely qualify the lookup (nil if not required).
   216  func GetBackup(ctx *pulumi.Context,
   217  	name string, id pulumi.IDInput, state *BackupState, opts ...pulumi.ResourceOption) (*Backup, error) {
   218  	var resource Backup
   219  	err := ctx.ReadResource("aws:fsx/backup:Backup", name, id, state, &resource, opts...)
   220  	if err != nil {
   221  		return nil, err
   222  	}
   223  	return &resource, nil
   224  }
   225  
   226  // Input properties used for looking up and filtering Backup resources.
   227  type backupState struct {
   228  	// Amazon Resource Name of the backup.
   229  	Arn *string `pulumi:"arn"`
   230  	// The ID of the file system to back up. Required if backing up Lustre or Windows file systems.
   231  	FileSystemId *string `pulumi:"fileSystemId"`
   232  	// The ID of the AWS Key Management Service (AWS KMS) key used to encrypt the backup of the Amazon FSx file system's data at rest.
   233  	KmsKeyId *string `pulumi:"kmsKeyId"`
   234  	// AWS account identifier that created the file system.
   235  	OwnerId *string `pulumi:"ownerId"`
   236  	// A map of tags to assign to the file system. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. If you have set `copyTagsToBackups` to true, and you specify one or more tags, no existing file system tags are copied from the file system to the backup.
   237  	Tags map[string]string `pulumi:"tags"`
   238  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   239  	//
   240  	// Deprecated: Please use `tags` instead.
   241  	TagsAll map[string]string `pulumi:"tagsAll"`
   242  	// The type of the file system backup.
   243  	Type *string `pulumi:"type"`
   244  	// The ID of the volume to back up. Required if backing up a ONTAP Volume.
   245  	VolumeId *string `pulumi:"volumeId"`
   246  }
   247  
   248  type BackupState struct {
   249  	// Amazon Resource Name of the backup.
   250  	Arn pulumi.StringPtrInput
   251  	// The ID of the file system to back up. Required if backing up Lustre or Windows file systems.
   252  	FileSystemId pulumi.StringPtrInput
   253  	// The ID of the AWS Key Management Service (AWS KMS) key used to encrypt the backup of the Amazon FSx file system's data at rest.
   254  	KmsKeyId pulumi.StringPtrInput
   255  	// AWS account identifier that created the file system.
   256  	OwnerId pulumi.StringPtrInput
   257  	// A map of tags to assign to the file system. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. If you have set `copyTagsToBackups` to true, and you specify one or more tags, no existing file system tags are copied from the file system to the backup.
   258  	Tags pulumi.StringMapInput
   259  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   260  	//
   261  	// Deprecated: Please use `tags` instead.
   262  	TagsAll pulumi.StringMapInput
   263  	// The type of the file system backup.
   264  	Type pulumi.StringPtrInput
   265  	// The ID of the volume to back up. Required if backing up a ONTAP Volume.
   266  	VolumeId pulumi.StringPtrInput
   267  }
   268  
   269  func (BackupState) ElementType() reflect.Type {
   270  	return reflect.TypeOf((*backupState)(nil)).Elem()
   271  }
   272  
   273  type backupArgs struct {
   274  	// The ID of the file system to back up. Required if backing up Lustre or Windows file systems.
   275  	FileSystemId *string `pulumi:"fileSystemId"`
   276  	// A map of tags to assign to the file system. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. If you have set `copyTagsToBackups` to true, and you specify one or more tags, no existing file system tags are copied from the file system to the backup.
   277  	Tags map[string]string `pulumi:"tags"`
   278  	// The ID of the volume to back up. Required if backing up a ONTAP Volume.
   279  	VolumeId *string `pulumi:"volumeId"`
   280  }
   281  
   282  // The set of arguments for constructing a Backup resource.
   283  type BackupArgs struct {
   284  	// The ID of the file system to back up. Required if backing up Lustre or Windows file systems.
   285  	FileSystemId pulumi.StringPtrInput
   286  	// A map of tags to assign to the file system. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. If you have set `copyTagsToBackups` to true, and you specify one or more tags, no existing file system tags are copied from the file system to the backup.
   287  	Tags pulumi.StringMapInput
   288  	// The ID of the volume to back up. Required if backing up a ONTAP Volume.
   289  	VolumeId pulumi.StringPtrInput
   290  }
   291  
   292  func (BackupArgs) ElementType() reflect.Type {
   293  	return reflect.TypeOf((*backupArgs)(nil)).Elem()
   294  }
   295  
   296  type BackupInput interface {
   297  	pulumi.Input
   298  
   299  	ToBackupOutput() BackupOutput
   300  	ToBackupOutputWithContext(ctx context.Context) BackupOutput
   301  }
   302  
   303  func (*Backup) ElementType() reflect.Type {
   304  	return reflect.TypeOf((**Backup)(nil)).Elem()
   305  }
   306  
   307  func (i *Backup) ToBackupOutput() BackupOutput {
   308  	return i.ToBackupOutputWithContext(context.Background())
   309  }
   310  
   311  func (i *Backup) ToBackupOutputWithContext(ctx context.Context) BackupOutput {
   312  	return pulumi.ToOutputWithContext(ctx, i).(BackupOutput)
   313  }
   314  
   315  // BackupArrayInput is an input type that accepts BackupArray and BackupArrayOutput values.
   316  // You can construct a concrete instance of `BackupArrayInput` via:
   317  //
   318  //	BackupArray{ BackupArgs{...} }
   319  type BackupArrayInput interface {
   320  	pulumi.Input
   321  
   322  	ToBackupArrayOutput() BackupArrayOutput
   323  	ToBackupArrayOutputWithContext(context.Context) BackupArrayOutput
   324  }
   325  
   326  type BackupArray []BackupInput
   327  
   328  func (BackupArray) ElementType() reflect.Type {
   329  	return reflect.TypeOf((*[]*Backup)(nil)).Elem()
   330  }
   331  
   332  func (i BackupArray) ToBackupArrayOutput() BackupArrayOutput {
   333  	return i.ToBackupArrayOutputWithContext(context.Background())
   334  }
   335  
   336  func (i BackupArray) ToBackupArrayOutputWithContext(ctx context.Context) BackupArrayOutput {
   337  	return pulumi.ToOutputWithContext(ctx, i).(BackupArrayOutput)
   338  }
   339  
   340  // BackupMapInput is an input type that accepts BackupMap and BackupMapOutput values.
   341  // You can construct a concrete instance of `BackupMapInput` via:
   342  //
   343  //	BackupMap{ "key": BackupArgs{...} }
   344  type BackupMapInput interface {
   345  	pulumi.Input
   346  
   347  	ToBackupMapOutput() BackupMapOutput
   348  	ToBackupMapOutputWithContext(context.Context) BackupMapOutput
   349  }
   350  
   351  type BackupMap map[string]BackupInput
   352  
   353  func (BackupMap) ElementType() reflect.Type {
   354  	return reflect.TypeOf((*map[string]*Backup)(nil)).Elem()
   355  }
   356  
   357  func (i BackupMap) ToBackupMapOutput() BackupMapOutput {
   358  	return i.ToBackupMapOutputWithContext(context.Background())
   359  }
   360  
   361  func (i BackupMap) ToBackupMapOutputWithContext(ctx context.Context) BackupMapOutput {
   362  	return pulumi.ToOutputWithContext(ctx, i).(BackupMapOutput)
   363  }
   364  
   365  type BackupOutput struct{ *pulumi.OutputState }
   366  
   367  func (BackupOutput) ElementType() reflect.Type {
   368  	return reflect.TypeOf((**Backup)(nil)).Elem()
   369  }
   370  
   371  func (o BackupOutput) ToBackupOutput() BackupOutput {
   372  	return o
   373  }
   374  
   375  func (o BackupOutput) ToBackupOutputWithContext(ctx context.Context) BackupOutput {
   376  	return o
   377  }
   378  
   379  // Amazon Resource Name of the backup.
   380  func (o BackupOutput) Arn() pulumi.StringOutput {
   381  	return o.ApplyT(func(v *Backup) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   382  }
   383  
   384  // The ID of the file system to back up. Required if backing up Lustre or Windows file systems.
   385  func (o BackupOutput) FileSystemId() pulumi.StringPtrOutput {
   386  	return o.ApplyT(func(v *Backup) pulumi.StringPtrOutput { return v.FileSystemId }).(pulumi.StringPtrOutput)
   387  }
   388  
   389  // The ID of the AWS Key Management Service (AWS KMS) key used to encrypt the backup of the Amazon FSx file system's data at rest.
   390  func (o BackupOutput) KmsKeyId() pulumi.StringOutput {
   391  	return o.ApplyT(func(v *Backup) pulumi.StringOutput { return v.KmsKeyId }).(pulumi.StringOutput)
   392  }
   393  
   394  // AWS account identifier that created the file system.
   395  func (o BackupOutput) OwnerId() pulumi.StringOutput {
   396  	return o.ApplyT(func(v *Backup) pulumi.StringOutput { return v.OwnerId }).(pulumi.StringOutput)
   397  }
   398  
   399  // A map of tags to assign to the file system. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. If you have set `copyTagsToBackups` to true, and you specify one or more tags, no existing file system tags are copied from the file system to the backup.
   400  func (o BackupOutput) Tags() pulumi.StringMapOutput {
   401  	return o.ApplyT(func(v *Backup) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   402  }
   403  
   404  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   405  //
   406  // Deprecated: Please use `tags` instead.
   407  func (o BackupOutput) TagsAll() pulumi.StringMapOutput {
   408  	return o.ApplyT(func(v *Backup) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   409  }
   410  
   411  // The type of the file system backup.
   412  func (o BackupOutput) Type() pulumi.StringOutput {
   413  	return o.ApplyT(func(v *Backup) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
   414  }
   415  
   416  // The ID of the volume to back up. Required if backing up a ONTAP Volume.
   417  func (o BackupOutput) VolumeId() pulumi.StringPtrOutput {
   418  	return o.ApplyT(func(v *Backup) pulumi.StringPtrOutput { return v.VolumeId }).(pulumi.StringPtrOutput)
   419  }
   420  
   421  type BackupArrayOutput struct{ *pulumi.OutputState }
   422  
   423  func (BackupArrayOutput) ElementType() reflect.Type {
   424  	return reflect.TypeOf((*[]*Backup)(nil)).Elem()
   425  }
   426  
   427  func (o BackupArrayOutput) ToBackupArrayOutput() BackupArrayOutput {
   428  	return o
   429  }
   430  
   431  func (o BackupArrayOutput) ToBackupArrayOutputWithContext(ctx context.Context) BackupArrayOutput {
   432  	return o
   433  }
   434  
   435  func (o BackupArrayOutput) Index(i pulumi.IntInput) BackupOutput {
   436  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Backup {
   437  		return vs[0].([]*Backup)[vs[1].(int)]
   438  	}).(BackupOutput)
   439  }
   440  
   441  type BackupMapOutput struct{ *pulumi.OutputState }
   442  
   443  func (BackupMapOutput) ElementType() reflect.Type {
   444  	return reflect.TypeOf((*map[string]*Backup)(nil)).Elem()
   445  }
   446  
   447  func (o BackupMapOutput) ToBackupMapOutput() BackupMapOutput {
   448  	return o
   449  }
   450  
   451  func (o BackupMapOutput) ToBackupMapOutputWithContext(ctx context.Context) BackupMapOutput {
   452  	return o
   453  }
   454  
   455  func (o BackupMapOutput) MapIndex(k pulumi.StringInput) BackupOutput {
   456  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Backup {
   457  		return vs[0].(map[string]*Backup)[vs[1].(string)]
   458  	}).(BackupOutput)
   459  }
   460  
   461  func init() {
   462  	pulumi.RegisterInputType(reflect.TypeOf((*BackupInput)(nil)).Elem(), &Backup{})
   463  	pulumi.RegisterInputType(reflect.TypeOf((*BackupArrayInput)(nil)).Elem(), BackupArray{})
   464  	pulumi.RegisterInputType(reflect.TypeOf((*BackupMapInput)(nil)).Elem(), BackupMap{})
   465  	pulumi.RegisterOutputType(BackupOutput{})
   466  	pulumi.RegisterOutputType(BackupArrayOutput{})
   467  	pulumi.RegisterOutputType(BackupMapOutput{})
   468  }