github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/secretsmanager/getSecretRotation.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 secretsmanager
     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  // Retrieve information about a Secrets Manager secret rotation. To retrieve secret metadata, see the `secretsmanager.Secret` data source. To retrieve a secret value, see the `secretsmanager.SecretVersion` data source.
    15  //
    16  // ## Example Usage
    17  //
    18  // ### Retrieve Secret Rotation Configuration
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/secretsmanager"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := secretsmanager.LookupSecretRotation(ctx, &secretsmanager.LookupSecretRotationArgs{
    34  //				SecretId: exampleAwsSecretsmanagerSecret.Id,
    35  //			}, nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  func LookupSecretRotation(ctx *pulumi.Context, args *LookupSecretRotationArgs, opts ...pulumi.InvokeOption) (*LookupSecretRotationResult, error) {
    46  	opts = internal.PkgInvokeDefaultOpts(opts)
    47  	var rv LookupSecretRotationResult
    48  	err := ctx.Invoke("aws:secretsmanager/getSecretRotation:getSecretRotation", args, &rv, opts...)
    49  	if err != nil {
    50  		return nil, err
    51  	}
    52  	return &rv, nil
    53  }
    54  
    55  // A collection of arguments for invoking getSecretRotation.
    56  type LookupSecretRotationArgs struct {
    57  	// Specifies the secret containing the version that you want to retrieve. You can specify either the ARN or the friendly name of the secret.
    58  	SecretId string `pulumi:"secretId"`
    59  }
    60  
    61  // A collection of values returned by getSecretRotation.
    62  type LookupSecretRotationResult struct {
    63  	// The provider-assigned unique ID for this managed resource.
    64  	Id string `pulumi:"id"`
    65  	// ARN of the secret.
    66  	RotationEnabled bool `pulumi:"rotationEnabled"`
    67  	// Decrypted part of the protected secret information that was originally provided as a string.
    68  	RotationLambdaArn string `pulumi:"rotationLambdaArn"`
    69  	// Decrypted part of the protected secret information that was originally provided as a binary. Base64 encoded.
    70  	RotationRules []GetSecretRotationRotationRule `pulumi:"rotationRules"`
    71  	SecretId      string                          `pulumi:"secretId"`
    72  }
    73  
    74  func LookupSecretRotationOutput(ctx *pulumi.Context, args LookupSecretRotationOutputArgs, opts ...pulumi.InvokeOption) LookupSecretRotationResultOutput {
    75  	return pulumi.ToOutputWithContext(context.Background(), args).
    76  		ApplyT(func(v interface{}) (LookupSecretRotationResult, error) {
    77  			args := v.(LookupSecretRotationArgs)
    78  			r, err := LookupSecretRotation(ctx, &args, opts...)
    79  			var s LookupSecretRotationResult
    80  			if r != nil {
    81  				s = *r
    82  			}
    83  			return s, err
    84  		}).(LookupSecretRotationResultOutput)
    85  }
    86  
    87  // A collection of arguments for invoking getSecretRotation.
    88  type LookupSecretRotationOutputArgs struct {
    89  	// Specifies the secret containing the version that you want to retrieve. You can specify either the ARN or the friendly name of the secret.
    90  	SecretId pulumi.StringInput `pulumi:"secretId"`
    91  }
    92  
    93  func (LookupSecretRotationOutputArgs) ElementType() reflect.Type {
    94  	return reflect.TypeOf((*LookupSecretRotationArgs)(nil)).Elem()
    95  }
    96  
    97  // A collection of values returned by getSecretRotation.
    98  type LookupSecretRotationResultOutput struct{ *pulumi.OutputState }
    99  
   100  func (LookupSecretRotationResultOutput) ElementType() reflect.Type {
   101  	return reflect.TypeOf((*LookupSecretRotationResult)(nil)).Elem()
   102  }
   103  
   104  func (o LookupSecretRotationResultOutput) ToLookupSecretRotationResultOutput() LookupSecretRotationResultOutput {
   105  	return o
   106  }
   107  
   108  func (o LookupSecretRotationResultOutput) ToLookupSecretRotationResultOutputWithContext(ctx context.Context) LookupSecretRotationResultOutput {
   109  	return o
   110  }
   111  
   112  // The provider-assigned unique ID for this managed resource.
   113  func (o LookupSecretRotationResultOutput) Id() pulumi.StringOutput {
   114  	return o.ApplyT(func(v LookupSecretRotationResult) string { return v.Id }).(pulumi.StringOutput)
   115  }
   116  
   117  // ARN of the secret.
   118  func (o LookupSecretRotationResultOutput) RotationEnabled() pulumi.BoolOutput {
   119  	return o.ApplyT(func(v LookupSecretRotationResult) bool { return v.RotationEnabled }).(pulumi.BoolOutput)
   120  }
   121  
   122  // Decrypted part of the protected secret information that was originally provided as a string.
   123  func (o LookupSecretRotationResultOutput) RotationLambdaArn() pulumi.StringOutput {
   124  	return o.ApplyT(func(v LookupSecretRotationResult) string { return v.RotationLambdaArn }).(pulumi.StringOutput)
   125  }
   126  
   127  // Decrypted part of the protected secret information that was originally provided as a binary. Base64 encoded.
   128  func (o LookupSecretRotationResultOutput) RotationRules() GetSecretRotationRotationRuleArrayOutput {
   129  	return o.ApplyT(func(v LookupSecretRotationResult) []GetSecretRotationRotationRule { return v.RotationRules }).(GetSecretRotationRotationRuleArrayOutput)
   130  }
   131  
   132  func (o LookupSecretRotationResultOutput) SecretId() pulumi.StringOutput {
   133  	return o.ApplyT(func(v LookupSecretRotationResult) string { return v.SecretId }).(pulumi.StringOutput)
   134  }
   135  
   136  func init() {
   137  	pulumi.RegisterOutputType(LookupSecretRotationResultOutput{})
   138  }