github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudfront/getFunction.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 cloudfront
     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 CloudFront Function.
    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/cloudfront"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			cfg := config.New(ctx, "")
    33  //			functionName := cfg.Require("functionName")
    34  //			_, err := cloudfront.LookupFunction(ctx, &cloudfront.LookupFunctionArgs{
    35  //				Name: functionName,
    36  //			}, nil)
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			return nil
    41  //		})
    42  //	}
    43  //
    44  // ```
    45  // <!--End PulumiCodeChooser -->
    46  func LookupFunction(ctx *pulumi.Context, args *LookupFunctionArgs, opts ...pulumi.InvokeOption) (*LookupFunctionResult, error) {
    47  	opts = internal.PkgInvokeDefaultOpts(opts)
    48  	var rv LookupFunctionResult
    49  	err := ctx.Invoke("aws:cloudfront/getFunction:getFunction", args, &rv, opts...)
    50  	if err != nil {
    51  		return nil, err
    52  	}
    53  	return &rv, nil
    54  }
    55  
    56  // A collection of arguments for invoking getFunction.
    57  type LookupFunctionArgs struct {
    58  	// Name of the CloudFront function.
    59  	Name string `pulumi:"name"`
    60  	// Function’s stage, either `DEVELOPMENT` or `LIVE`.
    61  	Stage string `pulumi:"stage"`
    62  }
    63  
    64  // A collection of values returned by getFunction.
    65  type LookupFunctionResult struct {
    66  	// ARN identifying your CloudFront Function.
    67  	Arn string `pulumi:"arn"`
    68  	// Source code of the function
    69  	Code string `pulumi:"code"`
    70  	// Comment.
    71  	Comment string `pulumi:"comment"`
    72  	// ETag hash of the function
    73  	Etag string `pulumi:"etag"`
    74  	// The provider-assigned unique ID for this managed resource.
    75  	Id string `pulumi:"id"`
    76  	// List of `cloudfront.KeyValueStore` ARNs associated to the function.
    77  	KeyValueStoreAssociations []string `pulumi:"keyValueStoreAssociations"`
    78  	// When this resource was last modified.
    79  	LastModifiedTime string `pulumi:"lastModifiedTime"`
    80  	Name             string `pulumi:"name"`
    81  	// Identifier of the function's runtime.
    82  	Runtime string `pulumi:"runtime"`
    83  	Stage   string `pulumi:"stage"`
    84  	// Status of the function. Can be `UNPUBLISHED`, `UNASSOCIATED` or `ASSOCIATED`.
    85  	Status string `pulumi:"status"`
    86  }
    87  
    88  func LookupFunctionOutput(ctx *pulumi.Context, args LookupFunctionOutputArgs, opts ...pulumi.InvokeOption) LookupFunctionResultOutput {
    89  	return pulumi.ToOutputWithContext(context.Background(), args).
    90  		ApplyT(func(v interface{}) (LookupFunctionResult, error) {
    91  			args := v.(LookupFunctionArgs)
    92  			r, err := LookupFunction(ctx, &args, opts...)
    93  			var s LookupFunctionResult
    94  			if r != nil {
    95  				s = *r
    96  			}
    97  			return s, err
    98  		}).(LookupFunctionResultOutput)
    99  }
   100  
   101  // A collection of arguments for invoking getFunction.
   102  type LookupFunctionOutputArgs struct {
   103  	// Name of the CloudFront function.
   104  	Name pulumi.StringInput `pulumi:"name"`
   105  	// Function’s stage, either `DEVELOPMENT` or `LIVE`.
   106  	Stage pulumi.StringInput `pulumi:"stage"`
   107  }
   108  
   109  func (LookupFunctionOutputArgs) ElementType() reflect.Type {
   110  	return reflect.TypeOf((*LookupFunctionArgs)(nil)).Elem()
   111  }
   112  
   113  // A collection of values returned by getFunction.
   114  type LookupFunctionResultOutput struct{ *pulumi.OutputState }
   115  
   116  func (LookupFunctionResultOutput) ElementType() reflect.Type {
   117  	return reflect.TypeOf((*LookupFunctionResult)(nil)).Elem()
   118  }
   119  
   120  func (o LookupFunctionResultOutput) ToLookupFunctionResultOutput() LookupFunctionResultOutput {
   121  	return o
   122  }
   123  
   124  func (o LookupFunctionResultOutput) ToLookupFunctionResultOutputWithContext(ctx context.Context) LookupFunctionResultOutput {
   125  	return o
   126  }
   127  
   128  // ARN identifying your CloudFront Function.
   129  func (o LookupFunctionResultOutput) Arn() pulumi.StringOutput {
   130  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Arn }).(pulumi.StringOutput)
   131  }
   132  
   133  // Source code of the function
   134  func (o LookupFunctionResultOutput) Code() pulumi.StringOutput {
   135  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Code }).(pulumi.StringOutput)
   136  }
   137  
   138  // Comment.
   139  func (o LookupFunctionResultOutput) Comment() pulumi.StringOutput {
   140  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Comment }).(pulumi.StringOutput)
   141  }
   142  
   143  // ETag hash of the function
   144  func (o LookupFunctionResultOutput) Etag() pulumi.StringOutput {
   145  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Etag }).(pulumi.StringOutput)
   146  }
   147  
   148  // The provider-assigned unique ID for this managed resource.
   149  func (o LookupFunctionResultOutput) Id() pulumi.StringOutput {
   150  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Id }).(pulumi.StringOutput)
   151  }
   152  
   153  // List of `cloudfront.KeyValueStore` ARNs associated to the function.
   154  func (o LookupFunctionResultOutput) KeyValueStoreAssociations() pulumi.StringArrayOutput {
   155  	return o.ApplyT(func(v LookupFunctionResult) []string { return v.KeyValueStoreAssociations }).(pulumi.StringArrayOutput)
   156  }
   157  
   158  // When this resource was last modified.
   159  func (o LookupFunctionResultOutput) LastModifiedTime() pulumi.StringOutput {
   160  	return o.ApplyT(func(v LookupFunctionResult) string { return v.LastModifiedTime }).(pulumi.StringOutput)
   161  }
   162  
   163  func (o LookupFunctionResultOutput) Name() pulumi.StringOutput {
   164  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Name }).(pulumi.StringOutput)
   165  }
   166  
   167  // Identifier of the function's runtime.
   168  func (o LookupFunctionResultOutput) Runtime() pulumi.StringOutput {
   169  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Runtime }).(pulumi.StringOutput)
   170  }
   171  
   172  func (o LookupFunctionResultOutput) Stage() pulumi.StringOutput {
   173  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Stage }).(pulumi.StringOutput)
   174  }
   175  
   176  // Status of the function. Can be `UNPUBLISHED`, `UNASSOCIATED` or `ASSOCIATED`.
   177  func (o LookupFunctionResultOutput) Status() pulumi.StringOutput {
   178  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Status }).(pulumi.StringOutput)
   179  }
   180  
   181  func init() {
   182  	pulumi.RegisterOutputType(LookupFunctionResultOutput{})
   183  }