github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/secretsmanager/getSecrets.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  // Use this data source to get the ARNs and names of Secrets Manager secrets matching the specified criteria.
    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/secretsmanager"
    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 := secretsmanager.GetSecrets(ctx, &secretsmanager.GetSecretsArgs{
    32  //				Filters: []secretsmanager.GetSecretsFilter{
    33  //					{
    34  //						Name: "name",
    35  //						Values: []string{
    36  //							"example",
    37  //						},
    38  //					},
    39  //				},
    40  //			}, nil)
    41  //			if err != nil {
    42  //				return err
    43  //			}
    44  //			return nil
    45  //		})
    46  //	}
    47  //
    48  // ```
    49  // <!--End PulumiCodeChooser -->
    50  func GetSecrets(ctx *pulumi.Context, args *GetSecretsArgs, opts ...pulumi.InvokeOption) (*GetSecretsResult, error) {
    51  	opts = internal.PkgInvokeDefaultOpts(opts)
    52  	var rv GetSecretsResult
    53  	err := ctx.Invoke("aws:secretsmanager/getSecrets:getSecrets", args, &rv, opts...)
    54  	if err != nil {
    55  		return nil, err
    56  	}
    57  	return &rv, nil
    58  }
    59  
    60  // A collection of arguments for invoking getSecrets.
    61  type GetSecretsArgs struct {
    62  	// Configuration block(s) for filtering. Detailed below.
    63  	Filters []GetSecretsFilter `pulumi:"filters"`
    64  }
    65  
    66  // A collection of values returned by getSecrets.
    67  type GetSecretsResult struct {
    68  	// Set of ARNs of the matched Secrets Manager secrets.
    69  	Arns    []string           `pulumi:"arns"`
    70  	Filters []GetSecretsFilter `pulumi:"filters"`
    71  	// The provider-assigned unique ID for this managed resource.
    72  	Id string `pulumi:"id"`
    73  	// Set of names of the matched Secrets Manager secrets.
    74  	Names []string `pulumi:"names"`
    75  }
    76  
    77  func GetSecretsOutput(ctx *pulumi.Context, args GetSecretsOutputArgs, opts ...pulumi.InvokeOption) GetSecretsResultOutput {
    78  	return pulumi.ToOutputWithContext(context.Background(), args).
    79  		ApplyT(func(v interface{}) (GetSecretsResult, error) {
    80  			args := v.(GetSecretsArgs)
    81  			r, err := GetSecrets(ctx, &args, opts...)
    82  			var s GetSecretsResult
    83  			if r != nil {
    84  				s = *r
    85  			}
    86  			return s, err
    87  		}).(GetSecretsResultOutput)
    88  }
    89  
    90  // A collection of arguments for invoking getSecrets.
    91  type GetSecretsOutputArgs struct {
    92  	// Configuration block(s) for filtering. Detailed below.
    93  	Filters GetSecretsFilterArrayInput `pulumi:"filters"`
    94  }
    95  
    96  func (GetSecretsOutputArgs) ElementType() reflect.Type {
    97  	return reflect.TypeOf((*GetSecretsArgs)(nil)).Elem()
    98  }
    99  
   100  // A collection of values returned by getSecrets.
   101  type GetSecretsResultOutput struct{ *pulumi.OutputState }
   102  
   103  func (GetSecretsResultOutput) ElementType() reflect.Type {
   104  	return reflect.TypeOf((*GetSecretsResult)(nil)).Elem()
   105  }
   106  
   107  func (o GetSecretsResultOutput) ToGetSecretsResultOutput() GetSecretsResultOutput {
   108  	return o
   109  }
   110  
   111  func (o GetSecretsResultOutput) ToGetSecretsResultOutputWithContext(ctx context.Context) GetSecretsResultOutput {
   112  	return o
   113  }
   114  
   115  // Set of ARNs of the matched Secrets Manager secrets.
   116  func (o GetSecretsResultOutput) Arns() pulumi.StringArrayOutput {
   117  	return o.ApplyT(func(v GetSecretsResult) []string { return v.Arns }).(pulumi.StringArrayOutput)
   118  }
   119  
   120  func (o GetSecretsResultOutput) Filters() GetSecretsFilterArrayOutput {
   121  	return o.ApplyT(func(v GetSecretsResult) []GetSecretsFilter { return v.Filters }).(GetSecretsFilterArrayOutput)
   122  }
   123  
   124  // The provider-assigned unique ID for this managed resource.
   125  func (o GetSecretsResultOutput) Id() pulumi.StringOutput {
   126  	return o.ApplyT(func(v GetSecretsResult) string { return v.Id }).(pulumi.StringOutput)
   127  }
   128  
   129  // Set of names of the matched Secrets Manager secrets.
   130  func (o GetSecretsResultOutput) Names() pulumi.StringArrayOutput {
   131  	return o.ApplyT(func(v GetSecretsResult) []string { return v.Names }).(pulumi.StringArrayOutput)
   132  }
   133  
   134  func init() {
   135  	pulumi.RegisterOutputType(GetSecretsResultOutput{})
   136  }