github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/docdb/clusterSnapshot.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 docdb
     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  // Manages a DocumentDB database cluster snapshot for DocumentDB clusters.
    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/docdb"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := docdb.NewClusterSnapshot(ctx, "example", &docdb.ClusterSnapshotArgs{
    33  //				DbClusterIdentifier:         pulumi.Any(exampleAwsDocdbCluster.Id),
    34  //				DbClusterSnapshotIdentifier: pulumi.String("resourcetestsnapshot1234"),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  //
    46  // ## Import
    47  //
    48  // Using `pulumi import`, import `aws_docdb_cluster_snapshot` using the cluster snapshot identifier. For example:
    49  //
    50  // ```sh
    51  // $ pulumi import aws:docdb/clusterSnapshot:ClusterSnapshot example my-cluster-snapshot
    52  // ```
    53  type ClusterSnapshot struct {
    54  	pulumi.CustomResourceState
    55  
    56  	// List of EC2 Availability Zones that instances in the DocumentDB cluster snapshot can be restored in.
    57  	AvailabilityZones pulumi.StringArrayOutput `pulumi:"availabilityZones"`
    58  	// The DocumentDB Cluster Identifier from which to take the snapshot.
    59  	DbClusterIdentifier pulumi.StringOutput `pulumi:"dbClusterIdentifier"`
    60  	// The Amazon Resource Name (ARN) for the DocumentDB Cluster Snapshot.
    61  	DbClusterSnapshotArn pulumi.StringOutput `pulumi:"dbClusterSnapshotArn"`
    62  	// The Identifier for the snapshot.
    63  	DbClusterSnapshotIdentifier pulumi.StringOutput `pulumi:"dbClusterSnapshotIdentifier"`
    64  	// Specifies the name of the database engine.
    65  	Engine pulumi.StringOutput `pulumi:"engine"`
    66  	// Version of the database engine for this DocumentDB cluster snapshot.
    67  	EngineVersion pulumi.StringOutput `pulumi:"engineVersion"`
    68  	// If storageEncrypted is true, the AWS KMS key identifier for the encrypted DocumentDB cluster snapshot.
    69  	KmsKeyId pulumi.StringOutput `pulumi:"kmsKeyId"`
    70  	// Port that the DocumentDB cluster was listening on at the time of the snapshot.
    71  	Port                       pulumi.IntOutput    `pulumi:"port"`
    72  	SnapshotType               pulumi.StringOutput `pulumi:"snapshotType"`
    73  	SourceDbClusterSnapshotArn pulumi.StringOutput `pulumi:"sourceDbClusterSnapshotArn"`
    74  	// The status of this DocumentDB Cluster Snapshot.
    75  	Status pulumi.StringOutput `pulumi:"status"`
    76  	// Specifies whether the DocumentDB cluster snapshot is encrypted.
    77  	StorageEncrypted pulumi.BoolOutput `pulumi:"storageEncrypted"`
    78  	// The VPC ID associated with the DocumentDB cluster snapshot.
    79  	VpcId pulumi.StringOutput `pulumi:"vpcId"`
    80  }
    81  
    82  // NewClusterSnapshot registers a new resource with the given unique name, arguments, and options.
    83  func NewClusterSnapshot(ctx *pulumi.Context,
    84  	name string, args *ClusterSnapshotArgs, opts ...pulumi.ResourceOption) (*ClusterSnapshot, error) {
    85  	if args == nil {
    86  		return nil, errors.New("missing one or more required arguments")
    87  	}
    88  
    89  	if args.DbClusterIdentifier == nil {
    90  		return nil, errors.New("invalid value for required argument 'DbClusterIdentifier'")
    91  	}
    92  	if args.DbClusterSnapshotIdentifier == nil {
    93  		return nil, errors.New("invalid value for required argument 'DbClusterSnapshotIdentifier'")
    94  	}
    95  	opts = internal.PkgResourceDefaultOpts(opts)
    96  	var resource ClusterSnapshot
    97  	err := ctx.RegisterResource("aws:docdb/clusterSnapshot:ClusterSnapshot", name, args, &resource, opts...)
    98  	if err != nil {
    99  		return nil, err
   100  	}
   101  	return &resource, nil
   102  }
   103  
   104  // GetClusterSnapshot gets an existing ClusterSnapshot resource's state with the given name, ID, and optional
   105  // state properties that are used to uniquely qualify the lookup (nil if not required).
   106  func GetClusterSnapshot(ctx *pulumi.Context,
   107  	name string, id pulumi.IDInput, state *ClusterSnapshotState, opts ...pulumi.ResourceOption) (*ClusterSnapshot, error) {
   108  	var resource ClusterSnapshot
   109  	err := ctx.ReadResource("aws:docdb/clusterSnapshot:ClusterSnapshot", name, id, state, &resource, opts...)
   110  	if err != nil {
   111  		return nil, err
   112  	}
   113  	return &resource, nil
   114  }
   115  
   116  // Input properties used for looking up and filtering ClusterSnapshot resources.
   117  type clusterSnapshotState struct {
   118  	// List of EC2 Availability Zones that instances in the DocumentDB cluster snapshot can be restored in.
   119  	AvailabilityZones []string `pulumi:"availabilityZones"`
   120  	// The DocumentDB Cluster Identifier from which to take the snapshot.
   121  	DbClusterIdentifier *string `pulumi:"dbClusterIdentifier"`
   122  	// The Amazon Resource Name (ARN) for the DocumentDB Cluster Snapshot.
   123  	DbClusterSnapshotArn *string `pulumi:"dbClusterSnapshotArn"`
   124  	// The Identifier for the snapshot.
   125  	DbClusterSnapshotIdentifier *string `pulumi:"dbClusterSnapshotIdentifier"`
   126  	// Specifies the name of the database engine.
   127  	Engine *string `pulumi:"engine"`
   128  	// Version of the database engine for this DocumentDB cluster snapshot.
   129  	EngineVersion *string `pulumi:"engineVersion"`
   130  	// If storageEncrypted is true, the AWS KMS key identifier for the encrypted DocumentDB cluster snapshot.
   131  	KmsKeyId *string `pulumi:"kmsKeyId"`
   132  	// Port that the DocumentDB cluster was listening on at the time of the snapshot.
   133  	Port                       *int    `pulumi:"port"`
   134  	SnapshotType               *string `pulumi:"snapshotType"`
   135  	SourceDbClusterSnapshotArn *string `pulumi:"sourceDbClusterSnapshotArn"`
   136  	// The status of this DocumentDB Cluster Snapshot.
   137  	Status *string `pulumi:"status"`
   138  	// Specifies whether the DocumentDB cluster snapshot is encrypted.
   139  	StorageEncrypted *bool `pulumi:"storageEncrypted"`
   140  	// The VPC ID associated with the DocumentDB cluster snapshot.
   141  	VpcId *string `pulumi:"vpcId"`
   142  }
   143  
   144  type ClusterSnapshotState struct {
   145  	// List of EC2 Availability Zones that instances in the DocumentDB cluster snapshot can be restored in.
   146  	AvailabilityZones pulumi.StringArrayInput
   147  	// The DocumentDB Cluster Identifier from which to take the snapshot.
   148  	DbClusterIdentifier pulumi.StringPtrInput
   149  	// The Amazon Resource Name (ARN) for the DocumentDB Cluster Snapshot.
   150  	DbClusterSnapshotArn pulumi.StringPtrInput
   151  	// The Identifier for the snapshot.
   152  	DbClusterSnapshotIdentifier pulumi.StringPtrInput
   153  	// Specifies the name of the database engine.
   154  	Engine pulumi.StringPtrInput
   155  	// Version of the database engine for this DocumentDB cluster snapshot.
   156  	EngineVersion pulumi.StringPtrInput
   157  	// If storageEncrypted is true, the AWS KMS key identifier for the encrypted DocumentDB cluster snapshot.
   158  	KmsKeyId pulumi.StringPtrInput
   159  	// Port that the DocumentDB cluster was listening on at the time of the snapshot.
   160  	Port                       pulumi.IntPtrInput
   161  	SnapshotType               pulumi.StringPtrInput
   162  	SourceDbClusterSnapshotArn pulumi.StringPtrInput
   163  	// The status of this DocumentDB Cluster Snapshot.
   164  	Status pulumi.StringPtrInput
   165  	// Specifies whether the DocumentDB cluster snapshot is encrypted.
   166  	StorageEncrypted pulumi.BoolPtrInput
   167  	// The VPC ID associated with the DocumentDB cluster snapshot.
   168  	VpcId pulumi.StringPtrInput
   169  }
   170  
   171  func (ClusterSnapshotState) ElementType() reflect.Type {
   172  	return reflect.TypeOf((*clusterSnapshotState)(nil)).Elem()
   173  }
   174  
   175  type clusterSnapshotArgs struct {
   176  	// The DocumentDB Cluster Identifier from which to take the snapshot.
   177  	DbClusterIdentifier string `pulumi:"dbClusterIdentifier"`
   178  	// The Identifier for the snapshot.
   179  	DbClusterSnapshotIdentifier string `pulumi:"dbClusterSnapshotIdentifier"`
   180  }
   181  
   182  // The set of arguments for constructing a ClusterSnapshot resource.
   183  type ClusterSnapshotArgs struct {
   184  	// The DocumentDB Cluster Identifier from which to take the snapshot.
   185  	DbClusterIdentifier pulumi.StringInput
   186  	// The Identifier for the snapshot.
   187  	DbClusterSnapshotIdentifier pulumi.StringInput
   188  }
   189  
   190  func (ClusterSnapshotArgs) ElementType() reflect.Type {
   191  	return reflect.TypeOf((*clusterSnapshotArgs)(nil)).Elem()
   192  }
   193  
   194  type ClusterSnapshotInput interface {
   195  	pulumi.Input
   196  
   197  	ToClusterSnapshotOutput() ClusterSnapshotOutput
   198  	ToClusterSnapshotOutputWithContext(ctx context.Context) ClusterSnapshotOutput
   199  }
   200  
   201  func (*ClusterSnapshot) ElementType() reflect.Type {
   202  	return reflect.TypeOf((**ClusterSnapshot)(nil)).Elem()
   203  }
   204  
   205  func (i *ClusterSnapshot) ToClusterSnapshotOutput() ClusterSnapshotOutput {
   206  	return i.ToClusterSnapshotOutputWithContext(context.Background())
   207  }
   208  
   209  func (i *ClusterSnapshot) ToClusterSnapshotOutputWithContext(ctx context.Context) ClusterSnapshotOutput {
   210  	return pulumi.ToOutputWithContext(ctx, i).(ClusterSnapshotOutput)
   211  }
   212  
   213  // ClusterSnapshotArrayInput is an input type that accepts ClusterSnapshotArray and ClusterSnapshotArrayOutput values.
   214  // You can construct a concrete instance of `ClusterSnapshotArrayInput` via:
   215  //
   216  //	ClusterSnapshotArray{ ClusterSnapshotArgs{...} }
   217  type ClusterSnapshotArrayInput interface {
   218  	pulumi.Input
   219  
   220  	ToClusterSnapshotArrayOutput() ClusterSnapshotArrayOutput
   221  	ToClusterSnapshotArrayOutputWithContext(context.Context) ClusterSnapshotArrayOutput
   222  }
   223  
   224  type ClusterSnapshotArray []ClusterSnapshotInput
   225  
   226  func (ClusterSnapshotArray) ElementType() reflect.Type {
   227  	return reflect.TypeOf((*[]*ClusterSnapshot)(nil)).Elem()
   228  }
   229  
   230  func (i ClusterSnapshotArray) ToClusterSnapshotArrayOutput() ClusterSnapshotArrayOutput {
   231  	return i.ToClusterSnapshotArrayOutputWithContext(context.Background())
   232  }
   233  
   234  func (i ClusterSnapshotArray) ToClusterSnapshotArrayOutputWithContext(ctx context.Context) ClusterSnapshotArrayOutput {
   235  	return pulumi.ToOutputWithContext(ctx, i).(ClusterSnapshotArrayOutput)
   236  }
   237  
   238  // ClusterSnapshotMapInput is an input type that accepts ClusterSnapshotMap and ClusterSnapshotMapOutput values.
   239  // You can construct a concrete instance of `ClusterSnapshotMapInput` via:
   240  //
   241  //	ClusterSnapshotMap{ "key": ClusterSnapshotArgs{...} }
   242  type ClusterSnapshotMapInput interface {
   243  	pulumi.Input
   244  
   245  	ToClusterSnapshotMapOutput() ClusterSnapshotMapOutput
   246  	ToClusterSnapshotMapOutputWithContext(context.Context) ClusterSnapshotMapOutput
   247  }
   248  
   249  type ClusterSnapshotMap map[string]ClusterSnapshotInput
   250  
   251  func (ClusterSnapshotMap) ElementType() reflect.Type {
   252  	return reflect.TypeOf((*map[string]*ClusterSnapshot)(nil)).Elem()
   253  }
   254  
   255  func (i ClusterSnapshotMap) ToClusterSnapshotMapOutput() ClusterSnapshotMapOutput {
   256  	return i.ToClusterSnapshotMapOutputWithContext(context.Background())
   257  }
   258  
   259  func (i ClusterSnapshotMap) ToClusterSnapshotMapOutputWithContext(ctx context.Context) ClusterSnapshotMapOutput {
   260  	return pulumi.ToOutputWithContext(ctx, i).(ClusterSnapshotMapOutput)
   261  }
   262  
   263  type ClusterSnapshotOutput struct{ *pulumi.OutputState }
   264  
   265  func (ClusterSnapshotOutput) ElementType() reflect.Type {
   266  	return reflect.TypeOf((**ClusterSnapshot)(nil)).Elem()
   267  }
   268  
   269  func (o ClusterSnapshotOutput) ToClusterSnapshotOutput() ClusterSnapshotOutput {
   270  	return o
   271  }
   272  
   273  func (o ClusterSnapshotOutput) ToClusterSnapshotOutputWithContext(ctx context.Context) ClusterSnapshotOutput {
   274  	return o
   275  }
   276  
   277  // List of EC2 Availability Zones that instances in the DocumentDB cluster snapshot can be restored in.
   278  func (o ClusterSnapshotOutput) AvailabilityZones() pulumi.StringArrayOutput {
   279  	return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringArrayOutput { return v.AvailabilityZones }).(pulumi.StringArrayOutput)
   280  }
   281  
   282  // The DocumentDB Cluster Identifier from which to take the snapshot.
   283  func (o ClusterSnapshotOutput) DbClusterIdentifier() pulumi.StringOutput {
   284  	return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.DbClusterIdentifier }).(pulumi.StringOutput)
   285  }
   286  
   287  // The Amazon Resource Name (ARN) for the DocumentDB Cluster Snapshot.
   288  func (o ClusterSnapshotOutput) DbClusterSnapshotArn() pulumi.StringOutput {
   289  	return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.DbClusterSnapshotArn }).(pulumi.StringOutput)
   290  }
   291  
   292  // The Identifier for the snapshot.
   293  func (o ClusterSnapshotOutput) DbClusterSnapshotIdentifier() pulumi.StringOutput {
   294  	return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.DbClusterSnapshotIdentifier }).(pulumi.StringOutput)
   295  }
   296  
   297  // Specifies the name of the database engine.
   298  func (o ClusterSnapshotOutput) Engine() pulumi.StringOutput {
   299  	return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.Engine }).(pulumi.StringOutput)
   300  }
   301  
   302  // Version of the database engine for this DocumentDB cluster snapshot.
   303  func (o ClusterSnapshotOutput) EngineVersion() pulumi.StringOutput {
   304  	return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.EngineVersion }).(pulumi.StringOutput)
   305  }
   306  
   307  // If storageEncrypted is true, the AWS KMS key identifier for the encrypted DocumentDB cluster snapshot.
   308  func (o ClusterSnapshotOutput) KmsKeyId() pulumi.StringOutput {
   309  	return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.KmsKeyId }).(pulumi.StringOutput)
   310  }
   311  
   312  // Port that the DocumentDB cluster was listening on at the time of the snapshot.
   313  func (o ClusterSnapshotOutput) Port() pulumi.IntOutput {
   314  	return o.ApplyT(func(v *ClusterSnapshot) pulumi.IntOutput { return v.Port }).(pulumi.IntOutput)
   315  }
   316  
   317  func (o ClusterSnapshotOutput) SnapshotType() pulumi.StringOutput {
   318  	return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.SnapshotType }).(pulumi.StringOutput)
   319  }
   320  
   321  func (o ClusterSnapshotOutput) SourceDbClusterSnapshotArn() pulumi.StringOutput {
   322  	return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.SourceDbClusterSnapshotArn }).(pulumi.StringOutput)
   323  }
   324  
   325  // The status of this DocumentDB Cluster Snapshot.
   326  func (o ClusterSnapshotOutput) Status() pulumi.StringOutput {
   327  	return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
   328  }
   329  
   330  // Specifies whether the DocumentDB cluster snapshot is encrypted.
   331  func (o ClusterSnapshotOutput) StorageEncrypted() pulumi.BoolOutput {
   332  	return o.ApplyT(func(v *ClusterSnapshot) pulumi.BoolOutput { return v.StorageEncrypted }).(pulumi.BoolOutput)
   333  }
   334  
   335  // The VPC ID associated with the DocumentDB cluster snapshot.
   336  func (o ClusterSnapshotOutput) VpcId() pulumi.StringOutput {
   337  	return o.ApplyT(func(v *ClusterSnapshot) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput)
   338  }
   339  
   340  type ClusterSnapshotArrayOutput struct{ *pulumi.OutputState }
   341  
   342  func (ClusterSnapshotArrayOutput) ElementType() reflect.Type {
   343  	return reflect.TypeOf((*[]*ClusterSnapshot)(nil)).Elem()
   344  }
   345  
   346  func (o ClusterSnapshotArrayOutput) ToClusterSnapshotArrayOutput() ClusterSnapshotArrayOutput {
   347  	return o
   348  }
   349  
   350  func (o ClusterSnapshotArrayOutput) ToClusterSnapshotArrayOutputWithContext(ctx context.Context) ClusterSnapshotArrayOutput {
   351  	return o
   352  }
   353  
   354  func (o ClusterSnapshotArrayOutput) Index(i pulumi.IntInput) ClusterSnapshotOutput {
   355  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ClusterSnapshot {
   356  		return vs[0].([]*ClusterSnapshot)[vs[1].(int)]
   357  	}).(ClusterSnapshotOutput)
   358  }
   359  
   360  type ClusterSnapshotMapOutput struct{ *pulumi.OutputState }
   361  
   362  func (ClusterSnapshotMapOutput) ElementType() reflect.Type {
   363  	return reflect.TypeOf((*map[string]*ClusterSnapshot)(nil)).Elem()
   364  }
   365  
   366  func (o ClusterSnapshotMapOutput) ToClusterSnapshotMapOutput() ClusterSnapshotMapOutput {
   367  	return o
   368  }
   369  
   370  func (o ClusterSnapshotMapOutput) ToClusterSnapshotMapOutputWithContext(ctx context.Context) ClusterSnapshotMapOutput {
   371  	return o
   372  }
   373  
   374  func (o ClusterSnapshotMapOutput) MapIndex(k pulumi.StringInput) ClusterSnapshotOutput {
   375  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ClusterSnapshot {
   376  		return vs[0].(map[string]*ClusterSnapshot)[vs[1].(string)]
   377  	}).(ClusterSnapshotOutput)
   378  }
   379  
   380  func init() {
   381  	pulumi.RegisterInputType(reflect.TypeOf((*ClusterSnapshotInput)(nil)).Elem(), &ClusterSnapshot{})
   382  	pulumi.RegisterInputType(reflect.TypeOf((*ClusterSnapshotArrayInput)(nil)).Elem(), ClusterSnapshotArray{})
   383  	pulumi.RegisterInputType(reflect.TypeOf((*ClusterSnapshotMapInput)(nil)).Elem(), ClusterSnapshotMap{})
   384  	pulumi.RegisterOutputType(ClusterSnapshotOutput{})
   385  	pulumi.RegisterOutputType(ClusterSnapshotArrayOutput{})
   386  	pulumi.RegisterOutputType(ClusterSnapshotMapOutput{})
   387  }