github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lambda/permission.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 // Gives an external source (like an EventBridge Rule, SNS, or S3) permission to access the Lambda function. 16 // 17 // ## Example Usage 18 // 19 // ### Basic Usage 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "encoding/json" 28 // 29 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 30 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" 31 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 32 // 33 // ) 34 // 35 // func main() { 36 // pulumi.Run(func(ctx *pulumi.Context) error { 37 // tmpJSON0, err := json.Marshal(map[string]interface{}{ 38 // "Version": "2012-10-17", 39 // "Statement": []map[string]interface{}{ 40 // map[string]interface{}{ 41 // "Action": "sts:AssumeRole", 42 // "Effect": "Allow", 43 // "Sid": "", 44 // "Principal": map[string]interface{}{ 45 // "Service": "lambda.amazonaws.com", 46 // }, 47 // }, 48 // }, 49 // }) 50 // if err != nil { 51 // return err 52 // } 53 // json0 := string(tmpJSON0) 54 // iamForLambda, err := iam.NewRole(ctx, "iam_for_lambda", &iam.RoleArgs{ 55 // Name: pulumi.String("iam_for_lambda"), 56 // AssumeRolePolicy: pulumi.String(json0), 57 // }) 58 // if err != nil { 59 // return err 60 // } 61 // testLambda, err := lambda.NewFunction(ctx, "test_lambda", &lambda.FunctionArgs{ 62 // Code: pulumi.NewFileArchive("lambdatest.zip"), 63 // Name: pulumi.String("lambda_function_name"), 64 // Role: iamForLambda.Arn, 65 // Handler: pulumi.String("exports.handler"), 66 // Runtime: pulumi.String(lambda.RuntimeNodeJS16dX), 67 // }) 68 // if err != nil { 69 // return err 70 // } 71 // testAlias, err := lambda.NewAlias(ctx, "test_alias", &lambda.AliasArgs{ 72 // Name: pulumi.String("testalias"), 73 // Description: pulumi.String("a sample description"), 74 // FunctionName: testLambda.Name, 75 // FunctionVersion: pulumi.String("$LATEST"), 76 // }) 77 // if err != nil { 78 // return err 79 // } 80 // _, err = lambda.NewPermission(ctx, "allow_cloudwatch", &lambda.PermissionArgs{ 81 // StatementId: pulumi.String("AllowExecutionFromCloudWatch"), 82 // Action: pulumi.String("lambda:InvokeFunction"), 83 // Function: testLambda.Name, 84 // Principal: pulumi.String("events.amazonaws.com"), 85 // SourceArn: pulumi.String("arn:aws:events:eu-west-1:111122223333:rule/RunDaily"), 86 // Qualifier: testAlias.Name, 87 // }) 88 // if err != nil { 89 // return err 90 // } 91 // return nil 92 // }) 93 // } 94 // 95 // ``` 96 // <!--End PulumiCodeChooser --> 97 // 98 // ### With SNS 99 // 100 // <!--Start PulumiCodeChooser --> 101 // ```go 102 // package main 103 // 104 // import ( 105 // 106 // "encoding/json" 107 // 108 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 109 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" 110 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns" 111 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 112 // 113 // ) 114 // 115 // func main() { 116 // pulumi.Run(func(ctx *pulumi.Context) error { 117 // _, err := sns.NewTopic(ctx, "default", &sns.TopicArgs{ 118 // Name: pulumi.String("call-lambda-maybe"), 119 // }) 120 // if err != nil { 121 // return err 122 // } 123 // tmpJSON0, err := json.Marshal(map[string]interface{}{ 124 // "Version": "2012-10-17", 125 // "Statement": []map[string]interface{}{ 126 // map[string]interface{}{ 127 // "Action": "sts:AssumeRole", 128 // "Effect": "Allow", 129 // "Sid": "", 130 // "Principal": map[string]interface{}{ 131 // "Service": "lambda.amazonaws.com", 132 // }, 133 // }, 134 // }, 135 // }) 136 // if err != nil { 137 // return err 138 // } 139 // json0 := string(tmpJSON0) 140 // defaultRole, err := iam.NewRole(ctx, "default", &iam.RoleArgs{ 141 // Name: pulumi.String("iam_for_lambda_with_sns"), 142 // AssumeRolePolicy: pulumi.String(json0), 143 // }) 144 // if err != nil { 145 // return err 146 // } 147 // _, err = lambda.NewFunction(ctx, "func", &lambda.FunctionArgs{ 148 // Code: pulumi.NewFileArchive("lambdatest.zip"), 149 // Name: pulumi.String("lambda_called_from_sns"), 150 // Role: defaultRole.Arn, 151 // Handler: pulumi.String("exports.handler"), 152 // Runtime: pulumi.String(lambda.RuntimePython3d7), 153 // }) 154 // if err != nil { 155 // return err 156 // } 157 // _, err = lambda.NewPermission(ctx, "with_sns", &lambda.PermissionArgs{ 158 // StatementId: pulumi.String("AllowExecutionFromSNS"), 159 // Action: pulumi.String("lambda:InvokeFunction"), 160 // Function: _func.Name, 161 // Principal: pulumi.String("sns.amazonaws.com"), 162 // SourceArn: _default.Arn, 163 // }) 164 // if err != nil { 165 // return err 166 // } 167 // _, err = sns.NewTopicSubscription(ctx, "lambda", &sns.TopicSubscriptionArgs{ 168 // Topic: _default.Arn, 169 // Protocol: pulumi.String("lambda"), 170 // Endpoint: _func.Arn, 171 // }) 172 // if err != nil { 173 // return err 174 // } 175 // return nil 176 // }) 177 // } 178 // 179 // ``` 180 // <!--End PulumiCodeChooser --> 181 // 182 // ### With API Gateway REST API 183 // 184 // <!--Start PulumiCodeChooser --> 185 // ```go 186 // package main 187 // 188 // import ( 189 // 190 // "fmt" 191 // 192 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigateway" 193 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" 194 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 195 // 196 // ) 197 // 198 // func main() { 199 // pulumi.Run(func(ctx *pulumi.Context) error { 200 // myDemoAPI, err := apigateway.NewRestApi(ctx, "MyDemoAPI", &apigateway.RestApiArgs{ 201 // Name: pulumi.String("MyDemoAPI"), 202 // Description: pulumi.String("This is my API for demonstration purposes"), 203 // }) 204 // if err != nil { 205 // return err 206 // } 207 // _, err = lambda.NewPermission(ctx, "lambda_permission", &lambda.PermissionArgs{ 208 // StatementId: pulumi.String("AllowMyDemoAPIInvoke"), 209 // Action: pulumi.String("lambda:InvokeFunction"), 210 // Function: pulumi.Any("MyDemoFunction"), 211 // Principal: pulumi.String("apigateway.amazonaws.com"), 212 // SourceArn: myDemoAPI.ExecutionArn.ApplyT(func(executionArn string) (string, error) { 213 // return fmt.Sprintf("%v/*", executionArn), nil 214 // }).(pulumi.StringOutput), 215 // }) 216 // if err != nil { 217 // return err 218 // } 219 // return nil 220 // }) 221 // } 222 // 223 // ``` 224 // <!--End PulumiCodeChooser --> 225 // 226 // ### With CloudWatch Log Group 227 // 228 // <!--Start PulumiCodeChooser --> 229 // ```go 230 // package main 231 // 232 // import ( 233 // 234 // "fmt" 235 // 236 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 237 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 238 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" 239 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 240 // 241 // ) 242 // 243 // func main() { 244 // pulumi.Run(func(ctx *pulumi.Context) error { 245 // _, err := cloudwatch.NewLogGroup(ctx, "default", &cloudwatch.LogGroupArgs{ 246 // Name: pulumi.String("/default"), 247 // }) 248 // if err != nil { 249 // return err 250 // } 251 // assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{ 252 // Statements: []iam.GetPolicyDocumentStatement{ 253 // { 254 // Effect: pulumi.StringRef("Allow"), 255 // Principals: []iam.GetPolicyDocumentStatementPrincipal{ 256 // { 257 // Type: "Service", 258 // Identifiers: []string{ 259 // "lambda.amazonaws.com", 260 // }, 261 // }, 262 // }, 263 // Actions: []string{ 264 // "sts:AssumeRole", 265 // }, 266 // }, 267 // }, 268 // }, nil) 269 // if err != nil { 270 // return err 271 // } 272 // defaultRole, err := iam.NewRole(ctx, "default", &iam.RoleArgs{ 273 // Name: pulumi.String("iam_for_lambda_called_from_cloudwatch_logs"), 274 // AssumeRolePolicy: pulumi.String(assumeRole.Json), 275 // }) 276 // if err != nil { 277 // return err 278 // } 279 // loggingFunction, err := lambda.NewFunction(ctx, "logging", &lambda.FunctionArgs{ 280 // Code: pulumi.NewFileArchive("lamba_logging.zip"), 281 // Name: pulumi.String("lambda_called_from_cloudwatch_logs"), 282 // Handler: pulumi.String("exports.handler"), 283 // Role: defaultRole.Arn, 284 // Runtime: pulumi.String(lambda.RuntimePython3d7), 285 // }) 286 // if err != nil { 287 // return err 288 // } 289 // logging, err := lambda.NewPermission(ctx, "logging", &lambda.PermissionArgs{ 290 // Action: pulumi.String("lambda:InvokeFunction"), 291 // Function: loggingFunction.Name, 292 // Principal: pulumi.String("logs.eu-west-1.amazonaws.com"), 293 // SourceArn: _default.Arn.ApplyT(func(arn string) (string, error) { 294 // return fmt.Sprintf("%v:*", arn), nil 295 // }).(pulumi.StringOutput), 296 // }) 297 // if err != nil { 298 // return err 299 // } 300 // _, err = cloudwatch.NewLogSubscriptionFilter(ctx, "logging", &cloudwatch.LogSubscriptionFilterArgs{ 301 // DestinationArn: loggingFunction.Arn, 302 // FilterPattern: pulumi.String(""), 303 // LogGroup: _default.Name, 304 // Name: pulumi.String("logging_default"), 305 // }, pulumi.DependsOn([]pulumi.Resource{ 306 // logging, 307 // })) 308 // if err != nil { 309 // return err 310 // } 311 // return nil 312 // }) 313 // } 314 // 315 // ``` 316 // <!--End PulumiCodeChooser --> 317 // 318 // ### With Cross-Account Invocation Policy 319 // 320 // <!--Start PulumiCodeChooser --> 321 // ```go 322 // package main 323 // 324 // import ( 325 // 326 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" 327 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 328 // 329 // ) 330 // 331 // func main() { 332 // pulumi.Run(func(ctx *pulumi.Context) error { 333 // _, err := lambda.NewFunctionUrl(ctx, "url", &lambda.FunctionUrlArgs{ 334 // FunctionName: pulumi.Any(example.FunctionName), 335 // AuthorizationType: pulumi.String("AWS_IAM"), 336 // }) 337 // if err != nil { 338 // return err 339 // } 340 // _, err = lambda.NewPermission(ctx, "url", &lambda.PermissionArgs{ 341 // Action: pulumi.String("lambda:InvokeFunctionUrl"), 342 // Function: pulumi.Any(example.FunctionName), 343 // Principal: pulumi.String("arn:aws:iam::444455556666:role/example"), 344 // SourceAccount: pulumi.String("444455556666"), 345 // FunctionUrlAuthType: pulumi.String("AWS_IAM"), 346 // }) 347 // if err != nil { 348 // return err 349 // } 350 // return nil 351 // }) 352 // } 353 // 354 // ``` 355 // <!--End PulumiCodeChooser --> 356 // 357 // ## Import 358 // 359 // Using `pulumi import`, import Lambda permission statements using function_name/statement_id with an optional qualifier. For example: 360 // 361 // ```sh 362 // $ pulumi import aws:lambda/permission:Permission test_lambda_permission my_test_lambda_function/AllowExecutionFromCloudWatch 363 // ``` 364 // ```sh 365 // $ pulumi import aws:lambda/permission:Permission test_lambda_permission my_test_lambda_function:qualifier_name/AllowExecutionFromCloudWatch 366 // ``` 367 type Permission struct { 368 pulumi.CustomResourceState 369 370 // The AWS Lambda action you want to allow in this statement. (e.g., `lambda:InvokeFunction`) 371 Action pulumi.StringOutput `pulumi:"action"` 372 // The Event Source Token to validate. Used with [Alexa Skills](https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html#use-aws-cli). 373 EventSourceToken pulumi.StringPtrOutput `pulumi:"eventSourceToken"` 374 // Name of the Lambda function whose resource policy you are updating 375 Function pulumi.StringOutput `pulumi:"function"` 376 // Lambda Function URLs [authentication type](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html). Valid values are: `AWS_IAM` or `NONE`. Only supported for `lambda:InvokeFunctionUrl` action. 377 FunctionUrlAuthType pulumi.StringPtrOutput `pulumi:"functionUrlAuthType"` 378 // The principal who is getting this permission e.g., `s3.amazonaws.com`, an AWS account ID, or AWS IAM principal, or AWS service principal such as `events.amazonaws.com` or `sns.amazonaws.com`. 379 Principal pulumi.StringOutput `pulumi:"principal"` 380 // The identifier for your organization in AWS Organizations. Use this to grant permissions to all the AWS accounts under this organization. 381 // 382 // [1]: https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html#use-aws-cli 383 // [2]: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html 384 // [3]: https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html 385 PrincipalOrgId pulumi.StringPtrOutput `pulumi:"principalOrgId"` 386 // Query parameter to specify function version or alias name. The permission will then apply to the specific qualified ARN e.g., `arn:aws:lambda:aws-region:acct-id:function:function-name:2` 387 Qualifier pulumi.StringPtrOutput `pulumi:"qualifier"` 388 // This parameter is used when allowing cross-account access, or for S3 and SES. The AWS account ID (without a hyphen) of the source owner. 389 SourceAccount pulumi.StringPtrOutput `pulumi:"sourceAccount"` 390 // When the principal is an AWS service, the ARN of the specific resource within that service to grant permission to. 391 // Without this, any resource from `principal` will be granted permission – even if that resource is from another account. 392 // For S3, this should be the ARN of the S3 Bucket. 393 // For EventBridge events, this should be the ARN of the EventBridge Rule. 394 // For API Gateway, this should be the ARN of the API, as described [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html). 395 SourceArn pulumi.StringPtrOutput `pulumi:"sourceArn"` 396 // A unique statement identifier. By default generated by the provider. 397 StatementId pulumi.StringOutput `pulumi:"statementId"` 398 // A statement identifier prefix. The provider will generate a unique suffix. Conflicts with `statementId`. 399 StatementIdPrefix pulumi.StringOutput `pulumi:"statementIdPrefix"` 400 } 401 402 // NewPermission registers a new resource with the given unique name, arguments, and options. 403 func NewPermission(ctx *pulumi.Context, 404 name string, args *PermissionArgs, opts ...pulumi.ResourceOption) (*Permission, error) { 405 if args == nil { 406 return nil, errors.New("missing one or more required arguments") 407 } 408 409 if args.Action == nil { 410 return nil, errors.New("invalid value for required argument 'Action'") 411 } 412 if args.Function == nil { 413 return nil, errors.New("invalid value for required argument 'Function'") 414 } 415 if args.Principal == nil { 416 return nil, errors.New("invalid value for required argument 'Principal'") 417 } 418 opts = internal.PkgResourceDefaultOpts(opts) 419 var resource Permission 420 err := ctx.RegisterResource("aws:lambda/permission:Permission", name, args, &resource, opts...) 421 if err != nil { 422 return nil, err 423 } 424 return &resource, nil 425 } 426 427 // GetPermission gets an existing Permission resource's state with the given name, ID, and optional 428 // state properties that are used to uniquely qualify the lookup (nil if not required). 429 func GetPermission(ctx *pulumi.Context, 430 name string, id pulumi.IDInput, state *PermissionState, opts ...pulumi.ResourceOption) (*Permission, error) { 431 var resource Permission 432 err := ctx.ReadResource("aws:lambda/permission:Permission", name, id, state, &resource, opts...) 433 if err != nil { 434 return nil, err 435 } 436 return &resource, nil 437 } 438 439 // Input properties used for looking up and filtering Permission resources. 440 type permissionState struct { 441 // The AWS Lambda action you want to allow in this statement. (e.g., `lambda:InvokeFunction`) 442 Action *string `pulumi:"action"` 443 // The Event Source Token to validate. Used with [Alexa Skills](https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html#use-aws-cli). 444 EventSourceToken *string `pulumi:"eventSourceToken"` 445 // Name of the Lambda function whose resource policy you are updating 446 Function interface{} `pulumi:"function"` 447 // Lambda Function URLs [authentication type](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html). Valid values are: `AWS_IAM` or `NONE`. Only supported for `lambda:InvokeFunctionUrl` action. 448 FunctionUrlAuthType *string `pulumi:"functionUrlAuthType"` 449 // The principal who is getting this permission e.g., `s3.amazonaws.com`, an AWS account ID, or AWS IAM principal, or AWS service principal such as `events.amazonaws.com` or `sns.amazonaws.com`. 450 Principal *string `pulumi:"principal"` 451 // The identifier for your organization in AWS Organizations. Use this to grant permissions to all the AWS accounts under this organization. 452 // 453 // [1]: https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html#use-aws-cli 454 // [2]: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html 455 // [3]: https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html 456 PrincipalOrgId *string `pulumi:"principalOrgId"` 457 // Query parameter to specify function version or alias name. The permission will then apply to the specific qualified ARN e.g., `arn:aws:lambda:aws-region:acct-id:function:function-name:2` 458 Qualifier *string `pulumi:"qualifier"` 459 // This parameter is used when allowing cross-account access, or for S3 and SES. The AWS account ID (without a hyphen) of the source owner. 460 SourceAccount *string `pulumi:"sourceAccount"` 461 // When the principal is an AWS service, the ARN of the specific resource within that service to grant permission to. 462 // Without this, any resource from `principal` will be granted permission – even if that resource is from another account. 463 // For S3, this should be the ARN of the S3 Bucket. 464 // For EventBridge events, this should be the ARN of the EventBridge Rule. 465 // For API Gateway, this should be the ARN of the API, as described [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html). 466 SourceArn *string `pulumi:"sourceArn"` 467 // A unique statement identifier. By default generated by the provider. 468 StatementId *string `pulumi:"statementId"` 469 // A statement identifier prefix. The provider will generate a unique suffix. Conflicts with `statementId`. 470 StatementIdPrefix *string `pulumi:"statementIdPrefix"` 471 } 472 473 type PermissionState struct { 474 // The AWS Lambda action you want to allow in this statement. (e.g., `lambda:InvokeFunction`) 475 Action pulumi.StringPtrInput 476 // The Event Source Token to validate. Used with [Alexa Skills](https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html#use-aws-cli). 477 EventSourceToken pulumi.StringPtrInput 478 // Name of the Lambda function whose resource policy you are updating 479 Function pulumi.Input 480 // Lambda Function URLs [authentication type](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html). Valid values are: `AWS_IAM` or `NONE`. Only supported for `lambda:InvokeFunctionUrl` action. 481 FunctionUrlAuthType pulumi.StringPtrInput 482 // The principal who is getting this permission e.g., `s3.amazonaws.com`, an AWS account ID, or AWS IAM principal, or AWS service principal such as `events.amazonaws.com` or `sns.amazonaws.com`. 483 Principal pulumi.StringPtrInput 484 // The identifier for your organization in AWS Organizations. Use this to grant permissions to all the AWS accounts under this organization. 485 // 486 // [1]: https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html#use-aws-cli 487 // [2]: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html 488 // [3]: https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html 489 PrincipalOrgId pulumi.StringPtrInput 490 // Query parameter to specify function version or alias name. The permission will then apply to the specific qualified ARN e.g., `arn:aws:lambda:aws-region:acct-id:function:function-name:2` 491 Qualifier pulumi.StringPtrInput 492 // This parameter is used when allowing cross-account access, or for S3 and SES. The AWS account ID (without a hyphen) of the source owner. 493 SourceAccount pulumi.StringPtrInput 494 // When the principal is an AWS service, the ARN of the specific resource within that service to grant permission to. 495 // Without this, any resource from `principal` will be granted permission – even if that resource is from another account. 496 // For S3, this should be the ARN of the S3 Bucket. 497 // For EventBridge events, this should be the ARN of the EventBridge Rule. 498 // For API Gateway, this should be the ARN of the API, as described [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html). 499 SourceArn pulumi.StringPtrInput 500 // A unique statement identifier. By default generated by the provider. 501 StatementId pulumi.StringPtrInput 502 // A statement identifier prefix. The provider will generate a unique suffix. Conflicts with `statementId`. 503 StatementIdPrefix pulumi.StringPtrInput 504 } 505 506 func (PermissionState) ElementType() reflect.Type { 507 return reflect.TypeOf((*permissionState)(nil)).Elem() 508 } 509 510 type permissionArgs struct { 511 // The AWS Lambda action you want to allow in this statement. (e.g., `lambda:InvokeFunction`) 512 Action string `pulumi:"action"` 513 // The Event Source Token to validate. Used with [Alexa Skills](https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html#use-aws-cli). 514 EventSourceToken *string `pulumi:"eventSourceToken"` 515 // Name of the Lambda function whose resource policy you are updating 516 Function interface{} `pulumi:"function"` 517 // Lambda Function URLs [authentication type](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html). Valid values are: `AWS_IAM` or `NONE`. Only supported for `lambda:InvokeFunctionUrl` action. 518 FunctionUrlAuthType *string `pulumi:"functionUrlAuthType"` 519 // The principal who is getting this permission e.g., `s3.amazonaws.com`, an AWS account ID, or AWS IAM principal, or AWS service principal such as `events.amazonaws.com` or `sns.amazonaws.com`. 520 Principal string `pulumi:"principal"` 521 // The identifier for your organization in AWS Organizations. Use this to grant permissions to all the AWS accounts under this organization. 522 // 523 // [1]: https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html#use-aws-cli 524 // [2]: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html 525 // [3]: https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html 526 PrincipalOrgId *string `pulumi:"principalOrgId"` 527 // Query parameter to specify function version or alias name. The permission will then apply to the specific qualified ARN e.g., `arn:aws:lambda:aws-region:acct-id:function:function-name:2` 528 Qualifier *string `pulumi:"qualifier"` 529 // This parameter is used when allowing cross-account access, or for S3 and SES. The AWS account ID (without a hyphen) of the source owner. 530 SourceAccount *string `pulumi:"sourceAccount"` 531 // When the principal is an AWS service, the ARN of the specific resource within that service to grant permission to. 532 // Without this, any resource from `principal` will be granted permission – even if that resource is from another account. 533 // For S3, this should be the ARN of the S3 Bucket. 534 // For EventBridge events, this should be the ARN of the EventBridge Rule. 535 // For API Gateway, this should be the ARN of the API, as described [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html). 536 SourceArn *string `pulumi:"sourceArn"` 537 // A unique statement identifier. By default generated by the provider. 538 StatementId *string `pulumi:"statementId"` 539 // A statement identifier prefix. The provider will generate a unique suffix. Conflicts with `statementId`. 540 StatementIdPrefix *string `pulumi:"statementIdPrefix"` 541 } 542 543 // The set of arguments for constructing a Permission resource. 544 type PermissionArgs struct { 545 // The AWS Lambda action you want to allow in this statement. (e.g., `lambda:InvokeFunction`) 546 Action pulumi.StringInput 547 // The Event Source Token to validate. Used with [Alexa Skills](https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html#use-aws-cli). 548 EventSourceToken pulumi.StringPtrInput 549 // Name of the Lambda function whose resource policy you are updating 550 Function pulumi.Input 551 // Lambda Function URLs [authentication type](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html). Valid values are: `AWS_IAM` or `NONE`. Only supported for `lambda:InvokeFunctionUrl` action. 552 FunctionUrlAuthType pulumi.StringPtrInput 553 // The principal who is getting this permission e.g., `s3.amazonaws.com`, an AWS account ID, or AWS IAM principal, or AWS service principal such as `events.amazonaws.com` or `sns.amazonaws.com`. 554 Principal pulumi.StringInput 555 // The identifier for your organization in AWS Organizations. Use this to grant permissions to all the AWS accounts under this organization. 556 // 557 // [1]: https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html#use-aws-cli 558 // [2]: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html 559 // [3]: https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html 560 PrincipalOrgId pulumi.StringPtrInput 561 // Query parameter to specify function version or alias name. The permission will then apply to the specific qualified ARN e.g., `arn:aws:lambda:aws-region:acct-id:function:function-name:2` 562 Qualifier pulumi.StringPtrInput 563 // This parameter is used when allowing cross-account access, or for S3 and SES. The AWS account ID (without a hyphen) of the source owner. 564 SourceAccount pulumi.StringPtrInput 565 // When the principal is an AWS service, the ARN of the specific resource within that service to grant permission to. 566 // Without this, any resource from `principal` will be granted permission – even if that resource is from another account. 567 // For S3, this should be the ARN of the S3 Bucket. 568 // For EventBridge events, this should be the ARN of the EventBridge Rule. 569 // For API Gateway, this should be the ARN of the API, as described [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html). 570 SourceArn pulumi.StringPtrInput 571 // A unique statement identifier. By default generated by the provider. 572 StatementId pulumi.StringPtrInput 573 // A statement identifier prefix. The provider will generate a unique suffix. Conflicts with `statementId`. 574 StatementIdPrefix pulumi.StringPtrInput 575 } 576 577 func (PermissionArgs) ElementType() reflect.Type { 578 return reflect.TypeOf((*permissionArgs)(nil)).Elem() 579 } 580 581 type PermissionInput interface { 582 pulumi.Input 583 584 ToPermissionOutput() PermissionOutput 585 ToPermissionOutputWithContext(ctx context.Context) PermissionOutput 586 } 587 588 func (*Permission) ElementType() reflect.Type { 589 return reflect.TypeOf((**Permission)(nil)).Elem() 590 } 591 592 func (i *Permission) ToPermissionOutput() PermissionOutput { 593 return i.ToPermissionOutputWithContext(context.Background()) 594 } 595 596 func (i *Permission) ToPermissionOutputWithContext(ctx context.Context) PermissionOutput { 597 return pulumi.ToOutputWithContext(ctx, i).(PermissionOutput) 598 } 599 600 // PermissionArrayInput is an input type that accepts PermissionArray and PermissionArrayOutput values. 601 // You can construct a concrete instance of `PermissionArrayInput` via: 602 // 603 // PermissionArray{ PermissionArgs{...} } 604 type PermissionArrayInput interface { 605 pulumi.Input 606 607 ToPermissionArrayOutput() PermissionArrayOutput 608 ToPermissionArrayOutputWithContext(context.Context) PermissionArrayOutput 609 } 610 611 type PermissionArray []PermissionInput 612 613 func (PermissionArray) ElementType() reflect.Type { 614 return reflect.TypeOf((*[]*Permission)(nil)).Elem() 615 } 616 617 func (i PermissionArray) ToPermissionArrayOutput() PermissionArrayOutput { 618 return i.ToPermissionArrayOutputWithContext(context.Background()) 619 } 620 621 func (i PermissionArray) ToPermissionArrayOutputWithContext(ctx context.Context) PermissionArrayOutput { 622 return pulumi.ToOutputWithContext(ctx, i).(PermissionArrayOutput) 623 } 624 625 // PermissionMapInput is an input type that accepts PermissionMap and PermissionMapOutput values. 626 // You can construct a concrete instance of `PermissionMapInput` via: 627 // 628 // PermissionMap{ "key": PermissionArgs{...} } 629 type PermissionMapInput interface { 630 pulumi.Input 631 632 ToPermissionMapOutput() PermissionMapOutput 633 ToPermissionMapOutputWithContext(context.Context) PermissionMapOutput 634 } 635 636 type PermissionMap map[string]PermissionInput 637 638 func (PermissionMap) ElementType() reflect.Type { 639 return reflect.TypeOf((*map[string]*Permission)(nil)).Elem() 640 } 641 642 func (i PermissionMap) ToPermissionMapOutput() PermissionMapOutput { 643 return i.ToPermissionMapOutputWithContext(context.Background()) 644 } 645 646 func (i PermissionMap) ToPermissionMapOutputWithContext(ctx context.Context) PermissionMapOutput { 647 return pulumi.ToOutputWithContext(ctx, i).(PermissionMapOutput) 648 } 649 650 type PermissionOutput struct{ *pulumi.OutputState } 651 652 func (PermissionOutput) ElementType() reflect.Type { 653 return reflect.TypeOf((**Permission)(nil)).Elem() 654 } 655 656 func (o PermissionOutput) ToPermissionOutput() PermissionOutput { 657 return o 658 } 659 660 func (o PermissionOutput) ToPermissionOutputWithContext(ctx context.Context) PermissionOutput { 661 return o 662 } 663 664 // The AWS Lambda action you want to allow in this statement. (e.g., `lambda:InvokeFunction`) 665 func (o PermissionOutput) Action() pulumi.StringOutput { 666 return o.ApplyT(func(v *Permission) pulumi.StringOutput { return v.Action }).(pulumi.StringOutput) 667 } 668 669 // The Event Source Token to validate. Used with [Alexa Skills](https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html#use-aws-cli). 670 func (o PermissionOutput) EventSourceToken() pulumi.StringPtrOutput { 671 return o.ApplyT(func(v *Permission) pulumi.StringPtrOutput { return v.EventSourceToken }).(pulumi.StringPtrOutput) 672 } 673 674 // Name of the Lambda function whose resource policy you are updating 675 func (o PermissionOutput) Function() pulumi.StringOutput { 676 return o.ApplyT(func(v *Permission) pulumi.StringOutput { return v.Function }).(pulumi.StringOutput) 677 } 678 679 // Lambda Function URLs [authentication type](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html). Valid values are: `AWS_IAM` or `NONE`. Only supported for `lambda:InvokeFunctionUrl` action. 680 func (o PermissionOutput) FunctionUrlAuthType() pulumi.StringPtrOutput { 681 return o.ApplyT(func(v *Permission) pulumi.StringPtrOutput { return v.FunctionUrlAuthType }).(pulumi.StringPtrOutput) 682 } 683 684 // The principal who is getting this permission e.g., `s3.amazonaws.com`, an AWS account ID, or AWS IAM principal, or AWS service principal such as `events.amazonaws.com` or `sns.amazonaws.com`. 685 func (o PermissionOutput) Principal() pulumi.StringOutput { 686 return o.ApplyT(func(v *Permission) pulumi.StringOutput { return v.Principal }).(pulumi.StringOutput) 687 } 688 689 // The identifier for your organization in AWS Organizations. Use this to grant permissions to all the AWS accounts under this organization. 690 // 691 // [1]: https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html#use-aws-cli 692 // [2]: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html 693 // [3]: https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html 694 func (o PermissionOutput) PrincipalOrgId() pulumi.StringPtrOutput { 695 return o.ApplyT(func(v *Permission) pulumi.StringPtrOutput { return v.PrincipalOrgId }).(pulumi.StringPtrOutput) 696 } 697 698 // Query parameter to specify function version or alias name. The permission will then apply to the specific qualified ARN e.g., `arn:aws:lambda:aws-region:acct-id:function:function-name:2` 699 func (o PermissionOutput) Qualifier() pulumi.StringPtrOutput { 700 return o.ApplyT(func(v *Permission) pulumi.StringPtrOutput { return v.Qualifier }).(pulumi.StringPtrOutput) 701 } 702 703 // This parameter is used when allowing cross-account access, or for S3 and SES. The AWS account ID (without a hyphen) of the source owner. 704 func (o PermissionOutput) SourceAccount() pulumi.StringPtrOutput { 705 return o.ApplyT(func(v *Permission) pulumi.StringPtrOutput { return v.SourceAccount }).(pulumi.StringPtrOutput) 706 } 707 708 // When the principal is an AWS service, the ARN of the specific resource within that service to grant permission to. 709 // Without this, any resource from `principal` will be granted permission – even if that resource is from another account. 710 // For S3, this should be the ARN of the S3 Bucket. 711 // For EventBridge events, this should be the ARN of the EventBridge Rule. 712 // For API Gateway, this should be the ARN of the API, as described [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html). 713 func (o PermissionOutput) SourceArn() pulumi.StringPtrOutput { 714 return o.ApplyT(func(v *Permission) pulumi.StringPtrOutput { return v.SourceArn }).(pulumi.StringPtrOutput) 715 } 716 717 // A unique statement identifier. By default generated by the provider. 718 func (o PermissionOutput) StatementId() pulumi.StringOutput { 719 return o.ApplyT(func(v *Permission) pulumi.StringOutput { return v.StatementId }).(pulumi.StringOutput) 720 } 721 722 // A statement identifier prefix. The provider will generate a unique suffix. Conflicts with `statementId`. 723 func (o PermissionOutput) StatementIdPrefix() pulumi.StringOutput { 724 return o.ApplyT(func(v *Permission) pulumi.StringOutput { return v.StatementIdPrefix }).(pulumi.StringOutput) 725 } 726 727 type PermissionArrayOutput struct{ *pulumi.OutputState } 728 729 func (PermissionArrayOutput) ElementType() reflect.Type { 730 return reflect.TypeOf((*[]*Permission)(nil)).Elem() 731 } 732 733 func (o PermissionArrayOutput) ToPermissionArrayOutput() PermissionArrayOutput { 734 return o 735 } 736 737 func (o PermissionArrayOutput) ToPermissionArrayOutputWithContext(ctx context.Context) PermissionArrayOutput { 738 return o 739 } 740 741 func (o PermissionArrayOutput) Index(i pulumi.IntInput) PermissionOutput { 742 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Permission { 743 return vs[0].([]*Permission)[vs[1].(int)] 744 }).(PermissionOutput) 745 } 746 747 type PermissionMapOutput struct{ *pulumi.OutputState } 748 749 func (PermissionMapOutput) ElementType() reflect.Type { 750 return reflect.TypeOf((*map[string]*Permission)(nil)).Elem() 751 } 752 753 func (o PermissionMapOutput) ToPermissionMapOutput() PermissionMapOutput { 754 return o 755 } 756 757 func (o PermissionMapOutput) ToPermissionMapOutputWithContext(ctx context.Context) PermissionMapOutput { 758 return o 759 } 760 761 func (o PermissionMapOutput) MapIndex(k pulumi.StringInput) PermissionOutput { 762 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Permission { 763 return vs[0].(map[string]*Permission)[vs[1].(string)] 764 }).(PermissionOutput) 765 } 766 767 func init() { 768 pulumi.RegisterInputType(reflect.TypeOf((*PermissionInput)(nil)).Elem(), &Permission{}) 769 pulumi.RegisterInputType(reflect.TypeOf((*PermissionArrayInput)(nil)).Elem(), PermissionArray{}) 770 pulumi.RegisterInputType(reflect.TypeOf((*PermissionMapInput)(nil)).Elem(), PermissionMap{}) 771 pulumi.RegisterOutputType(PermissionOutput{}) 772 pulumi.RegisterOutputType(PermissionArrayOutput{}) 773 pulumi.RegisterOutputType(PermissionMapOutput{}) 774 }