github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lambda/getInvocation.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  // Use this data source to invoke custom lambda functions as data source.
    15  // The lambda function is invoked with [RequestResponse](https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html#API_Invoke_RequestSyntax)
    16  // invocation type.
    17  //
    18  // > **NOTE:** If you get a `KMSAccessDeniedException: Lambda was unable to decrypt the environment variables because KMS access was denied` error when invoking an `lambda.Function` with environment variables, the IAM role associated with the function may have been deleted and recreated _after_ the function was created. You can fix the problem two ways: 1) updating the function's role to another role and then updating it back again to the recreated role, or 2) by using Pulumi to `taint` the function and `apply` your configuration again to recreate the function. (When you create a function, Lambda grants permissions on the KMS key to the function's IAM role. If the IAM role is recreated, the grant is no longer valid. Changing the function's role or recreating the function causes Lambda to update the grant.)
    19  func LookupInvocation(ctx *pulumi.Context, args *LookupInvocationArgs, opts ...pulumi.InvokeOption) (*LookupInvocationResult, error) {
    20  	opts = internal.PkgInvokeDefaultOpts(opts)
    21  	var rv LookupInvocationResult
    22  	err := ctx.Invoke("aws:lambda/getInvocation:getInvocation", args, &rv, opts...)
    23  	if err != nil {
    24  		return nil, err
    25  	}
    26  	return &rv, nil
    27  }
    28  
    29  // A collection of arguments for invoking getInvocation.
    30  type LookupInvocationArgs struct {
    31  	// Name of the lambda function.
    32  	FunctionName string `pulumi:"functionName"`
    33  	// String in JSON format that is passed as payload to the lambda function.
    34  	Input string `pulumi:"input"`
    35  	// Qualifier (a.k.a version) of the lambda function. Defaults
    36  	// to `$LATEST`.
    37  	Qualifier *string `pulumi:"qualifier"`
    38  }
    39  
    40  // A collection of values returned by getInvocation.
    41  type LookupInvocationResult struct {
    42  	FunctionName string `pulumi:"functionName"`
    43  	// The provider-assigned unique ID for this managed resource.
    44  	Id        string  `pulumi:"id"`
    45  	Input     string  `pulumi:"input"`
    46  	Qualifier *string `pulumi:"qualifier"`
    47  	// String result of the lambda function invocation.
    48  	Result string `pulumi:"result"`
    49  }
    50  
    51  func LookupInvocationOutput(ctx *pulumi.Context, args LookupInvocationOutputArgs, opts ...pulumi.InvokeOption) LookupInvocationResultOutput {
    52  	return pulumi.ToOutputWithContext(context.Background(), args).
    53  		ApplyT(func(v interface{}) (LookupInvocationResult, error) {
    54  			args := v.(LookupInvocationArgs)
    55  			r, err := LookupInvocation(ctx, &args, opts...)
    56  			var s LookupInvocationResult
    57  			if r != nil {
    58  				s = *r
    59  			}
    60  			return s, err
    61  		}).(LookupInvocationResultOutput)
    62  }
    63  
    64  // A collection of arguments for invoking getInvocation.
    65  type LookupInvocationOutputArgs struct {
    66  	// Name of the lambda function.
    67  	FunctionName pulumi.StringInput `pulumi:"functionName"`
    68  	// String in JSON format that is passed as payload to the lambda function.
    69  	Input pulumi.StringInput `pulumi:"input"`
    70  	// Qualifier (a.k.a version) of the lambda function. Defaults
    71  	// to `$LATEST`.
    72  	Qualifier pulumi.StringPtrInput `pulumi:"qualifier"`
    73  }
    74  
    75  func (LookupInvocationOutputArgs) ElementType() reflect.Type {
    76  	return reflect.TypeOf((*LookupInvocationArgs)(nil)).Elem()
    77  }
    78  
    79  // A collection of values returned by getInvocation.
    80  type LookupInvocationResultOutput struct{ *pulumi.OutputState }
    81  
    82  func (LookupInvocationResultOutput) ElementType() reflect.Type {
    83  	return reflect.TypeOf((*LookupInvocationResult)(nil)).Elem()
    84  }
    85  
    86  func (o LookupInvocationResultOutput) ToLookupInvocationResultOutput() LookupInvocationResultOutput {
    87  	return o
    88  }
    89  
    90  func (o LookupInvocationResultOutput) ToLookupInvocationResultOutputWithContext(ctx context.Context) LookupInvocationResultOutput {
    91  	return o
    92  }
    93  
    94  func (o LookupInvocationResultOutput) FunctionName() pulumi.StringOutput {
    95  	return o.ApplyT(func(v LookupInvocationResult) string { return v.FunctionName }).(pulumi.StringOutput)
    96  }
    97  
    98  // The provider-assigned unique ID for this managed resource.
    99  func (o LookupInvocationResultOutput) Id() pulumi.StringOutput {
   100  	return o.ApplyT(func(v LookupInvocationResult) string { return v.Id }).(pulumi.StringOutput)
   101  }
   102  
   103  func (o LookupInvocationResultOutput) Input() pulumi.StringOutput {
   104  	return o.ApplyT(func(v LookupInvocationResult) string { return v.Input }).(pulumi.StringOutput)
   105  }
   106  
   107  func (o LookupInvocationResultOutput) Qualifier() pulumi.StringPtrOutput {
   108  	return o.ApplyT(func(v LookupInvocationResult) *string { return v.Qualifier }).(pulumi.StringPtrOutput)
   109  }
   110  
   111  // String result of the lambda function invocation.
   112  func (o LookupInvocationResultOutput) Result() pulumi.StringOutput {
   113  	return o.ApplyT(func(v LookupInvocationResult) string { return v.Result }).(pulumi.StringOutput)
   114  }
   115  
   116  func init() {
   117  	pulumi.RegisterOutputType(LookupInvocationResultOutput{})
   118  }