github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ssm/getParameter.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 ssm
     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 an SSM Parameter data source.
    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/ssm"
    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 := ssm.LookupParameter(ctx, &ssm.LookupParameterArgs{
    32  //				Name: "foo",
    33  //			}, nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			return nil
    38  //		})
    39  //	}
    40  //
    41  // ```
    42  // <!--End PulumiCodeChooser -->
    43  //
    44  // > **Note:** The unencrypted value of a SecureString will be stored in the raw state as plain-text.
    45  func LookupParameter(ctx *pulumi.Context, args *LookupParameterArgs, opts ...pulumi.InvokeOption) (*LookupParameterResult, error) {
    46  	opts = internal.PkgInvokeDefaultOpts(opts)
    47  	var rv LookupParameterResult
    48  	err := ctx.Invoke("aws:ssm/getParameter:getParameter", 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 getParameter.
    56  type LookupParameterArgs struct {
    57  	// Name of the parameter.
    58  	Name string `pulumi:"name"`
    59  	// Whether to return decrypted `SecureString` value. Defaults to `true`.
    60  	//
    61  	// In addition to all arguments above, the following attributes are exported:
    62  	WithDecryption *bool `pulumi:"withDecryption"`
    63  }
    64  
    65  // A collection of values returned by getParameter.
    66  type LookupParameterResult struct {
    67  	Arn string `pulumi:"arn"`
    68  	// The provider-assigned unique ID for this managed resource.
    69  	Id             string `pulumi:"id"`
    70  	InsecureValue  string `pulumi:"insecureValue"`
    71  	Name           string `pulumi:"name"`
    72  	Type           string `pulumi:"type"`
    73  	Value          string `pulumi:"value"`
    74  	Version        int    `pulumi:"version"`
    75  	WithDecryption *bool  `pulumi:"withDecryption"`
    76  }
    77  
    78  func LookupParameterOutput(ctx *pulumi.Context, args LookupParameterOutputArgs, opts ...pulumi.InvokeOption) LookupParameterResultOutput {
    79  	return pulumi.ToOutputWithContext(context.Background(), args).
    80  		ApplyT(func(v interface{}) (LookupParameterResult, error) {
    81  			args := v.(LookupParameterArgs)
    82  			r, err := LookupParameter(ctx, &args, opts...)
    83  			var s LookupParameterResult
    84  			if r != nil {
    85  				s = *r
    86  			}
    87  			return s, err
    88  		}).(LookupParameterResultOutput)
    89  }
    90  
    91  // A collection of arguments for invoking getParameter.
    92  type LookupParameterOutputArgs struct {
    93  	// Name of the parameter.
    94  	Name pulumi.StringInput `pulumi:"name"`
    95  	// Whether to return decrypted `SecureString` value. Defaults to `true`.
    96  	//
    97  	// In addition to all arguments above, the following attributes are exported:
    98  	WithDecryption pulumi.BoolPtrInput `pulumi:"withDecryption"`
    99  }
   100  
   101  func (LookupParameterOutputArgs) ElementType() reflect.Type {
   102  	return reflect.TypeOf((*LookupParameterArgs)(nil)).Elem()
   103  }
   104  
   105  // A collection of values returned by getParameter.
   106  type LookupParameterResultOutput struct{ *pulumi.OutputState }
   107  
   108  func (LookupParameterResultOutput) ElementType() reflect.Type {
   109  	return reflect.TypeOf((*LookupParameterResult)(nil)).Elem()
   110  }
   111  
   112  func (o LookupParameterResultOutput) ToLookupParameterResultOutput() LookupParameterResultOutput {
   113  	return o
   114  }
   115  
   116  func (o LookupParameterResultOutput) ToLookupParameterResultOutputWithContext(ctx context.Context) LookupParameterResultOutput {
   117  	return o
   118  }
   119  
   120  func (o LookupParameterResultOutput) Arn() pulumi.StringOutput {
   121  	return o.ApplyT(func(v LookupParameterResult) string { return v.Arn }).(pulumi.StringOutput)
   122  }
   123  
   124  // The provider-assigned unique ID for this managed resource.
   125  func (o LookupParameterResultOutput) Id() pulumi.StringOutput {
   126  	return o.ApplyT(func(v LookupParameterResult) string { return v.Id }).(pulumi.StringOutput)
   127  }
   128  
   129  func (o LookupParameterResultOutput) InsecureValue() pulumi.StringOutput {
   130  	return o.ApplyT(func(v LookupParameterResult) string { return v.InsecureValue }).(pulumi.StringOutput)
   131  }
   132  
   133  func (o LookupParameterResultOutput) Name() pulumi.StringOutput {
   134  	return o.ApplyT(func(v LookupParameterResult) string { return v.Name }).(pulumi.StringOutput)
   135  }
   136  
   137  func (o LookupParameterResultOutput) Type() pulumi.StringOutput {
   138  	return o.ApplyT(func(v LookupParameterResult) string { return v.Type }).(pulumi.StringOutput)
   139  }
   140  
   141  func (o LookupParameterResultOutput) Value() pulumi.StringOutput {
   142  	return o.ApplyT(func(v LookupParameterResult) string { return v.Value }).(pulumi.StringOutput)
   143  }
   144  
   145  func (o LookupParameterResultOutput) Version() pulumi.IntOutput {
   146  	return o.ApplyT(func(v LookupParameterResult) int { return v.Version }).(pulumi.IntOutput)
   147  }
   148  
   149  func (o LookupParameterResultOutput) WithDecryption() pulumi.BoolPtrOutput {
   150  	return o.ApplyT(func(v LookupParameterResult) *bool { return v.WithDecryption }).(pulumi.BoolPtrOutput)
   151  }
   152  
   153  func init() {
   154  	pulumi.RegisterOutputType(LookupParameterResultOutput{})
   155  }