github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lambda/functionEventInvokeConfig.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 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Manages an asynchronous invocation configuration for a Lambda Function or Alias. More information about asynchronous invocations and the configurable values can be found in the [Lambda Developer Guide](https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html). 16 // 17 // ## Example Usage 18 // 19 // ### Destination Configuration 20 // 21 // > **NOTE:** Ensure the Lambda Function IAM Role has necessary permissions for the destination, such as `sqs:SendMessage` or `sns:Publish`, otherwise the API will return a generic `InvalidParameterValueException: The destination ARN arn:PARTITION:SERVICE:REGION:ACCOUNT:RESOURCE is invalid.` error. 22 // 23 // <!--Start PulumiCodeChooser --> 24 // ```go 25 // package main 26 // 27 // import ( 28 // 29 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" 30 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 31 // 32 // ) 33 // 34 // func main() { 35 // pulumi.Run(func(ctx *pulumi.Context) error { 36 // _, err := lambda.NewFunctionEventInvokeConfig(ctx, "example", &lambda.FunctionEventInvokeConfigArgs{ 37 // FunctionName: pulumi.Any(exampleAwsLambdaAlias.FunctionName), 38 // DestinationConfig: &lambda.FunctionEventInvokeConfigDestinationConfigArgs{ 39 // OnFailure: &lambda.FunctionEventInvokeConfigDestinationConfigOnFailureArgs{ 40 // Destination: pulumi.Any(exampleAwsSqsQueue.Arn), 41 // }, 42 // OnSuccess: &lambda.FunctionEventInvokeConfigDestinationConfigOnSuccessArgs{ 43 // Destination: pulumi.Any(exampleAwsSnsTopic.Arn), 44 // }, 45 // }, 46 // }) 47 // if err != nil { 48 // return err 49 // } 50 // return nil 51 // }) 52 // } 53 // 54 // ``` 55 // <!--End PulumiCodeChooser --> 56 // 57 // ### Error Handling Configuration 58 // 59 // <!--Start PulumiCodeChooser --> 60 // ```go 61 // package main 62 // 63 // import ( 64 // 65 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" 66 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 67 // 68 // ) 69 // 70 // func main() { 71 // pulumi.Run(func(ctx *pulumi.Context) error { 72 // _, err := lambda.NewFunctionEventInvokeConfig(ctx, "example", &lambda.FunctionEventInvokeConfigArgs{ 73 // FunctionName: pulumi.Any(exampleAwsLambdaAlias.FunctionName), 74 // MaximumEventAgeInSeconds: pulumi.Int(60), 75 // MaximumRetryAttempts: pulumi.Int(0), 76 // }) 77 // if err != nil { 78 // return err 79 // } 80 // return nil 81 // }) 82 // } 83 // 84 // ``` 85 // <!--End PulumiCodeChooser --> 86 // 87 // ### Configuration for Alias Name 88 // 89 // <!--Start PulumiCodeChooser --> 90 // ```go 91 // package main 92 // 93 // import ( 94 // 95 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" 96 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 97 // 98 // ) 99 // 100 // func main() { 101 // pulumi.Run(func(ctx *pulumi.Context) error { 102 // _, err := lambda.NewFunctionEventInvokeConfig(ctx, "example", &lambda.FunctionEventInvokeConfigArgs{ 103 // FunctionName: pulumi.Any(exampleAwsLambdaAlias.FunctionName), 104 // Qualifier: pulumi.Any(exampleAwsLambdaAlias.Name), 105 // }) 106 // if err != nil { 107 // return err 108 // } 109 // return nil 110 // }) 111 // } 112 // 113 // ``` 114 // <!--End PulumiCodeChooser --> 115 // 116 // ### Configuration for Function Latest Unpublished Version 117 // 118 // <!--Start PulumiCodeChooser --> 119 // ```go 120 // package main 121 // 122 // import ( 123 // 124 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" 125 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 126 // 127 // ) 128 // 129 // func main() { 130 // pulumi.Run(func(ctx *pulumi.Context) error { 131 // _, err := lambda.NewFunctionEventInvokeConfig(ctx, "example", &lambda.FunctionEventInvokeConfigArgs{ 132 // FunctionName: pulumi.Any(exampleAwsLambdaFunction.FunctionName), 133 // Qualifier: pulumi.String("$LATEST"), 134 // }) 135 // if err != nil { 136 // return err 137 // } 138 // return nil 139 // }) 140 // } 141 // 142 // ``` 143 // <!--End PulumiCodeChooser --> 144 // 145 // ### Configuration for Function Published Version 146 // 147 // <!--Start PulumiCodeChooser --> 148 // ```go 149 // package main 150 // 151 // import ( 152 // 153 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" 154 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 155 // 156 // ) 157 // 158 // func main() { 159 // pulumi.Run(func(ctx *pulumi.Context) error { 160 // _, err := lambda.NewFunctionEventInvokeConfig(ctx, "example", &lambda.FunctionEventInvokeConfigArgs{ 161 // FunctionName: pulumi.Any(exampleAwsLambdaFunction.FunctionName), 162 // Qualifier: pulumi.Any(exampleAwsLambdaFunction.Version), 163 // }) 164 // if err != nil { 165 // return err 166 // } 167 // return nil 168 // }) 169 // } 170 // 171 // ``` 172 // <!--End PulumiCodeChooser --> 173 // 174 // ## Import 175 // 176 // ARN with qualifier: 177 // 178 // Name without qualifier (all versions and aliases): 179 // 180 // Name with qualifier: 181 // 182 // __Using `pulumi import` to import__ Lambda Function Event Invoke Configs using the fully qualified Function name or Amazon Resource Name (ARN). For example: 183 // 184 // ARN without qualifier (all versions and aliases): 185 // 186 // ```sh 187 // $ pulumi import aws:lambda/functionEventInvokeConfig:FunctionEventInvokeConfig example arn:aws:us-east-1:123456789012:function:my_function 188 // ``` 189 // ARN with qualifier: 190 // 191 // ```sh 192 // $ pulumi import aws:lambda/functionEventInvokeConfig:FunctionEventInvokeConfig example arn:aws:us-east-1:123456789012:function:my_function:production 193 // ``` 194 // Name without qualifier (all versions and aliases): 195 // 196 // ```sh 197 // $ pulumi import aws:lambda/functionEventInvokeConfig:FunctionEventInvokeConfig example my_function 198 // ``` 199 // Name with qualifier: 200 // 201 // ```sh 202 // $ pulumi import aws:lambda/functionEventInvokeConfig:FunctionEventInvokeConfig example my_function:production 203 // ``` 204 type FunctionEventInvokeConfig struct { 205 pulumi.CustomResourceState 206 207 // Configuration block with destination configuration. See below for details. 208 DestinationConfig FunctionEventInvokeConfigDestinationConfigPtrOutput `pulumi:"destinationConfig"` 209 // Name or Amazon Resource Name (ARN) of the Lambda Function, omitting any version or alias qualifier. 210 // 211 // The following arguments are optional: 212 FunctionName pulumi.StringOutput `pulumi:"functionName"` 213 // Maximum age of a request that Lambda sends to a function for processing in seconds. Valid values between 60 and 21600. 214 MaximumEventAgeInSeconds pulumi.IntPtrOutput `pulumi:"maximumEventAgeInSeconds"` 215 // Maximum number of times to retry when the function returns an error. Valid values between 0 and 2. Defaults to 2. 216 MaximumRetryAttempts pulumi.IntPtrOutput `pulumi:"maximumRetryAttempts"` 217 // Lambda Function published version, `$LATEST`, or Lambda Alias name. 218 Qualifier pulumi.StringPtrOutput `pulumi:"qualifier"` 219 } 220 221 // NewFunctionEventInvokeConfig registers a new resource with the given unique name, arguments, and options. 222 func NewFunctionEventInvokeConfig(ctx *pulumi.Context, 223 name string, args *FunctionEventInvokeConfigArgs, opts ...pulumi.ResourceOption) (*FunctionEventInvokeConfig, error) { 224 if args == nil { 225 return nil, errors.New("missing one or more required arguments") 226 } 227 228 if args.FunctionName == nil { 229 return nil, errors.New("invalid value for required argument 'FunctionName'") 230 } 231 opts = internal.PkgResourceDefaultOpts(opts) 232 var resource FunctionEventInvokeConfig 233 err := ctx.RegisterResource("aws:lambda/functionEventInvokeConfig:FunctionEventInvokeConfig", name, args, &resource, opts...) 234 if err != nil { 235 return nil, err 236 } 237 return &resource, nil 238 } 239 240 // GetFunctionEventInvokeConfig gets an existing FunctionEventInvokeConfig resource's state with the given name, ID, and optional 241 // state properties that are used to uniquely qualify the lookup (nil if not required). 242 func GetFunctionEventInvokeConfig(ctx *pulumi.Context, 243 name string, id pulumi.IDInput, state *FunctionEventInvokeConfigState, opts ...pulumi.ResourceOption) (*FunctionEventInvokeConfig, error) { 244 var resource FunctionEventInvokeConfig 245 err := ctx.ReadResource("aws:lambda/functionEventInvokeConfig:FunctionEventInvokeConfig", name, id, state, &resource, opts...) 246 if err != nil { 247 return nil, err 248 } 249 return &resource, nil 250 } 251 252 // Input properties used for looking up and filtering FunctionEventInvokeConfig resources. 253 type functionEventInvokeConfigState struct { 254 // Configuration block with destination configuration. See below for details. 255 DestinationConfig *FunctionEventInvokeConfigDestinationConfig `pulumi:"destinationConfig"` 256 // Name or Amazon Resource Name (ARN) of the Lambda Function, omitting any version or alias qualifier. 257 // 258 // The following arguments are optional: 259 FunctionName *string `pulumi:"functionName"` 260 // Maximum age of a request that Lambda sends to a function for processing in seconds. Valid values between 60 and 21600. 261 MaximumEventAgeInSeconds *int `pulumi:"maximumEventAgeInSeconds"` 262 // Maximum number of times to retry when the function returns an error. Valid values between 0 and 2. Defaults to 2. 263 MaximumRetryAttempts *int `pulumi:"maximumRetryAttempts"` 264 // Lambda Function published version, `$LATEST`, or Lambda Alias name. 265 Qualifier *string `pulumi:"qualifier"` 266 } 267 268 type FunctionEventInvokeConfigState struct { 269 // Configuration block with destination configuration. See below for details. 270 DestinationConfig FunctionEventInvokeConfigDestinationConfigPtrInput 271 // Name or Amazon Resource Name (ARN) of the Lambda Function, omitting any version or alias qualifier. 272 // 273 // The following arguments are optional: 274 FunctionName pulumi.StringPtrInput 275 // Maximum age of a request that Lambda sends to a function for processing in seconds. Valid values between 60 and 21600. 276 MaximumEventAgeInSeconds pulumi.IntPtrInput 277 // Maximum number of times to retry when the function returns an error. Valid values between 0 and 2. Defaults to 2. 278 MaximumRetryAttempts pulumi.IntPtrInput 279 // Lambda Function published version, `$LATEST`, or Lambda Alias name. 280 Qualifier pulumi.StringPtrInput 281 } 282 283 func (FunctionEventInvokeConfigState) ElementType() reflect.Type { 284 return reflect.TypeOf((*functionEventInvokeConfigState)(nil)).Elem() 285 } 286 287 type functionEventInvokeConfigArgs struct { 288 // Configuration block with destination configuration. See below for details. 289 DestinationConfig *FunctionEventInvokeConfigDestinationConfig `pulumi:"destinationConfig"` 290 // Name or Amazon Resource Name (ARN) of the Lambda Function, omitting any version or alias qualifier. 291 // 292 // The following arguments are optional: 293 FunctionName string `pulumi:"functionName"` 294 // Maximum age of a request that Lambda sends to a function for processing in seconds. Valid values between 60 and 21600. 295 MaximumEventAgeInSeconds *int `pulumi:"maximumEventAgeInSeconds"` 296 // Maximum number of times to retry when the function returns an error. Valid values between 0 and 2. Defaults to 2. 297 MaximumRetryAttempts *int `pulumi:"maximumRetryAttempts"` 298 // Lambda Function published version, `$LATEST`, or Lambda Alias name. 299 Qualifier *string `pulumi:"qualifier"` 300 } 301 302 // The set of arguments for constructing a FunctionEventInvokeConfig resource. 303 type FunctionEventInvokeConfigArgs struct { 304 // Configuration block with destination configuration. See below for details. 305 DestinationConfig FunctionEventInvokeConfigDestinationConfigPtrInput 306 // Name or Amazon Resource Name (ARN) of the Lambda Function, omitting any version or alias qualifier. 307 // 308 // The following arguments are optional: 309 FunctionName pulumi.StringInput 310 // Maximum age of a request that Lambda sends to a function for processing in seconds. Valid values between 60 and 21600. 311 MaximumEventAgeInSeconds pulumi.IntPtrInput 312 // Maximum number of times to retry when the function returns an error. Valid values between 0 and 2. Defaults to 2. 313 MaximumRetryAttempts pulumi.IntPtrInput 314 // Lambda Function published version, `$LATEST`, or Lambda Alias name. 315 Qualifier pulumi.StringPtrInput 316 } 317 318 func (FunctionEventInvokeConfigArgs) ElementType() reflect.Type { 319 return reflect.TypeOf((*functionEventInvokeConfigArgs)(nil)).Elem() 320 } 321 322 type FunctionEventInvokeConfigInput interface { 323 pulumi.Input 324 325 ToFunctionEventInvokeConfigOutput() FunctionEventInvokeConfigOutput 326 ToFunctionEventInvokeConfigOutputWithContext(ctx context.Context) FunctionEventInvokeConfigOutput 327 } 328 329 func (*FunctionEventInvokeConfig) ElementType() reflect.Type { 330 return reflect.TypeOf((**FunctionEventInvokeConfig)(nil)).Elem() 331 } 332 333 func (i *FunctionEventInvokeConfig) ToFunctionEventInvokeConfigOutput() FunctionEventInvokeConfigOutput { 334 return i.ToFunctionEventInvokeConfigOutputWithContext(context.Background()) 335 } 336 337 func (i *FunctionEventInvokeConfig) ToFunctionEventInvokeConfigOutputWithContext(ctx context.Context) FunctionEventInvokeConfigOutput { 338 return pulumi.ToOutputWithContext(ctx, i).(FunctionEventInvokeConfigOutput) 339 } 340 341 // FunctionEventInvokeConfigArrayInput is an input type that accepts FunctionEventInvokeConfigArray and FunctionEventInvokeConfigArrayOutput values. 342 // You can construct a concrete instance of `FunctionEventInvokeConfigArrayInput` via: 343 // 344 // FunctionEventInvokeConfigArray{ FunctionEventInvokeConfigArgs{...} } 345 type FunctionEventInvokeConfigArrayInput interface { 346 pulumi.Input 347 348 ToFunctionEventInvokeConfigArrayOutput() FunctionEventInvokeConfigArrayOutput 349 ToFunctionEventInvokeConfigArrayOutputWithContext(context.Context) FunctionEventInvokeConfigArrayOutput 350 } 351 352 type FunctionEventInvokeConfigArray []FunctionEventInvokeConfigInput 353 354 func (FunctionEventInvokeConfigArray) ElementType() reflect.Type { 355 return reflect.TypeOf((*[]*FunctionEventInvokeConfig)(nil)).Elem() 356 } 357 358 func (i FunctionEventInvokeConfigArray) ToFunctionEventInvokeConfigArrayOutput() FunctionEventInvokeConfigArrayOutput { 359 return i.ToFunctionEventInvokeConfigArrayOutputWithContext(context.Background()) 360 } 361 362 func (i FunctionEventInvokeConfigArray) ToFunctionEventInvokeConfigArrayOutputWithContext(ctx context.Context) FunctionEventInvokeConfigArrayOutput { 363 return pulumi.ToOutputWithContext(ctx, i).(FunctionEventInvokeConfigArrayOutput) 364 } 365 366 // FunctionEventInvokeConfigMapInput is an input type that accepts FunctionEventInvokeConfigMap and FunctionEventInvokeConfigMapOutput values. 367 // You can construct a concrete instance of `FunctionEventInvokeConfigMapInput` via: 368 // 369 // FunctionEventInvokeConfigMap{ "key": FunctionEventInvokeConfigArgs{...} } 370 type FunctionEventInvokeConfigMapInput interface { 371 pulumi.Input 372 373 ToFunctionEventInvokeConfigMapOutput() FunctionEventInvokeConfigMapOutput 374 ToFunctionEventInvokeConfigMapOutputWithContext(context.Context) FunctionEventInvokeConfigMapOutput 375 } 376 377 type FunctionEventInvokeConfigMap map[string]FunctionEventInvokeConfigInput 378 379 func (FunctionEventInvokeConfigMap) ElementType() reflect.Type { 380 return reflect.TypeOf((*map[string]*FunctionEventInvokeConfig)(nil)).Elem() 381 } 382 383 func (i FunctionEventInvokeConfigMap) ToFunctionEventInvokeConfigMapOutput() FunctionEventInvokeConfigMapOutput { 384 return i.ToFunctionEventInvokeConfigMapOutputWithContext(context.Background()) 385 } 386 387 func (i FunctionEventInvokeConfigMap) ToFunctionEventInvokeConfigMapOutputWithContext(ctx context.Context) FunctionEventInvokeConfigMapOutput { 388 return pulumi.ToOutputWithContext(ctx, i).(FunctionEventInvokeConfigMapOutput) 389 } 390 391 type FunctionEventInvokeConfigOutput struct{ *pulumi.OutputState } 392 393 func (FunctionEventInvokeConfigOutput) ElementType() reflect.Type { 394 return reflect.TypeOf((**FunctionEventInvokeConfig)(nil)).Elem() 395 } 396 397 func (o FunctionEventInvokeConfigOutput) ToFunctionEventInvokeConfigOutput() FunctionEventInvokeConfigOutput { 398 return o 399 } 400 401 func (o FunctionEventInvokeConfigOutput) ToFunctionEventInvokeConfigOutputWithContext(ctx context.Context) FunctionEventInvokeConfigOutput { 402 return o 403 } 404 405 // Configuration block with destination configuration. See below for details. 406 func (o FunctionEventInvokeConfigOutput) DestinationConfig() FunctionEventInvokeConfigDestinationConfigPtrOutput { 407 return o.ApplyT(func(v *FunctionEventInvokeConfig) FunctionEventInvokeConfigDestinationConfigPtrOutput { 408 return v.DestinationConfig 409 }).(FunctionEventInvokeConfigDestinationConfigPtrOutput) 410 } 411 412 // Name or Amazon Resource Name (ARN) of the Lambda Function, omitting any version or alias qualifier. 413 // 414 // The following arguments are optional: 415 func (o FunctionEventInvokeConfigOutput) FunctionName() pulumi.StringOutput { 416 return o.ApplyT(func(v *FunctionEventInvokeConfig) pulumi.StringOutput { return v.FunctionName }).(pulumi.StringOutput) 417 } 418 419 // Maximum age of a request that Lambda sends to a function for processing in seconds. Valid values between 60 and 21600. 420 func (o FunctionEventInvokeConfigOutput) MaximumEventAgeInSeconds() pulumi.IntPtrOutput { 421 return o.ApplyT(func(v *FunctionEventInvokeConfig) pulumi.IntPtrOutput { return v.MaximumEventAgeInSeconds }).(pulumi.IntPtrOutput) 422 } 423 424 // Maximum number of times to retry when the function returns an error. Valid values between 0 and 2. Defaults to 2. 425 func (o FunctionEventInvokeConfigOutput) MaximumRetryAttempts() pulumi.IntPtrOutput { 426 return o.ApplyT(func(v *FunctionEventInvokeConfig) pulumi.IntPtrOutput { return v.MaximumRetryAttempts }).(pulumi.IntPtrOutput) 427 } 428 429 // Lambda Function published version, `$LATEST`, or Lambda Alias name. 430 func (o FunctionEventInvokeConfigOutput) Qualifier() pulumi.StringPtrOutput { 431 return o.ApplyT(func(v *FunctionEventInvokeConfig) pulumi.StringPtrOutput { return v.Qualifier }).(pulumi.StringPtrOutput) 432 } 433 434 type FunctionEventInvokeConfigArrayOutput struct{ *pulumi.OutputState } 435 436 func (FunctionEventInvokeConfigArrayOutput) ElementType() reflect.Type { 437 return reflect.TypeOf((*[]*FunctionEventInvokeConfig)(nil)).Elem() 438 } 439 440 func (o FunctionEventInvokeConfigArrayOutput) ToFunctionEventInvokeConfigArrayOutput() FunctionEventInvokeConfigArrayOutput { 441 return o 442 } 443 444 func (o FunctionEventInvokeConfigArrayOutput) ToFunctionEventInvokeConfigArrayOutputWithContext(ctx context.Context) FunctionEventInvokeConfigArrayOutput { 445 return o 446 } 447 448 func (o FunctionEventInvokeConfigArrayOutput) Index(i pulumi.IntInput) FunctionEventInvokeConfigOutput { 449 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *FunctionEventInvokeConfig { 450 return vs[0].([]*FunctionEventInvokeConfig)[vs[1].(int)] 451 }).(FunctionEventInvokeConfigOutput) 452 } 453 454 type FunctionEventInvokeConfigMapOutput struct{ *pulumi.OutputState } 455 456 func (FunctionEventInvokeConfigMapOutput) ElementType() reflect.Type { 457 return reflect.TypeOf((*map[string]*FunctionEventInvokeConfig)(nil)).Elem() 458 } 459 460 func (o FunctionEventInvokeConfigMapOutput) ToFunctionEventInvokeConfigMapOutput() FunctionEventInvokeConfigMapOutput { 461 return o 462 } 463 464 func (o FunctionEventInvokeConfigMapOutput) ToFunctionEventInvokeConfigMapOutputWithContext(ctx context.Context) FunctionEventInvokeConfigMapOutput { 465 return o 466 } 467 468 func (o FunctionEventInvokeConfigMapOutput) MapIndex(k pulumi.StringInput) FunctionEventInvokeConfigOutput { 469 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *FunctionEventInvokeConfig { 470 return vs[0].(map[string]*FunctionEventInvokeConfig)[vs[1].(string)] 471 }).(FunctionEventInvokeConfigOutput) 472 } 473 474 func init() { 475 pulumi.RegisterInputType(reflect.TypeOf((*FunctionEventInvokeConfigInput)(nil)).Elem(), &FunctionEventInvokeConfig{}) 476 pulumi.RegisterInputType(reflect.TypeOf((*FunctionEventInvokeConfigArrayInput)(nil)).Elem(), FunctionEventInvokeConfigArray{}) 477 pulumi.RegisterInputType(reflect.TypeOf((*FunctionEventInvokeConfigMapInput)(nil)).Elem(), FunctionEventInvokeConfigMap{}) 478 pulumi.RegisterOutputType(FunctionEventInvokeConfigOutput{}) 479 pulumi.RegisterOutputType(FunctionEventInvokeConfigArrayOutput{}) 480 pulumi.RegisterOutputType(FunctionEventInvokeConfigMapOutput{}) 481 }