github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/memorydb/getSnapshot.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 memorydb
     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 information about a MemoryDB Snapshot.
    15  //
    16  // ## Example Usage
    17  //
    18  // <!--Start PulumiCodeChooser -->
    19  // ```go
    20  // package main
    21  //
    22  // import (
    23  //
    24  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/memorydb"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			_, err := memorydb.LookupSnapshot(ctx, &memorydb.LookupSnapshotArgs{
    32  //				Name: "my-snapshot",
    33  //			}, nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			return nil
    38  //		})
    39  //	}
    40  //
    41  // ```
    42  // <!--End PulumiCodeChooser -->
    43  func LookupSnapshot(ctx *pulumi.Context, args *LookupSnapshotArgs, opts ...pulumi.InvokeOption) (*LookupSnapshotResult, error) {
    44  	opts = internal.PkgInvokeDefaultOpts(opts)
    45  	var rv LookupSnapshotResult
    46  	err := ctx.Invoke("aws:memorydb/getSnapshot:getSnapshot", args, &rv, opts...)
    47  	if err != nil {
    48  		return nil, err
    49  	}
    50  	return &rv, nil
    51  }
    52  
    53  // A collection of arguments for invoking getSnapshot.
    54  type LookupSnapshotArgs struct {
    55  	// Name of the snapshot.
    56  	Name string `pulumi:"name"`
    57  	// Map of tags assigned to the snapshot.
    58  	Tags map[string]string `pulumi:"tags"`
    59  }
    60  
    61  // A collection of values returned by getSnapshot.
    62  type LookupSnapshotResult struct {
    63  	// ARN of the snapshot.
    64  	Arn string `pulumi:"arn"`
    65  	// The configuration of the cluster from which the snapshot was taken.
    66  	ClusterConfigurations []GetSnapshotClusterConfiguration `pulumi:"clusterConfigurations"`
    67  	// Name of the MemoryDB cluster that this snapshot was taken from.
    68  	ClusterName string `pulumi:"clusterName"`
    69  	// The provider-assigned unique ID for this managed resource.
    70  	Id string `pulumi:"id"`
    71  	// ARN of the KMS key used to encrypt the snapshot at rest.
    72  	KmsKeyArn string `pulumi:"kmsKeyArn"`
    73  	// Name of the cluster.
    74  	Name string `pulumi:"name"`
    75  	// Whether the snapshot is from an automatic backup (`automated`) or was created manually (`manual`).
    76  	Source string `pulumi:"source"`
    77  	// Map of tags assigned to the snapshot.
    78  	Tags map[string]string `pulumi:"tags"`
    79  }
    80  
    81  func LookupSnapshotOutput(ctx *pulumi.Context, args LookupSnapshotOutputArgs, opts ...pulumi.InvokeOption) LookupSnapshotResultOutput {
    82  	return pulumi.ToOutputWithContext(context.Background(), args).
    83  		ApplyT(func(v interface{}) (LookupSnapshotResult, error) {
    84  			args := v.(LookupSnapshotArgs)
    85  			r, err := LookupSnapshot(ctx, &args, opts...)
    86  			var s LookupSnapshotResult
    87  			if r != nil {
    88  				s = *r
    89  			}
    90  			return s, err
    91  		}).(LookupSnapshotResultOutput)
    92  }
    93  
    94  // A collection of arguments for invoking getSnapshot.
    95  type LookupSnapshotOutputArgs struct {
    96  	// Name of the snapshot.
    97  	Name pulumi.StringInput `pulumi:"name"`
    98  	// Map of tags assigned to the snapshot.
    99  	Tags pulumi.StringMapInput `pulumi:"tags"`
   100  }
   101  
   102  func (LookupSnapshotOutputArgs) ElementType() reflect.Type {
   103  	return reflect.TypeOf((*LookupSnapshotArgs)(nil)).Elem()
   104  }
   105  
   106  // A collection of values returned by getSnapshot.
   107  type LookupSnapshotResultOutput struct{ *pulumi.OutputState }
   108  
   109  func (LookupSnapshotResultOutput) ElementType() reflect.Type {
   110  	return reflect.TypeOf((*LookupSnapshotResult)(nil)).Elem()
   111  }
   112  
   113  func (o LookupSnapshotResultOutput) ToLookupSnapshotResultOutput() LookupSnapshotResultOutput {
   114  	return o
   115  }
   116  
   117  func (o LookupSnapshotResultOutput) ToLookupSnapshotResultOutputWithContext(ctx context.Context) LookupSnapshotResultOutput {
   118  	return o
   119  }
   120  
   121  // ARN of the snapshot.
   122  func (o LookupSnapshotResultOutput) Arn() pulumi.StringOutput {
   123  	return o.ApplyT(func(v LookupSnapshotResult) string { return v.Arn }).(pulumi.StringOutput)
   124  }
   125  
   126  // The configuration of the cluster from which the snapshot was taken.
   127  func (o LookupSnapshotResultOutput) ClusterConfigurations() GetSnapshotClusterConfigurationArrayOutput {
   128  	return o.ApplyT(func(v LookupSnapshotResult) []GetSnapshotClusterConfiguration { return v.ClusterConfigurations }).(GetSnapshotClusterConfigurationArrayOutput)
   129  }
   130  
   131  // Name of the MemoryDB cluster that this snapshot was taken from.
   132  func (o LookupSnapshotResultOutput) ClusterName() pulumi.StringOutput {
   133  	return o.ApplyT(func(v LookupSnapshotResult) string { return v.ClusterName }).(pulumi.StringOutput)
   134  }
   135  
   136  // The provider-assigned unique ID for this managed resource.
   137  func (o LookupSnapshotResultOutput) Id() pulumi.StringOutput {
   138  	return o.ApplyT(func(v LookupSnapshotResult) string { return v.Id }).(pulumi.StringOutput)
   139  }
   140  
   141  // ARN of the KMS key used to encrypt the snapshot at rest.
   142  func (o LookupSnapshotResultOutput) KmsKeyArn() pulumi.StringOutput {
   143  	return o.ApplyT(func(v LookupSnapshotResult) string { return v.KmsKeyArn }).(pulumi.StringOutput)
   144  }
   145  
   146  // Name of the cluster.
   147  func (o LookupSnapshotResultOutput) Name() pulumi.StringOutput {
   148  	return o.ApplyT(func(v LookupSnapshotResult) string { return v.Name }).(pulumi.StringOutput)
   149  }
   150  
   151  // Whether the snapshot is from an automatic backup (`automated`) or was created manually (`manual`).
   152  func (o LookupSnapshotResultOutput) Source() pulumi.StringOutput {
   153  	return o.ApplyT(func(v LookupSnapshotResult) string { return v.Source }).(pulumi.StringOutput)
   154  }
   155  
   156  // Map of tags assigned to the snapshot.
   157  func (o LookupSnapshotResultOutput) Tags() pulumi.StringMapOutput {
   158  	return o.ApplyT(func(v LookupSnapshotResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   159  }
   160  
   161  func init() {
   162  	pulumi.RegisterOutputType(LookupSnapshotResultOutput{})
   163  }