github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lambda/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 lambda
     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 Lambda 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/lambda"
    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 := lambda.LookupFunction(ctx, &lambda.LookupFunctionArgs{
    35  //				FunctionName: 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:lambda/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 lambda function.
    59  	FunctionName string `pulumi:"functionName"`
    60  	// Alias name or version number of the lambda functionE.g., `$LATEST`, `my-alias`, or `1`. When not included: the data source resolves to the most recent published version; if no published version exists: it resolves to the most recent unpublished version.
    61  	Qualifier *string           `pulumi:"qualifier"`
    62  	Tags      map[string]string `pulumi:"tags"`
    63  }
    64  
    65  // A collection of values returned by getFunction.
    66  type LookupFunctionResult struct {
    67  	// Instruction set architecture for the Lambda function.
    68  	Architectures []string `pulumi:"architectures"`
    69  	// Unqualified (no `:QUALIFIER` or `:VERSION` suffix) ARN identifying your Lambda Function. See also `qualifiedArn`.
    70  	Arn string `pulumi:"arn"`
    71  	// ARN for a Code Signing Configuration.
    72  	CodeSigningConfigArn string `pulumi:"codeSigningConfigArn"`
    73  	// Configure the function's *dead letter queue*.
    74  	DeadLetterConfig GetFunctionDeadLetterConfig `pulumi:"deadLetterConfig"`
    75  	// Description of what your Lambda Function does.
    76  	Description string `pulumi:"description"`
    77  	// Lambda environment's configuration settings.
    78  	Environment GetFunctionEnvironment `pulumi:"environment"`
    79  	// Amount of Ephemeral storage(`/tmp`) allocated for the Lambda Function.
    80  	EphemeralStorages []GetFunctionEphemeralStorage `pulumi:"ephemeralStorages"`
    81  	// Connection settings for an Amazon EFS file system.
    82  	FileSystemConfigs []GetFunctionFileSystemConfig `pulumi:"fileSystemConfigs"`
    83  	FunctionName      string                        `pulumi:"functionName"`
    84  	// Function entrypoint in your code.
    85  	Handler string `pulumi:"handler"`
    86  	// The provider-assigned unique ID for this managed resource.
    87  	Id string `pulumi:"id"`
    88  	// URI of the container image.
    89  	ImageUri string `pulumi:"imageUri"`
    90  	// ARN to be used for invoking Lambda Function from API Gateway. **NOTE:** Starting with `v4.51.0` of the provider, this will *not* include the qualifier.
    91  	InvokeArn string `pulumi:"invokeArn"`
    92  	// ARN for the KMS encryption key.
    93  	KmsKeyArn string `pulumi:"kmsKeyArn"`
    94  	// Date this resource was last modified.
    95  	LastModified string `pulumi:"lastModified"`
    96  	// List of Lambda Layer ARNs attached to your Lambda Function.
    97  	Layers []string `pulumi:"layers"`
    98  	// Advanced logging settings.
    99  	LoggingConfigs []GetFunctionLoggingConfig `pulumi:"loggingConfigs"`
   100  	// Amount of memory in MB your Lambda Function can use at runtime.
   101  	MemorySize int `pulumi:"memorySize"`
   102  	// Qualified (`:QUALIFIER` or `:VERSION` suffix) ARN identifying your Lambda Function. See also `arn`.
   103  	QualifiedArn string `pulumi:"qualifiedArn"`
   104  	// Qualified (`:QUALIFIER` or `:VERSION` suffix) ARN to be used for invoking Lambda Function from API Gateway. See also `invokeArn`.
   105  	QualifiedInvokeArn string  `pulumi:"qualifiedInvokeArn"`
   106  	Qualifier          *string `pulumi:"qualifier"`
   107  	// The amount of reserved concurrent executions for this lambda function or `-1` if unreserved.
   108  	ReservedConcurrentExecutions int `pulumi:"reservedConcurrentExecutions"`
   109  	// IAM role attached to the Lambda Function.
   110  	Role string `pulumi:"role"`
   111  	// Runtime environment for the Lambda function.
   112  	Runtime string `pulumi:"runtime"`
   113  	// ARN of a signing job.
   114  	SigningJobArn string `pulumi:"signingJobArn"`
   115  	// The ARN for a signing profile version.
   116  	SigningProfileVersionArn string `pulumi:"signingProfileVersionArn"`
   117  	// Base64-encoded representation of raw SHA-256 sum of the zip file.
   118  	SourceCodeHash string `pulumi:"sourceCodeHash"`
   119  	// Size in bytes of the function .zip file.
   120  	SourceCodeSize int               `pulumi:"sourceCodeSize"`
   121  	Tags           map[string]string `pulumi:"tags"`
   122  	// Function execution time at which Lambda should terminate the function.
   123  	Timeout int `pulumi:"timeout"`
   124  	// Tracing settings of the function.
   125  	TracingConfig GetFunctionTracingConfig `pulumi:"tracingConfig"`
   126  	// The version of the Lambda function returned. If `qualifier` is not set, this will resolve to the most recent published version. If no published version of the function exists, `version` will resolve to `$LATEST`.
   127  	Version string `pulumi:"version"`
   128  	// VPC configuration associated with your Lambda function.
   129  	VpcConfig GetFunctionVpcConfig `pulumi:"vpcConfig"`
   130  }
   131  
   132  func LookupFunctionOutput(ctx *pulumi.Context, args LookupFunctionOutputArgs, opts ...pulumi.InvokeOption) LookupFunctionResultOutput {
   133  	return pulumi.ToOutputWithContext(context.Background(), args).
   134  		ApplyT(func(v interface{}) (LookupFunctionResult, error) {
   135  			args := v.(LookupFunctionArgs)
   136  			r, err := LookupFunction(ctx, &args, opts...)
   137  			var s LookupFunctionResult
   138  			if r != nil {
   139  				s = *r
   140  			}
   141  			return s, err
   142  		}).(LookupFunctionResultOutput)
   143  }
   144  
   145  // A collection of arguments for invoking getFunction.
   146  type LookupFunctionOutputArgs struct {
   147  	// Name of the lambda function.
   148  	FunctionName pulumi.StringInput `pulumi:"functionName"`
   149  	// Alias name or version number of the lambda functionE.g., `$LATEST`, `my-alias`, or `1`. When not included: the data source resolves to the most recent published version; if no published version exists: it resolves to the most recent unpublished version.
   150  	Qualifier pulumi.StringPtrInput `pulumi:"qualifier"`
   151  	Tags      pulumi.StringMapInput `pulumi:"tags"`
   152  }
   153  
   154  func (LookupFunctionOutputArgs) ElementType() reflect.Type {
   155  	return reflect.TypeOf((*LookupFunctionArgs)(nil)).Elem()
   156  }
   157  
   158  // A collection of values returned by getFunction.
   159  type LookupFunctionResultOutput struct{ *pulumi.OutputState }
   160  
   161  func (LookupFunctionResultOutput) ElementType() reflect.Type {
   162  	return reflect.TypeOf((*LookupFunctionResult)(nil)).Elem()
   163  }
   164  
   165  func (o LookupFunctionResultOutput) ToLookupFunctionResultOutput() LookupFunctionResultOutput {
   166  	return o
   167  }
   168  
   169  func (o LookupFunctionResultOutput) ToLookupFunctionResultOutputWithContext(ctx context.Context) LookupFunctionResultOutput {
   170  	return o
   171  }
   172  
   173  // Instruction set architecture for the Lambda function.
   174  func (o LookupFunctionResultOutput) Architectures() pulumi.StringArrayOutput {
   175  	return o.ApplyT(func(v LookupFunctionResult) []string { return v.Architectures }).(pulumi.StringArrayOutput)
   176  }
   177  
   178  // Unqualified (no `:QUALIFIER` or `:VERSION` suffix) ARN identifying your Lambda Function. See also `qualifiedArn`.
   179  func (o LookupFunctionResultOutput) Arn() pulumi.StringOutput {
   180  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Arn }).(pulumi.StringOutput)
   181  }
   182  
   183  // ARN for a Code Signing Configuration.
   184  func (o LookupFunctionResultOutput) CodeSigningConfigArn() pulumi.StringOutput {
   185  	return o.ApplyT(func(v LookupFunctionResult) string { return v.CodeSigningConfigArn }).(pulumi.StringOutput)
   186  }
   187  
   188  // Configure the function's *dead letter queue*.
   189  func (o LookupFunctionResultOutput) DeadLetterConfig() GetFunctionDeadLetterConfigOutput {
   190  	return o.ApplyT(func(v LookupFunctionResult) GetFunctionDeadLetterConfig { return v.DeadLetterConfig }).(GetFunctionDeadLetterConfigOutput)
   191  }
   192  
   193  // Description of what your Lambda Function does.
   194  func (o LookupFunctionResultOutput) Description() pulumi.StringOutput {
   195  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Description }).(pulumi.StringOutput)
   196  }
   197  
   198  // Lambda environment's configuration settings.
   199  func (o LookupFunctionResultOutput) Environment() GetFunctionEnvironmentOutput {
   200  	return o.ApplyT(func(v LookupFunctionResult) GetFunctionEnvironment { return v.Environment }).(GetFunctionEnvironmentOutput)
   201  }
   202  
   203  // Amount of Ephemeral storage(`/tmp`) allocated for the Lambda Function.
   204  func (o LookupFunctionResultOutput) EphemeralStorages() GetFunctionEphemeralStorageArrayOutput {
   205  	return o.ApplyT(func(v LookupFunctionResult) []GetFunctionEphemeralStorage { return v.EphemeralStorages }).(GetFunctionEphemeralStorageArrayOutput)
   206  }
   207  
   208  // Connection settings for an Amazon EFS file system.
   209  func (o LookupFunctionResultOutput) FileSystemConfigs() GetFunctionFileSystemConfigArrayOutput {
   210  	return o.ApplyT(func(v LookupFunctionResult) []GetFunctionFileSystemConfig { return v.FileSystemConfigs }).(GetFunctionFileSystemConfigArrayOutput)
   211  }
   212  
   213  func (o LookupFunctionResultOutput) FunctionName() pulumi.StringOutput {
   214  	return o.ApplyT(func(v LookupFunctionResult) string { return v.FunctionName }).(pulumi.StringOutput)
   215  }
   216  
   217  // Function entrypoint in your code.
   218  func (o LookupFunctionResultOutput) Handler() pulumi.StringOutput {
   219  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Handler }).(pulumi.StringOutput)
   220  }
   221  
   222  // The provider-assigned unique ID for this managed resource.
   223  func (o LookupFunctionResultOutput) Id() pulumi.StringOutput {
   224  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Id }).(pulumi.StringOutput)
   225  }
   226  
   227  // URI of the container image.
   228  func (o LookupFunctionResultOutput) ImageUri() pulumi.StringOutput {
   229  	return o.ApplyT(func(v LookupFunctionResult) string { return v.ImageUri }).(pulumi.StringOutput)
   230  }
   231  
   232  // ARN to be used for invoking Lambda Function from API Gateway. **NOTE:** Starting with `v4.51.0` of the provider, this will *not* include the qualifier.
   233  func (o LookupFunctionResultOutput) InvokeArn() pulumi.StringOutput {
   234  	return o.ApplyT(func(v LookupFunctionResult) string { return v.InvokeArn }).(pulumi.StringOutput)
   235  }
   236  
   237  // ARN for the KMS encryption key.
   238  func (o LookupFunctionResultOutput) KmsKeyArn() pulumi.StringOutput {
   239  	return o.ApplyT(func(v LookupFunctionResult) string { return v.KmsKeyArn }).(pulumi.StringOutput)
   240  }
   241  
   242  // Date this resource was last modified.
   243  func (o LookupFunctionResultOutput) LastModified() pulumi.StringOutput {
   244  	return o.ApplyT(func(v LookupFunctionResult) string { return v.LastModified }).(pulumi.StringOutput)
   245  }
   246  
   247  // List of Lambda Layer ARNs attached to your Lambda Function.
   248  func (o LookupFunctionResultOutput) Layers() pulumi.StringArrayOutput {
   249  	return o.ApplyT(func(v LookupFunctionResult) []string { return v.Layers }).(pulumi.StringArrayOutput)
   250  }
   251  
   252  // Advanced logging settings.
   253  func (o LookupFunctionResultOutput) LoggingConfigs() GetFunctionLoggingConfigArrayOutput {
   254  	return o.ApplyT(func(v LookupFunctionResult) []GetFunctionLoggingConfig { return v.LoggingConfigs }).(GetFunctionLoggingConfigArrayOutput)
   255  }
   256  
   257  // Amount of memory in MB your Lambda Function can use at runtime.
   258  func (o LookupFunctionResultOutput) MemorySize() pulumi.IntOutput {
   259  	return o.ApplyT(func(v LookupFunctionResult) int { return v.MemorySize }).(pulumi.IntOutput)
   260  }
   261  
   262  // Qualified (`:QUALIFIER` or `:VERSION` suffix) ARN identifying your Lambda Function. See also `arn`.
   263  func (o LookupFunctionResultOutput) QualifiedArn() pulumi.StringOutput {
   264  	return o.ApplyT(func(v LookupFunctionResult) string { return v.QualifiedArn }).(pulumi.StringOutput)
   265  }
   266  
   267  // Qualified (`:QUALIFIER` or `:VERSION` suffix) ARN to be used for invoking Lambda Function from API Gateway. See also `invokeArn`.
   268  func (o LookupFunctionResultOutput) QualifiedInvokeArn() pulumi.StringOutput {
   269  	return o.ApplyT(func(v LookupFunctionResult) string { return v.QualifiedInvokeArn }).(pulumi.StringOutput)
   270  }
   271  
   272  func (o LookupFunctionResultOutput) Qualifier() pulumi.StringPtrOutput {
   273  	return o.ApplyT(func(v LookupFunctionResult) *string { return v.Qualifier }).(pulumi.StringPtrOutput)
   274  }
   275  
   276  // The amount of reserved concurrent executions for this lambda function or `-1` if unreserved.
   277  func (o LookupFunctionResultOutput) ReservedConcurrentExecutions() pulumi.IntOutput {
   278  	return o.ApplyT(func(v LookupFunctionResult) int { return v.ReservedConcurrentExecutions }).(pulumi.IntOutput)
   279  }
   280  
   281  // IAM role attached to the Lambda Function.
   282  func (o LookupFunctionResultOutput) Role() pulumi.StringOutput {
   283  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Role }).(pulumi.StringOutput)
   284  }
   285  
   286  // Runtime environment for the Lambda function.
   287  func (o LookupFunctionResultOutput) Runtime() pulumi.StringOutput {
   288  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Runtime }).(pulumi.StringOutput)
   289  }
   290  
   291  // ARN of a signing job.
   292  func (o LookupFunctionResultOutput) SigningJobArn() pulumi.StringOutput {
   293  	return o.ApplyT(func(v LookupFunctionResult) string { return v.SigningJobArn }).(pulumi.StringOutput)
   294  }
   295  
   296  // The ARN for a signing profile version.
   297  func (o LookupFunctionResultOutput) SigningProfileVersionArn() pulumi.StringOutput {
   298  	return o.ApplyT(func(v LookupFunctionResult) string { return v.SigningProfileVersionArn }).(pulumi.StringOutput)
   299  }
   300  
   301  // Base64-encoded representation of raw SHA-256 sum of the zip file.
   302  func (o LookupFunctionResultOutput) SourceCodeHash() pulumi.StringOutput {
   303  	return o.ApplyT(func(v LookupFunctionResult) string { return v.SourceCodeHash }).(pulumi.StringOutput)
   304  }
   305  
   306  // Size in bytes of the function .zip file.
   307  func (o LookupFunctionResultOutput) SourceCodeSize() pulumi.IntOutput {
   308  	return o.ApplyT(func(v LookupFunctionResult) int { return v.SourceCodeSize }).(pulumi.IntOutput)
   309  }
   310  
   311  func (o LookupFunctionResultOutput) Tags() pulumi.StringMapOutput {
   312  	return o.ApplyT(func(v LookupFunctionResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   313  }
   314  
   315  // Function execution time at which Lambda should terminate the function.
   316  func (o LookupFunctionResultOutput) Timeout() pulumi.IntOutput {
   317  	return o.ApplyT(func(v LookupFunctionResult) int { return v.Timeout }).(pulumi.IntOutput)
   318  }
   319  
   320  // Tracing settings of the function.
   321  func (o LookupFunctionResultOutput) TracingConfig() GetFunctionTracingConfigOutput {
   322  	return o.ApplyT(func(v LookupFunctionResult) GetFunctionTracingConfig { return v.TracingConfig }).(GetFunctionTracingConfigOutput)
   323  }
   324  
   325  // The version of the Lambda function returned. If `qualifier` is not set, this will resolve to the most recent published version. If no published version of the function exists, `version` will resolve to `$LATEST`.
   326  func (o LookupFunctionResultOutput) Version() pulumi.StringOutput {
   327  	return o.ApplyT(func(v LookupFunctionResult) string { return v.Version }).(pulumi.StringOutput)
   328  }
   329  
   330  // VPC configuration associated with your Lambda function.
   331  func (o LookupFunctionResultOutput) VpcConfig() GetFunctionVpcConfigOutput {
   332  	return o.ApplyT(func(v LookupFunctionResult) GetFunctionVpcConfig { return v.VpcConfig }).(GetFunctionVpcConfigOutput)
   333  }
   334  
   335  func init() {
   336  	pulumi.RegisterOutputType(LookupFunctionResultOutput{})
   337  }