From f12812256b9e0d86f1b773e0904c2487cfecb0c6 Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Wed, 22 Nov 2023 11:17:21 +0000 Subject: [PATCH 01/18] Initial HTTP API investigation --- awsx/apigatewayv2/httpApi.ts | 129 +++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 awsx/apigatewayv2/httpApi.ts diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts new file mode 100644 index 000000000..508e71754 --- /dev/null +++ b/awsx/apigatewayv2/httpApi.ts @@ -0,0 +1,129 @@ +import * as pulumi from "@pulumi/pulumi"; +import * as aws from "@pulumi/aws"; + +type Route = Omit< + aws.apigatewayv2.RouteArgs, + | "apiId" + | "routeKey" + // Supported only for WebSocket APIs. + | "requestModels" + | "requestParameters" + | "routeResponseSelectionExpression" + | "modelSelectionExpression" +>; + +type HttpIntegration = Omit< + aws.apigatewayv2.IntegrationArgs, + | "apiId" + // Supported only for WebSocket APIs. + | "requestTemplates" + | "contentHandlingStrategy" + | "passthroughBehavior" + | "templateSelectionExpression" +>; + +type LambdaIntegration = Omit & { + lambda: aws.lambda.Function; +}; + +type Integration = HttpIntegration | LambdaIntegration; + +type Stage = Omit; + +interface HttpApiArgs { + routes: Record; + integrations: Record; + stages?: Record; +} + +export async function buildHttpApi(parent: pulumi.Resource, name: string, args: HttpApiArgs) { + const api = new aws.apigatewayv2.Api( + name, + { + protocolType: "HTTP", + }, + { parent }, + ); + + const functions: aws.lambda.Function[] = []; + const integrations: aws.apigatewayv2.Integration[] = []; + for (const [integrationKey, integrationInput] of Object.entries(args.integrations)) { + const integrationName = `${name}-${integrationKey}`; + if ("lambda" in integrationInput) { + const { lambda, ...integrationArgs } = integrationInput; + functions.push(lambda); + integrations.push( + new aws.apigatewayv2.Integration( + integrationName, + { + apiId: api.id, + integrationType: "AWS_PROXY", + integrationUri: lambda.invokeArn, + ...integrationArgs, + }, + { parent }, + ), + ); + } else { + integrations.push( + new aws.apigatewayv2.Integration( + integrationName, + { + apiId: api.id, + ...integrationInput, + }, + { parent }, + ), + ); + } + } + + const routes: aws.apigatewayv2.Route[] = []; + for (const [routeKey, routeInput] of Object.entries(args.routes)) { + const routeName = routeKey.replace(/\W+/g, "-"); + routes.push( + new aws.apigatewayv2.Route( + `${name}-${routeName}`, + { + apiId: api.id, + routeKey, + ...routeInput, + }, + { + parent, + dependsOn: integrations, + }, + ), + ); + } + + const stages: aws.apigatewayv2.Stage[] = []; + for (const [stageKey, stageInput] of Object.entries(args.stages ?? defaultStages())) { + stages.push( + new aws.apigatewayv2.Stage( + `${name}-${stageKey}`, + { + apiId: api.id, + ...stageInput, + }, + { parent }, + ), + ); + } + + const deployment = new aws.apigatewayv2.Deployment( + `${name}-deployment`, + { + apiId: api.id, + }, + { parent, dependsOn: [...routes, ...stages] }, + ); + + return { api, routes, integrations, stages, deployment }; +} + +function defaultStages(): Record { + return { + default: { autoDeploy: true }, + }; +} From 744f768527646146597a523ffaa9f76f4c4ef0e3 Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Wed, 22 Nov 2023 11:32:50 +0000 Subject: [PATCH 02/18] Add domains and authorizers --- awsx/apigatewayv2/httpApi.ts | 105 ++++++++++++++++++++++++++++++++--- 1 file changed, 97 insertions(+), 8 deletions(-) diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts index 508e71754..31af7e576 100644 --- a/awsx/apigatewayv2/httpApi.ts +++ b/awsx/apigatewayv2/httpApi.ts @@ -10,7 +10,11 @@ type Route = Omit< | "requestParameters" | "routeResponseSelectionExpression" | "modelSelectionExpression" ->; +> & { + integration?: pulumi.Input; + authorizer?: pulumi.Input; + target: pulumi.Input; +}; type HttpIntegration = Omit< aws.apigatewayv2.IntegrationArgs, @@ -28,12 +32,21 @@ type LambdaIntegration = Omit; + type Stage = Omit; +type DomainName = Omit & { + domainConfiguration?: Omit; + domainId?: pulumi.Input; +}; + interface HttpApiArgs { routes: Record; - integrations: Record; + integrations?: Record; + authorizers?: Record; stages?: Record; + domainNames?: Record; } export async function buildHttpApi(parent: pulumi.Resource, name: string, args: HttpApiArgs) { @@ -46,13 +59,14 @@ export async function buildHttpApi(parent: pulumi.Resource, name: string, args: ); const functions: aws.lambda.Function[] = []; - const integrations: aws.apigatewayv2.Integration[] = []; - for (const [integrationKey, integrationInput] of Object.entries(args.integrations)) { + const integrationsMap = new Map(); + for (const [integrationKey, integrationInput] of Object.entries(args.integrations ?? {})) { const integrationName = `${name}-${integrationKey}`; if ("lambda" in integrationInput) { const { lambda, ...integrationArgs } = integrationInput; functions.push(lambda); - integrations.push( + integrationsMap.set( + integrationKey, new aws.apigatewayv2.Integration( integrationName, { @@ -65,7 +79,8 @@ export async function buildHttpApi(parent: pulumi.Resource, name: string, args: ), ); } else { - integrations.push( + integrationsMap.set( + integrationKey, new aws.apigatewayv2.Integration( integrationName, { @@ -77,17 +92,58 @@ export async function buildHttpApi(parent: pulumi.Resource, name: string, args: ); } } + const integrations = Array.from(integrationsMap.values()); + + const authorizersMap = new Map(); + for (const [authorizerKey, authorizerInput] of Object.entries(args.authorizers ?? {})) { + const authorizerName = authorizerKey.replace(/\W+/g, "-"); + authorizersMap.set( + authorizerKey, + new aws.apigatewayv2.Authorizer( + `${name}-${authorizerName}`, + { + apiId: api.id, + ...authorizerInput, + }, + { parent }, + ), + ); + } + const authorizers = Array.from(authorizersMap.values()); const routes: aws.apigatewayv2.Route[] = []; for (const [routeKey, routeInput] of Object.entries(args.routes)) { const routeName = routeKey.replace(/\W+/g, "-"); + const { integration, authorizer, ...routeArgs } = routeInput; + let target = routeInput.target; + if (integration !== undefined) { + target = pulumi.output(integration).apply((id) => { + const integration = integrationsMap.get(id); + if (integration === undefined) { + throw new Error(`Could not find integration with key ${id}`); + } + return `integrations/${integration.id}`; + }); + } + let authorizerId = routeInput.authorizerId; + if (authorizer !== undefined) { + authorizerId = pulumi.output(authorizer).apply((id) => { + const authorizer = authorizersMap.get(id); + if (authorizer === undefined) { + throw new Error(`Could not find authorizer with key ${id}`); + } + return authorizer.id; + }); + } routes.push( new aws.apigatewayv2.Route( `${name}-${routeName}`, { apiId: api.id, routeKey, - ...routeInput, + ...routeArgs, + target, + authorizerId, }, { parent, @@ -119,7 +175,40 @@ export async function buildHttpApi(parent: pulumi.Resource, name: string, args: { parent, dependsOn: [...routes, ...stages] }, ); - return { api, routes, integrations, stages, deployment }; + const domains: aws.apigatewayv2.DomainName[] = []; + for (const [domainKey, domainInput] of Object.entries(args.domainNames ?? {})) { + const { domainConfiguration, domainId, ...apiMappingArgs } = domainInput; + if ( + (domainId === undefined && domainConfiguration === undefined) || + (domainId !== undefined && domainConfiguration !== undefined) + ) { + throw new Error( + `Exactly one of domainId or domainConfiguration must be specified for domain ${domainKey}`, + ); + } + let resolvedDomainId = domainId; + const domainResourceName = domainKey.replace(/\W+/g, "-"); + if (domainConfiguration !== undefined) { + const domain = new aws.apigatewayv2.DomainName( + `${name}-${domainResourceName}`, + { ...domainConfiguration, domainName: domainKey }, + { parent }, + ); + domains.push(domain); + resolvedDomainId = domain.id; + } + new aws.apigatewayv2.ApiMapping( + `${name}-${domainResourceName}`, + { + apiId: api.id, + domainName: resolvedDomainId!, + ...apiMappingArgs, + }, + { parent, dependsOn: domains }, + ); + } + + return { api, routes, integrations, authorizers, stages, deployment, domains }; } function defaultStages(): Record { From 04851f32315cb18fecf0713e3cbf2e60a30a4d85 Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Wed, 22 Nov 2023 15:39:10 +0000 Subject: [PATCH 03/18] Generate schema - Fix mapping sub-resources by map key. - Pipe through additional args to the root API resource. --- awsx/apigatewayv2/httpApi.ts | 103 ++++++++++---- awsx/apigatewayv2/index.ts | 15 ++ awsx/resources.ts | 2 + awsx/schema-types.ts | 69 +++++++++ schema.json | 204 ++++++++++++++++++++++++++ schemagen/pkg/gen/apigatewayv2.go | 229 ++++++++++++++++++++++++++++++ schemagen/pkg/gen/ec2.go | 18 +++ schemagen/pkg/gen/schema.go | 5 + 8 files changed, 617 insertions(+), 28 deletions(-) create mode 100644 awsx/apigatewayv2/index.ts create mode 100644 schemagen/pkg/gen/apigatewayv2.go diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts index 31af7e576..b324ea9fa 100644 --- a/awsx/apigatewayv2/httpApi.ts +++ b/awsx/apigatewayv2/httpApi.ts @@ -1,5 +1,20 @@ +// Copyright 2016-2023, Pulumi Corporation. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; +import * as schema from "../schema-types"; type Route = Omit< aws.apigatewayv2.RouteArgs, @@ -13,7 +28,6 @@ type Route = Omit< > & { integration?: pulumi.Input; authorizer?: pulumi.Input; - target: pulumi.Input; }; type HttpIntegration = Omit< @@ -41,26 +55,47 @@ type DomainName = Omit domainId?: pulumi.Input; }; -interface HttpApiArgs { +type HttpApiArgs = Omit< + aws.apigatewayv2.ApiArgs, + "protocolType" | "target" | "routeKey" | "credentialsArn" +> & { routes: Record; integrations?: Record; authorizers?: Record; stages?: Record; domainNames?: Record; +}; + +export class HttpApi extends schema.HttpApi { + constructor(name: string, args: HttpApiArgs, opts?: pulumi.ComponentResourceOptions) { + super(name, args, opts); + + const result = buildHttpApi(this, name, args); + this.api = result.api; + this.routes = result.routes; + this.integrations = result.integrations; + this.authorizers = result.authorizers; + this.stages = result.stages; + this.deployment = result.deployment; + this.domainNames = result.domainNames; + this.apiMappings = result.apiMappings; + } } -export async function buildHttpApi(parent: pulumi.Resource, name: string, args: HttpApiArgs) { +export function buildHttpApi(parent: pulumi.Resource, name: string, args: HttpApiArgs) { + const { routes, integrations, authorizers, stages, domainNames, ...apiArgs } = args; const api = new aws.apigatewayv2.Api( name, { protocolType: "HTTP", + ...apiArgs, }, { parent }, ); const functions: aws.lambda.Function[] = []; const integrationsMap = new Map(); - for (const [integrationKey, integrationInput] of Object.entries(args.integrations ?? {})) { + for (const [integrationKey, integrationInput] of Object.entries(integrations ?? {})) { const integrationName = `${name}-${integrationKey}`; if ("lambda" in integrationInput) { const { lambda, ...integrationArgs } = integrationInput; @@ -92,10 +127,10 @@ export async function buildHttpApi(parent: pulumi.Resource, name: string, args: ); } } - const integrations = Array.from(integrationsMap.values()); + const integrationResources = Array.from(integrationsMap.values()); const authorizersMap = new Map(); - for (const [authorizerKey, authorizerInput] of Object.entries(args.authorizers ?? {})) { + for (const [authorizerKey, authorizerInput] of Object.entries(authorizers ?? {})) { const authorizerName = authorizerKey.replace(/\W+/g, "-"); authorizersMap.set( authorizerKey, @@ -109,10 +144,10 @@ export async function buildHttpApi(parent: pulumi.Resource, name: string, args: ), ); } - const authorizers = Array.from(authorizersMap.values()); + const authorizerResources = Array.from(authorizersMap.values()); - const routes: aws.apigatewayv2.Route[] = []; - for (const [routeKey, routeInput] of Object.entries(args.routes)) { + const routeResources: aws.apigatewayv2.Route[] = []; + for (const [routeKey, routeInput] of Object.entries(routes)) { const routeName = routeKey.replace(/\W+/g, "-"); const { integration, authorizer, ...routeArgs } = routeInput; let target = routeInput.target; @@ -135,7 +170,7 @@ export async function buildHttpApi(parent: pulumi.Resource, name: string, args: return authorizer.id; }); } - routes.push( + routeResources.push( new aws.apigatewayv2.Route( `${name}-${routeName}`, { @@ -147,15 +182,15 @@ export async function buildHttpApi(parent: pulumi.Resource, name: string, args: }, { parent, - dependsOn: integrations, + dependsOn: integrationResources, }, ), ); } - const stages: aws.apigatewayv2.Stage[] = []; - for (const [stageKey, stageInput] of Object.entries(args.stages ?? defaultStages())) { - stages.push( + const stageResources: aws.apigatewayv2.Stage[] = []; + for (const [stageKey, stageInput] of Object.entries(stages ?? defaultStages())) { + stageResources.push( new aws.apigatewayv2.Stage( `${name}-${stageKey}`, { @@ -167,16 +202,17 @@ export async function buildHttpApi(parent: pulumi.Resource, name: string, args: ); } - const deployment = new aws.apigatewayv2.Deployment( + const deploymentResource = new aws.apigatewayv2.Deployment( `${name}-deployment`, { apiId: api.id, }, - { parent, dependsOn: [...routes, ...stages] }, + { parent, dependsOn: [...routeResources, ...stageResources] }, ); - const domains: aws.apigatewayv2.DomainName[] = []; - for (const [domainKey, domainInput] of Object.entries(args.domainNames ?? {})) { + const domainResources: aws.apigatewayv2.DomainName[] = []; + const apiMappingResources: aws.apigatewayv2.ApiMapping[] = []; + for (const [domainKey, domainInput] of Object.entries(domainNames ?? {})) { const { domainConfiguration, domainId, ...apiMappingArgs } = domainInput; if ( (domainId === undefined && domainConfiguration === undefined) || @@ -194,21 +230,32 @@ export async function buildHttpApi(parent: pulumi.Resource, name: string, args: { ...domainConfiguration, domainName: domainKey }, { parent }, ); - domains.push(domain); + domainResources.push(domain); resolvedDomainId = domain.id; } - new aws.apigatewayv2.ApiMapping( - `${name}-${domainResourceName}`, - { - apiId: api.id, - domainName: resolvedDomainId!, - ...apiMappingArgs, - }, - { parent, dependsOn: domains }, + apiMappingResources.push( + new aws.apigatewayv2.ApiMapping( + `${name}-${domainResourceName}`, + { + apiId: api.id, + domainName: resolvedDomainId!, + ...apiMappingArgs, + }, + { parent, dependsOn: domainResources }, + ), ); } - return { api, routes, integrations, authorizers, stages, deployment, domains }; + return { + api, + routes: routeResources, + integrations: integrationResources, + authorizers: authorizerResources, + stages: stageResources, + deployment: deploymentResource, + domainNames: domainResources, + apiMappings: apiMappingResources, + }; } function defaultStages(): Record { diff --git a/awsx/apigatewayv2/index.ts b/awsx/apigatewayv2/index.ts new file mode 100644 index 000000000..b554c2f74 --- /dev/null +++ b/awsx/apigatewayv2/index.ts @@ -0,0 +1,15 @@ +// Copyright 2016-2023, Pulumi Corporation. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +export { HttpApi } from "./httpApi"; diff --git a/awsx/resources.ts b/awsx/resources.ts index fdac2ac98..f1d139c51 100644 --- a/awsx/resources.ts +++ b/awsx/resources.ts @@ -19,6 +19,7 @@ import { Repository } from "./ecr"; import { Image } from "./ecr/image"; import * as ecs from "./ecs"; import * as lb from "./lb"; +import * as apigatewayv2 from "./apigatewayv2"; import * as schemaTypes from "./schema-types"; const resources: schemaTypes.ResourceConstructor = { @@ -34,6 +35,7 @@ const resources: schemaTypes.ResourceConstructor = { "awsx:ec2:DefaultVpc": (...args) => new ec2.DefaultVpc(...args), "awsx:ecr:Repository": (...args) => new Repository(...args), "awsx:ecr:Image": (...args) => new Image(...args), + "awsx:apigatewayv2:HttpApi": (...args) => new apigatewayv2.HttpApi(...args), }; export function construct( diff --git a/awsx/schema-types.ts b/awsx/schema-types.ts index cc37674a2..b5af6f1b8 100644 --- a/awsx/schema-types.ts +++ b/awsx/schema-types.ts @@ -6,6 +6,7 @@ import * as pulumi from "@pulumi/pulumi"; export type ConstructComponent = (name: string, inputs: any, options: pulumi.ComponentResourceOptions) => T; export type ResourceConstructor = { + readonly "awsx:apigatewayv2:HttpApi": ConstructComponent; readonly "awsx:cloudtrail:Trail": ConstructComponent; readonly "awsx:ec2:DefaultVpc": ConstructComponent; readonly "awsx:ec2:Vpc": ConstructComponent; @@ -24,6 +25,36 @@ export type Functions = { }; import * as aws from "@pulumi/aws"; import * as docker from "@pulumi/docker"; +export abstract class HttpApi extends (pulumi.ComponentResource) { + public api!: aws.apigatewayv2.Api | pulumi.Output; + public apiMappings?: aws.apigatewayv2.ApiMapping[] | pulumi.Output; + public authorizers!: aws.apigatewayv2.Authorizer[] | pulumi.Output; + public deployment!: aws.apigatewayv2.Deployment | pulumi.Output; + public domainNames!: aws.apigatewayv2.DomainName[] | pulumi.Output; + public integrations!: aws.apigatewayv2.Integration[] | pulumi.Output; + public routes!: aws.apigatewayv2.Route[] | pulumi.Output; + public stages!: aws.apigatewayv2.Stage[] | pulumi.Output; + constructor(name: string, args: pulumi.Inputs, opts: pulumi.ComponentResourceOptions = {}) { + super("awsx:apigatewayv2:HttpApi", name, opts.urn ? { api: undefined, apiMappings: undefined, authorizers: undefined, deployment: undefined, domainNames: undefined, integrations: undefined, routes: undefined, stages: undefined } : { name, args, opts }, opts); + } +} +export interface HttpApiArgs { + readonly apiKeySelectionExpression?: pulumi.Input; + readonly authorizers?: pulumi.Input>>; + readonly body?: pulumi.Input; + readonly corsConfiguration?: pulumi.Input; + readonly description?: pulumi.Input; + readonly disableExecuteApiEndpoint?: pulumi.Input; + readonly domainMappings?: pulumi.Input>>; + readonly failOnWarnings?: pulumi.Input; + readonly integrations?: pulumi.Input>>; + readonly name?: pulumi.Input; + readonly routeSelectionExpression?: pulumi.Input; + readonly routes: pulumi.Input>>; + readonly stages?: pulumi.Input>>; + readonly tags?: pulumi.Input>>; + readonly version?: pulumi.Input; +} export abstract class Trail extends (pulumi.ComponentResource) { public bucket?: aws.s3.Bucket | pulumi.Output; public logGroup?: aws.cloudwatch.LogGroup | pulumi.Output; @@ -357,6 +388,44 @@ export interface TargetGroupAttachmentArgs { readonly targetGroup?: pulumi.Input; readonly targetGroupArn?: pulumi.Input; } +export interface DomainConfigurationInputs { + readonly domainNameConfiguration?: pulumi.Input; + readonly mutualTlsAuthentication?: pulumi.Input; + readonly tags?: pulumi.Input>>; +} +export interface DomainConfigurationOutputs { + readonly domainNameConfiguration?: pulumi.Output; + readonly mutualTlsAuthentication?: pulumi.Output; + readonly tags?: pulumi.Output>; +} +export interface DomainMappingInputs { + readonly domainConfiguration?: pulumi.Input; + readonly domainId?: pulumi.Input; +} +export interface DomainMappingOutputs { + readonly domainConfiguration?: pulumi.Output; + readonly domainId?: pulumi.Output; +} +export interface HttpAuthorizerInputs { +} +export interface HttpAuthorizerOutputs { +} +export interface HttpIntegrationInputs { +} +export interface HttpIntegrationOutputs { +} +export interface HttpRouteInputs { + readonly authorizer?: pulumi.Input; + readonly integration?: pulumi.Input; +} +export interface HttpRouteOutputs { + readonly authorizer?: pulumi.Output; + readonly integration?: pulumi.Output; +} +export interface HttpStageInputs { +} +export interface HttpStageOutputs { +} export interface BucketInputs { readonly accelerationStatus?: pulumi.Input; readonly acl?: pulumi.Input; diff --git a/schema.json b/schema.json index 79015269b..7d2edc60a 100644 --- a/schema.json +++ b/schema.json @@ -66,6 +66,62 @@ }, "config": {}, "types": { + "awsx:apigatewayv2:DomainConfiguration": { + "description": "Manages an Amazon API Gateway Version 2 domain name.\nMore information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html).\n\n\u003e **Note:** This resource establishes ownership of and the TLS settings for\na particular domain name. An API stage can be associated with the domain name using the `aws.apigatewayv2.ApiMapping` resource.\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Basic\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.DomainName(\"example\", {\n domainName: \"ws-api.example.com\",\n domainNameConfiguration: {\n certificateArn: aws_acm_certificate.example.arn,\n endpointType: \"REGIONAL\",\n securityPolicy: \"TLS_1_2\",\n },\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.DomainName(\"example\",\n domain_name=\"ws-api.example.com\",\n domain_name_configuration=aws.apigatewayv2.DomainNameDomainNameConfigurationArgs(\n certificate_arn=aws_acm_certificate[\"example\"][\"arn\"],\n endpoint_type=\"REGIONAL\",\n security_policy=\"TLS_1_2\",\n ))\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.DomainName(\"example\", new()\n {\n Domain = \"ws-api.example.com\",\n DomainNameConfiguration = new Aws.ApiGatewayV2.Inputs.DomainNameDomainNameConfigurationArgs\n {\n CertificateArn = aws_acm_certificate.Example.Arn,\n EndpointType = \"REGIONAL\",\n SecurityPolicy = \"TLS_1_2\",\n },\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewDomainName(ctx, \"example\", \u0026apigatewayv2.DomainNameArgs{\n\t\t\tDomainName: pulumi.String(\"ws-api.example.com\"),\n\t\t\tDomainNameConfiguration: \u0026apigatewayv2.DomainNameDomainNameConfigurationArgs{\n\t\t\t\tCertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn),\n\t\t\t\tEndpointType: pulumi.String(\"REGIONAL\"),\n\t\t\t\tSecurityPolicy: pulumi.String(\"TLS_1_2\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.DomainName;\nimport com.pulumi.aws.apigatewayv2.DomainNameArgs;\nimport com.pulumi.aws.apigatewayv2.inputs.DomainNameDomainNameConfigurationArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new DomainName(\"example\", DomainNameArgs.builder() \n .domainName(\"ws-api.example.com\")\n .domainNameConfiguration(DomainNameDomainNameConfigurationArgs.builder()\n .certificateArn(aws_acm_certificate.example().arn())\n .endpointType(\"REGIONAL\")\n .securityPolicy(\"TLS_1_2\")\n .build())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:DomainName\n properties:\n domainName: ws-api.example.com\n domainNameConfiguration:\n certificateArn: ${aws_acm_certificate.example.arn}\n endpointType: REGIONAL\n securityPolicy: TLS_1_2\n```\n{{% /example %}}\n{{% example %}}\n### Associated Route 53 Resource Record\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst exampleDomainName = new aws.apigatewayv2.DomainName(\"exampleDomainName\", {\n domainName: \"http-api.example.com\",\n domainNameConfiguration: {\n certificateArn: aws_acm_certificate.example.arn,\n endpointType: \"REGIONAL\",\n securityPolicy: \"TLS_1_2\",\n },\n});\nconst exampleRecord = new aws.route53.Record(\"exampleRecord\", {\n name: exampleDomainName.domainName,\n type: \"A\",\n zoneId: aws_route53_zone.example.zone_id,\n aliases: [{\n name: exampleDomainName.domainNameConfiguration.apply(domainNameConfiguration =\u003e domainNameConfiguration.targetDomainName),\n zoneId: exampleDomainName.domainNameConfiguration.apply(domainNameConfiguration =\u003e domainNameConfiguration.hostedZoneId),\n evaluateTargetHealth: false,\n }],\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample_domain_name = aws.apigatewayv2.DomainName(\"exampleDomainName\",\n domain_name=\"http-api.example.com\",\n domain_name_configuration=aws.apigatewayv2.DomainNameDomainNameConfigurationArgs(\n certificate_arn=aws_acm_certificate[\"example\"][\"arn\"],\n endpoint_type=\"REGIONAL\",\n security_policy=\"TLS_1_2\",\n ))\nexample_record = aws.route53.Record(\"exampleRecord\",\n name=example_domain_name.domain_name,\n type=\"A\",\n zone_id=aws_route53_zone[\"example\"][\"zone_id\"],\n aliases=[aws.route53.RecordAliasArgs(\n name=example_domain_name.domain_name_configuration.target_domain_name,\n zone_id=example_domain_name.domain_name_configuration.hosted_zone_id,\n evaluate_target_health=False,\n )])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var exampleDomainName = new Aws.ApiGatewayV2.DomainName(\"exampleDomainName\", new()\n {\n Domain = \"http-api.example.com\",\n DomainNameConfiguration = new Aws.ApiGatewayV2.Inputs.DomainNameDomainNameConfigurationArgs\n {\n CertificateArn = aws_acm_certificate.Example.Arn,\n EndpointType = \"REGIONAL\",\n SecurityPolicy = \"TLS_1_2\",\n },\n });\n\n var exampleRecord = new Aws.Route53.Record(\"exampleRecord\", new()\n {\n Name = exampleDomainName.Domain,\n Type = \"A\",\n ZoneId = aws_route53_zone.Example.Zone_id,\n Aliases = new[]\n {\n new Aws.Route53.Inputs.RecordAliasArgs\n {\n Name = exampleDomainName.DomainNameConfiguration.Apply(domainNameConfiguration =\u003e domainNameConfiguration.TargetDomainName),\n ZoneId = exampleDomainName.DomainNameConfiguration.Apply(domainNameConfiguration =\u003e domainNameConfiguration.HostedZoneId),\n EvaluateTargetHealth = false,\n },\n },\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\texampleDomainName, err := apigatewayv2.NewDomainName(ctx, \"exampleDomainName\", \u0026apigatewayv2.DomainNameArgs{\n\t\t\tDomainName: pulumi.String(\"http-api.example.com\"),\n\t\t\tDomainNameConfiguration: \u0026apigatewayv2.DomainNameDomainNameConfigurationArgs{\n\t\t\t\tCertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn),\n\t\t\t\tEndpointType: pulumi.String(\"REGIONAL\"),\n\t\t\t\tSecurityPolicy: pulumi.String(\"TLS_1_2\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = route53.NewRecord(ctx, \"exampleRecord\", \u0026route53.RecordArgs{\n\t\t\tName: exampleDomainName.DomainName,\n\t\t\tType: pulumi.String(\"A\"),\n\t\t\tZoneId: pulumi.Any(aws_route53_zone.Example.Zone_id),\n\t\t\tAliases: route53.RecordAliasArray{\n\t\t\t\t\u0026route53.RecordAliasArgs{\n\t\t\t\t\tName: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) {\n\t\t\t\t\t\treturn \u0026domainNameConfiguration.TargetDomainName, nil\n\t\t\t\t\t}).(pulumi.StringPtrOutput),\n\t\t\t\t\tZoneId: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) {\n\t\t\t\t\t\treturn \u0026domainNameConfiguration.HostedZoneId, nil\n\t\t\t\t\t}).(pulumi.StringPtrOutput),\n\t\t\t\t\tEvaluateTargetHealth: pulumi.Bool(false),\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.DomainName;\nimport com.pulumi.aws.apigatewayv2.DomainNameArgs;\nimport com.pulumi.aws.apigatewayv2.inputs.DomainNameDomainNameConfigurationArgs;\nimport com.pulumi.aws.route53.Record;\nimport com.pulumi.aws.route53.RecordArgs;\nimport com.pulumi.aws.route53.inputs.RecordAliasArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var exampleDomainName = new DomainName(\"exampleDomainName\", DomainNameArgs.builder() \n .domainName(\"http-api.example.com\")\n .domainNameConfiguration(DomainNameDomainNameConfigurationArgs.builder()\n .certificateArn(aws_acm_certificate.example().arn())\n .endpointType(\"REGIONAL\")\n .securityPolicy(\"TLS_1_2\")\n .build())\n .build());\n\n var exampleRecord = new Record(\"exampleRecord\", RecordArgs.builder() \n .name(exampleDomainName.domainName())\n .type(\"A\")\n .zoneId(aws_route53_zone.example().zone_id())\n .aliases(RecordAliasArgs.builder()\n .name(exampleDomainName.domainNameConfiguration().applyValue(domainNameConfiguration -\u003e domainNameConfiguration.targetDomainName()))\n .zoneId(exampleDomainName.domainNameConfiguration().applyValue(domainNameConfiguration -\u003e domainNameConfiguration.hostedZoneId()))\n .evaluateTargetHealth(false)\n .build())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n exampleDomainName:\n type: aws:apigatewayv2:DomainName\n properties:\n domainName: http-api.example.com\n domainNameConfiguration:\n certificateArn: ${aws_acm_certificate.example.arn}\n endpointType: REGIONAL\n securityPolicy: TLS_1_2\n exampleRecord:\n type: aws:route53:Record\n properties:\n name: ${exampleDomainName.domainName}\n type: A\n zoneId: ${aws_route53_zone.example.zone_id}\n aliases:\n - name: ${exampleDomainName.domainNameConfiguration.targetDomainName}\n zoneId: ${exampleDomainName.domainNameConfiguration.hostedZoneId}\n evaluateTargetHealth: false\n```\n{{% /example %}}\n{{% /examples %}}\n\n## Import\n\nUsing `pulumi import`, import `aws_apigatewayv2_domain_name` using the domain name. For example:\n\n```sh\n $ pulumi import aws:apigatewayv2/domainName:DomainName example ws-api.example.com\n```\n ", + "properties": { + "domainNameConfiguration": { + "$ref": "/aws/v6.9.0/schema.json#/types/aws:apigatewayv2/DomainNameDomainNameConfiguration:DomainNameDomainNameConfiguration", + "description": "Domain name configuration. See below.\n" + }, + "mutualTlsAuthentication": { + "$ref": "/aws/v6.9.0/schema.json#/types/aws:apigatewayv2/DomainNameMutualTlsAuthentication:DomainNameMutualTlsAuthentication", + "description": "Mutual TLS authentication configuration for the domain name.\n" + }, + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.\n" + } + }, + "type": "object" + }, + "awsx:apigatewayv2:DomainMapping": { + "properties": { + "domainConfiguration": { + "$ref": "#/types/awsx:apigatewayv2:DomainConfiguration", + "description": "Configuration of the domain name to create. Cannot be specified together with `domainId`." + }, + "domainId": { + "type": "string", + "description": "Identifier of an existing domain. Cannot be specified together with `domainConfiguration`." + } + }, + "type": "object" + }, + "awsx:apigatewayv2:HttpAuthorizer": { + "type": "object" + }, + "awsx:apigatewayv2:HttpIntegration": { + "type": "object" + }, + "awsx:apigatewayv2:HttpRoute": { + "properties": { + "authorizer": { + "type": "string", + "description": "The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route." + }, + "integration": { + "type": "string", + "description": "The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified." + } + }, + "type": "object" + }, + "awsx:apigatewayv2:HttpStage": { + "type": "object" + }, "awsx:awsx:Bucket": { "description": "The set of arguments for constructing a Bucket resource.", "properties": { @@ -1766,6 +1822,154 @@ }, "provider": {}, "resources": { + "awsx:apigatewayv2:HttpApi": { + "description": "Creates an HTTP API with associated sub-resources.", + "properties": { + "api": { + "$ref": "/aws/v6.9.0/schema.json#/resources/aws:apigatewayv2%2fapi:Api", + "description": "The underlying API resource." + }, + "apiMappings": { + "type": "array", + "items": { + "$ref": "/aws/v6.9.0/schema.json#/resources/aws:apigatewayv2%2fapiMapping:ApiMapping" + }, + "description": "The API mappings for the HTTP API." + }, + "authorizers": { + "type": "array", + "items": { + "$ref": "/aws/v6.9.0/schema.json#/resources/aws:apigatewayv2%2fauthorizer:Authorizer" + }, + "description": "The authorizers for the HTTP API routes." + }, + "deployment": { + "$ref": "/aws/v6.9.0/schema.json#/resources/aws:apigatewayv2%2fdeployment:Deployment", + "description": "The deployment for the HTTP API." + }, + "domainNames": { + "type": "array", + "items": { + "$ref": "/aws/v6.9.0/schema.json#/resources/aws:apigatewayv2%2fdomainName:DomainName" + }, + "description": "The domain names for the HTTP API." + }, + "integrations": { + "type": "array", + "items": { + "$ref": "/aws/v6.9.0/schema.json#/resources/aws:apigatewayv2%2fintegration:Integration" + }, + "description": "The integrations for the HTTP API routes. This is a map from integration name to the integration arguments." + }, + "routes": { + "type": "array", + "items": { + "$ref": "/aws/v6.9.0/schema.json#/resources/aws:apigatewayv2%2froute:Route" + }, + "description": "The routes for the HTTP API. This is a map from route key (for example `GET /pets`) to route arguments." + }, + "stages": { + "type": "array", + "items": { + "$ref": "/aws/v6.9.0/schema.json#/resources/aws:apigatewayv2%2fstage:Stage" + }, + "description": "The deployment stages for the HTTP API." + } + }, + "type": "awsx:apigatewayv2:httpApi", + "required": [ + "api", + "routes", + "integrations", + "authorizers", + "stages", + "deployment", + "domainNames" + ], + "inputProperties": { + "apiKeySelectionExpression": { + "type": "string", + "description": "An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions).\nValid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`.\nApplicable for WebSocket APIs.\n" + }, + "authorizers": { + "type": "object", + "additionalProperties": { + "$ref": "#/types/awsx:apigatewayv2:HttpAuthorizer" + }, + "description": "The authorizers for the HTTP API routes." + }, + "body": { + "type": "string", + "description": "An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs.\n" + }, + "corsConfiguration": { + "$ref": "/aws/v6.9.0/schema.json#/types/aws:apigatewayv2/ApiCorsConfiguration:ApiCorsConfiguration", + "description": "Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs.\n" + }, + "description": { + "type": "string", + "description": "Description of the API. Must be less than or equal to 1024 characters in length.\n" + }, + "disableExecuteApiEndpoint": { + "type": "boolean", + "description": "Whether clients can invoke the API by using the default `execute-api` endpoint.\nBy default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`.\nTo require that clients use a custom domain name to invoke the API, disable the default endpoint.\n" + }, + "domainMappings": { + "type": "object", + "additionalProperties": { + "$ref": "#/types/awsx:apigatewayv2:DomainMapping" + }, + "description": "The domain names for the HTTP API." + }, + "failOnWarnings": { + "type": "boolean", + "description": "Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs.\n" + }, + "integrations": { + "type": "object", + "additionalProperties": { + "$ref": "#/types/awsx:apigatewayv2:HttpIntegration" + }, + "description": "The integrations for the HTTP API routes." + }, + "name": { + "type": "string", + "description": "Name of the API. Must be less than or equal to 128 characters in length.\n" + }, + "routeSelectionExpression": { + "type": "string", + "description": "The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API.\nDefaults to `$request.method $request.path`.\n" + }, + "routes": { + "type": "object", + "additionalProperties": { + "$ref": "#/types/awsx:apigatewayv2:HttpRoute" + }, + "description": "The routes for the HTTP API." + }, + "stages": { + "type": "object", + "additionalProperties": { + "$ref": "#/types/awsx:apigatewayv2:HttpStage" + }, + "description": "The deployment stages for the HTTP API." + }, + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.\n" + }, + "version": { + "type": "string", + "description": "Version identifier for the API. Must be between 1 and 64 characters in length.\n" + } + }, + "requiredInputs": [ + "routes" + ] + }, "awsx:cloudtrail:Trail": { "properties": { "bucket": { diff --git a/schemagen/pkg/gen/apigatewayv2.go b/schemagen/pkg/gen/apigatewayv2.go new file mode 100644 index 000000000..3a6152f72 --- /dev/null +++ b/schemagen/pkg/gen/apigatewayv2.go @@ -0,0 +1,229 @@ +// Copyright 2016-2023, Pulumi Corporation. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gen + +import "github.com/pulumi/pulumi/pkg/v3/codegen/schema" + +func generateApiGatewayV2(awsSpec schema.PackageSpec) schema.PackageSpec { + return schema.PackageSpec{ + Resources: map[string]schema.ResourceSpec{ + "awsx:apigatewayv2:HttpApi": httpApi(awsSpec), + }, + Types: map[string]schema.ComplexTypeSpec{ + "awsx:apigatewayv2:HttpRoute": httpRoute(awsSpec), + "awsx:apigatewayv2:HttpIntegration": httpIntegration(awsSpec), + "awsx:apigatewayv2:HttpAuthorizer": httpAuthorizer(awsSpec), + "awsx:apigatewayv2:HttpStage": httpStage(awsSpec), + "awsx:apigatewayv2:DomainMapping": domainMapping(awsSpec), + "awsx:apigatewayv2:DomainConfiguration": domainConfiguration(awsSpec), + }, + } +} + +func httpApi(awsSpec schema.PackageSpec) schema.ResourceSpec { + awsApiSpec := awsSpec.Resources["aws:apigatewayv2/api:Api"] + inputProperties := map[string]schema.PropertySpec{ + "routes": { + Description: "The routes for the HTTP API.", + TypeSpec: stringMapOfLocalRefs("apigatewayv2", "HttpRoute"), + }, + "integrations": { + Description: "The integrations for the HTTP API routes.", + TypeSpec: stringMapOfLocalRefs("apigatewayv2", "HttpIntegration"), + }, + "authorizers": { + Description: "The authorizers for the HTTP API routes.", + TypeSpec: stringMapOfLocalRefs("apigatewayv2", "HttpAuthorizer"), + }, + "stages": { + Description: "The deployment stages for the HTTP API.", + TypeSpec: stringMapOfLocalRefs("apigatewayv2", "HttpStage"), + }, + "domainMappings": { + Description: "The domain names for the HTTP API.", + TypeSpec: stringMapOfLocalRefs("apigatewayv2", "DomainMapping"), + }, + } + for k, v := range awsApiSpec.InputProperties { + // Protocol type is hard coded to HTTP. + // Target, route key and credentials ARN are part of "quick create" which isn't a helpful abstraction to present in the component. + if k == "protocolType" || k == "target" || k == "routeKey" || k == "credentialsArn" { + continue + } + // Skip conflicting properties. + if _, ok := inputProperties[k]; ok { + continue + } + inputProperties[k] = renameAwsPropertyRefs(awsSpec, v) + } + return schema.ResourceSpec{ + ObjectTypeSpec: schema.ObjectTypeSpec{ + Description: "Creates an HTTP API with associated sub-resources.", + Type: "awsx:apigatewayv2:httpApi", + Properties: map[string]schema.PropertySpec{ + "api": { + Description: "The underlying API resource.", + TypeSpec: awsType(awsSpec, "apigatewayv2", "api"), + }, + "routes": { + Description: "The routes for the HTTP API. This is a map from route key (for example `GET /pets`) to route arguments.", + TypeSpec: arrayOfAwsType(awsSpec, "apigatewayv2", "route"), + }, + "integrations": { + Description: "The integrations for the HTTP API routes. This is a map from integration name to the integration arguments.", + TypeSpec: arrayOfAwsType(awsSpec, "apigatewayv2", "integration"), + }, + "authorizers": { + Description: "The authorizers for the HTTP API routes.", + TypeSpec: arrayOfAwsType(awsSpec, "apigatewayv2", "authorizer"), + }, + "stages": { + Description: "The deployment stages for the HTTP API.", + TypeSpec: arrayOfAwsType(awsSpec, "apigatewayv2", "stage"), + }, + "deployment": { + Description: "The deployment for the HTTP API.", + TypeSpec: awsType(awsSpec, "apigatewayv2", "deployment"), + }, + "domainNames": { + Description: "The domain names for the HTTP API.", + TypeSpec: arrayOfAwsType(awsSpec, "apigatewayv2", "domainName"), + }, + "apiMappings": { + Description: "The API mappings for the HTTP API.", + TypeSpec: arrayOfAwsType(awsSpec, "apigatewayv2", "apiMapping"), + }, + }, + Required: []string{"api", "routes", "integrations", "authorizers", "stages", "deployment", "domainNames"}, + }, + InputProperties: inputProperties, + RequiredInputs: []string{"routes"}, + } +} + +func httpRoute(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { + original := awsSpec.Types["aws:apigatewayv2/route:Route"] + properties := renameAwsPropertiesRefs(awsSpec, original.Properties) + delete(properties, "apiId") + // Inferred from the map key + delete(properties, "routeKey") + // WebSocket specific properties + delete(properties, "requestModels") + delete(properties, "requestParameters") + delete(properties, "routeResponseSelectionExpression") + delete(properties, "modelSelectionExpression") + properties["integration"] = schema.PropertySpec{ + Description: "The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified.", + TypeSpec: schema.TypeSpec{ + Type: "string", + }, + } + properties["authorizer"] = schema.PropertySpec{ + Description: "The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route.", + TypeSpec: schema.TypeSpec{ + Type: "string", + }, + } + return schema.ComplexTypeSpec{ + ObjectTypeSpec: schema.ObjectTypeSpec{ + Type: "object", + Description: original.Description, + Properties: properties, + }, + } +} + +func httpIntegration(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { + original := awsSpec.Types["aws:apigatewayv2/integration:Integration"] + properties := renameAwsPropertiesRefs(awsSpec, original.Properties) + delete(properties, "apiId") + // WebSocket specific properties + delete(properties, "requestTemplates") + delete(properties, "contentHandlingStrategy") + delete(properties, "passthroughBehavior") + delete(properties, "templateSelectionExpression") + return schema.ComplexTypeSpec{ + ObjectTypeSpec: schema.ObjectTypeSpec{ + Type: "object", + Description: original.Description, + Properties: properties, + }, + } +} + +func httpAuthorizer(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { + original := awsSpec.Types["aws:apigatewayv2/authorizer:Authorizer"] + properties := renameAwsPropertiesRefs(awsSpec, original.Properties) + delete(properties, "apiId") + return schema.ComplexTypeSpec{ + ObjectTypeSpec: schema.ObjectTypeSpec{ + Type: "object", + Description: original.Description, + Properties: properties, + }, + } +} + +func httpStage(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { + original := awsSpec.Types["aws:apigatewayv2/stage:Stage"] + properties := renameAwsPropertiesRefs(awsSpec, original.Properties) + delete(properties, "apiId") + return schema.ComplexTypeSpec{ + ObjectTypeSpec: schema.ObjectTypeSpec{ + Type: "object", + Description: original.Description, + Properties: properties, + }, + } +} + +func domainMapping(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { + original := awsSpec.Types["aws:apigatewayv2/apiMapping:ApiMapping"] + properties := renameAwsPropertiesRefs(awsSpec, original.Properties) + delete(properties, "apiId") + delete(properties, "domainName") + properties["domainConfiguration"] = schema.PropertySpec{ + Description: "Configuration of the domain name to create. Cannot be specified together with `domainId`.", + TypeSpec: schema.TypeSpec{ + Ref: localRef("apigatewayv2", "DomainConfiguration"), + }, + } + properties["domainId"] = schema.PropertySpec{ + Description: "Identifier of an existing domain. Cannot be specified together with `domainConfiguration`.", + TypeSpec: schema.TypeSpec{ + Type: "string", + }, + } + return schema.ComplexTypeSpec{ + ObjectTypeSpec: schema.ObjectTypeSpec{ + Type: "object", + Description: original.Description, + Properties: properties, + }, + } +} + +func domainConfiguration(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { + original := awsSpec.Resources["aws:apigatewayv2/domainName:DomainName"] + properties := renameAwsPropertiesRefs(awsSpec, original.InputProperties) + delete(properties, "domainName") + return schema.ComplexTypeSpec{ + ObjectTypeSpec: schema.ObjectTypeSpec{ + Type: "object", + Description: original.Description, + Properties: properties, + }, + } +} diff --git a/schemagen/pkg/gen/ec2.go b/schemagen/pkg/gen/ec2.go index 5fa2e331c..818f4ac91 100644 --- a/schemagen/pkg/gen/ec2.go +++ b/schemagen/pkg/gen/ec2.go @@ -241,6 +241,24 @@ func vpcResource(awsSpec schema.PackageSpec) schema.ResourceSpec { } } +func arrayOfLocalRefs(module, name string) schema.TypeSpec { + return schema.TypeSpec{ + Type: "array", + Items: &schema.TypeSpec{ + Ref: localRef(module, name), + }, + } +} + +func stringMapOfLocalRefs(module, name string) schema.TypeSpec { + return schema.TypeSpec{ + Type: "object", + AdditionalProperties: &schema.TypeSpec{ + Ref: localRef(module, name), + }, + } +} + func arrayOfAwsType(packageSpec schema.PackageSpec, awsNamespace, resourceNameCamelCase string) schema.TypeSpec { awsRefInput := fmt.Sprintf( "#/resources/aws:%s%s%s:%s", diff --git a/schemagen/pkg/gen/schema.go b/schemagen/pkg/gen/schema.go index 692799055..0fc4d9606 100644 --- a/schemagen/pkg/gen/schema.go +++ b/schemagen/pkg/gen/schema.go @@ -113,6 +113,7 @@ func GenerateSchema(packageDir string) schema.PackageSpec { generateS3(awsSpec), generateEc2(awsSpec), generateEcr(awsSpec, dockerSpec), + generateApiGatewayV2(awsSpec), ) } @@ -174,6 +175,10 @@ func renamePropertiesRefs(propertySpec map[string]schema.PropertySpec, old, new return properties } +func renameAwsPropertyRefs(spec schema.PackageSpec, propSpec schema.PropertySpec) schema.PropertySpec { + return renamePropertyRefs(propSpec, "#/types/aws:", packageRef(spec, "/types/aws:")) +} + func renamePropertyRefs(propSpec schema.PropertySpec, old, new string) schema.PropertySpec { if propSpec.Ref != "" { propSpec.Ref = strings.Replace(propSpec.Ref, old, new, 1) From 9f014495a06241c06921277e46e479fc9306896d Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Wed, 22 Nov 2023 15:39:18 +0000 Subject: [PATCH 04/18] Generate SDK --- sdk/dotnet/Apigatewayv2/HttpApi.cs | 247 ++++ .../Inputs/DomainConfigurationArgs.cs | 383 ++++++ .../Apigatewayv2/Inputs/DomainMappingArgs.cs | 32 + .../Apigatewayv2/Inputs/HttpAuthorizerArgs.cs | 20 + .../Inputs/HttpIntegrationArgs.cs | 20 + .../Apigatewayv2/Inputs/HttpRouteArgs.cs | 32 + .../Apigatewayv2/Inputs/HttpStageArgs.cs | 20 + sdk/dotnet/Apigatewayv2/README.md | 1 + sdk/go/awsx/apigatewayv2/httpApi.go | 368 ++++++ sdk/go/awsx/apigatewayv2/init.go | 45 + sdk/go/awsx/apigatewayv2/pulumiTypes.go | 1127 +++++++++++++++++ .../com/pulumi/awsx/apigatewayv2/HttpApi.java | 190 +++ .../pulumi/awsx/apigatewayv2/HttpApiArgs.java | 630 +++++++++ .../inputs/DomainConfigurationArgs.java | 262 ++++ .../inputs/DomainMappingArgs.java | 121 ++ .../inputs/HttpAuthorizerArgs.java | 28 + .../inputs/HttpIntegrationArgs.java | 28 + .../apigatewayv2/inputs/HttpRouteArgs.java | 120 ++ .../apigatewayv2/inputs/HttpStageArgs.java | 28 + sdk/nodejs/apigatewayv2/httpApi.ts | 192 +++ sdk/nodejs/apigatewayv2/index.ts | 25 + sdk/nodejs/index.ts | 2 + sdk/nodejs/tsconfig.json | 2 + sdk/nodejs/types/input.ts | 387 ++++++ sdk/nodejs/types/output.ts | 3 + sdk/python/pulumi_awsx/__init__.py | 11 + .../pulumi_awsx/apigatewayv2/__init__.py | 9 + .../pulumi_awsx/apigatewayv2/_inputs.py | 509 ++++++++ .../pulumi_awsx/apigatewayv2/http_api.py | 484 +++++++ 29 files changed, 5326 insertions(+) create mode 100644 sdk/dotnet/Apigatewayv2/HttpApi.cs create mode 100644 sdk/dotnet/Apigatewayv2/Inputs/DomainConfigurationArgs.cs create mode 100644 sdk/dotnet/Apigatewayv2/Inputs/DomainMappingArgs.cs create mode 100644 sdk/dotnet/Apigatewayv2/Inputs/HttpAuthorizerArgs.cs create mode 100644 sdk/dotnet/Apigatewayv2/Inputs/HttpIntegrationArgs.cs create mode 100644 sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs create mode 100644 sdk/dotnet/Apigatewayv2/Inputs/HttpStageArgs.cs create mode 100644 sdk/dotnet/Apigatewayv2/README.md create mode 100644 sdk/go/awsx/apigatewayv2/httpApi.go create mode 100644 sdk/go/awsx/apigatewayv2/init.go create mode 100644 sdk/go/awsx/apigatewayv2/pulumiTypes.go create mode 100644 sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApi.java create mode 100644 sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApiArgs.java create mode 100644 sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainConfigurationArgs.java create mode 100644 sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainMappingArgs.java create mode 100644 sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpAuthorizerArgs.java create mode 100644 sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpIntegrationArgs.java create mode 100644 sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java create mode 100644 sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpStageArgs.java create mode 100644 sdk/nodejs/apigatewayv2/httpApi.ts create mode 100644 sdk/nodejs/apigatewayv2/index.ts create mode 100644 sdk/python/pulumi_awsx/apigatewayv2/__init__.py create mode 100644 sdk/python/pulumi_awsx/apigatewayv2/_inputs.py create mode 100644 sdk/python/pulumi_awsx/apigatewayv2/http_api.py diff --git a/sdk/dotnet/Apigatewayv2/HttpApi.cs b/sdk/dotnet/Apigatewayv2/HttpApi.cs new file mode 100644 index 000000000..2f89422f2 --- /dev/null +++ b/sdk/dotnet/Apigatewayv2/HttpApi.cs @@ -0,0 +1,247 @@ +// *** WARNING: this file was generated by pulumi-gen-awsx. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading.Tasks; +using Pulumi.Serialization; + +namespace Pulumi.Awsx.Apigatewayv2 +{ + /// + /// Creates an HTTP API with associated sub-resources. + /// + [AwsxResourceType("awsx:apigatewayv2:HttpApi")] + public partial class HttpApi : global::Pulumi.CustomResource + { + /// + /// The underlying API resource. + /// + [Output("api")] + public Output Api { get; private set; } = null!; + + /// + /// The API mappings for the HTTP API. + /// + [Output("apiMappings")] + public Output> ApiMappings { get; private set; } = null!; + + /// + /// The authorizers for the HTTP API routes. + /// + [Output("authorizers")] + public Output> Authorizers { get; private set; } = null!; + + /// + /// The deployment for the HTTP API. + /// + [Output("deployment")] + public Output Deployment { get; private set; } = null!; + + /// + /// The domain names for the HTTP API. + /// + [Output("domainNames")] + public Output> DomainNames { get; private set; } = null!; + + /// + /// The integrations for the HTTP API routes. This is a map from integration name to the integration arguments. + /// + [Output("integrations")] + public Output> Integrations { get; private set; } = null!; + + /// + /// The routes for the HTTP API. This is a map from route key (for example `GET /pets`) to route arguments. + /// + [Output("routes")] + public Output> Routes { get; private set; } = null!; + + /// + /// The deployment stages for the HTTP API. + /// + [Output("stages")] + public Output> Stages { get; private set; } = null!; + + + /// + /// Create a HttpApi resource with the given unique name, arguments, and options. + /// + /// + /// The unique name of the resource + /// The arguments used to populate this resource's properties + /// A bag of options that control this resource's behavior + public HttpApi(string name, HttpApiArgs args, CustomResourceOptions? options = null) + : base("awsx:apigatewayv2:HttpApi", name, args ?? new HttpApiArgs(), MakeResourceOptions(options, "")) + { + } + + private HttpApi(string name, Input id, CustomResourceOptions? options = null) + : base("awsx:apigatewayv2:HttpApi", name, null, MakeResourceOptions(options, id)) + { + } + + private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input? id) + { + var defaultOptions = new CustomResourceOptions + { + Version = Utilities.Version, + }; + var merged = CustomResourceOptions.Merge(defaultOptions, options); + // Override the ID if one was specified for consistency with other language SDKs. + merged.Id = id ?? merged.Id; + return merged; + } + /// + /// Get an existing HttpApi resource's state with the given name, ID, and optional extra + /// properties used to qualify the lookup. + /// + /// + /// The unique name of the resulting resource. + /// The unique provider ID of the resource to lookup. + /// A bag of options that control this resource's behavior + public static HttpApi Get(string name, Input id, CustomResourceOptions? options = null) + { + return new HttpApi(name, id, options); + } + } + + public sealed class HttpApiArgs : global::Pulumi.ResourceArgs + { + /// + /// An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). + /// Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. + /// Applicable for WebSocket APIs. + /// + [Input("apiKeySelectionExpression")] + public Input? ApiKeySelectionExpression { get; set; } + + [Input("authorizers")] + private InputMap? _authorizers; + + /// + /// The authorizers for the HTTP API routes. + /// + public InputMap Authorizers + { + get => _authorizers ?? (_authorizers = new InputMap()); + set => _authorizers = value; + } + + /// + /// An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. + /// + [Input("body")] + public Input? Body { get; set; } + + /// + /// Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. + /// + [Input("corsConfiguration")] + public Input? CorsConfiguration { get; set; } + + /// + /// Description of the API. Must be less than or equal to 1024 characters in length. + /// + [Input("description")] + public Input? Description { get; set; } + + /// + /// Whether clients can invoke the API by using the default `execute-api` endpoint. + /// By default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`. + /// To require that clients use a custom domain name to invoke the API, disable the default endpoint. + /// + [Input("disableExecuteApiEndpoint")] + public Input? DisableExecuteApiEndpoint { get; set; } + + [Input("domainMappings")] + private InputMap? _domainMappings; + + /// + /// The domain names for the HTTP API. + /// + public InputMap DomainMappings + { + get => _domainMappings ?? (_domainMappings = new InputMap()); + set => _domainMappings = value; + } + + /// + /// Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. + /// + [Input("failOnWarnings")] + public Input? FailOnWarnings { get; set; } + + [Input("integrations")] + private InputMap? _integrations; + + /// + /// The integrations for the HTTP API routes. + /// + public InputMap Integrations + { + get => _integrations ?? (_integrations = new InputMap()); + set => _integrations = value; + } + + /// + /// Name of the API. Must be less than or equal to 128 characters in length. + /// + [Input("name")] + public Input? Name { get; set; } + + /// + /// The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. + /// Defaults to `$request.method $request.path`. + /// + [Input("routeSelectionExpression")] + public Input? RouteSelectionExpression { get; set; } + + [Input("routes", required: true)] + private InputMap? _routes; + + /// + /// The routes for the HTTP API. + /// + public InputMap Routes + { + get => _routes ?? (_routes = new InputMap()); + set => _routes = value; + } + + [Input("stages")] + private InputMap? _stages; + + /// + /// The deployment stages for the HTTP API. + /// + public InputMap Stages + { + get => _stages ?? (_stages = new InputMap()); + set => _stages = value; + } + + [Input("tags")] + private InputMap? _tags; + + /// + /// Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + /// + public InputMap Tags + { + get => _tags ?? (_tags = new InputMap()); + set => _tags = value; + } + + /// + /// Version identifier for the API. Must be between 1 and 64 characters in length. + /// + [Input("version")] + public Input? Version { get; set; } + + public HttpApiArgs() + { + } + public static new HttpApiArgs Empty => new HttpApiArgs(); + } +} diff --git a/sdk/dotnet/Apigatewayv2/Inputs/DomainConfigurationArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/DomainConfigurationArgs.cs new file mode 100644 index 000000000..1a24151a4 --- /dev/null +++ b/sdk/dotnet/Apigatewayv2/Inputs/DomainConfigurationArgs.cs @@ -0,0 +1,383 @@ +// *** WARNING: this file was generated by pulumi-gen-awsx. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading.Tasks; +using Pulumi.Serialization; + +namespace Pulumi.Awsx.Apigatewayv2.Inputs +{ + + /// + /// Manages an Amazon API Gateway Version 2 domain name. + /// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). + /// + /// > **Note:** This resource establishes ownership of and the TLS settings for + /// a particular domain name. An API stage can be associated with the domain name using the `aws.apigatewayv2.ApiMapping` resource. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// ### Basic + /// + /// ```typescript + /// import * as pulumi from "@pulumi/pulumi"; + /// import * as aws from "@pulumi/aws"; + /// + /// const example = new aws.apigatewayv2.DomainName("example", { + /// domainName: "ws-api.example.com", + /// domainNameConfiguration: { + /// certificateArn: aws_acm_certificate.example.arn, + /// endpointType: "REGIONAL", + /// securityPolicy: "TLS_1_2", + /// }, + /// }); + /// ``` + /// ```python + /// import pulumi + /// import pulumi_aws as aws + /// + /// example = aws.apigatewayv2.DomainName("example", + /// domain_name="ws-api.example.com", + /// domain_name_configuration=aws.apigatewayv2.DomainNameDomainNameConfigurationArgs( + /// certificate_arn=aws_acm_certificate["example"]["arn"], + /// endpoint_type="REGIONAL", + /// security_policy="TLS_1_2", + /// )) + /// ``` + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Aws = Pulumi.Aws; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var example = new Aws.ApiGatewayV2.DomainName("example", new() + /// { + /// Domain = "ws-api.example.com", + /// DomainNameConfiguration = new Aws.ApiGatewayV2.Inputs.DomainNameDomainNameConfigurationArgs + /// { + /// CertificateArn = aws_acm_certificate.Example.Arn, + /// EndpointType = "REGIONAL", + /// SecurityPolicy = "TLS_1_2", + /// }, + /// }); + /// + /// }); + /// ``` + /// ```go + /// package main + /// + /// import ( + /// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + /// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + /// ) + /// + /// func main() { + /// pulumi.Run(func(ctx *pulumi.Context) error { + /// _, err := apigatewayv2.NewDomainName(ctx, "example", &apigatewayv2.DomainNameArgs{ + /// DomainName: pulumi.String("ws-api.example.com"), + /// DomainNameConfiguration: &apigatewayv2.DomainNameDomainNameConfigurationArgs{ + /// CertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn), + /// EndpointType: pulumi.String("REGIONAL"), + /// SecurityPolicy: pulumi.String("TLS_1_2"), + /// }, + /// }) + /// if err != nil { + /// return err + /// } + /// return nil + /// }) + /// } + /// ``` + /// ```java + /// package generated_program; + /// + /// import com.pulumi.Context; + /// import com.pulumi.Pulumi; + /// import com.pulumi.core.Output; + /// import com.pulumi.aws.apigatewayv2.DomainName; + /// import com.pulumi.aws.apigatewayv2.DomainNameArgs; + /// import com.pulumi.aws.apigatewayv2.inputs.DomainNameDomainNameConfigurationArgs; + /// import java.util.List; + /// import java.util.ArrayList; + /// import java.util.Map; + /// import java.io.File; + /// import java.nio.file.Files; + /// import java.nio.file.Paths; + /// + /// public class App { + /// public static void main(String[] args) { + /// Pulumi.run(App::stack); + /// } + /// + /// public static void stack(Context ctx) { + /// var example = new DomainName("example", DomainNameArgs.builder() + /// .domainName("ws-api.example.com") + /// .domainNameConfiguration(DomainNameDomainNameConfigurationArgs.builder() + /// .certificateArn(aws_acm_certificate.example().arn()) + /// .endpointType("REGIONAL") + /// .securityPolicy("TLS_1_2") + /// .build()) + /// .build()); + /// + /// } + /// } + /// ``` + /// ```yaml + /// resources: + /// example: + /// type: aws:apigatewayv2:DomainName + /// properties: + /// domainName: ws-api.example.com + /// domainNameConfiguration: + /// certificateArn: ${aws_acm_certificate.example.arn} + /// endpointType: REGIONAL + /// securityPolicy: TLS_1_2 + /// ``` + /// {{% /example %}} + /// {{% example %}} + /// ### Associated Route 53 Resource Record + /// + /// ```typescript + /// import * as pulumi from "@pulumi/pulumi"; + /// import * as aws from "@pulumi/aws"; + /// + /// const exampleDomainName = new aws.apigatewayv2.DomainName("exampleDomainName", { + /// domainName: "http-api.example.com", + /// domainNameConfiguration: { + /// certificateArn: aws_acm_certificate.example.arn, + /// endpointType: "REGIONAL", + /// securityPolicy: "TLS_1_2", + /// }, + /// }); + /// const exampleRecord = new aws.route53.Record("exampleRecord", { + /// name: exampleDomainName.domainName, + /// type: "A", + /// zoneId: aws_route53_zone.example.zone_id, + /// aliases: [{ + /// name: exampleDomainName.domainNameConfiguration.apply(domainNameConfiguration => domainNameConfiguration.targetDomainName), + /// zoneId: exampleDomainName.domainNameConfiguration.apply(domainNameConfiguration => domainNameConfiguration.hostedZoneId), + /// evaluateTargetHealth: false, + /// }], + /// }); + /// ``` + /// ```python + /// import pulumi + /// import pulumi_aws as aws + /// + /// example_domain_name = aws.apigatewayv2.DomainName("exampleDomainName", + /// domain_name="http-api.example.com", + /// domain_name_configuration=aws.apigatewayv2.DomainNameDomainNameConfigurationArgs( + /// certificate_arn=aws_acm_certificate["example"]["arn"], + /// endpoint_type="REGIONAL", + /// security_policy="TLS_1_2", + /// )) + /// example_record = aws.route53.Record("exampleRecord", + /// name=example_domain_name.domain_name, + /// type="A", + /// zone_id=aws_route53_zone["example"]["zone_id"], + /// aliases=[aws.route53.RecordAliasArgs( + /// name=example_domain_name.domain_name_configuration.target_domain_name, + /// zone_id=example_domain_name.domain_name_configuration.hosted_zone_id, + /// evaluate_target_health=False, + /// )]) + /// ``` + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Aws = Pulumi.Aws; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var exampleDomainName = new Aws.ApiGatewayV2.DomainName("exampleDomainName", new() + /// { + /// Domain = "http-api.example.com", + /// DomainNameConfiguration = new Aws.ApiGatewayV2.Inputs.DomainNameDomainNameConfigurationArgs + /// { + /// CertificateArn = aws_acm_certificate.Example.Arn, + /// EndpointType = "REGIONAL", + /// SecurityPolicy = "TLS_1_2", + /// }, + /// }); + /// + /// var exampleRecord = new Aws.Route53.Record("exampleRecord", new() + /// { + /// Name = exampleDomainName.Domain, + /// Type = "A", + /// ZoneId = aws_route53_zone.Example.Zone_id, + /// Aliases = new[] + /// { + /// new Aws.Route53.Inputs.RecordAliasArgs + /// { + /// Name = exampleDomainName.DomainNameConfiguration.Apply(domainNameConfiguration => domainNameConfiguration.TargetDomainName), + /// ZoneId = exampleDomainName.DomainNameConfiguration.Apply(domainNameConfiguration => domainNameConfiguration.HostedZoneId), + /// EvaluateTargetHealth = false, + /// }, + /// }, + /// }); + /// + /// }); + /// ``` + /// ```go + /// package main + /// + /// import ( + /// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + /// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53" + /// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + /// ) + /// + /// func main() { + /// pulumi.Run(func(ctx *pulumi.Context) error { + /// exampleDomainName, err := apigatewayv2.NewDomainName(ctx, "exampleDomainName", &apigatewayv2.DomainNameArgs{ + /// DomainName: pulumi.String("http-api.example.com"), + /// DomainNameConfiguration: &apigatewayv2.DomainNameDomainNameConfigurationArgs{ + /// CertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn), + /// EndpointType: pulumi.String("REGIONAL"), + /// SecurityPolicy: pulumi.String("TLS_1_2"), + /// }, + /// }) + /// if err != nil { + /// return err + /// } + /// _, err = route53.NewRecord(ctx, "exampleRecord", &route53.RecordArgs{ + /// Name: exampleDomainName.DomainName, + /// Type: pulumi.String("A"), + /// ZoneId: pulumi.Any(aws_route53_zone.Example.Zone_id), + /// Aliases: route53.RecordAliasArray{ + /// &route53.RecordAliasArgs{ + /// Name: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) { + /// return &domainNameConfiguration.TargetDomainName, nil + /// }).(pulumi.StringPtrOutput), + /// ZoneId: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) { + /// return &domainNameConfiguration.HostedZoneId, nil + /// }).(pulumi.StringPtrOutput), + /// EvaluateTargetHealth: pulumi.Bool(false), + /// }, + /// }, + /// }) + /// if err != nil { + /// return err + /// } + /// return nil + /// }) + /// } + /// ``` + /// ```java + /// package generated_program; + /// + /// import com.pulumi.Context; + /// import com.pulumi.Pulumi; + /// import com.pulumi.core.Output; + /// import com.pulumi.aws.apigatewayv2.DomainName; + /// import com.pulumi.aws.apigatewayv2.DomainNameArgs; + /// import com.pulumi.aws.apigatewayv2.inputs.DomainNameDomainNameConfigurationArgs; + /// import com.pulumi.aws.route53.Record; + /// import com.pulumi.aws.route53.RecordArgs; + /// import com.pulumi.aws.route53.inputs.RecordAliasArgs; + /// import java.util.List; + /// import java.util.ArrayList; + /// import java.util.Map; + /// import java.io.File; + /// import java.nio.file.Files; + /// import java.nio.file.Paths; + /// + /// public class App { + /// public static void main(String[] args) { + /// Pulumi.run(App::stack); + /// } + /// + /// public static void stack(Context ctx) { + /// var exampleDomainName = new DomainName("exampleDomainName", DomainNameArgs.builder() + /// .domainName("http-api.example.com") + /// .domainNameConfiguration(DomainNameDomainNameConfigurationArgs.builder() + /// .certificateArn(aws_acm_certificate.example().arn()) + /// .endpointType("REGIONAL") + /// .securityPolicy("TLS_1_2") + /// .build()) + /// .build()); + /// + /// var exampleRecord = new Record("exampleRecord", RecordArgs.builder() + /// .name(exampleDomainName.domainName()) + /// .type("A") + /// .zoneId(aws_route53_zone.example().zone_id()) + /// .aliases(RecordAliasArgs.builder() + /// .name(exampleDomainName.domainNameConfiguration().applyValue(domainNameConfiguration -> domainNameConfiguration.targetDomainName())) + /// .zoneId(exampleDomainName.domainNameConfiguration().applyValue(domainNameConfiguration -> domainNameConfiguration.hostedZoneId())) + /// .evaluateTargetHealth(false) + /// .build()) + /// .build()); + /// + /// } + /// } + /// ``` + /// ```yaml + /// resources: + /// exampleDomainName: + /// type: aws:apigatewayv2:DomainName + /// properties: + /// domainName: http-api.example.com + /// domainNameConfiguration: + /// certificateArn: ${aws_acm_certificate.example.arn} + /// endpointType: REGIONAL + /// securityPolicy: TLS_1_2 + /// exampleRecord: + /// type: aws:route53:Record + /// properties: + /// name: ${exampleDomainName.domainName} + /// type: A + /// zoneId: ${aws_route53_zone.example.zone_id} + /// aliases: + /// - name: ${exampleDomainName.domainNameConfiguration.targetDomainName} + /// zoneId: ${exampleDomainName.domainNameConfiguration.hostedZoneId} + /// evaluateTargetHealth: false + /// ``` + /// {{% /example %}} + /// {{% /examples %}} + /// + /// ## Import + /// + /// Using `pulumi import`, import `aws_apigatewayv2_domain_name` using the domain name. For example: + /// + /// ```sh + /// $ pulumi import aws:apigatewayv2/domainName:DomainName example ws-api.example.com + /// ``` + /// + /// + public sealed class DomainConfigurationArgs : global::Pulumi.ResourceArgs + { + /// + /// Domain name configuration. See below. + /// + [Input("domainNameConfiguration")] + public Input? DomainNameConfiguration { get; set; } + + /// + /// Mutual TLS authentication configuration for the domain name. + /// + [Input("mutualTlsAuthentication")] + public Input? MutualTlsAuthentication { get; set; } + + [Input("tags")] + private InputMap? _tags; + + /// + /// Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + /// + public InputMap Tags + { + get => _tags ?? (_tags = new InputMap()); + set => _tags = value; + } + + public DomainConfigurationArgs() + { + } + public static new DomainConfigurationArgs Empty => new DomainConfigurationArgs(); + } +} diff --git a/sdk/dotnet/Apigatewayv2/Inputs/DomainMappingArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/DomainMappingArgs.cs new file mode 100644 index 000000000..5bea78cd1 --- /dev/null +++ b/sdk/dotnet/Apigatewayv2/Inputs/DomainMappingArgs.cs @@ -0,0 +1,32 @@ +// *** WARNING: this file was generated by pulumi-gen-awsx. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading.Tasks; +using Pulumi.Serialization; + +namespace Pulumi.Awsx.Apigatewayv2.Inputs +{ + + public sealed class DomainMappingArgs : global::Pulumi.ResourceArgs + { + /// + /// Configuration of the domain name to create. Cannot be specified together with `domainId`. + /// + [Input("domainConfiguration")] + public Input? DomainConfiguration { get; set; } + + /// + /// Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + /// + [Input("domainId")] + public Input? DomainId { get; set; } + + public DomainMappingArgs() + { + } + public static new DomainMappingArgs Empty => new DomainMappingArgs(); + } +} diff --git a/sdk/dotnet/Apigatewayv2/Inputs/HttpAuthorizerArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/HttpAuthorizerArgs.cs new file mode 100644 index 000000000..4321e4eff --- /dev/null +++ b/sdk/dotnet/Apigatewayv2/Inputs/HttpAuthorizerArgs.cs @@ -0,0 +1,20 @@ +// *** WARNING: this file was generated by pulumi-gen-awsx. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading.Tasks; +using Pulumi.Serialization; + +namespace Pulumi.Awsx.Apigatewayv2.Inputs +{ + + public sealed class HttpAuthorizerArgs : global::Pulumi.ResourceArgs + { + public HttpAuthorizerArgs() + { + } + public static new HttpAuthorizerArgs Empty => new HttpAuthorizerArgs(); + } +} diff --git a/sdk/dotnet/Apigatewayv2/Inputs/HttpIntegrationArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/HttpIntegrationArgs.cs new file mode 100644 index 000000000..6d380100a --- /dev/null +++ b/sdk/dotnet/Apigatewayv2/Inputs/HttpIntegrationArgs.cs @@ -0,0 +1,20 @@ +// *** WARNING: this file was generated by pulumi-gen-awsx. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading.Tasks; +using Pulumi.Serialization; + +namespace Pulumi.Awsx.Apigatewayv2.Inputs +{ + + public sealed class HttpIntegrationArgs : global::Pulumi.ResourceArgs + { + public HttpIntegrationArgs() + { + } + public static new HttpIntegrationArgs Empty => new HttpIntegrationArgs(); + } +} diff --git a/sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs new file mode 100644 index 000000000..ccb2387fd --- /dev/null +++ b/sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs @@ -0,0 +1,32 @@ +// *** WARNING: this file was generated by pulumi-gen-awsx. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading.Tasks; +using Pulumi.Serialization; + +namespace Pulumi.Awsx.Apigatewayv2.Inputs +{ + + public sealed class HttpRouteArgs : global::Pulumi.ResourceArgs + { + /// + /// The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + /// + [Input("authorizer")] + public Input? Authorizer { get; set; } + + /// + /// The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + /// + [Input("integration")] + public Input? Integration { get; set; } + + public HttpRouteArgs() + { + } + public static new HttpRouteArgs Empty => new HttpRouteArgs(); + } +} diff --git a/sdk/dotnet/Apigatewayv2/Inputs/HttpStageArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/HttpStageArgs.cs new file mode 100644 index 000000000..06bdee75a --- /dev/null +++ b/sdk/dotnet/Apigatewayv2/Inputs/HttpStageArgs.cs @@ -0,0 +1,20 @@ +// *** WARNING: this file was generated by pulumi-gen-awsx. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading.Tasks; +using Pulumi.Serialization; + +namespace Pulumi.Awsx.Apigatewayv2.Inputs +{ + + public sealed class HttpStageArgs : global::Pulumi.ResourceArgs + { + public HttpStageArgs() + { + } + public static new HttpStageArgs Empty => new HttpStageArgs(); + } +} diff --git a/sdk/dotnet/Apigatewayv2/README.md b/sdk/dotnet/Apigatewayv2/README.md new file mode 100644 index 000000000..f5452bf23 --- /dev/null +++ b/sdk/dotnet/Apigatewayv2/README.md @@ -0,0 +1 @@ +Pulumi Amazon Web Services (AWS) AWSX Components. diff --git a/sdk/go/awsx/apigatewayv2/httpApi.go b/sdk/go/awsx/apigatewayv2/httpApi.go new file mode 100644 index 000000000..3dd7118ef --- /dev/null +++ b/sdk/go/awsx/apigatewayv2/httpApi.go @@ -0,0 +1,368 @@ +// Code generated by pulumi-gen-awsx DO NOT EDIT. +// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** + +package apigatewayv2 + +import ( + "context" + "reflect" + + "errors" + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi-awsx/sdk/v2/go/awsx/internal" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + "github.com/pulumi/pulumi/sdk/v3/go/pulumix" +) + +// Creates an HTTP API with associated sub-resources. +type HttpApi struct { + pulumi.CustomResourceState + + // The underlying API resource. + Api apigatewayv2.ApiOutput `pulumi:"api"` + // The API mappings for the HTTP API. + ApiMappings apigatewayv2.ApiMappingArrayOutput `pulumi:"apiMappings"` + // The authorizers for the HTTP API routes. + Authorizers apigatewayv2.AuthorizerArrayOutput `pulumi:"authorizers"` + // The deployment for the HTTP API. + Deployment apigatewayv2.DeploymentOutput `pulumi:"deployment"` + // The domain names for the HTTP API. + DomainNames apigatewayv2.DomainNameArrayOutput `pulumi:"domainNames"` + // The integrations for the HTTP API routes. This is a map from integration name to the integration arguments. + Integrations apigatewayv2.IntegrationArrayOutput `pulumi:"integrations"` + // The routes for the HTTP API. This is a map from route key (for example `GET /pets`) to route arguments. + Routes apigatewayv2.RouteArrayOutput `pulumi:"routes"` + // The deployment stages for the HTTP API. + Stages apigatewayv2.StageArrayOutput `pulumi:"stages"` +} + +// NewHttpApi registers a new resource with the given unique name, arguments, and options. +func NewHttpApi(ctx *pulumi.Context, + name string, args *HttpApiArgs, opts ...pulumi.ResourceOption) (*HttpApi, error) { + if args == nil { + return nil, errors.New("missing one or more required arguments") + } + + if args.Routes == nil { + return nil, errors.New("invalid value for required argument 'Routes'") + } + opts = internal.PkgResourceDefaultOpts(opts) + var resource HttpApi + err := ctx.RegisterResource("awsx:apigatewayv2:HttpApi", name, args, &resource, opts...) + if err != nil { + return nil, err + } + return &resource, nil +} + +// GetHttpApi gets an existing HttpApi resource's state with the given name, ID, and optional +// state properties that are used to uniquely qualify the lookup (nil if not required). +func GetHttpApi(ctx *pulumi.Context, + name string, id pulumi.IDInput, state *HttpApiState, opts ...pulumi.ResourceOption) (*HttpApi, error) { + var resource HttpApi + err := ctx.ReadResource("awsx:apigatewayv2:HttpApi", name, id, state, &resource, opts...) + if err != nil { + return nil, err + } + return &resource, nil +} + +// Input properties used for looking up and filtering HttpApi resources. +type httpApiState struct { +} + +type HttpApiState struct { +} + +func (HttpApiState) ElementType() reflect.Type { + return reflect.TypeOf((*httpApiState)(nil)).Elem() +} + +type httpApiArgs struct { + // An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). + // Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. + // Applicable for WebSocket APIs. + ApiKeySelectionExpression *string `pulumi:"apiKeySelectionExpression"` + // The authorizers for the HTTP API routes. + Authorizers map[string]HttpAuthorizer `pulumi:"authorizers"` + // An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. + Body *string `pulumi:"body"` + // Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. + CorsConfiguration *apigatewayv2.ApiCorsConfiguration `pulumi:"corsConfiguration"` + // Description of the API. Must be less than or equal to 1024 characters in length. + Description *string `pulumi:"description"` + // Whether clients can invoke the API by using the default `execute-api` endpoint. + // By default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`. + // To require that clients use a custom domain name to invoke the API, disable the default endpoint. + DisableExecuteApiEndpoint *bool `pulumi:"disableExecuteApiEndpoint"` + // The domain names for the HTTP API. + DomainMappings map[string]DomainMapping `pulumi:"domainMappings"` + // Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. + FailOnWarnings *bool `pulumi:"failOnWarnings"` + // The integrations for the HTTP API routes. + Integrations map[string]HttpIntegration `pulumi:"integrations"` + // Name of the API. Must be less than or equal to 128 characters in length. + Name *string `pulumi:"name"` + // The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. + // Defaults to `$request.method $request.path`. + RouteSelectionExpression *string `pulumi:"routeSelectionExpression"` + // The routes for the HTTP API. + Routes map[string]HttpRoute `pulumi:"routes"` + // The deployment stages for the HTTP API. + Stages map[string]HttpStage `pulumi:"stages"` + // Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + Tags map[string]string `pulumi:"tags"` + // Version identifier for the API. Must be between 1 and 64 characters in length. + Version *string `pulumi:"version"` +} + +// The set of arguments for constructing a HttpApi resource. +type HttpApiArgs struct { + // An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). + // Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. + // Applicable for WebSocket APIs. + ApiKeySelectionExpression pulumi.StringPtrInput + // The authorizers for the HTTP API routes. + Authorizers HttpAuthorizerMapInput + // An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. + Body pulumi.StringPtrInput + // Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. + CorsConfiguration apigatewayv2.ApiCorsConfigurationPtrInput + // Description of the API. Must be less than or equal to 1024 characters in length. + Description pulumi.StringPtrInput + // Whether clients can invoke the API by using the default `execute-api` endpoint. + // By default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`. + // To require that clients use a custom domain name to invoke the API, disable the default endpoint. + DisableExecuteApiEndpoint pulumi.BoolPtrInput + // The domain names for the HTTP API. + DomainMappings DomainMappingMapInput + // Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. + FailOnWarnings pulumi.BoolPtrInput + // The integrations for the HTTP API routes. + Integrations HttpIntegrationMapInput + // Name of the API. Must be less than or equal to 128 characters in length. + Name pulumi.StringPtrInput + // The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. + // Defaults to `$request.method $request.path`. + RouteSelectionExpression pulumi.StringPtrInput + // The routes for the HTTP API. + Routes HttpRouteMapInput + // The deployment stages for the HTTP API. + Stages HttpStageMapInput + // Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + Tags pulumi.StringMapInput + // Version identifier for the API. Must be between 1 and 64 characters in length. + Version pulumi.StringPtrInput +} + +func (HttpApiArgs) ElementType() reflect.Type { + return reflect.TypeOf((*httpApiArgs)(nil)).Elem() +} + +type HttpApiInput interface { + pulumi.Input + + ToHttpApiOutput() HttpApiOutput + ToHttpApiOutputWithContext(ctx context.Context) HttpApiOutput +} + +func (*HttpApi) ElementType() reflect.Type { + return reflect.TypeOf((**HttpApi)(nil)).Elem() +} + +func (i *HttpApi) ToHttpApiOutput() HttpApiOutput { + return i.ToHttpApiOutputWithContext(context.Background()) +} + +func (i *HttpApi) ToHttpApiOutputWithContext(ctx context.Context) HttpApiOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpApiOutput) +} + +func (i *HttpApi) ToOutput(ctx context.Context) pulumix.Output[*HttpApi] { + return pulumix.Output[*HttpApi]{ + OutputState: i.ToHttpApiOutputWithContext(ctx).OutputState, + } +} + +// HttpApiArrayInput is an input type that accepts HttpApiArray and HttpApiArrayOutput values. +// You can construct a concrete instance of `HttpApiArrayInput` via: +// +// HttpApiArray{ HttpApiArgs{...} } +type HttpApiArrayInput interface { + pulumi.Input + + ToHttpApiArrayOutput() HttpApiArrayOutput + ToHttpApiArrayOutputWithContext(context.Context) HttpApiArrayOutput +} + +type HttpApiArray []HttpApiInput + +func (HttpApiArray) ElementType() reflect.Type { + return reflect.TypeOf((*[]*HttpApi)(nil)).Elem() +} + +func (i HttpApiArray) ToHttpApiArrayOutput() HttpApiArrayOutput { + return i.ToHttpApiArrayOutputWithContext(context.Background()) +} + +func (i HttpApiArray) ToHttpApiArrayOutputWithContext(ctx context.Context) HttpApiArrayOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpApiArrayOutput) +} + +func (i HttpApiArray) ToOutput(ctx context.Context) pulumix.Output[[]*HttpApi] { + return pulumix.Output[[]*HttpApi]{ + OutputState: i.ToHttpApiArrayOutputWithContext(ctx).OutputState, + } +} + +// HttpApiMapInput is an input type that accepts HttpApiMap and HttpApiMapOutput values. +// You can construct a concrete instance of `HttpApiMapInput` via: +// +// HttpApiMap{ "key": HttpApiArgs{...} } +type HttpApiMapInput interface { + pulumi.Input + + ToHttpApiMapOutput() HttpApiMapOutput + ToHttpApiMapOutputWithContext(context.Context) HttpApiMapOutput +} + +type HttpApiMap map[string]HttpApiInput + +func (HttpApiMap) ElementType() reflect.Type { + return reflect.TypeOf((*map[string]*HttpApi)(nil)).Elem() +} + +func (i HttpApiMap) ToHttpApiMapOutput() HttpApiMapOutput { + return i.ToHttpApiMapOutputWithContext(context.Background()) +} + +func (i HttpApiMap) ToHttpApiMapOutputWithContext(ctx context.Context) HttpApiMapOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpApiMapOutput) +} + +func (i HttpApiMap) ToOutput(ctx context.Context) pulumix.Output[map[string]*HttpApi] { + return pulumix.Output[map[string]*HttpApi]{ + OutputState: i.ToHttpApiMapOutputWithContext(ctx).OutputState, + } +} + +type HttpApiOutput struct{ *pulumi.OutputState } + +func (HttpApiOutput) ElementType() reflect.Type { + return reflect.TypeOf((**HttpApi)(nil)).Elem() +} + +func (o HttpApiOutput) ToHttpApiOutput() HttpApiOutput { + return o +} + +func (o HttpApiOutput) ToHttpApiOutputWithContext(ctx context.Context) HttpApiOutput { + return o +} + +func (o HttpApiOutput) ToOutput(ctx context.Context) pulumix.Output[*HttpApi] { + return pulumix.Output[*HttpApi]{ + OutputState: o.OutputState, + } +} + +// The underlying API resource. +func (o HttpApiOutput) Api() apigatewayv2.ApiOutput { + return o.ApplyT(func(v *HttpApi) apigatewayv2.ApiOutput { return v.Api }).(apigatewayv2.ApiOutput) +} + +// The API mappings for the HTTP API. +func (o HttpApiOutput) ApiMappings() apigatewayv2.ApiMappingArrayOutput { + return o.ApplyT(func(v *HttpApi) apigatewayv2.ApiMappingArrayOutput { return v.ApiMappings }).(apigatewayv2.ApiMappingArrayOutput) +} + +// The authorizers for the HTTP API routes. +func (o HttpApiOutput) Authorizers() apigatewayv2.AuthorizerArrayOutput { + return o.ApplyT(func(v *HttpApi) apigatewayv2.AuthorizerArrayOutput { return v.Authorizers }).(apigatewayv2.AuthorizerArrayOutput) +} + +// The deployment for the HTTP API. +func (o HttpApiOutput) Deployment() apigatewayv2.DeploymentOutput { + return o.ApplyT(func(v *HttpApi) apigatewayv2.DeploymentOutput { return v.Deployment }).(apigatewayv2.DeploymentOutput) +} + +// The domain names for the HTTP API. +func (o HttpApiOutput) DomainNames() apigatewayv2.DomainNameArrayOutput { + return o.ApplyT(func(v *HttpApi) apigatewayv2.DomainNameArrayOutput { return v.DomainNames }).(apigatewayv2.DomainNameArrayOutput) +} + +// The integrations for the HTTP API routes. This is a map from integration name to the integration arguments. +func (o HttpApiOutput) Integrations() apigatewayv2.IntegrationArrayOutput { + return o.ApplyT(func(v *HttpApi) apigatewayv2.IntegrationArrayOutput { return v.Integrations }).(apigatewayv2.IntegrationArrayOutput) +} + +// The routes for the HTTP API. This is a map from route key (for example `GET /pets`) to route arguments. +func (o HttpApiOutput) Routes() apigatewayv2.RouteArrayOutput { + return o.ApplyT(func(v *HttpApi) apigatewayv2.RouteArrayOutput { return v.Routes }).(apigatewayv2.RouteArrayOutput) +} + +// The deployment stages for the HTTP API. +func (o HttpApiOutput) Stages() apigatewayv2.StageArrayOutput { + return o.ApplyT(func(v *HttpApi) apigatewayv2.StageArrayOutput { return v.Stages }).(apigatewayv2.StageArrayOutput) +} + +type HttpApiArrayOutput struct{ *pulumi.OutputState } + +func (HttpApiArrayOutput) ElementType() reflect.Type { + return reflect.TypeOf((*[]*HttpApi)(nil)).Elem() +} + +func (o HttpApiArrayOutput) ToHttpApiArrayOutput() HttpApiArrayOutput { + return o +} + +func (o HttpApiArrayOutput) ToHttpApiArrayOutputWithContext(ctx context.Context) HttpApiArrayOutput { + return o +} + +func (o HttpApiArrayOutput) ToOutput(ctx context.Context) pulumix.Output[[]*HttpApi] { + return pulumix.Output[[]*HttpApi]{ + OutputState: o.OutputState, + } +} + +func (o HttpApiArrayOutput) Index(i pulumi.IntInput) HttpApiOutput { + return pulumi.All(o, i).ApplyT(func(vs []interface{}) *HttpApi { + return vs[0].([]*HttpApi)[vs[1].(int)] + }).(HttpApiOutput) +} + +type HttpApiMapOutput struct{ *pulumi.OutputState } + +func (HttpApiMapOutput) ElementType() reflect.Type { + return reflect.TypeOf((*map[string]*HttpApi)(nil)).Elem() +} + +func (o HttpApiMapOutput) ToHttpApiMapOutput() HttpApiMapOutput { + return o +} + +func (o HttpApiMapOutput) ToHttpApiMapOutputWithContext(ctx context.Context) HttpApiMapOutput { + return o +} + +func (o HttpApiMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]*HttpApi] { + return pulumix.Output[map[string]*HttpApi]{ + OutputState: o.OutputState, + } +} + +func (o HttpApiMapOutput) MapIndex(k pulumi.StringInput) HttpApiOutput { + return pulumi.All(o, k).ApplyT(func(vs []interface{}) *HttpApi { + return vs[0].(map[string]*HttpApi)[vs[1].(string)] + }).(HttpApiOutput) +} + +func init() { + pulumi.RegisterInputType(reflect.TypeOf((*HttpApiInput)(nil)).Elem(), &HttpApi{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpApiArrayInput)(nil)).Elem(), HttpApiArray{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpApiMapInput)(nil)).Elem(), HttpApiMap{}) + pulumi.RegisterOutputType(HttpApiOutput{}) + pulumi.RegisterOutputType(HttpApiArrayOutput{}) + pulumi.RegisterOutputType(HttpApiMapOutput{}) +} diff --git a/sdk/go/awsx/apigatewayv2/init.go b/sdk/go/awsx/apigatewayv2/init.go new file mode 100644 index 000000000..15821c33d --- /dev/null +++ b/sdk/go/awsx/apigatewayv2/init.go @@ -0,0 +1,45 @@ +// Code generated by pulumi-gen-awsx DO NOT EDIT. +// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** + +package apigatewayv2 + +import ( + "fmt" + + "github.com/blang/semver" + "github.com/pulumi/pulumi-awsx/sdk/v2/go/awsx/internal" + _ "github.com/pulumi/pulumi-docker/sdk/v4/go/docker" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +) + +type module struct { + version semver.Version +} + +func (m *module) Version() semver.Version { + return m.version +} + +func (m *module) Construct(ctx *pulumi.Context, name, typ, urn string) (r pulumi.Resource, err error) { + switch typ { + case "awsx:apigatewayv2:HttpApi": + r = &HttpApi{} + default: + return nil, fmt.Errorf("unknown resource type: %s", typ) + } + + err = ctx.RegisterResource(typ, name, nil, r, pulumi.URN_(urn)) + return +} + +func init() { + version, err := internal.PkgVersion() + if err != nil { + version = semver.Version{Major: 1} + } + pulumi.RegisterResourceModule( + "awsx", + "apigatewayv2", + &module{version}, + ) +} diff --git a/sdk/go/awsx/apigatewayv2/pulumiTypes.go b/sdk/go/awsx/apigatewayv2/pulumiTypes.go new file mode 100644 index 000000000..835910dad --- /dev/null +++ b/sdk/go/awsx/apigatewayv2/pulumiTypes.go @@ -0,0 +1,1127 @@ +// Code generated by pulumi-gen-awsx DO NOT EDIT. +// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** + +package apigatewayv2 + +import ( + "context" + "reflect" + + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi-awsx/sdk/v2/go/awsx/internal" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + "github.com/pulumi/pulumi/sdk/v3/go/pulumix" +) + +var _ = internal.GetEnvOrDefault + +// Manages an Amazon API Gateway Version 2 domain name. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). +// +// > **Note:** This resource establishes ownership of and the TLS settings for +// a particular domain name. An API stage can be associated with the domain name using the `aws.apigatewayv2.ApiMapping` resource. +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewDomainName(ctx, "example", &apigatewayv2.DomainNameArgs{ +// DomainName: pulumi.String("ws-api.example.com"), +// DomainNameConfiguration: &apigatewayv2.DomainNameDomainNameConfigurationArgs{ +// CertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn), +// EndpointType: pulumi.String("REGIONAL"), +// SecurityPolicy: pulumi.String("TLS_1_2"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Associated Route 53 Resource Record +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// exampleDomainName, err := apigatewayv2.NewDomainName(ctx, "exampleDomainName", &apigatewayv2.DomainNameArgs{ +// DomainName: pulumi.String("http-api.example.com"), +// DomainNameConfiguration: &apigatewayv2.DomainNameDomainNameConfigurationArgs{ +// CertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn), +// EndpointType: pulumi.String("REGIONAL"), +// SecurityPolicy: pulumi.String("TLS_1_2"), +// }, +// }) +// if err != nil { +// return err +// } +// _, err = route53.NewRecord(ctx, "exampleRecord", &route53.RecordArgs{ +// Name: exampleDomainName.DomainName, +// Type: pulumi.String("A"), +// ZoneId: pulumi.Any(aws_route53_zone.Example.Zone_id), +// Aliases: route53.RecordAliasArray{ +// &route53.RecordAliasArgs{ +// Name: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) { +// return &domainNameConfiguration.TargetDomainName, nil +// }).(pulumi.StringPtrOutput), +// ZoneId: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) { +// return &domainNameConfiguration.HostedZoneId, nil +// }).(pulumi.StringPtrOutput), +// EvaluateTargetHealth: pulumi.Bool(false), +// }, +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_domain_name` using the domain name. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/domainName:DomainName example ws-api.example.com +// +// ``` +type DomainConfiguration struct { + // Domain name configuration. See below. + DomainNameConfiguration *apigatewayv2.DomainNameDomainNameConfiguration `pulumi:"domainNameConfiguration"` + // Mutual TLS authentication configuration for the domain name. + MutualTlsAuthentication *apigatewayv2.DomainNameMutualTlsAuthentication `pulumi:"mutualTlsAuthentication"` + // Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + Tags map[string]string `pulumi:"tags"` +} + +// DomainConfigurationInput is an input type that accepts DomainConfigurationArgs and DomainConfigurationOutput values. +// You can construct a concrete instance of `DomainConfigurationInput` via: +// +// DomainConfigurationArgs{...} +type DomainConfigurationInput interface { + pulumi.Input + + ToDomainConfigurationOutput() DomainConfigurationOutput + ToDomainConfigurationOutputWithContext(context.Context) DomainConfigurationOutput +} + +// Manages an Amazon API Gateway Version 2 domain name. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). +// +// > **Note:** This resource establishes ownership of and the TLS settings for +// a particular domain name. An API stage can be associated with the domain name using the `aws.apigatewayv2.ApiMapping` resource. +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewDomainName(ctx, "example", &apigatewayv2.DomainNameArgs{ +// DomainName: pulumi.String("ws-api.example.com"), +// DomainNameConfiguration: &apigatewayv2.DomainNameDomainNameConfigurationArgs{ +// CertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn), +// EndpointType: pulumi.String("REGIONAL"), +// SecurityPolicy: pulumi.String("TLS_1_2"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Associated Route 53 Resource Record +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// exampleDomainName, err := apigatewayv2.NewDomainName(ctx, "exampleDomainName", &apigatewayv2.DomainNameArgs{ +// DomainName: pulumi.String("http-api.example.com"), +// DomainNameConfiguration: &apigatewayv2.DomainNameDomainNameConfigurationArgs{ +// CertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn), +// EndpointType: pulumi.String("REGIONAL"), +// SecurityPolicy: pulumi.String("TLS_1_2"), +// }, +// }) +// if err != nil { +// return err +// } +// _, err = route53.NewRecord(ctx, "exampleRecord", &route53.RecordArgs{ +// Name: exampleDomainName.DomainName, +// Type: pulumi.String("A"), +// ZoneId: pulumi.Any(aws_route53_zone.Example.Zone_id), +// Aliases: route53.RecordAliasArray{ +// &route53.RecordAliasArgs{ +// Name: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) { +// return &domainNameConfiguration.TargetDomainName, nil +// }).(pulumi.StringPtrOutput), +// ZoneId: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) { +// return &domainNameConfiguration.HostedZoneId, nil +// }).(pulumi.StringPtrOutput), +// EvaluateTargetHealth: pulumi.Bool(false), +// }, +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_domain_name` using the domain name. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/domainName:DomainName example ws-api.example.com +// +// ``` +type DomainConfigurationArgs struct { + // Domain name configuration. See below. + DomainNameConfiguration apigatewayv2.DomainNameDomainNameConfigurationPtrInput `pulumi:"domainNameConfiguration"` + // Mutual TLS authentication configuration for the domain name. + MutualTlsAuthentication apigatewayv2.DomainNameMutualTlsAuthenticationPtrInput `pulumi:"mutualTlsAuthentication"` + // Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + Tags pulumi.StringMapInput `pulumi:"tags"` +} + +func (DomainConfigurationArgs) ElementType() reflect.Type { + return reflect.TypeOf((*DomainConfiguration)(nil)).Elem() +} + +func (i DomainConfigurationArgs) ToDomainConfigurationOutput() DomainConfigurationOutput { + return i.ToDomainConfigurationOutputWithContext(context.Background()) +} + +func (i DomainConfigurationArgs) ToDomainConfigurationOutputWithContext(ctx context.Context) DomainConfigurationOutput { + return pulumi.ToOutputWithContext(ctx, i).(DomainConfigurationOutput) +} + +func (i DomainConfigurationArgs) ToOutput(ctx context.Context) pulumix.Output[DomainConfiguration] { + return pulumix.Output[DomainConfiguration]{ + OutputState: i.ToDomainConfigurationOutputWithContext(ctx).OutputState, + } +} + +func (i DomainConfigurationArgs) ToDomainConfigurationPtrOutput() DomainConfigurationPtrOutput { + return i.ToDomainConfigurationPtrOutputWithContext(context.Background()) +} + +func (i DomainConfigurationArgs) ToDomainConfigurationPtrOutputWithContext(ctx context.Context) DomainConfigurationPtrOutput { + return pulumi.ToOutputWithContext(ctx, i).(DomainConfigurationOutput).ToDomainConfigurationPtrOutputWithContext(ctx) +} + +// DomainConfigurationPtrInput is an input type that accepts DomainConfigurationArgs, DomainConfigurationPtr and DomainConfigurationPtrOutput values. +// You can construct a concrete instance of `DomainConfigurationPtrInput` via: +// +// DomainConfigurationArgs{...} +// +// or: +// +// nil +type DomainConfigurationPtrInput interface { + pulumi.Input + + ToDomainConfigurationPtrOutput() DomainConfigurationPtrOutput + ToDomainConfigurationPtrOutputWithContext(context.Context) DomainConfigurationPtrOutput +} + +type domainConfigurationPtrType DomainConfigurationArgs + +func DomainConfigurationPtr(v *DomainConfigurationArgs) DomainConfigurationPtrInput { + return (*domainConfigurationPtrType)(v) +} + +func (*domainConfigurationPtrType) ElementType() reflect.Type { + return reflect.TypeOf((**DomainConfiguration)(nil)).Elem() +} + +func (i *domainConfigurationPtrType) ToDomainConfigurationPtrOutput() DomainConfigurationPtrOutput { + return i.ToDomainConfigurationPtrOutputWithContext(context.Background()) +} + +func (i *domainConfigurationPtrType) ToDomainConfigurationPtrOutputWithContext(ctx context.Context) DomainConfigurationPtrOutput { + return pulumi.ToOutputWithContext(ctx, i).(DomainConfigurationPtrOutput) +} + +func (i *domainConfigurationPtrType) ToOutput(ctx context.Context) pulumix.Output[*DomainConfiguration] { + return pulumix.Output[*DomainConfiguration]{ + OutputState: i.ToDomainConfigurationPtrOutputWithContext(ctx).OutputState, + } +} + +// Manages an Amazon API Gateway Version 2 domain name. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). +// +// > **Note:** This resource establishes ownership of and the TLS settings for +// a particular domain name. An API stage can be associated with the domain name using the `aws.apigatewayv2.ApiMapping` resource. +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewDomainName(ctx, "example", &apigatewayv2.DomainNameArgs{ +// DomainName: pulumi.String("ws-api.example.com"), +// DomainNameConfiguration: &apigatewayv2.DomainNameDomainNameConfigurationArgs{ +// CertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn), +// EndpointType: pulumi.String("REGIONAL"), +// SecurityPolicy: pulumi.String("TLS_1_2"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Associated Route 53 Resource Record +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// exampleDomainName, err := apigatewayv2.NewDomainName(ctx, "exampleDomainName", &apigatewayv2.DomainNameArgs{ +// DomainName: pulumi.String("http-api.example.com"), +// DomainNameConfiguration: &apigatewayv2.DomainNameDomainNameConfigurationArgs{ +// CertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn), +// EndpointType: pulumi.String("REGIONAL"), +// SecurityPolicy: pulumi.String("TLS_1_2"), +// }, +// }) +// if err != nil { +// return err +// } +// _, err = route53.NewRecord(ctx, "exampleRecord", &route53.RecordArgs{ +// Name: exampleDomainName.DomainName, +// Type: pulumi.String("A"), +// ZoneId: pulumi.Any(aws_route53_zone.Example.Zone_id), +// Aliases: route53.RecordAliasArray{ +// &route53.RecordAliasArgs{ +// Name: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) { +// return &domainNameConfiguration.TargetDomainName, nil +// }).(pulumi.StringPtrOutput), +// ZoneId: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) { +// return &domainNameConfiguration.HostedZoneId, nil +// }).(pulumi.StringPtrOutput), +// EvaluateTargetHealth: pulumi.Bool(false), +// }, +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_domain_name` using the domain name. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/domainName:DomainName example ws-api.example.com +// +// ``` +type DomainConfigurationOutput struct{ *pulumi.OutputState } + +func (DomainConfigurationOutput) ElementType() reflect.Type { + return reflect.TypeOf((*DomainConfiguration)(nil)).Elem() +} + +func (o DomainConfigurationOutput) ToDomainConfigurationOutput() DomainConfigurationOutput { + return o +} + +func (o DomainConfigurationOutput) ToDomainConfigurationOutputWithContext(ctx context.Context) DomainConfigurationOutput { + return o +} + +func (o DomainConfigurationOutput) ToDomainConfigurationPtrOutput() DomainConfigurationPtrOutput { + return o.ToDomainConfigurationPtrOutputWithContext(context.Background()) +} + +func (o DomainConfigurationOutput) ToDomainConfigurationPtrOutputWithContext(ctx context.Context) DomainConfigurationPtrOutput { + return o.ApplyTWithContext(ctx, func(_ context.Context, v DomainConfiguration) *DomainConfiguration { + return &v + }).(DomainConfigurationPtrOutput) +} + +func (o DomainConfigurationOutput) ToOutput(ctx context.Context) pulumix.Output[DomainConfiguration] { + return pulumix.Output[DomainConfiguration]{ + OutputState: o.OutputState, + } +} + +// Domain name configuration. See below. +func (o DomainConfigurationOutput) DomainNameConfiguration() apigatewayv2.DomainNameDomainNameConfigurationPtrOutput { + return o.ApplyT(func(v DomainConfiguration) *apigatewayv2.DomainNameDomainNameConfiguration { + return v.DomainNameConfiguration + }).(apigatewayv2.DomainNameDomainNameConfigurationPtrOutput) +} + +// Mutual TLS authentication configuration for the domain name. +func (o DomainConfigurationOutput) MutualTlsAuthentication() apigatewayv2.DomainNameMutualTlsAuthenticationPtrOutput { + return o.ApplyT(func(v DomainConfiguration) *apigatewayv2.DomainNameMutualTlsAuthentication { + return v.MutualTlsAuthentication + }).(apigatewayv2.DomainNameMutualTlsAuthenticationPtrOutput) +} + +// Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. +func (o DomainConfigurationOutput) Tags() pulumi.StringMapOutput { + return o.ApplyT(func(v DomainConfiguration) map[string]string { return v.Tags }).(pulumi.StringMapOutput) +} + +type DomainConfigurationPtrOutput struct{ *pulumi.OutputState } + +func (DomainConfigurationPtrOutput) ElementType() reflect.Type { + return reflect.TypeOf((**DomainConfiguration)(nil)).Elem() +} + +func (o DomainConfigurationPtrOutput) ToDomainConfigurationPtrOutput() DomainConfigurationPtrOutput { + return o +} + +func (o DomainConfigurationPtrOutput) ToDomainConfigurationPtrOutputWithContext(ctx context.Context) DomainConfigurationPtrOutput { + return o +} + +func (o DomainConfigurationPtrOutput) ToOutput(ctx context.Context) pulumix.Output[*DomainConfiguration] { + return pulumix.Output[*DomainConfiguration]{ + OutputState: o.OutputState, + } +} + +func (o DomainConfigurationPtrOutput) Elem() DomainConfigurationOutput { + return o.ApplyT(func(v *DomainConfiguration) DomainConfiguration { + if v != nil { + return *v + } + var ret DomainConfiguration + return ret + }).(DomainConfigurationOutput) +} + +// Domain name configuration. See below. +func (o DomainConfigurationPtrOutput) DomainNameConfiguration() apigatewayv2.DomainNameDomainNameConfigurationPtrOutput { + return o.ApplyT(func(v *DomainConfiguration) *apigatewayv2.DomainNameDomainNameConfiguration { + if v == nil { + return nil + } + return v.DomainNameConfiguration + }).(apigatewayv2.DomainNameDomainNameConfigurationPtrOutput) +} + +// Mutual TLS authentication configuration for the domain name. +func (o DomainConfigurationPtrOutput) MutualTlsAuthentication() apigatewayv2.DomainNameMutualTlsAuthenticationPtrOutput { + return o.ApplyT(func(v *DomainConfiguration) *apigatewayv2.DomainNameMutualTlsAuthentication { + if v == nil { + return nil + } + return v.MutualTlsAuthentication + }).(apigatewayv2.DomainNameMutualTlsAuthenticationPtrOutput) +} + +// Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. +func (o DomainConfigurationPtrOutput) Tags() pulumi.StringMapOutput { + return o.ApplyT(func(v *DomainConfiguration) map[string]string { + if v == nil { + return nil + } + return v.Tags + }).(pulumi.StringMapOutput) +} + +type DomainMapping struct { + // Configuration of the domain name to create. Cannot be specified together with `domainId`. + DomainConfiguration *DomainConfiguration `pulumi:"domainConfiguration"` + // Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + DomainId *string `pulumi:"domainId"` +} + +// DomainMappingInput is an input type that accepts DomainMappingArgs and DomainMappingOutput values. +// You can construct a concrete instance of `DomainMappingInput` via: +// +// DomainMappingArgs{...} +type DomainMappingInput interface { + pulumi.Input + + ToDomainMappingOutput() DomainMappingOutput + ToDomainMappingOutputWithContext(context.Context) DomainMappingOutput +} + +type DomainMappingArgs struct { + // Configuration of the domain name to create. Cannot be specified together with `domainId`. + DomainConfiguration DomainConfigurationPtrInput `pulumi:"domainConfiguration"` + // Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + DomainId pulumi.StringPtrInput `pulumi:"domainId"` +} + +func (DomainMappingArgs) ElementType() reflect.Type { + return reflect.TypeOf((*DomainMapping)(nil)).Elem() +} + +func (i DomainMappingArgs) ToDomainMappingOutput() DomainMappingOutput { + return i.ToDomainMappingOutputWithContext(context.Background()) +} + +func (i DomainMappingArgs) ToDomainMappingOutputWithContext(ctx context.Context) DomainMappingOutput { + return pulumi.ToOutputWithContext(ctx, i).(DomainMappingOutput) +} + +func (i DomainMappingArgs) ToOutput(ctx context.Context) pulumix.Output[DomainMapping] { + return pulumix.Output[DomainMapping]{ + OutputState: i.ToDomainMappingOutputWithContext(ctx).OutputState, + } +} + +// DomainMappingMapInput is an input type that accepts DomainMappingMap and DomainMappingMapOutput values. +// You can construct a concrete instance of `DomainMappingMapInput` via: +// +// DomainMappingMap{ "key": DomainMappingArgs{...} } +type DomainMappingMapInput interface { + pulumi.Input + + ToDomainMappingMapOutput() DomainMappingMapOutput + ToDomainMappingMapOutputWithContext(context.Context) DomainMappingMapOutput +} + +type DomainMappingMap map[string]DomainMappingInput + +func (DomainMappingMap) ElementType() reflect.Type { + return reflect.TypeOf((*map[string]DomainMapping)(nil)).Elem() +} + +func (i DomainMappingMap) ToDomainMappingMapOutput() DomainMappingMapOutput { + return i.ToDomainMappingMapOutputWithContext(context.Background()) +} + +func (i DomainMappingMap) ToDomainMappingMapOutputWithContext(ctx context.Context) DomainMappingMapOutput { + return pulumi.ToOutputWithContext(ctx, i).(DomainMappingMapOutput) +} + +func (i DomainMappingMap) ToOutput(ctx context.Context) pulumix.Output[map[string]DomainMapping] { + return pulumix.Output[map[string]DomainMapping]{ + OutputState: i.ToDomainMappingMapOutputWithContext(ctx).OutputState, + } +} + +type DomainMappingOutput struct{ *pulumi.OutputState } + +func (DomainMappingOutput) ElementType() reflect.Type { + return reflect.TypeOf((*DomainMapping)(nil)).Elem() +} + +func (o DomainMappingOutput) ToDomainMappingOutput() DomainMappingOutput { + return o +} + +func (o DomainMappingOutput) ToDomainMappingOutputWithContext(ctx context.Context) DomainMappingOutput { + return o +} + +func (o DomainMappingOutput) ToOutput(ctx context.Context) pulumix.Output[DomainMapping] { + return pulumix.Output[DomainMapping]{ + OutputState: o.OutputState, + } +} + +// Configuration of the domain name to create. Cannot be specified together with `domainId`. +func (o DomainMappingOutput) DomainConfiguration() DomainConfigurationPtrOutput { + return o.ApplyT(func(v DomainMapping) *DomainConfiguration { return v.DomainConfiguration }).(DomainConfigurationPtrOutput) +} + +// Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. +func (o DomainMappingOutput) DomainId() pulumi.StringPtrOutput { + return o.ApplyT(func(v DomainMapping) *string { return v.DomainId }).(pulumi.StringPtrOutput) +} + +type DomainMappingMapOutput struct{ *pulumi.OutputState } + +func (DomainMappingMapOutput) ElementType() reflect.Type { + return reflect.TypeOf((*map[string]DomainMapping)(nil)).Elem() +} + +func (o DomainMappingMapOutput) ToDomainMappingMapOutput() DomainMappingMapOutput { + return o +} + +func (o DomainMappingMapOutput) ToDomainMappingMapOutputWithContext(ctx context.Context) DomainMappingMapOutput { + return o +} + +func (o DomainMappingMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]DomainMapping] { + return pulumix.Output[map[string]DomainMapping]{ + OutputState: o.OutputState, + } +} + +func (o DomainMappingMapOutput) MapIndex(k pulumi.StringInput) DomainMappingOutput { + return pulumi.All(o, k).ApplyT(func(vs []interface{}) DomainMapping { + return vs[0].(map[string]DomainMapping)[vs[1].(string)] + }).(DomainMappingOutput) +} + +type HttpAuthorizer struct { +} + +// HttpAuthorizerInput is an input type that accepts HttpAuthorizerArgs and HttpAuthorizerOutput values. +// You can construct a concrete instance of `HttpAuthorizerInput` via: +// +// HttpAuthorizerArgs{...} +type HttpAuthorizerInput interface { + pulumi.Input + + ToHttpAuthorizerOutput() HttpAuthorizerOutput + ToHttpAuthorizerOutputWithContext(context.Context) HttpAuthorizerOutput +} + +type HttpAuthorizerArgs struct { +} + +func (HttpAuthorizerArgs) ElementType() reflect.Type { + return reflect.TypeOf((*HttpAuthorizer)(nil)).Elem() +} + +func (i HttpAuthorizerArgs) ToHttpAuthorizerOutput() HttpAuthorizerOutput { + return i.ToHttpAuthorizerOutputWithContext(context.Background()) +} + +func (i HttpAuthorizerArgs) ToHttpAuthorizerOutputWithContext(ctx context.Context) HttpAuthorizerOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpAuthorizerOutput) +} + +func (i HttpAuthorizerArgs) ToOutput(ctx context.Context) pulumix.Output[HttpAuthorizer] { + return pulumix.Output[HttpAuthorizer]{ + OutputState: i.ToHttpAuthorizerOutputWithContext(ctx).OutputState, + } +} + +// HttpAuthorizerMapInput is an input type that accepts HttpAuthorizerMap and HttpAuthorizerMapOutput values. +// You can construct a concrete instance of `HttpAuthorizerMapInput` via: +// +// HttpAuthorizerMap{ "key": HttpAuthorizerArgs{...} } +type HttpAuthorizerMapInput interface { + pulumi.Input + + ToHttpAuthorizerMapOutput() HttpAuthorizerMapOutput + ToHttpAuthorizerMapOutputWithContext(context.Context) HttpAuthorizerMapOutput +} + +type HttpAuthorizerMap map[string]HttpAuthorizerInput + +func (HttpAuthorizerMap) ElementType() reflect.Type { + return reflect.TypeOf((*map[string]HttpAuthorizer)(nil)).Elem() +} + +func (i HttpAuthorizerMap) ToHttpAuthorizerMapOutput() HttpAuthorizerMapOutput { + return i.ToHttpAuthorizerMapOutputWithContext(context.Background()) +} + +func (i HttpAuthorizerMap) ToHttpAuthorizerMapOutputWithContext(ctx context.Context) HttpAuthorizerMapOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpAuthorizerMapOutput) +} + +func (i HttpAuthorizerMap) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpAuthorizer] { + return pulumix.Output[map[string]HttpAuthorizer]{ + OutputState: i.ToHttpAuthorizerMapOutputWithContext(ctx).OutputState, + } +} + +type HttpAuthorizerOutput struct{ *pulumi.OutputState } + +func (HttpAuthorizerOutput) ElementType() reflect.Type { + return reflect.TypeOf((*HttpAuthorizer)(nil)).Elem() +} + +func (o HttpAuthorizerOutput) ToHttpAuthorizerOutput() HttpAuthorizerOutput { + return o +} + +func (o HttpAuthorizerOutput) ToHttpAuthorizerOutputWithContext(ctx context.Context) HttpAuthorizerOutput { + return o +} + +func (o HttpAuthorizerOutput) ToOutput(ctx context.Context) pulumix.Output[HttpAuthorizer] { + return pulumix.Output[HttpAuthorizer]{ + OutputState: o.OutputState, + } +} + +type HttpAuthorizerMapOutput struct{ *pulumi.OutputState } + +func (HttpAuthorizerMapOutput) ElementType() reflect.Type { + return reflect.TypeOf((*map[string]HttpAuthorizer)(nil)).Elem() +} + +func (o HttpAuthorizerMapOutput) ToHttpAuthorizerMapOutput() HttpAuthorizerMapOutput { + return o +} + +func (o HttpAuthorizerMapOutput) ToHttpAuthorizerMapOutputWithContext(ctx context.Context) HttpAuthorizerMapOutput { + return o +} + +func (o HttpAuthorizerMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpAuthorizer] { + return pulumix.Output[map[string]HttpAuthorizer]{ + OutputState: o.OutputState, + } +} + +func (o HttpAuthorizerMapOutput) MapIndex(k pulumi.StringInput) HttpAuthorizerOutput { + return pulumi.All(o, k).ApplyT(func(vs []interface{}) HttpAuthorizer { + return vs[0].(map[string]HttpAuthorizer)[vs[1].(string)] + }).(HttpAuthorizerOutput) +} + +type HttpIntegration struct { +} + +// HttpIntegrationInput is an input type that accepts HttpIntegrationArgs and HttpIntegrationOutput values. +// You can construct a concrete instance of `HttpIntegrationInput` via: +// +// HttpIntegrationArgs{...} +type HttpIntegrationInput interface { + pulumi.Input + + ToHttpIntegrationOutput() HttpIntegrationOutput + ToHttpIntegrationOutputWithContext(context.Context) HttpIntegrationOutput +} + +type HttpIntegrationArgs struct { +} + +func (HttpIntegrationArgs) ElementType() reflect.Type { + return reflect.TypeOf((*HttpIntegration)(nil)).Elem() +} + +func (i HttpIntegrationArgs) ToHttpIntegrationOutput() HttpIntegrationOutput { + return i.ToHttpIntegrationOutputWithContext(context.Background()) +} + +func (i HttpIntegrationArgs) ToHttpIntegrationOutputWithContext(ctx context.Context) HttpIntegrationOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpIntegrationOutput) +} + +func (i HttpIntegrationArgs) ToOutput(ctx context.Context) pulumix.Output[HttpIntegration] { + return pulumix.Output[HttpIntegration]{ + OutputState: i.ToHttpIntegrationOutputWithContext(ctx).OutputState, + } +} + +// HttpIntegrationMapInput is an input type that accepts HttpIntegrationMap and HttpIntegrationMapOutput values. +// You can construct a concrete instance of `HttpIntegrationMapInput` via: +// +// HttpIntegrationMap{ "key": HttpIntegrationArgs{...} } +type HttpIntegrationMapInput interface { + pulumi.Input + + ToHttpIntegrationMapOutput() HttpIntegrationMapOutput + ToHttpIntegrationMapOutputWithContext(context.Context) HttpIntegrationMapOutput +} + +type HttpIntegrationMap map[string]HttpIntegrationInput + +func (HttpIntegrationMap) ElementType() reflect.Type { + return reflect.TypeOf((*map[string]HttpIntegration)(nil)).Elem() +} + +func (i HttpIntegrationMap) ToHttpIntegrationMapOutput() HttpIntegrationMapOutput { + return i.ToHttpIntegrationMapOutputWithContext(context.Background()) +} + +func (i HttpIntegrationMap) ToHttpIntegrationMapOutputWithContext(ctx context.Context) HttpIntegrationMapOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpIntegrationMapOutput) +} + +func (i HttpIntegrationMap) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpIntegration] { + return pulumix.Output[map[string]HttpIntegration]{ + OutputState: i.ToHttpIntegrationMapOutputWithContext(ctx).OutputState, + } +} + +type HttpIntegrationOutput struct{ *pulumi.OutputState } + +func (HttpIntegrationOutput) ElementType() reflect.Type { + return reflect.TypeOf((*HttpIntegration)(nil)).Elem() +} + +func (o HttpIntegrationOutput) ToHttpIntegrationOutput() HttpIntegrationOutput { + return o +} + +func (o HttpIntegrationOutput) ToHttpIntegrationOutputWithContext(ctx context.Context) HttpIntegrationOutput { + return o +} + +func (o HttpIntegrationOutput) ToOutput(ctx context.Context) pulumix.Output[HttpIntegration] { + return pulumix.Output[HttpIntegration]{ + OutputState: o.OutputState, + } +} + +type HttpIntegrationMapOutput struct{ *pulumi.OutputState } + +func (HttpIntegrationMapOutput) ElementType() reflect.Type { + return reflect.TypeOf((*map[string]HttpIntegration)(nil)).Elem() +} + +func (o HttpIntegrationMapOutput) ToHttpIntegrationMapOutput() HttpIntegrationMapOutput { + return o +} + +func (o HttpIntegrationMapOutput) ToHttpIntegrationMapOutputWithContext(ctx context.Context) HttpIntegrationMapOutput { + return o +} + +func (o HttpIntegrationMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpIntegration] { + return pulumix.Output[map[string]HttpIntegration]{ + OutputState: o.OutputState, + } +} + +func (o HttpIntegrationMapOutput) MapIndex(k pulumi.StringInput) HttpIntegrationOutput { + return pulumi.All(o, k).ApplyT(func(vs []interface{}) HttpIntegration { + return vs[0].(map[string]HttpIntegration)[vs[1].(string)] + }).(HttpIntegrationOutput) +} + +type HttpRoute struct { + // The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + Authorizer *string `pulumi:"authorizer"` + // The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + Integration *string `pulumi:"integration"` +} + +// HttpRouteInput is an input type that accepts HttpRouteArgs and HttpRouteOutput values. +// You can construct a concrete instance of `HttpRouteInput` via: +// +// HttpRouteArgs{...} +type HttpRouteInput interface { + pulumi.Input + + ToHttpRouteOutput() HttpRouteOutput + ToHttpRouteOutputWithContext(context.Context) HttpRouteOutput +} + +type HttpRouteArgs struct { + // The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + Authorizer pulumi.StringPtrInput `pulumi:"authorizer"` + // The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + Integration pulumi.StringPtrInput `pulumi:"integration"` +} + +func (HttpRouteArgs) ElementType() reflect.Type { + return reflect.TypeOf((*HttpRoute)(nil)).Elem() +} + +func (i HttpRouteArgs) ToHttpRouteOutput() HttpRouteOutput { + return i.ToHttpRouteOutputWithContext(context.Background()) +} + +func (i HttpRouteArgs) ToHttpRouteOutputWithContext(ctx context.Context) HttpRouteOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpRouteOutput) +} + +func (i HttpRouteArgs) ToOutput(ctx context.Context) pulumix.Output[HttpRoute] { + return pulumix.Output[HttpRoute]{ + OutputState: i.ToHttpRouteOutputWithContext(ctx).OutputState, + } +} + +// HttpRouteMapInput is an input type that accepts HttpRouteMap and HttpRouteMapOutput values. +// You can construct a concrete instance of `HttpRouteMapInput` via: +// +// HttpRouteMap{ "key": HttpRouteArgs{...} } +type HttpRouteMapInput interface { + pulumi.Input + + ToHttpRouteMapOutput() HttpRouteMapOutput + ToHttpRouteMapOutputWithContext(context.Context) HttpRouteMapOutput +} + +type HttpRouteMap map[string]HttpRouteInput + +func (HttpRouteMap) ElementType() reflect.Type { + return reflect.TypeOf((*map[string]HttpRoute)(nil)).Elem() +} + +func (i HttpRouteMap) ToHttpRouteMapOutput() HttpRouteMapOutput { + return i.ToHttpRouteMapOutputWithContext(context.Background()) +} + +func (i HttpRouteMap) ToHttpRouteMapOutputWithContext(ctx context.Context) HttpRouteMapOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpRouteMapOutput) +} + +func (i HttpRouteMap) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpRoute] { + return pulumix.Output[map[string]HttpRoute]{ + OutputState: i.ToHttpRouteMapOutputWithContext(ctx).OutputState, + } +} + +type HttpRouteOutput struct{ *pulumi.OutputState } + +func (HttpRouteOutput) ElementType() reflect.Type { + return reflect.TypeOf((*HttpRoute)(nil)).Elem() +} + +func (o HttpRouteOutput) ToHttpRouteOutput() HttpRouteOutput { + return o +} + +func (o HttpRouteOutput) ToHttpRouteOutputWithContext(ctx context.Context) HttpRouteOutput { + return o +} + +func (o HttpRouteOutput) ToOutput(ctx context.Context) pulumix.Output[HttpRoute] { + return pulumix.Output[HttpRoute]{ + OutputState: o.OutputState, + } +} + +// The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. +func (o HttpRouteOutput) Authorizer() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpRoute) *string { return v.Authorizer }).(pulumi.StringPtrOutput) +} + +// The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. +func (o HttpRouteOutput) Integration() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpRoute) *string { return v.Integration }).(pulumi.StringPtrOutput) +} + +type HttpRouteMapOutput struct{ *pulumi.OutputState } + +func (HttpRouteMapOutput) ElementType() reflect.Type { + return reflect.TypeOf((*map[string]HttpRoute)(nil)).Elem() +} + +func (o HttpRouteMapOutput) ToHttpRouteMapOutput() HttpRouteMapOutput { + return o +} + +func (o HttpRouteMapOutput) ToHttpRouteMapOutputWithContext(ctx context.Context) HttpRouteMapOutput { + return o +} + +func (o HttpRouteMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpRoute] { + return pulumix.Output[map[string]HttpRoute]{ + OutputState: o.OutputState, + } +} + +func (o HttpRouteMapOutput) MapIndex(k pulumi.StringInput) HttpRouteOutput { + return pulumi.All(o, k).ApplyT(func(vs []interface{}) HttpRoute { + return vs[0].(map[string]HttpRoute)[vs[1].(string)] + }).(HttpRouteOutput) +} + +type HttpStage struct { +} + +// HttpStageInput is an input type that accepts HttpStageArgs and HttpStageOutput values. +// You can construct a concrete instance of `HttpStageInput` via: +// +// HttpStageArgs{...} +type HttpStageInput interface { + pulumi.Input + + ToHttpStageOutput() HttpStageOutput + ToHttpStageOutputWithContext(context.Context) HttpStageOutput +} + +type HttpStageArgs struct { +} + +func (HttpStageArgs) ElementType() reflect.Type { + return reflect.TypeOf((*HttpStage)(nil)).Elem() +} + +func (i HttpStageArgs) ToHttpStageOutput() HttpStageOutput { + return i.ToHttpStageOutputWithContext(context.Background()) +} + +func (i HttpStageArgs) ToHttpStageOutputWithContext(ctx context.Context) HttpStageOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpStageOutput) +} + +func (i HttpStageArgs) ToOutput(ctx context.Context) pulumix.Output[HttpStage] { + return pulumix.Output[HttpStage]{ + OutputState: i.ToHttpStageOutputWithContext(ctx).OutputState, + } +} + +// HttpStageMapInput is an input type that accepts HttpStageMap and HttpStageMapOutput values. +// You can construct a concrete instance of `HttpStageMapInput` via: +// +// HttpStageMap{ "key": HttpStageArgs{...} } +type HttpStageMapInput interface { + pulumi.Input + + ToHttpStageMapOutput() HttpStageMapOutput + ToHttpStageMapOutputWithContext(context.Context) HttpStageMapOutput +} + +type HttpStageMap map[string]HttpStageInput + +func (HttpStageMap) ElementType() reflect.Type { + return reflect.TypeOf((*map[string]HttpStage)(nil)).Elem() +} + +func (i HttpStageMap) ToHttpStageMapOutput() HttpStageMapOutput { + return i.ToHttpStageMapOutputWithContext(context.Background()) +} + +func (i HttpStageMap) ToHttpStageMapOutputWithContext(ctx context.Context) HttpStageMapOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpStageMapOutput) +} + +func (i HttpStageMap) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpStage] { + return pulumix.Output[map[string]HttpStage]{ + OutputState: i.ToHttpStageMapOutputWithContext(ctx).OutputState, + } +} + +type HttpStageOutput struct{ *pulumi.OutputState } + +func (HttpStageOutput) ElementType() reflect.Type { + return reflect.TypeOf((*HttpStage)(nil)).Elem() +} + +func (o HttpStageOutput) ToHttpStageOutput() HttpStageOutput { + return o +} + +func (o HttpStageOutput) ToHttpStageOutputWithContext(ctx context.Context) HttpStageOutput { + return o +} + +func (o HttpStageOutput) ToOutput(ctx context.Context) pulumix.Output[HttpStage] { + return pulumix.Output[HttpStage]{ + OutputState: o.OutputState, + } +} + +type HttpStageMapOutput struct{ *pulumi.OutputState } + +func (HttpStageMapOutput) ElementType() reflect.Type { + return reflect.TypeOf((*map[string]HttpStage)(nil)).Elem() +} + +func (o HttpStageMapOutput) ToHttpStageMapOutput() HttpStageMapOutput { + return o +} + +func (o HttpStageMapOutput) ToHttpStageMapOutputWithContext(ctx context.Context) HttpStageMapOutput { + return o +} + +func (o HttpStageMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpStage] { + return pulumix.Output[map[string]HttpStage]{ + OutputState: o.OutputState, + } +} + +func (o HttpStageMapOutput) MapIndex(k pulumi.StringInput) HttpStageOutput { + return pulumi.All(o, k).ApplyT(func(vs []interface{}) HttpStage { + return vs[0].(map[string]HttpStage)[vs[1].(string)] + }).(HttpStageOutput) +} + +func init() { + pulumi.RegisterInputType(reflect.TypeOf((*DomainConfigurationInput)(nil)).Elem(), DomainConfigurationArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*DomainConfigurationPtrInput)(nil)).Elem(), DomainConfigurationArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*DomainMappingInput)(nil)).Elem(), DomainMappingArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*DomainMappingMapInput)(nil)).Elem(), DomainMappingMap{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpAuthorizerInput)(nil)).Elem(), HttpAuthorizerArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpAuthorizerMapInput)(nil)).Elem(), HttpAuthorizerMap{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpIntegrationInput)(nil)).Elem(), HttpIntegrationArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpIntegrationMapInput)(nil)).Elem(), HttpIntegrationMap{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpRouteInput)(nil)).Elem(), HttpRouteArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpRouteMapInput)(nil)).Elem(), HttpRouteMap{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpStageInput)(nil)).Elem(), HttpStageArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpStageMapInput)(nil)).Elem(), HttpStageMap{}) + pulumi.RegisterOutputType(DomainConfigurationOutput{}) + pulumi.RegisterOutputType(DomainConfigurationPtrOutput{}) + pulumi.RegisterOutputType(DomainMappingOutput{}) + pulumi.RegisterOutputType(DomainMappingMapOutput{}) + pulumi.RegisterOutputType(HttpAuthorizerOutput{}) + pulumi.RegisterOutputType(HttpAuthorizerMapOutput{}) + pulumi.RegisterOutputType(HttpIntegrationOutput{}) + pulumi.RegisterOutputType(HttpIntegrationMapOutput{}) + pulumi.RegisterOutputType(HttpRouteOutput{}) + pulumi.RegisterOutputType(HttpRouteMapOutput{}) + pulumi.RegisterOutputType(HttpStageOutput{}) + pulumi.RegisterOutputType(HttpStageMapOutput{}) +} diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApi.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApi.java new file mode 100644 index 000000000..bc14061ca --- /dev/null +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApi.java @@ -0,0 +1,190 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.awsx.apigatewayv2; + +import com.pulumi.aws.apigatewayv2.Api; +import com.pulumi.aws.apigatewayv2.ApiMapping; +import com.pulumi.aws.apigatewayv2.Authorizer; +import com.pulumi.aws.apigatewayv2.Deployment; +import com.pulumi.aws.apigatewayv2.DomainName; +import com.pulumi.aws.apigatewayv2.Integration; +import com.pulumi.aws.apigatewayv2.Route; +import com.pulumi.aws.apigatewayv2.Stage; +import com.pulumi.awsx.Utilities; +import com.pulumi.awsx.apigatewayv2.HttpApiArgs; +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Export; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import java.util.List; +import java.util.Optional; +import javax.annotation.Nullable; + +/** + * Creates an HTTP API with associated sub-resources. + * + */ +@ResourceType(type="awsx:apigatewayv2:HttpApi") +public class HttpApi extends com.pulumi.resources.CustomResource { + /** + * The underlying API resource. + * + */ + @Export(name="api", refs={Api.class}, tree="[0]") + private Output api; + + /** + * @return The underlying API resource. + * + */ + public Output api() { + return this.api; + } + /** + * The API mappings for the HTTP API. + * + */ + @Export(name="apiMappings", refs={List.class,ApiMapping.class}, tree="[0,1]") + private Output> apiMappings; + + /** + * @return The API mappings for the HTTP API. + * + */ + public Output>> apiMappings() { + return Codegen.optional(this.apiMappings); + } + /** + * The authorizers for the HTTP API routes. + * + */ + @Export(name="authorizers", refs={List.class,Authorizer.class}, tree="[0,1]") + private Output> authorizers; + + /** + * @return The authorizers for the HTTP API routes. + * + */ + public Output> authorizers() { + return this.authorizers; + } + /** + * The deployment for the HTTP API. + * + */ + @Export(name="deployment", refs={Deployment.class}, tree="[0]") + private Output deployment; + + /** + * @return The deployment for the HTTP API. + * + */ + public Output deployment() { + return this.deployment; + } + /** + * The domain names for the HTTP API. + * + */ + @Export(name="domainNames", refs={List.class,DomainName.class}, tree="[0,1]") + private Output> domainNames; + + /** + * @return The domain names for the HTTP API. + * + */ + public Output> domainNames() { + return this.domainNames; + } + /** + * The integrations for the HTTP API routes. This is a map from integration name to the integration arguments. + * + */ + @Export(name="integrations", refs={List.class,Integration.class}, tree="[0,1]") + private Output> integrations; + + /** + * @return The integrations for the HTTP API routes. This is a map from integration name to the integration arguments. + * + */ + public Output> integrations() { + return this.integrations; + } + /** + * The routes for the HTTP API. This is a map from route key (for example `GET /pets`) to route arguments. + * + */ + @Export(name="routes", refs={List.class,Route.class}, tree="[0,1]") + private Output> routes; + + /** + * @return The routes for the HTTP API. This is a map from route key (for example `GET /pets`) to route arguments. + * + */ + public Output> routes() { + return this.routes; + } + /** + * The deployment stages for the HTTP API. + * + */ + @Export(name="stages", refs={List.class,Stage.class}, tree="[0,1]") + private Output> stages; + + /** + * @return The deployment stages for the HTTP API. + * + */ + public Output> stages() { + return this.stages; + } + + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public HttpApi(String name) { + this(name, HttpApiArgs.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public HttpApi(String name, HttpApiArgs args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public HttpApi(String name, HttpApiArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("awsx:apigatewayv2:HttpApi", name, args == null ? HttpApiArgs.Empty : args, makeResourceOptions(options, Codegen.empty())); + } + + private HttpApi(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("awsx:apigatewayv2:HttpApi", name, null, makeResourceOptions(options, id)); + } + + private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); + } + + /** + * Get an existing Host resource's state with the given name, ID, and optional extra + * properties used to qualify the lookup. + * + * @param name The _unique_ name of the resulting resource. + * @param id The _unique_ provider ID of the resource to lookup. + * @param options Optional settings to control the behavior of the CustomResource. + */ + public static HttpApi get(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { + return new HttpApi(name, id, options); + } +} diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApiArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApiArgs.java new file mode 100644 index 000000000..5bcfe06d6 --- /dev/null +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApiArgs.java @@ -0,0 +1,630 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.awsx.apigatewayv2; + +import com.pulumi.aws.apigatewayv2.inputs.ApiCorsConfigurationArgs; +import com.pulumi.awsx.apigatewayv2.inputs.DomainMappingArgs; +import com.pulumi.awsx.apigatewayv2.inputs.HttpAuthorizerArgs; +import com.pulumi.awsx.apigatewayv2.inputs.HttpIntegrationArgs; +import com.pulumi.awsx.apigatewayv2.inputs.HttpRouteArgs; +import com.pulumi.awsx.apigatewayv2.inputs.HttpStageArgs; +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import java.lang.Boolean; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +public final class HttpApiArgs extends com.pulumi.resources.ResourceArgs { + + public static final HttpApiArgs Empty = new HttpApiArgs(); + + /** + * An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). + * Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. + * Applicable for WebSocket APIs. + * + */ + @Import(name="apiKeySelectionExpression") + private @Nullable Output apiKeySelectionExpression; + + /** + * @return An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). + * Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. + * Applicable for WebSocket APIs. + * + */ + public Optional> apiKeySelectionExpression() { + return Optional.ofNullable(this.apiKeySelectionExpression); + } + + /** + * The authorizers for the HTTP API routes. + * + */ + @Import(name="authorizers") + private @Nullable Output> authorizers; + + /** + * @return The authorizers for the HTTP API routes. + * + */ + public Optional>> authorizers() { + return Optional.ofNullable(this.authorizers); + } + + /** + * An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. + * + */ + @Import(name="body") + private @Nullable Output body; + + /** + * @return An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. + * + */ + public Optional> body() { + return Optional.ofNullable(this.body); + } + + /** + * Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. + * + */ + @Import(name="corsConfiguration") + private @Nullable Output corsConfiguration; + + /** + * @return Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. + * + */ + public Optional> corsConfiguration() { + return Optional.ofNullable(this.corsConfiguration); + } + + /** + * Description of the API. Must be less than or equal to 1024 characters in length. + * + */ + @Import(name="description") + private @Nullable Output description; + + /** + * @return Description of the API. Must be less than or equal to 1024 characters in length. + * + */ + public Optional> description() { + return Optional.ofNullable(this.description); + } + + /** + * Whether clients can invoke the API by using the default `execute-api` endpoint. + * By default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`. + * To require that clients use a custom domain name to invoke the API, disable the default endpoint. + * + */ + @Import(name="disableExecuteApiEndpoint") + private @Nullable Output disableExecuteApiEndpoint; + + /** + * @return Whether clients can invoke the API by using the default `execute-api` endpoint. + * By default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`. + * To require that clients use a custom domain name to invoke the API, disable the default endpoint. + * + */ + public Optional> disableExecuteApiEndpoint() { + return Optional.ofNullable(this.disableExecuteApiEndpoint); + } + + /** + * The domain names for the HTTP API. + * + */ + @Import(name="domainMappings") + private @Nullable Output> domainMappings; + + /** + * @return The domain names for the HTTP API. + * + */ + public Optional>> domainMappings() { + return Optional.ofNullable(this.domainMappings); + } + + /** + * Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. + * + */ + @Import(name="failOnWarnings") + private @Nullable Output failOnWarnings; + + /** + * @return Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. + * + */ + public Optional> failOnWarnings() { + return Optional.ofNullable(this.failOnWarnings); + } + + /** + * The integrations for the HTTP API routes. + * + */ + @Import(name="integrations") + private @Nullable Output> integrations; + + /** + * @return The integrations for the HTTP API routes. + * + */ + public Optional>> integrations() { + return Optional.ofNullable(this.integrations); + } + + /** + * Name of the API. Must be less than or equal to 128 characters in length. + * + */ + @Import(name="name") + private @Nullable Output name; + + /** + * @return Name of the API. Must be less than or equal to 128 characters in length. + * + */ + public Optional> name() { + return Optional.ofNullable(this.name); + } + + /** + * The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. + * Defaults to `$request.method $request.path`. + * + */ + @Import(name="routeSelectionExpression") + private @Nullable Output routeSelectionExpression; + + /** + * @return The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. + * Defaults to `$request.method $request.path`. + * + */ + public Optional> routeSelectionExpression() { + return Optional.ofNullable(this.routeSelectionExpression); + } + + /** + * The routes for the HTTP API. + * + */ + @Import(name="routes", required=true) + private Output> routes; + + /** + * @return The routes for the HTTP API. + * + */ + public Output> routes() { + return this.routes; + } + + /** + * The deployment stages for the HTTP API. + * + */ + @Import(name="stages") + private @Nullable Output> stages; + + /** + * @return The deployment stages for the HTTP API. + * + */ + public Optional>> stages() { + return Optional.ofNullable(this.stages); + } + + /** + * Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + * + */ + @Import(name="tags") + private @Nullable Output> tags; + + /** + * @return Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + * + */ + public Optional>> tags() { + return Optional.ofNullable(this.tags); + } + + /** + * Version identifier for the API. Must be between 1 and 64 characters in length. + * + */ + @Import(name="version") + private @Nullable Output version; + + /** + * @return Version identifier for the API. Must be between 1 and 64 characters in length. + * + */ + public Optional> version() { + return Optional.ofNullable(this.version); + } + + private HttpApiArgs() {} + + private HttpApiArgs(HttpApiArgs $) { + this.apiKeySelectionExpression = $.apiKeySelectionExpression; + this.authorizers = $.authorizers; + this.body = $.body; + this.corsConfiguration = $.corsConfiguration; + this.description = $.description; + this.disableExecuteApiEndpoint = $.disableExecuteApiEndpoint; + this.domainMappings = $.domainMappings; + this.failOnWarnings = $.failOnWarnings; + this.integrations = $.integrations; + this.name = $.name; + this.routeSelectionExpression = $.routeSelectionExpression; + this.routes = $.routes; + this.stages = $.stages; + this.tags = $.tags; + this.version = $.version; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(HttpApiArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private HttpApiArgs $; + + public Builder() { + $ = new HttpApiArgs(); + } + + public Builder(HttpApiArgs defaults) { + $ = new HttpApiArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param apiKeySelectionExpression An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). + * Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. + * Applicable for WebSocket APIs. + * + * @return builder + * + */ + public Builder apiKeySelectionExpression(@Nullable Output apiKeySelectionExpression) { + $.apiKeySelectionExpression = apiKeySelectionExpression; + return this; + } + + /** + * @param apiKeySelectionExpression An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). + * Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. + * Applicable for WebSocket APIs. + * + * @return builder + * + */ + public Builder apiKeySelectionExpression(String apiKeySelectionExpression) { + return apiKeySelectionExpression(Output.of(apiKeySelectionExpression)); + } + + /** + * @param authorizers The authorizers for the HTTP API routes. + * + * @return builder + * + */ + public Builder authorizers(@Nullable Output> authorizers) { + $.authorizers = authorizers; + return this; + } + + /** + * @param authorizers The authorizers for the HTTP API routes. + * + * @return builder + * + */ + public Builder authorizers(Map authorizers) { + return authorizers(Output.of(authorizers)); + } + + /** + * @param body An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. + * + * @return builder + * + */ + public Builder body(@Nullable Output body) { + $.body = body; + return this; + } + + /** + * @param body An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. + * + * @return builder + * + */ + public Builder body(String body) { + return body(Output.of(body)); + } + + /** + * @param corsConfiguration Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. + * + * @return builder + * + */ + public Builder corsConfiguration(@Nullable Output corsConfiguration) { + $.corsConfiguration = corsConfiguration; + return this; + } + + /** + * @param corsConfiguration Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. + * + * @return builder + * + */ + public Builder corsConfiguration(ApiCorsConfigurationArgs corsConfiguration) { + return corsConfiguration(Output.of(corsConfiguration)); + } + + /** + * @param description Description of the API. Must be less than or equal to 1024 characters in length. + * + * @return builder + * + */ + public Builder description(@Nullable Output description) { + $.description = description; + return this; + } + + /** + * @param description Description of the API. Must be less than or equal to 1024 characters in length. + * + * @return builder + * + */ + public Builder description(String description) { + return description(Output.of(description)); + } + + /** + * @param disableExecuteApiEndpoint Whether clients can invoke the API by using the default `execute-api` endpoint. + * By default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`. + * To require that clients use a custom domain name to invoke the API, disable the default endpoint. + * + * @return builder + * + */ + public Builder disableExecuteApiEndpoint(@Nullable Output disableExecuteApiEndpoint) { + $.disableExecuteApiEndpoint = disableExecuteApiEndpoint; + return this; + } + + /** + * @param disableExecuteApiEndpoint Whether clients can invoke the API by using the default `execute-api` endpoint. + * By default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`. + * To require that clients use a custom domain name to invoke the API, disable the default endpoint. + * + * @return builder + * + */ + public Builder disableExecuteApiEndpoint(Boolean disableExecuteApiEndpoint) { + return disableExecuteApiEndpoint(Output.of(disableExecuteApiEndpoint)); + } + + /** + * @param domainMappings The domain names for the HTTP API. + * + * @return builder + * + */ + public Builder domainMappings(@Nullable Output> domainMappings) { + $.domainMappings = domainMappings; + return this; + } + + /** + * @param domainMappings The domain names for the HTTP API. + * + * @return builder + * + */ + public Builder domainMappings(Map domainMappings) { + return domainMappings(Output.of(domainMappings)); + } + + /** + * @param failOnWarnings Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. + * + * @return builder + * + */ + public Builder failOnWarnings(@Nullable Output failOnWarnings) { + $.failOnWarnings = failOnWarnings; + return this; + } + + /** + * @param failOnWarnings Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. + * + * @return builder + * + */ + public Builder failOnWarnings(Boolean failOnWarnings) { + return failOnWarnings(Output.of(failOnWarnings)); + } + + /** + * @param integrations The integrations for the HTTP API routes. + * + * @return builder + * + */ + public Builder integrations(@Nullable Output> integrations) { + $.integrations = integrations; + return this; + } + + /** + * @param integrations The integrations for the HTTP API routes. + * + * @return builder + * + */ + public Builder integrations(Map integrations) { + return integrations(Output.of(integrations)); + } + + /** + * @param name Name of the API. Must be less than or equal to 128 characters in length. + * + * @return builder + * + */ + public Builder name(@Nullable Output name) { + $.name = name; + return this; + } + + /** + * @param name Name of the API. Must be less than or equal to 128 characters in length. + * + * @return builder + * + */ + public Builder name(String name) { + return name(Output.of(name)); + } + + /** + * @param routeSelectionExpression The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. + * Defaults to `$request.method $request.path`. + * + * @return builder + * + */ + public Builder routeSelectionExpression(@Nullable Output routeSelectionExpression) { + $.routeSelectionExpression = routeSelectionExpression; + return this; + } + + /** + * @param routeSelectionExpression The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. + * Defaults to `$request.method $request.path`. + * + * @return builder + * + */ + public Builder routeSelectionExpression(String routeSelectionExpression) { + return routeSelectionExpression(Output.of(routeSelectionExpression)); + } + + /** + * @param routes The routes for the HTTP API. + * + * @return builder + * + */ + public Builder routes(Output> routes) { + $.routes = routes; + return this; + } + + /** + * @param routes The routes for the HTTP API. + * + * @return builder + * + */ + public Builder routes(Map routes) { + return routes(Output.of(routes)); + } + + /** + * @param stages The deployment stages for the HTTP API. + * + * @return builder + * + */ + public Builder stages(@Nullable Output> stages) { + $.stages = stages; + return this; + } + + /** + * @param stages The deployment stages for the HTTP API. + * + * @return builder + * + */ + public Builder stages(Map stages) { + return stages(Output.of(stages)); + } + + /** + * @param tags Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + * + * @return builder + * + */ + public Builder tags(@Nullable Output> tags) { + $.tags = tags; + return this; + } + + /** + * @param tags Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + * + * @return builder + * + */ + public Builder tags(Map tags) { + return tags(Output.of(tags)); + } + + /** + * @param version Version identifier for the API. Must be between 1 and 64 characters in length. + * + * @return builder + * + */ + public Builder version(@Nullable Output version) { + $.version = version; + return this; + } + + /** + * @param version Version identifier for the API. Must be between 1 and 64 characters in length. + * + * @return builder + * + */ + public Builder version(String version) { + return version(Output.of(version)); + } + + public HttpApiArgs build() { + $.routes = Objects.requireNonNull($.routes, "expected parameter 'routes' to be non-null"); + return $; + } + } + +} diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainConfigurationArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainConfigurationArgs.java new file mode 100644 index 000000000..8c8232bd2 --- /dev/null +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainConfigurationArgs.java @@ -0,0 +1,262 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.awsx.apigatewayv2.inputs; + +import com.pulumi.aws.apigatewayv2.inputs.DomainNameDomainNameConfigurationArgs; +import com.pulumi.aws.apigatewayv2.inputs.DomainNameMutualTlsAuthenticationArgs; +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +/** + * Manages an Amazon API Gateway Version 2 domain name. + * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). + * + * > **Note:** This resource establishes ownership of and the TLS settings for + * a particular domain name. An API stage can be associated with the domain name using the `aws.apigatewayv2.ApiMapping` resource. + * + * ## Example Usage + * ### Basic + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.DomainName; + * import com.pulumi.aws.apigatewayv2.DomainNameArgs; + * import com.pulumi.aws.apigatewayv2.inputs.DomainNameDomainNameConfigurationArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new DomainName("example", DomainNameArgs.builder() + * .domainName("ws-api.example.com") + * .domainNameConfiguration(DomainNameDomainNameConfigurationArgs.builder() + * .certificateArn(aws_acm_certificate.example().arn()) + * .endpointType("REGIONAL") + * .securityPolicy("TLS_1_2") + * .build()) + * .build()); + * + * } + * } + * ``` + * ### Associated Route 53 Resource Record + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.DomainName; + * import com.pulumi.aws.apigatewayv2.DomainNameArgs; + * import com.pulumi.aws.apigatewayv2.inputs.DomainNameDomainNameConfigurationArgs; + * import com.pulumi.aws.route53.Record; + * import com.pulumi.aws.route53.RecordArgs; + * import com.pulumi.aws.route53.inputs.RecordAliasArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var exampleDomainName = new DomainName("exampleDomainName", DomainNameArgs.builder() + * .domainName("http-api.example.com") + * .domainNameConfiguration(DomainNameDomainNameConfigurationArgs.builder() + * .certificateArn(aws_acm_certificate.example().arn()) + * .endpointType("REGIONAL") + * .securityPolicy("TLS_1_2") + * .build()) + * .build()); + * + * var exampleRecord = new Record("exampleRecord", RecordArgs.builder() + * .name(exampleDomainName.domainName()) + * .type("A") + * .zoneId(aws_route53_zone.example().zone_id()) + * .aliases(RecordAliasArgs.builder() + * .name(exampleDomainName.domainNameConfiguration().applyValue(domainNameConfiguration -> domainNameConfiguration.targetDomainName())) + * .zoneId(exampleDomainName.domainNameConfiguration().applyValue(domainNameConfiguration -> domainNameConfiguration.hostedZoneId())) + * .evaluateTargetHealth(false) + * .build()) + * .build()); + * + * } + * } + * ``` + * + * ## Import + * + * Using `pulumi import`, import `aws_apigatewayv2_domain_name` using the domain name. For example: + * + * ```sh + * $ pulumi import aws:apigatewayv2/domainName:DomainName example ws-api.example.com + * ``` + * + */ +public final class DomainConfigurationArgs extends com.pulumi.resources.ResourceArgs { + + public static final DomainConfigurationArgs Empty = new DomainConfigurationArgs(); + + /** + * Domain name configuration. See below. + * + */ + @Import(name="domainNameConfiguration") + private @Nullable Output domainNameConfiguration; + + /** + * @return Domain name configuration. See below. + * + */ + public Optional> domainNameConfiguration() { + return Optional.ofNullable(this.domainNameConfiguration); + } + + /** + * Mutual TLS authentication configuration for the domain name. + * + */ + @Import(name="mutualTlsAuthentication") + private @Nullable Output mutualTlsAuthentication; + + /** + * @return Mutual TLS authentication configuration for the domain name. + * + */ + public Optional> mutualTlsAuthentication() { + return Optional.ofNullable(this.mutualTlsAuthentication); + } + + /** + * Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + * + */ + @Import(name="tags") + private @Nullable Output> tags; + + /** + * @return Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + * + */ + public Optional>> tags() { + return Optional.ofNullable(this.tags); + } + + private DomainConfigurationArgs() {} + + private DomainConfigurationArgs(DomainConfigurationArgs $) { + this.domainNameConfiguration = $.domainNameConfiguration; + this.mutualTlsAuthentication = $.mutualTlsAuthentication; + this.tags = $.tags; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(DomainConfigurationArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private DomainConfigurationArgs $; + + public Builder() { + $ = new DomainConfigurationArgs(); + } + + public Builder(DomainConfigurationArgs defaults) { + $ = new DomainConfigurationArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param domainNameConfiguration Domain name configuration. See below. + * + * @return builder + * + */ + public Builder domainNameConfiguration(@Nullable Output domainNameConfiguration) { + $.domainNameConfiguration = domainNameConfiguration; + return this; + } + + /** + * @param domainNameConfiguration Domain name configuration. See below. + * + * @return builder + * + */ + public Builder domainNameConfiguration(DomainNameDomainNameConfigurationArgs domainNameConfiguration) { + return domainNameConfiguration(Output.of(domainNameConfiguration)); + } + + /** + * @param mutualTlsAuthentication Mutual TLS authentication configuration for the domain name. + * + * @return builder + * + */ + public Builder mutualTlsAuthentication(@Nullable Output mutualTlsAuthentication) { + $.mutualTlsAuthentication = mutualTlsAuthentication; + return this; + } + + /** + * @param mutualTlsAuthentication Mutual TLS authentication configuration for the domain name. + * + * @return builder + * + */ + public Builder mutualTlsAuthentication(DomainNameMutualTlsAuthenticationArgs mutualTlsAuthentication) { + return mutualTlsAuthentication(Output.of(mutualTlsAuthentication)); + } + + /** + * @param tags Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + * + * @return builder + * + */ + public Builder tags(@Nullable Output> tags) { + $.tags = tags; + return this; + } + + /** + * @param tags Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + * + * @return builder + * + */ + public Builder tags(Map tags) { + return tags(Output.of(tags)); + } + + public DomainConfigurationArgs build() { + return $; + } + } + +} diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainMappingArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainMappingArgs.java new file mode 100644 index 000000000..ea29a5976 --- /dev/null +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainMappingArgs.java @@ -0,0 +1,121 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.awsx.apigatewayv2.inputs; + +import com.pulumi.awsx.apigatewayv2.inputs.DomainConfigurationArgs; +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +public final class DomainMappingArgs extends com.pulumi.resources.ResourceArgs { + + public static final DomainMappingArgs Empty = new DomainMappingArgs(); + + /** + * Configuration of the domain name to create. Cannot be specified together with `domainId`. + * + */ + @Import(name="domainConfiguration") + private @Nullable Output domainConfiguration; + + /** + * @return Configuration of the domain name to create. Cannot be specified together with `domainId`. + * + */ + public Optional> domainConfiguration() { + return Optional.ofNullable(this.domainConfiguration); + } + + /** + * Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + * + */ + @Import(name="domainId") + private @Nullable Output domainId; + + /** + * @return Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + * + */ + public Optional> domainId() { + return Optional.ofNullable(this.domainId); + } + + private DomainMappingArgs() {} + + private DomainMappingArgs(DomainMappingArgs $) { + this.domainConfiguration = $.domainConfiguration; + this.domainId = $.domainId; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(DomainMappingArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private DomainMappingArgs $; + + public Builder() { + $ = new DomainMappingArgs(); + } + + public Builder(DomainMappingArgs defaults) { + $ = new DomainMappingArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param domainConfiguration Configuration of the domain name to create. Cannot be specified together with `domainId`. + * + * @return builder + * + */ + public Builder domainConfiguration(@Nullable Output domainConfiguration) { + $.domainConfiguration = domainConfiguration; + return this; + } + + /** + * @param domainConfiguration Configuration of the domain name to create. Cannot be specified together with `domainId`. + * + * @return builder + * + */ + public Builder domainConfiguration(DomainConfigurationArgs domainConfiguration) { + return domainConfiguration(Output.of(domainConfiguration)); + } + + /** + * @param domainId Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + * + * @return builder + * + */ + public Builder domainId(@Nullable Output domainId) { + $.domainId = domainId; + return this; + } + + /** + * @param domainId Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + * + * @return builder + * + */ + public Builder domainId(String domainId) { + return domainId(Output.of(domainId)); + } + + public DomainMappingArgs build() { + return $; + } + } + +} diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpAuthorizerArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpAuthorizerArgs.java new file mode 100644 index 000000000..50360508d --- /dev/null +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpAuthorizerArgs.java @@ -0,0 +1,28 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.awsx.apigatewayv2.inputs; + + + + +public final class HttpAuthorizerArgs extends com.pulumi.resources.ResourceArgs { + + public static final HttpAuthorizerArgs Empty = new HttpAuthorizerArgs(); + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private HttpAuthorizerArgs $; + + public Builder() { + $ = new HttpAuthorizerArgs(); + } + public HttpAuthorizerArgs build() { + return $; + } + } + +} diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpIntegrationArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpIntegrationArgs.java new file mode 100644 index 000000000..6266597ed --- /dev/null +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpIntegrationArgs.java @@ -0,0 +1,28 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.awsx.apigatewayv2.inputs; + + + + +public final class HttpIntegrationArgs extends com.pulumi.resources.ResourceArgs { + + public static final HttpIntegrationArgs Empty = new HttpIntegrationArgs(); + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private HttpIntegrationArgs $; + + public Builder() { + $ = new HttpIntegrationArgs(); + } + public HttpIntegrationArgs build() { + return $; + } + } + +} diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java new file mode 100644 index 000000000..9f39c5f1e --- /dev/null +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java @@ -0,0 +1,120 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.awsx.apigatewayv2.inputs; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +public final class HttpRouteArgs extends com.pulumi.resources.ResourceArgs { + + public static final HttpRouteArgs Empty = new HttpRouteArgs(); + + /** + * The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + * + */ + @Import(name="authorizer") + private @Nullable Output authorizer; + + /** + * @return The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + * + */ + public Optional> authorizer() { + return Optional.ofNullable(this.authorizer); + } + + /** + * The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + * + */ + @Import(name="integration") + private @Nullable Output integration; + + /** + * @return The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + * + */ + public Optional> integration() { + return Optional.ofNullable(this.integration); + } + + private HttpRouteArgs() {} + + private HttpRouteArgs(HttpRouteArgs $) { + this.authorizer = $.authorizer; + this.integration = $.integration; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(HttpRouteArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private HttpRouteArgs $; + + public Builder() { + $ = new HttpRouteArgs(); + } + + public Builder(HttpRouteArgs defaults) { + $ = new HttpRouteArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param authorizer The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + * + * @return builder + * + */ + public Builder authorizer(@Nullable Output authorizer) { + $.authorizer = authorizer; + return this; + } + + /** + * @param authorizer The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + * + * @return builder + * + */ + public Builder authorizer(String authorizer) { + return authorizer(Output.of(authorizer)); + } + + /** + * @param integration The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + * + * @return builder + * + */ + public Builder integration(@Nullable Output integration) { + $.integration = integration; + return this; + } + + /** + * @param integration The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + * + * @return builder + * + */ + public Builder integration(String integration) { + return integration(Output.of(integration)); + } + + public HttpRouteArgs build() { + return $; + } + } + +} diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpStageArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpStageArgs.java new file mode 100644 index 000000000..496ed793a --- /dev/null +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpStageArgs.java @@ -0,0 +1,28 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.awsx.apigatewayv2.inputs; + + + + +public final class HttpStageArgs extends com.pulumi.resources.ResourceArgs { + + public static final HttpStageArgs Empty = new HttpStageArgs(); + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private HttpStageArgs $; + + public Builder() { + $ = new HttpStageArgs(); + } + public HttpStageArgs build() { + return $; + } + } + +} diff --git a/sdk/nodejs/apigatewayv2/httpApi.ts b/sdk/nodejs/apigatewayv2/httpApi.ts new file mode 100644 index 000000000..574a5cf0a --- /dev/null +++ b/sdk/nodejs/apigatewayv2/httpApi.ts @@ -0,0 +1,192 @@ +// *** WARNING: this file was generated by pulumi-gen-awsx. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +import * as pulumi from "@pulumi/pulumi"; +import * as inputs from "../types/input"; +import * as outputs from "../types/output"; +import * as enums from "../types/enums"; +import * as utilities from "../utilities"; + +import * as pulumiAws from "@pulumi/aws"; + +/** + * Creates an HTTP API with associated sub-resources. + */ +export class HttpApi extends pulumi.CustomResource { + /** + * Get an existing HttpApi resource's state with the given name, ID, and optional extra + * properties used to qualify the lookup. + * + * @param name The _unique_ name of the resulting resource. + * @param id The _unique_ provider ID of the resource to lookup. + * @param opts Optional settings to control the behavior of the CustomResource. + */ + public static get(name: string, id: pulumi.Input, opts?: pulumi.CustomResourceOptions): HttpApi { + return new HttpApi(name, undefined as any, { ...opts, id: id }); + } + + /** @internal */ + public static readonly __pulumiType = 'awsx:apigatewayv2:HttpApi'; + + /** + * Returns true if the given object is an instance of HttpApi. This is designed to work even + * when multiple copies of the Pulumi SDK have been loaded into the same process. + */ + public static isInstance(obj: any): obj is HttpApi { + if (obj === undefined || obj === null) { + return false; + } + return obj['__pulumiType'] === HttpApi.__pulumiType; + } + + /** + * The underlying API resource. + */ + public /*out*/ readonly api!: pulumi.Output; + /** + * The API mappings for the HTTP API. + */ + public /*out*/ readonly apiMappings!: pulumi.Output; + /** + * The authorizers for the HTTP API routes. + */ + public readonly authorizers!: pulumi.Output; + /** + * The deployment for the HTTP API. + */ + public /*out*/ readonly deployment!: pulumi.Output; + /** + * The domain names for the HTTP API. + */ + public /*out*/ readonly domainNames!: pulumi.Output; + /** + * The integrations for the HTTP API routes. This is a map from integration name to the integration arguments. + */ + public readonly integrations!: pulumi.Output; + /** + * The routes for the HTTP API. This is a map from route key (for example `GET /pets`) to route arguments. + */ + public readonly routes!: pulumi.Output; + /** + * The deployment stages for the HTTP API. + */ + public readonly stages!: pulumi.Output; + + /** + * Create a HttpApi resource with the given unique name, arguments, and options. + * + * @param name The _unique_ name of the resource. + * @param args The arguments to use to populate this resource's properties. + * @param opts A bag of options that control this resource's behavior. + */ + constructor(name: string, args: HttpApiArgs, opts?: pulumi.CustomResourceOptions) { + let resourceInputs: pulumi.Inputs = {}; + opts = opts || {}; + if (!opts.id) { + if ((!args || args.routes === undefined) && !opts.urn) { + throw new Error("Missing required property 'routes'"); + } + resourceInputs["apiKeySelectionExpression"] = args ? args.apiKeySelectionExpression : undefined; + resourceInputs["authorizers"] = args ? args.authorizers : undefined; + resourceInputs["body"] = args ? args.body : undefined; + resourceInputs["corsConfiguration"] = args ? args.corsConfiguration : undefined; + resourceInputs["description"] = args ? args.description : undefined; + resourceInputs["disableExecuteApiEndpoint"] = args ? args.disableExecuteApiEndpoint : undefined; + resourceInputs["domainMappings"] = args ? args.domainMappings : undefined; + resourceInputs["failOnWarnings"] = args ? args.failOnWarnings : undefined; + resourceInputs["integrations"] = args ? args.integrations : undefined; + resourceInputs["name"] = args ? args.name : undefined; + resourceInputs["routeSelectionExpression"] = args ? args.routeSelectionExpression : undefined; + resourceInputs["routes"] = args ? args.routes : undefined; + resourceInputs["stages"] = args ? args.stages : undefined; + resourceInputs["tags"] = args ? args.tags : undefined; + resourceInputs["version"] = args ? args.version : undefined; + resourceInputs["api"] = undefined /*out*/; + resourceInputs["apiMappings"] = undefined /*out*/; + resourceInputs["deployment"] = undefined /*out*/; + resourceInputs["domainNames"] = undefined /*out*/; + } else { + resourceInputs["api"] = undefined /*out*/; + resourceInputs["apiMappings"] = undefined /*out*/; + resourceInputs["authorizers"] = undefined /*out*/; + resourceInputs["deployment"] = undefined /*out*/; + resourceInputs["domainNames"] = undefined /*out*/; + resourceInputs["integrations"] = undefined /*out*/; + resourceInputs["routes"] = undefined /*out*/; + resourceInputs["stages"] = undefined /*out*/; + } + opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); + super(HttpApi.__pulumiType, name, resourceInputs, opts); + } +} + +/** + * The set of arguments for constructing a HttpApi resource. + */ +export interface HttpApiArgs { + /** + * An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). + * Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. + * Applicable for WebSocket APIs. + */ + apiKeySelectionExpression?: pulumi.Input; + /** + * The authorizers for the HTTP API routes. + */ + authorizers?: pulumi.Input<{[key: string]: pulumi.Input}>; + /** + * An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. + */ + body?: pulumi.Input; + /** + * Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. + */ + corsConfiguration?: pulumi.Input; + /** + * Description of the API. Must be less than or equal to 1024 characters in length. + */ + description?: pulumi.Input; + /** + * Whether clients can invoke the API by using the default `execute-api` endpoint. + * By default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`. + * To require that clients use a custom domain name to invoke the API, disable the default endpoint. + */ + disableExecuteApiEndpoint?: pulumi.Input; + /** + * The domain names for the HTTP API. + */ + domainMappings?: pulumi.Input<{[key: string]: pulumi.Input}>; + /** + * Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. + */ + failOnWarnings?: pulumi.Input; + /** + * The integrations for the HTTP API routes. + */ + integrations?: pulumi.Input<{[key: string]: pulumi.Input}>; + /** + * Name of the API. Must be less than or equal to 128 characters in length. + */ + name?: pulumi.Input; + /** + * The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. + * Defaults to `$request.method $request.path`. + */ + routeSelectionExpression?: pulumi.Input; + /** + * The routes for the HTTP API. + */ + routes: pulumi.Input<{[key: string]: pulumi.Input}>; + /** + * The deployment stages for the HTTP API. + */ + stages?: pulumi.Input<{[key: string]: pulumi.Input}>; + /** + * Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + */ + tags?: pulumi.Input<{[key: string]: pulumi.Input}>; + /** + * Version identifier for the API. Must be between 1 and 64 characters in length. + */ + version?: pulumi.Input; +} diff --git a/sdk/nodejs/apigatewayv2/index.ts b/sdk/nodejs/apigatewayv2/index.ts new file mode 100644 index 000000000..78b05e999 --- /dev/null +++ b/sdk/nodejs/apigatewayv2/index.ts @@ -0,0 +1,25 @@ +// *** WARNING: this file was generated by pulumi-gen-awsx. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +import * as pulumi from "@pulumi/pulumi"; +import * as utilities from "../utilities"; + +// Export members: +export { HttpApiArgs } from "./httpApi"; +export type HttpApi = import("./httpApi").HttpApi; +export const HttpApi: typeof import("./httpApi").HttpApi = null as any; +utilities.lazyLoad(exports, ["HttpApi"], () => require("./httpApi")); + + +const _module = { + version: utilities.getVersion(), + construct: (name: string, type: string, urn: string): pulumi.Resource => { + switch (type) { + case "awsx:apigatewayv2:HttpApi": + return new HttpApi(name, undefined, { urn }) + default: + throw new Error(`unknown resource type ${type}`); + } + }, +}; +pulumi.runtime.registerResourceModule("awsx", "apigatewayv2", _module) diff --git a/sdk/nodejs/index.ts b/sdk/nodejs/index.ts index 76a9625b9..348ec214e 100644 --- a/sdk/nodejs/index.ts +++ b/sdk/nodejs/index.ts @@ -12,6 +12,7 @@ utilities.lazyLoad(exports, ["Provider"], () => require("./provider")); // Export sub-modules: +import * as apigatewayv2 from "./apigatewayv2"; import * as classic from "./classic"; import * as cloudtrail from "./cloudtrail"; import * as ec2 from "./ec2"; @@ -21,6 +22,7 @@ import * as lb from "./lb"; import * as types from "./types"; export { + apigatewayv2, classic, cloudtrail, ec2, diff --git a/sdk/nodejs/tsconfig.json b/sdk/nodejs/tsconfig.json index 213e9bce6..a43e0914e 100644 --- a/sdk/nodejs/tsconfig.json +++ b/sdk/nodejs/tsconfig.json @@ -13,6 +13,8 @@ "strict": true }, "files": [ + "apigatewayv2/httpApi.ts", + "apigatewayv2/index.ts", "classic/acmpca/index.ts", "classic/acmpca/metrics.ts", "classic/apigateway/api.ts", diff --git a/sdk/nodejs/types/input.ts b/sdk/nodejs/types/input.ts index 3fd0cc932..47964043c 100644 --- a/sdk/nodejs/types/input.ts +++ b/sdk/nodejs/types/input.ts @@ -9,6 +9,393 @@ import * as enums from "../types/enums"; import * as pulumiAws from "@pulumi/aws"; import * as utilities from "../utilities"; +export namespace apigatewayv2 { + /** + * Manages an Amazon API Gateway Version 2 domain name. + * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). + * + * > **Note:** This resource establishes ownership of and the TLS settings for + * a particular domain name. An API stage can be associated with the domain name using the `aws.apigatewayv2.ApiMapping` resource. + * + * {{% examples %}} + * ## Example Usage + * {{% example %}} + * ### Basic + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as aws from "@pulumi/aws"; + * + * const example = new aws.apigatewayv2.DomainName("example", { + * domainName: "ws-api.example.com", + * domainNameConfiguration: { + * certificateArn: aws_acm_certificate.example.arn, + * endpointType: "REGIONAL", + * securityPolicy: "TLS_1_2", + * }, + * }); + * ``` + * ```python + * import pulumi + * import pulumi_aws as aws + * + * example = aws.apigatewayv2.DomainName("example", + * domain_name="ws-api.example.com", + * domain_name_configuration=aws.apigatewayv2.DomainNameDomainNameConfigurationArgs( + * certificate_arn=aws_acm_certificate["example"]["arn"], + * endpoint_type="REGIONAL", + * security_policy="TLS_1_2", + * )) + * ``` + * ```csharp + * using System.Collections.Generic; + * using System.Linq; + * using Pulumi; + * using Aws = Pulumi.Aws; + * + * return await Deployment.RunAsync(() => + * { + * var example = new Aws.ApiGatewayV2.DomainName("example", new() + * { + * Domain = "ws-api.example.com", + * DomainNameConfiguration = new Aws.ApiGatewayV2.Inputs.DomainNameDomainNameConfigurationArgs + * { + * CertificateArn = aws_acm_certificate.Example.Arn, + * EndpointType = "REGIONAL", + * SecurityPolicy = "TLS_1_2", + * }, + * }); + * + * }); + * ``` + * ```go + * package main + * + * import ( + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + * "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + * ) + * + * func main() { + * pulumi.Run(func(ctx *pulumi.Context) error { + * _, err := apigatewayv2.NewDomainName(ctx, "example", &apigatewayv2.DomainNameArgs{ + * DomainName: pulumi.String("ws-api.example.com"), + * DomainNameConfiguration: &apigatewayv2.DomainNameDomainNameConfigurationArgs{ + * CertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn), + * EndpointType: pulumi.String("REGIONAL"), + * SecurityPolicy: pulumi.String("TLS_1_2"), + * }, + * }) + * if err != nil { + * return err + * } + * return nil + * }) + * } + * ``` + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.DomainName; + * import com.pulumi.aws.apigatewayv2.DomainNameArgs; + * import com.pulumi.aws.apigatewayv2.inputs.DomainNameDomainNameConfigurationArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new DomainName("example", DomainNameArgs.builder() + * .domainName("ws-api.example.com") + * .domainNameConfiguration(DomainNameDomainNameConfigurationArgs.builder() + * .certificateArn(aws_acm_certificate.example().arn()) + * .endpointType("REGIONAL") + * .securityPolicy("TLS_1_2") + * .build()) + * .build()); + * + * } + * } + * ``` + * ```yaml + * resources: + * example: + * type: aws:apigatewayv2:DomainName + * properties: + * domainName: ws-api.example.com + * domainNameConfiguration: + * certificateArn: ${aws_acm_certificate.example.arn} + * endpointType: REGIONAL + * securityPolicy: TLS_1_2 + * ``` + * {{% /example %}} + * {{% example %}} + * ### Associated Route 53 Resource Record + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as aws from "@pulumi/aws"; + * + * const exampleDomainName = new aws.apigatewayv2.DomainName("exampleDomainName", { + * domainName: "http-api.example.com", + * domainNameConfiguration: { + * certificateArn: aws_acm_certificate.example.arn, + * endpointType: "REGIONAL", + * securityPolicy: "TLS_1_2", + * }, + * }); + * const exampleRecord = new aws.route53.Record("exampleRecord", { + * name: exampleDomainName.domainName, + * type: "A", + * zoneId: aws_route53_zone.example.zone_id, + * aliases: [{ + * name: exampleDomainName.domainNameConfiguration.apply(domainNameConfiguration => domainNameConfiguration.targetDomainName), + * zoneId: exampleDomainName.domainNameConfiguration.apply(domainNameConfiguration => domainNameConfiguration.hostedZoneId), + * evaluateTargetHealth: false, + * }], + * }); + * ``` + * ```python + * import pulumi + * import pulumi_aws as aws + * + * example_domain_name = aws.apigatewayv2.DomainName("exampleDomainName", + * domain_name="http-api.example.com", + * domain_name_configuration=aws.apigatewayv2.DomainNameDomainNameConfigurationArgs( + * certificate_arn=aws_acm_certificate["example"]["arn"], + * endpoint_type="REGIONAL", + * security_policy="TLS_1_2", + * )) + * example_record = aws.route53.Record("exampleRecord", + * name=example_domain_name.domain_name, + * type="A", + * zone_id=aws_route53_zone["example"]["zone_id"], + * aliases=[aws.route53.RecordAliasArgs( + * name=example_domain_name.domain_name_configuration.target_domain_name, + * zone_id=example_domain_name.domain_name_configuration.hosted_zone_id, + * evaluate_target_health=False, + * )]) + * ``` + * ```csharp + * using System.Collections.Generic; + * using System.Linq; + * using Pulumi; + * using Aws = Pulumi.Aws; + * + * return await Deployment.RunAsync(() => + * { + * var exampleDomainName = new Aws.ApiGatewayV2.DomainName("exampleDomainName", new() + * { + * Domain = "http-api.example.com", + * DomainNameConfiguration = new Aws.ApiGatewayV2.Inputs.DomainNameDomainNameConfigurationArgs + * { + * CertificateArn = aws_acm_certificate.Example.Arn, + * EndpointType = "REGIONAL", + * SecurityPolicy = "TLS_1_2", + * }, + * }); + * + * var exampleRecord = new Aws.Route53.Record("exampleRecord", new() + * { + * Name = exampleDomainName.Domain, + * Type = "A", + * ZoneId = aws_route53_zone.Example.Zone_id, + * Aliases = new[] + * { + * new Aws.Route53.Inputs.RecordAliasArgs + * { + * Name = exampleDomainName.DomainNameConfiguration.Apply(domainNameConfiguration => domainNameConfiguration.TargetDomainName), + * ZoneId = exampleDomainName.DomainNameConfiguration.Apply(domainNameConfiguration => domainNameConfiguration.HostedZoneId), + * EvaluateTargetHealth = false, + * }, + * }, + * }); + * + * }); + * ``` + * ```go + * package main + * + * import ( + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53" + * "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + * ) + * + * func main() { + * pulumi.Run(func(ctx *pulumi.Context) error { + * exampleDomainName, err := apigatewayv2.NewDomainName(ctx, "exampleDomainName", &apigatewayv2.DomainNameArgs{ + * DomainName: pulumi.String("http-api.example.com"), + * DomainNameConfiguration: &apigatewayv2.DomainNameDomainNameConfigurationArgs{ + * CertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn), + * EndpointType: pulumi.String("REGIONAL"), + * SecurityPolicy: pulumi.String("TLS_1_2"), + * }, + * }) + * if err != nil { + * return err + * } + * _, err = route53.NewRecord(ctx, "exampleRecord", &route53.RecordArgs{ + * Name: exampleDomainName.DomainName, + * Type: pulumi.String("A"), + * ZoneId: pulumi.Any(aws_route53_zone.Example.Zone_id), + * Aliases: route53.RecordAliasArray{ + * &route53.RecordAliasArgs{ + * Name: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) { + * return &domainNameConfiguration.TargetDomainName, nil + * }).(pulumi.StringPtrOutput), + * ZoneId: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) { + * return &domainNameConfiguration.HostedZoneId, nil + * }).(pulumi.StringPtrOutput), + * EvaluateTargetHealth: pulumi.Bool(false), + * }, + * }, + * }) + * if err != nil { + * return err + * } + * return nil + * }) + * } + * ``` + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.DomainName; + * import com.pulumi.aws.apigatewayv2.DomainNameArgs; + * import com.pulumi.aws.apigatewayv2.inputs.DomainNameDomainNameConfigurationArgs; + * import com.pulumi.aws.route53.Record; + * import com.pulumi.aws.route53.RecordArgs; + * import com.pulumi.aws.route53.inputs.RecordAliasArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var exampleDomainName = new DomainName("exampleDomainName", DomainNameArgs.builder() + * .domainName("http-api.example.com") + * .domainNameConfiguration(DomainNameDomainNameConfigurationArgs.builder() + * .certificateArn(aws_acm_certificate.example().arn()) + * .endpointType("REGIONAL") + * .securityPolicy("TLS_1_2") + * .build()) + * .build()); + * + * var exampleRecord = new Record("exampleRecord", RecordArgs.builder() + * .name(exampleDomainName.domainName()) + * .type("A") + * .zoneId(aws_route53_zone.example().zone_id()) + * .aliases(RecordAliasArgs.builder() + * .name(exampleDomainName.domainNameConfiguration().applyValue(domainNameConfiguration -> domainNameConfiguration.targetDomainName())) + * .zoneId(exampleDomainName.domainNameConfiguration().applyValue(domainNameConfiguration -> domainNameConfiguration.hostedZoneId())) + * .evaluateTargetHealth(false) + * .build()) + * .build()); + * + * } + * } + * ``` + * ```yaml + * resources: + * exampleDomainName: + * type: aws:apigatewayv2:DomainName + * properties: + * domainName: http-api.example.com + * domainNameConfiguration: + * certificateArn: ${aws_acm_certificate.example.arn} + * endpointType: REGIONAL + * securityPolicy: TLS_1_2 + * exampleRecord: + * type: aws:route53:Record + * properties: + * name: ${exampleDomainName.domainName} + * type: A + * zoneId: ${aws_route53_zone.example.zone_id} + * aliases: + * - name: ${exampleDomainName.domainNameConfiguration.targetDomainName} + * zoneId: ${exampleDomainName.domainNameConfiguration.hostedZoneId} + * evaluateTargetHealth: false + * ``` + * {{% /example %}} + * {{% /examples %}} + * + * ## Import + * + * Using `pulumi import`, import `aws_apigatewayv2_domain_name` using the domain name. For example: + * + * ```sh + * $ pulumi import aws:apigatewayv2/domainName:DomainName example ws-api.example.com + * ``` + * + */ + export interface DomainConfigurationArgs { + /** + * Domain name configuration. See below. + */ + domainNameConfiguration?: pulumi.Input; + /** + * Mutual TLS authentication configuration for the domain name. + */ + mutualTlsAuthentication?: pulumi.Input; + /** + * Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + */ + tags?: pulumi.Input<{[key: string]: pulumi.Input}>; + } + + export interface DomainMappingArgs { + /** + * Configuration of the domain name to create. Cannot be specified together with `domainId`. + */ + domainConfiguration?: pulumi.Input; + /** + * Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + */ + domainId?: pulumi.Input; + } + + export interface HttpAuthorizerArgs { + } + + export interface HttpIntegrationArgs { + } + + export interface HttpRouteArgs { + /** + * The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + */ + authorizer?: pulumi.Input; + /** + * The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + */ + integration?: pulumi.Input; + } + + export interface HttpStageArgs { + } +} + export namespace awsx { /** * The set of arguments for constructing a Bucket resource. diff --git a/sdk/nodejs/types/output.ts b/sdk/nodejs/types/output.ts index 437dc6cc3..524647817 100644 --- a/sdk/nodejs/types/output.ts +++ b/sdk/nodejs/types/output.ts @@ -9,6 +9,9 @@ import * as enums from "../types/enums"; import * as pulumiAws from "@pulumi/aws"; import * as utilities from "../utilities"; +export namespace apigatewayv2 { +} + export namespace awsx { } diff --git a/sdk/python/pulumi_awsx/__init__.py b/sdk/python/pulumi_awsx/__init__.py index 6032a297f..3e64a78aa 100644 --- a/sdk/python/pulumi_awsx/__init__.py +++ b/sdk/python/pulumi_awsx/__init__.py @@ -9,6 +9,8 @@ # Make subpackages available: if typing.TYPE_CHECKING: + import pulumi_awsx.apigatewayv2 as __apigatewayv2 + apigatewayv2 = __apigatewayv2 import pulumi_awsx.awsx as __awsx awsx = __awsx import pulumi_awsx.cloudtrail as __cloudtrail @@ -22,6 +24,7 @@ import pulumi_awsx.lb as __lb lb = __lb else: + apigatewayv2 = _utilities.lazy_import('pulumi_awsx.apigatewayv2') awsx = _utilities.lazy_import('pulumi_awsx.awsx') cloudtrail = _utilities.lazy_import('pulumi_awsx.cloudtrail') ec2 = _utilities.lazy_import('pulumi_awsx.ec2') @@ -32,6 +35,14 @@ _utilities.register( resource_modules=""" [ + { + "pkg": "awsx", + "mod": "apigatewayv2", + "fqn": "pulumi_awsx.apigatewayv2", + "classes": { + "awsx:apigatewayv2:HttpApi": "HttpApi" + } + }, { "pkg": "awsx", "mod": "cloudtrail", diff --git a/sdk/python/pulumi_awsx/apigatewayv2/__init__.py b/sdk/python/pulumi_awsx/apigatewayv2/__init__.py new file mode 100644 index 000000000..62029935f --- /dev/null +++ b/sdk/python/pulumi_awsx/apigatewayv2/__init__.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# *** WARNING: this file was generated by pulumi-gen-awsx. *** +# *** Do not edit by hand unless you're certain you know what you are doing! *** + +from .. import _utilities +import typing +# Export this package's modules as members: +from .http_api import * +from ._inputs import * diff --git a/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py b/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py new file mode 100644 index 000000000..6910bed6e --- /dev/null +++ b/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py @@ -0,0 +1,509 @@ +# coding=utf-8 +# *** WARNING: this file was generated by pulumi-gen-awsx. *** +# *** Do not edit by hand unless you're certain you know what you are doing! *** + +import copy +import warnings +import pulumi +import pulumi.runtime +from typing import Any, Mapping, Optional, Sequence, Union, overload +from .. import _utilities +import pulumi_aws + +__all__ = [ + 'DomainConfigurationArgs', + 'DomainMappingArgs', + 'HttpAuthorizerArgs', + 'HttpIntegrationArgs', + 'HttpRouteArgs', + 'HttpStageArgs', +] + +@pulumi.input_type +class DomainConfigurationArgs: + def __init__(__self__, *, + domain_name_configuration: Optional[pulumi.Input['pulumi_aws.apigatewayv2.DomainNameDomainNameConfigurationArgs']] = None, + mutual_tls_authentication: Optional[pulumi.Input['pulumi_aws.apigatewayv2.DomainNameMutualTlsAuthenticationArgs']] = None, + tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None): + """ + Manages an Amazon API Gateway Version 2 domain name. + More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). + + > **Note:** This resource establishes ownership of and the TLS settings for + a particular domain name. An API stage can be associated with the domain name using the `aws.apigatewayv2.ApiMapping` resource. + + {{% examples %}} + ## Example Usage + {{% example %}} + ### Basic + + ```typescript + import * as pulumi from "@pulumi/pulumi"; + import * as aws from "@pulumi/aws"; + + const example = new aws.apigatewayv2.DomainName("example", { + domainName: "ws-api.example.com", + domainNameConfiguration: { + certificateArn: aws_acm_certificate.example.arn, + endpointType: "REGIONAL", + securityPolicy: "TLS_1_2", + }, + }); + ``` + ```python + import pulumi + import pulumi_aws as aws + + example = aws.apigatewayv2.DomainName("example", + domain_name="ws-api.example.com", + domain_name_configuration=aws.apigatewayv2.DomainNameDomainNameConfigurationArgs( + certificate_arn=aws_acm_certificate["example"]["arn"], + endpoint_type="REGIONAL", + security_policy="TLS_1_2", + )) + ``` + ```csharp + using System.Collections.Generic; + using System.Linq; + using Pulumi; + using Aws = Pulumi.Aws; + + return await Deployment.RunAsync(() => + { + var example = new Aws.ApiGatewayV2.DomainName("example", new() + { + Domain = "ws-api.example.com", + DomainNameConfiguration = new Aws.ApiGatewayV2.Inputs.DomainNameDomainNameConfigurationArgs + { + CertificateArn = aws_acm_certificate.Example.Arn, + EndpointType = "REGIONAL", + SecurityPolicy = "TLS_1_2", + }, + }); + + }); + ``` + ```go + package main + + import ( + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + ) + + func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + _, err := apigatewayv2.NewDomainName(ctx, "example", &apigatewayv2.DomainNameArgs{ + DomainName: pulumi.String("ws-api.example.com"), + DomainNameConfiguration: &apigatewayv2.DomainNameDomainNameConfigurationArgs{ + CertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn), + EndpointType: pulumi.String("REGIONAL"), + SecurityPolicy: pulumi.String("TLS_1_2"), + }, + }) + if err != nil { + return err + } + return nil + }) + } + ``` + ```java + package generated_program; + + import com.pulumi.Context; + import com.pulumi.Pulumi; + import com.pulumi.core.Output; + import com.pulumi.aws.apigatewayv2.DomainName; + import com.pulumi.aws.apigatewayv2.DomainNameArgs; + import com.pulumi.aws.apigatewayv2.inputs.DomainNameDomainNameConfigurationArgs; + import java.util.List; + import java.util.ArrayList; + import java.util.Map; + import java.io.File; + import java.nio.file.Files; + import java.nio.file.Paths; + + public class App { + public static void main(String[] args) { + Pulumi.run(App::stack); + } + + public static void stack(Context ctx) { + var example = new DomainName("example", DomainNameArgs.builder() + .domainName("ws-api.example.com") + .domainNameConfiguration(DomainNameDomainNameConfigurationArgs.builder() + .certificateArn(aws_acm_certificate.example().arn()) + .endpointType("REGIONAL") + .securityPolicy("TLS_1_2") + .build()) + .build()); + + } + } + ``` + ```yaml + resources: + example: + type: aws:apigatewayv2:DomainName + properties: + domainName: ws-api.example.com + domainNameConfiguration: + certificateArn: ${aws_acm_certificate.example.arn} + endpointType: REGIONAL + securityPolicy: TLS_1_2 + ``` + {{% /example %}} + {{% example %}} + ### Associated Route 53 Resource Record + + ```typescript + import * as pulumi from "@pulumi/pulumi"; + import * as aws from "@pulumi/aws"; + + const exampleDomainName = new aws.apigatewayv2.DomainName("exampleDomainName", { + domainName: "http-api.example.com", + domainNameConfiguration: { + certificateArn: aws_acm_certificate.example.arn, + endpointType: "REGIONAL", + securityPolicy: "TLS_1_2", + }, + }); + const exampleRecord = new aws.route53.Record("exampleRecord", { + name: exampleDomainName.domainName, + type: "A", + zoneId: aws_route53_zone.example.zone_id, + aliases: [{ + name: exampleDomainName.domainNameConfiguration.apply(domainNameConfiguration => domainNameConfiguration.targetDomainName), + zoneId: exampleDomainName.domainNameConfiguration.apply(domainNameConfiguration => domainNameConfiguration.hostedZoneId), + evaluateTargetHealth: false, + }], + }); + ``` + ```python + import pulumi + import pulumi_aws as aws + + example_domain_name = aws.apigatewayv2.DomainName("exampleDomainName", + domain_name="http-api.example.com", + domain_name_configuration=aws.apigatewayv2.DomainNameDomainNameConfigurationArgs( + certificate_arn=aws_acm_certificate["example"]["arn"], + endpoint_type="REGIONAL", + security_policy="TLS_1_2", + )) + example_record = aws.route53.Record("exampleRecord", + name=example_domain_name.domain_name, + type="A", + zone_id=aws_route53_zone["example"]["zone_id"], + aliases=[aws.route53.RecordAliasArgs( + name=example_domain_name.domain_name_configuration.target_domain_name, + zone_id=example_domain_name.domain_name_configuration.hosted_zone_id, + evaluate_target_health=False, + )]) + ``` + ```csharp + using System.Collections.Generic; + using System.Linq; + using Pulumi; + using Aws = Pulumi.Aws; + + return await Deployment.RunAsync(() => + { + var exampleDomainName = new Aws.ApiGatewayV2.DomainName("exampleDomainName", new() + { + Domain = "http-api.example.com", + DomainNameConfiguration = new Aws.ApiGatewayV2.Inputs.DomainNameDomainNameConfigurationArgs + { + CertificateArn = aws_acm_certificate.Example.Arn, + EndpointType = "REGIONAL", + SecurityPolicy = "TLS_1_2", + }, + }); + + var exampleRecord = new Aws.Route53.Record("exampleRecord", new() + { + Name = exampleDomainName.Domain, + Type = "A", + ZoneId = aws_route53_zone.Example.Zone_id, + Aliases = new[] + { + new Aws.Route53.Inputs.RecordAliasArgs + { + Name = exampleDomainName.DomainNameConfiguration.Apply(domainNameConfiguration => domainNameConfiguration.TargetDomainName), + ZoneId = exampleDomainName.DomainNameConfiguration.Apply(domainNameConfiguration => domainNameConfiguration.HostedZoneId), + EvaluateTargetHealth = false, + }, + }, + }); + + }); + ``` + ```go + package main + + import ( + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + ) + + func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + exampleDomainName, err := apigatewayv2.NewDomainName(ctx, "exampleDomainName", &apigatewayv2.DomainNameArgs{ + DomainName: pulumi.String("http-api.example.com"), + DomainNameConfiguration: &apigatewayv2.DomainNameDomainNameConfigurationArgs{ + CertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn), + EndpointType: pulumi.String("REGIONAL"), + SecurityPolicy: pulumi.String("TLS_1_2"), + }, + }) + if err != nil { + return err + } + _, err = route53.NewRecord(ctx, "exampleRecord", &route53.RecordArgs{ + Name: exampleDomainName.DomainName, + Type: pulumi.String("A"), + ZoneId: pulumi.Any(aws_route53_zone.Example.Zone_id), + Aliases: route53.RecordAliasArray{ + &route53.RecordAliasArgs{ + Name: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) { + return &domainNameConfiguration.TargetDomainName, nil + }).(pulumi.StringPtrOutput), + ZoneId: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) { + return &domainNameConfiguration.HostedZoneId, nil + }).(pulumi.StringPtrOutput), + EvaluateTargetHealth: pulumi.Bool(false), + }, + }, + }) + if err != nil { + return err + } + return nil + }) + } + ``` + ```java + package generated_program; + + import com.pulumi.Context; + import com.pulumi.Pulumi; + import com.pulumi.core.Output; + import com.pulumi.aws.apigatewayv2.DomainName; + import com.pulumi.aws.apigatewayv2.DomainNameArgs; + import com.pulumi.aws.apigatewayv2.inputs.DomainNameDomainNameConfigurationArgs; + import com.pulumi.aws.route53.Record; + import com.pulumi.aws.route53.RecordArgs; + import com.pulumi.aws.route53.inputs.RecordAliasArgs; + import java.util.List; + import java.util.ArrayList; + import java.util.Map; + import java.io.File; + import java.nio.file.Files; + import java.nio.file.Paths; + + public class App { + public static void main(String[] args) { + Pulumi.run(App::stack); + } + + public static void stack(Context ctx) { + var exampleDomainName = new DomainName("exampleDomainName", DomainNameArgs.builder() + .domainName("http-api.example.com") + .domainNameConfiguration(DomainNameDomainNameConfigurationArgs.builder() + .certificateArn(aws_acm_certificate.example().arn()) + .endpointType("REGIONAL") + .securityPolicy("TLS_1_2") + .build()) + .build()); + + var exampleRecord = new Record("exampleRecord", RecordArgs.builder() + .name(exampleDomainName.domainName()) + .type("A") + .zoneId(aws_route53_zone.example().zone_id()) + .aliases(RecordAliasArgs.builder() + .name(exampleDomainName.domainNameConfiguration().applyValue(domainNameConfiguration -> domainNameConfiguration.targetDomainName())) + .zoneId(exampleDomainName.domainNameConfiguration().applyValue(domainNameConfiguration -> domainNameConfiguration.hostedZoneId())) + .evaluateTargetHealth(false) + .build()) + .build()); + + } + } + ``` + ```yaml + resources: + exampleDomainName: + type: aws:apigatewayv2:DomainName + properties: + domainName: http-api.example.com + domainNameConfiguration: + certificateArn: ${aws_acm_certificate.example.arn} + endpointType: REGIONAL + securityPolicy: TLS_1_2 + exampleRecord: + type: aws:route53:Record + properties: + name: ${exampleDomainName.domainName} + type: A + zoneId: ${aws_route53_zone.example.zone_id} + aliases: + - name: ${exampleDomainName.domainNameConfiguration.targetDomainName} + zoneId: ${exampleDomainName.domainNameConfiguration.hostedZoneId} + evaluateTargetHealth: false + ``` + {{% /example %}} + {{% /examples %}} + + ## Import + + Using `pulumi import`, import `aws_apigatewayv2_domain_name` using the domain name. For example: + + ```sh + $ pulumi import aws:apigatewayv2/domainName:DomainName example ws-api.example.com + ``` + + :param pulumi.Input['pulumi_aws.apigatewayv2.DomainNameDomainNameConfigurationArgs'] domain_name_configuration: Domain name configuration. See below. + :param pulumi.Input['pulumi_aws.apigatewayv2.DomainNameMutualTlsAuthenticationArgs'] mutual_tls_authentication: Mutual TLS authentication configuration for the domain name. + :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + """ + if domain_name_configuration is not None: + pulumi.set(__self__, "domain_name_configuration", domain_name_configuration) + if mutual_tls_authentication is not None: + pulumi.set(__self__, "mutual_tls_authentication", mutual_tls_authentication) + if tags is not None: + pulumi.set(__self__, "tags", tags) + + @property + @pulumi.getter(name="domainNameConfiguration") + def domain_name_configuration(self) -> Optional[pulumi.Input['pulumi_aws.apigatewayv2.DomainNameDomainNameConfigurationArgs']]: + """ + Domain name configuration. See below. + """ + return pulumi.get(self, "domain_name_configuration") + + @domain_name_configuration.setter + def domain_name_configuration(self, value: Optional[pulumi.Input['pulumi_aws.apigatewayv2.DomainNameDomainNameConfigurationArgs']]): + pulumi.set(self, "domain_name_configuration", value) + + @property + @pulumi.getter(name="mutualTlsAuthentication") + def mutual_tls_authentication(self) -> Optional[pulumi.Input['pulumi_aws.apigatewayv2.DomainNameMutualTlsAuthenticationArgs']]: + """ + Mutual TLS authentication configuration for the domain name. + """ + return pulumi.get(self, "mutual_tls_authentication") + + @mutual_tls_authentication.setter + def mutual_tls_authentication(self, value: Optional[pulumi.Input['pulumi_aws.apigatewayv2.DomainNameMutualTlsAuthenticationArgs']]): + pulumi.set(self, "mutual_tls_authentication", value) + + @property + @pulumi.getter + def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]: + """ + Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + """ + return pulumi.get(self, "tags") + + @tags.setter + def tags(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]): + pulumi.set(self, "tags", value) + + +@pulumi.input_type +class DomainMappingArgs: + def __init__(__self__, *, + domain_configuration: Optional[pulumi.Input['DomainConfigurationArgs']] = None, + domain_id: Optional[pulumi.Input[str]] = None): + """ + :param pulumi.Input['DomainConfigurationArgs'] domain_configuration: Configuration of the domain name to create. Cannot be specified together with `domainId`. + :param pulumi.Input[str] domain_id: Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + """ + if domain_configuration is not None: + pulumi.set(__self__, "domain_configuration", domain_configuration) + if domain_id is not None: + pulumi.set(__self__, "domain_id", domain_id) + + @property + @pulumi.getter(name="domainConfiguration") + def domain_configuration(self) -> Optional[pulumi.Input['DomainConfigurationArgs']]: + """ + Configuration of the domain name to create. Cannot be specified together with `domainId`. + """ + return pulumi.get(self, "domain_configuration") + + @domain_configuration.setter + def domain_configuration(self, value: Optional[pulumi.Input['DomainConfigurationArgs']]): + pulumi.set(self, "domain_configuration", value) + + @property + @pulumi.getter(name="domainId") + def domain_id(self) -> Optional[pulumi.Input[str]]: + """ + Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + """ + return pulumi.get(self, "domain_id") + + @domain_id.setter + def domain_id(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "domain_id", value) + + +@pulumi.input_type +class HttpAuthorizerArgs: + def __init__(__self__): + pass + + +@pulumi.input_type +class HttpIntegrationArgs: + def __init__(__self__): + pass + + +@pulumi.input_type +class HttpRouteArgs: + def __init__(__self__, *, + authorizer: Optional[pulumi.Input[str]] = None, + integration: Optional[pulumi.Input[str]] = None): + """ + :param pulumi.Input[str] authorizer: The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + :param pulumi.Input[str] integration: The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + """ + if authorizer is not None: + pulumi.set(__self__, "authorizer", authorizer) + if integration is not None: + pulumi.set(__self__, "integration", integration) + + @property + @pulumi.getter + def authorizer(self) -> Optional[pulumi.Input[str]]: + """ + The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + """ + return pulumi.get(self, "authorizer") + + @authorizer.setter + def authorizer(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "authorizer", value) + + @property + @pulumi.getter + def integration(self) -> Optional[pulumi.Input[str]]: + """ + The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + """ + return pulumi.get(self, "integration") + + @integration.setter + def integration(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "integration", value) + + +@pulumi.input_type +class HttpStageArgs: + def __init__(__self__): + pass + + diff --git a/sdk/python/pulumi_awsx/apigatewayv2/http_api.py b/sdk/python/pulumi_awsx/apigatewayv2/http_api.py new file mode 100644 index 000000000..c970cd06d --- /dev/null +++ b/sdk/python/pulumi_awsx/apigatewayv2/http_api.py @@ -0,0 +1,484 @@ +# coding=utf-8 +# *** WARNING: this file was generated by pulumi-gen-awsx. *** +# *** Do not edit by hand unless you're certain you know what you are doing! *** + +import copy +import warnings +import pulumi +import pulumi.runtime +from typing import Any, Mapping, Optional, Sequence, Union, overload +from .. import _utilities +from ._inputs import * +import pulumi_aws + +__all__ = ['HttpApiArgs', 'HttpApi'] + +@pulumi.input_type +class HttpApiArgs: + def __init__(__self__, *, + routes: pulumi.Input[Mapping[str, pulumi.Input['HttpRouteArgs']]], + api_key_selection_expression: Optional[pulumi.Input[str]] = None, + authorizers: Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpAuthorizerArgs']]]] = None, + body: Optional[pulumi.Input[str]] = None, + cors_configuration: Optional[pulumi.Input['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs']] = None, + description: Optional[pulumi.Input[str]] = None, + disable_execute_api_endpoint: Optional[pulumi.Input[bool]] = None, + domain_mappings: Optional[pulumi.Input[Mapping[str, pulumi.Input['DomainMappingArgs']]]] = None, + fail_on_warnings: Optional[pulumi.Input[bool]] = None, + integrations: Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpIntegrationArgs']]]] = None, + name: Optional[pulumi.Input[str]] = None, + route_selection_expression: Optional[pulumi.Input[str]] = None, + stages: Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpStageArgs']]]] = None, + tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, + version: Optional[pulumi.Input[str]] = None): + """ + The set of arguments for constructing a HttpApi resource. + :param pulumi.Input[Mapping[str, pulumi.Input['HttpRouteArgs']]] routes: The routes for the HTTP API. + :param pulumi.Input[str] api_key_selection_expression: An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). + Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. + Applicable for WebSocket APIs. + :param pulumi.Input[Mapping[str, pulumi.Input['HttpAuthorizerArgs']]] authorizers: The authorizers for the HTTP API routes. + :param pulumi.Input[str] body: An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. + :param pulumi.Input['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs'] cors_configuration: Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. + :param pulumi.Input[str] description: Description of the API. Must be less than or equal to 1024 characters in length. + :param pulumi.Input[bool] disable_execute_api_endpoint: Whether clients can invoke the API by using the default `execute-api` endpoint. + By default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`. + To require that clients use a custom domain name to invoke the API, disable the default endpoint. + :param pulumi.Input[Mapping[str, pulumi.Input['DomainMappingArgs']]] domain_mappings: The domain names for the HTTP API. + :param pulumi.Input[bool] fail_on_warnings: Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. + :param pulumi.Input[Mapping[str, pulumi.Input['HttpIntegrationArgs']]] integrations: The integrations for the HTTP API routes. + :param pulumi.Input[str] name: Name of the API. Must be less than or equal to 128 characters in length. + :param pulumi.Input[str] route_selection_expression: The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. + Defaults to `$request.method $request.path`. + :param pulumi.Input[Mapping[str, pulumi.Input['HttpStageArgs']]] stages: The deployment stages for the HTTP API. + :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + :param pulumi.Input[str] version: Version identifier for the API. Must be between 1 and 64 characters in length. + """ + pulumi.set(__self__, "routes", routes) + if api_key_selection_expression is not None: + pulumi.set(__self__, "api_key_selection_expression", api_key_selection_expression) + if authorizers is not None: + pulumi.set(__self__, "authorizers", authorizers) + if body is not None: + pulumi.set(__self__, "body", body) + if cors_configuration is not None: + pulumi.set(__self__, "cors_configuration", cors_configuration) + if description is not None: + pulumi.set(__self__, "description", description) + if disable_execute_api_endpoint is not None: + pulumi.set(__self__, "disable_execute_api_endpoint", disable_execute_api_endpoint) + if domain_mappings is not None: + pulumi.set(__self__, "domain_mappings", domain_mappings) + if fail_on_warnings is not None: + pulumi.set(__self__, "fail_on_warnings", fail_on_warnings) + if integrations is not None: + pulumi.set(__self__, "integrations", integrations) + if name is not None: + pulumi.set(__self__, "name", name) + if route_selection_expression is not None: + pulumi.set(__self__, "route_selection_expression", route_selection_expression) + if stages is not None: + pulumi.set(__self__, "stages", stages) + if tags is not None: + pulumi.set(__self__, "tags", tags) + if version is not None: + pulumi.set(__self__, "version", version) + + @property + @pulumi.getter + def routes(self) -> pulumi.Input[Mapping[str, pulumi.Input['HttpRouteArgs']]]: + """ + The routes for the HTTP API. + """ + return pulumi.get(self, "routes") + + @routes.setter + def routes(self, value: pulumi.Input[Mapping[str, pulumi.Input['HttpRouteArgs']]]): + pulumi.set(self, "routes", value) + + @property + @pulumi.getter(name="apiKeySelectionExpression") + def api_key_selection_expression(self) -> Optional[pulumi.Input[str]]: + """ + An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). + Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. + Applicable for WebSocket APIs. + """ + return pulumi.get(self, "api_key_selection_expression") + + @api_key_selection_expression.setter + def api_key_selection_expression(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "api_key_selection_expression", value) + + @property + @pulumi.getter + def authorizers(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpAuthorizerArgs']]]]: + """ + The authorizers for the HTTP API routes. + """ + return pulumi.get(self, "authorizers") + + @authorizers.setter + def authorizers(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpAuthorizerArgs']]]]): + pulumi.set(self, "authorizers", value) + + @property + @pulumi.getter + def body(self) -> Optional[pulumi.Input[str]]: + """ + An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. + """ + return pulumi.get(self, "body") + + @body.setter + def body(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "body", value) + + @property + @pulumi.getter(name="corsConfiguration") + def cors_configuration(self) -> Optional[pulumi.Input['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs']]: + """ + Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. + """ + return pulumi.get(self, "cors_configuration") + + @cors_configuration.setter + def cors_configuration(self, value: Optional[pulumi.Input['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs']]): + pulumi.set(self, "cors_configuration", value) + + @property + @pulumi.getter + def description(self) -> Optional[pulumi.Input[str]]: + """ + Description of the API. Must be less than or equal to 1024 characters in length. + """ + return pulumi.get(self, "description") + + @description.setter + def description(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "description", value) + + @property + @pulumi.getter(name="disableExecuteApiEndpoint") + def disable_execute_api_endpoint(self) -> Optional[pulumi.Input[bool]]: + """ + Whether clients can invoke the API by using the default `execute-api` endpoint. + By default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`. + To require that clients use a custom domain name to invoke the API, disable the default endpoint. + """ + return pulumi.get(self, "disable_execute_api_endpoint") + + @disable_execute_api_endpoint.setter + def disable_execute_api_endpoint(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "disable_execute_api_endpoint", value) + + @property + @pulumi.getter(name="domainMappings") + def domain_mappings(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input['DomainMappingArgs']]]]: + """ + The domain names for the HTTP API. + """ + return pulumi.get(self, "domain_mappings") + + @domain_mappings.setter + def domain_mappings(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input['DomainMappingArgs']]]]): + pulumi.set(self, "domain_mappings", value) + + @property + @pulumi.getter(name="failOnWarnings") + def fail_on_warnings(self) -> Optional[pulumi.Input[bool]]: + """ + Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. + """ + return pulumi.get(self, "fail_on_warnings") + + @fail_on_warnings.setter + def fail_on_warnings(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "fail_on_warnings", value) + + @property + @pulumi.getter + def integrations(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpIntegrationArgs']]]]: + """ + The integrations for the HTTP API routes. + """ + return pulumi.get(self, "integrations") + + @integrations.setter + def integrations(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpIntegrationArgs']]]]): + pulumi.set(self, "integrations", value) + + @property + @pulumi.getter + def name(self) -> Optional[pulumi.Input[str]]: + """ + Name of the API. Must be less than or equal to 128 characters in length. + """ + return pulumi.get(self, "name") + + @name.setter + def name(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "name", value) + + @property + @pulumi.getter(name="routeSelectionExpression") + def route_selection_expression(self) -> Optional[pulumi.Input[str]]: + """ + The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. + Defaults to `$request.method $request.path`. + """ + return pulumi.get(self, "route_selection_expression") + + @route_selection_expression.setter + def route_selection_expression(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "route_selection_expression", value) + + @property + @pulumi.getter + def stages(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpStageArgs']]]]: + """ + The deployment stages for the HTTP API. + """ + return pulumi.get(self, "stages") + + @stages.setter + def stages(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpStageArgs']]]]): + pulumi.set(self, "stages", value) + + @property + @pulumi.getter + def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]: + """ + Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + """ + return pulumi.get(self, "tags") + + @tags.setter + def tags(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]): + pulumi.set(self, "tags", value) + + @property + @pulumi.getter + def version(self) -> Optional[pulumi.Input[str]]: + """ + Version identifier for the API. Must be between 1 and 64 characters in length. + """ + return pulumi.get(self, "version") + + @version.setter + def version(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "version", value) + + +class HttpApi(pulumi.CustomResource): + @overload + def __init__(__self__, + resource_name: str, + opts: Optional[pulumi.ResourceOptions] = None, + api_key_selection_expression: Optional[pulumi.Input[str]] = None, + authorizers: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpAuthorizerArgs']]]]] = None, + body: Optional[pulumi.Input[str]] = None, + cors_configuration: Optional[pulumi.Input[pulumi.InputType['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs']]] = None, + description: Optional[pulumi.Input[str]] = None, + disable_execute_api_endpoint: Optional[pulumi.Input[bool]] = None, + domain_mappings: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['DomainMappingArgs']]]]] = None, + fail_on_warnings: Optional[pulumi.Input[bool]] = None, + integrations: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpIntegrationArgs']]]]] = None, + name: Optional[pulumi.Input[str]] = None, + route_selection_expression: Optional[pulumi.Input[str]] = None, + routes: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpRouteArgs']]]]] = None, + stages: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpStageArgs']]]]] = None, + tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, + version: Optional[pulumi.Input[str]] = None, + __props__=None): + """ + Creates an HTTP API with associated sub-resources. + + :param str resource_name: The name of the resource. + :param pulumi.ResourceOptions opts: Options for the resource. + :param pulumi.Input[str] api_key_selection_expression: An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). + Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. + Applicable for WebSocket APIs. + :param pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpAuthorizerArgs']]]] authorizers: The authorizers for the HTTP API routes. + :param pulumi.Input[str] body: An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. + :param pulumi.Input[pulumi.InputType['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs']] cors_configuration: Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. + :param pulumi.Input[str] description: Description of the API. Must be less than or equal to 1024 characters in length. + :param pulumi.Input[bool] disable_execute_api_endpoint: Whether clients can invoke the API by using the default `execute-api` endpoint. + By default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`. + To require that clients use a custom domain name to invoke the API, disable the default endpoint. + :param pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['DomainMappingArgs']]]] domain_mappings: The domain names for the HTTP API. + :param pulumi.Input[bool] fail_on_warnings: Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. + :param pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpIntegrationArgs']]]] integrations: The integrations for the HTTP API routes. + :param pulumi.Input[str] name: Name of the API. Must be less than or equal to 128 characters in length. + :param pulumi.Input[str] route_selection_expression: The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. + Defaults to `$request.method $request.path`. + :param pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpRouteArgs']]]] routes: The routes for the HTTP API. + :param pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpStageArgs']]]] stages: The deployment stages for the HTTP API. + :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + :param pulumi.Input[str] version: Version identifier for the API. Must be between 1 and 64 characters in length. + """ + ... + @overload + def __init__(__self__, + resource_name: str, + args: HttpApiArgs, + opts: Optional[pulumi.ResourceOptions] = None): + """ + Creates an HTTP API with associated sub-resources. + + :param str resource_name: The name of the resource. + :param HttpApiArgs args: The arguments to use to populate this resource's properties. + :param pulumi.ResourceOptions opts: Options for the resource. + """ + ... + def __init__(__self__, resource_name: str, *args, **kwargs): + resource_args, opts = _utilities.get_resource_args_opts(HttpApiArgs, pulumi.ResourceOptions, *args, **kwargs) + if resource_args is not None: + __self__._internal_init(resource_name, opts, **resource_args.__dict__) + else: + __self__._internal_init(resource_name, *args, **kwargs) + + def _internal_init(__self__, + resource_name: str, + opts: Optional[pulumi.ResourceOptions] = None, + api_key_selection_expression: Optional[pulumi.Input[str]] = None, + authorizers: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpAuthorizerArgs']]]]] = None, + body: Optional[pulumi.Input[str]] = None, + cors_configuration: Optional[pulumi.Input[pulumi.InputType['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs']]] = None, + description: Optional[pulumi.Input[str]] = None, + disable_execute_api_endpoint: Optional[pulumi.Input[bool]] = None, + domain_mappings: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['DomainMappingArgs']]]]] = None, + fail_on_warnings: Optional[pulumi.Input[bool]] = None, + integrations: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpIntegrationArgs']]]]] = None, + name: Optional[pulumi.Input[str]] = None, + route_selection_expression: Optional[pulumi.Input[str]] = None, + routes: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpRouteArgs']]]]] = None, + stages: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpStageArgs']]]]] = None, + tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, + version: Optional[pulumi.Input[str]] = None, + __props__=None): + opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts) + if not isinstance(opts, pulumi.ResourceOptions): + raise TypeError('Expected resource options to be a ResourceOptions instance') + if opts.id is None: + if __props__ is not None: + raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource') + __props__ = HttpApiArgs.__new__(HttpApiArgs) + + __props__.__dict__["api_key_selection_expression"] = api_key_selection_expression + __props__.__dict__["authorizers"] = authorizers + __props__.__dict__["body"] = body + __props__.__dict__["cors_configuration"] = cors_configuration + __props__.__dict__["description"] = description + __props__.__dict__["disable_execute_api_endpoint"] = disable_execute_api_endpoint + __props__.__dict__["domain_mappings"] = domain_mappings + __props__.__dict__["fail_on_warnings"] = fail_on_warnings + __props__.__dict__["integrations"] = integrations + __props__.__dict__["name"] = name + __props__.__dict__["route_selection_expression"] = route_selection_expression + if routes is None and not opts.urn: + raise TypeError("Missing required property 'routes'") + __props__.__dict__["routes"] = routes + __props__.__dict__["stages"] = stages + __props__.__dict__["tags"] = tags + __props__.__dict__["version"] = version + __props__.__dict__["api"] = None + __props__.__dict__["api_mappings"] = None + __props__.__dict__["deployment"] = None + __props__.__dict__["domain_names"] = None + super(HttpApi, __self__).__init__( + 'awsx:apigatewayv2:HttpApi', + resource_name, + __props__, + opts) + + @staticmethod + def get(resource_name: str, + id: pulumi.Input[str], + opts: Optional[pulumi.ResourceOptions] = None) -> 'HttpApi': + """ + Get an existing HttpApi resource's state with the given name, id, and optional extra + properties used to qualify the lookup. + + :param str resource_name: The unique name of the resulting resource. + :param pulumi.Input[str] id: The unique provider ID of the resource to lookup. + :param pulumi.ResourceOptions opts: Options for the resource. + """ + opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) + + __props__ = HttpApiArgs.__new__(HttpApiArgs) + + __props__.__dict__["api"] = None + __props__.__dict__["api_mappings"] = None + __props__.__dict__["authorizers"] = None + __props__.__dict__["deployment"] = None + __props__.__dict__["domain_names"] = None + __props__.__dict__["integrations"] = None + __props__.__dict__["routes"] = None + __props__.__dict__["stages"] = None + return HttpApi(resource_name, opts=opts, __props__=__props__) + + @property + @pulumi.getter + def api(self) -> pulumi.Output['pulumi_aws.apigatewayv2.Api']: + """ + The underlying API resource. + """ + return pulumi.get(self, "api") + + @property + @pulumi.getter(name="apiMappings") + def api_mappings(self) -> pulumi.Output[Optional[Sequence['pulumi_aws.apigatewayv2.ApiMapping']]]: + """ + The API mappings for the HTTP API. + """ + return pulumi.get(self, "api_mappings") + + @property + @pulumi.getter + def authorizers(self) -> pulumi.Output[Sequence['pulumi_aws.apigatewayv2.Authorizer']]: + """ + The authorizers for the HTTP API routes. + """ + return pulumi.get(self, "authorizers") + + @property + @pulumi.getter + def deployment(self) -> pulumi.Output['pulumi_aws.apigatewayv2.Deployment']: + """ + The deployment for the HTTP API. + """ + return pulumi.get(self, "deployment") + + @property + @pulumi.getter(name="domainNames") + def domain_names(self) -> pulumi.Output[Sequence['pulumi_aws.apigatewayv2.DomainName']]: + """ + The domain names for the HTTP API. + """ + return pulumi.get(self, "domain_names") + + @property + @pulumi.getter + def integrations(self) -> pulumi.Output[Sequence['pulumi_aws.apigatewayv2.Integration']]: + """ + The integrations for the HTTP API routes. This is a map from integration name to the integration arguments. + """ + return pulumi.get(self, "integrations") + + @property + @pulumi.getter + def routes(self) -> pulumi.Output[Sequence['pulumi_aws.apigatewayv2.Route']]: + """ + The routes for the HTTP API. This is a map from route key (for example `GET /pets`) to route arguments. + """ + return pulumi.get(self, "routes") + + @property + @pulumi.getter + def stages(self) -> pulumi.Output[Sequence['pulumi_aws.apigatewayv2.Stage']]: + """ + The deployment stages for the HTTP API. + """ + return pulumi.get(self, "stages") + From 3e0b67873499b6771d11be781607dc876c4fe96b Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Wed, 22 Nov 2023 16:05:38 +0000 Subject: [PATCH 05/18] Tweak types to make them compatible Use TS type checking to check that the schema and TS types are mappable by assigning the generated type to the manual TS type. --- awsx/apigatewayv2/httpApi.ts | 13 +- awsx/schema-types.ts | 90 +++++++++++- schema.json | 220 +++++++++++++++++++++++++++++- schemagen/pkg/gen/apigatewayv2.go | 42 ++++-- schemagen/pkg/gen/ec2.go | 18 --- 5 files changed, 337 insertions(+), 46 deletions(-) diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts index b324ea9fa..f63b38771 100644 --- a/awsx/apigatewayv2/httpApi.ts +++ b/awsx/apigatewayv2/httpApi.ts @@ -33,12 +33,14 @@ type Route = Omit< type HttpIntegration = Omit< aws.apigatewayv2.IntegrationArgs, | "apiId" + | "integrationType" // Supported only for WebSocket APIs. | "requestTemplates" | "contentHandlingStrategy" | "passthroughBehavior" | "templateSelectionExpression" ->; +> & + Partial>; type LambdaIntegration = Omit & { lambda: aws.lambda.Function; @@ -67,7 +69,7 @@ type HttpApiArgs = Omit< }; export class HttpApi extends schema.HttpApi { - constructor(name: string, args: HttpApiArgs, opts?: pulumi.ComponentResourceOptions) { + constructor(name: string, args: schema.HttpApiArgs, opts?: pulumi.ComponentResourceOptions) { super(name, args, opts); const result = buildHttpApi(this, name, args); @@ -114,6 +116,12 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: HttpAp ), ); } else { + const { integrationType } = integrationInput; + if (integrationType === undefined) { + throw new Error( + `integrationType must be specified for custom integration ${integrationKey}`, + ); + } integrationsMap.set( integrationKey, new aws.apigatewayv2.Integration( @@ -121,6 +129,7 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: HttpAp { apiId: api.id, ...integrationInput, + integrationType, }, { parent }, ), diff --git a/awsx/schema-types.ts b/awsx/schema-types.ts index b5af6f1b8..9cc2d705d 100644 --- a/awsx/schema-types.ts +++ b/awsx/schema-types.ts @@ -40,18 +40,18 @@ export abstract class HttpApi extends (pulumi.ComponentResource); - readonly authorizers?: pulumi.Input>>; + readonly authorizers?: Record; readonly body?: pulumi.Input; readonly corsConfiguration?: pulumi.Input; readonly description?: pulumi.Input; readonly disableExecuteApiEndpoint?: pulumi.Input; - readonly domainMappings?: pulumi.Input>>; + readonly domainMappings?: Record; readonly failOnWarnings?: pulumi.Input; - readonly integrations?: pulumi.Input>>; + readonly integrations?: Record; readonly name?: pulumi.Input; readonly routeSelectionExpression?: pulumi.Input; - readonly routes: pulumi.Input>>; - readonly stages?: pulumi.Input>>; + readonly routes: Record; + readonly stages?: Record; readonly tags?: pulumi.Input>>; readonly version?: pulumi.Input; } @@ -399,32 +399,112 @@ export interface DomainConfigurationOutputs { readonly tags?: pulumi.Output>; } export interface DomainMappingInputs { + readonly apiMappingKey?: pulumi.Input; readonly domainConfiguration?: pulumi.Input; readonly domainId?: pulumi.Input; + readonly stage?: pulumi.Input; } export interface DomainMappingOutputs { + readonly apiMappingKey?: pulumi.Output; readonly domainConfiguration?: pulumi.Output; readonly domainId?: pulumi.Output; + readonly stage?: pulumi.Output; } export interface HttpAuthorizerInputs { + readonly authorizerCredentialsArn?: pulumi.Input; + readonly authorizerPayloadFormatVersion?: pulumi.Input; + readonly authorizerResultTtlInSeconds?: pulumi.Input; + readonly authorizerType: pulumi.Input; + readonly authorizerUri?: pulumi.Input; + readonly enableSimpleResponses?: pulumi.Input; + readonly identitySources?: pulumi.Input[]>; + readonly jwtConfiguration?: pulumi.Input; + readonly name?: pulumi.Input; } export interface HttpAuthorizerOutputs { + readonly authorizerCredentialsArn?: pulumi.Output; + readonly authorizerPayloadFormatVersion?: pulumi.Output; + readonly authorizerResultTtlInSeconds?: pulumi.Output; + readonly authorizerType: pulumi.Output; + readonly authorizerUri?: pulumi.Output; + readonly enableSimpleResponses?: pulumi.Output; + readonly identitySources?: pulumi.Output; + readonly jwtConfiguration?: pulumi.Output; + readonly name?: pulumi.Output; } export interface HttpIntegrationInputs { + readonly connectionId?: pulumi.Input; + readonly connectionType?: pulumi.Input; + readonly credentialsArn?: pulumi.Input; + readonly description?: pulumi.Input; + readonly integrationMethod?: pulumi.Input; + readonly integrationSubtype?: pulumi.Input; + readonly integrationType?: pulumi.Input; + readonly integrationUri?: pulumi.Input; + readonly payloadFormatVersion?: pulumi.Input; + readonly requestParameters?: pulumi.Input>>; + readonly responseParameters?: pulumi.Input[]>; + readonly timeoutMilliseconds?: pulumi.Input; + readonly tlsConfig?: pulumi.Input; } export interface HttpIntegrationOutputs { + readonly connectionId?: pulumi.Output; + readonly connectionType?: pulumi.Output; + readonly credentialsArn?: pulumi.Output; + readonly description?: pulumi.Output; + readonly integrationMethod?: pulumi.Output; + readonly integrationSubtype?: pulumi.Output; + readonly integrationType?: pulumi.Output; + readonly integrationUri?: pulumi.Output; + readonly payloadFormatVersion?: pulumi.Output; + readonly requestParameters?: pulumi.Output>; + readonly responseParameters?: pulumi.Output; + readonly timeoutMilliseconds?: pulumi.Output; + readonly tlsConfig?: pulumi.Output; } export interface HttpRouteInputs { + readonly apiKeyRequired?: pulumi.Input; + readonly authorizationScopes?: pulumi.Input[]>; + readonly authorizationType?: pulumi.Input; readonly authorizer?: pulumi.Input; + readonly authorizerId?: pulumi.Input; readonly integration?: pulumi.Input; + readonly operationName?: pulumi.Input; + readonly target?: pulumi.Input; } export interface HttpRouteOutputs { + readonly apiKeyRequired?: pulumi.Output; + readonly authorizationScopes?: pulumi.Output; + readonly authorizationType?: pulumi.Output; readonly authorizer?: pulumi.Output; + readonly authorizerId?: pulumi.Output; readonly integration?: pulumi.Output; + readonly operationName?: pulumi.Output; + readonly target?: pulumi.Output; } export interface HttpStageInputs { + readonly accessLogSettings?: pulumi.Input; + readonly autoDeploy?: pulumi.Input; + readonly clientCertificateId?: pulumi.Input; + readonly defaultRouteSettings?: pulumi.Input; + readonly deploymentId?: pulumi.Input; + readonly description?: pulumi.Input; + readonly name?: pulumi.Input; + readonly routeSettings?: pulumi.Input[]>; + readonly stageVariables?: pulumi.Input>>; + readonly tags?: pulumi.Input>>; } export interface HttpStageOutputs { + readonly accessLogSettings?: pulumi.Output; + readonly autoDeploy?: pulumi.Output; + readonly clientCertificateId?: pulumi.Output; + readonly defaultRouteSettings?: pulumi.Output; + readonly deploymentId?: pulumi.Output; + readonly description?: pulumi.Output; + readonly name?: pulumi.Output; + readonly routeSettings?: pulumi.Output; + readonly stageVariables?: pulumi.Output>; + readonly tags?: pulumi.Output>; } export interface BucketInputs { readonly accelerationStatus?: pulumi.Input; diff --git a/schema.json b/schema.json index 7d2edc60a..5c24cd453 100644 --- a/schema.json +++ b/schema.json @@ -88,7 +88,12 @@ "type": "object" }, "awsx:apigatewayv2:DomainMapping": { + "description": "Manages an Amazon API Gateway Version 2 API mapping.\nMore information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html).\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Basic\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.ApiMapping(\"example\", {\n apiId: aws_apigatewayv2_api.example.id,\n domainName: aws_apigatewayv2_domain_name.example.id,\n stage: aws_apigatewayv2_stage.example.id,\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.ApiMapping(\"example\",\n api_id=aws_apigatewayv2_api[\"example\"][\"id\"],\n domain_name=aws_apigatewayv2_domain_name[\"example\"][\"id\"],\n stage=aws_apigatewayv2_stage[\"example\"][\"id\"])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.ApiMapping(\"example\", new()\n {\n ApiId = aws_apigatewayv2_api.Example.Id,\n DomainName = aws_apigatewayv2_domain_name.Example.Id,\n Stage = aws_apigatewayv2_stage.Example.Id,\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewApiMapping(ctx, \"example\", \u0026apigatewayv2.ApiMappingArgs{\n\t\t\tApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),\n\t\t\tDomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id),\n\t\t\tStage: pulumi.Any(aws_apigatewayv2_stage.Example.Id),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.ApiMapping;\nimport com.pulumi.aws.apigatewayv2.ApiMappingArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new ApiMapping(\"example\", ApiMappingArgs.builder() \n .apiId(aws_apigatewayv2_api.example().id())\n .domainName(aws_apigatewayv2_domain_name.example().id())\n .stage(aws_apigatewayv2_stage.example().id())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:ApiMapping\n properties:\n apiId: ${aws_apigatewayv2_api.example.id}\n domainName: ${aws_apigatewayv2_domain_name.example.id}\n stage: ${aws_apigatewayv2_stage.example.id}\n```\n{{% /example %}}\n{{% /examples %}}\n\n## Import\n\nUsing `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example:\n\n```sh\n $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com\n```\n ", "properties": { + "apiMappingKey": { + "type": "string", + "description": "The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html).\n" + }, "domainConfiguration": { "$ref": "#/types/awsx:apigatewayv2:DomainConfiguration", "description": "Configuration of the domain name to create. Cannot be specified together with `domainId`." @@ -96,30 +101,223 @@ "domainId": { "type": "string", "description": "Identifier of an existing domain. Cannot be specified together with `domainConfiguration`." + }, + "stage": { + "type": "string", + "description": "API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage.\n" } }, "type": "object" }, "awsx:apigatewayv2:HttpAuthorizer": { - "type": "object" + "description": "Manages an Amazon API Gateway Version 2 authorizer.\nMore information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html).\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Basic WebSocket API\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.Authorizer(\"example\", {\n apiId: aws_apigatewayv2_api.example.id,\n authorizerType: \"REQUEST\",\n authorizerUri: aws_lambda_function.example.invoke_arn,\n identitySources: [\"route.request.header.Auth\"],\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.Authorizer(\"example\",\n api_id=aws_apigatewayv2_api[\"example\"][\"id\"],\n authorizer_type=\"REQUEST\",\n authorizer_uri=aws_lambda_function[\"example\"][\"invoke_arn\"],\n identity_sources=[\"route.request.header.Auth\"])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.Authorizer(\"example\", new()\n {\n ApiId = aws_apigatewayv2_api.Example.Id,\n AuthorizerType = \"REQUEST\",\n AuthorizerUri = aws_lambda_function.Example.Invoke_arn,\n IdentitySources = new[]\n {\n \"route.request.header.Auth\",\n },\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewAuthorizer(ctx, \"example\", \u0026apigatewayv2.AuthorizerArgs{\n\t\t\tApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),\n\t\t\tAuthorizerType: pulumi.String(\"REQUEST\"),\n\t\t\tAuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn),\n\t\t\tIdentitySources: pulumi.StringArray{\n\t\t\t\tpulumi.String(\"route.request.header.Auth\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.Authorizer;\nimport com.pulumi.aws.apigatewayv2.AuthorizerArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new Authorizer(\"example\", AuthorizerArgs.builder() \n .apiId(aws_apigatewayv2_api.example().id())\n .authorizerType(\"REQUEST\")\n .authorizerUri(aws_lambda_function.example().invoke_arn())\n .identitySources(\"route.request.header.Auth\")\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:Authorizer\n properties:\n apiId: ${aws_apigatewayv2_api.example.id}\n authorizerType: REQUEST\n authorizerUri: ${aws_lambda_function.example.invoke_arn}\n identitySources:\n - route.request.header.Auth\n```\n{{% /example %}}\n{{% example %}}\n### Basic HTTP API\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.Authorizer(\"example\", {\n apiId: aws_apigatewayv2_api.example.id,\n authorizerType: \"REQUEST\",\n authorizerUri: aws_lambda_function.example.invoke_arn,\n identitySources: [\"$request.header.Authorization\"],\n authorizerPayloadFormatVersion: \"2.0\",\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.Authorizer(\"example\",\n api_id=aws_apigatewayv2_api[\"example\"][\"id\"],\n authorizer_type=\"REQUEST\",\n authorizer_uri=aws_lambda_function[\"example\"][\"invoke_arn\"],\n identity_sources=[\"$request.header.Authorization\"],\n authorizer_payload_format_version=\"2.0\")\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.Authorizer(\"example\", new()\n {\n ApiId = aws_apigatewayv2_api.Example.Id,\n AuthorizerType = \"REQUEST\",\n AuthorizerUri = aws_lambda_function.Example.Invoke_arn,\n IdentitySources = new[]\n {\n \"$request.header.Authorization\",\n },\n AuthorizerPayloadFormatVersion = \"2.0\",\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewAuthorizer(ctx, \"example\", \u0026apigatewayv2.AuthorizerArgs{\n\t\t\tApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),\n\t\t\tAuthorizerType: pulumi.String(\"REQUEST\"),\n\t\t\tAuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn),\n\t\t\tIdentitySources: pulumi.StringArray{\n\t\t\t\tpulumi.String(\"$request.header.Authorization\"),\n\t\t\t},\n\t\t\tAuthorizerPayloadFormatVersion: pulumi.String(\"2.0\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.Authorizer;\nimport com.pulumi.aws.apigatewayv2.AuthorizerArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new Authorizer(\"example\", AuthorizerArgs.builder() \n .apiId(aws_apigatewayv2_api.example().id())\n .authorizerType(\"REQUEST\")\n .authorizerUri(aws_lambda_function.example().invoke_arn())\n .identitySources(\"$request.header.Authorization\")\n .authorizerPayloadFormatVersion(\"2.0\")\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:Authorizer\n properties:\n apiId: ${aws_apigatewayv2_api.example.id}\n authorizerType: REQUEST\n authorizerUri: ${aws_lambda_function.example.invoke_arn}\n identitySources:\n - $request.header.Authorization\n authorizerPayloadFormatVersion: '2.0'\n```\n{{% /example %}}\n{{% /examples %}}\n\n## Import\n\nUsing `pulumi import`, import `aws_apigatewayv2_authorizer` using the API identifier and authorizer identifier. For example:\n\n```sh\n $ pulumi import aws:apigatewayv2/authorizer:Authorizer example aabbccddee/1122334\n```\n ", + "properties": { + "authorizerCredentialsArn": { + "type": "string", + "description": "Required credentials as an IAM role for API Gateway to invoke the authorizer.\nSupported only for `REQUEST` authorizers.\n" + }, + "authorizerPayloadFormatVersion": { + "type": "string", + "description": "Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers.\nValid values: `1.0`, `2.0`.\n" + }, + "authorizerResultTtlInSeconds": { + "type": "integer", + "description": "Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled.\nIf it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`.\nSupported only for HTTP API Lambda authorizers.\n" + }, + "authorizerType": { + "type": "string", + "description": "Authorizer type. Valid values: `JWT`, `REQUEST`.\nSpecify `REQUEST` for a Lambda function using incoming request parameters.\nFor HTTP APIs, specify `JWT` to use JSON Web Tokens.\n" + }, + "authorizerUri": { + "type": "string", + "description": "Authorizer's Uniform Resource Identifier (URI).\nFor `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invoke_arn` attribute of the `aws.lambda.Function` resource.\nSupported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length.\n" + }, + "enableSimpleResponses": { + "type": "boolean", + "description": "Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy.\nSupported only for HTTP APIs.\n" + }, + "identitySources": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Identity sources for which authorization is requested.\nFor `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters.\nFor `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests.\n" + }, + "jwtConfiguration": { + "$ref": "/aws/v6.9.0/schema.json#/types/aws:apigatewayv2/AuthorizerJwtConfiguration:AuthorizerJwtConfiguration", + "description": "Configuration of a JWT authorizer. Required for the `JWT` authorizer type.\nSupported only for HTTP APIs.\n" + }, + "name": { + "type": "string", + "description": "Name of the authorizer. Must be between 1 and 128 characters in length.\n" + } + }, + "type": "object", + "required": [ + "authorizerType" + ] }, "awsx:apigatewayv2:HttpIntegration": { + "description": "Manages an Amazon API Gateway Version 2 integration.\nMore information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html).\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Basic\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.Integration(\"example\", {\n apiId: aws_apigatewayv2_api.example.id,\n integrationType: \"MOCK\",\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.Integration(\"example\",\n api_id=aws_apigatewayv2_api[\"example\"][\"id\"],\n integration_type=\"MOCK\")\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.Integration(\"example\", new()\n {\n ApiId = aws_apigatewayv2_api.Example.Id,\n IntegrationType = \"MOCK\",\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewIntegration(ctx, \"example\", \u0026apigatewayv2.IntegrationArgs{\n\t\t\tApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),\n\t\t\tIntegrationType: pulumi.String(\"MOCK\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.Integration;\nimport com.pulumi.aws.apigatewayv2.IntegrationArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new Integration(\"example\", IntegrationArgs.builder() \n .apiId(aws_apigatewayv2_api.example().id())\n .integrationType(\"MOCK\")\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:Integration\n properties:\n apiId: ${aws_apigatewayv2_api.example.id}\n integrationType: MOCK\n```\n{{% /example %}}\n{{% example %}}\n### Lambda Integration\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst exampleFunction = new aws.lambda.Function(\"exampleFunction\", {\n code: new pulumi.asset.FileArchive(\"example.zip\"),\n role: aws_iam_role.example.arn,\n handler: \"index.handler\",\n runtime: \"nodejs16.x\",\n});\nconst exampleIntegration = new aws.apigatewayv2.Integration(\"exampleIntegration\", {\n apiId: aws_apigatewayv2_api.example.id,\n integrationType: \"AWS_PROXY\",\n connectionType: \"INTERNET\",\n contentHandlingStrategy: \"CONVERT_TO_TEXT\",\n description: \"Lambda example\",\n integrationMethod: \"POST\",\n integrationUri: exampleFunction.invokeArn,\n passthroughBehavior: \"WHEN_NO_MATCH\",\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample_function = aws.lambda_.Function(\"exampleFunction\",\n code=pulumi.FileArchive(\"example.zip\"),\n role=aws_iam_role[\"example\"][\"arn\"],\n handler=\"index.handler\",\n runtime=\"nodejs16.x\")\nexample_integration = aws.apigatewayv2.Integration(\"exampleIntegration\",\n api_id=aws_apigatewayv2_api[\"example\"][\"id\"],\n integration_type=\"AWS_PROXY\",\n connection_type=\"INTERNET\",\n content_handling_strategy=\"CONVERT_TO_TEXT\",\n description=\"Lambda example\",\n integration_method=\"POST\",\n integration_uri=example_function.invoke_arn,\n passthrough_behavior=\"WHEN_NO_MATCH\")\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var exampleFunction = new Aws.Lambda.Function(\"exampleFunction\", new()\n {\n Code = new FileArchive(\"example.zip\"),\n Role = aws_iam_role.Example.Arn,\n Handler = \"index.handler\",\n Runtime = \"nodejs16.x\",\n });\n\n var exampleIntegration = new Aws.ApiGatewayV2.Integration(\"exampleIntegration\", new()\n {\n ApiId = aws_apigatewayv2_api.Example.Id,\n IntegrationType = \"AWS_PROXY\",\n ConnectionType = \"INTERNET\",\n ContentHandlingStrategy = \"CONVERT_TO_TEXT\",\n Description = \"Lambda example\",\n IntegrationMethod = \"POST\",\n IntegrationUri = exampleFunction.InvokeArn,\n PassthroughBehavior = \"WHEN_NO_MATCH\",\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws\"\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\texampleFunction, err := lambda.NewFunction(ctx, \"exampleFunction\", \u0026lambda.FunctionArgs{\n\t\t\tCode: pulumi.NewFileArchive(\"example.zip\"),\n\t\t\tRole: pulumi.Any(aws_iam_role.Example.Arn),\n\t\t\tHandler: pulumi.String(\"index.handler\"),\n\t\t\tRuntime: pulumi.String(\"nodejs16.x\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = apigatewayv2.NewIntegration(ctx, \"exampleIntegration\", \u0026apigatewayv2.IntegrationArgs{\n\t\t\tApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),\n\t\t\tIntegrationType: pulumi.String(\"AWS_PROXY\"),\n\t\t\tConnectionType: pulumi.String(\"INTERNET\"),\n\t\t\tContentHandlingStrategy: pulumi.String(\"CONVERT_TO_TEXT\"),\n\t\t\tDescription: pulumi.String(\"Lambda example\"),\n\t\t\tIntegrationMethod: pulumi.String(\"POST\"),\n\t\t\tIntegrationUri: exampleFunction.InvokeArn,\n\t\t\tPassthroughBehavior: pulumi.String(\"WHEN_NO_MATCH\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.lambda.Function;\nimport com.pulumi.aws.lambda.FunctionArgs;\nimport com.pulumi.aws.apigatewayv2.Integration;\nimport com.pulumi.aws.apigatewayv2.IntegrationArgs;\nimport com.pulumi.asset.FileArchive;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var exampleFunction = new Function(\"exampleFunction\", FunctionArgs.builder() \n .code(new FileArchive(\"example.zip\"))\n .role(aws_iam_role.example().arn())\n .handler(\"index.handler\")\n .runtime(\"nodejs16.x\")\n .build());\n\n var exampleIntegration = new Integration(\"exampleIntegration\", IntegrationArgs.builder() \n .apiId(aws_apigatewayv2_api.example().id())\n .integrationType(\"AWS_PROXY\")\n .connectionType(\"INTERNET\")\n .contentHandlingStrategy(\"CONVERT_TO_TEXT\")\n .description(\"Lambda example\")\n .integrationMethod(\"POST\")\n .integrationUri(exampleFunction.invokeArn())\n .passthroughBehavior(\"WHEN_NO_MATCH\")\n .build());\n\n }\n}\n```\n```yaml\nresources:\n exampleFunction:\n type: aws:lambda:Function\n properties:\n code:\n fn::FileArchive: example.zip\n role: ${aws_iam_role.example.arn}\n handler: index.handler\n runtime: nodejs16.x\n exampleIntegration:\n type: aws:apigatewayv2:Integration\n properties:\n apiId: ${aws_apigatewayv2_api.example.id}\n integrationType: AWS_PROXY\n connectionType: INTERNET\n contentHandlingStrategy: CONVERT_TO_TEXT\n description: Lambda example\n integrationMethod: POST\n integrationUri: ${exampleFunction.invokeArn}\n passthroughBehavior: WHEN_NO_MATCH\n```\n{{% /example %}}\n{{% example %}}\n### AWS Service Integration\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.Integration(\"example\", {\n apiId: aws_apigatewayv2_api.example.id,\n credentialsArn: aws_iam_role.example.arn,\n description: \"SQS example\",\n integrationType: \"AWS_PROXY\",\n integrationSubtype: \"SQS-SendMessage\",\n requestParameters: {\n QueueUrl: \"$request.header.queueUrl\",\n MessageBody: \"$request.body.message\",\n },\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.Integration(\"example\",\n api_id=aws_apigatewayv2_api[\"example\"][\"id\"],\n credentials_arn=aws_iam_role[\"example\"][\"arn\"],\n description=\"SQS example\",\n integration_type=\"AWS_PROXY\",\n integration_subtype=\"SQS-SendMessage\",\n request_parameters={\n \"QueueUrl\": \"$request.header.queueUrl\",\n \"MessageBody\": \"$request.body.message\",\n })\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.Integration(\"example\", new()\n {\n ApiId = aws_apigatewayv2_api.Example.Id,\n CredentialsArn = aws_iam_role.Example.Arn,\n Description = \"SQS example\",\n IntegrationType = \"AWS_PROXY\",\n IntegrationSubtype = \"SQS-SendMessage\",\n RequestParameters = \n {\n { \"QueueUrl\", \"$request.header.queueUrl\" },\n { \"MessageBody\", \"$request.body.message\" },\n },\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewIntegration(ctx, \"example\", \u0026apigatewayv2.IntegrationArgs{\n\t\t\tApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),\n\t\t\tCredentialsArn: pulumi.Any(aws_iam_role.Example.Arn),\n\t\t\tDescription: pulumi.String(\"SQS example\"),\n\t\t\tIntegrationType: pulumi.String(\"AWS_PROXY\"),\n\t\t\tIntegrationSubtype: pulumi.String(\"SQS-SendMessage\"),\n\t\t\tRequestParameters: pulumi.StringMap{\n\t\t\t\t\"QueueUrl\": pulumi.String(\"$request.header.queueUrl\"),\n\t\t\t\t\"MessageBody\": pulumi.String(\"$request.body.message\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.Integration;\nimport com.pulumi.aws.apigatewayv2.IntegrationArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new Integration(\"example\", IntegrationArgs.builder() \n .apiId(aws_apigatewayv2_api.example().id())\n .credentialsArn(aws_iam_role.example().arn())\n .description(\"SQS example\")\n .integrationType(\"AWS_PROXY\")\n .integrationSubtype(\"SQS-SendMessage\")\n .requestParameters(Map.ofEntries(\n Map.entry(\"QueueUrl\", \"$request.header.queueUrl\"),\n Map.entry(\"MessageBody\", \"$request.body.message\")\n ))\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:Integration\n properties:\n apiId: ${aws_apigatewayv2_api.example.id}\n credentialsArn: ${aws_iam_role.example.arn}\n description: SQS example\n integrationType: AWS_PROXY\n integrationSubtype: SQS-SendMessage\n requestParameters:\n QueueUrl: $request.header.queueUrl\n MessageBody: $request.body.message\n```\n{{% /example %}}\n{{% example %}}\n### Private Integration\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.Integration(\"example\", {\n apiId: aws_apigatewayv2_api.example.id,\n credentialsArn: aws_iam_role.example.arn,\n description: \"Example with a load balancer\",\n integrationType: \"HTTP_PROXY\",\n integrationUri: aws_lb_listener.example.arn,\n integrationMethod: \"ANY\",\n connectionType: \"VPC_LINK\",\n connectionId: aws_apigatewayv2_vpc_link.example.id,\n tlsConfig: {\n serverNameToVerify: \"example.com\",\n },\n requestParameters: {\n \"append:header.authforintegration\": \"$context.authorizer.authorizerResponse\",\n \"overwrite:path\": \"staticValueForIntegration\",\n },\n responseParameters: [\n {\n statusCode: \"403\",\n mappings: {\n \"append:header.auth\": \"$context.authorizer.authorizerResponse\",\n },\n },\n {\n statusCode: \"200\",\n mappings: {\n \"overwrite:statuscode\": \"204\",\n },\n },\n ],\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.Integration(\"example\",\n api_id=aws_apigatewayv2_api[\"example\"][\"id\"],\n credentials_arn=aws_iam_role[\"example\"][\"arn\"],\n description=\"Example with a load balancer\",\n integration_type=\"HTTP_PROXY\",\n integration_uri=aws_lb_listener[\"example\"][\"arn\"],\n integration_method=\"ANY\",\n connection_type=\"VPC_LINK\",\n connection_id=aws_apigatewayv2_vpc_link[\"example\"][\"id\"],\n tls_config=aws.apigatewayv2.IntegrationTlsConfigArgs(\n server_name_to_verify=\"example.com\",\n ),\n request_parameters={\n \"append:header.authforintegration\": \"$context.authorizer.authorizerResponse\",\n \"overwrite:path\": \"staticValueForIntegration\",\n },\n response_parameters=[\n aws.apigatewayv2.IntegrationResponseParameterArgs(\n status_code=\"403\",\n mappings={\n \"append:header.auth\": \"$context.authorizer.authorizerResponse\",\n },\n ),\n aws.apigatewayv2.IntegrationResponseParameterArgs(\n status_code=\"200\",\n mappings={\n \"overwrite:statuscode\": \"204\",\n },\n ),\n ])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.Integration(\"example\", new()\n {\n ApiId = aws_apigatewayv2_api.Example.Id,\n CredentialsArn = aws_iam_role.Example.Arn,\n Description = \"Example with a load balancer\",\n IntegrationType = \"HTTP_PROXY\",\n IntegrationUri = aws_lb_listener.Example.Arn,\n IntegrationMethod = \"ANY\",\n ConnectionType = \"VPC_LINK\",\n ConnectionId = aws_apigatewayv2_vpc_link.Example.Id,\n TlsConfig = new Aws.ApiGatewayV2.Inputs.IntegrationTlsConfigArgs\n {\n ServerNameToVerify = \"example.com\",\n },\n RequestParameters = \n {\n { \"append:header.authforintegration\", \"$context.authorizer.authorizerResponse\" },\n { \"overwrite:path\", \"staticValueForIntegration\" },\n },\n ResponseParameters = new[]\n {\n new Aws.ApiGatewayV2.Inputs.IntegrationResponseParameterArgs\n {\n StatusCode = \"403\",\n Mappings = \n {\n { \"append:header.auth\", \"$context.authorizer.authorizerResponse\" },\n },\n },\n new Aws.ApiGatewayV2.Inputs.IntegrationResponseParameterArgs\n {\n StatusCode = \"200\",\n Mappings = \n {\n { \"overwrite:statuscode\", \"204\" },\n },\n },\n },\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewIntegration(ctx, \"example\", \u0026apigatewayv2.IntegrationArgs{\n\t\t\tApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),\n\t\t\tCredentialsArn: pulumi.Any(aws_iam_role.Example.Arn),\n\t\t\tDescription: pulumi.String(\"Example with a load balancer\"),\n\t\t\tIntegrationType: pulumi.String(\"HTTP_PROXY\"),\n\t\t\tIntegrationUri: pulumi.Any(aws_lb_listener.Example.Arn),\n\t\t\tIntegrationMethod: pulumi.String(\"ANY\"),\n\t\t\tConnectionType: pulumi.String(\"VPC_LINK\"),\n\t\t\tConnectionId: pulumi.Any(aws_apigatewayv2_vpc_link.Example.Id),\n\t\t\tTlsConfig: \u0026apigatewayv2.IntegrationTlsConfigArgs{\n\t\t\t\tServerNameToVerify: pulumi.String(\"example.com\"),\n\t\t\t},\n\t\t\tRequestParameters: pulumi.StringMap{\n\t\t\t\t\"append:header.authforintegration\": pulumi.String(\"$context.authorizer.authorizerResponse\"),\n\t\t\t\t\"overwrite:path\": pulumi.String(\"staticValueForIntegration\"),\n\t\t\t},\n\t\t\tResponseParameters: apigatewayv2.IntegrationResponseParameterArray{\n\t\t\t\t\u0026apigatewayv2.IntegrationResponseParameterArgs{\n\t\t\t\t\tStatusCode: pulumi.String(\"403\"),\n\t\t\t\t\tMappings: pulumi.StringMap{\n\t\t\t\t\t\t\"append:header.auth\": pulumi.String(\"$context.authorizer.authorizerResponse\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\u0026apigatewayv2.IntegrationResponseParameterArgs{\n\t\t\t\t\tStatusCode: pulumi.String(\"200\"),\n\t\t\t\t\tMappings: pulumi.StringMap{\n\t\t\t\t\t\t\"overwrite:statuscode\": pulumi.String(\"204\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.Integration;\nimport com.pulumi.aws.apigatewayv2.IntegrationArgs;\nimport com.pulumi.aws.apigatewayv2.inputs.IntegrationTlsConfigArgs;\nimport com.pulumi.aws.apigatewayv2.inputs.IntegrationResponseParameterArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new Integration(\"example\", IntegrationArgs.builder() \n .apiId(aws_apigatewayv2_api.example().id())\n .credentialsArn(aws_iam_role.example().arn())\n .description(\"Example with a load balancer\")\n .integrationType(\"HTTP_PROXY\")\n .integrationUri(aws_lb_listener.example().arn())\n .integrationMethod(\"ANY\")\n .connectionType(\"VPC_LINK\")\n .connectionId(aws_apigatewayv2_vpc_link.example().id())\n .tlsConfig(IntegrationTlsConfigArgs.builder()\n .serverNameToVerify(\"example.com\")\n .build())\n .requestParameters(Map.ofEntries(\n Map.entry(\"append:header.authforintegration\", \"$context.authorizer.authorizerResponse\"),\n Map.entry(\"overwrite:path\", \"staticValueForIntegration\")\n ))\n .responseParameters( \n IntegrationResponseParameterArgs.builder()\n .statusCode(403)\n .mappings(Map.of(\"append:header.auth\", \"$context.authorizer.authorizerResponse\"))\n .build(),\n IntegrationResponseParameterArgs.builder()\n .statusCode(200)\n .mappings(Map.of(\"overwrite:statuscode\", \"204\"))\n .build())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:Integration\n properties:\n apiId: ${aws_apigatewayv2_api.example.id}\n credentialsArn: ${aws_iam_role.example.arn}\n description: Example with a load balancer\n integrationType: HTTP_PROXY\n integrationUri: ${aws_lb_listener.example.arn}\n integrationMethod: ANY\n connectionType: VPC_LINK\n connectionId: ${aws_apigatewayv2_vpc_link.example.id}\n tlsConfig:\n serverNameToVerify: example.com\n requestParameters:\n append:header.authforintegration: $context.authorizer.authorizerResponse\n overwrite:path: staticValueForIntegration\n responseParameters:\n - statusCode: 403\n mappings:\n append:header.auth: $context.authorizer.authorizerResponse\n - statusCode: 200\n mappings:\n overwrite:statuscode: '204'\n```\n{{% /example %}}\n{{% /examples %}}\n\n## Import\n\nUsing `pulumi import`, import `aws_apigatewayv2_integration` using the API identifier and integration identifier. For example:\n\n```sh\n $ pulumi import aws:apigatewayv2/integration:Integration example aabbccddee/1122334\n```\n -\u003e __Note:__ The API Gateway managed integration created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported.\n\n", + "properties": { + "connectionId": { + "type": "string", + "description": "ID of the VPC link for a private integration. Supported only for HTTP APIs. Must be between 1 and 1024 characters in length.\n" + }, + "connectionType": { + "type": "string", + "description": "Type of the network connection to the integration endpoint. Valid values: `INTERNET`, `VPC_LINK`. Default is `INTERNET`.\n" + }, + "credentialsArn": { + "type": "string", + "description": "Credentials required for the integration, if any.\n" + }, + "description": { + "type": "string", + "description": "Description of the integration.\n" + }, + "integrationMethod": { + "type": "string", + "description": "Integration's HTTP method. Must be specified if `integration_type` is not `MOCK`.\n" + }, + "integrationSubtype": { + "type": "string", + "description": "AWS service action to invoke. Supported only for HTTP APIs when `integration_type` is `AWS_PROXY`. See the [AWS service integration reference](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html) documentation for supported values. Must be between 1 and 128 characters in length.\n", + "willReplaceOnChanges": true + }, + "integrationType": { + "type": "string", + "description": "Integration type of an integration.\nValid values: `AWS` (supported only for WebSocket APIs), `AWS_PROXY`, `HTTP` (supported only for WebSocket APIs), `HTTP_PROXY`, `MOCK` (supported only for WebSocket APIs). For an HTTP API private integration, use `HTTP_PROXY`.\n", + "willReplaceOnChanges": true + }, + "integrationUri": { + "type": "string", + "description": "URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`.\nFor an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service.\n" + }, + "payloadFormatVersion": { + "type": "string", + "description": "The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`.\n" + }, + "requestParameters": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "For WebSocket APIs, a key-value map specifying request parameters that are passed from the method request to the backend.\nFor HTTP APIs with a specified `integration_subtype`, a key-value map specifying parameters that are passed to `AWS_PROXY` integrations.\nFor HTTP APIs without a specified `integration_subtype`, a key-value map specifying how to transform HTTP requests before sending them to the backend.\nSee the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html) for details.\n" + }, + "responseParameters": { + "type": "array", + "items": { + "$ref": "/aws/v6.9.0/schema.json#/types/aws:apigatewayv2/IntegrationResponseParameter:IntegrationResponseParameter" + }, + "description": "Mappings to transform the HTTP response from a backend integration before returning the response to clients. Supported only for HTTP APIs.\n" + }, + "timeoutMilliseconds": { + "type": "integer", + "description": "Custom timeout between 50 and 29,000 milliseconds for WebSocket APIs and between 50 and 30,000 milliseconds for HTTP APIs.\nThe default timeout is 29 seconds for WebSocket APIs and 30 seconds for HTTP APIs.\nthis provider will only perform drift detection of its value when present in a configuration.\n" + }, + "tlsConfig": { + "$ref": "/aws/v6.9.0/schema.json#/types/aws:apigatewayv2/IntegrationTlsConfig:IntegrationTlsConfig", + "description": "TLS configuration for a private integration. Supported only for HTTP APIs.\n" + } + }, "type": "object" }, "awsx:apigatewayv2:HttpRoute": { + "description": "Manages an Amazon API Gateway Version 2 route.\nMore information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html) for [WebSocket](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-develop-routes.html) and [HTTP](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-routes.html) APIs.\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Basic\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst exampleApi = new aws.apigatewayv2.Api(\"exampleApi\", {\n protocolType: \"WEBSOCKET\",\n routeSelectionExpression: \"$request.body.action\",\n});\nconst exampleRoute = new aws.apigatewayv2.Route(\"exampleRoute\", {\n apiId: exampleApi.id,\n routeKey: \"$default\",\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample_api = aws.apigatewayv2.Api(\"exampleApi\",\n protocol_type=\"WEBSOCKET\",\n route_selection_expression=\"$request.body.action\")\nexample_route = aws.apigatewayv2.Route(\"exampleRoute\",\n api_id=example_api.id,\n route_key=\"$default\")\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var exampleApi = new Aws.ApiGatewayV2.Api(\"exampleApi\", new()\n {\n ProtocolType = \"WEBSOCKET\",\n RouteSelectionExpression = \"$request.body.action\",\n });\n\n var exampleRoute = new Aws.ApiGatewayV2.Route(\"exampleRoute\", new()\n {\n ApiId = exampleApi.Id,\n RouteKey = \"$default\",\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\texampleApi, err := apigatewayv2.NewApi(ctx, \"exampleApi\", \u0026apigatewayv2.ApiArgs{\n\t\t\tProtocolType: pulumi.String(\"WEBSOCKET\"),\n\t\t\tRouteSelectionExpression: pulumi.String(\"$request.body.action\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = apigatewayv2.NewRoute(ctx, \"exampleRoute\", \u0026apigatewayv2.RouteArgs{\n\t\t\tApiId: exampleApi.ID(),\n\t\t\tRouteKey: pulumi.String(\"$default\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.Api;\nimport com.pulumi.aws.apigatewayv2.ApiArgs;\nimport com.pulumi.aws.apigatewayv2.Route;\nimport com.pulumi.aws.apigatewayv2.RouteArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var exampleApi = new Api(\"exampleApi\", ApiArgs.builder() \n .protocolType(\"WEBSOCKET\")\n .routeSelectionExpression(\"$request.body.action\")\n .build());\n\n var exampleRoute = new Route(\"exampleRoute\", RouteArgs.builder() \n .apiId(exampleApi.id())\n .routeKey(\"$default\")\n .build());\n\n }\n}\n```\n```yaml\nresources:\n exampleApi:\n type: aws:apigatewayv2:Api\n properties:\n protocolType: WEBSOCKET\n routeSelectionExpression: $request.body.action\n exampleRoute:\n type: aws:apigatewayv2:Route\n properties:\n apiId: ${exampleApi.id}\n routeKey: $default\n```\n{{% /example %}}\n{{% example %}}\n### HTTP Proxy Integration\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst exampleApi = new aws.apigatewayv2.Api(\"exampleApi\", {protocolType: \"HTTP\"});\nconst exampleIntegration = new aws.apigatewayv2.Integration(\"exampleIntegration\", {\n apiId: exampleApi.id,\n integrationType: \"HTTP_PROXY\",\n integrationMethod: \"ANY\",\n integrationUri: \"https://example.com/{proxy}\",\n});\nconst exampleRoute = new aws.apigatewayv2.Route(\"exampleRoute\", {\n apiId: exampleApi.id,\n routeKey: \"ANY /example/{proxy+}\",\n target: pulumi.interpolate`integrations/${exampleIntegration.id}`,\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample_api = aws.apigatewayv2.Api(\"exampleApi\", protocol_type=\"HTTP\")\nexample_integration = aws.apigatewayv2.Integration(\"exampleIntegration\",\n api_id=example_api.id,\n integration_type=\"HTTP_PROXY\",\n integration_method=\"ANY\",\n integration_uri=\"https://example.com/{proxy}\")\nexample_route = aws.apigatewayv2.Route(\"exampleRoute\",\n api_id=example_api.id,\n route_key=\"ANY /example/{proxy+}\",\n target=example_integration.id.apply(lambda id: f\"integrations/{id}\"))\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var exampleApi = new Aws.ApiGatewayV2.Api(\"exampleApi\", new()\n {\n ProtocolType = \"HTTP\",\n });\n\n var exampleIntegration = new Aws.ApiGatewayV2.Integration(\"exampleIntegration\", new()\n {\n ApiId = exampleApi.Id,\n IntegrationType = \"HTTP_PROXY\",\n IntegrationMethod = \"ANY\",\n IntegrationUri = \"https://example.com/{proxy}\",\n });\n\n var exampleRoute = new Aws.ApiGatewayV2.Route(\"exampleRoute\", new()\n {\n ApiId = exampleApi.Id,\n RouteKey = \"ANY /example/{proxy+}\",\n Target = exampleIntegration.Id.Apply(id =\u003e $\"integrations/{id}\"),\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\texampleApi, err := apigatewayv2.NewApi(ctx, \"exampleApi\", \u0026apigatewayv2.ApiArgs{\n\t\t\tProtocolType: pulumi.String(\"HTTP\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\texampleIntegration, err := apigatewayv2.NewIntegration(ctx, \"exampleIntegration\", \u0026apigatewayv2.IntegrationArgs{\n\t\t\tApiId: exampleApi.ID(),\n\t\t\tIntegrationType: pulumi.String(\"HTTP_PROXY\"),\n\t\t\tIntegrationMethod: pulumi.String(\"ANY\"),\n\t\t\tIntegrationUri: pulumi.String(\"https://example.com/{proxy}\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = apigatewayv2.NewRoute(ctx, \"exampleRoute\", \u0026apigatewayv2.RouteArgs{\n\t\t\tApiId: exampleApi.ID(),\n\t\t\tRouteKey: pulumi.String(\"ANY /example/{proxy+}\"),\n\t\t\tTarget: exampleIntegration.ID().ApplyT(func(id string) (string, error) {\n\t\t\t\treturn fmt.Sprintf(\"integrations/%v\", id), nil\n\t\t\t}).(pulumi.StringOutput),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.Api;\nimport com.pulumi.aws.apigatewayv2.ApiArgs;\nimport com.pulumi.aws.apigatewayv2.Integration;\nimport com.pulumi.aws.apigatewayv2.IntegrationArgs;\nimport com.pulumi.aws.apigatewayv2.Route;\nimport com.pulumi.aws.apigatewayv2.RouteArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var exampleApi = new Api(\"exampleApi\", ApiArgs.builder() \n .protocolType(\"HTTP\")\n .build());\n\n var exampleIntegration = new Integration(\"exampleIntegration\", IntegrationArgs.builder() \n .apiId(exampleApi.id())\n .integrationType(\"HTTP_PROXY\")\n .integrationMethod(\"ANY\")\n .integrationUri(\"https://example.com/{proxy}\")\n .build());\n\n var exampleRoute = new Route(\"exampleRoute\", RouteArgs.builder() \n .apiId(exampleApi.id())\n .routeKey(\"ANY /example/{proxy+}\")\n .target(exampleIntegration.id().applyValue(id -\u003e String.format(\"integrations/%s\", id)))\n .build());\n\n }\n}\n```\n```yaml\nresources:\n exampleApi:\n type: aws:apigatewayv2:Api\n properties:\n protocolType: HTTP\n exampleIntegration:\n type: aws:apigatewayv2:Integration\n properties:\n apiId: ${exampleApi.id}\n integrationType: HTTP_PROXY\n integrationMethod: ANY\n integrationUri: https://example.com/{proxy}\n exampleRoute:\n type: aws:apigatewayv2:Route\n properties:\n apiId: ${exampleApi.id}\n routeKey: ANY /example/{proxy+}\n target: integrations/${exampleIntegration.id}\n```\n{{% /example %}}\n{{% /examples %}}\n\n## Import\n\nUsing `pulumi import`, import `aws_apigatewayv2_route` using the API identifier and route identifier. For example:\n\n```sh\n $ pulumi import aws:apigatewayv2/route:Route example aabbccddee/1122334\n```\n -\u003e __Note:__ The API Gateway managed route created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported.\n\n", "properties": { + "apiKeyRequired": { + "type": "boolean", + "description": "Boolean whether an API key is required for the route. Defaults to `false`. Supported only for WebSocket APIs.\n" + }, + "authorizationScopes": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation.\n" + }, + "authorizationType": { + "type": "string", + "description": "Authorization type for the route.\nFor WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer.\nFor HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer.\nDefaults to `NONE`.\n" + }, "authorizer": { "type": "string", "description": "The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route." }, + "authorizerId": { + "type": "string", + "description": "Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route.\n" + }, "integration": { "type": "string", "description": "The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified." + }, + "operationName": { + "type": "string", + "description": "Operation name for the route. Must be between 1 and 64 characters in length.\n" + }, + "target": { + "type": "string", + "description": "Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource.\n" } }, "type": "object" }, "awsx:apigatewayv2:HttpStage": { + "description": "Manages an Amazon API Gateway Version 2 stage.\nMore information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html).\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Basic\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.Stage(\"example\", {apiId: aws_apigatewayv2_api.example.id});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.Stage(\"example\", api_id=aws_apigatewayv2_api[\"example\"][\"id\"])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.Stage(\"example\", new()\n {\n ApiId = aws_apigatewayv2_api.Example.Id,\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewStage(ctx, \"example\", \u0026apigatewayv2.StageArgs{\n\t\t\tApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.Stage;\nimport com.pulumi.aws.apigatewayv2.StageArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new Stage(\"example\", StageArgs.builder() \n .apiId(aws_apigatewayv2_api.example().id())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:Stage\n properties:\n apiId: ${aws_apigatewayv2_api.example.id}\n```\n{{% /example %}}\n{{% /examples %}}\n\n## Import\n\nUsing `pulumi import`, import `aws_apigatewayv2_stage` using the API identifier and stage name. For example:\n\n```sh\n $ pulumi import aws:apigatewayv2/stage:Stage example aabbccddee/example-stage\n```\n -\u003e __Note:__ The API Gateway managed stage created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported.\n\n", + "properties": { + "accessLogSettings": { + "$ref": "/aws/v6.9.0/schema.json#/types/aws:apigatewayv2/StageAccessLogSettings:StageAccessLogSettings", + "description": "Settings for logging access in this stage.\nUse the `aws.apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions).\n" + }, + "autoDeploy": { + "type": "boolean", + "description": "Whether updates to an API automatically trigger a new deployment. Defaults to `false`. Applicable for HTTP APIs.\n" + }, + "clientCertificateId": { + "type": "string", + "description": "Identifier of a client certificate for the stage. Use the `aws.apigateway.ClientCertificate` resource to configure a client certificate.\nSupported only for WebSocket APIs.\n" + }, + "defaultRouteSettings": { + "$ref": "/aws/v6.9.0/schema.json#/types/aws:apigatewayv2/StageDefaultRouteSettings:StageDefaultRouteSettings", + "description": "Default route settings for the stage.\n" + }, + "deploymentId": { + "type": "string", + "description": "Deployment identifier of the stage. Use the `aws.apigatewayv2.Deployment` resource to configure a deployment.\n" + }, + "description": { + "type": "string", + "description": "Description for the stage. Must be less than or equal to 1024 characters in length.\n" + }, + "name": { + "type": "string", + "description": "Name of the stage. Must be between 1 and 128 characters in length.\n\nThe following arguments are optional:\n", + "willReplaceOnChanges": true + }, + "routeSettings": { + "type": "array", + "items": { + "$ref": "/aws/v6.9.0/schema.json#/types/aws:apigatewayv2/StageRouteSetting:StageRouteSetting" + }, + "description": "Route settings for the stage.\n" + }, + "stageVariables": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Map that defines the stage variables for the stage.\n" + }, + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Map of tags to assign to the stage. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.\n" + } + }, "type": "object" }, "awsx:awsx:Bucket": { @@ -1894,8 +2092,10 @@ "authorizers": { "type": "object", "additionalProperties": { - "$ref": "#/types/awsx:apigatewayv2:HttpAuthorizer" + "$ref": "#/types/awsx:apigatewayv2:HttpAuthorizer", + "plain": true }, + "plain": true, "description": "The authorizers for the HTTP API routes." }, "body": { @@ -1917,8 +2117,10 @@ "domainMappings": { "type": "object", "additionalProperties": { - "$ref": "#/types/awsx:apigatewayv2:DomainMapping" + "$ref": "#/types/awsx:apigatewayv2:DomainMapping", + "plain": true }, + "plain": true, "description": "The domain names for the HTTP API." }, "failOnWarnings": { @@ -1928,8 +2130,10 @@ "integrations": { "type": "object", "additionalProperties": { - "$ref": "#/types/awsx:apigatewayv2:HttpIntegration" + "$ref": "#/types/awsx:apigatewayv2:HttpIntegration", + "plain": true }, + "plain": true, "description": "The integrations for the HTTP API routes." }, "name": { @@ -1943,15 +2147,19 @@ "routes": { "type": "object", "additionalProperties": { - "$ref": "#/types/awsx:apigatewayv2:HttpRoute" + "$ref": "#/types/awsx:apigatewayv2:HttpRoute", + "plain": true }, + "plain": true, "description": "The routes for the HTTP API." }, "stages": { "type": "object", "additionalProperties": { - "$ref": "#/types/awsx:apigatewayv2:HttpStage" + "$ref": "#/types/awsx:apigatewayv2:HttpStage", + "plain": true }, + "plain": true, "description": "The deployment stages for the HTTP API." }, "tags": { diff --git a/schemagen/pkg/gen/apigatewayv2.go b/schemagen/pkg/gen/apigatewayv2.go index 3a6152f72..c90fce188 100644 --- a/schemagen/pkg/gen/apigatewayv2.go +++ b/schemagen/pkg/gen/apigatewayv2.go @@ -37,23 +37,23 @@ func httpApi(awsSpec schema.PackageSpec) schema.ResourceSpec { inputProperties := map[string]schema.PropertySpec{ "routes": { Description: "The routes for the HTTP API.", - TypeSpec: stringMapOfLocalRefs("apigatewayv2", "HttpRoute"), + TypeSpec: plainStringMapOfLocalRefs("apigatewayv2", "HttpRoute"), }, "integrations": { Description: "The integrations for the HTTP API routes.", - TypeSpec: stringMapOfLocalRefs("apigatewayv2", "HttpIntegration"), + TypeSpec: plainStringMapOfLocalRefs("apigatewayv2", "HttpIntegration"), }, "authorizers": { Description: "The authorizers for the HTTP API routes.", - TypeSpec: stringMapOfLocalRefs("apigatewayv2", "HttpAuthorizer"), + TypeSpec: plainStringMapOfLocalRefs("apigatewayv2", "HttpAuthorizer"), }, "stages": { Description: "The deployment stages for the HTTP API.", - TypeSpec: stringMapOfLocalRefs("apigatewayv2", "HttpStage"), + TypeSpec: plainStringMapOfLocalRefs("apigatewayv2", "HttpStage"), }, "domainMappings": { Description: "The domain names for the HTTP API.", - TypeSpec: stringMapOfLocalRefs("apigatewayv2", "DomainMapping"), + TypeSpec: plainStringMapOfLocalRefs("apigatewayv2", "DomainMapping"), }, } for k, v := range awsApiSpec.InputProperties { @@ -114,8 +114,8 @@ func httpApi(awsSpec schema.PackageSpec) schema.ResourceSpec { } func httpRoute(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { - original := awsSpec.Types["aws:apigatewayv2/route:Route"] - properties := renameAwsPropertiesRefs(awsSpec, original.Properties) + original := awsSpec.Resources["aws:apigatewayv2/route:Route"] + properties := renameAwsPropertiesRefs(awsSpec, original.InputProperties) delete(properties, "apiId") // Inferred from the map key delete(properties, "routeKey") @@ -146,8 +146,8 @@ func httpRoute(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { } func httpIntegration(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { - original := awsSpec.Types["aws:apigatewayv2/integration:Integration"] - properties := renameAwsPropertiesRefs(awsSpec, original.Properties) + original := awsSpec.Resources["aws:apigatewayv2/integration:Integration"] + properties := renameAwsPropertiesRefs(awsSpec, original.InputProperties) delete(properties, "apiId") // WebSocket specific properties delete(properties, "requestTemplates") @@ -164,21 +164,22 @@ func httpIntegration(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { } func httpAuthorizer(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { - original := awsSpec.Types["aws:apigatewayv2/authorizer:Authorizer"] - properties := renameAwsPropertiesRefs(awsSpec, original.Properties) + original := awsSpec.Resources["aws:apigatewayv2/authorizer:Authorizer"] + properties := renameAwsPropertiesRefs(awsSpec, original.InputProperties) delete(properties, "apiId") return schema.ComplexTypeSpec{ ObjectTypeSpec: schema.ObjectTypeSpec{ Type: "object", Description: original.Description, Properties: properties, + Required: []string{"authorizerType"}, }, } } func httpStage(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { - original := awsSpec.Types["aws:apigatewayv2/stage:Stage"] - properties := renameAwsPropertiesRefs(awsSpec, original.Properties) + original := awsSpec.Resources["aws:apigatewayv2/stage:Stage"] + properties := renameAwsPropertiesRefs(awsSpec, original.InputProperties) delete(properties, "apiId") return schema.ComplexTypeSpec{ ObjectTypeSpec: schema.ObjectTypeSpec{ @@ -190,8 +191,8 @@ func httpStage(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { } func domainMapping(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { - original := awsSpec.Types["aws:apigatewayv2/apiMapping:ApiMapping"] - properties := renameAwsPropertiesRefs(awsSpec, original.Properties) + original := awsSpec.Resources["aws:apigatewayv2/apiMapping:ApiMapping"] + properties := renameAwsPropertiesRefs(awsSpec, original.InputProperties) delete(properties, "apiId") delete(properties, "domainName") properties["domainConfiguration"] = schema.PropertySpec{ @@ -227,3 +228,14 @@ func domainConfiguration(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { }, } } + +func plainStringMapOfLocalRefs(module, name string) schema.TypeSpec { + return schema.TypeSpec{ + Type: "object", + AdditionalProperties: &schema.TypeSpec{ + Ref: localRef(module, name), + Plain: true, + }, + Plain: true, + } +} diff --git a/schemagen/pkg/gen/ec2.go b/schemagen/pkg/gen/ec2.go index 818f4ac91..5fa2e331c 100644 --- a/schemagen/pkg/gen/ec2.go +++ b/schemagen/pkg/gen/ec2.go @@ -241,24 +241,6 @@ func vpcResource(awsSpec schema.PackageSpec) schema.ResourceSpec { } } -func arrayOfLocalRefs(module, name string) schema.TypeSpec { - return schema.TypeSpec{ - Type: "array", - Items: &schema.TypeSpec{ - Ref: localRef(module, name), - }, - } -} - -func stringMapOfLocalRefs(module, name string) schema.TypeSpec { - return schema.TypeSpec{ - Type: "object", - AdditionalProperties: &schema.TypeSpec{ - Ref: localRef(module, name), - }, - } -} - func arrayOfAwsType(packageSpec schema.PackageSpec, awsNamespace, resourceNameCamelCase string) schema.TypeSpec { awsRefInput := fmt.Sprintf( "#/resources/aws:%s%s%s:%s", From 28d7f98d23885cf78946a180de7bcd56d78758d9 Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Wed, 22 Nov 2023 16:28:05 +0000 Subject: [PATCH 06/18] Add lambda integration helpers Specify a lambda function directly, or a lambda invoke URN. --- awsx/apigatewayv2/httpApi.ts | 85 ++++++++++++++++--------------- awsx/schema-types.ts | 4 ++ schema.json | 11 +++- schemagen/pkg/gen/apigatewayv2.go | 16 ++++++ 4 files changed, 73 insertions(+), 43 deletions(-) diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts index f63b38771..3cb292308 100644 --- a/awsx/apigatewayv2/httpApi.ts +++ b/awsx/apigatewayv2/httpApi.ts @@ -30,9 +30,10 @@ type Route = Omit< authorizer?: pulumi.Input; }; -type HttpIntegration = Omit< +type Integration = Omit< aws.apigatewayv2.IntegrationArgs, | "apiId" + // Make optional | "integrationType" // Supported only for WebSocket APIs. | "requestTemplates" @@ -40,13 +41,10 @@ type HttpIntegration = Omit< | "passthroughBehavior" | "templateSelectionExpression" > & - Partial>; - -type LambdaIntegration = Omit & { - lambda: aws.lambda.Function; -}; - -type Integration = HttpIntegration | LambdaIntegration; + Partial> & { + lambda?: aws.lambda.Function; + lambdaInvokeArn?: pulumi.Input; + }; type Authorizer = Omit; @@ -95,46 +93,49 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: HttpAp { parent }, ); - const functions: aws.lambda.Function[] = []; const integrationsMap = new Map(); for (const [integrationKey, integrationInput] of Object.entries(integrations ?? {})) { - const integrationName = `${name}-${integrationKey}`; - if ("lambda" in integrationInput) { - const { lambda, ...integrationArgs } = integrationInput; - functions.push(lambda); - integrationsMap.set( - integrationKey, - new aws.apigatewayv2.Integration( - integrationName, - { - apiId: api.id, - integrationType: "AWS_PROXY", - integrationUri: lambda.invokeArn, - ...integrationArgs, - }, - { parent }, - ), - ); - } else { - const { integrationType } = integrationInput; - if (integrationType === undefined) { + function errOnlyOneArg() { + return `Exactly one of lambda, lambdaInvokeArn or integrationUri must be specified for integration ${integrationKey}`; + } + let { integrationType, integrationUri, lambda, lambdaInvokeArn, ...integrationArgs } = + integrationInput; + if (lambda !== undefined) { + if (lambdaInvokeArn !== undefined) { + throw new Error(errOnlyOneArg()); + } + lambdaInvokeArn = lambda.invokeArn; + } + if (lambdaInvokeArn !== undefined) { + if (integrationUri !== undefined) { + throw new Error(errOnlyOneArg()); + } + if (integrationType !== undefined && integrationType !== "AWS_PROXY") { throw new Error( - `integrationType must be specified for custom integration ${integrationKey}`, + `integrationType must be AWS_PROXY for lambda integration ${integrationKey}`, ); } - integrationsMap.set( - integrationKey, - new aws.apigatewayv2.Integration( - integrationName, - { - apiId: api.id, - ...integrationInput, - integrationType, - }, - { parent }, - ), - ); + integrationType = "AWS_PROXY"; + integrationUri = lambdaInvokeArn; } + const integrationName = `${name}-${integrationKey}`; + + if (integrationType === undefined) { + throw new Error(`integrationType must be specified for custom integration ${integrationKey}`); + } + integrationsMap.set( + integrationKey, + new aws.apigatewayv2.Integration( + integrationName, + { + apiId: api.id, + integrationType, + integrationUri, + ...integrationArgs, + }, + { parent }, + ), + ); } const integrationResources = Array.from(integrationsMap.values()); diff --git a/awsx/schema-types.ts b/awsx/schema-types.ts index 9cc2d705d..ece83a9a3 100644 --- a/awsx/schema-types.ts +++ b/awsx/schema-types.ts @@ -441,6 +441,8 @@ export interface HttpIntegrationInputs { readonly integrationSubtype?: pulumi.Input; readonly integrationType?: pulumi.Input; readonly integrationUri?: pulumi.Input; + readonly lambda?: aws.lambda.Function; + readonly lambdaInvokeArn?: pulumi.Input; readonly payloadFormatVersion?: pulumi.Input; readonly requestParameters?: pulumi.Input>>; readonly responseParameters?: pulumi.Input[]>; @@ -456,6 +458,8 @@ export interface HttpIntegrationOutputs { readonly integrationSubtype?: pulumi.Output; readonly integrationType?: pulumi.Output; readonly integrationUri?: pulumi.Output; + readonly lambda?: aws.lambda.Function; + readonly lambdaInvokeArn?: pulumi.Output; readonly payloadFormatVersion?: pulumi.Output; readonly requestParameters?: pulumi.Output>; readonly responseParameters?: pulumi.Output; diff --git a/schema.json b/schema.json index 5c24cd453..91718a032 100644 --- a/schema.json +++ b/schema.json @@ -192,7 +192,16 @@ }, "integrationUri": { "type": "string", - "description": "URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`.\nFor an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service.\n" + "description": "URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`.\nFor an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service.\n Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified." + }, + "lambda": { + "$ref": "/aws/v6.9.0/schema.json#/resources/aws:lambda/function:Function", + "plain": true, + "description": "A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified." + }, + "lambdaInvokeArn": { + "type": "string", + "description": "The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified." }, "payloadFormatVersion": { "type": "string", diff --git a/schemagen/pkg/gen/apigatewayv2.go b/schemagen/pkg/gen/apigatewayv2.go index c90fce188..77a07cf80 100644 --- a/schemagen/pkg/gen/apigatewayv2.go +++ b/schemagen/pkg/gen/apigatewayv2.go @@ -154,6 +154,22 @@ func httpIntegration(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { delete(properties, "contentHandlingStrategy") delete(properties, "passthroughBehavior") delete(properties, "templateSelectionExpression") + properties["lambda"] = schema.PropertySpec{ + Description: "A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified.", + TypeSpec: schema.TypeSpec{ + Ref: packageRef(awsSpec, "/resources/aws:lambda/function:Function"), + Plain: true, + }, + } + properties["lambdaInvokeArn"] = schema.PropertySpec{ + Description: "The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified.", + TypeSpec: schema.TypeSpec{ + Type: "string", + }, + } + integrationUri := properties["integrationUri"] + integrationUri.Description += " Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified." + properties["integrationUri"] = integrationUri return schema.ComplexTypeSpec{ ObjectTypeSpec: schema.ObjectTypeSpec{ Type: "object", From c041d7f9256b9c88b12453bc56f23b78eeb56f0c Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Wed, 22 Nov 2023 17:11:12 +0000 Subject: [PATCH 07/18] Depend on generated types in implementation Remove initial Typescript scaffolding types and fix final mismatches. --- awsx/apigatewayv2/httpApi.ts | 67 +++++-------------------------- awsx/schema-types.ts | 12 +++--- schema.json | 11 ++++- schemagen/pkg/gen/apigatewayv2.go | 5 ++- 4 files changed, 29 insertions(+), 66 deletions(-) diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts index 3cb292308..d42f7ca8c 100644 --- a/awsx/apigatewayv2/httpApi.ts +++ b/awsx/apigatewayv2/httpApi.ts @@ -16,56 +16,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; import * as schema from "../schema-types"; -type Route = Omit< - aws.apigatewayv2.RouteArgs, - | "apiId" - | "routeKey" - // Supported only for WebSocket APIs. - | "requestModels" - | "requestParameters" - | "routeResponseSelectionExpression" - | "modelSelectionExpression" -> & { - integration?: pulumi.Input; - authorizer?: pulumi.Input; -}; - -type Integration = Omit< - aws.apigatewayv2.IntegrationArgs, - | "apiId" - // Make optional - | "integrationType" - // Supported only for WebSocket APIs. - | "requestTemplates" - | "contentHandlingStrategy" - | "passthroughBehavior" - | "templateSelectionExpression" -> & - Partial> & { - lambda?: aws.lambda.Function; - lambdaInvokeArn?: pulumi.Input; - }; - -type Authorizer = Omit; - -type Stage = Omit; - -type DomainName = Omit & { - domainConfiguration?: Omit; - domainId?: pulumi.Input; -}; - -type HttpApiArgs = Omit< - aws.apigatewayv2.ApiArgs, - "protocolType" | "target" | "routeKey" | "credentialsArn" -> & { - routes: Record; - integrations?: Record; - authorizers?: Record; - stages?: Record; - domainNames?: Record; -}; - export class HttpApi extends schema.HttpApi { constructor(name: string, args: schema.HttpApiArgs, opts?: pulumi.ComponentResourceOptions) { super(name, args, opts); @@ -82,8 +32,8 @@ export class HttpApi extends schema.HttpApi { } } -export function buildHttpApi(parent: pulumi.Resource, name: string, args: HttpApiArgs) { - const { routes, integrations, authorizers, stages, domainNames, ...apiArgs } = args; +export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema.HttpApiArgs) { + const { routes, integrations, authorizers, stages, domainMappings, ...apiArgs } = args; const api = new aws.apigatewayv2.Api( name, { @@ -222,22 +172,25 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: HttpAp const domainResources: aws.apigatewayv2.DomainName[] = []; const apiMappingResources: aws.apigatewayv2.ApiMapping[] = []; - for (const [domainKey, domainInput] of Object.entries(domainNames ?? {})) { + for (const [domainName, domainInput] of Object.entries(domainMappings ?? {})) { const { domainConfiguration, domainId, ...apiMappingArgs } = domainInput; if ( (domainId === undefined && domainConfiguration === undefined) || (domainId !== undefined && domainConfiguration !== undefined) ) { throw new Error( - `Exactly one of domainId or domainConfiguration must be specified for domain ${domainKey}`, + `Exactly one of domainId or domainConfiguration must be specified for domain ${domainName}`, ); } let resolvedDomainId = domainId; - const domainResourceName = domainKey.replace(/\W+/g, "-"); + const domainResourceName = domainName.replace(/\W+/g, "-"); if (domainConfiguration !== undefined) { const domain = new aws.apigatewayv2.DomainName( `${name}-${domainResourceName}`, - { ...domainConfiguration, domainName: domainKey }, + { + domainName: domainName, + ...domainConfiguration, + }, { parent }, ); domainResources.push(domain); @@ -268,7 +221,7 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: HttpAp }; } -function defaultStages(): Record { +function defaultStages(): Record { return { default: { autoDeploy: true }, }; diff --git a/awsx/schema-types.ts b/awsx/schema-types.ts index ece83a9a3..c5ffc47e1 100644 --- a/awsx/schema-types.ts +++ b/awsx/schema-types.ts @@ -389,26 +389,26 @@ export interface TargetGroupAttachmentArgs { readonly targetGroupArn?: pulumi.Input; } export interface DomainConfigurationInputs { - readonly domainNameConfiguration?: pulumi.Input; + readonly domainNameConfiguration: pulumi.Input; readonly mutualTlsAuthentication?: pulumi.Input; readonly tags?: pulumi.Input>>; } export interface DomainConfigurationOutputs { - readonly domainNameConfiguration?: pulumi.Output; + readonly domainNameConfiguration: pulumi.Output; readonly mutualTlsAuthentication?: pulumi.Output; readonly tags?: pulumi.Output>; } export interface DomainMappingInputs { readonly apiMappingKey?: pulumi.Input; - readonly domainConfiguration?: pulumi.Input; + readonly domainConfiguration?: DomainConfigurationInputs; readonly domainId?: pulumi.Input; - readonly stage?: pulumi.Input; + readonly stage: pulumi.Input; } export interface DomainMappingOutputs { readonly apiMappingKey?: pulumi.Output; - readonly domainConfiguration?: pulumi.Output; + readonly domainConfiguration?: DomainConfigurationOutputs; readonly domainId?: pulumi.Output; - readonly stage?: pulumi.Output; + readonly stage: pulumi.Output; } export interface HttpAuthorizerInputs { readonly authorizerCredentialsArn?: pulumi.Input; diff --git a/schema.json b/schema.json index 91718a032..d7ee99dd5 100644 --- a/schema.json +++ b/schema.json @@ -85,7 +85,10 @@ "description": "Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.\n" } }, - "type": "object" + "type": "object", + "required": [ + "domainNameConfiguration" + ] }, "awsx:apigatewayv2:DomainMapping": { "description": "Manages an Amazon API Gateway Version 2 API mapping.\nMore information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html).\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Basic\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.ApiMapping(\"example\", {\n apiId: aws_apigatewayv2_api.example.id,\n domainName: aws_apigatewayv2_domain_name.example.id,\n stage: aws_apigatewayv2_stage.example.id,\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.ApiMapping(\"example\",\n api_id=aws_apigatewayv2_api[\"example\"][\"id\"],\n domain_name=aws_apigatewayv2_domain_name[\"example\"][\"id\"],\n stage=aws_apigatewayv2_stage[\"example\"][\"id\"])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.ApiMapping(\"example\", new()\n {\n ApiId = aws_apigatewayv2_api.Example.Id,\n DomainName = aws_apigatewayv2_domain_name.Example.Id,\n Stage = aws_apigatewayv2_stage.Example.Id,\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewApiMapping(ctx, \"example\", \u0026apigatewayv2.ApiMappingArgs{\n\t\t\tApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),\n\t\t\tDomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id),\n\t\t\tStage: pulumi.Any(aws_apigatewayv2_stage.Example.Id),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.ApiMapping;\nimport com.pulumi.aws.apigatewayv2.ApiMappingArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new ApiMapping(\"example\", ApiMappingArgs.builder() \n .apiId(aws_apigatewayv2_api.example().id())\n .domainName(aws_apigatewayv2_domain_name.example().id())\n .stage(aws_apigatewayv2_stage.example().id())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:ApiMapping\n properties:\n apiId: ${aws_apigatewayv2_api.example.id}\n domainName: ${aws_apigatewayv2_domain_name.example.id}\n stage: ${aws_apigatewayv2_stage.example.id}\n```\n{{% /example %}}\n{{% /examples %}}\n\n## Import\n\nUsing `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example:\n\n```sh\n $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com\n```\n ", @@ -96,6 +99,7 @@ }, "domainConfiguration": { "$ref": "#/types/awsx:apigatewayv2:DomainConfiguration", + "plain": true, "description": "Configuration of the domain name to create. Cannot be specified together with `domainId`." }, "domainId": { @@ -107,7 +111,10 @@ "description": "API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage.\n" } }, - "type": "object" + "type": "object", + "required": [ + "stage" + ] }, "awsx:apigatewayv2:HttpAuthorizer": { "description": "Manages an Amazon API Gateway Version 2 authorizer.\nMore information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html).\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Basic WebSocket API\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.Authorizer(\"example\", {\n apiId: aws_apigatewayv2_api.example.id,\n authorizerType: \"REQUEST\",\n authorizerUri: aws_lambda_function.example.invoke_arn,\n identitySources: [\"route.request.header.Auth\"],\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.Authorizer(\"example\",\n api_id=aws_apigatewayv2_api[\"example\"][\"id\"],\n authorizer_type=\"REQUEST\",\n authorizer_uri=aws_lambda_function[\"example\"][\"invoke_arn\"],\n identity_sources=[\"route.request.header.Auth\"])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.Authorizer(\"example\", new()\n {\n ApiId = aws_apigatewayv2_api.Example.Id,\n AuthorizerType = \"REQUEST\",\n AuthorizerUri = aws_lambda_function.Example.Invoke_arn,\n IdentitySources = new[]\n {\n \"route.request.header.Auth\",\n },\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewAuthorizer(ctx, \"example\", \u0026apigatewayv2.AuthorizerArgs{\n\t\t\tApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),\n\t\t\tAuthorizerType: pulumi.String(\"REQUEST\"),\n\t\t\tAuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn),\n\t\t\tIdentitySources: pulumi.StringArray{\n\t\t\t\tpulumi.String(\"route.request.header.Auth\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.Authorizer;\nimport com.pulumi.aws.apigatewayv2.AuthorizerArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new Authorizer(\"example\", AuthorizerArgs.builder() \n .apiId(aws_apigatewayv2_api.example().id())\n .authorizerType(\"REQUEST\")\n .authorizerUri(aws_lambda_function.example().invoke_arn())\n .identitySources(\"route.request.header.Auth\")\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:Authorizer\n properties:\n apiId: ${aws_apigatewayv2_api.example.id}\n authorizerType: REQUEST\n authorizerUri: ${aws_lambda_function.example.invoke_arn}\n identitySources:\n - route.request.header.Auth\n```\n{{% /example %}}\n{{% example %}}\n### Basic HTTP API\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.Authorizer(\"example\", {\n apiId: aws_apigatewayv2_api.example.id,\n authorizerType: \"REQUEST\",\n authorizerUri: aws_lambda_function.example.invoke_arn,\n identitySources: [\"$request.header.Authorization\"],\n authorizerPayloadFormatVersion: \"2.0\",\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.Authorizer(\"example\",\n api_id=aws_apigatewayv2_api[\"example\"][\"id\"],\n authorizer_type=\"REQUEST\",\n authorizer_uri=aws_lambda_function[\"example\"][\"invoke_arn\"],\n identity_sources=[\"$request.header.Authorization\"],\n authorizer_payload_format_version=\"2.0\")\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.Authorizer(\"example\", new()\n {\n ApiId = aws_apigatewayv2_api.Example.Id,\n AuthorizerType = \"REQUEST\",\n AuthorizerUri = aws_lambda_function.Example.Invoke_arn,\n IdentitySources = new[]\n {\n \"$request.header.Authorization\",\n },\n AuthorizerPayloadFormatVersion = \"2.0\",\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewAuthorizer(ctx, \"example\", \u0026apigatewayv2.AuthorizerArgs{\n\t\t\tApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),\n\t\t\tAuthorizerType: pulumi.String(\"REQUEST\"),\n\t\t\tAuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn),\n\t\t\tIdentitySources: pulumi.StringArray{\n\t\t\t\tpulumi.String(\"$request.header.Authorization\"),\n\t\t\t},\n\t\t\tAuthorizerPayloadFormatVersion: pulumi.String(\"2.0\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.Authorizer;\nimport com.pulumi.aws.apigatewayv2.AuthorizerArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new Authorizer(\"example\", AuthorizerArgs.builder() \n .apiId(aws_apigatewayv2_api.example().id())\n .authorizerType(\"REQUEST\")\n .authorizerUri(aws_lambda_function.example().invoke_arn())\n .identitySources(\"$request.header.Authorization\")\n .authorizerPayloadFormatVersion(\"2.0\")\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:Authorizer\n properties:\n apiId: ${aws_apigatewayv2_api.example.id}\n authorizerType: REQUEST\n authorizerUri: ${aws_lambda_function.example.invoke_arn}\n identitySources:\n - $request.header.Authorization\n authorizerPayloadFormatVersion: '2.0'\n```\n{{% /example %}}\n{{% /examples %}}\n\n## Import\n\nUsing `pulumi import`, import `aws_apigatewayv2_authorizer` using the API identifier and authorizer identifier. For example:\n\n```sh\n $ pulumi import aws:apigatewayv2/authorizer:Authorizer example aabbccddee/1122334\n```\n ", diff --git a/schemagen/pkg/gen/apigatewayv2.go b/schemagen/pkg/gen/apigatewayv2.go index 77a07cf80..8c6d4d634 100644 --- a/schemagen/pkg/gen/apigatewayv2.go +++ b/schemagen/pkg/gen/apigatewayv2.go @@ -214,7 +214,8 @@ func domainMapping(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { properties["domainConfiguration"] = schema.PropertySpec{ Description: "Configuration of the domain name to create. Cannot be specified together with `domainId`.", TypeSpec: schema.TypeSpec{ - Ref: localRef("apigatewayv2", "DomainConfiguration"), + Ref: localRef("apigatewayv2", "DomainConfiguration"), + Plain: true, }, } properties["domainId"] = schema.PropertySpec{ @@ -228,6 +229,7 @@ func domainMapping(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { Type: "object", Description: original.Description, Properties: properties, + Required: []string{"stage"}, }, } } @@ -241,6 +243,7 @@ func domainConfiguration(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { Type: "object", Description: original.Description, Properties: properties, + Required: []string{"domainNameConfiguration"}, }, } } From 5786a7a57870eaac334310bcfdfa1695c9a6209e Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Wed, 22 Nov 2023 17:11:24 +0000 Subject: [PATCH 08/18] Generate SDKs --- sdk/dotnet/Apigatewayv2/HttpApi.cs | 30 +- .../Inputs/DomainConfigurationArgs.cs | 4 +- .../Apigatewayv2/Inputs/DomainMappingArgs.cs | 132 +- .../Apigatewayv2/Inputs/HttpAuthorizerArgs.cs | 321 +++ .../Inputs/HttpIntegrationArgs.cs | 790 ++++++ .../Apigatewayv2/Inputs/HttpRouteArgs.cs | 361 +++ .../Apigatewayv2/Inputs/HttpStageArgs.cs | 185 ++ sdk/go/awsx/apigatewayv2/httpApi.go | 10 +- sdk/go/awsx/apigatewayv2/pulumiTypes.go | 1134 ++++---- .../pulumi/awsx/apigatewayv2/HttpApiArgs.java | 80 +- .../inputs/DomainConfigurationArgs.java | 11 +- .../inputs/DomainMappingArgs.java | 125 +- .../inputs/HttpAuthorizerArgs.java | 498 +++- .../inputs/HttpIntegrationArgs.java | 796 +++++- .../apigatewayv2/inputs/HttpRouteArgs.java | 345 +++ .../apigatewayv2/inputs/HttpStageArgs.java | 467 +++- sdk/nodejs/apigatewayv2/httpApi.ts | 10 +- sdk/nodejs/types/input.ts | 1689 +++++++++++- .../pulumi_awsx/apigatewayv2/_inputs.py | 2274 ++++++++++++++++- .../pulumi_awsx/apigatewayv2/http_api.py | 70 +- 20 files changed, 8531 insertions(+), 801 deletions(-) diff --git a/sdk/dotnet/Apigatewayv2/HttpApi.cs b/sdk/dotnet/Apigatewayv2/HttpApi.cs index 2f89422f2..2e2c8b8fb 100644 --- a/sdk/dotnet/Apigatewayv2/HttpApi.cs +++ b/sdk/dotnet/Apigatewayv2/HttpApi.cs @@ -117,14 +117,14 @@ public sealed class HttpApiArgs : global::Pulumi.ResourceArgs public Input? ApiKeySelectionExpression { get; set; } [Input("authorizers")] - private InputMap? _authorizers; + private Dictionary? _authorizers; /// /// The authorizers for the HTTP API routes. /// - public InputMap Authorizers + public Dictionary Authorizers { - get => _authorizers ?? (_authorizers = new InputMap()); + get => _authorizers ?? (_authorizers = new Dictionary()); set => _authorizers = value; } @@ -155,14 +155,14 @@ public InputMap Authorizers public Input? DisableExecuteApiEndpoint { get; set; } [Input("domainMappings")] - private InputMap? _domainMappings; + private Dictionary? _domainMappings; /// /// The domain names for the HTTP API. /// - public InputMap DomainMappings + public Dictionary DomainMappings { - get => _domainMappings ?? (_domainMappings = new InputMap()); + get => _domainMappings ?? (_domainMappings = new Dictionary()); set => _domainMappings = value; } @@ -173,14 +173,14 @@ public InputMap DomainMappings public Input? FailOnWarnings { get; set; } [Input("integrations")] - private InputMap? _integrations; + private Dictionary? _integrations; /// /// The integrations for the HTTP API routes. /// - public InputMap Integrations + public Dictionary Integrations { - get => _integrations ?? (_integrations = new InputMap()); + get => _integrations ?? (_integrations = new Dictionary()); set => _integrations = value; } @@ -198,26 +198,26 @@ public InputMap Integrations public Input? RouteSelectionExpression { get; set; } [Input("routes", required: true)] - private InputMap? _routes; + private Dictionary? _routes; /// /// The routes for the HTTP API. /// - public InputMap Routes + public Dictionary Routes { - get => _routes ?? (_routes = new InputMap()); + get => _routes ?? (_routes = new Dictionary()); set => _routes = value; } [Input("stages")] - private InputMap? _stages; + private Dictionary? _stages; /// /// The deployment stages for the HTTP API. /// - public InputMap Stages + public Dictionary Stages { - get => _stages ?? (_stages = new InputMap()); + get => _stages ?? (_stages = new Dictionary()); set => _stages = value; } diff --git a/sdk/dotnet/Apigatewayv2/Inputs/DomainConfigurationArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/DomainConfigurationArgs.cs index 1a24151a4..4f65c282e 100644 --- a/sdk/dotnet/Apigatewayv2/Inputs/DomainConfigurationArgs.cs +++ b/sdk/dotnet/Apigatewayv2/Inputs/DomainConfigurationArgs.cs @@ -354,8 +354,8 @@ public sealed class DomainConfigurationArgs : global::Pulumi.ResourceArgs /// /// Domain name configuration. See below. /// - [Input("domainNameConfiguration")] - public Input? DomainNameConfiguration { get; set; } + [Input("domainNameConfiguration", required: true)] + public Input DomainNameConfiguration { get; set; } = null!; /// /// Mutual TLS authentication configuration for the domain name. diff --git a/sdk/dotnet/Apigatewayv2/Inputs/DomainMappingArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/DomainMappingArgs.cs index 5bea78cd1..c9f766922 100644 --- a/sdk/dotnet/Apigatewayv2/Inputs/DomainMappingArgs.cs +++ b/sdk/dotnet/Apigatewayv2/Inputs/DomainMappingArgs.cs @@ -10,13 +10,137 @@ namespace Pulumi.Awsx.Apigatewayv2.Inputs { + /// + /// Manages an Amazon API Gateway Version 2 API mapping. + /// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// ### Basic + /// + /// ```typescript + /// import * as pulumi from "@pulumi/pulumi"; + /// import * as aws from "@pulumi/aws"; + /// + /// const example = new aws.apigatewayv2.ApiMapping("example", { + /// apiId: aws_apigatewayv2_api.example.id, + /// domainName: aws_apigatewayv2_domain_name.example.id, + /// stage: aws_apigatewayv2_stage.example.id, + /// }); + /// ``` + /// ```python + /// import pulumi + /// import pulumi_aws as aws + /// + /// example = aws.apigatewayv2.ApiMapping("example", + /// api_id=aws_apigatewayv2_api["example"]["id"], + /// domain_name=aws_apigatewayv2_domain_name["example"]["id"], + /// stage=aws_apigatewayv2_stage["example"]["id"]) + /// ``` + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Aws = Pulumi.Aws; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var example = new Aws.ApiGatewayV2.ApiMapping("example", new() + /// { + /// ApiId = aws_apigatewayv2_api.Example.Id, + /// DomainName = aws_apigatewayv2_domain_name.Example.Id, + /// Stage = aws_apigatewayv2_stage.Example.Id, + /// }); + /// + /// }); + /// ``` + /// ```go + /// package main + /// + /// import ( + /// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + /// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + /// ) + /// + /// func main() { + /// pulumi.Run(func(ctx *pulumi.Context) error { + /// _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ + /// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + /// DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), + /// Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), + /// }) + /// if err != nil { + /// return err + /// } + /// return nil + /// }) + /// } + /// ``` + /// ```java + /// package generated_program; + /// + /// import com.pulumi.Context; + /// import com.pulumi.Pulumi; + /// import com.pulumi.core.Output; + /// import com.pulumi.aws.apigatewayv2.ApiMapping; + /// import com.pulumi.aws.apigatewayv2.ApiMappingArgs; + /// import java.util.List; + /// import java.util.ArrayList; + /// import java.util.Map; + /// import java.io.File; + /// import java.nio.file.Files; + /// import java.nio.file.Paths; + /// + /// public class App { + /// public static void main(String[] args) { + /// Pulumi.run(App::stack); + /// } + /// + /// public static void stack(Context ctx) { + /// var example = new ApiMapping("example", ApiMappingArgs.builder() + /// .apiId(aws_apigatewayv2_api.example().id()) + /// .domainName(aws_apigatewayv2_domain_name.example().id()) + /// .stage(aws_apigatewayv2_stage.example().id()) + /// .build()); + /// + /// } + /// } + /// ``` + /// ```yaml + /// resources: + /// example: + /// type: aws:apigatewayv2:ApiMapping + /// properties: + /// apiId: ${aws_apigatewayv2_api.example.id} + /// domainName: ${aws_apigatewayv2_domain_name.example.id} + /// stage: ${aws_apigatewayv2_stage.example.id} + /// ``` + /// {{% /example %}} + /// {{% /examples %}} + /// + /// ## Import + /// + /// Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: + /// + /// ```sh + /// $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com + /// ``` + /// + /// public sealed class DomainMappingArgs : global::Pulumi.ResourceArgs { + /// + /// The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). + /// + [Input("apiMappingKey")] + public Input? ApiMappingKey { get; set; } + /// /// Configuration of the domain name to create. Cannot be specified together with `domainId`. /// [Input("domainConfiguration")] - public Input? DomainConfiguration { get; set; } + public Inputs.DomainConfigurationArgs? DomainConfiguration { get; set; } /// /// Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. @@ -24,6 +148,12 @@ public sealed class DomainMappingArgs : global::Pulumi.ResourceArgs [Input("domainId")] public Input? DomainId { get; set; } + /// + /// API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. + /// + [Input("stage", required: true)] + public Input Stage { get; set; } = null!; + public DomainMappingArgs() { } diff --git a/sdk/dotnet/Apigatewayv2/Inputs/HttpAuthorizerArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/HttpAuthorizerArgs.cs index 4321e4eff..bd566e57f 100644 --- a/sdk/dotnet/Apigatewayv2/Inputs/HttpAuthorizerArgs.cs +++ b/sdk/dotnet/Apigatewayv2/Inputs/HttpAuthorizerArgs.cs @@ -10,8 +10,329 @@ namespace Pulumi.Awsx.Apigatewayv2.Inputs { + /// + /// Manages an Amazon API Gateway Version 2 authorizer. + /// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// ### Basic WebSocket API + /// + /// ```typescript + /// import * as pulumi from "@pulumi/pulumi"; + /// import * as aws from "@pulumi/aws"; + /// + /// const example = new aws.apigatewayv2.Authorizer("example", { + /// apiId: aws_apigatewayv2_api.example.id, + /// authorizerType: "REQUEST", + /// authorizerUri: aws_lambda_function.example.invoke_arn, + /// identitySources: ["route.request.header.Auth"], + /// }); + /// ``` + /// ```python + /// import pulumi + /// import pulumi_aws as aws + /// + /// example = aws.apigatewayv2.Authorizer("example", + /// api_id=aws_apigatewayv2_api["example"]["id"], + /// authorizer_type="REQUEST", + /// authorizer_uri=aws_lambda_function["example"]["invoke_arn"], + /// identity_sources=["route.request.header.Auth"]) + /// ``` + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Aws = Pulumi.Aws; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var example = new Aws.ApiGatewayV2.Authorizer("example", new() + /// { + /// ApiId = aws_apigatewayv2_api.Example.Id, + /// AuthorizerType = "REQUEST", + /// AuthorizerUri = aws_lambda_function.Example.Invoke_arn, + /// IdentitySources = new[] + /// { + /// "route.request.header.Auth", + /// }, + /// }); + /// + /// }); + /// ``` + /// ```go + /// package main + /// + /// import ( + /// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + /// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + /// ) + /// + /// func main() { + /// pulumi.Run(func(ctx *pulumi.Context) error { + /// _, err := apigatewayv2.NewAuthorizer(ctx, "example", &apigatewayv2.AuthorizerArgs{ + /// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + /// AuthorizerType: pulumi.String("REQUEST"), + /// AuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn), + /// IdentitySources: pulumi.StringArray{ + /// pulumi.String("route.request.header.Auth"), + /// }, + /// }) + /// if err != nil { + /// return err + /// } + /// return nil + /// }) + /// } + /// ``` + /// ```java + /// package generated_program; + /// + /// import com.pulumi.Context; + /// import com.pulumi.Pulumi; + /// import com.pulumi.core.Output; + /// import com.pulumi.aws.apigatewayv2.Authorizer; + /// import com.pulumi.aws.apigatewayv2.AuthorizerArgs; + /// import java.util.List; + /// import java.util.ArrayList; + /// import java.util.Map; + /// import java.io.File; + /// import java.nio.file.Files; + /// import java.nio.file.Paths; + /// + /// public class App { + /// public static void main(String[] args) { + /// Pulumi.run(App::stack); + /// } + /// + /// public static void stack(Context ctx) { + /// var example = new Authorizer("example", AuthorizerArgs.builder() + /// .apiId(aws_apigatewayv2_api.example().id()) + /// .authorizerType("REQUEST") + /// .authorizerUri(aws_lambda_function.example().invoke_arn()) + /// .identitySources("route.request.header.Auth") + /// .build()); + /// + /// } + /// } + /// ``` + /// ```yaml + /// resources: + /// example: + /// type: aws:apigatewayv2:Authorizer + /// properties: + /// apiId: ${aws_apigatewayv2_api.example.id} + /// authorizerType: REQUEST + /// authorizerUri: ${aws_lambda_function.example.invoke_arn} + /// identitySources: + /// - route.request.header.Auth + /// ``` + /// {{% /example %}} + /// {{% example %}} + /// ### Basic HTTP API + /// + /// ```typescript + /// import * as pulumi from "@pulumi/pulumi"; + /// import * as aws from "@pulumi/aws"; + /// + /// const example = new aws.apigatewayv2.Authorizer("example", { + /// apiId: aws_apigatewayv2_api.example.id, + /// authorizerType: "REQUEST", + /// authorizerUri: aws_lambda_function.example.invoke_arn, + /// identitySources: ["$request.header.Authorization"], + /// authorizerPayloadFormatVersion: "2.0", + /// }); + /// ``` + /// ```python + /// import pulumi + /// import pulumi_aws as aws + /// + /// example = aws.apigatewayv2.Authorizer("example", + /// api_id=aws_apigatewayv2_api["example"]["id"], + /// authorizer_type="REQUEST", + /// authorizer_uri=aws_lambda_function["example"]["invoke_arn"], + /// identity_sources=["$request.header.Authorization"], + /// authorizer_payload_format_version="2.0") + /// ``` + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Aws = Pulumi.Aws; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var example = new Aws.ApiGatewayV2.Authorizer("example", new() + /// { + /// ApiId = aws_apigatewayv2_api.Example.Id, + /// AuthorizerType = "REQUEST", + /// AuthorizerUri = aws_lambda_function.Example.Invoke_arn, + /// IdentitySources = new[] + /// { + /// "$request.header.Authorization", + /// }, + /// AuthorizerPayloadFormatVersion = "2.0", + /// }); + /// + /// }); + /// ``` + /// ```go + /// package main + /// + /// import ( + /// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + /// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + /// ) + /// + /// func main() { + /// pulumi.Run(func(ctx *pulumi.Context) error { + /// _, err := apigatewayv2.NewAuthorizer(ctx, "example", &apigatewayv2.AuthorizerArgs{ + /// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + /// AuthorizerType: pulumi.String("REQUEST"), + /// AuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn), + /// IdentitySources: pulumi.StringArray{ + /// pulumi.String("$request.header.Authorization"), + /// }, + /// AuthorizerPayloadFormatVersion: pulumi.String("2.0"), + /// }) + /// if err != nil { + /// return err + /// } + /// return nil + /// }) + /// } + /// ``` + /// ```java + /// package generated_program; + /// + /// import com.pulumi.Context; + /// import com.pulumi.Pulumi; + /// import com.pulumi.core.Output; + /// import com.pulumi.aws.apigatewayv2.Authorizer; + /// import com.pulumi.aws.apigatewayv2.AuthorizerArgs; + /// import java.util.List; + /// import java.util.ArrayList; + /// import java.util.Map; + /// import java.io.File; + /// import java.nio.file.Files; + /// import java.nio.file.Paths; + /// + /// public class App { + /// public static void main(String[] args) { + /// Pulumi.run(App::stack); + /// } + /// + /// public static void stack(Context ctx) { + /// var example = new Authorizer("example", AuthorizerArgs.builder() + /// .apiId(aws_apigatewayv2_api.example().id()) + /// .authorizerType("REQUEST") + /// .authorizerUri(aws_lambda_function.example().invoke_arn()) + /// .identitySources("$request.header.Authorization") + /// .authorizerPayloadFormatVersion("2.0") + /// .build()); + /// + /// } + /// } + /// ``` + /// ```yaml + /// resources: + /// example: + /// type: aws:apigatewayv2:Authorizer + /// properties: + /// apiId: ${aws_apigatewayv2_api.example.id} + /// authorizerType: REQUEST + /// authorizerUri: ${aws_lambda_function.example.invoke_arn} + /// identitySources: + /// - $request.header.Authorization + /// authorizerPayloadFormatVersion: '2.0' + /// ``` + /// {{% /example %}} + /// {{% /examples %}} + /// + /// ## Import + /// + /// Using `pulumi import`, import `aws_apigatewayv2_authorizer` using the API identifier and authorizer identifier. For example: + /// + /// ```sh + /// $ pulumi import aws:apigatewayv2/authorizer:Authorizer example aabbccddee/1122334 + /// ``` + /// + /// public sealed class HttpAuthorizerArgs : global::Pulumi.ResourceArgs { + /// + /// Required credentials as an IAM role for API Gateway to invoke the authorizer. + /// Supported only for `REQUEST` authorizers. + /// + [Input("authorizerCredentialsArn")] + public Input? AuthorizerCredentialsArn { get; set; } + + /// + /// Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. + /// Valid values: `1.0`, `2.0`. + /// + [Input("authorizerPayloadFormatVersion")] + public Input? AuthorizerPayloadFormatVersion { get; set; } + + /// + /// Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. + /// If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. + /// Supported only for HTTP API Lambda authorizers. + /// + [Input("authorizerResultTtlInSeconds")] + public Input? AuthorizerResultTtlInSeconds { get; set; } + + /// + /// Authorizer type. Valid values: `JWT`, `REQUEST`. + /// Specify `REQUEST` for a Lambda function using incoming request parameters. + /// For HTTP APIs, specify `JWT` to use JSON Web Tokens. + /// + [Input("authorizerType", required: true)] + public Input AuthorizerType { get; set; } = null!; + + /// + /// Authorizer's Uniform Resource Identifier (URI). + /// For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invoke_arn` attribute of the `aws.lambda.Function` resource. + /// Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length. + /// + [Input("authorizerUri")] + public Input? AuthorizerUri { get; set; } + + /// + /// Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. + /// Supported only for HTTP APIs. + /// + [Input("enableSimpleResponses")] + public Input? EnableSimpleResponses { get; set; } + + [Input("identitySources")] + private InputList? _identitySources; + + /// + /// Identity sources for which authorization is requested. + /// For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. + /// For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. + /// + public InputList IdentitySources + { + get => _identitySources ?? (_identitySources = new InputList()); + set => _identitySources = value; + } + + /// + /// Configuration of a JWT authorizer. Required for the `JWT` authorizer type. + /// Supported only for HTTP APIs. + /// + [Input("jwtConfiguration")] + public Input? JwtConfiguration { get; set; } + + /// + /// Name of the authorizer. Must be between 1 and 128 characters in length. + /// + [Input("name")] + public Input? Name { get; set; } + public HttpAuthorizerArgs() { } diff --git a/sdk/dotnet/Apigatewayv2/Inputs/HttpIntegrationArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/HttpIntegrationArgs.cs index 6d380100a..2bb021c66 100644 --- a/sdk/dotnet/Apigatewayv2/Inputs/HttpIntegrationArgs.cs +++ b/sdk/dotnet/Apigatewayv2/Inputs/HttpIntegrationArgs.cs @@ -10,8 +10,798 @@ namespace Pulumi.Awsx.Apigatewayv2.Inputs { + /// + /// Manages an Amazon API Gateway Version 2 integration. + /// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// ### Basic + /// + /// ```typescript + /// import * as pulumi from "@pulumi/pulumi"; + /// import * as aws from "@pulumi/aws"; + /// + /// const example = new aws.apigatewayv2.Integration("example", { + /// apiId: aws_apigatewayv2_api.example.id, + /// integrationType: "MOCK", + /// }); + /// ``` + /// ```python + /// import pulumi + /// import pulumi_aws as aws + /// + /// example = aws.apigatewayv2.Integration("example", + /// api_id=aws_apigatewayv2_api["example"]["id"], + /// integration_type="MOCK") + /// ``` + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Aws = Pulumi.Aws; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var example = new Aws.ApiGatewayV2.Integration("example", new() + /// { + /// ApiId = aws_apigatewayv2_api.Example.Id, + /// IntegrationType = "MOCK", + /// }); + /// + /// }); + /// ``` + /// ```go + /// package main + /// + /// import ( + /// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + /// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + /// ) + /// + /// func main() { + /// pulumi.Run(func(ctx *pulumi.Context) error { + /// _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ + /// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + /// IntegrationType: pulumi.String("MOCK"), + /// }) + /// if err != nil { + /// return err + /// } + /// return nil + /// }) + /// } + /// ``` + /// ```java + /// package generated_program; + /// + /// import com.pulumi.Context; + /// import com.pulumi.Pulumi; + /// import com.pulumi.core.Output; + /// import com.pulumi.aws.apigatewayv2.Integration; + /// import com.pulumi.aws.apigatewayv2.IntegrationArgs; + /// import java.util.List; + /// import java.util.ArrayList; + /// import java.util.Map; + /// import java.io.File; + /// import java.nio.file.Files; + /// import java.nio.file.Paths; + /// + /// public class App { + /// public static void main(String[] args) { + /// Pulumi.run(App::stack); + /// } + /// + /// public static void stack(Context ctx) { + /// var example = new Integration("example", IntegrationArgs.builder() + /// .apiId(aws_apigatewayv2_api.example().id()) + /// .integrationType("MOCK") + /// .build()); + /// + /// } + /// } + /// ``` + /// ```yaml + /// resources: + /// example: + /// type: aws:apigatewayv2:Integration + /// properties: + /// apiId: ${aws_apigatewayv2_api.example.id} + /// integrationType: MOCK + /// ``` + /// {{% /example %}} + /// {{% example %}} + /// ### Lambda Integration + /// + /// ```typescript + /// import * as pulumi from "@pulumi/pulumi"; + /// import * as aws from "@pulumi/aws"; + /// + /// const exampleFunction = new aws.lambda.Function("exampleFunction", { + /// code: new pulumi.asset.FileArchive("example.zip"), + /// role: aws_iam_role.example.arn, + /// handler: "index.handler", + /// runtime: "nodejs16.x", + /// }); + /// const exampleIntegration = new aws.apigatewayv2.Integration("exampleIntegration", { + /// apiId: aws_apigatewayv2_api.example.id, + /// integrationType: "AWS_PROXY", + /// connectionType: "INTERNET", + /// contentHandlingStrategy: "CONVERT_TO_TEXT", + /// description: "Lambda example", + /// integrationMethod: "POST", + /// integrationUri: exampleFunction.invokeArn, + /// passthroughBehavior: "WHEN_NO_MATCH", + /// }); + /// ``` + /// ```python + /// import pulumi + /// import pulumi_aws as aws + /// + /// example_function = aws.lambda_.Function("exampleFunction", + /// code=pulumi.FileArchive("example.zip"), + /// role=aws_iam_role["example"]["arn"], + /// handler="index.handler", + /// runtime="nodejs16.x") + /// example_integration = aws.apigatewayv2.Integration("exampleIntegration", + /// api_id=aws_apigatewayv2_api["example"]["id"], + /// integration_type="AWS_PROXY", + /// connection_type="INTERNET", + /// content_handling_strategy="CONVERT_TO_TEXT", + /// description="Lambda example", + /// integration_method="POST", + /// integration_uri=example_function.invoke_arn, + /// passthrough_behavior="WHEN_NO_MATCH") + /// ``` + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Aws = Pulumi.Aws; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var exampleFunction = new Aws.Lambda.Function("exampleFunction", new() + /// { + /// Code = new FileArchive("example.zip"), + /// Role = aws_iam_role.Example.Arn, + /// Handler = "index.handler", + /// Runtime = "nodejs16.x", + /// }); + /// + /// var exampleIntegration = new Aws.ApiGatewayV2.Integration("exampleIntegration", new() + /// { + /// ApiId = aws_apigatewayv2_api.Example.Id, + /// IntegrationType = "AWS_PROXY", + /// ConnectionType = "INTERNET", + /// ContentHandlingStrategy = "CONVERT_TO_TEXT", + /// Description = "Lambda example", + /// IntegrationMethod = "POST", + /// IntegrationUri = exampleFunction.InvokeArn, + /// PassthroughBehavior = "WHEN_NO_MATCH", + /// }); + /// + /// }); + /// ``` + /// ```go + /// package main + /// + /// import ( + /// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" + /// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + /// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" + /// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + /// ) + /// + /// func main() { + /// pulumi.Run(func(ctx *pulumi.Context) error { + /// exampleFunction, err := lambda.NewFunction(ctx, "exampleFunction", &lambda.FunctionArgs{ + /// Code: pulumi.NewFileArchive("example.zip"), + /// Role: pulumi.Any(aws_iam_role.Example.Arn), + /// Handler: pulumi.String("index.handler"), + /// Runtime: pulumi.String("nodejs16.x"), + /// }) + /// if err != nil { + /// return err + /// } + /// _, err = apigatewayv2.NewIntegration(ctx, "exampleIntegration", &apigatewayv2.IntegrationArgs{ + /// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + /// IntegrationType: pulumi.String("AWS_PROXY"), + /// ConnectionType: pulumi.String("INTERNET"), + /// ContentHandlingStrategy: pulumi.String("CONVERT_TO_TEXT"), + /// Description: pulumi.String("Lambda example"), + /// IntegrationMethod: pulumi.String("POST"), + /// IntegrationUri: exampleFunction.InvokeArn, + /// PassthroughBehavior: pulumi.String("WHEN_NO_MATCH"), + /// }) + /// if err != nil { + /// return err + /// } + /// return nil + /// }) + /// } + /// ``` + /// ```java + /// package generated_program; + /// + /// import com.pulumi.Context; + /// import com.pulumi.Pulumi; + /// import com.pulumi.core.Output; + /// import com.pulumi.aws.lambda.Function; + /// import com.pulumi.aws.lambda.FunctionArgs; + /// import com.pulumi.aws.apigatewayv2.Integration; + /// import com.pulumi.aws.apigatewayv2.IntegrationArgs; + /// import com.pulumi.asset.FileArchive; + /// import java.util.List; + /// import java.util.ArrayList; + /// import java.util.Map; + /// import java.io.File; + /// import java.nio.file.Files; + /// import java.nio.file.Paths; + /// + /// public class App { + /// public static void main(String[] args) { + /// Pulumi.run(App::stack); + /// } + /// + /// public static void stack(Context ctx) { + /// var exampleFunction = new Function("exampleFunction", FunctionArgs.builder() + /// .code(new FileArchive("example.zip")) + /// .role(aws_iam_role.example().arn()) + /// .handler("index.handler") + /// .runtime("nodejs16.x") + /// .build()); + /// + /// var exampleIntegration = new Integration("exampleIntegration", IntegrationArgs.builder() + /// .apiId(aws_apigatewayv2_api.example().id()) + /// .integrationType("AWS_PROXY") + /// .connectionType("INTERNET") + /// .contentHandlingStrategy("CONVERT_TO_TEXT") + /// .description("Lambda example") + /// .integrationMethod("POST") + /// .integrationUri(exampleFunction.invokeArn()) + /// .passthroughBehavior("WHEN_NO_MATCH") + /// .build()); + /// + /// } + /// } + /// ``` + /// ```yaml + /// resources: + /// exampleFunction: + /// type: aws:lambda:Function + /// properties: + /// code: + /// fn::FileArchive: example.zip + /// role: ${aws_iam_role.example.arn} + /// handler: index.handler + /// runtime: nodejs16.x + /// exampleIntegration: + /// type: aws:apigatewayv2:Integration + /// properties: + /// apiId: ${aws_apigatewayv2_api.example.id} + /// integrationType: AWS_PROXY + /// connectionType: INTERNET + /// contentHandlingStrategy: CONVERT_TO_TEXT + /// description: Lambda example + /// integrationMethod: POST + /// integrationUri: ${exampleFunction.invokeArn} + /// passthroughBehavior: WHEN_NO_MATCH + /// ``` + /// {{% /example %}} + /// {{% example %}} + /// ### AWS Service Integration + /// + /// ```typescript + /// import * as pulumi from "@pulumi/pulumi"; + /// import * as aws from "@pulumi/aws"; + /// + /// const example = new aws.apigatewayv2.Integration("example", { + /// apiId: aws_apigatewayv2_api.example.id, + /// credentialsArn: aws_iam_role.example.arn, + /// description: "SQS example", + /// integrationType: "AWS_PROXY", + /// integrationSubtype: "SQS-SendMessage", + /// requestParameters: { + /// QueueUrl: "$request.header.queueUrl", + /// MessageBody: "$request.body.message", + /// }, + /// }); + /// ``` + /// ```python + /// import pulumi + /// import pulumi_aws as aws + /// + /// example = aws.apigatewayv2.Integration("example", + /// api_id=aws_apigatewayv2_api["example"]["id"], + /// credentials_arn=aws_iam_role["example"]["arn"], + /// description="SQS example", + /// integration_type="AWS_PROXY", + /// integration_subtype="SQS-SendMessage", + /// request_parameters={ + /// "QueueUrl": "$request.header.queueUrl", + /// "MessageBody": "$request.body.message", + /// }) + /// ``` + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Aws = Pulumi.Aws; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var example = new Aws.ApiGatewayV2.Integration("example", new() + /// { + /// ApiId = aws_apigatewayv2_api.Example.Id, + /// CredentialsArn = aws_iam_role.Example.Arn, + /// Description = "SQS example", + /// IntegrationType = "AWS_PROXY", + /// IntegrationSubtype = "SQS-SendMessage", + /// RequestParameters = + /// { + /// { "QueueUrl", "$request.header.queueUrl" }, + /// { "MessageBody", "$request.body.message" }, + /// }, + /// }); + /// + /// }); + /// ``` + /// ```go + /// package main + /// + /// import ( + /// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + /// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + /// ) + /// + /// func main() { + /// pulumi.Run(func(ctx *pulumi.Context) error { + /// _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ + /// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + /// CredentialsArn: pulumi.Any(aws_iam_role.Example.Arn), + /// Description: pulumi.String("SQS example"), + /// IntegrationType: pulumi.String("AWS_PROXY"), + /// IntegrationSubtype: pulumi.String("SQS-SendMessage"), + /// RequestParameters: pulumi.StringMap{ + /// "QueueUrl": pulumi.String("$request.header.queueUrl"), + /// "MessageBody": pulumi.String("$request.body.message"), + /// }, + /// }) + /// if err != nil { + /// return err + /// } + /// return nil + /// }) + /// } + /// ``` + /// ```java + /// package generated_program; + /// + /// import com.pulumi.Context; + /// import com.pulumi.Pulumi; + /// import com.pulumi.core.Output; + /// import com.pulumi.aws.apigatewayv2.Integration; + /// import com.pulumi.aws.apigatewayv2.IntegrationArgs; + /// import java.util.List; + /// import java.util.ArrayList; + /// import java.util.Map; + /// import java.io.File; + /// import java.nio.file.Files; + /// import java.nio.file.Paths; + /// + /// public class App { + /// public static void main(String[] args) { + /// Pulumi.run(App::stack); + /// } + /// + /// public static void stack(Context ctx) { + /// var example = new Integration("example", IntegrationArgs.builder() + /// .apiId(aws_apigatewayv2_api.example().id()) + /// .credentialsArn(aws_iam_role.example().arn()) + /// .description("SQS example") + /// .integrationType("AWS_PROXY") + /// .integrationSubtype("SQS-SendMessage") + /// .requestParameters(Map.ofEntries( + /// Map.entry("QueueUrl", "$request.header.queueUrl"), + /// Map.entry("MessageBody", "$request.body.message") + /// )) + /// .build()); + /// + /// } + /// } + /// ``` + /// ```yaml + /// resources: + /// example: + /// type: aws:apigatewayv2:Integration + /// properties: + /// apiId: ${aws_apigatewayv2_api.example.id} + /// credentialsArn: ${aws_iam_role.example.arn} + /// description: SQS example + /// integrationType: AWS_PROXY + /// integrationSubtype: SQS-SendMessage + /// requestParameters: + /// QueueUrl: $request.header.queueUrl + /// MessageBody: $request.body.message + /// ``` + /// {{% /example %}} + /// {{% example %}} + /// ### Private Integration + /// + /// ```typescript + /// import * as pulumi from "@pulumi/pulumi"; + /// import * as aws from "@pulumi/aws"; + /// + /// const example = new aws.apigatewayv2.Integration("example", { + /// apiId: aws_apigatewayv2_api.example.id, + /// credentialsArn: aws_iam_role.example.arn, + /// description: "Example with a load balancer", + /// integrationType: "HTTP_PROXY", + /// integrationUri: aws_lb_listener.example.arn, + /// integrationMethod: "ANY", + /// connectionType: "VPC_LINK", + /// connectionId: aws_apigatewayv2_vpc_link.example.id, + /// tlsConfig: { + /// serverNameToVerify: "example.com", + /// }, + /// requestParameters: { + /// "append:header.authforintegration": "$context.authorizer.authorizerResponse", + /// "overwrite:path": "staticValueForIntegration", + /// }, + /// responseParameters: [ + /// { + /// statusCode: "403", + /// mappings: { + /// "append:header.auth": "$context.authorizer.authorizerResponse", + /// }, + /// }, + /// { + /// statusCode: "200", + /// mappings: { + /// "overwrite:statuscode": "204", + /// }, + /// }, + /// ], + /// }); + /// ``` + /// ```python + /// import pulumi + /// import pulumi_aws as aws + /// + /// example = aws.apigatewayv2.Integration("example", + /// api_id=aws_apigatewayv2_api["example"]["id"], + /// credentials_arn=aws_iam_role["example"]["arn"], + /// description="Example with a load balancer", + /// integration_type="HTTP_PROXY", + /// integration_uri=aws_lb_listener["example"]["arn"], + /// integration_method="ANY", + /// connection_type="VPC_LINK", + /// connection_id=aws_apigatewayv2_vpc_link["example"]["id"], + /// tls_config=aws.apigatewayv2.IntegrationTlsConfigArgs( + /// server_name_to_verify="example.com", + /// ), + /// request_parameters={ + /// "append:header.authforintegration": "$context.authorizer.authorizerResponse", + /// "overwrite:path": "staticValueForIntegration", + /// }, + /// response_parameters=[ + /// aws.apigatewayv2.IntegrationResponseParameterArgs( + /// status_code="403", + /// mappings={ + /// "append:header.auth": "$context.authorizer.authorizerResponse", + /// }, + /// ), + /// aws.apigatewayv2.IntegrationResponseParameterArgs( + /// status_code="200", + /// mappings={ + /// "overwrite:statuscode": "204", + /// }, + /// ), + /// ]) + /// ``` + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Aws = Pulumi.Aws; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var example = new Aws.ApiGatewayV2.Integration("example", new() + /// { + /// ApiId = aws_apigatewayv2_api.Example.Id, + /// CredentialsArn = aws_iam_role.Example.Arn, + /// Description = "Example with a load balancer", + /// IntegrationType = "HTTP_PROXY", + /// IntegrationUri = aws_lb_listener.Example.Arn, + /// IntegrationMethod = "ANY", + /// ConnectionType = "VPC_LINK", + /// ConnectionId = aws_apigatewayv2_vpc_link.Example.Id, + /// TlsConfig = new Aws.ApiGatewayV2.Inputs.IntegrationTlsConfigArgs + /// { + /// ServerNameToVerify = "example.com", + /// }, + /// RequestParameters = + /// { + /// { "append:header.authforintegration", "$context.authorizer.authorizerResponse" }, + /// { "overwrite:path", "staticValueForIntegration" }, + /// }, + /// ResponseParameters = new[] + /// { + /// new Aws.ApiGatewayV2.Inputs.IntegrationResponseParameterArgs + /// { + /// StatusCode = "403", + /// Mappings = + /// { + /// { "append:header.auth", "$context.authorizer.authorizerResponse" }, + /// }, + /// }, + /// new Aws.ApiGatewayV2.Inputs.IntegrationResponseParameterArgs + /// { + /// StatusCode = "200", + /// Mappings = + /// { + /// { "overwrite:statuscode", "204" }, + /// }, + /// }, + /// }, + /// }); + /// + /// }); + /// ``` + /// ```go + /// package main + /// + /// import ( + /// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + /// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + /// ) + /// + /// func main() { + /// pulumi.Run(func(ctx *pulumi.Context) error { + /// _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ + /// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + /// CredentialsArn: pulumi.Any(aws_iam_role.Example.Arn), + /// Description: pulumi.String("Example with a load balancer"), + /// IntegrationType: pulumi.String("HTTP_PROXY"), + /// IntegrationUri: pulumi.Any(aws_lb_listener.Example.Arn), + /// IntegrationMethod: pulumi.String("ANY"), + /// ConnectionType: pulumi.String("VPC_LINK"), + /// ConnectionId: pulumi.Any(aws_apigatewayv2_vpc_link.Example.Id), + /// TlsConfig: &apigatewayv2.IntegrationTlsConfigArgs{ + /// ServerNameToVerify: pulumi.String("example.com"), + /// }, + /// RequestParameters: pulumi.StringMap{ + /// "append:header.authforintegration": pulumi.String("$context.authorizer.authorizerResponse"), + /// "overwrite:path": pulumi.String("staticValueForIntegration"), + /// }, + /// ResponseParameters: apigatewayv2.IntegrationResponseParameterArray{ + /// &apigatewayv2.IntegrationResponseParameterArgs{ + /// StatusCode: pulumi.String("403"), + /// Mappings: pulumi.StringMap{ + /// "append:header.auth": pulumi.String("$context.authorizer.authorizerResponse"), + /// }, + /// }, + /// &apigatewayv2.IntegrationResponseParameterArgs{ + /// StatusCode: pulumi.String("200"), + /// Mappings: pulumi.StringMap{ + /// "overwrite:statuscode": pulumi.String("204"), + /// }, + /// }, + /// }, + /// }) + /// if err != nil { + /// return err + /// } + /// return nil + /// }) + /// } + /// ``` + /// ```java + /// package generated_program; + /// + /// import com.pulumi.Context; + /// import com.pulumi.Pulumi; + /// import com.pulumi.core.Output; + /// import com.pulumi.aws.apigatewayv2.Integration; + /// import com.pulumi.aws.apigatewayv2.IntegrationArgs; + /// import com.pulumi.aws.apigatewayv2.inputs.IntegrationTlsConfigArgs; + /// import com.pulumi.aws.apigatewayv2.inputs.IntegrationResponseParameterArgs; + /// import java.util.List; + /// import java.util.ArrayList; + /// import java.util.Map; + /// import java.io.File; + /// import java.nio.file.Files; + /// import java.nio.file.Paths; + /// + /// public class App { + /// public static void main(String[] args) { + /// Pulumi.run(App::stack); + /// } + /// + /// public static void stack(Context ctx) { + /// var example = new Integration("example", IntegrationArgs.builder() + /// .apiId(aws_apigatewayv2_api.example().id()) + /// .credentialsArn(aws_iam_role.example().arn()) + /// .description("Example with a load balancer") + /// .integrationType("HTTP_PROXY") + /// .integrationUri(aws_lb_listener.example().arn()) + /// .integrationMethod("ANY") + /// .connectionType("VPC_LINK") + /// .connectionId(aws_apigatewayv2_vpc_link.example().id()) + /// .tlsConfig(IntegrationTlsConfigArgs.builder() + /// .serverNameToVerify("example.com") + /// .build()) + /// .requestParameters(Map.ofEntries( + /// Map.entry("append:header.authforintegration", "$context.authorizer.authorizerResponse"), + /// Map.entry("overwrite:path", "staticValueForIntegration") + /// )) + /// .responseParameters( + /// IntegrationResponseParameterArgs.builder() + /// .statusCode(403) + /// .mappings(Map.of("append:header.auth", "$context.authorizer.authorizerResponse")) + /// .build(), + /// IntegrationResponseParameterArgs.builder() + /// .statusCode(200) + /// .mappings(Map.of("overwrite:statuscode", "204")) + /// .build()) + /// .build()); + /// + /// } + /// } + /// ``` + /// ```yaml + /// resources: + /// example: + /// type: aws:apigatewayv2:Integration + /// properties: + /// apiId: ${aws_apigatewayv2_api.example.id} + /// credentialsArn: ${aws_iam_role.example.arn} + /// description: Example with a load balancer + /// integrationType: HTTP_PROXY + /// integrationUri: ${aws_lb_listener.example.arn} + /// integrationMethod: ANY + /// connectionType: VPC_LINK + /// connectionId: ${aws_apigatewayv2_vpc_link.example.id} + /// tlsConfig: + /// serverNameToVerify: example.com + /// requestParameters: + /// append:header.authforintegration: $context.authorizer.authorizerResponse + /// overwrite:path: staticValueForIntegration + /// responseParameters: + /// - statusCode: 403 + /// mappings: + /// append:header.auth: $context.authorizer.authorizerResponse + /// - statusCode: 200 + /// mappings: + /// overwrite:statuscode: '204' + /// ``` + /// {{% /example %}} + /// {{% /examples %}} + /// + /// ## Import + /// + /// Using `pulumi import`, import `aws_apigatewayv2_integration` using the API identifier and integration identifier. For example: + /// + /// ```sh + /// $ pulumi import aws:apigatewayv2/integration:Integration example aabbccddee/1122334 + /// ``` + /// -> __Note:__ The API Gateway managed integration created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. + /// public sealed class HttpIntegrationArgs : global::Pulumi.ResourceArgs { + /// + /// ID of the VPC link for a private integration. Supported only for HTTP APIs. Must be between 1 and 1024 characters in length. + /// + [Input("connectionId")] + public Input? ConnectionId { get; set; } + + /// + /// Type of the network connection to the integration endpoint. Valid values: `INTERNET`, `VPC_LINK`. Default is `INTERNET`. + /// + [Input("connectionType")] + public Input? ConnectionType { get; set; } + + /// + /// Credentials required for the integration, if any. + /// + [Input("credentialsArn")] + public Input? CredentialsArn { get; set; } + + /// + /// Description of the integration. + /// + [Input("description")] + public Input? Description { get; set; } + + /// + /// Integration's HTTP method. Must be specified if `integration_type` is not `MOCK`. + /// + [Input("integrationMethod")] + public Input? IntegrationMethod { get; set; } + + /// + /// AWS service action to invoke. Supported only for HTTP APIs when `integration_type` is `AWS_PROXY`. See the [AWS service integration reference](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html) documentation for supported values. Must be between 1 and 128 characters in length. + /// + [Input("integrationSubtype")] + public Input? IntegrationSubtype { get; set; } + + /// + /// Integration type of an integration. + /// Valid values: `AWS` (supported only for WebSocket APIs), `AWS_PROXY`, `HTTP` (supported only for WebSocket APIs), `HTTP_PROXY`, `MOCK` (supported only for WebSocket APIs). For an HTTP API private integration, use `HTTP_PROXY`. + /// + [Input("integrationType")] + public Input? IntegrationType { get; set; } + + /// + /// URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`. + /// For an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service. + /// Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + /// + [Input("integrationUri")] + public Input? IntegrationUri { get; set; } + + /// + /// A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + /// + [Input("lambda")] + public Pulumi.Aws.Lambda.Function? Lambda { get; set; } + + /// + /// The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + /// + [Input("lambdaInvokeArn")] + public Input? LambdaInvokeArn { get; set; } + + /// + /// The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. + /// + [Input("payloadFormatVersion")] + public Input? PayloadFormatVersion { get; set; } + + [Input("requestParameters")] + private InputMap? _requestParameters; + + /// + /// For WebSocket APIs, a key-value map specifying request parameters that are passed from the method request to the backend. + /// For HTTP APIs with a specified `integration_subtype`, a key-value map specifying parameters that are passed to `AWS_PROXY` integrations. + /// For HTTP APIs without a specified `integration_subtype`, a key-value map specifying how to transform HTTP requests before sending them to the backend. + /// See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html) for details. + /// + public InputMap RequestParameters + { + get => _requestParameters ?? (_requestParameters = new InputMap()); + set => _requestParameters = value; + } + + [Input("responseParameters")] + private InputList? _responseParameters; + + /// + /// Mappings to transform the HTTP response from a backend integration before returning the response to clients. Supported only for HTTP APIs. + /// + public InputList ResponseParameters + { + get => _responseParameters ?? (_responseParameters = new InputList()); + set => _responseParameters = value; + } + + /// + /// Custom timeout between 50 and 29,000 milliseconds for WebSocket APIs and between 50 and 30,000 milliseconds for HTTP APIs. + /// The default timeout is 29 seconds for WebSocket APIs and 30 seconds for HTTP APIs. + /// this provider will only perform drift detection of its value when present in a configuration. + /// + [Input("timeoutMilliseconds")] + public Input? TimeoutMilliseconds { get; set; } + + /// + /// TLS configuration for a private integration. Supported only for HTTP APIs. + /// + [Input("tlsConfig")] + public Input? TlsConfig { get; set; } + public HttpIntegrationArgs() { } diff --git a/sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs index ccb2387fd..37faa3e5a 100644 --- a/sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs +++ b/sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs @@ -10,20 +10,381 @@ namespace Pulumi.Awsx.Apigatewayv2.Inputs { + /// + /// Manages an Amazon API Gateway Version 2 route. + /// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html) for [WebSocket](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-develop-routes.html) and [HTTP](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-routes.html) APIs. + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// ### Basic + /// + /// ```typescript + /// import * as pulumi from "@pulumi/pulumi"; + /// import * as aws from "@pulumi/aws"; + /// + /// const exampleApi = new aws.apigatewayv2.Api("exampleApi", { + /// protocolType: "WEBSOCKET", + /// routeSelectionExpression: "$request.body.action", + /// }); + /// const exampleRoute = new aws.apigatewayv2.Route("exampleRoute", { + /// apiId: exampleApi.id, + /// routeKey: "$default", + /// }); + /// ``` + /// ```python + /// import pulumi + /// import pulumi_aws as aws + /// + /// example_api = aws.apigatewayv2.Api("exampleApi", + /// protocol_type="WEBSOCKET", + /// route_selection_expression="$request.body.action") + /// example_route = aws.apigatewayv2.Route("exampleRoute", + /// api_id=example_api.id, + /// route_key="$default") + /// ``` + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Aws = Pulumi.Aws; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var exampleApi = new Aws.ApiGatewayV2.Api("exampleApi", new() + /// { + /// ProtocolType = "WEBSOCKET", + /// RouteSelectionExpression = "$request.body.action", + /// }); + /// + /// var exampleRoute = new Aws.ApiGatewayV2.Route("exampleRoute", new() + /// { + /// ApiId = exampleApi.Id, + /// RouteKey = "$default", + /// }); + /// + /// }); + /// ``` + /// ```go + /// package main + /// + /// import ( + /// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + /// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + /// ) + /// + /// func main() { + /// pulumi.Run(func(ctx *pulumi.Context) error { + /// exampleApi, err := apigatewayv2.NewApi(ctx, "exampleApi", &apigatewayv2.ApiArgs{ + /// ProtocolType: pulumi.String("WEBSOCKET"), + /// RouteSelectionExpression: pulumi.String("$request.body.action"), + /// }) + /// if err != nil { + /// return err + /// } + /// _, err = apigatewayv2.NewRoute(ctx, "exampleRoute", &apigatewayv2.RouteArgs{ + /// ApiId: exampleApi.ID(), + /// RouteKey: pulumi.String("$default"), + /// }) + /// if err != nil { + /// return err + /// } + /// return nil + /// }) + /// } + /// ``` + /// ```java + /// package generated_program; + /// + /// import com.pulumi.Context; + /// import com.pulumi.Pulumi; + /// import com.pulumi.core.Output; + /// import com.pulumi.aws.apigatewayv2.Api; + /// import com.pulumi.aws.apigatewayv2.ApiArgs; + /// import com.pulumi.aws.apigatewayv2.Route; + /// import com.pulumi.aws.apigatewayv2.RouteArgs; + /// import java.util.List; + /// import java.util.ArrayList; + /// import java.util.Map; + /// import java.io.File; + /// import java.nio.file.Files; + /// import java.nio.file.Paths; + /// + /// public class App { + /// public static void main(String[] args) { + /// Pulumi.run(App::stack); + /// } + /// + /// public static void stack(Context ctx) { + /// var exampleApi = new Api("exampleApi", ApiArgs.builder() + /// .protocolType("WEBSOCKET") + /// .routeSelectionExpression("$request.body.action") + /// .build()); + /// + /// var exampleRoute = new Route("exampleRoute", RouteArgs.builder() + /// .apiId(exampleApi.id()) + /// .routeKey("$default") + /// .build()); + /// + /// } + /// } + /// ``` + /// ```yaml + /// resources: + /// exampleApi: + /// type: aws:apigatewayv2:Api + /// properties: + /// protocolType: WEBSOCKET + /// routeSelectionExpression: $request.body.action + /// exampleRoute: + /// type: aws:apigatewayv2:Route + /// properties: + /// apiId: ${exampleApi.id} + /// routeKey: $default + /// ``` + /// {{% /example %}} + /// {{% example %}} + /// ### HTTP Proxy Integration + /// + /// ```typescript + /// import * as pulumi from "@pulumi/pulumi"; + /// import * as aws from "@pulumi/aws"; + /// + /// const exampleApi = new aws.apigatewayv2.Api("exampleApi", {protocolType: "HTTP"}); + /// const exampleIntegration = new aws.apigatewayv2.Integration("exampleIntegration", { + /// apiId: exampleApi.id, + /// integrationType: "HTTP_PROXY", + /// integrationMethod: "ANY", + /// integrationUri: "https://example.com/{proxy}", + /// }); + /// const exampleRoute = new aws.apigatewayv2.Route("exampleRoute", { + /// apiId: exampleApi.id, + /// routeKey: "ANY /example/{proxy+}", + /// target: pulumi.interpolate`integrations/${exampleIntegration.id}`, + /// }); + /// ``` + /// ```python + /// import pulumi + /// import pulumi_aws as aws + /// + /// example_api = aws.apigatewayv2.Api("exampleApi", protocol_type="HTTP") + /// example_integration = aws.apigatewayv2.Integration("exampleIntegration", + /// api_id=example_api.id, + /// integration_type="HTTP_PROXY", + /// integration_method="ANY", + /// integration_uri="https://example.com/{proxy}") + /// example_route = aws.apigatewayv2.Route("exampleRoute", + /// api_id=example_api.id, + /// route_key="ANY /example/{proxy+}", + /// target=example_integration.id.apply(lambda id: f"integrations/{id}")) + /// ``` + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Aws = Pulumi.Aws; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var exampleApi = new Aws.ApiGatewayV2.Api("exampleApi", new() + /// { + /// ProtocolType = "HTTP", + /// }); + /// + /// var exampleIntegration = new Aws.ApiGatewayV2.Integration("exampleIntegration", new() + /// { + /// ApiId = exampleApi.Id, + /// IntegrationType = "HTTP_PROXY", + /// IntegrationMethod = "ANY", + /// IntegrationUri = "https://example.com/{proxy}", + /// }); + /// + /// var exampleRoute = new Aws.ApiGatewayV2.Route("exampleRoute", new() + /// { + /// ApiId = exampleApi.Id, + /// RouteKey = "ANY /example/{proxy+}", + /// Target = exampleIntegration.Id.Apply(id => $"integrations/{id}"), + /// }); + /// + /// }); + /// ``` + /// ```go + /// package main + /// + /// import ( + /// "fmt" + /// + /// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + /// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + /// ) + /// + /// func main() { + /// pulumi.Run(func(ctx *pulumi.Context) error { + /// exampleApi, err := apigatewayv2.NewApi(ctx, "exampleApi", &apigatewayv2.ApiArgs{ + /// ProtocolType: pulumi.String("HTTP"), + /// }) + /// if err != nil { + /// return err + /// } + /// exampleIntegration, err := apigatewayv2.NewIntegration(ctx, "exampleIntegration", &apigatewayv2.IntegrationArgs{ + /// ApiId: exampleApi.ID(), + /// IntegrationType: pulumi.String("HTTP_PROXY"), + /// IntegrationMethod: pulumi.String("ANY"), + /// IntegrationUri: pulumi.String("https://example.com/{proxy}"), + /// }) + /// if err != nil { + /// return err + /// } + /// _, err = apigatewayv2.NewRoute(ctx, "exampleRoute", &apigatewayv2.RouteArgs{ + /// ApiId: exampleApi.ID(), + /// RouteKey: pulumi.String("ANY /example/{proxy+}"), + /// Target: exampleIntegration.ID().ApplyT(func(id string) (string, error) { + /// return fmt.Sprintf("integrations/%v", id), nil + /// }).(pulumi.StringOutput), + /// }) + /// if err != nil { + /// return err + /// } + /// return nil + /// }) + /// } + /// ``` + /// ```java + /// package generated_program; + /// + /// import com.pulumi.Context; + /// import com.pulumi.Pulumi; + /// import com.pulumi.core.Output; + /// import com.pulumi.aws.apigatewayv2.Api; + /// import com.pulumi.aws.apigatewayv2.ApiArgs; + /// import com.pulumi.aws.apigatewayv2.Integration; + /// import com.pulumi.aws.apigatewayv2.IntegrationArgs; + /// import com.pulumi.aws.apigatewayv2.Route; + /// import com.pulumi.aws.apigatewayv2.RouteArgs; + /// import java.util.List; + /// import java.util.ArrayList; + /// import java.util.Map; + /// import java.io.File; + /// import java.nio.file.Files; + /// import java.nio.file.Paths; + /// + /// public class App { + /// public static void main(String[] args) { + /// Pulumi.run(App::stack); + /// } + /// + /// public static void stack(Context ctx) { + /// var exampleApi = new Api("exampleApi", ApiArgs.builder() + /// .protocolType("HTTP") + /// .build()); + /// + /// var exampleIntegration = new Integration("exampleIntegration", IntegrationArgs.builder() + /// .apiId(exampleApi.id()) + /// .integrationType("HTTP_PROXY") + /// .integrationMethod("ANY") + /// .integrationUri("https://example.com/{proxy}") + /// .build()); + /// + /// var exampleRoute = new Route("exampleRoute", RouteArgs.builder() + /// .apiId(exampleApi.id()) + /// .routeKey("ANY /example/{proxy+}") + /// .target(exampleIntegration.id().applyValue(id -> String.format("integrations/%s", id))) + /// .build()); + /// + /// } + /// } + /// ``` + /// ```yaml + /// resources: + /// exampleApi: + /// type: aws:apigatewayv2:Api + /// properties: + /// protocolType: HTTP + /// exampleIntegration: + /// type: aws:apigatewayv2:Integration + /// properties: + /// apiId: ${exampleApi.id} + /// integrationType: HTTP_PROXY + /// integrationMethod: ANY + /// integrationUri: https://example.com/{proxy} + /// exampleRoute: + /// type: aws:apigatewayv2:Route + /// properties: + /// apiId: ${exampleApi.id} + /// routeKey: ANY /example/{proxy+} + /// target: integrations/${exampleIntegration.id} + /// ``` + /// {{% /example %}} + /// {{% /examples %}} + /// + /// ## Import + /// + /// Using `pulumi import`, import `aws_apigatewayv2_route` using the API identifier and route identifier. For example: + /// + /// ```sh + /// $ pulumi import aws:apigatewayv2/route:Route example aabbccddee/1122334 + /// ``` + /// -> __Note:__ The API Gateway managed route created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. + /// public sealed class HttpRouteArgs : global::Pulumi.ResourceArgs { + /// + /// Boolean whether an API key is required for the route. Defaults to `false`. Supported only for WebSocket APIs. + /// + [Input("apiKeyRequired")] + public Input? ApiKeyRequired { get; set; } + + [Input("authorizationScopes")] + private InputList? _authorizationScopes; + + /// + /// Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation. + /// + public InputList AuthorizationScopes + { + get => _authorizationScopes ?? (_authorizationScopes = new InputList()); + set => _authorizationScopes = value; + } + + /// + /// Authorization type for the route. + /// For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + /// For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + /// Defaults to `NONE`. + /// + [Input("authorizationType")] + public Input? AuthorizationType { get; set; } + /// /// The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. /// [Input("authorizer")] public Input? Authorizer { get; set; } + /// + /// Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. + /// + [Input("authorizerId")] + public Input? AuthorizerId { get; set; } + /// /// The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. /// [Input("integration")] public Input? Integration { get; set; } + /// + /// Operation name for the route. Must be between 1 and 64 characters in length. + /// + [Input("operationName")] + public Input? OperationName { get; set; } + + /// + /// Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + /// + [Input("target")] + public Input? Target { get; set; } + public HttpRouteArgs() { } diff --git a/sdk/dotnet/Apigatewayv2/Inputs/HttpStageArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/HttpStageArgs.cs index 06bdee75a..930d91660 100644 --- a/sdk/dotnet/Apigatewayv2/Inputs/HttpStageArgs.cs +++ b/sdk/dotnet/Apigatewayv2/Inputs/HttpStageArgs.cs @@ -10,8 +10,193 @@ namespace Pulumi.Awsx.Apigatewayv2.Inputs { + /// + /// Manages an Amazon API Gateway Version 2 stage. + /// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). + /// + /// {{% examples %}} + /// ## Example Usage + /// {{% example %}} + /// ### Basic + /// + /// ```typescript + /// import * as pulumi from "@pulumi/pulumi"; + /// import * as aws from "@pulumi/aws"; + /// + /// const example = new aws.apigatewayv2.Stage("example", {apiId: aws_apigatewayv2_api.example.id}); + /// ``` + /// ```python + /// import pulumi + /// import pulumi_aws as aws + /// + /// example = aws.apigatewayv2.Stage("example", api_id=aws_apigatewayv2_api["example"]["id"]) + /// ``` + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Aws = Pulumi.Aws; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var example = new Aws.ApiGatewayV2.Stage("example", new() + /// { + /// ApiId = aws_apigatewayv2_api.Example.Id, + /// }); + /// + /// }); + /// ``` + /// ```go + /// package main + /// + /// import ( + /// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + /// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + /// ) + /// + /// func main() { + /// pulumi.Run(func(ctx *pulumi.Context) error { + /// _, err := apigatewayv2.NewStage(ctx, "example", &apigatewayv2.StageArgs{ + /// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + /// }) + /// if err != nil { + /// return err + /// } + /// return nil + /// }) + /// } + /// ``` + /// ```java + /// package generated_program; + /// + /// import com.pulumi.Context; + /// import com.pulumi.Pulumi; + /// import com.pulumi.core.Output; + /// import com.pulumi.aws.apigatewayv2.Stage; + /// import com.pulumi.aws.apigatewayv2.StageArgs; + /// import java.util.List; + /// import java.util.ArrayList; + /// import java.util.Map; + /// import java.io.File; + /// import java.nio.file.Files; + /// import java.nio.file.Paths; + /// + /// public class App { + /// public static void main(String[] args) { + /// Pulumi.run(App::stack); + /// } + /// + /// public static void stack(Context ctx) { + /// var example = new Stage("example", StageArgs.builder() + /// .apiId(aws_apigatewayv2_api.example().id()) + /// .build()); + /// + /// } + /// } + /// ``` + /// ```yaml + /// resources: + /// example: + /// type: aws:apigatewayv2:Stage + /// properties: + /// apiId: ${aws_apigatewayv2_api.example.id} + /// ``` + /// {{% /example %}} + /// {{% /examples %}} + /// + /// ## Import + /// + /// Using `pulumi import`, import `aws_apigatewayv2_stage` using the API identifier and stage name. For example: + /// + /// ```sh + /// $ pulumi import aws:apigatewayv2/stage:Stage example aabbccddee/example-stage + /// ``` + /// -> __Note:__ The API Gateway managed stage created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. + /// public sealed class HttpStageArgs : global::Pulumi.ResourceArgs { + /// + /// Settings for logging access in this stage. + /// Use the `aws.apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions). + /// + [Input("accessLogSettings")] + public Input? AccessLogSettings { get; set; } + + /// + /// Whether updates to an API automatically trigger a new deployment. Defaults to `false`. Applicable for HTTP APIs. + /// + [Input("autoDeploy")] + public Input? AutoDeploy { get; set; } + + /// + /// Identifier of a client certificate for the stage. Use the `aws.apigateway.ClientCertificate` resource to configure a client certificate. + /// Supported only for WebSocket APIs. + /// + [Input("clientCertificateId")] + public Input? ClientCertificateId { get; set; } + + /// + /// Default route settings for the stage. + /// + [Input("defaultRouteSettings")] + public Input? DefaultRouteSettings { get; set; } + + /// + /// Deployment identifier of the stage. Use the `aws.apigatewayv2.Deployment` resource to configure a deployment. + /// + [Input("deploymentId")] + public Input? DeploymentId { get; set; } + + /// + /// Description for the stage. Must be less than or equal to 1024 characters in length. + /// + [Input("description")] + public Input? Description { get; set; } + + /// + /// Name of the stage. Must be between 1 and 128 characters in length. + /// + /// The following arguments are optional: + /// + [Input("name")] + public Input? Name { get; set; } + + [Input("routeSettings")] + private InputList? _routeSettings; + + /// + /// Route settings for the stage. + /// + public InputList RouteSettings + { + get => _routeSettings ?? (_routeSettings = new InputList()); + set => _routeSettings = value; + } + + [Input("stageVariables")] + private InputMap? _stageVariables; + + /// + /// Map that defines the stage variables for the stage. + /// + public InputMap StageVariables + { + get => _stageVariables ?? (_stageVariables = new InputMap()); + set => _stageVariables = value; + } + + [Input("tags")] + private InputMap? _tags; + + /// + /// Map of tags to assign to the stage. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + /// + public InputMap Tags + { + get => _tags ?? (_tags = new InputMap()); + set => _tags = value; + } + public HttpStageArgs() { } diff --git a/sdk/go/awsx/apigatewayv2/httpApi.go b/sdk/go/awsx/apigatewayv2/httpApi.go index 3dd7118ef..ca2ce400e 100644 --- a/sdk/go/awsx/apigatewayv2/httpApi.go +++ b/sdk/go/awsx/apigatewayv2/httpApi.go @@ -123,7 +123,7 @@ type HttpApiArgs struct { // Applicable for WebSocket APIs. ApiKeySelectionExpression pulumi.StringPtrInput // The authorizers for the HTTP API routes. - Authorizers HttpAuthorizerMapInput + Authorizers map[string]HttpAuthorizerArgs // An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. Body pulumi.StringPtrInput // Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. @@ -135,20 +135,20 @@ type HttpApiArgs struct { // To require that clients use a custom domain name to invoke the API, disable the default endpoint. DisableExecuteApiEndpoint pulumi.BoolPtrInput // The domain names for the HTTP API. - DomainMappings DomainMappingMapInput + DomainMappings map[string]DomainMappingArgs // Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. FailOnWarnings pulumi.BoolPtrInput // The integrations for the HTTP API routes. - Integrations HttpIntegrationMapInput + Integrations map[string]HttpIntegrationArgs // Name of the API. Must be less than or equal to 128 characters in length. Name pulumi.StringPtrInput // The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. // Defaults to `$request.method $request.path`. RouteSelectionExpression pulumi.StringPtrInput // The routes for the HTTP API. - Routes HttpRouteMapInput + Routes map[string]HttpRouteArgs // The deployment stages for the HTTP API. - Stages HttpStageMapInput + Stages map[string]HttpStageArgs // Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. Tags pulumi.StringMapInput // Version identifier for the API. Must be between 1 and 64 characters in length. diff --git a/sdk/go/awsx/apigatewayv2/pulumiTypes.go b/sdk/go/awsx/apigatewayv2/pulumiTypes.go index 835910dad..45427ce63 100644 --- a/sdk/go/awsx/apigatewayv2/pulumiTypes.go +++ b/sdk/go/awsx/apigatewayv2/pulumiTypes.go @@ -8,6 +8,7 @@ import ( "reflect" "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" "github.com/pulumi/pulumi-awsx/sdk/v2/go/awsx/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/pulumi/pulumi/sdk/v3/go/pulumix" @@ -112,7 +113,7 @@ var _ = internal.GetEnvOrDefault // ``` type DomainConfiguration struct { // Domain name configuration. See below. - DomainNameConfiguration *apigatewayv2.DomainNameDomainNameConfiguration `pulumi:"domainNameConfiguration"` + DomainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration `pulumi:"domainNameConfiguration"` // Mutual TLS authentication configuration for the domain name. MutualTlsAuthentication *apigatewayv2.DomainNameMutualTlsAuthentication `pulumi:"mutualTlsAuthentication"` // Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. @@ -227,7 +228,7 @@ type DomainConfigurationInput interface { // ``` type DomainConfigurationArgs struct { // Domain name configuration. See below. - DomainNameConfiguration apigatewayv2.DomainNameDomainNameConfigurationPtrInput `pulumi:"domainNameConfiguration"` + DomainNameConfiguration apigatewayv2.DomainNameDomainNameConfigurationInput `pulumi:"domainNameConfiguration"` // Mutual TLS authentication configuration for the domain name. MutualTlsAuthentication apigatewayv2.DomainNameMutualTlsAuthenticationPtrInput `pulumi:"mutualTlsAuthentication"` // Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. @@ -425,10 +426,10 @@ func (o DomainConfigurationOutput) ToOutput(ctx context.Context) pulumix.Output[ } // Domain name configuration. See below. -func (o DomainConfigurationOutput) DomainNameConfiguration() apigatewayv2.DomainNameDomainNameConfigurationPtrOutput { - return o.ApplyT(func(v DomainConfiguration) *apigatewayv2.DomainNameDomainNameConfiguration { +func (o DomainConfigurationOutput) DomainNameConfiguration() apigatewayv2.DomainNameDomainNameConfigurationOutput { + return o.ApplyT(func(v DomainConfiguration) apigatewayv2.DomainNameDomainNameConfiguration { return v.DomainNameConfiguration - }).(apigatewayv2.DomainNameDomainNameConfigurationPtrOutput) + }).(apigatewayv2.DomainNameDomainNameConfigurationOutput) } // Mutual TLS authentication configuration for the domain name. @@ -479,7 +480,7 @@ func (o DomainConfigurationPtrOutput) DomainNameConfiguration() apigatewayv2.Dom if v == nil { return nil } - return v.DomainNameConfiguration + return &v.DomainNameConfiguration }).(apigatewayv2.DomainNameDomainNameConfigurationPtrOutput) } @@ -503,625 +504,556 @@ func (o DomainConfigurationPtrOutput) Tags() pulumi.StringMapOutput { }).(pulumi.StringMapOutput) } +// Manages an Amazon API Gateway Version 2 API mapping. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), +// Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com +// +// ``` type DomainMapping struct { + // The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). + ApiMappingKey *string `pulumi:"apiMappingKey"` // Configuration of the domain name to create. Cannot be specified together with `domainId`. DomainConfiguration *DomainConfiguration `pulumi:"domainConfiguration"` // Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. DomainId *string `pulumi:"domainId"` + // API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. + Stage string `pulumi:"stage"` } -// DomainMappingInput is an input type that accepts DomainMappingArgs and DomainMappingOutput values. -// You can construct a concrete instance of `DomainMappingInput` via: +// Manages an Amazon API Gateway Version 2 authorizer. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). // -// DomainMappingArgs{...} -type DomainMappingInput interface { - pulumi.Input - - ToDomainMappingOutput() DomainMappingOutput - ToDomainMappingOutputWithContext(context.Context) DomainMappingOutput -} - -type DomainMappingArgs struct { - // Configuration of the domain name to create. Cannot be specified together with `domainId`. - DomainConfiguration DomainConfigurationPtrInput `pulumi:"domainConfiguration"` - // Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. - DomainId pulumi.StringPtrInput `pulumi:"domainId"` -} - -func (DomainMappingArgs) ElementType() reflect.Type { - return reflect.TypeOf((*DomainMapping)(nil)).Elem() -} - -func (i DomainMappingArgs) ToDomainMappingOutput() DomainMappingOutput { - return i.ToDomainMappingOutputWithContext(context.Background()) -} - -func (i DomainMappingArgs) ToDomainMappingOutputWithContext(ctx context.Context) DomainMappingOutput { - return pulumi.ToOutputWithContext(ctx, i).(DomainMappingOutput) -} - -func (i DomainMappingArgs) ToOutput(ctx context.Context) pulumix.Output[DomainMapping] { - return pulumix.Output[DomainMapping]{ - OutputState: i.ToDomainMappingOutputWithContext(ctx).OutputState, - } -} - -// DomainMappingMapInput is an input type that accepts DomainMappingMap and DomainMappingMapOutput values. -// You can construct a concrete instance of `DomainMappingMapInput` via: +// ## Example Usage +// ### Basic WebSocket API +// ```go +// package main // -// DomainMappingMap{ "key": DomainMappingArgs{...} } -type DomainMappingMapInput interface { - pulumi.Input - - ToDomainMappingMapOutput() DomainMappingMapOutput - ToDomainMappingMapOutputWithContext(context.Context) DomainMappingMapOutput -} - -type DomainMappingMap map[string]DomainMappingInput - -func (DomainMappingMap) ElementType() reflect.Type { - return reflect.TypeOf((*map[string]DomainMapping)(nil)).Elem() -} - -func (i DomainMappingMap) ToDomainMappingMapOutput() DomainMappingMapOutput { - return i.ToDomainMappingMapOutputWithContext(context.Background()) -} - -func (i DomainMappingMap) ToDomainMappingMapOutputWithContext(ctx context.Context) DomainMappingMapOutput { - return pulumi.ToOutputWithContext(ctx, i).(DomainMappingMapOutput) -} - -func (i DomainMappingMap) ToOutput(ctx context.Context) pulumix.Output[map[string]DomainMapping] { - return pulumix.Output[map[string]DomainMapping]{ - OutputState: i.ToDomainMappingMapOutputWithContext(ctx).OutputState, - } -} - -type DomainMappingOutput struct{ *pulumi.OutputState } - -func (DomainMappingOutput) ElementType() reflect.Type { - return reflect.TypeOf((*DomainMapping)(nil)).Elem() -} - -func (o DomainMappingOutput) ToDomainMappingOutput() DomainMappingOutput { - return o -} - -func (o DomainMappingOutput) ToDomainMappingOutputWithContext(ctx context.Context) DomainMappingOutput { - return o -} - -func (o DomainMappingOutput) ToOutput(ctx context.Context) pulumix.Output[DomainMapping] { - return pulumix.Output[DomainMapping]{ - OutputState: o.OutputState, - } -} - -// Configuration of the domain name to create. Cannot be specified together with `domainId`. -func (o DomainMappingOutput) DomainConfiguration() DomainConfigurationPtrOutput { - return o.ApplyT(func(v DomainMapping) *DomainConfiguration { return v.DomainConfiguration }).(DomainConfigurationPtrOutput) -} - -// Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. -func (o DomainMappingOutput) DomainId() pulumi.StringPtrOutput { - return o.ApplyT(func(v DomainMapping) *string { return v.DomainId }).(pulumi.StringPtrOutput) -} - -type DomainMappingMapOutput struct{ *pulumi.OutputState } - -func (DomainMappingMapOutput) ElementType() reflect.Type { - return reflect.TypeOf((*map[string]DomainMapping)(nil)).Elem() -} - -func (o DomainMappingMapOutput) ToDomainMappingMapOutput() DomainMappingMapOutput { - return o -} - -func (o DomainMappingMapOutput) ToDomainMappingMapOutputWithContext(ctx context.Context) DomainMappingMapOutput { - return o -} - -func (o DomainMappingMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]DomainMapping] { - return pulumix.Output[map[string]DomainMapping]{ - OutputState: o.OutputState, - } -} - -func (o DomainMappingMapOutput) MapIndex(k pulumi.StringInput) DomainMappingOutput { - return pulumi.All(o, k).ApplyT(func(vs []interface{}) DomainMapping { - return vs[0].(map[string]DomainMapping)[vs[1].(string)] - }).(DomainMappingOutput) -} - -type HttpAuthorizer struct { -} - -// HttpAuthorizerInput is an input type that accepts HttpAuthorizerArgs and HttpAuthorizerOutput values. -// You can construct a concrete instance of `HttpAuthorizerInput` via: +// import ( // -// HttpAuthorizerArgs{...} -type HttpAuthorizerInput interface { - pulumi.Input - - ToHttpAuthorizerOutput() HttpAuthorizerOutput - ToHttpAuthorizerOutputWithContext(context.Context) HttpAuthorizerOutput -} - -type HttpAuthorizerArgs struct { -} - -func (HttpAuthorizerArgs) ElementType() reflect.Type { - return reflect.TypeOf((*HttpAuthorizer)(nil)).Elem() -} - -func (i HttpAuthorizerArgs) ToHttpAuthorizerOutput() HttpAuthorizerOutput { - return i.ToHttpAuthorizerOutputWithContext(context.Background()) -} - -func (i HttpAuthorizerArgs) ToHttpAuthorizerOutputWithContext(ctx context.Context) HttpAuthorizerOutput { - return pulumi.ToOutputWithContext(ctx, i).(HttpAuthorizerOutput) -} - -func (i HttpAuthorizerArgs) ToOutput(ctx context.Context) pulumix.Output[HttpAuthorizer] { - return pulumix.Output[HttpAuthorizer]{ - OutputState: i.ToHttpAuthorizerOutputWithContext(ctx).OutputState, - } -} - -// HttpAuthorizerMapInput is an input type that accepts HttpAuthorizerMap and HttpAuthorizerMapOutput values. -// You can construct a concrete instance of `HttpAuthorizerMapInput` via: +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" // -// HttpAuthorizerMap{ "key": HttpAuthorizerArgs{...} } -type HttpAuthorizerMapInput interface { - pulumi.Input - - ToHttpAuthorizerMapOutput() HttpAuthorizerMapOutput - ToHttpAuthorizerMapOutputWithContext(context.Context) HttpAuthorizerMapOutput -} - -type HttpAuthorizerMap map[string]HttpAuthorizerInput - -func (HttpAuthorizerMap) ElementType() reflect.Type { - return reflect.TypeOf((*map[string]HttpAuthorizer)(nil)).Elem() -} - -func (i HttpAuthorizerMap) ToHttpAuthorizerMapOutput() HttpAuthorizerMapOutput { - return i.ToHttpAuthorizerMapOutputWithContext(context.Background()) -} - -func (i HttpAuthorizerMap) ToHttpAuthorizerMapOutputWithContext(ctx context.Context) HttpAuthorizerMapOutput { - return pulumi.ToOutputWithContext(ctx, i).(HttpAuthorizerMapOutput) -} - -func (i HttpAuthorizerMap) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpAuthorizer] { - return pulumix.Output[map[string]HttpAuthorizer]{ - OutputState: i.ToHttpAuthorizerMapOutputWithContext(ctx).OutputState, - } -} - -type HttpAuthorizerOutput struct{ *pulumi.OutputState } - -func (HttpAuthorizerOutput) ElementType() reflect.Type { - return reflect.TypeOf((*HttpAuthorizer)(nil)).Elem() -} - -func (o HttpAuthorizerOutput) ToHttpAuthorizerOutput() HttpAuthorizerOutput { - return o -} - -func (o HttpAuthorizerOutput) ToHttpAuthorizerOutputWithContext(ctx context.Context) HttpAuthorizerOutput { - return o -} - -func (o HttpAuthorizerOutput) ToOutput(ctx context.Context) pulumix.Output[HttpAuthorizer] { - return pulumix.Output[HttpAuthorizer]{ - OutputState: o.OutputState, - } -} - -type HttpAuthorizerMapOutput struct{ *pulumi.OutputState } - -func (HttpAuthorizerMapOutput) ElementType() reflect.Type { - return reflect.TypeOf((*map[string]HttpAuthorizer)(nil)).Elem() -} - -func (o HttpAuthorizerMapOutput) ToHttpAuthorizerMapOutput() HttpAuthorizerMapOutput { - return o -} - -func (o HttpAuthorizerMapOutput) ToHttpAuthorizerMapOutputWithContext(ctx context.Context) HttpAuthorizerMapOutput { - return o -} - -func (o HttpAuthorizerMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpAuthorizer] { - return pulumix.Output[map[string]HttpAuthorizer]{ - OutputState: o.OutputState, - } -} - -func (o HttpAuthorizerMapOutput) MapIndex(k pulumi.StringInput) HttpAuthorizerOutput { - return pulumi.All(o, k).ApplyT(func(vs []interface{}) HttpAuthorizer { - return vs[0].(map[string]HttpAuthorizer)[vs[1].(string)] - }).(HttpAuthorizerOutput) -} - -type HttpIntegration struct { -} - -// HttpIntegrationInput is an input type that accepts HttpIntegrationArgs and HttpIntegrationOutput values. -// You can construct a concrete instance of `HttpIntegrationInput` via: +// ) // -// HttpIntegrationArgs{...} -type HttpIntegrationInput interface { - pulumi.Input - - ToHttpIntegrationOutput() HttpIntegrationOutput - ToHttpIntegrationOutputWithContext(context.Context) HttpIntegrationOutput -} - -type HttpIntegrationArgs struct { -} - -func (HttpIntegrationArgs) ElementType() reflect.Type { - return reflect.TypeOf((*HttpIntegration)(nil)).Elem() -} - -func (i HttpIntegrationArgs) ToHttpIntegrationOutput() HttpIntegrationOutput { - return i.ToHttpIntegrationOutputWithContext(context.Background()) -} - -func (i HttpIntegrationArgs) ToHttpIntegrationOutputWithContext(ctx context.Context) HttpIntegrationOutput { - return pulumi.ToOutputWithContext(ctx, i).(HttpIntegrationOutput) -} - -func (i HttpIntegrationArgs) ToOutput(ctx context.Context) pulumix.Output[HttpIntegration] { - return pulumix.Output[HttpIntegration]{ - OutputState: i.ToHttpIntegrationOutputWithContext(ctx).OutputState, - } -} - -// HttpIntegrationMapInput is an input type that accepts HttpIntegrationMap and HttpIntegrationMapOutput values. -// You can construct a concrete instance of `HttpIntegrationMapInput` via: +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewAuthorizer(ctx, "example", &apigatewayv2.AuthorizerArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// AuthorizerType: pulumi.String("REQUEST"), +// AuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn), +// IdentitySources: pulumi.StringArray{ +// pulumi.String("route.request.header.Auth"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } // -// HttpIntegrationMap{ "key": HttpIntegrationArgs{...} } -type HttpIntegrationMapInput interface { - pulumi.Input - - ToHttpIntegrationMapOutput() HttpIntegrationMapOutput - ToHttpIntegrationMapOutputWithContext(context.Context) HttpIntegrationMapOutput -} - -type HttpIntegrationMap map[string]HttpIntegrationInput - -func (HttpIntegrationMap) ElementType() reflect.Type { - return reflect.TypeOf((*map[string]HttpIntegration)(nil)).Elem() -} - -func (i HttpIntegrationMap) ToHttpIntegrationMapOutput() HttpIntegrationMapOutput { - return i.ToHttpIntegrationMapOutputWithContext(context.Background()) -} - -func (i HttpIntegrationMap) ToHttpIntegrationMapOutputWithContext(ctx context.Context) HttpIntegrationMapOutput { - return pulumi.ToOutputWithContext(ctx, i).(HttpIntegrationMapOutput) -} - -func (i HttpIntegrationMap) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpIntegration] { - return pulumix.Output[map[string]HttpIntegration]{ - OutputState: i.ToHttpIntegrationMapOutputWithContext(ctx).OutputState, - } -} - -type HttpIntegrationOutput struct{ *pulumi.OutputState } - -func (HttpIntegrationOutput) ElementType() reflect.Type { - return reflect.TypeOf((*HttpIntegration)(nil)).Elem() -} - -func (o HttpIntegrationOutput) ToHttpIntegrationOutput() HttpIntegrationOutput { - return o -} - -func (o HttpIntegrationOutput) ToHttpIntegrationOutputWithContext(ctx context.Context) HttpIntegrationOutput { - return o -} - -func (o HttpIntegrationOutput) ToOutput(ctx context.Context) pulumix.Output[HttpIntegration] { - return pulumix.Output[HttpIntegration]{ - OutputState: o.OutputState, - } -} - -type HttpIntegrationMapOutput struct{ *pulumi.OutputState } - -func (HttpIntegrationMapOutput) ElementType() reflect.Type { - return reflect.TypeOf((*map[string]HttpIntegration)(nil)).Elem() -} - -func (o HttpIntegrationMapOutput) ToHttpIntegrationMapOutput() HttpIntegrationMapOutput { - return o -} - -func (o HttpIntegrationMapOutput) ToHttpIntegrationMapOutputWithContext(ctx context.Context) HttpIntegrationMapOutput { - return o -} - -func (o HttpIntegrationMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpIntegration] { - return pulumix.Output[map[string]HttpIntegration]{ - OutputState: o.OutputState, - } -} - -func (o HttpIntegrationMapOutput) MapIndex(k pulumi.StringInput) HttpIntegrationOutput { - return pulumi.All(o, k).ApplyT(func(vs []interface{}) HttpIntegration { - return vs[0].(map[string]HttpIntegration)[vs[1].(string)] - }).(HttpIntegrationOutput) -} - -type HttpRoute struct { - // The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. - Authorizer *string `pulumi:"authorizer"` - // The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. - Integration *string `pulumi:"integration"` -} - -// HttpRouteInput is an input type that accepts HttpRouteArgs and HttpRouteOutput values. -// You can construct a concrete instance of `HttpRouteInput` via: +// ``` +// ### Basic HTTP API +// ```go +// package main // -// HttpRouteArgs{...} -type HttpRouteInput interface { - pulumi.Input - - ToHttpRouteOutput() HttpRouteOutput - ToHttpRouteOutputWithContext(context.Context) HttpRouteOutput -} - -type HttpRouteArgs struct { - // The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. - Authorizer pulumi.StringPtrInput `pulumi:"authorizer"` - // The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. - Integration pulumi.StringPtrInput `pulumi:"integration"` -} - -func (HttpRouteArgs) ElementType() reflect.Type { - return reflect.TypeOf((*HttpRoute)(nil)).Elem() -} - -func (i HttpRouteArgs) ToHttpRouteOutput() HttpRouteOutput { - return i.ToHttpRouteOutputWithContext(context.Background()) -} - -func (i HttpRouteArgs) ToHttpRouteOutputWithContext(ctx context.Context) HttpRouteOutput { - return pulumi.ToOutputWithContext(ctx, i).(HttpRouteOutput) -} - -func (i HttpRouteArgs) ToOutput(ctx context.Context) pulumix.Output[HttpRoute] { - return pulumix.Output[HttpRoute]{ - OutputState: i.ToHttpRouteOutputWithContext(ctx).OutputState, - } -} - -// HttpRouteMapInput is an input type that accepts HttpRouteMap and HttpRouteMapOutput values. -// You can construct a concrete instance of `HttpRouteMapInput` via: +// import ( // -// HttpRouteMap{ "key": HttpRouteArgs{...} } -type HttpRouteMapInput interface { - pulumi.Input - - ToHttpRouteMapOutput() HttpRouteMapOutput - ToHttpRouteMapOutputWithContext(context.Context) HttpRouteMapOutput -} - -type HttpRouteMap map[string]HttpRouteInput - -func (HttpRouteMap) ElementType() reflect.Type { - return reflect.TypeOf((*map[string]HttpRoute)(nil)).Elem() -} - -func (i HttpRouteMap) ToHttpRouteMapOutput() HttpRouteMapOutput { - return i.ToHttpRouteMapOutputWithContext(context.Background()) -} - -func (i HttpRouteMap) ToHttpRouteMapOutputWithContext(ctx context.Context) HttpRouteMapOutput { - return pulumi.ToOutputWithContext(ctx, i).(HttpRouteMapOutput) -} - -func (i HttpRouteMap) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpRoute] { - return pulumix.Output[map[string]HttpRoute]{ - OutputState: i.ToHttpRouteMapOutputWithContext(ctx).OutputState, - } -} - -type HttpRouteOutput struct{ *pulumi.OutputState } - -func (HttpRouteOutput) ElementType() reflect.Type { - return reflect.TypeOf((*HttpRoute)(nil)).Elem() -} - -func (o HttpRouteOutput) ToHttpRouteOutput() HttpRouteOutput { - return o -} - -func (o HttpRouteOutput) ToHttpRouteOutputWithContext(ctx context.Context) HttpRouteOutput { - return o -} - -func (o HttpRouteOutput) ToOutput(ctx context.Context) pulumix.Output[HttpRoute] { - return pulumix.Output[HttpRoute]{ - OutputState: o.OutputState, - } -} - -// The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. -func (o HttpRouteOutput) Authorizer() pulumi.StringPtrOutput { - return o.ApplyT(func(v HttpRoute) *string { return v.Authorizer }).(pulumi.StringPtrOutput) -} - -// The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. -func (o HttpRouteOutput) Integration() pulumi.StringPtrOutput { - return o.ApplyT(func(v HttpRoute) *string { return v.Integration }).(pulumi.StringPtrOutput) -} - -type HttpRouteMapOutput struct{ *pulumi.OutputState } - -func (HttpRouteMapOutput) ElementType() reflect.Type { - return reflect.TypeOf((*map[string]HttpRoute)(nil)).Elem() -} - -func (o HttpRouteMapOutput) ToHttpRouteMapOutput() HttpRouteMapOutput { - return o -} - -func (o HttpRouteMapOutput) ToHttpRouteMapOutputWithContext(ctx context.Context) HttpRouteMapOutput { - return o -} - -func (o HttpRouteMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpRoute] { - return pulumix.Output[map[string]HttpRoute]{ - OutputState: o.OutputState, - } -} - -func (o HttpRouteMapOutput) MapIndex(k pulumi.StringInput) HttpRouteOutput { - return pulumi.All(o, k).ApplyT(func(vs []interface{}) HttpRoute { - return vs[0].(map[string]HttpRoute)[vs[1].(string)] - }).(HttpRouteOutput) -} - -type HttpStage struct { -} - -// HttpStageInput is an input type that accepts HttpStageArgs and HttpStageOutput values. -// You can construct a concrete instance of `HttpStageInput` via: +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" // -// HttpStageArgs{...} -type HttpStageInput interface { - pulumi.Input - - ToHttpStageOutput() HttpStageOutput - ToHttpStageOutputWithContext(context.Context) HttpStageOutput -} - -type HttpStageArgs struct { -} - -func (HttpStageArgs) ElementType() reflect.Type { - return reflect.TypeOf((*HttpStage)(nil)).Elem() -} - -func (i HttpStageArgs) ToHttpStageOutput() HttpStageOutput { - return i.ToHttpStageOutputWithContext(context.Background()) -} - -func (i HttpStageArgs) ToHttpStageOutputWithContext(ctx context.Context) HttpStageOutput { - return pulumi.ToOutputWithContext(ctx, i).(HttpStageOutput) -} - -func (i HttpStageArgs) ToOutput(ctx context.Context) pulumix.Output[HttpStage] { - return pulumix.Output[HttpStage]{ - OutputState: i.ToHttpStageOutputWithContext(ctx).OutputState, - } -} - -// HttpStageMapInput is an input type that accepts HttpStageMap and HttpStageMapOutput values. -// You can construct a concrete instance of `HttpStageMapInput` via: +// ) // -// HttpStageMap{ "key": HttpStageArgs{...} } -type HttpStageMapInput interface { - pulumi.Input - - ToHttpStageMapOutput() HttpStageMapOutput - ToHttpStageMapOutputWithContext(context.Context) HttpStageMapOutput -} - -type HttpStageMap map[string]HttpStageInput - -func (HttpStageMap) ElementType() reflect.Type { - return reflect.TypeOf((*map[string]HttpStage)(nil)).Elem() -} - -func (i HttpStageMap) ToHttpStageMapOutput() HttpStageMapOutput { - return i.ToHttpStageMapOutputWithContext(context.Background()) -} - -func (i HttpStageMap) ToHttpStageMapOutputWithContext(ctx context.Context) HttpStageMapOutput { - return pulumi.ToOutputWithContext(ctx, i).(HttpStageMapOutput) -} - -func (i HttpStageMap) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpStage] { - return pulumix.Output[map[string]HttpStage]{ - OutputState: i.ToHttpStageMapOutputWithContext(ctx).OutputState, - } -} - -type HttpStageOutput struct{ *pulumi.OutputState } - -func (HttpStageOutput) ElementType() reflect.Type { - return reflect.TypeOf((*HttpStage)(nil)).Elem() -} - -func (o HttpStageOutput) ToHttpStageOutput() HttpStageOutput { - return o -} - -func (o HttpStageOutput) ToHttpStageOutputWithContext(ctx context.Context) HttpStageOutput { - return o -} - -func (o HttpStageOutput) ToOutput(ctx context.Context) pulumix.Output[HttpStage] { - return pulumix.Output[HttpStage]{ - OutputState: o.OutputState, - } -} - -type HttpStageMapOutput struct{ *pulumi.OutputState } - -func (HttpStageMapOutput) ElementType() reflect.Type { - return reflect.TypeOf((*map[string]HttpStage)(nil)).Elem() -} - -func (o HttpStageMapOutput) ToHttpStageMapOutput() HttpStageMapOutput { - return o -} - -func (o HttpStageMapOutput) ToHttpStageMapOutputWithContext(ctx context.Context) HttpStageMapOutput { - return o -} - -func (o HttpStageMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]HttpStage] { - return pulumix.Output[map[string]HttpStage]{ - OutputState: o.OutputState, - } +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewAuthorizer(ctx, "example", &apigatewayv2.AuthorizerArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// AuthorizerType: pulumi.String("REQUEST"), +// AuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn), +// IdentitySources: pulumi.StringArray{ +// pulumi.String("$request.header.Authorization"), +// }, +// AuthorizerPayloadFormatVersion: pulumi.String("2.0"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_authorizer` using the API identifier and authorizer identifier. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/authorizer:Authorizer example aabbccddee/1122334 +// +// ``` +type HttpAuthorizer struct { + // Required credentials as an IAM role for API Gateway to invoke the authorizer. + // Supported only for `REQUEST` authorizers. + AuthorizerCredentialsArn *string `pulumi:"authorizerCredentialsArn"` + // Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. + // Valid values: `1.0`, `2.0`. + AuthorizerPayloadFormatVersion *string `pulumi:"authorizerPayloadFormatVersion"` + // Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. + // If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. + // Supported only for HTTP API Lambda authorizers. + AuthorizerResultTtlInSeconds *int `pulumi:"authorizerResultTtlInSeconds"` + // Authorizer type. Valid values: `JWT`, `REQUEST`. + // Specify `REQUEST` for a Lambda function using incoming request parameters. + // For HTTP APIs, specify `JWT` to use JSON Web Tokens. + AuthorizerType string `pulumi:"authorizerType"` + // Authorizer's Uniform Resource Identifier (URI). + // For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invoke_arn` attribute of the `aws.lambda.Function` resource. + // Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length. + AuthorizerUri *string `pulumi:"authorizerUri"` + // Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. + // Supported only for HTTP APIs. + EnableSimpleResponses *bool `pulumi:"enableSimpleResponses"` + // Identity sources for which authorization is requested. + // For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. + // For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. + IdentitySources []string `pulumi:"identitySources"` + // Configuration of a JWT authorizer. Required for the `JWT` authorizer type. + // Supported only for HTTP APIs. + JwtConfiguration *apigatewayv2.AuthorizerJwtConfiguration `pulumi:"jwtConfiguration"` + // Name of the authorizer. Must be between 1 and 128 characters in length. + Name *string `pulumi:"name"` +} + +// Manages an Amazon API Gateway Version 2 integration. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// IntegrationType: pulumi.String("MOCK"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Lambda Integration +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// exampleFunction, err := lambda.NewFunction(ctx, "exampleFunction", &lambda.FunctionArgs{ +// Code: pulumi.NewFileArchive("example.zip"), +// Role: pulumi.Any(aws_iam_role.Example.Arn), +// Handler: pulumi.String("index.handler"), +// Runtime: pulumi.String("nodejs16.x"), +// }) +// if err != nil { +// return err +// } +// _, err = apigatewayv2.NewIntegration(ctx, "exampleIntegration", &apigatewayv2.IntegrationArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// IntegrationType: pulumi.String("AWS_PROXY"), +// ConnectionType: pulumi.String("INTERNET"), +// ContentHandlingStrategy: pulumi.String("CONVERT_TO_TEXT"), +// Description: pulumi.String("Lambda example"), +// IntegrationMethod: pulumi.String("POST"), +// IntegrationUri: exampleFunction.InvokeArn, +// PassthroughBehavior: pulumi.String("WHEN_NO_MATCH"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### AWS Service Integration +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// CredentialsArn: pulumi.Any(aws_iam_role.Example.Arn), +// Description: pulumi.String("SQS example"), +// IntegrationType: pulumi.String("AWS_PROXY"), +// IntegrationSubtype: pulumi.String("SQS-SendMessage"), +// RequestParameters: pulumi.StringMap{ +// "QueueUrl": pulumi.String("$request.header.queueUrl"), +// "MessageBody": pulumi.String("$request.body.message"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Private Integration +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// CredentialsArn: pulumi.Any(aws_iam_role.Example.Arn), +// Description: pulumi.String("Example with a load balancer"), +// IntegrationType: pulumi.String("HTTP_PROXY"), +// IntegrationUri: pulumi.Any(aws_lb_listener.Example.Arn), +// IntegrationMethod: pulumi.String("ANY"), +// ConnectionType: pulumi.String("VPC_LINK"), +// ConnectionId: pulumi.Any(aws_apigatewayv2_vpc_link.Example.Id), +// TlsConfig: &apigatewayv2.IntegrationTlsConfigArgs{ +// ServerNameToVerify: pulumi.String("example.com"), +// }, +// RequestParameters: pulumi.StringMap{ +// "append:header.authforintegration": pulumi.String("$context.authorizer.authorizerResponse"), +// "overwrite:path": pulumi.String("staticValueForIntegration"), +// }, +// ResponseParameters: apigatewayv2.IntegrationResponseParameterArray{ +// &apigatewayv2.IntegrationResponseParameterArgs{ +// StatusCode: pulumi.String("403"), +// Mappings: pulumi.StringMap{ +// "append:header.auth": pulumi.String("$context.authorizer.authorizerResponse"), +// }, +// }, +// &apigatewayv2.IntegrationResponseParameterArgs{ +// StatusCode: pulumi.String("200"), +// Mappings: pulumi.StringMap{ +// "overwrite:statuscode": pulumi.String("204"), +// }, +// }, +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_integration` using the API identifier and integration identifier. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/integration:Integration example aabbccddee/1122334 +// +// ``` +// +// -> __Note:__ The API Gateway managed integration created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. +type HttpIntegration struct { + // ID of the VPC link for a private integration. Supported only for HTTP APIs. Must be between 1 and 1024 characters in length. + ConnectionId *string `pulumi:"connectionId"` + // Type of the network connection to the integration endpoint. Valid values: `INTERNET`, `VPC_LINK`. Default is `INTERNET`. + ConnectionType *string `pulumi:"connectionType"` + // Credentials required for the integration, if any. + CredentialsArn *string `pulumi:"credentialsArn"` + // Description of the integration. + Description *string `pulumi:"description"` + // Integration's HTTP method. Must be specified if `integration_type` is not `MOCK`. + IntegrationMethod *string `pulumi:"integrationMethod"` + // AWS service action to invoke. Supported only for HTTP APIs when `integration_type` is `AWS_PROXY`. See the [AWS service integration reference](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html) documentation for supported values. Must be between 1 and 128 characters in length. + IntegrationSubtype *string `pulumi:"integrationSubtype"` + // Integration type of an integration. + // Valid values: `AWS` (supported only for WebSocket APIs), `AWS_PROXY`, `HTTP` (supported only for WebSocket APIs), `HTTP_PROXY`, `MOCK` (supported only for WebSocket APIs). For an HTTP API private integration, use `HTTP_PROXY`. + IntegrationType *string `pulumi:"integrationType"` + // URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`. + // For an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service. + // Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + IntegrationUri *string `pulumi:"integrationUri"` + // A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + Lambda *lambda.Function `pulumi:"lambda"` + // The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + LambdaInvokeArn *string `pulumi:"lambdaInvokeArn"` + // The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. + PayloadFormatVersion *string `pulumi:"payloadFormatVersion"` + // For WebSocket APIs, a key-value map specifying request parameters that are passed from the method request to the backend. + // For HTTP APIs with a specified `integration_subtype`, a key-value map specifying parameters that are passed to `AWS_PROXY` integrations. + // For HTTP APIs without a specified `integration_subtype`, a key-value map specifying how to transform HTTP requests before sending them to the backend. + // See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html) for details. + RequestParameters map[string]string `pulumi:"requestParameters"` + // Mappings to transform the HTTP response from a backend integration before returning the response to clients. Supported only for HTTP APIs. + ResponseParameters []apigatewayv2.IntegrationResponseParameter `pulumi:"responseParameters"` + // Custom timeout between 50 and 29,000 milliseconds for WebSocket APIs and between 50 and 30,000 milliseconds for HTTP APIs. + // The default timeout is 29 seconds for WebSocket APIs and 30 seconds for HTTP APIs. + // this provider will only perform drift detection of its value when present in a configuration. + TimeoutMilliseconds *int `pulumi:"timeoutMilliseconds"` + // TLS configuration for a private integration. Supported only for HTTP APIs. + TlsConfig *apigatewayv2.IntegrationTlsConfig `pulumi:"tlsConfig"` +} + +// Manages an Amazon API Gateway Version 2 route. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html) for [WebSocket](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-develop-routes.html) and [HTTP](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-routes.html) APIs. +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// exampleApi, err := apigatewayv2.NewApi(ctx, "exampleApi", &apigatewayv2.ApiArgs{ +// ProtocolType: pulumi.String("WEBSOCKET"), +// RouteSelectionExpression: pulumi.String("$request.body.action"), +// }) +// if err != nil { +// return err +// } +// _, err = apigatewayv2.NewRoute(ctx, "exampleRoute", &apigatewayv2.RouteArgs{ +// ApiId: exampleApi.ID(), +// RouteKey: pulumi.String("$default"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### HTTP Proxy Integration +// ```go +// package main +// +// import ( +// +// "fmt" +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// exampleApi, err := apigatewayv2.NewApi(ctx, "exampleApi", &apigatewayv2.ApiArgs{ +// ProtocolType: pulumi.String("HTTP"), +// }) +// if err != nil { +// return err +// } +// exampleIntegration, err := apigatewayv2.NewIntegration(ctx, "exampleIntegration", &apigatewayv2.IntegrationArgs{ +// ApiId: exampleApi.ID(), +// IntegrationType: pulumi.String("HTTP_PROXY"), +// IntegrationMethod: pulumi.String("ANY"), +// IntegrationUri: pulumi.String("https://example.com/{proxy}"), +// }) +// if err != nil { +// return err +// } +// _, err = apigatewayv2.NewRoute(ctx, "exampleRoute", &apigatewayv2.RouteArgs{ +// ApiId: exampleApi.ID(), +// RouteKey: pulumi.String("ANY /example/{proxy+}"), +// Target: exampleIntegration.ID().ApplyT(func(id string) (string, error) { +// return fmt.Sprintf("integrations/%v", id), nil +// }).(pulumi.StringOutput), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_route` using the API identifier and route identifier. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/route:Route example aabbccddee/1122334 +// +// ``` +// +// -> __Note:__ The API Gateway managed route created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. +type HttpRoute struct { + // Boolean whether an API key is required for the route. Defaults to `false`. Supported only for WebSocket APIs. + ApiKeyRequired *bool `pulumi:"apiKeyRequired"` + // Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation. + AuthorizationScopes []string `pulumi:"authorizationScopes"` + // Authorization type for the route. + // For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + // For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + // Defaults to `NONE`. + AuthorizationType *string `pulumi:"authorizationType"` + // The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + Authorizer *string `pulumi:"authorizer"` + // Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. + AuthorizerId *string `pulumi:"authorizerId"` + // The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + Integration *string `pulumi:"integration"` + // Operation name for the route. Must be between 1 and 64 characters in length. + OperationName *string `pulumi:"operationName"` + // Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + Target *string `pulumi:"target"` } -func (o HttpStageMapOutput) MapIndex(k pulumi.StringInput) HttpStageOutput { - return pulumi.All(o, k).ApplyT(func(vs []interface{}) HttpStage { - return vs[0].(map[string]HttpStage)[vs[1].(string)] - }).(HttpStageOutput) +// Manages an Amazon API Gateway Version 2 stage. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewStage(ctx, "example", &apigatewayv2.StageArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_stage` using the API identifier and stage name. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/stage:Stage example aabbccddee/example-stage +// +// ``` +// +// -> __Note:__ The API Gateway managed stage created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. +type HttpStage struct { + // Settings for logging access in this stage. + // Use the `aws.apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions). + AccessLogSettings *apigatewayv2.StageAccessLogSettings `pulumi:"accessLogSettings"` + // Whether updates to an API automatically trigger a new deployment. Defaults to `false`. Applicable for HTTP APIs. + AutoDeploy *bool `pulumi:"autoDeploy"` + // Identifier of a client certificate for the stage. Use the `aws.apigateway.ClientCertificate` resource to configure a client certificate. + // Supported only for WebSocket APIs. + ClientCertificateId *string `pulumi:"clientCertificateId"` + // Default route settings for the stage. + DefaultRouteSettings *apigatewayv2.StageDefaultRouteSettings `pulumi:"defaultRouteSettings"` + // Deployment identifier of the stage. Use the `aws.apigatewayv2.Deployment` resource to configure a deployment. + DeploymentId *string `pulumi:"deploymentId"` + // Description for the stage. Must be less than or equal to 1024 characters in length. + Description *string `pulumi:"description"` + // Name of the stage. Must be between 1 and 128 characters in length. + // + // The following arguments are optional: + Name *string `pulumi:"name"` + // Route settings for the stage. + RouteSettings []apigatewayv2.StageRouteSetting `pulumi:"routeSettings"` + // Map that defines the stage variables for the stage. + StageVariables map[string]string `pulumi:"stageVariables"` + // Map of tags to assign to the stage. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + Tags map[string]string `pulumi:"tags"` } func init() { pulumi.RegisterInputType(reflect.TypeOf((*DomainConfigurationInput)(nil)).Elem(), DomainConfigurationArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*DomainConfigurationPtrInput)(nil)).Elem(), DomainConfigurationArgs{}) - pulumi.RegisterInputType(reflect.TypeOf((*DomainMappingInput)(nil)).Elem(), DomainMappingArgs{}) - pulumi.RegisterInputType(reflect.TypeOf((*DomainMappingMapInput)(nil)).Elem(), DomainMappingMap{}) - pulumi.RegisterInputType(reflect.TypeOf((*HttpAuthorizerInput)(nil)).Elem(), HttpAuthorizerArgs{}) - pulumi.RegisterInputType(reflect.TypeOf((*HttpAuthorizerMapInput)(nil)).Elem(), HttpAuthorizerMap{}) - pulumi.RegisterInputType(reflect.TypeOf((*HttpIntegrationInput)(nil)).Elem(), HttpIntegrationArgs{}) - pulumi.RegisterInputType(reflect.TypeOf((*HttpIntegrationMapInput)(nil)).Elem(), HttpIntegrationMap{}) - pulumi.RegisterInputType(reflect.TypeOf((*HttpRouteInput)(nil)).Elem(), HttpRouteArgs{}) - pulumi.RegisterInputType(reflect.TypeOf((*HttpRouteMapInput)(nil)).Elem(), HttpRouteMap{}) - pulumi.RegisterInputType(reflect.TypeOf((*HttpStageInput)(nil)).Elem(), HttpStageArgs{}) - pulumi.RegisterInputType(reflect.TypeOf((*HttpStageMapInput)(nil)).Elem(), HttpStageMap{}) pulumi.RegisterOutputType(DomainConfigurationOutput{}) pulumi.RegisterOutputType(DomainConfigurationPtrOutput{}) - pulumi.RegisterOutputType(DomainMappingOutput{}) - pulumi.RegisterOutputType(DomainMappingMapOutput{}) - pulumi.RegisterOutputType(HttpAuthorizerOutput{}) - pulumi.RegisterOutputType(HttpAuthorizerMapOutput{}) - pulumi.RegisterOutputType(HttpIntegrationOutput{}) - pulumi.RegisterOutputType(HttpIntegrationMapOutput{}) - pulumi.RegisterOutputType(HttpRouteOutput{}) - pulumi.RegisterOutputType(HttpRouteMapOutput{}) - pulumi.RegisterOutputType(HttpStageOutput{}) - pulumi.RegisterOutputType(HttpStageMapOutput{}) } diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApiArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApiArgs.java index 5bcfe06d6..221ef2713 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApiArgs.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApiArgs.java @@ -47,13 +47,13 @@ public Optional> apiKeySelectionExpression() { * */ @Import(name="authorizers") - private @Nullable Output> authorizers; + private @Nullable Map authorizers; /** * @return The authorizers for the HTTP API routes. * */ - public Optional>> authorizers() { + public Optional> authorizers() { return Optional.ofNullable(this.authorizers); } @@ -126,13 +126,13 @@ public Optional> disableExecuteApiEndpoint() { * */ @Import(name="domainMappings") - private @Nullable Output> domainMappings; + private @Nullable Map domainMappings; /** * @return The domain names for the HTTP API. * */ - public Optional>> domainMappings() { + public Optional> domainMappings() { return Optional.ofNullable(this.domainMappings); } @@ -156,13 +156,13 @@ public Optional> failOnWarnings() { * */ @Import(name="integrations") - private @Nullable Output> integrations; + private @Nullable Map integrations; /** * @return The integrations for the HTTP API routes. * */ - public Optional>> integrations() { + public Optional> integrations() { return Optional.ofNullable(this.integrations); } @@ -203,13 +203,13 @@ public Optional> routeSelectionExpression() { * */ @Import(name="routes", required=true) - private Output> routes; + private Map routes; /** * @return The routes for the HTTP API. * */ - public Output> routes() { + public Map routes() { return this.routes; } @@ -218,13 +218,13 @@ public Output> routes() { * */ @Import(name="stages") - private @Nullable Output> stages; + private @Nullable Map stages; /** * @return The deployment stages for the HTTP API. * */ - public Optional>> stages() { + public Optional> stages() { return Optional.ofNullable(this.stages); } @@ -327,21 +327,11 @@ public Builder apiKeySelectionExpression(String apiKeySelectionExpression) { * @return builder * */ - public Builder authorizers(@Nullable Output> authorizers) { + public Builder authorizers(@Nullable Map authorizers) { $.authorizers = authorizers; return this; } - /** - * @param authorizers The authorizers for the HTTP API routes. - * - * @return builder - * - */ - public Builder authorizers(Map authorizers) { - return authorizers(Output.of(authorizers)); - } - /** * @param body An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. * @@ -436,21 +426,11 @@ public Builder disableExecuteApiEndpoint(Boolean disableExecuteApiEndpoint) { * @return builder * */ - public Builder domainMappings(@Nullable Output> domainMappings) { + public Builder domainMappings(@Nullable Map domainMappings) { $.domainMappings = domainMappings; return this; } - /** - * @param domainMappings The domain names for the HTTP API. - * - * @return builder - * - */ - public Builder domainMappings(Map domainMappings) { - return domainMappings(Output.of(domainMappings)); - } - /** * @param failOnWarnings Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. * @@ -478,21 +458,11 @@ public Builder failOnWarnings(Boolean failOnWarnings) { * @return builder * */ - public Builder integrations(@Nullable Output> integrations) { + public Builder integrations(@Nullable Map integrations) { $.integrations = integrations; return this; } - /** - * @param integrations The integrations for the HTTP API routes. - * - * @return builder - * - */ - public Builder integrations(Map integrations) { - return integrations(Output.of(integrations)); - } - /** * @param name Name of the API. Must be less than or equal to 128 characters in length. * @@ -543,42 +513,22 @@ public Builder routeSelectionExpression(String routeSelectionExpression) { * @return builder * */ - public Builder routes(Output> routes) { + public Builder routes(Map routes) { $.routes = routes; return this; } - /** - * @param routes The routes for the HTTP API. - * - * @return builder - * - */ - public Builder routes(Map routes) { - return routes(Output.of(routes)); - } - /** * @param stages The deployment stages for the HTTP API. * * @return builder * */ - public Builder stages(@Nullable Output> stages) { + public Builder stages(@Nullable Map stages) { $.stages = stages; return this; } - /** - * @param stages The deployment stages for the HTTP API. - * - * @return builder - * - */ - public Builder stages(Map stages) { - return stages(Output.of(stages)); - } - /** * @param tags Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. * diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainConfigurationArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainConfigurationArgs.java index 8c8232bd2..e047717fa 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainConfigurationArgs.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainConfigurationArgs.java @@ -124,15 +124,15 @@ public final class DomainConfigurationArgs extends com.pulumi.resources.Resource * Domain name configuration. See below. * */ - @Import(name="domainNameConfiguration") - private @Nullable Output domainNameConfiguration; + @Import(name="domainNameConfiguration", required=true) + private Output domainNameConfiguration; /** * @return Domain name configuration. See below. * */ - public Optional> domainNameConfiguration() { - return Optional.ofNullable(this.domainNameConfiguration); + public Output domainNameConfiguration() { + return this.domainNameConfiguration; } /** @@ -197,7 +197,7 @@ public Builder(DomainConfigurationArgs defaults) { * @return builder * */ - public Builder domainNameConfiguration(@Nullable Output domainNameConfiguration) { + public Builder domainNameConfiguration(Output domainNameConfiguration) { $.domainNameConfiguration = domainNameConfiguration; return this; } @@ -255,6 +255,7 @@ public Builder tags(Map tags) { } public DomainConfigurationArgs build() { + $.domainNameConfiguration = Objects.requireNonNull($.domainNameConfiguration, "expected parameter 'domainNameConfiguration' to be non-null"); return $; } } diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainMappingArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainMappingArgs.java index ea29a5976..5f70428e5 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainMappingArgs.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainMappingArgs.java @@ -12,22 +12,83 @@ import javax.annotation.Nullable; +/** + * Manages an Amazon API Gateway Version 2 API mapping. + * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). + * + * ## Example Usage + * ### Basic + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.ApiMapping; + * import com.pulumi.aws.apigatewayv2.ApiMappingArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new ApiMapping("example", ApiMappingArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .domainName(aws_apigatewayv2_domain_name.example().id()) + * .stage(aws_apigatewayv2_stage.example().id()) + * .build()); + * + * } + * } + * ``` + * + * ## Import + * + * Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: + * + * ```sh + * $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com + * ``` + * + */ public final class DomainMappingArgs extends com.pulumi.resources.ResourceArgs { public static final DomainMappingArgs Empty = new DomainMappingArgs(); + /** + * The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). + * + */ + @Import(name="apiMappingKey") + private @Nullable Output apiMappingKey; + + /** + * @return The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). + * + */ + public Optional> apiMappingKey() { + return Optional.ofNullable(this.apiMappingKey); + } + /** * Configuration of the domain name to create. Cannot be specified together with `domainId`. * */ @Import(name="domainConfiguration") - private @Nullable Output domainConfiguration; + private @Nullable DomainConfigurationArgs domainConfiguration; /** * @return Configuration of the domain name to create. Cannot be specified together with `domainId`. * */ - public Optional> domainConfiguration() { + public Optional domainConfiguration() { return Optional.ofNullable(this.domainConfiguration); } @@ -46,11 +107,28 @@ public Optional> domainId() { return Optional.ofNullable(this.domainId); } + /** + * API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. + * + */ + @Import(name="stage", required=true) + private Output stage; + + /** + * @return API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. + * + */ + public Output stage() { + return this.stage; + } + private DomainMappingArgs() {} private DomainMappingArgs(DomainMappingArgs $) { + this.apiMappingKey = $.apiMappingKey; this.domainConfiguration = $.domainConfiguration; this.domainId = $.domainId; + this.stage = $.stage; } public static Builder builder() { @@ -72,24 +150,35 @@ public Builder(DomainMappingArgs defaults) { } /** - * @param domainConfiguration Configuration of the domain name to create. Cannot be specified together with `domainId`. + * @param apiMappingKey The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). * * @return builder * */ - public Builder domainConfiguration(@Nullable Output domainConfiguration) { - $.domainConfiguration = domainConfiguration; + public Builder apiMappingKey(@Nullable Output apiMappingKey) { + $.apiMappingKey = apiMappingKey; return this; } + /** + * @param apiMappingKey The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). + * + * @return builder + * + */ + public Builder apiMappingKey(String apiMappingKey) { + return apiMappingKey(Output.of(apiMappingKey)); + } + /** * @param domainConfiguration Configuration of the domain name to create. Cannot be specified together with `domainId`. * * @return builder * */ - public Builder domainConfiguration(DomainConfigurationArgs domainConfiguration) { - return domainConfiguration(Output.of(domainConfiguration)); + public Builder domainConfiguration(@Nullable DomainConfigurationArgs domainConfiguration) { + $.domainConfiguration = domainConfiguration; + return this; } /** @@ -113,7 +202,29 @@ public Builder domainId(String domainId) { return domainId(Output.of(domainId)); } + /** + * @param stage API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. + * + * @return builder + * + */ + public Builder stage(Output stage) { + $.stage = stage; + return this; + } + + /** + * @param stage API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. + * + * @return builder + * + */ + public Builder stage(String stage) { + return stage(Output.of(stage)); + } + public DomainMappingArgs build() { + $.stage = Objects.requireNonNull($.stage, "expected parameter 'stage' to be non-null"); return $; } } diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpAuthorizerArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpAuthorizerArgs.java index 50360508d..5e03e5016 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpAuthorizerArgs.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpAuthorizerArgs.java @@ -3,16 +3,281 @@ package com.pulumi.awsx.apigatewayv2.inputs; +import com.pulumi.aws.apigatewayv2.inputs.AuthorizerJwtConfigurationArgs; +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import java.lang.Boolean; +import java.lang.Integer; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; - +/** + * Manages an Amazon API Gateway Version 2 authorizer. + * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). + * + * ## Example Usage + * ### Basic WebSocket API + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Authorizer; + * import com.pulumi.aws.apigatewayv2.AuthorizerArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new Authorizer("example", AuthorizerArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .authorizerType("REQUEST") + * .authorizerUri(aws_lambda_function.example().invoke_arn()) + * .identitySources("route.request.header.Auth") + * .build()); + * + * } + * } + * ``` + * ### Basic HTTP API + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Authorizer; + * import com.pulumi.aws.apigatewayv2.AuthorizerArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new Authorizer("example", AuthorizerArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .authorizerType("REQUEST") + * .authorizerUri(aws_lambda_function.example().invoke_arn()) + * .identitySources("$request.header.Authorization") + * .authorizerPayloadFormatVersion("2.0") + * .build()); + * + * } + * } + * ``` + * + * ## Import + * + * Using `pulumi import`, import `aws_apigatewayv2_authorizer` using the API identifier and authorizer identifier. For example: + * + * ```sh + * $ pulumi import aws:apigatewayv2/authorizer:Authorizer example aabbccddee/1122334 + * ``` + * + */ public final class HttpAuthorizerArgs extends com.pulumi.resources.ResourceArgs { public static final HttpAuthorizerArgs Empty = new HttpAuthorizerArgs(); + /** + * Required credentials as an IAM role for API Gateway to invoke the authorizer. + * Supported only for `REQUEST` authorizers. + * + */ + @Import(name="authorizerCredentialsArn") + private @Nullable Output authorizerCredentialsArn; + + /** + * @return Required credentials as an IAM role for API Gateway to invoke the authorizer. + * Supported only for `REQUEST` authorizers. + * + */ + public Optional> authorizerCredentialsArn() { + return Optional.ofNullable(this.authorizerCredentialsArn); + } + + /** + * Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. + * Valid values: `1.0`, `2.0`. + * + */ + @Import(name="authorizerPayloadFormatVersion") + private @Nullable Output authorizerPayloadFormatVersion; + + /** + * @return Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. + * Valid values: `1.0`, `2.0`. + * + */ + public Optional> authorizerPayloadFormatVersion() { + return Optional.ofNullable(this.authorizerPayloadFormatVersion); + } + + /** + * Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. + * If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. + * Supported only for HTTP API Lambda authorizers. + * + */ + @Import(name="authorizerResultTtlInSeconds") + private @Nullable Output authorizerResultTtlInSeconds; + + /** + * @return Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. + * If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. + * Supported only for HTTP API Lambda authorizers. + * + */ + public Optional> authorizerResultTtlInSeconds() { + return Optional.ofNullable(this.authorizerResultTtlInSeconds); + } + + /** + * Authorizer type. Valid values: `JWT`, `REQUEST`. + * Specify `REQUEST` for a Lambda function using incoming request parameters. + * For HTTP APIs, specify `JWT` to use JSON Web Tokens. + * + */ + @Import(name="authorizerType", required=true) + private Output authorizerType; + + /** + * @return Authorizer type. Valid values: `JWT`, `REQUEST`. + * Specify `REQUEST` for a Lambda function using incoming request parameters. + * For HTTP APIs, specify `JWT` to use JSON Web Tokens. + * + */ + public Output authorizerType() { + return this.authorizerType; + } + + /** + * Authorizer's Uniform Resource Identifier (URI). + * For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invoke_arn` attribute of the `aws.lambda.Function` resource. + * Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length. + * + */ + @Import(name="authorizerUri") + private @Nullable Output authorizerUri; + + /** + * @return Authorizer's Uniform Resource Identifier (URI). + * For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invoke_arn` attribute of the `aws.lambda.Function` resource. + * Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length. + * + */ + public Optional> authorizerUri() { + return Optional.ofNullable(this.authorizerUri); + } + + /** + * Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. + * Supported only for HTTP APIs. + * + */ + @Import(name="enableSimpleResponses") + private @Nullable Output enableSimpleResponses; + + /** + * @return Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. + * Supported only for HTTP APIs. + * + */ + public Optional> enableSimpleResponses() { + return Optional.ofNullable(this.enableSimpleResponses); + } + + /** + * Identity sources for which authorization is requested. + * For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. + * For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. + * + */ + @Import(name="identitySources") + private @Nullable Output> identitySources; + + /** + * @return Identity sources for which authorization is requested. + * For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. + * For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. + * + */ + public Optional>> identitySources() { + return Optional.ofNullable(this.identitySources); + } + + /** + * Configuration of a JWT authorizer. Required for the `JWT` authorizer type. + * Supported only for HTTP APIs. + * + */ + @Import(name="jwtConfiguration") + private @Nullable Output jwtConfiguration; + + /** + * @return Configuration of a JWT authorizer. Required for the `JWT` authorizer type. + * Supported only for HTTP APIs. + * + */ + public Optional> jwtConfiguration() { + return Optional.ofNullable(this.jwtConfiguration); + } + + /** + * Name of the authorizer. Must be between 1 and 128 characters in length. + * + */ + @Import(name="name") + private @Nullable Output name; + + /** + * @return Name of the authorizer. Must be between 1 and 128 characters in length. + * + */ + public Optional> name() { + return Optional.ofNullable(this.name); + } + + private HttpAuthorizerArgs() {} + + private HttpAuthorizerArgs(HttpAuthorizerArgs $) { + this.authorizerCredentialsArn = $.authorizerCredentialsArn; + this.authorizerPayloadFormatVersion = $.authorizerPayloadFormatVersion; + this.authorizerResultTtlInSeconds = $.authorizerResultTtlInSeconds; + this.authorizerType = $.authorizerType; + this.authorizerUri = $.authorizerUri; + this.enableSimpleResponses = $.enableSimpleResponses; + this.identitySources = $.identitySources; + this.jwtConfiguration = $.jwtConfiguration; + this.name = $.name; + } + public static Builder builder() { return new Builder(); } + public static Builder builder(HttpAuthorizerArgs defaults) { + return new Builder(defaults); + } public static final class Builder { private HttpAuthorizerArgs $; @@ -20,7 +285,238 @@ public static final class Builder { public Builder() { $ = new HttpAuthorizerArgs(); } + + public Builder(HttpAuthorizerArgs defaults) { + $ = new HttpAuthorizerArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param authorizerCredentialsArn Required credentials as an IAM role for API Gateway to invoke the authorizer. + * Supported only for `REQUEST` authorizers. + * + * @return builder + * + */ + public Builder authorizerCredentialsArn(@Nullable Output authorizerCredentialsArn) { + $.authorizerCredentialsArn = authorizerCredentialsArn; + return this; + } + + /** + * @param authorizerCredentialsArn Required credentials as an IAM role for API Gateway to invoke the authorizer. + * Supported only for `REQUEST` authorizers. + * + * @return builder + * + */ + public Builder authorizerCredentialsArn(String authorizerCredentialsArn) { + return authorizerCredentialsArn(Output.of(authorizerCredentialsArn)); + } + + /** + * @param authorizerPayloadFormatVersion Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. + * Valid values: `1.0`, `2.0`. + * + * @return builder + * + */ + public Builder authorizerPayloadFormatVersion(@Nullable Output authorizerPayloadFormatVersion) { + $.authorizerPayloadFormatVersion = authorizerPayloadFormatVersion; + return this; + } + + /** + * @param authorizerPayloadFormatVersion Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. + * Valid values: `1.0`, `2.0`. + * + * @return builder + * + */ + public Builder authorizerPayloadFormatVersion(String authorizerPayloadFormatVersion) { + return authorizerPayloadFormatVersion(Output.of(authorizerPayloadFormatVersion)); + } + + /** + * @param authorizerResultTtlInSeconds Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. + * If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. + * Supported only for HTTP API Lambda authorizers. + * + * @return builder + * + */ + public Builder authorizerResultTtlInSeconds(@Nullable Output authorizerResultTtlInSeconds) { + $.authorizerResultTtlInSeconds = authorizerResultTtlInSeconds; + return this; + } + + /** + * @param authorizerResultTtlInSeconds Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. + * If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. + * Supported only for HTTP API Lambda authorizers. + * + * @return builder + * + */ + public Builder authorizerResultTtlInSeconds(Integer authorizerResultTtlInSeconds) { + return authorizerResultTtlInSeconds(Output.of(authorizerResultTtlInSeconds)); + } + + /** + * @param authorizerType Authorizer type. Valid values: `JWT`, `REQUEST`. + * Specify `REQUEST` for a Lambda function using incoming request parameters. + * For HTTP APIs, specify `JWT` to use JSON Web Tokens. + * + * @return builder + * + */ + public Builder authorizerType(Output authorizerType) { + $.authorizerType = authorizerType; + return this; + } + + /** + * @param authorizerType Authorizer type. Valid values: `JWT`, `REQUEST`. + * Specify `REQUEST` for a Lambda function using incoming request parameters. + * For HTTP APIs, specify `JWT` to use JSON Web Tokens. + * + * @return builder + * + */ + public Builder authorizerType(String authorizerType) { + return authorizerType(Output.of(authorizerType)); + } + + /** + * @param authorizerUri Authorizer's Uniform Resource Identifier (URI). + * For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invoke_arn` attribute of the `aws.lambda.Function` resource. + * Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length. + * + * @return builder + * + */ + public Builder authorizerUri(@Nullable Output authorizerUri) { + $.authorizerUri = authorizerUri; + return this; + } + + /** + * @param authorizerUri Authorizer's Uniform Resource Identifier (URI). + * For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invoke_arn` attribute of the `aws.lambda.Function` resource. + * Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length. + * + * @return builder + * + */ + public Builder authorizerUri(String authorizerUri) { + return authorizerUri(Output.of(authorizerUri)); + } + + /** + * @param enableSimpleResponses Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. + * Supported only for HTTP APIs. + * + * @return builder + * + */ + public Builder enableSimpleResponses(@Nullable Output enableSimpleResponses) { + $.enableSimpleResponses = enableSimpleResponses; + return this; + } + + /** + * @param enableSimpleResponses Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. + * Supported only for HTTP APIs. + * + * @return builder + * + */ + public Builder enableSimpleResponses(Boolean enableSimpleResponses) { + return enableSimpleResponses(Output.of(enableSimpleResponses)); + } + + /** + * @param identitySources Identity sources for which authorization is requested. + * For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. + * For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. + * + * @return builder + * + */ + public Builder identitySources(@Nullable Output> identitySources) { + $.identitySources = identitySources; + return this; + } + + /** + * @param identitySources Identity sources for which authorization is requested. + * For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. + * For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. + * + * @return builder + * + */ + public Builder identitySources(List identitySources) { + return identitySources(Output.of(identitySources)); + } + + /** + * @param identitySources Identity sources for which authorization is requested. + * For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. + * For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. + * + * @return builder + * + */ + public Builder identitySources(String... identitySources) { + return identitySources(List.of(identitySources)); + } + + /** + * @param jwtConfiguration Configuration of a JWT authorizer. Required for the `JWT` authorizer type. + * Supported only for HTTP APIs. + * + * @return builder + * + */ + public Builder jwtConfiguration(@Nullable Output jwtConfiguration) { + $.jwtConfiguration = jwtConfiguration; + return this; + } + + /** + * @param jwtConfiguration Configuration of a JWT authorizer. Required for the `JWT` authorizer type. + * Supported only for HTTP APIs. + * + * @return builder + * + */ + public Builder jwtConfiguration(AuthorizerJwtConfigurationArgs jwtConfiguration) { + return jwtConfiguration(Output.of(jwtConfiguration)); + } + + /** + * @param name Name of the authorizer. Must be between 1 and 128 characters in length. + * + * @return builder + * + */ + public Builder name(@Nullable Output name) { + $.name = name; + return this; + } + + /** + * @param name Name of the authorizer. Must be between 1 and 128 characters in length. + * + * @return builder + * + */ + public Builder name(String name) { + return name(Output.of(name)); + } + public HttpAuthorizerArgs build() { + $.authorizerType = Objects.requireNonNull($.authorizerType, "expected parameter 'authorizerType' to be non-null"); return $; } } diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpIntegrationArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpIntegrationArgs.java index 6266597ed..ad3cf7f7d 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpIntegrationArgs.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpIntegrationArgs.java @@ -3,16 +3,474 @@ package com.pulumi.awsx.apigatewayv2.inputs; +import com.pulumi.aws.apigatewayv2.inputs.IntegrationResponseParameterArgs; +import com.pulumi.aws.apigatewayv2.inputs.IntegrationTlsConfigArgs; +import com.pulumi.aws.lambda.Function; +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import java.lang.Integer; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; - +/** + * Manages an Amazon API Gateway Version 2 integration. + * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). + * + * ## Example Usage + * ### Basic + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Integration; + * import com.pulumi.aws.apigatewayv2.IntegrationArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new Integration("example", IntegrationArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .integrationType("MOCK") + * .build()); + * + * } + * } + * ``` + * ### Lambda Integration + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.lambda.Function; + * import com.pulumi.aws.lambda.FunctionArgs; + * import com.pulumi.aws.apigatewayv2.Integration; + * import com.pulumi.aws.apigatewayv2.IntegrationArgs; + * import com.pulumi.asset.FileArchive; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var exampleFunction = new Function("exampleFunction", FunctionArgs.builder() + * .code(new FileArchive("example.zip")) + * .role(aws_iam_role.example().arn()) + * .handler("index.handler") + * .runtime("nodejs16.x") + * .build()); + * + * var exampleIntegration = new Integration("exampleIntegration", IntegrationArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .integrationType("AWS_PROXY") + * .connectionType("INTERNET") + * .contentHandlingStrategy("CONVERT_TO_TEXT") + * .description("Lambda example") + * .integrationMethod("POST") + * .integrationUri(exampleFunction.invokeArn()) + * .passthroughBehavior("WHEN_NO_MATCH") + * .build()); + * + * } + * } + * ``` + * ### AWS Service Integration + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Integration; + * import com.pulumi.aws.apigatewayv2.IntegrationArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new Integration("example", IntegrationArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .credentialsArn(aws_iam_role.example().arn()) + * .description("SQS example") + * .integrationType("AWS_PROXY") + * .integrationSubtype("SQS-SendMessage") + * .requestParameters(Map.ofEntries( + * Map.entry("QueueUrl", "$request.header.queueUrl"), + * Map.entry("MessageBody", "$request.body.message") + * )) + * .build()); + * + * } + * } + * ``` + * ### Private Integration + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Integration; + * import com.pulumi.aws.apigatewayv2.IntegrationArgs; + * import com.pulumi.aws.apigatewayv2.inputs.IntegrationTlsConfigArgs; + * import com.pulumi.aws.apigatewayv2.inputs.IntegrationResponseParameterArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new Integration("example", IntegrationArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .credentialsArn(aws_iam_role.example().arn()) + * .description("Example with a load balancer") + * .integrationType("HTTP_PROXY") + * .integrationUri(aws_lb_listener.example().arn()) + * .integrationMethod("ANY") + * .connectionType("VPC_LINK") + * .connectionId(aws_apigatewayv2_vpc_link.example().id()) + * .tlsConfig(IntegrationTlsConfigArgs.builder() + * .serverNameToVerify("example.com") + * .build()) + * .requestParameters(Map.ofEntries( + * Map.entry("append:header.authforintegration", "$context.authorizer.authorizerResponse"), + * Map.entry("overwrite:path", "staticValueForIntegration") + * )) + * .responseParameters( + * IntegrationResponseParameterArgs.builder() + * .statusCode(403) + * .mappings(Map.of("append:header.auth", "$context.authorizer.authorizerResponse")) + * .build(), + * IntegrationResponseParameterArgs.builder() + * .statusCode(200) + * .mappings(Map.of("overwrite:statuscode", "204")) + * .build()) + * .build()); + * + * } + * } + * ``` + * + * ## Import + * + * Using `pulumi import`, import `aws_apigatewayv2_integration` using the API identifier and integration identifier. For example: + * + * ```sh + * $ pulumi import aws:apigatewayv2/integration:Integration example aabbccddee/1122334 + * ``` + * -> __Note:__ The API Gateway managed integration created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. + * + */ public final class HttpIntegrationArgs extends com.pulumi.resources.ResourceArgs { public static final HttpIntegrationArgs Empty = new HttpIntegrationArgs(); + /** + * ID of the VPC link for a private integration. Supported only for HTTP APIs. Must be between 1 and 1024 characters in length. + * + */ + @Import(name="connectionId") + private @Nullable Output connectionId; + + /** + * @return ID of the VPC link for a private integration. Supported only for HTTP APIs. Must be between 1 and 1024 characters in length. + * + */ + public Optional> connectionId() { + return Optional.ofNullable(this.connectionId); + } + + /** + * Type of the network connection to the integration endpoint. Valid values: `INTERNET`, `VPC_LINK`. Default is `INTERNET`. + * + */ + @Import(name="connectionType") + private @Nullable Output connectionType; + + /** + * @return Type of the network connection to the integration endpoint. Valid values: `INTERNET`, `VPC_LINK`. Default is `INTERNET`. + * + */ + public Optional> connectionType() { + return Optional.ofNullable(this.connectionType); + } + + /** + * Credentials required for the integration, if any. + * + */ + @Import(name="credentialsArn") + private @Nullable Output credentialsArn; + + /** + * @return Credentials required for the integration, if any. + * + */ + public Optional> credentialsArn() { + return Optional.ofNullable(this.credentialsArn); + } + + /** + * Description of the integration. + * + */ + @Import(name="description") + private @Nullable Output description; + + /** + * @return Description of the integration. + * + */ + public Optional> description() { + return Optional.ofNullable(this.description); + } + + /** + * Integration's HTTP method. Must be specified if `integration_type` is not `MOCK`. + * + */ + @Import(name="integrationMethod") + private @Nullable Output integrationMethod; + + /** + * @return Integration's HTTP method. Must be specified if `integration_type` is not `MOCK`. + * + */ + public Optional> integrationMethod() { + return Optional.ofNullable(this.integrationMethod); + } + + /** + * AWS service action to invoke. Supported only for HTTP APIs when `integration_type` is `AWS_PROXY`. See the [AWS service integration reference](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html) documentation for supported values. Must be between 1 and 128 characters in length. + * + */ + @Import(name="integrationSubtype") + private @Nullable Output integrationSubtype; + + /** + * @return AWS service action to invoke. Supported only for HTTP APIs when `integration_type` is `AWS_PROXY`. See the [AWS service integration reference](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html) documentation for supported values. Must be between 1 and 128 characters in length. + * + */ + public Optional> integrationSubtype() { + return Optional.ofNullable(this.integrationSubtype); + } + + /** + * Integration type of an integration. + * Valid values: `AWS` (supported only for WebSocket APIs), `AWS_PROXY`, `HTTP` (supported only for WebSocket APIs), `HTTP_PROXY`, `MOCK` (supported only for WebSocket APIs). For an HTTP API private integration, use `HTTP_PROXY`. + * + */ + @Import(name="integrationType") + private @Nullable Output integrationType; + + /** + * @return Integration type of an integration. + * Valid values: `AWS` (supported only for WebSocket APIs), `AWS_PROXY`, `HTTP` (supported only for WebSocket APIs), `HTTP_PROXY`, `MOCK` (supported only for WebSocket APIs). For an HTTP API private integration, use `HTTP_PROXY`. + * + */ + public Optional> integrationType() { + return Optional.ofNullable(this.integrationType); + } + + /** + * URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`. + * For an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service. + * Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * + */ + @Import(name="integrationUri") + private @Nullable Output integrationUri; + + /** + * @return URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`. + * For an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service. + * Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * + */ + public Optional> integrationUri() { + return Optional.ofNullable(this.integrationUri); + } + + /** + * A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * + */ + @Import(name="lambda") + private @Nullable Function lambda; + + /** + * @return A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * + */ + public Optional lambda() { + return Optional.ofNullable(this.lambda); + } + + /** + * The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * + */ + @Import(name="lambdaInvokeArn") + private @Nullable Output lambdaInvokeArn; + + /** + * @return The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * + */ + public Optional> lambdaInvokeArn() { + return Optional.ofNullable(this.lambdaInvokeArn); + } + + /** + * The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. + * + */ + @Import(name="payloadFormatVersion") + private @Nullable Output payloadFormatVersion; + + /** + * @return The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. + * + */ + public Optional> payloadFormatVersion() { + return Optional.ofNullable(this.payloadFormatVersion); + } + + /** + * For WebSocket APIs, a key-value map specifying request parameters that are passed from the method request to the backend. + * For HTTP APIs with a specified `integration_subtype`, a key-value map specifying parameters that are passed to `AWS_PROXY` integrations. + * For HTTP APIs without a specified `integration_subtype`, a key-value map specifying how to transform HTTP requests before sending them to the backend. + * See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html) for details. + * + */ + @Import(name="requestParameters") + private @Nullable Output> requestParameters; + + /** + * @return For WebSocket APIs, a key-value map specifying request parameters that are passed from the method request to the backend. + * For HTTP APIs with a specified `integration_subtype`, a key-value map specifying parameters that are passed to `AWS_PROXY` integrations. + * For HTTP APIs without a specified `integration_subtype`, a key-value map specifying how to transform HTTP requests before sending them to the backend. + * See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html) for details. + * + */ + public Optional>> requestParameters() { + return Optional.ofNullable(this.requestParameters); + } + + /** + * Mappings to transform the HTTP response from a backend integration before returning the response to clients. Supported only for HTTP APIs. + * + */ + @Import(name="responseParameters") + private @Nullable Output> responseParameters; + + /** + * @return Mappings to transform the HTTP response from a backend integration before returning the response to clients. Supported only for HTTP APIs. + * + */ + public Optional>> responseParameters() { + return Optional.ofNullable(this.responseParameters); + } + + /** + * Custom timeout between 50 and 29,000 milliseconds for WebSocket APIs and between 50 and 30,000 milliseconds for HTTP APIs. + * The default timeout is 29 seconds for WebSocket APIs and 30 seconds for HTTP APIs. + * this provider will only perform drift detection of its value when present in a configuration. + * + */ + @Import(name="timeoutMilliseconds") + private @Nullable Output timeoutMilliseconds; + + /** + * @return Custom timeout between 50 and 29,000 milliseconds for WebSocket APIs and between 50 and 30,000 milliseconds for HTTP APIs. + * The default timeout is 29 seconds for WebSocket APIs and 30 seconds for HTTP APIs. + * this provider will only perform drift detection of its value when present in a configuration. + * + */ + public Optional> timeoutMilliseconds() { + return Optional.ofNullable(this.timeoutMilliseconds); + } + + /** + * TLS configuration for a private integration. Supported only for HTTP APIs. + * + */ + @Import(name="tlsConfig") + private @Nullable Output tlsConfig; + + /** + * @return TLS configuration for a private integration. Supported only for HTTP APIs. + * + */ + public Optional> tlsConfig() { + return Optional.ofNullable(this.tlsConfig); + } + + private HttpIntegrationArgs() {} + + private HttpIntegrationArgs(HttpIntegrationArgs $) { + this.connectionId = $.connectionId; + this.connectionType = $.connectionType; + this.credentialsArn = $.credentialsArn; + this.description = $.description; + this.integrationMethod = $.integrationMethod; + this.integrationSubtype = $.integrationSubtype; + this.integrationType = $.integrationType; + this.integrationUri = $.integrationUri; + this.lambda = $.lambda; + this.lambdaInvokeArn = $.lambdaInvokeArn; + this.payloadFormatVersion = $.payloadFormatVersion; + this.requestParameters = $.requestParameters; + this.responseParameters = $.responseParameters; + this.timeoutMilliseconds = $.timeoutMilliseconds; + this.tlsConfig = $.tlsConfig; + } + public static Builder builder() { return new Builder(); } + public static Builder builder(HttpIntegrationArgs defaults) { + return new Builder(defaults); + } public static final class Builder { private HttpIntegrationArgs $; @@ -20,6 +478,342 @@ public static final class Builder { public Builder() { $ = new HttpIntegrationArgs(); } + + public Builder(HttpIntegrationArgs defaults) { + $ = new HttpIntegrationArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param connectionId ID of the VPC link for a private integration. Supported only for HTTP APIs. Must be between 1 and 1024 characters in length. + * + * @return builder + * + */ + public Builder connectionId(@Nullable Output connectionId) { + $.connectionId = connectionId; + return this; + } + + /** + * @param connectionId ID of the VPC link for a private integration. Supported only for HTTP APIs. Must be between 1 and 1024 characters in length. + * + * @return builder + * + */ + public Builder connectionId(String connectionId) { + return connectionId(Output.of(connectionId)); + } + + /** + * @param connectionType Type of the network connection to the integration endpoint. Valid values: `INTERNET`, `VPC_LINK`. Default is `INTERNET`. + * + * @return builder + * + */ + public Builder connectionType(@Nullable Output connectionType) { + $.connectionType = connectionType; + return this; + } + + /** + * @param connectionType Type of the network connection to the integration endpoint. Valid values: `INTERNET`, `VPC_LINK`. Default is `INTERNET`. + * + * @return builder + * + */ + public Builder connectionType(String connectionType) { + return connectionType(Output.of(connectionType)); + } + + /** + * @param credentialsArn Credentials required for the integration, if any. + * + * @return builder + * + */ + public Builder credentialsArn(@Nullable Output credentialsArn) { + $.credentialsArn = credentialsArn; + return this; + } + + /** + * @param credentialsArn Credentials required for the integration, if any. + * + * @return builder + * + */ + public Builder credentialsArn(String credentialsArn) { + return credentialsArn(Output.of(credentialsArn)); + } + + /** + * @param description Description of the integration. + * + * @return builder + * + */ + public Builder description(@Nullable Output description) { + $.description = description; + return this; + } + + /** + * @param description Description of the integration. + * + * @return builder + * + */ + public Builder description(String description) { + return description(Output.of(description)); + } + + /** + * @param integrationMethod Integration's HTTP method. Must be specified if `integration_type` is not `MOCK`. + * + * @return builder + * + */ + public Builder integrationMethod(@Nullable Output integrationMethod) { + $.integrationMethod = integrationMethod; + return this; + } + + /** + * @param integrationMethod Integration's HTTP method. Must be specified if `integration_type` is not `MOCK`. + * + * @return builder + * + */ + public Builder integrationMethod(String integrationMethod) { + return integrationMethod(Output.of(integrationMethod)); + } + + /** + * @param integrationSubtype AWS service action to invoke. Supported only for HTTP APIs when `integration_type` is `AWS_PROXY`. See the [AWS service integration reference](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html) documentation for supported values. Must be between 1 and 128 characters in length. + * + * @return builder + * + */ + public Builder integrationSubtype(@Nullable Output integrationSubtype) { + $.integrationSubtype = integrationSubtype; + return this; + } + + /** + * @param integrationSubtype AWS service action to invoke. Supported only for HTTP APIs when `integration_type` is `AWS_PROXY`. See the [AWS service integration reference](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html) documentation for supported values. Must be between 1 and 128 characters in length. + * + * @return builder + * + */ + public Builder integrationSubtype(String integrationSubtype) { + return integrationSubtype(Output.of(integrationSubtype)); + } + + /** + * @param integrationType Integration type of an integration. + * Valid values: `AWS` (supported only for WebSocket APIs), `AWS_PROXY`, `HTTP` (supported only for WebSocket APIs), `HTTP_PROXY`, `MOCK` (supported only for WebSocket APIs). For an HTTP API private integration, use `HTTP_PROXY`. + * + * @return builder + * + */ + public Builder integrationType(@Nullable Output integrationType) { + $.integrationType = integrationType; + return this; + } + + /** + * @param integrationType Integration type of an integration. + * Valid values: `AWS` (supported only for WebSocket APIs), `AWS_PROXY`, `HTTP` (supported only for WebSocket APIs), `HTTP_PROXY`, `MOCK` (supported only for WebSocket APIs). For an HTTP API private integration, use `HTTP_PROXY`. + * + * @return builder + * + */ + public Builder integrationType(String integrationType) { + return integrationType(Output.of(integrationType)); + } + + /** + * @param integrationUri URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`. + * For an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service. + * Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * + * @return builder + * + */ + public Builder integrationUri(@Nullable Output integrationUri) { + $.integrationUri = integrationUri; + return this; + } + + /** + * @param integrationUri URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`. + * For an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service. + * Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * + * @return builder + * + */ + public Builder integrationUri(String integrationUri) { + return integrationUri(Output.of(integrationUri)); + } + + /** + * @param lambda A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * + * @return builder + * + */ + public Builder lambda(@Nullable Function lambda) { + $.lambda = lambda; + return this; + } + + /** + * @param lambdaInvokeArn The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * + * @return builder + * + */ + public Builder lambdaInvokeArn(@Nullable Output lambdaInvokeArn) { + $.lambdaInvokeArn = lambdaInvokeArn; + return this; + } + + /** + * @param lambdaInvokeArn The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * + * @return builder + * + */ + public Builder lambdaInvokeArn(String lambdaInvokeArn) { + return lambdaInvokeArn(Output.of(lambdaInvokeArn)); + } + + /** + * @param payloadFormatVersion The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. + * + * @return builder + * + */ + public Builder payloadFormatVersion(@Nullable Output payloadFormatVersion) { + $.payloadFormatVersion = payloadFormatVersion; + return this; + } + + /** + * @param payloadFormatVersion The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. + * + * @return builder + * + */ + public Builder payloadFormatVersion(String payloadFormatVersion) { + return payloadFormatVersion(Output.of(payloadFormatVersion)); + } + + /** + * @param requestParameters For WebSocket APIs, a key-value map specifying request parameters that are passed from the method request to the backend. + * For HTTP APIs with a specified `integration_subtype`, a key-value map specifying parameters that are passed to `AWS_PROXY` integrations. + * For HTTP APIs without a specified `integration_subtype`, a key-value map specifying how to transform HTTP requests before sending them to the backend. + * See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html) for details. + * + * @return builder + * + */ + public Builder requestParameters(@Nullable Output> requestParameters) { + $.requestParameters = requestParameters; + return this; + } + + /** + * @param requestParameters For WebSocket APIs, a key-value map specifying request parameters that are passed from the method request to the backend. + * For HTTP APIs with a specified `integration_subtype`, a key-value map specifying parameters that are passed to `AWS_PROXY` integrations. + * For HTTP APIs without a specified `integration_subtype`, a key-value map specifying how to transform HTTP requests before sending them to the backend. + * See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html) for details. + * + * @return builder + * + */ + public Builder requestParameters(Map requestParameters) { + return requestParameters(Output.of(requestParameters)); + } + + /** + * @param responseParameters Mappings to transform the HTTP response from a backend integration before returning the response to clients. Supported only for HTTP APIs. + * + * @return builder + * + */ + public Builder responseParameters(@Nullable Output> responseParameters) { + $.responseParameters = responseParameters; + return this; + } + + /** + * @param responseParameters Mappings to transform the HTTP response from a backend integration before returning the response to clients. Supported only for HTTP APIs. + * + * @return builder + * + */ + public Builder responseParameters(List responseParameters) { + return responseParameters(Output.of(responseParameters)); + } + + /** + * @param responseParameters Mappings to transform the HTTP response from a backend integration before returning the response to clients. Supported only for HTTP APIs. + * + * @return builder + * + */ + public Builder responseParameters(IntegrationResponseParameterArgs... responseParameters) { + return responseParameters(List.of(responseParameters)); + } + + /** + * @param timeoutMilliseconds Custom timeout between 50 and 29,000 milliseconds for WebSocket APIs and between 50 and 30,000 milliseconds for HTTP APIs. + * The default timeout is 29 seconds for WebSocket APIs and 30 seconds for HTTP APIs. + * this provider will only perform drift detection of its value when present in a configuration. + * + * @return builder + * + */ + public Builder timeoutMilliseconds(@Nullable Output timeoutMilliseconds) { + $.timeoutMilliseconds = timeoutMilliseconds; + return this; + } + + /** + * @param timeoutMilliseconds Custom timeout between 50 and 29,000 milliseconds for WebSocket APIs and between 50 and 30,000 milliseconds for HTTP APIs. + * The default timeout is 29 seconds for WebSocket APIs and 30 seconds for HTTP APIs. + * this provider will only perform drift detection of its value when present in a configuration. + * + * @return builder + * + */ + public Builder timeoutMilliseconds(Integer timeoutMilliseconds) { + return timeoutMilliseconds(Output.of(timeoutMilliseconds)); + } + + /** + * @param tlsConfig TLS configuration for a private integration. Supported only for HTTP APIs. + * + * @return builder + * + */ + public Builder tlsConfig(@Nullable Output tlsConfig) { + $.tlsConfig = tlsConfig; + return this; + } + + /** + * @param tlsConfig TLS configuration for a private integration. Supported only for HTTP APIs. + * + * @return builder + * + */ + public Builder tlsConfig(IntegrationTlsConfigArgs tlsConfig) { + return tlsConfig(Output.of(tlsConfig)); + } + public HttpIntegrationArgs build() { return $; } diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java index 9f39c5f1e..76243cd36 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java @@ -5,16 +5,168 @@ import com.pulumi.core.Output; import com.pulumi.core.annotations.Import; +import java.lang.Boolean; import java.lang.String; +import java.util.List; import java.util.Objects; import java.util.Optional; import javax.annotation.Nullable; +/** + * Manages an Amazon API Gateway Version 2 route. + * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html) for [WebSocket](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-develop-routes.html) and [HTTP](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-routes.html) APIs. + * + * ## Example Usage + * ### Basic + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Api; + * import com.pulumi.aws.apigatewayv2.ApiArgs; + * import com.pulumi.aws.apigatewayv2.Route; + * import com.pulumi.aws.apigatewayv2.RouteArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var exampleApi = new Api("exampleApi", ApiArgs.builder() + * .protocolType("WEBSOCKET") + * .routeSelectionExpression("$request.body.action") + * .build()); + * + * var exampleRoute = new Route("exampleRoute", RouteArgs.builder() + * .apiId(exampleApi.id()) + * .routeKey("$default") + * .build()); + * + * } + * } + * ``` + * ### HTTP Proxy Integration + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Api; + * import com.pulumi.aws.apigatewayv2.ApiArgs; + * import com.pulumi.aws.apigatewayv2.Integration; + * import com.pulumi.aws.apigatewayv2.IntegrationArgs; + * import com.pulumi.aws.apigatewayv2.Route; + * import com.pulumi.aws.apigatewayv2.RouteArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var exampleApi = new Api("exampleApi", ApiArgs.builder() + * .protocolType("HTTP") + * .build()); + * + * var exampleIntegration = new Integration("exampleIntegration", IntegrationArgs.builder() + * .apiId(exampleApi.id()) + * .integrationType("HTTP_PROXY") + * .integrationMethod("ANY") + * .integrationUri("https://example.com/{proxy}") + * .build()); + * + * var exampleRoute = new Route("exampleRoute", RouteArgs.builder() + * .apiId(exampleApi.id()) + * .routeKey("ANY /example/{proxy+}") + * .target(exampleIntegration.id().applyValue(id -> String.format("integrations/%s", id))) + * .build()); + * + * } + * } + * ``` + * + * ## Import + * + * Using `pulumi import`, import `aws_apigatewayv2_route` using the API identifier and route identifier. For example: + * + * ```sh + * $ pulumi import aws:apigatewayv2/route:Route example aabbccddee/1122334 + * ``` + * -> __Note:__ The API Gateway managed route created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. + * + */ public final class HttpRouteArgs extends com.pulumi.resources.ResourceArgs { public static final HttpRouteArgs Empty = new HttpRouteArgs(); + /** + * Boolean whether an API key is required for the route. Defaults to `false`. Supported only for WebSocket APIs. + * + */ + @Import(name="apiKeyRequired") + private @Nullable Output apiKeyRequired; + + /** + * @return Boolean whether an API key is required for the route. Defaults to `false`. Supported only for WebSocket APIs. + * + */ + public Optional> apiKeyRequired() { + return Optional.ofNullable(this.apiKeyRequired); + } + + /** + * Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation. + * + */ + @Import(name="authorizationScopes") + private @Nullable Output> authorizationScopes; + + /** + * @return Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation. + * + */ + public Optional>> authorizationScopes() { + return Optional.ofNullable(this.authorizationScopes); + } + + /** + * Authorization type for the route. + * For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + * For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + * Defaults to `NONE`. + * + */ + @Import(name="authorizationType") + private @Nullable Output authorizationType; + + /** + * @return Authorization type for the route. + * For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + * For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + * Defaults to `NONE`. + * + */ + public Optional> authorizationType() { + return Optional.ofNullable(this.authorizationType); + } + /** * The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. * @@ -30,6 +182,21 @@ public Optional> authorizer() { return Optional.ofNullable(this.authorizer); } + /** + * Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. + * + */ + @Import(name="authorizerId") + private @Nullable Output authorizerId; + + /** + * @return Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. + * + */ + public Optional> authorizerId() { + return Optional.ofNullable(this.authorizerId); + } + /** * The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. * @@ -45,11 +212,47 @@ public Optional> integration() { return Optional.ofNullable(this.integration); } + /** + * Operation name for the route. Must be between 1 and 64 characters in length. + * + */ + @Import(name="operationName") + private @Nullable Output operationName; + + /** + * @return Operation name for the route. Must be between 1 and 64 characters in length. + * + */ + public Optional> operationName() { + return Optional.ofNullable(this.operationName); + } + + /** + * Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + * + */ + @Import(name="target") + private @Nullable Output target; + + /** + * @return Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + * + */ + public Optional> target() { + return Optional.ofNullable(this.target); + } + private HttpRouteArgs() {} private HttpRouteArgs(HttpRouteArgs $) { + this.apiKeyRequired = $.apiKeyRequired; + this.authorizationScopes = $.authorizationScopes; + this.authorizationType = $.authorizationType; this.authorizer = $.authorizer; + this.authorizerId = $.authorizerId; this.integration = $.integration; + this.operationName = $.operationName; + this.target = $.target; } public static Builder builder() { @@ -70,6 +273,85 @@ public Builder(HttpRouteArgs defaults) { $ = new HttpRouteArgs(Objects.requireNonNull(defaults)); } + /** + * @param apiKeyRequired Boolean whether an API key is required for the route. Defaults to `false`. Supported only for WebSocket APIs. + * + * @return builder + * + */ + public Builder apiKeyRequired(@Nullable Output apiKeyRequired) { + $.apiKeyRequired = apiKeyRequired; + return this; + } + + /** + * @param apiKeyRequired Boolean whether an API key is required for the route. Defaults to `false`. Supported only for WebSocket APIs. + * + * @return builder + * + */ + public Builder apiKeyRequired(Boolean apiKeyRequired) { + return apiKeyRequired(Output.of(apiKeyRequired)); + } + + /** + * @param authorizationScopes Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation. + * + * @return builder + * + */ + public Builder authorizationScopes(@Nullable Output> authorizationScopes) { + $.authorizationScopes = authorizationScopes; + return this; + } + + /** + * @param authorizationScopes Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation. + * + * @return builder + * + */ + public Builder authorizationScopes(List authorizationScopes) { + return authorizationScopes(Output.of(authorizationScopes)); + } + + /** + * @param authorizationScopes Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation. + * + * @return builder + * + */ + public Builder authorizationScopes(String... authorizationScopes) { + return authorizationScopes(List.of(authorizationScopes)); + } + + /** + * @param authorizationType Authorization type for the route. + * For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + * For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + * Defaults to `NONE`. + * + * @return builder + * + */ + public Builder authorizationType(@Nullable Output authorizationType) { + $.authorizationType = authorizationType; + return this; + } + + /** + * @param authorizationType Authorization type for the route. + * For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + * For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + * Defaults to `NONE`. + * + * @return builder + * + */ + public Builder authorizationType(String authorizationType) { + return authorizationType(Output.of(authorizationType)); + } + /** * @param authorizer The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. * @@ -91,6 +373,27 @@ public Builder authorizer(String authorizer) { return authorizer(Output.of(authorizer)); } + /** + * @param authorizerId Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. + * + * @return builder + * + */ + public Builder authorizerId(@Nullable Output authorizerId) { + $.authorizerId = authorizerId; + return this; + } + + /** + * @param authorizerId Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. + * + * @return builder + * + */ + public Builder authorizerId(String authorizerId) { + return authorizerId(Output.of(authorizerId)); + } + /** * @param integration The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. * @@ -112,6 +415,48 @@ public Builder integration(String integration) { return integration(Output.of(integration)); } + /** + * @param operationName Operation name for the route. Must be between 1 and 64 characters in length. + * + * @return builder + * + */ + public Builder operationName(@Nullable Output operationName) { + $.operationName = operationName; + return this; + } + + /** + * @param operationName Operation name for the route. Must be between 1 and 64 characters in length. + * + * @return builder + * + */ + public Builder operationName(String operationName) { + return operationName(Output.of(operationName)); + } + + /** + * @param target Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + * + * @return builder + * + */ + public Builder target(@Nullable Output target) { + $.target = target; + return this; + } + + /** + * @param target Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + * + * @return builder + * + */ + public Builder target(String target) { + return target(Output.of(target)); + } + public HttpRouteArgs build() { return $; } diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpStageArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpStageArgs.java index 496ed793a..49905cd1a 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpStageArgs.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpStageArgs.java @@ -3,16 +3,248 @@ package com.pulumi.awsx.apigatewayv2.inputs; +import com.pulumi.aws.apigatewayv2.inputs.StageAccessLogSettingsArgs; +import com.pulumi.aws.apigatewayv2.inputs.StageDefaultRouteSettingsArgs; +import com.pulumi.aws.apigatewayv2.inputs.StageRouteSettingArgs; +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import java.lang.Boolean; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; - +/** + * Manages an Amazon API Gateway Version 2 stage. + * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). + * + * ## Example Usage + * ### Basic + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Stage; + * import com.pulumi.aws.apigatewayv2.StageArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new Stage("example", StageArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .build()); + * + * } + * } + * ``` + * + * ## Import + * + * Using `pulumi import`, import `aws_apigatewayv2_stage` using the API identifier and stage name. For example: + * + * ```sh + * $ pulumi import aws:apigatewayv2/stage:Stage example aabbccddee/example-stage + * ``` + * -> __Note:__ The API Gateway managed stage created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. + * + */ public final class HttpStageArgs extends com.pulumi.resources.ResourceArgs { public static final HttpStageArgs Empty = new HttpStageArgs(); + /** + * Settings for logging access in this stage. + * Use the `aws.apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions). + * + */ + @Import(name="accessLogSettings") + private @Nullable Output accessLogSettings; + + /** + * @return Settings for logging access in this stage. + * Use the `aws.apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions). + * + */ + public Optional> accessLogSettings() { + return Optional.ofNullable(this.accessLogSettings); + } + + /** + * Whether updates to an API automatically trigger a new deployment. Defaults to `false`. Applicable for HTTP APIs. + * + */ + @Import(name="autoDeploy") + private @Nullable Output autoDeploy; + + /** + * @return Whether updates to an API automatically trigger a new deployment. Defaults to `false`. Applicable for HTTP APIs. + * + */ + public Optional> autoDeploy() { + return Optional.ofNullable(this.autoDeploy); + } + + /** + * Identifier of a client certificate for the stage. Use the `aws.apigateway.ClientCertificate` resource to configure a client certificate. + * Supported only for WebSocket APIs. + * + */ + @Import(name="clientCertificateId") + private @Nullable Output clientCertificateId; + + /** + * @return Identifier of a client certificate for the stage. Use the `aws.apigateway.ClientCertificate` resource to configure a client certificate. + * Supported only for WebSocket APIs. + * + */ + public Optional> clientCertificateId() { + return Optional.ofNullable(this.clientCertificateId); + } + + /** + * Default route settings for the stage. + * + */ + @Import(name="defaultRouteSettings") + private @Nullable Output defaultRouteSettings; + + /** + * @return Default route settings for the stage. + * + */ + public Optional> defaultRouteSettings() { + return Optional.ofNullable(this.defaultRouteSettings); + } + + /** + * Deployment identifier of the stage. Use the `aws.apigatewayv2.Deployment` resource to configure a deployment. + * + */ + @Import(name="deploymentId") + private @Nullable Output deploymentId; + + /** + * @return Deployment identifier of the stage. Use the `aws.apigatewayv2.Deployment` resource to configure a deployment. + * + */ + public Optional> deploymentId() { + return Optional.ofNullable(this.deploymentId); + } + + /** + * Description for the stage. Must be less than or equal to 1024 characters in length. + * + */ + @Import(name="description") + private @Nullable Output description; + + /** + * @return Description for the stage. Must be less than or equal to 1024 characters in length. + * + */ + public Optional> description() { + return Optional.ofNullable(this.description); + } + + /** + * Name of the stage. Must be between 1 and 128 characters in length. + * + * The following arguments are optional: + * + */ + @Import(name="name") + private @Nullable Output name; + + /** + * @return Name of the stage. Must be between 1 and 128 characters in length. + * + * The following arguments are optional: + * + */ + public Optional> name() { + return Optional.ofNullable(this.name); + } + + /** + * Route settings for the stage. + * + */ + @Import(name="routeSettings") + private @Nullable Output> routeSettings; + + /** + * @return Route settings for the stage. + * + */ + public Optional>> routeSettings() { + return Optional.ofNullable(this.routeSettings); + } + + /** + * Map that defines the stage variables for the stage. + * + */ + @Import(name="stageVariables") + private @Nullable Output> stageVariables; + + /** + * @return Map that defines the stage variables for the stage. + * + */ + public Optional>> stageVariables() { + return Optional.ofNullable(this.stageVariables); + } + + /** + * Map of tags to assign to the stage. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + * + */ + @Import(name="tags") + private @Nullable Output> tags; + + /** + * @return Map of tags to assign to the stage. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + * + */ + public Optional>> tags() { + return Optional.ofNullable(this.tags); + } + + private HttpStageArgs() {} + + private HttpStageArgs(HttpStageArgs $) { + this.accessLogSettings = $.accessLogSettings; + this.autoDeploy = $.autoDeploy; + this.clientCertificateId = $.clientCertificateId; + this.defaultRouteSettings = $.defaultRouteSettings; + this.deploymentId = $.deploymentId; + this.description = $.description; + this.name = $.name; + this.routeSettings = $.routeSettings; + this.stageVariables = $.stageVariables; + this.tags = $.tags; + } + public static Builder builder() { return new Builder(); } + public static Builder builder(HttpStageArgs defaults) { + return new Builder(defaults); + } public static final class Builder { private HttpStageArgs $; @@ -20,6 +252,239 @@ public static final class Builder { public Builder() { $ = new HttpStageArgs(); } + + public Builder(HttpStageArgs defaults) { + $ = new HttpStageArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param accessLogSettings Settings for logging access in this stage. + * Use the `aws.apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions). + * + * @return builder + * + */ + public Builder accessLogSettings(@Nullable Output accessLogSettings) { + $.accessLogSettings = accessLogSettings; + return this; + } + + /** + * @param accessLogSettings Settings for logging access in this stage. + * Use the `aws.apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions). + * + * @return builder + * + */ + public Builder accessLogSettings(StageAccessLogSettingsArgs accessLogSettings) { + return accessLogSettings(Output.of(accessLogSettings)); + } + + /** + * @param autoDeploy Whether updates to an API automatically trigger a new deployment. Defaults to `false`. Applicable for HTTP APIs. + * + * @return builder + * + */ + public Builder autoDeploy(@Nullable Output autoDeploy) { + $.autoDeploy = autoDeploy; + return this; + } + + /** + * @param autoDeploy Whether updates to an API automatically trigger a new deployment. Defaults to `false`. Applicable for HTTP APIs. + * + * @return builder + * + */ + public Builder autoDeploy(Boolean autoDeploy) { + return autoDeploy(Output.of(autoDeploy)); + } + + /** + * @param clientCertificateId Identifier of a client certificate for the stage. Use the `aws.apigateway.ClientCertificate` resource to configure a client certificate. + * Supported only for WebSocket APIs. + * + * @return builder + * + */ + public Builder clientCertificateId(@Nullable Output clientCertificateId) { + $.clientCertificateId = clientCertificateId; + return this; + } + + /** + * @param clientCertificateId Identifier of a client certificate for the stage. Use the `aws.apigateway.ClientCertificate` resource to configure a client certificate. + * Supported only for WebSocket APIs. + * + * @return builder + * + */ + public Builder clientCertificateId(String clientCertificateId) { + return clientCertificateId(Output.of(clientCertificateId)); + } + + /** + * @param defaultRouteSettings Default route settings for the stage. + * + * @return builder + * + */ + public Builder defaultRouteSettings(@Nullable Output defaultRouteSettings) { + $.defaultRouteSettings = defaultRouteSettings; + return this; + } + + /** + * @param defaultRouteSettings Default route settings for the stage. + * + * @return builder + * + */ + public Builder defaultRouteSettings(StageDefaultRouteSettingsArgs defaultRouteSettings) { + return defaultRouteSettings(Output.of(defaultRouteSettings)); + } + + /** + * @param deploymentId Deployment identifier of the stage. Use the `aws.apigatewayv2.Deployment` resource to configure a deployment. + * + * @return builder + * + */ + public Builder deploymentId(@Nullable Output deploymentId) { + $.deploymentId = deploymentId; + return this; + } + + /** + * @param deploymentId Deployment identifier of the stage. Use the `aws.apigatewayv2.Deployment` resource to configure a deployment. + * + * @return builder + * + */ + public Builder deploymentId(String deploymentId) { + return deploymentId(Output.of(deploymentId)); + } + + /** + * @param description Description for the stage. Must be less than or equal to 1024 characters in length. + * + * @return builder + * + */ + public Builder description(@Nullable Output description) { + $.description = description; + return this; + } + + /** + * @param description Description for the stage. Must be less than or equal to 1024 characters in length. + * + * @return builder + * + */ + public Builder description(String description) { + return description(Output.of(description)); + } + + /** + * @param name Name of the stage. Must be between 1 and 128 characters in length. + * + * The following arguments are optional: + * + * @return builder + * + */ + public Builder name(@Nullable Output name) { + $.name = name; + return this; + } + + /** + * @param name Name of the stage. Must be between 1 and 128 characters in length. + * + * The following arguments are optional: + * + * @return builder + * + */ + public Builder name(String name) { + return name(Output.of(name)); + } + + /** + * @param routeSettings Route settings for the stage. + * + * @return builder + * + */ + public Builder routeSettings(@Nullable Output> routeSettings) { + $.routeSettings = routeSettings; + return this; + } + + /** + * @param routeSettings Route settings for the stage. + * + * @return builder + * + */ + public Builder routeSettings(List routeSettings) { + return routeSettings(Output.of(routeSettings)); + } + + /** + * @param routeSettings Route settings for the stage. + * + * @return builder + * + */ + public Builder routeSettings(StageRouteSettingArgs... routeSettings) { + return routeSettings(List.of(routeSettings)); + } + + /** + * @param stageVariables Map that defines the stage variables for the stage. + * + * @return builder + * + */ + public Builder stageVariables(@Nullable Output> stageVariables) { + $.stageVariables = stageVariables; + return this; + } + + /** + * @param stageVariables Map that defines the stage variables for the stage. + * + * @return builder + * + */ + public Builder stageVariables(Map stageVariables) { + return stageVariables(Output.of(stageVariables)); + } + + /** + * @param tags Map of tags to assign to the stage. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + * + * @return builder + * + */ + public Builder tags(@Nullable Output> tags) { + $.tags = tags; + return this; + } + + /** + * @param tags Map of tags to assign to the stage. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + * + * @return builder + * + */ + public Builder tags(Map tags) { + return tags(Output.of(tags)); + } + public HttpStageArgs build() { return $; } diff --git a/sdk/nodejs/apigatewayv2/httpApi.ts b/sdk/nodejs/apigatewayv2/httpApi.ts index 574a5cf0a..12e2a0059 100644 --- a/sdk/nodejs/apigatewayv2/httpApi.ts +++ b/sdk/nodejs/apigatewayv2/httpApi.ts @@ -133,7 +133,7 @@ export interface HttpApiArgs { /** * The authorizers for the HTTP API routes. */ - authorizers?: pulumi.Input<{[key: string]: pulumi.Input}>; + authorizers?: {[key: string]: inputs.apigatewayv2.HttpAuthorizerArgs}; /** * An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. */ @@ -155,7 +155,7 @@ export interface HttpApiArgs { /** * The domain names for the HTTP API. */ - domainMappings?: pulumi.Input<{[key: string]: pulumi.Input}>; + domainMappings?: {[key: string]: inputs.apigatewayv2.DomainMappingArgs}; /** * Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. */ @@ -163,7 +163,7 @@ export interface HttpApiArgs { /** * The integrations for the HTTP API routes. */ - integrations?: pulumi.Input<{[key: string]: pulumi.Input}>; + integrations?: {[key: string]: inputs.apigatewayv2.HttpIntegrationArgs}; /** * Name of the API. Must be less than or equal to 128 characters in length. */ @@ -176,11 +176,11 @@ export interface HttpApiArgs { /** * The routes for the HTTP API. */ - routes: pulumi.Input<{[key: string]: pulumi.Input}>; + routes: {[key: string]: inputs.apigatewayv2.HttpRouteArgs}; /** * The deployment stages for the HTTP API. */ - stages?: pulumi.Input<{[key: string]: pulumi.Input}>; + stages?: {[key: string]: inputs.apigatewayv2.HttpStageArgs}; /** * Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ diff --git a/sdk/nodejs/types/input.ts b/sdk/nodejs/types/input.ts index 47964043c..699435976 100644 --- a/sdk/nodejs/types/input.ts +++ b/sdk/nodejs/types/input.ts @@ -353,7 +353,7 @@ export namespace apigatewayv2 { /** * Domain name configuration. See below. */ - domainNameConfiguration?: pulumi.Input; + domainNameConfiguration: pulumi.Input; /** * Mutual TLS authentication configuration for the domain name. */ @@ -364,35 +364,1696 @@ export namespace apigatewayv2 { tags?: pulumi.Input<{[key: string]: pulumi.Input}>; } + /** + * Manages an Amazon API Gateway Version 2 API mapping. + * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). + * + * {{% examples %}} + * ## Example Usage + * {{% example %}} + * ### Basic + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as aws from "@pulumi/aws"; + * + * const example = new aws.apigatewayv2.ApiMapping("example", { + * apiId: aws_apigatewayv2_api.example.id, + * domainName: aws_apigatewayv2_domain_name.example.id, + * stage: aws_apigatewayv2_stage.example.id, + * }); + * ``` + * ```python + * import pulumi + * import pulumi_aws as aws + * + * example = aws.apigatewayv2.ApiMapping("example", + * api_id=aws_apigatewayv2_api["example"]["id"], + * domain_name=aws_apigatewayv2_domain_name["example"]["id"], + * stage=aws_apigatewayv2_stage["example"]["id"]) + * ``` + * ```csharp + * using System.Collections.Generic; + * using System.Linq; + * using Pulumi; + * using Aws = Pulumi.Aws; + * + * return await Deployment.RunAsync(() => + * { + * var example = new Aws.ApiGatewayV2.ApiMapping("example", new() + * { + * ApiId = aws_apigatewayv2_api.Example.Id, + * DomainName = aws_apigatewayv2_domain_name.Example.Id, + * Stage = aws_apigatewayv2_stage.Example.Id, + * }); + * + * }); + * ``` + * ```go + * package main + * + * import ( + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + * "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + * ) + * + * func main() { + * pulumi.Run(func(ctx *pulumi.Context) error { + * _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ + * ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + * DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), + * Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), + * }) + * if err != nil { + * return err + * } + * return nil + * }) + * } + * ``` + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.ApiMapping; + * import com.pulumi.aws.apigatewayv2.ApiMappingArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new ApiMapping("example", ApiMappingArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .domainName(aws_apigatewayv2_domain_name.example().id()) + * .stage(aws_apigatewayv2_stage.example().id()) + * .build()); + * + * } + * } + * ``` + * ```yaml + * resources: + * example: + * type: aws:apigatewayv2:ApiMapping + * properties: + * apiId: ${aws_apigatewayv2_api.example.id} + * domainName: ${aws_apigatewayv2_domain_name.example.id} + * stage: ${aws_apigatewayv2_stage.example.id} + * ``` + * {{% /example %}} + * {{% /examples %}} + * + * ## Import + * + * Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: + * + * ```sh + * $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com + * ``` + * + */ export interface DomainMappingArgs { /** - * Configuration of the domain name to create. Cannot be specified together with `domainId`. + * The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). + */ + apiMappingKey?: pulumi.Input; + /** + * Configuration of the domain name to create. Cannot be specified together with `domainId`. + */ + domainConfiguration?: inputs.apigatewayv2.DomainConfigurationArgs; + /** + * Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + */ + domainId?: pulumi.Input; + /** + * API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. + */ + stage: pulumi.Input; + } + + /** + * Manages an Amazon API Gateway Version 2 authorizer. + * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). + * + * {{% examples %}} + * ## Example Usage + * {{% example %}} + * ### Basic WebSocket API + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as aws from "@pulumi/aws"; + * + * const example = new aws.apigatewayv2.Authorizer("example", { + * apiId: aws_apigatewayv2_api.example.id, + * authorizerType: "REQUEST", + * authorizerUri: aws_lambda_function.example.invoke_arn, + * identitySources: ["route.request.header.Auth"], + * }); + * ``` + * ```python + * import pulumi + * import pulumi_aws as aws + * + * example = aws.apigatewayv2.Authorizer("example", + * api_id=aws_apigatewayv2_api["example"]["id"], + * authorizer_type="REQUEST", + * authorizer_uri=aws_lambda_function["example"]["invoke_arn"], + * identity_sources=["route.request.header.Auth"]) + * ``` + * ```csharp + * using System.Collections.Generic; + * using System.Linq; + * using Pulumi; + * using Aws = Pulumi.Aws; + * + * return await Deployment.RunAsync(() => + * { + * var example = new Aws.ApiGatewayV2.Authorizer("example", new() + * { + * ApiId = aws_apigatewayv2_api.Example.Id, + * AuthorizerType = "REQUEST", + * AuthorizerUri = aws_lambda_function.Example.Invoke_arn, + * IdentitySources = new[] + * { + * "route.request.header.Auth", + * }, + * }); + * + * }); + * ``` + * ```go + * package main + * + * import ( + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + * "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + * ) + * + * func main() { + * pulumi.Run(func(ctx *pulumi.Context) error { + * _, err := apigatewayv2.NewAuthorizer(ctx, "example", &apigatewayv2.AuthorizerArgs{ + * ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + * AuthorizerType: pulumi.String("REQUEST"), + * AuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn), + * IdentitySources: pulumi.StringArray{ + * pulumi.String("route.request.header.Auth"), + * }, + * }) + * if err != nil { + * return err + * } + * return nil + * }) + * } + * ``` + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Authorizer; + * import com.pulumi.aws.apigatewayv2.AuthorizerArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new Authorizer("example", AuthorizerArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .authorizerType("REQUEST") + * .authorizerUri(aws_lambda_function.example().invoke_arn()) + * .identitySources("route.request.header.Auth") + * .build()); + * + * } + * } + * ``` + * ```yaml + * resources: + * example: + * type: aws:apigatewayv2:Authorizer + * properties: + * apiId: ${aws_apigatewayv2_api.example.id} + * authorizerType: REQUEST + * authorizerUri: ${aws_lambda_function.example.invoke_arn} + * identitySources: + * - route.request.header.Auth + * ``` + * {{% /example %}} + * {{% example %}} + * ### Basic HTTP API + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as aws from "@pulumi/aws"; + * + * const example = new aws.apigatewayv2.Authorizer("example", { + * apiId: aws_apigatewayv2_api.example.id, + * authorizerType: "REQUEST", + * authorizerUri: aws_lambda_function.example.invoke_arn, + * identitySources: ["$request.header.Authorization"], + * authorizerPayloadFormatVersion: "2.0", + * }); + * ``` + * ```python + * import pulumi + * import pulumi_aws as aws + * + * example = aws.apigatewayv2.Authorizer("example", + * api_id=aws_apigatewayv2_api["example"]["id"], + * authorizer_type="REQUEST", + * authorizer_uri=aws_lambda_function["example"]["invoke_arn"], + * identity_sources=["$request.header.Authorization"], + * authorizer_payload_format_version="2.0") + * ``` + * ```csharp + * using System.Collections.Generic; + * using System.Linq; + * using Pulumi; + * using Aws = Pulumi.Aws; + * + * return await Deployment.RunAsync(() => + * { + * var example = new Aws.ApiGatewayV2.Authorizer("example", new() + * { + * ApiId = aws_apigatewayv2_api.Example.Id, + * AuthorizerType = "REQUEST", + * AuthorizerUri = aws_lambda_function.Example.Invoke_arn, + * IdentitySources = new[] + * { + * "$request.header.Authorization", + * }, + * AuthorizerPayloadFormatVersion = "2.0", + * }); + * + * }); + * ``` + * ```go + * package main + * + * import ( + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + * "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + * ) + * + * func main() { + * pulumi.Run(func(ctx *pulumi.Context) error { + * _, err := apigatewayv2.NewAuthorizer(ctx, "example", &apigatewayv2.AuthorizerArgs{ + * ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + * AuthorizerType: pulumi.String("REQUEST"), + * AuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn), + * IdentitySources: pulumi.StringArray{ + * pulumi.String("$request.header.Authorization"), + * }, + * AuthorizerPayloadFormatVersion: pulumi.String("2.0"), + * }) + * if err != nil { + * return err + * } + * return nil + * }) + * } + * ``` + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Authorizer; + * import com.pulumi.aws.apigatewayv2.AuthorizerArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new Authorizer("example", AuthorizerArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .authorizerType("REQUEST") + * .authorizerUri(aws_lambda_function.example().invoke_arn()) + * .identitySources("$request.header.Authorization") + * .authorizerPayloadFormatVersion("2.0") + * .build()); + * + * } + * } + * ``` + * ```yaml + * resources: + * example: + * type: aws:apigatewayv2:Authorizer + * properties: + * apiId: ${aws_apigatewayv2_api.example.id} + * authorizerType: REQUEST + * authorizerUri: ${aws_lambda_function.example.invoke_arn} + * identitySources: + * - $request.header.Authorization + * authorizerPayloadFormatVersion: '2.0' + * ``` + * {{% /example %}} + * {{% /examples %}} + * + * ## Import + * + * Using `pulumi import`, import `aws_apigatewayv2_authorizer` using the API identifier and authorizer identifier. For example: + * + * ```sh + * $ pulumi import aws:apigatewayv2/authorizer:Authorizer example aabbccddee/1122334 + * ``` + * + */ + export interface HttpAuthorizerArgs { + /** + * Required credentials as an IAM role for API Gateway to invoke the authorizer. + * Supported only for `REQUEST` authorizers. + */ + authorizerCredentialsArn?: pulumi.Input; + /** + * Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. + * Valid values: `1.0`, `2.0`. + */ + authorizerPayloadFormatVersion?: pulumi.Input; + /** + * Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. + * If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. + * Supported only for HTTP API Lambda authorizers. + */ + authorizerResultTtlInSeconds?: pulumi.Input; + /** + * Authorizer type. Valid values: `JWT`, `REQUEST`. + * Specify `REQUEST` for a Lambda function using incoming request parameters. + * For HTTP APIs, specify `JWT` to use JSON Web Tokens. + */ + authorizerType: pulumi.Input; + /** + * Authorizer's Uniform Resource Identifier (URI). + * For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invoke_arn` attribute of the `aws.lambda.Function` resource. + * Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length. + */ + authorizerUri?: pulumi.Input; + /** + * Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. + * Supported only for HTTP APIs. + */ + enableSimpleResponses?: pulumi.Input; + /** + * Identity sources for which authorization is requested. + * For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. + * For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. + */ + identitySources?: pulumi.Input[]>; + /** + * Configuration of a JWT authorizer. Required for the `JWT` authorizer type. + * Supported only for HTTP APIs. + */ + jwtConfiguration?: pulumi.Input; + /** + * Name of the authorizer. Must be between 1 and 128 characters in length. + */ + name?: pulumi.Input; + } + + /** + * Manages an Amazon API Gateway Version 2 integration. + * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). + * + * {{% examples %}} + * ## Example Usage + * {{% example %}} + * ### Basic + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as aws from "@pulumi/aws"; + * + * const example = new aws.apigatewayv2.Integration("example", { + * apiId: aws_apigatewayv2_api.example.id, + * integrationType: "MOCK", + * }); + * ``` + * ```python + * import pulumi + * import pulumi_aws as aws + * + * example = aws.apigatewayv2.Integration("example", + * api_id=aws_apigatewayv2_api["example"]["id"], + * integration_type="MOCK") + * ``` + * ```csharp + * using System.Collections.Generic; + * using System.Linq; + * using Pulumi; + * using Aws = Pulumi.Aws; + * + * return await Deployment.RunAsync(() => + * { + * var example = new Aws.ApiGatewayV2.Integration("example", new() + * { + * ApiId = aws_apigatewayv2_api.Example.Id, + * IntegrationType = "MOCK", + * }); + * + * }); + * ``` + * ```go + * package main + * + * import ( + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + * "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + * ) + * + * func main() { + * pulumi.Run(func(ctx *pulumi.Context) error { + * _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ + * ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + * IntegrationType: pulumi.String("MOCK"), + * }) + * if err != nil { + * return err + * } + * return nil + * }) + * } + * ``` + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Integration; + * import com.pulumi.aws.apigatewayv2.IntegrationArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new Integration("example", IntegrationArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .integrationType("MOCK") + * .build()); + * + * } + * } + * ``` + * ```yaml + * resources: + * example: + * type: aws:apigatewayv2:Integration + * properties: + * apiId: ${aws_apigatewayv2_api.example.id} + * integrationType: MOCK + * ``` + * {{% /example %}} + * {{% example %}} + * ### Lambda Integration + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as aws from "@pulumi/aws"; + * + * const exampleFunction = new aws.lambda.Function("exampleFunction", { + * code: new pulumi.asset.FileArchive("example.zip"), + * role: aws_iam_role.example.arn, + * handler: "index.handler", + * runtime: "nodejs16.x", + * }); + * const exampleIntegration = new aws.apigatewayv2.Integration("exampleIntegration", { + * apiId: aws_apigatewayv2_api.example.id, + * integrationType: "AWS_PROXY", + * connectionType: "INTERNET", + * contentHandlingStrategy: "CONVERT_TO_TEXT", + * description: "Lambda example", + * integrationMethod: "POST", + * integrationUri: exampleFunction.invokeArn, + * passthroughBehavior: "WHEN_NO_MATCH", + * }); + * ``` + * ```python + * import pulumi + * import pulumi_aws as aws + * + * example_function = aws.lambda_.Function("exampleFunction", + * code=pulumi.FileArchive("example.zip"), + * role=aws_iam_role["example"]["arn"], + * handler="index.handler", + * runtime="nodejs16.x") + * example_integration = aws.apigatewayv2.Integration("exampleIntegration", + * api_id=aws_apigatewayv2_api["example"]["id"], + * integration_type="AWS_PROXY", + * connection_type="INTERNET", + * content_handling_strategy="CONVERT_TO_TEXT", + * description="Lambda example", + * integration_method="POST", + * integration_uri=example_function.invoke_arn, + * passthrough_behavior="WHEN_NO_MATCH") + * ``` + * ```csharp + * using System.Collections.Generic; + * using System.Linq; + * using Pulumi; + * using Aws = Pulumi.Aws; + * + * return await Deployment.RunAsync(() => + * { + * var exampleFunction = new Aws.Lambda.Function("exampleFunction", new() + * { + * Code = new FileArchive("example.zip"), + * Role = aws_iam_role.Example.Arn, + * Handler = "index.handler", + * Runtime = "nodejs16.x", + * }); + * + * var exampleIntegration = new Aws.ApiGatewayV2.Integration("exampleIntegration", new() + * { + * ApiId = aws_apigatewayv2_api.Example.Id, + * IntegrationType = "AWS_PROXY", + * ConnectionType = "INTERNET", + * ContentHandlingStrategy = "CONVERT_TO_TEXT", + * Description = "Lambda example", + * IntegrationMethod = "POST", + * IntegrationUri = exampleFunction.InvokeArn, + * PassthroughBehavior = "WHEN_NO_MATCH", + * }); + * + * }); + * ``` + * ```go + * package main + * + * import ( + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" + * "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + * ) + * + * func main() { + * pulumi.Run(func(ctx *pulumi.Context) error { + * exampleFunction, err := lambda.NewFunction(ctx, "exampleFunction", &lambda.FunctionArgs{ + * Code: pulumi.NewFileArchive("example.zip"), + * Role: pulumi.Any(aws_iam_role.Example.Arn), + * Handler: pulumi.String("index.handler"), + * Runtime: pulumi.String("nodejs16.x"), + * }) + * if err != nil { + * return err + * } + * _, err = apigatewayv2.NewIntegration(ctx, "exampleIntegration", &apigatewayv2.IntegrationArgs{ + * ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + * IntegrationType: pulumi.String("AWS_PROXY"), + * ConnectionType: pulumi.String("INTERNET"), + * ContentHandlingStrategy: pulumi.String("CONVERT_TO_TEXT"), + * Description: pulumi.String("Lambda example"), + * IntegrationMethod: pulumi.String("POST"), + * IntegrationUri: exampleFunction.InvokeArn, + * PassthroughBehavior: pulumi.String("WHEN_NO_MATCH"), + * }) + * if err != nil { + * return err + * } + * return nil + * }) + * } + * ``` + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.lambda.Function; + * import com.pulumi.aws.lambda.FunctionArgs; + * import com.pulumi.aws.apigatewayv2.Integration; + * import com.pulumi.aws.apigatewayv2.IntegrationArgs; + * import com.pulumi.asset.FileArchive; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var exampleFunction = new Function("exampleFunction", FunctionArgs.builder() + * .code(new FileArchive("example.zip")) + * .role(aws_iam_role.example().arn()) + * .handler("index.handler") + * .runtime("nodejs16.x") + * .build()); + * + * var exampleIntegration = new Integration("exampleIntegration", IntegrationArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .integrationType("AWS_PROXY") + * .connectionType("INTERNET") + * .contentHandlingStrategy("CONVERT_TO_TEXT") + * .description("Lambda example") + * .integrationMethod("POST") + * .integrationUri(exampleFunction.invokeArn()) + * .passthroughBehavior("WHEN_NO_MATCH") + * .build()); + * + * } + * } + * ``` + * ```yaml + * resources: + * exampleFunction: + * type: aws:lambda:Function + * properties: + * code: + * fn::FileArchive: example.zip + * role: ${aws_iam_role.example.arn} + * handler: index.handler + * runtime: nodejs16.x + * exampleIntegration: + * type: aws:apigatewayv2:Integration + * properties: + * apiId: ${aws_apigatewayv2_api.example.id} + * integrationType: AWS_PROXY + * connectionType: INTERNET + * contentHandlingStrategy: CONVERT_TO_TEXT + * description: Lambda example + * integrationMethod: POST + * integrationUri: ${exampleFunction.invokeArn} + * passthroughBehavior: WHEN_NO_MATCH + * ``` + * {{% /example %}} + * {{% example %}} + * ### AWS Service Integration + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as aws from "@pulumi/aws"; + * + * const example = new aws.apigatewayv2.Integration("example", { + * apiId: aws_apigatewayv2_api.example.id, + * credentialsArn: aws_iam_role.example.arn, + * description: "SQS example", + * integrationType: "AWS_PROXY", + * integrationSubtype: "SQS-SendMessage", + * requestParameters: { + * QueueUrl: "$request.header.queueUrl", + * MessageBody: "$request.body.message", + * }, + * }); + * ``` + * ```python + * import pulumi + * import pulumi_aws as aws + * + * example = aws.apigatewayv2.Integration("example", + * api_id=aws_apigatewayv2_api["example"]["id"], + * credentials_arn=aws_iam_role["example"]["arn"], + * description="SQS example", + * integration_type="AWS_PROXY", + * integration_subtype="SQS-SendMessage", + * request_parameters={ + * "QueueUrl": "$request.header.queueUrl", + * "MessageBody": "$request.body.message", + * }) + * ``` + * ```csharp + * using System.Collections.Generic; + * using System.Linq; + * using Pulumi; + * using Aws = Pulumi.Aws; + * + * return await Deployment.RunAsync(() => + * { + * var example = new Aws.ApiGatewayV2.Integration("example", new() + * { + * ApiId = aws_apigatewayv2_api.Example.Id, + * CredentialsArn = aws_iam_role.Example.Arn, + * Description = "SQS example", + * IntegrationType = "AWS_PROXY", + * IntegrationSubtype = "SQS-SendMessage", + * RequestParameters = + * { + * { "QueueUrl", "$request.header.queueUrl" }, + * { "MessageBody", "$request.body.message" }, + * }, + * }); + * + * }); + * ``` + * ```go + * package main + * + * import ( + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + * "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + * ) + * + * func main() { + * pulumi.Run(func(ctx *pulumi.Context) error { + * _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ + * ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + * CredentialsArn: pulumi.Any(aws_iam_role.Example.Arn), + * Description: pulumi.String("SQS example"), + * IntegrationType: pulumi.String("AWS_PROXY"), + * IntegrationSubtype: pulumi.String("SQS-SendMessage"), + * RequestParameters: pulumi.StringMap{ + * "QueueUrl": pulumi.String("$request.header.queueUrl"), + * "MessageBody": pulumi.String("$request.body.message"), + * }, + * }) + * if err != nil { + * return err + * } + * return nil + * }) + * } + * ``` + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Integration; + * import com.pulumi.aws.apigatewayv2.IntegrationArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new Integration("example", IntegrationArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .credentialsArn(aws_iam_role.example().arn()) + * .description("SQS example") + * .integrationType("AWS_PROXY") + * .integrationSubtype("SQS-SendMessage") + * .requestParameters(Map.ofEntries( + * Map.entry("QueueUrl", "$request.header.queueUrl"), + * Map.entry("MessageBody", "$request.body.message") + * )) + * .build()); + * + * } + * } + * ``` + * ```yaml + * resources: + * example: + * type: aws:apigatewayv2:Integration + * properties: + * apiId: ${aws_apigatewayv2_api.example.id} + * credentialsArn: ${aws_iam_role.example.arn} + * description: SQS example + * integrationType: AWS_PROXY + * integrationSubtype: SQS-SendMessage + * requestParameters: + * QueueUrl: $request.header.queueUrl + * MessageBody: $request.body.message + * ``` + * {{% /example %}} + * {{% example %}} + * ### Private Integration + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as aws from "@pulumi/aws"; + * + * const example = new aws.apigatewayv2.Integration("example", { + * apiId: aws_apigatewayv2_api.example.id, + * credentialsArn: aws_iam_role.example.arn, + * description: "Example with a load balancer", + * integrationType: "HTTP_PROXY", + * integrationUri: aws_lb_listener.example.arn, + * integrationMethod: "ANY", + * connectionType: "VPC_LINK", + * connectionId: aws_apigatewayv2_vpc_link.example.id, + * tlsConfig: { + * serverNameToVerify: "example.com", + * }, + * requestParameters: { + * "append:header.authforintegration": "$context.authorizer.authorizerResponse", + * "overwrite:path": "staticValueForIntegration", + * }, + * responseParameters: [ + * { + * statusCode: "403", + * mappings: { + * "append:header.auth": "$context.authorizer.authorizerResponse", + * }, + * }, + * { + * statusCode: "200", + * mappings: { + * "overwrite:statuscode": "204", + * }, + * }, + * ], + * }); + * ``` + * ```python + * import pulumi + * import pulumi_aws as aws + * + * example = aws.apigatewayv2.Integration("example", + * api_id=aws_apigatewayv2_api["example"]["id"], + * credentials_arn=aws_iam_role["example"]["arn"], + * description="Example with a load balancer", + * integration_type="HTTP_PROXY", + * integration_uri=aws_lb_listener["example"]["arn"], + * integration_method="ANY", + * connection_type="VPC_LINK", + * connection_id=aws_apigatewayv2_vpc_link["example"]["id"], + * tls_config=aws.apigatewayv2.IntegrationTlsConfigArgs( + * server_name_to_verify="example.com", + * ), + * request_parameters={ + * "append:header.authforintegration": "$context.authorizer.authorizerResponse", + * "overwrite:path": "staticValueForIntegration", + * }, + * response_parameters=[ + * aws.apigatewayv2.IntegrationResponseParameterArgs( + * status_code="403", + * mappings={ + * "append:header.auth": "$context.authorizer.authorizerResponse", + * }, + * ), + * aws.apigatewayv2.IntegrationResponseParameterArgs( + * status_code="200", + * mappings={ + * "overwrite:statuscode": "204", + * }, + * ), + * ]) + * ``` + * ```csharp + * using System.Collections.Generic; + * using System.Linq; + * using Pulumi; + * using Aws = Pulumi.Aws; + * + * return await Deployment.RunAsync(() => + * { + * var example = new Aws.ApiGatewayV2.Integration("example", new() + * { + * ApiId = aws_apigatewayv2_api.Example.Id, + * CredentialsArn = aws_iam_role.Example.Arn, + * Description = "Example with a load balancer", + * IntegrationType = "HTTP_PROXY", + * IntegrationUri = aws_lb_listener.Example.Arn, + * IntegrationMethod = "ANY", + * ConnectionType = "VPC_LINK", + * ConnectionId = aws_apigatewayv2_vpc_link.Example.Id, + * TlsConfig = new Aws.ApiGatewayV2.Inputs.IntegrationTlsConfigArgs + * { + * ServerNameToVerify = "example.com", + * }, + * RequestParameters = + * { + * { "append:header.authforintegration", "$context.authorizer.authorizerResponse" }, + * { "overwrite:path", "staticValueForIntegration" }, + * }, + * ResponseParameters = new[] + * { + * new Aws.ApiGatewayV2.Inputs.IntegrationResponseParameterArgs + * { + * StatusCode = "403", + * Mappings = + * { + * { "append:header.auth", "$context.authorizer.authorizerResponse" }, + * }, + * }, + * new Aws.ApiGatewayV2.Inputs.IntegrationResponseParameterArgs + * { + * StatusCode = "200", + * Mappings = + * { + * { "overwrite:statuscode", "204" }, + * }, + * }, + * }, + * }); + * + * }); + * ``` + * ```go + * package main + * + * import ( + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + * "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + * ) + * + * func main() { + * pulumi.Run(func(ctx *pulumi.Context) error { + * _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ + * ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + * CredentialsArn: pulumi.Any(aws_iam_role.Example.Arn), + * Description: pulumi.String("Example with a load balancer"), + * IntegrationType: pulumi.String("HTTP_PROXY"), + * IntegrationUri: pulumi.Any(aws_lb_listener.Example.Arn), + * IntegrationMethod: pulumi.String("ANY"), + * ConnectionType: pulumi.String("VPC_LINK"), + * ConnectionId: pulumi.Any(aws_apigatewayv2_vpc_link.Example.Id), + * TlsConfig: &apigatewayv2.IntegrationTlsConfigArgs{ + * ServerNameToVerify: pulumi.String("example.com"), + * }, + * RequestParameters: pulumi.StringMap{ + * "append:header.authforintegration": pulumi.String("$context.authorizer.authorizerResponse"), + * "overwrite:path": pulumi.String("staticValueForIntegration"), + * }, + * ResponseParameters: apigatewayv2.IntegrationResponseParameterArray{ + * &apigatewayv2.IntegrationResponseParameterArgs{ + * StatusCode: pulumi.String("403"), + * Mappings: pulumi.StringMap{ + * "append:header.auth": pulumi.String("$context.authorizer.authorizerResponse"), + * }, + * }, + * &apigatewayv2.IntegrationResponseParameterArgs{ + * StatusCode: pulumi.String("200"), + * Mappings: pulumi.StringMap{ + * "overwrite:statuscode": pulumi.String("204"), + * }, + * }, + * }, + * }) + * if err != nil { + * return err + * } + * return nil + * }) + * } + * ``` + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Integration; + * import com.pulumi.aws.apigatewayv2.IntegrationArgs; + * import com.pulumi.aws.apigatewayv2.inputs.IntegrationTlsConfigArgs; + * import com.pulumi.aws.apigatewayv2.inputs.IntegrationResponseParameterArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new Integration("example", IntegrationArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .credentialsArn(aws_iam_role.example().arn()) + * .description("Example with a load balancer") + * .integrationType("HTTP_PROXY") + * .integrationUri(aws_lb_listener.example().arn()) + * .integrationMethod("ANY") + * .connectionType("VPC_LINK") + * .connectionId(aws_apigatewayv2_vpc_link.example().id()) + * .tlsConfig(IntegrationTlsConfigArgs.builder() + * .serverNameToVerify("example.com") + * .build()) + * .requestParameters(Map.ofEntries( + * Map.entry("append:header.authforintegration", "$context.authorizer.authorizerResponse"), + * Map.entry("overwrite:path", "staticValueForIntegration") + * )) + * .responseParameters( + * IntegrationResponseParameterArgs.builder() + * .statusCode(403) + * .mappings(Map.of("append:header.auth", "$context.authorizer.authorizerResponse")) + * .build(), + * IntegrationResponseParameterArgs.builder() + * .statusCode(200) + * .mappings(Map.of("overwrite:statuscode", "204")) + * .build()) + * .build()); + * + * } + * } + * ``` + * ```yaml + * resources: + * example: + * type: aws:apigatewayv2:Integration + * properties: + * apiId: ${aws_apigatewayv2_api.example.id} + * credentialsArn: ${aws_iam_role.example.arn} + * description: Example with a load balancer + * integrationType: HTTP_PROXY + * integrationUri: ${aws_lb_listener.example.arn} + * integrationMethod: ANY + * connectionType: VPC_LINK + * connectionId: ${aws_apigatewayv2_vpc_link.example.id} + * tlsConfig: + * serverNameToVerify: example.com + * requestParameters: + * append:header.authforintegration: $context.authorizer.authorizerResponse + * overwrite:path: staticValueForIntegration + * responseParameters: + * - statusCode: 403 + * mappings: + * append:header.auth: $context.authorizer.authorizerResponse + * - statusCode: 200 + * mappings: + * overwrite:statuscode: '204' + * ``` + * {{% /example %}} + * {{% /examples %}} + * + * ## Import + * + * Using `pulumi import`, import `aws_apigatewayv2_integration` using the API identifier and integration identifier. For example: + * + * ```sh + * $ pulumi import aws:apigatewayv2/integration:Integration example aabbccddee/1122334 + * ``` + * -> __Note:__ The API Gateway managed integration created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. + */ + export interface HttpIntegrationArgs { + /** + * ID of the VPC link for a private integration. Supported only for HTTP APIs. Must be between 1 and 1024 characters in length. + */ + connectionId?: pulumi.Input; + /** + * Type of the network connection to the integration endpoint. Valid values: `INTERNET`, `VPC_LINK`. Default is `INTERNET`. + */ + connectionType?: pulumi.Input; + /** + * Credentials required for the integration, if any. + */ + credentialsArn?: pulumi.Input; + /** + * Description of the integration. + */ + description?: pulumi.Input; + /** + * Integration's HTTP method. Must be specified if `integration_type` is not `MOCK`. + */ + integrationMethod?: pulumi.Input; + /** + * AWS service action to invoke. Supported only for HTTP APIs when `integration_type` is `AWS_PROXY`. See the [AWS service integration reference](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html) documentation for supported values. Must be between 1 and 128 characters in length. + */ + integrationSubtype?: pulumi.Input; + /** + * Integration type of an integration. + * Valid values: `AWS` (supported only for WebSocket APIs), `AWS_PROXY`, `HTTP` (supported only for WebSocket APIs), `HTTP_PROXY`, `MOCK` (supported only for WebSocket APIs). For an HTTP API private integration, use `HTTP_PROXY`. + */ + integrationType?: pulumi.Input; + /** + * URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`. + * For an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service. + * Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + */ + integrationUri?: pulumi.Input; + /** + * A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + */ + lambda?: pulumiAws.lambda.Function; + /** + * The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + */ + lambdaInvokeArn?: pulumi.Input; + /** + * The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. + */ + payloadFormatVersion?: pulumi.Input; + /** + * For WebSocket APIs, a key-value map specifying request parameters that are passed from the method request to the backend. + * For HTTP APIs with a specified `integration_subtype`, a key-value map specifying parameters that are passed to `AWS_PROXY` integrations. + * For HTTP APIs without a specified `integration_subtype`, a key-value map specifying how to transform HTTP requests before sending them to the backend. + * See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html) for details. + */ + requestParameters?: pulumi.Input<{[key: string]: pulumi.Input}>; + /** + * Mappings to transform the HTTP response from a backend integration before returning the response to clients. Supported only for HTTP APIs. + */ + responseParameters?: pulumi.Input[]>; + /** + * Custom timeout between 50 and 29,000 milliseconds for WebSocket APIs and between 50 and 30,000 milliseconds for HTTP APIs. + * The default timeout is 29 seconds for WebSocket APIs and 30 seconds for HTTP APIs. + * this provider will only perform drift detection of its value when present in a configuration. + */ + timeoutMilliseconds?: pulumi.Input; + /** + * TLS configuration for a private integration. Supported only for HTTP APIs. + */ + tlsConfig?: pulumi.Input; + } + + /** + * Manages an Amazon API Gateway Version 2 route. + * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html) for [WebSocket](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-develop-routes.html) and [HTTP](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-routes.html) APIs. + * + * {{% examples %}} + * ## Example Usage + * {{% example %}} + * ### Basic + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as aws from "@pulumi/aws"; + * + * const exampleApi = new aws.apigatewayv2.Api("exampleApi", { + * protocolType: "WEBSOCKET", + * routeSelectionExpression: "$request.body.action", + * }); + * const exampleRoute = new aws.apigatewayv2.Route("exampleRoute", { + * apiId: exampleApi.id, + * routeKey: "$default", + * }); + * ``` + * ```python + * import pulumi + * import pulumi_aws as aws + * + * example_api = aws.apigatewayv2.Api("exampleApi", + * protocol_type="WEBSOCKET", + * route_selection_expression="$request.body.action") + * example_route = aws.apigatewayv2.Route("exampleRoute", + * api_id=example_api.id, + * route_key="$default") + * ``` + * ```csharp + * using System.Collections.Generic; + * using System.Linq; + * using Pulumi; + * using Aws = Pulumi.Aws; + * + * return await Deployment.RunAsync(() => + * { + * var exampleApi = new Aws.ApiGatewayV2.Api("exampleApi", new() + * { + * ProtocolType = "WEBSOCKET", + * RouteSelectionExpression = "$request.body.action", + * }); + * + * var exampleRoute = new Aws.ApiGatewayV2.Route("exampleRoute", new() + * { + * ApiId = exampleApi.Id, + * RouteKey = "$default", + * }); + * + * }); + * ``` + * ```go + * package main + * + * import ( + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + * "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + * ) + * + * func main() { + * pulumi.Run(func(ctx *pulumi.Context) error { + * exampleApi, err := apigatewayv2.NewApi(ctx, "exampleApi", &apigatewayv2.ApiArgs{ + * ProtocolType: pulumi.String("WEBSOCKET"), + * RouteSelectionExpression: pulumi.String("$request.body.action"), + * }) + * if err != nil { + * return err + * } + * _, err = apigatewayv2.NewRoute(ctx, "exampleRoute", &apigatewayv2.RouteArgs{ + * ApiId: exampleApi.ID(), + * RouteKey: pulumi.String("$default"), + * }) + * if err != nil { + * return err + * } + * return nil + * }) + * } + * ``` + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Api; + * import com.pulumi.aws.apigatewayv2.ApiArgs; + * import com.pulumi.aws.apigatewayv2.Route; + * import com.pulumi.aws.apigatewayv2.RouteArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var exampleApi = new Api("exampleApi", ApiArgs.builder() + * .protocolType("WEBSOCKET") + * .routeSelectionExpression("$request.body.action") + * .build()); + * + * var exampleRoute = new Route("exampleRoute", RouteArgs.builder() + * .apiId(exampleApi.id()) + * .routeKey("$default") + * .build()); + * + * } + * } + * ``` + * ```yaml + * resources: + * exampleApi: + * type: aws:apigatewayv2:Api + * properties: + * protocolType: WEBSOCKET + * routeSelectionExpression: $request.body.action + * exampleRoute: + * type: aws:apigatewayv2:Route + * properties: + * apiId: ${exampleApi.id} + * routeKey: $default + * ``` + * {{% /example %}} + * {{% example %}} + * ### HTTP Proxy Integration + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as aws from "@pulumi/aws"; + * + * const exampleApi = new aws.apigatewayv2.Api("exampleApi", {protocolType: "HTTP"}); + * const exampleIntegration = new aws.apigatewayv2.Integration("exampleIntegration", { + * apiId: exampleApi.id, + * integrationType: "HTTP_PROXY", + * integrationMethod: "ANY", + * integrationUri: "https://example.com/{proxy}", + * }); + * const exampleRoute = new aws.apigatewayv2.Route("exampleRoute", { + * apiId: exampleApi.id, + * routeKey: "ANY /example/{proxy+}", + * target: pulumi.interpolate`integrations/${exampleIntegration.id}`, + * }); + * ``` + * ```python + * import pulumi + * import pulumi_aws as aws + * + * example_api = aws.apigatewayv2.Api("exampleApi", protocol_type="HTTP") + * example_integration = aws.apigatewayv2.Integration("exampleIntegration", + * api_id=example_api.id, + * integration_type="HTTP_PROXY", + * integration_method="ANY", + * integration_uri="https://example.com/{proxy}") + * example_route = aws.apigatewayv2.Route("exampleRoute", + * api_id=example_api.id, + * route_key="ANY /example/{proxy+}", + * target=example_integration.id.apply(lambda id: f"integrations/{id}")) + * ``` + * ```csharp + * using System.Collections.Generic; + * using System.Linq; + * using Pulumi; + * using Aws = Pulumi.Aws; + * + * return await Deployment.RunAsync(() => + * { + * var exampleApi = new Aws.ApiGatewayV2.Api("exampleApi", new() + * { + * ProtocolType = "HTTP", + * }); + * + * var exampleIntegration = new Aws.ApiGatewayV2.Integration("exampleIntegration", new() + * { + * ApiId = exampleApi.Id, + * IntegrationType = "HTTP_PROXY", + * IntegrationMethod = "ANY", + * IntegrationUri = "https://example.com/{proxy}", + * }); + * + * var exampleRoute = new Aws.ApiGatewayV2.Route("exampleRoute", new() + * { + * ApiId = exampleApi.Id, + * RouteKey = "ANY /example/{proxy+}", + * Target = exampleIntegration.Id.Apply(id => $"integrations/{id}"), + * }); + * + * }); + * ``` + * ```go + * package main + * + * import ( + * "fmt" + * + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + * "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + * ) + * + * func main() { + * pulumi.Run(func(ctx *pulumi.Context) error { + * exampleApi, err := apigatewayv2.NewApi(ctx, "exampleApi", &apigatewayv2.ApiArgs{ + * ProtocolType: pulumi.String("HTTP"), + * }) + * if err != nil { + * return err + * } + * exampleIntegration, err := apigatewayv2.NewIntegration(ctx, "exampleIntegration", &apigatewayv2.IntegrationArgs{ + * ApiId: exampleApi.ID(), + * IntegrationType: pulumi.String("HTTP_PROXY"), + * IntegrationMethod: pulumi.String("ANY"), + * IntegrationUri: pulumi.String("https://example.com/{proxy}"), + * }) + * if err != nil { + * return err + * } + * _, err = apigatewayv2.NewRoute(ctx, "exampleRoute", &apigatewayv2.RouteArgs{ + * ApiId: exampleApi.ID(), + * RouteKey: pulumi.String("ANY /example/{proxy+}"), + * Target: exampleIntegration.ID().ApplyT(func(id string) (string, error) { + * return fmt.Sprintf("integrations/%v", id), nil + * }).(pulumi.StringOutput), + * }) + * if err != nil { + * return err + * } + * return nil + * }) + * } + * ``` + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Api; + * import com.pulumi.aws.apigatewayv2.ApiArgs; + * import com.pulumi.aws.apigatewayv2.Integration; + * import com.pulumi.aws.apigatewayv2.IntegrationArgs; + * import com.pulumi.aws.apigatewayv2.Route; + * import com.pulumi.aws.apigatewayv2.RouteArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var exampleApi = new Api("exampleApi", ApiArgs.builder() + * .protocolType("HTTP") + * .build()); + * + * var exampleIntegration = new Integration("exampleIntegration", IntegrationArgs.builder() + * .apiId(exampleApi.id()) + * .integrationType("HTTP_PROXY") + * .integrationMethod("ANY") + * .integrationUri("https://example.com/{proxy}") + * .build()); + * + * var exampleRoute = new Route("exampleRoute", RouteArgs.builder() + * .apiId(exampleApi.id()) + * .routeKey("ANY /example/{proxy+}") + * .target(exampleIntegration.id().applyValue(id -> String.format("integrations/%s", id))) + * .build()); + * + * } + * } + * ``` + * ```yaml + * resources: + * exampleApi: + * type: aws:apigatewayv2:Api + * properties: + * protocolType: HTTP + * exampleIntegration: + * type: aws:apigatewayv2:Integration + * properties: + * apiId: ${exampleApi.id} + * integrationType: HTTP_PROXY + * integrationMethod: ANY + * integrationUri: https://example.com/{proxy} + * exampleRoute: + * type: aws:apigatewayv2:Route + * properties: + * apiId: ${exampleApi.id} + * routeKey: ANY /example/{proxy+} + * target: integrations/${exampleIntegration.id} + * ``` + * {{% /example %}} + * {{% /examples %}} + * + * ## Import + * + * Using `pulumi import`, import `aws_apigatewayv2_route` using the API identifier and route identifier. For example: + * + * ```sh + * $ pulumi import aws:apigatewayv2/route:Route example aabbccddee/1122334 + * ``` + * -> __Note:__ The API Gateway managed route created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. + */ + export interface HttpRouteArgs { + /** + * Boolean whether an API key is required for the route. Defaults to `false`. Supported only for WebSocket APIs. */ - domainConfiguration?: pulumi.Input; + apiKeyRequired?: pulumi.Input; /** - * Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + * Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation. */ - domainId?: pulumi.Input; - } - - export interface HttpAuthorizerArgs { - } - - export interface HttpIntegrationArgs { - } - - export interface HttpRouteArgs { + authorizationScopes?: pulumi.Input[]>; + /** + * Authorization type for the route. + * For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + * For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + * Defaults to `NONE`. + */ + authorizationType?: pulumi.Input; /** * The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. */ authorizer?: pulumi.Input; + /** + * Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. + */ + authorizerId?: pulumi.Input; /** * The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. */ integration?: pulumi.Input; + /** + * Operation name for the route. Must be between 1 and 64 characters in length. + */ + operationName?: pulumi.Input; + /** + * Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + */ + target?: pulumi.Input; } + /** + * Manages an Amazon API Gateway Version 2 stage. + * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). + * + * {{% examples %}} + * ## Example Usage + * {{% example %}} + * ### Basic + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as aws from "@pulumi/aws"; + * + * const example = new aws.apigatewayv2.Stage("example", {apiId: aws_apigatewayv2_api.example.id}); + * ``` + * ```python + * import pulumi + * import pulumi_aws as aws + * + * example = aws.apigatewayv2.Stage("example", api_id=aws_apigatewayv2_api["example"]["id"]) + * ``` + * ```csharp + * using System.Collections.Generic; + * using System.Linq; + * using Pulumi; + * using Aws = Pulumi.Aws; + * + * return await Deployment.RunAsync(() => + * { + * var example = new Aws.ApiGatewayV2.Stage("example", new() + * { + * ApiId = aws_apigatewayv2_api.Example.Id, + * }); + * + * }); + * ``` + * ```go + * package main + * + * import ( + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + * "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + * ) + * + * func main() { + * pulumi.Run(func(ctx *pulumi.Context) error { + * _, err := apigatewayv2.NewStage(ctx, "example", &apigatewayv2.StageArgs{ + * ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + * }) + * if err != nil { + * return err + * } + * return nil + * }) + * } + * ``` + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.Stage; + * import com.pulumi.aws.apigatewayv2.StageArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new Stage("example", StageArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .build()); + * + * } + * } + * ``` + * ```yaml + * resources: + * example: + * type: aws:apigatewayv2:Stage + * properties: + * apiId: ${aws_apigatewayv2_api.example.id} + * ``` + * {{% /example %}} + * {{% /examples %}} + * + * ## Import + * + * Using `pulumi import`, import `aws_apigatewayv2_stage` using the API identifier and stage name. For example: + * + * ```sh + * $ pulumi import aws:apigatewayv2/stage:Stage example aabbccddee/example-stage + * ``` + * -> __Note:__ The API Gateway managed stage created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. + */ export interface HttpStageArgs { + /** + * Settings for logging access in this stage. + * Use the `aws.apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions). + */ + accessLogSettings?: pulumi.Input; + /** + * Whether updates to an API automatically trigger a new deployment. Defaults to `false`. Applicable for HTTP APIs. + */ + autoDeploy?: pulumi.Input; + /** + * Identifier of a client certificate for the stage. Use the `aws.apigateway.ClientCertificate` resource to configure a client certificate. + * Supported only for WebSocket APIs. + */ + clientCertificateId?: pulumi.Input; + /** + * Default route settings for the stage. + */ + defaultRouteSettings?: pulumi.Input; + /** + * Deployment identifier of the stage. Use the `aws.apigatewayv2.Deployment` resource to configure a deployment. + */ + deploymentId?: pulumi.Input; + /** + * Description for the stage. Must be less than or equal to 1024 characters in length. + */ + description?: pulumi.Input; + /** + * Name of the stage. Must be between 1 and 128 characters in length. + * + * The following arguments are optional: + */ + name?: pulumi.Input; + /** + * Route settings for the stage. + */ + routeSettings?: pulumi.Input[]>; + /** + * Map that defines the stage variables for the stage. + */ + stageVariables?: pulumi.Input<{[key: string]: pulumi.Input}>; + /** + * Map of tags to assign to the stage. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + */ + tags?: pulumi.Input<{[key: string]: pulumi.Input}>; } } diff --git a/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py b/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py index 6910bed6e..3a0c580dc 100644 --- a/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py +++ b/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py @@ -22,7 +22,7 @@ @pulumi.input_type class DomainConfigurationArgs: def __init__(__self__, *, - domain_name_configuration: Optional[pulumi.Input['pulumi_aws.apigatewayv2.DomainNameDomainNameConfigurationArgs']] = None, + domain_name_configuration: pulumi.Input['pulumi_aws.apigatewayv2.DomainNameDomainNameConfigurationArgs'], mutual_tls_authentication: Optional[pulumi.Input['pulumi_aws.apigatewayv2.DomainNameMutualTlsAuthenticationArgs']] = None, tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None): """ @@ -367,8 +367,7 @@ def __init__(__self__, *, :param pulumi.Input['pulumi_aws.apigatewayv2.DomainNameMutualTlsAuthenticationArgs'] mutual_tls_authentication: Mutual TLS authentication configuration for the domain name. :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. """ - if domain_name_configuration is not None: - pulumi.set(__self__, "domain_name_configuration", domain_name_configuration) + pulumi.set(__self__, "domain_name_configuration", domain_name_configuration) if mutual_tls_authentication is not None: pulumi.set(__self__, "mutual_tls_authentication", mutual_tls_authentication) if tags is not None: @@ -376,14 +375,14 @@ def __init__(__self__, *, @property @pulumi.getter(name="domainNameConfiguration") - def domain_name_configuration(self) -> Optional[pulumi.Input['pulumi_aws.apigatewayv2.DomainNameDomainNameConfigurationArgs']]: + def domain_name_configuration(self) -> pulumi.Input['pulumi_aws.apigatewayv2.DomainNameDomainNameConfigurationArgs']: """ Domain name configuration. See below. """ return pulumi.get(self, "domain_name_configuration") @domain_name_configuration.setter - def domain_name_configuration(self, value: Optional[pulumi.Input['pulumi_aws.apigatewayv2.DomainNameDomainNameConfigurationArgs']]): + def domain_name_configuration(self, value: pulumi.Input['pulumi_aws.apigatewayv2.DomainNameDomainNameConfigurationArgs']): pulumi.set(self, "domain_name_configuration", value) @property @@ -414,67 +413,1948 @@ def tags(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]): @pulumi.input_type class DomainMappingArgs: def __init__(__self__, *, - domain_configuration: Optional[pulumi.Input['DomainConfigurationArgs']] = None, + stage: pulumi.Input[str], + api_mapping_key: Optional[pulumi.Input[str]] = None, + domain_configuration: Optional['DomainConfigurationArgs'] = None, domain_id: Optional[pulumi.Input[str]] = None): """ - :param pulumi.Input['DomainConfigurationArgs'] domain_configuration: Configuration of the domain name to create. Cannot be specified together with `domainId`. + Manages an Amazon API Gateway Version 2 API mapping. + More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). + + {{% examples %}} + ## Example Usage + {{% example %}} + ### Basic + + ```typescript + import * as pulumi from "@pulumi/pulumi"; + import * as aws from "@pulumi/aws"; + + const example = new aws.apigatewayv2.ApiMapping("example", { + apiId: aws_apigatewayv2_api.example.id, + domainName: aws_apigatewayv2_domain_name.example.id, + stage: aws_apigatewayv2_stage.example.id, + }); + ``` + ```python + import pulumi + import pulumi_aws as aws + + example = aws.apigatewayv2.ApiMapping("example", + api_id=aws_apigatewayv2_api["example"]["id"], + domain_name=aws_apigatewayv2_domain_name["example"]["id"], + stage=aws_apigatewayv2_stage["example"]["id"]) + ``` + ```csharp + using System.Collections.Generic; + using System.Linq; + using Pulumi; + using Aws = Pulumi.Aws; + + return await Deployment.RunAsync(() => + { + var example = new Aws.ApiGatewayV2.ApiMapping("example", new() + { + ApiId = aws_apigatewayv2_api.Example.Id, + DomainName = aws_apigatewayv2_domain_name.Example.Id, + Stage = aws_apigatewayv2_stage.Example.Id, + }); + + }); + ``` + ```go + package main + + import ( + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + ) + + func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ + ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), + Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), + }) + if err != nil { + return err + } + return nil + }) + } + ``` + ```java + package generated_program; + + import com.pulumi.Context; + import com.pulumi.Pulumi; + import com.pulumi.core.Output; + import com.pulumi.aws.apigatewayv2.ApiMapping; + import com.pulumi.aws.apigatewayv2.ApiMappingArgs; + import java.util.List; + import java.util.ArrayList; + import java.util.Map; + import java.io.File; + import java.nio.file.Files; + import java.nio.file.Paths; + + public class App { + public static void main(String[] args) { + Pulumi.run(App::stack); + } + + public static void stack(Context ctx) { + var example = new ApiMapping("example", ApiMappingArgs.builder() + .apiId(aws_apigatewayv2_api.example().id()) + .domainName(aws_apigatewayv2_domain_name.example().id()) + .stage(aws_apigatewayv2_stage.example().id()) + .build()); + + } + } + ``` + ```yaml + resources: + example: + type: aws:apigatewayv2:ApiMapping + properties: + apiId: ${aws_apigatewayv2_api.example.id} + domainName: ${aws_apigatewayv2_domain_name.example.id} + stage: ${aws_apigatewayv2_stage.example.id} + ``` + {{% /example %}} + {{% /examples %}} + + ## Import + + Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: + + ```sh + $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com + ``` + + :param pulumi.Input[str] stage: API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. + :param pulumi.Input[str] api_mapping_key: The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). + :param 'DomainConfigurationArgs' domain_configuration: Configuration of the domain name to create. Cannot be specified together with `domainId`. :param pulumi.Input[str] domain_id: Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. """ + pulumi.set(__self__, "stage", stage) + if api_mapping_key is not None: + pulumi.set(__self__, "api_mapping_key", api_mapping_key) if domain_configuration is not None: pulumi.set(__self__, "domain_configuration", domain_configuration) if domain_id is not None: pulumi.set(__self__, "domain_id", domain_id) - @property - @pulumi.getter(name="domainConfiguration") - def domain_configuration(self) -> Optional[pulumi.Input['DomainConfigurationArgs']]: - """ - Configuration of the domain name to create. Cannot be specified together with `domainId`. - """ - return pulumi.get(self, "domain_configuration") + @property + @pulumi.getter + def stage(self) -> pulumi.Input[str]: + """ + API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. + """ + return pulumi.get(self, "stage") + + @stage.setter + def stage(self, value: pulumi.Input[str]): + pulumi.set(self, "stage", value) + + @property + @pulumi.getter(name="apiMappingKey") + def api_mapping_key(self) -> Optional[pulumi.Input[str]]: + """ + The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). + """ + return pulumi.get(self, "api_mapping_key") + + @api_mapping_key.setter + def api_mapping_key(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "api_mapping_key", value) + + @property + @pulumi.getter(name="domainConfiguration") + def domain_configuration(self) -> Optional['DomainConfigurationArgs']: + """ + Configuration of the domain name to create. Cannot be specified together with `domainId`. + """ + return pulumi.get(self, "domain_configuration") + + @domain_configuration.setter + def domain_configuration(self, value: Optional['DomainConfigurationArgs']): + pulumi.set(self, "domain_configuration", value) + + @property + @pulumi.getter(name="domainId") + def domain_id(self) -> Optional[pulumi.Input[str]]: + """ + Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + """ + return pulumi.get(self, "domain_id") + + @domain_id.setter + def domain_id(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "domain_id", value) + + +@pulumi.input_type +class HttpAuthorizerArgs: + def __init__(__self__, *, + authorizer_type: pulumi.Input[str], + authorizer_credentials_arn: Optional[pulumi.Input[str]] = None, + authorizer_payload_format_version: Optional[pulumi.Input[str]] = None, + authorizer_result_ttl_in_seconds: Optional[pulumi.Input[int]] = None, + authorizer_uri: Optional[pulumi.Input[str]] = None, + enable_simple_responses: Optional[pulumi.Input[bool]] = None, + identity_sources: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + jwt_configuration: Optional[pulumi.Input['pulumi_aws.apigatewayv2.AuthorizerJwtConfigurationArgs']] = None, + name: Optional[pulumi.Input[str]] = None): + """ + Manages an Amazon API Gateway Version 2 authorizer. + More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). + + {{% examples %}} + ## Example Usage + {{% example %}} + ### Basic WebSocket API + + ```typescript + import * as pulumi from "@pulumi/pulumi"; + import * as aws from "@pulumi/aws"; + + const example = new aws.apigatewayv2.Authorizer("example", { + apiId: aws_apigatewayv2_api.example.id, + authorizerType: "REQUEST", + authorizerUri: aws_lambda_function.example.invoke_arn, + identitySources: ["route.request.header.Auth"], + }); + ``` + ```python + import pulumi + import pulumi_aws as aws + + example = aws.apigatewayv2.Authorizer("example", + api_id=aws_apigatewayv2_api["example"]["id"], + authorizer_type="REQUEST", + authorizer_uri=aws_lambda_function["example"]["invoke_arn"], + identity_sources=["route.request.header.Auth"]) + ``` + ```csharp + using System.Collections.Generic; + using System.Linq; + using Pulumi; + using Aws = Pulumi.Aws; + + return await Deployment.RunAsync(() => + { + var example = new Aws.ApiGatewayV2.Authorizer("example", new() + { + ApiId = aws_apigatewayv2_api.Example.Id, + AuthorizerType = "REQUEST", + AuthorizerUri = aws_lambda_function.Example.Invoke_arn, + IdentitySources = new[] + { + "route.request.header.Auth", + }, + }); + + }); + ``` + ```go + package main + + import ( + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + ) + + func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + _, err := apigatewayv2.NewAuthorizer(ctx, "example", &apigatewayv2.AuthorizerArgs{ + ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + AuthorizerType: pulumi.String("REQUEST"), + AuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn), + IdentitySources: pulumi.StringArray{ + pulumi.String("route.request.header.Auth"), + }, + }) + if err != nil { + return err + } + return nil + }) + } + ``` + ```java + package generated_program; + + import com.pulumi.Context; + import com.pulumi.Pulumi; + import com.pulumi.core.Output; + import com.pulumi.aws.apigatewayv2.Authorizer; + import com.pulumi.aws.apigatewayv2.AuthorizerArgs; + import java.util.List; + import java.util.ArrayList; + import java.util.Map; + import java.io.File; + import java.nio.file.Files; + import java.nio.file.Paths; + + public class App { + public static void main(String[] args) { + Pulumi.run(App::stack); + } + + public static void stack(Context ctx) { + var example = new Authorizer("example", AuthorizerArgs.builder() + .apiId(aws_apigatewayv2_api.example().id()) + .authorizerType("REQUEST") + .authorizerUri(aws_lambda_function.example().invoke_arn()) + .identitySources("route.request.header.Auth") + .build()); + + } + } + ``` + ```yaml + resources: + example: + type: aws:apigatewayv2:Authorizer + properties: + apiId: ${aws_apigatewayv2_api.example.id} + authorizerType: REQUEST + authorizerUri: ${aws_lambda_function.example.invoke_arn} + identitySources: + - route.request.header.Auth + ``` + {{% /example %}} + {{% example %}} + ### Basic HTTP API + + ```typescript + import * as pulumi from "@pulumi/pulumi"; + import * as aws from "@pulumi/aws"; + + const example = new aws.apigatewayv2.Authorizer("example", { + apiId: aws_apigatewayv2_api.example.id, + authorizerType: "REQUEST", + authorizerUri: aws_lambda_function.example.invoke_arn, + identitySources: ["$request.header.Authorization"], + authorizerPayloadFormatVersion: "2.0", + }); + ``` + ```python + import pulumi + import pulumi_aws as aws + + example = aws.apigatewayv2.Authorizer("example", + api_id=aws_apigatewayv2_api["example"]["id"], + authorizer_type="REQUEST", + authorizer_uri=aws_lambda_function["example"]["invoke_arn"], + identity_sources=["$request.header.Authorization"], + authorizer_payload_format_version="2.0") + ``` + ```csharp + using System.Collections.Generic; + using System.Linq; + using Pulumi; + using Aws = Pulumi.Aws; + + return await Deployment.RunAsync(() => + { + var example = new Aws.ApiGatewayV2.Authorizer("example", new() + { + ApiId = aws_apigatewayv2_api.Example.Id, + AuthorizerType = "REQUEST", + AuthorizerUri = aws_lambda_function.Example.Invoke_arn, + IdentitySources = new[] + { + "$request.header.Authorization", + }, + AuthorizerPayloadFormatVersion = "2.0", + }); + + }); + ``` + ```go + package main + + import ( + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + ) + + func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + _, err := apigatewayv2.NewAuthorizer(ctx, "example", &apigatewayv2.AuthorizerArgs{ + ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + AuthorizerType: pulumi.String("REQUEST"), + AuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn), + IdentitySources: pulumi.StringArray{ + pulumi.String("$request.header.Authorization"), + }, + AuthorizerPayloadFormatVersion: pulumi.String("2.0"), + }) + if err != nil { + return err + } + return nil + }) + } + ``` + ```java + package generated_program; + + import com.pulumi.Context; + import com.pulumi.Pulumi; + import com.pulumi.core.Output; + import com.pulumi.aws.apigatewayv2.Authorizer; + import com.pulumi.aws.apigatewayv2.AuthorizerArgs; + import java.util.List; + import java.util.ArrayList; + import java.util.Map; + import java.io.File; + import java.nio.file.Files; + import java.nio.file.Paths; + + public class App { + public static void main(String[] args) { + Pulumi.run(App::stack); + } + + public static void stack(Context ctx) { + var example = new Authorizer("example", AuthorizerArgs.builder() + .apiId(aws_apigatewayv2_api.example().id()) + .authorizerType("REQUEST") + .authorizerUri(aws_lambda_function.example().invoke_arn()) + .identitySources("$request.header.Authorization") + .authorizerPayloadFormatVersion("2.0") + .build()); + + } + } + ``` + ```yaml + resources: + example: + type: aws:apigatewayv2:Authorizer + properties: + apiId: ${aws_apigatewayv2_api.example.id} + authorizerType: REQUEST + authorizerUri: ${aws_lambda_function.example.invoke_arn} + identitySources: + - $request.header.Authorization + authorizerPayloadFormatVersion: '2.0' + ``` + {{% /example %}} + {{% /examples %}} + + ## Import + + Using `pulumi import`, import `aws_apigatewayv2_authorizer` using the API identifier and authorizer identifier. For example: + + ```sh + $ pulumi import aws:apigatewayv2/authorizer:Authorizer example aabbccddee/1122334 + ``` + + :param pulumi.Input[str] authorizer_type: Authorizer type. Valid values: `JWT`, `REQUEST`. + Specify `REQUEST` for a Lambda function using incoming request parameters. + For HTTP APIs, specify `JWT` to use JSON Web Tokens. + :param pulumi.Input[str] authorizer_credentials_arn: Required credentials as an IAM role for API Gateway to invoke the authorizer. + Supported only for `REQUEST` authorizers. + :param pulumi.Input[str] authorizer_payload_format_version: Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. + Valid values: `1.0`, `2.0`. + :param pulumi.Input[int] authorizer_result_ttl_in_seconds: Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. + If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. + Supported only for HTTP API Lambda authorizers. + :param pulumi.Input[str] authorizer_uri: Authorizer's Uniform Resource Identifier (URI). + For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invoke_arn` attribute of the `aws.lambda.Function` resource. + Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length. + :param pulumi.Input[bool] enable_simple_responses: Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. + Supported only for HTTP APIs. + :param pulumi.Input[Sequence[pulumi.Input[str]]] identity_sources: Identity sources for which authorization is requested. + For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. + For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. + :param pulumi.Input['pulumi_aws.apigatewayv2.AuthorizerJwtConfigurationArgs'] jwt_configuration: Configuration of a JWT authorizer. Required for the `JWT` authorizer type. + Supported only for HTTP APIs. + :param pulumi.Input[str] name: Name of the authorizer. Must be between 1 and 128 characters in length. + """ + pulumi.set(__self__, "authorizer_type", authorizer_type) + if authorizer_credentials_arn is not None: + pulumi.set(__self__, "authorizer_credentials_arn", authorizer_credentials_arn) + if authorizer_payload_format_version is not None: + pulumi.set(__self__, "authorizer_payload_format_version", authorizer_payload_format_version) + if authorizer_result_ttl_in_seconds is not None: + pulumi.set(__self__, "authorizer_result_ttl_in_seconds", authorizer_result_ttl_in_seconds) + if authorizer_uri is not None: + pulumi.set(__self__, "authorizer_uri", authorizer_uri) + if enable_simple_responses is not None: + pulumi.set(__self__, "enable_simple_responses", enable_simple_responses) + if identity_sources is not None: + pulumi.set(__self__, "identity_sources", identity_sources) + if jwt_configuration is not None: + pulumi.set(__self__, "jwt_configuration", jwt_configuration) + if name is not None: + pulumi.set(__self__, "name", name) + + @property + @pulumi.getter(name="authorizerType") + def authorizer_type(self) -> pulumi.Input[str]: + """ + Authorizer type. Valid values: `JWT`, `REQUEST`. + Specify `REQUEST` for a Lambda function using incoming request parameters. + For HTTP APIs, specify `JWT` to use JSON Web Tokens. + """ + return pulumi.get(self, "authorizer_type") + + @authorizer_type.setter + def authorizer_type(self, value: pulumi.Input[str]): + pulumi.set(self, "authorizer_type", value) + + @property + @pulumi.getter(name="authorizerCredentialsArn") + def authorizer_credentials_arn(self) -> Optional[pulumi.Input[str]]: + """ + Required credentials as an IAM role for API Gateway to invoke the authorizer. + Supported only for `REQUEST` authorizers. + """ + return pulumi.get(self, "authorizer_credentials_arn") + + @authorizer_credentials_arn.setter + def authorizer_credentials_arn(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "authorizer_credentials_arn", value) + + @property + @pulumi.getter(name="authorizerPayloadFormatVersion") + def authorizer_payload_format_version(self) -> Optional[pulumi.Input[str]]: + """ + Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. + Valid values: `1.0`, `2.0`. + """ + return pulumi.get(self, "authorizer_payload_format_version") + + @authorizer_payload_format_version.setter + def authorizer_payload_format_version(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "authorizer_payload_format_version", value) + + @property + @pulumi.getter(name="authorizerResultTtlInSeconds") + def authorizer_result_ttl_in_seconds(self) -> Optional[pulumi.Input[int]]: + """ + Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. + If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. + Supported only for HTTP API Lambda authorizers. + """ + return pulumi.get(self, "authorizer_result_ttl_in_seconds") + + @authorizer_result_ttl_in_seconds.setter + def authorizer_result_ttl_in_seconds(self, value: Optional[pulumi.Input[int]]): + pulumi.set(self, "authorizer_result_ttl_in_seconds", value) + + @property + @pulumi.getter(name="authorizerUri") + def authorizer_uri(self) -> Optional[pulumi.Input[str]]: + """ + Authorizer's Uniform Resource Identifier (URI). + For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invoke_arn` attribute of the `aws.lambda.Function` resource. + Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length. + """ + return pulumi.get(self, "authorizer_uri") + + @authorizer_uri.setter + def authorizer_uri(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "authorizer_uri", value) + + @property + @pulumi.getter(name="enableSimpleResponses") + def enable_simple_responses(self) -> Optional[pulumi.Input[bool]]: + """ + Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. + Supported only for HTTP APIs. + """ + return pulumi.get(self, "enable_simple_responses") + + @enable_simple_responses.setter + def enable_simple_responses(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "enable_simple_responses", value) + + @property + @pulumi.getter(name="identitySources") + def identity_sources(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]: + """ + Identity sources for which authorization is requested. + For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. + For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. + """ + return pulumi.get(self, "identity_sources") + + @identity_sources.setter + def identity_sources(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]): + pulumi.set(self, "identity_sources", value) + + @property + @pulumi.getter(name="jwtConfiguration") + def jwt_configuration(self) -> Optional[pulumi.Input['pulumi_aws.apigatewayv2.AuthorizerJwtConfigurationArgs']]: + """ + Configuration of a JWT authorizer. Required for the `JWT` authorizer type. + Supported only for HTTP APIs. + """ + return pulumi.get(self, "jwt_configuration") + + @jwt_configuration.setter + def jwt_configuration(self, value: Optional[pulumi.Input['pulumi_aws.apigatewayv2.AuthorizerJwtConfigurationArgs']]): + pulumi.set(self, "jwt_configuration", value) + + @property + @pulumi.getter + def name(self) -> Optional[pulumi.Input[str]]: + """ + Name of the authorizer. Must be between 1 and 128 characters in length. + """ + return pulumi.get(self, "name") + + @name.setter + def name(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "name", value) + + +@pulumi.input_type +class HttpIntegrationArgs: + def __init__(__self__, *, + connection_id: Optional[pulumi.Input[str]] = None, + connection_type: Optional[pulumi.Input[str]] = None, + credentials_arn: Optional[pulumi.Input[str]] = None, + description: Optional[pulumi.Input[str]] = None, + integration_method: Optional[pulumi.Input[str]] = None, + integration_subtype: Optional[pulumi.Input[str]] = None, + integration_type: Optional[pulumi.Input[str]] = None, + integration_uri: Optional[pulumi.Input[str]] = None, + lambda_: Optional['pulumi_aws.lambda_.Function'] = None, + lambda_invoke_arn: Optional[pulumi.Input[str]] = None, + payload_format_version: Optional[pulumi.Input[str]] = None, + request_parameters: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, + response_parameters: Optional[pulumi.Input[Sequence[pulumi.Input['pulumi_aws.apigatewayv2.IntegrationResponseParameterArgs']]]] = None, + timeout_milliseconds: Optional[pulumi.Input[int]] = None, + tls_config: Optional[pulumi.Input['pulumi_aws.apigatewayv2.IntegrationTlsConfigArgs']] = None): + """ + Manages an Amazon API Gateway Version 2 integration. + More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). + + {{% examples %}} + ## Example Usage + {{% example %}} + ### Basic + + ```typescript + import * as pulumi from "@pulumi/pulumi"; + import * as aws from "@pulumi/aws"; + + const example = new aws.apigatewayv2.Integration("example", { + apiId: aws_apigatewayv2_api.example.id, + integrationType: "MOCK", + }); + ``` + ```python + import pulumi + import pulumi_aws as aws + + example = aws.apigatewayv2.Integration("example", + api_id=aws_apigatewayv2_api["example"]["id"], + integration_type="MOCK") + ``` + ```csharp + using System.Collections.Generic; + using System.Linq; + using Pulumi; + using Aws = Pulumi.Aws; + + return await Deployment.RunAsync(() => + { + var example = new Aws.ApiGatewayV2.Integration("example", new() + { + ApiId = aws_apigatewayv2_api.Example.Id, + IntegrationType = "MOCK", + }); + + }); + ``` + ```go + package main + + import ( + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + ) + + func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ + ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + IntegrationType: pulumi.String("MOCK"), + }) + if err != nil { + return err + } + return nil + }) + } + ``` + ```java + package generated_program; + + import com.pulumi.Context; + import com.pulumi.Pulumi; + import com.pulumi.core.Output; + import com.pulumi.aws.apigatewayv2.Integration; + import com.pulumi.aws.apigatewayv2.IntegrationArgs; + import java.util.List; + import java.util.ArrayList; + import java.util.Map; + import java.io.File; + import java.nio.file.Files; + import java.nio.file.Paths; + + public class App { + public static void main(String[] args) { + Pulumi.run(App::stack); + } + + public static void stack(Context ctx) { + var example = new Integration("example", IntegrationArgs.builder() + .apiId(aws_apigatewayv2_api.example().id()) + .integrationType("MOCK") + .build()); + + } + } + ``` + ```yaml + resources: + example: + type: aws:apigatewayv2:Integration + properties: + apiId: ${aws_apigatewayv2_api.example.id} + integrationType: MOCK + ``` + {{% /example %}} + {{% example %}} + ### Lambda Integration + + ```typescript + import * as pulumi from "@pulumi/pulumi"; + import * as aws from "@pulumi/aws"; + + const exampleFunction = new aws.lambda.Function("exampleFunction", { + code: new pulumi.asset.FileArchive("example.zip"), + role: aws_iam_role.example.arn, + handler: "index.handler", + runtime: "nodejs16.x", + }); + const exampleIntegration = new aws.apigatewayv2.Integration("exampleIntegration", { + apiId: aws_apigatewayv2_api.example.id, + integrationType: "AWS_PROXY", + connectionType: "INTERNET", + contentHandlingStrategy: "CONVERT_TO_TEXT", + description: "Lambda example", + integrationMethod: "POST", + integrationUri: exampleFunction.invokeArn, + passthroughBehavior: "WHEN_NO_MATCH", + }); + ``` + ```python + import pulumi + import pulumi_aws as aws + + example_function = aws.lambda_.Function("exampleFunction", + code=pulumi.FileArchive("example.zip"), + role=aws_iam_role["example"]["arn"], + handler="index.handler", + runtime="nodejs16.x") + example_integration = aws.apigatewayv2.Integration("exampleIntegration", + api_id=aws_apigatewayv2_api["example"]["id"], + integration_type="AWS_PROXY", + connection_type="INTERNET", + content_handling_strategy="CONVERT_TO_TEXT", + description="Lambda example", + integration_method="POST", + integration_uri=example_function.invoke_arn, + passthrough_behavior="WHEN_NO_MATCH") + ``` + ```csharp + using System.Collections.Generic; + using System.Linq; + using Pulumi; + using Aws = Pulumi.Aws; + + return await Deployment.RunAsync(() => + { + var exampleFunction = new Aws.Lambda.Function("exampleFunction", new() + { + Code = new FileArchive("example.zip"), + Role = aws_iam_role.Example.Arn, + Handler = "index.handler", + Runtime = "nodejs16.x", + }); + + var exampleIntegration = new Aws.ApiGatewayV2.Integration("exampleIntegration", new() + { + ApiId = aws_apigatewayv2_api.Example.Id, + IntegrationType = "AWS_PROXY", + ConnectionType = "INTERNET", + ContentHandlingStrategy = "CONVERT_TO_TEXT", + Description = "Lambda example", + IntegrationMethod = "POST", + IntegrationUri = exampleFunction.InvokeArn, + PassthroughBehavior = "WHEN_NO_MATCH", + }); + + }); + ``` + ```go + package main + + import ( + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + ) + + func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + exampleFunction, err := lambda.NewFunction(ctx, "exampleFunction", &lambda.FunctionArgs{ + Code: pulumi.NewFileArchive("example.zip"), + Role: pulumi.Any(aws_iam_role.Example.Arn), + Handler: pulumi.String("index.handler"), + Runtime: pulumi.String("nodejs16.x"), + }) + if err != nil { + return err + } + _, err = apigatewayv2.NewIntegration(ctx, "exampleIntegration", &apigatewayv2.IntegrationArgs{ + ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + IntegrationType: pulumi.String("AWS_PROXY"), + ConnectionType: pulumi.String("INTERNET"), + ContentHandlingStrategy: pulumi.String("CONVERT_TO_TEXT"), + Description: pulumi.String("Lambda example"), + IntegrationMethod: pulumi.String("POST"), + IntegrationUri: exampleFunction.InvokeArn, + PassthroughBehavior: pulumi.String("WHEN_NO_MATCH"), + }) + if err != nil { + return err + } + return nil + }) + } + ``` + ```java + package generated_program; + + import com.pulumi.Context; + import com.pulumi.Pulumi; + import com.pulumi.core.Output; + import com.pulumi.aws.lambda.Function; + import com.pulumi.aws.lambda.FunctionArgs; + import com.pulumi.aws.apigatewayv2.Integration; + import com.pulumi.aws.apigatewayv2.IntegrationArgs; + import com.pulumi.asset.FileArchive; + import java.util.List; + import java.util.ArrayList; + import java.util.Map; + import java.io.File; + import java.nio.file.Files; + import java.nio.file.Paths; + + public class App { + public static void main(String[] args) { + Pulumi.run(App::stack); + } + + public static void stack(Context ctx) { + var exampleFunction = new Function("exampleFunction", FunctionArgs.builder() + .code(new FileArchive("example.zip")) + .role(aws_iam_role.example().arn()) + .handler("index.handler") + .runtime("nodejs16.x") + .build()); + + var exampleIntegration = new Integration("exampleIntegration", IntegrationArgs.builder() + .apiId(aws_apigatewayv2_api.example().id()) + .integrationType("AWS_PROXY") + .connectionType("INTERNET") + .contentHandlingStrategy("CONVERT_TO_TEXT") + .description("Lambda example") + .integrationMethod("POST") + .integrationUri(exampleFunction.invokeArn()) + .passthroughBehavior("WHEN_NO_MATCH") + .build()); + + } + } + ``` + ```yaml + resources: + exampleFunction: + type: aws:lambda:Function + properties: + code: + fn::FileArchive: example.zip + role: ${aws_iam_role.example.arn} + handler: index.handler + runtime: nodejs16.x + exampleIntegration: + type: aws:apigatewayv2:Integration + properties: + apiId: ${aws_apigatewayv2_api.example.id} + integrationType: AWS_PROXY + connectionType: INTERNET + contentHandlingStrategy: CONVERT_TO_TEXT + description: Lambda example + integrationMethod: POST + integrationUri: ${exampleFunction.invokeArn} + passthroughBehavior: WHEN_NO_MATCH + ``` + {{% /example %}} + {{% example %}} + ### AWS Service Integration + + ```typescript + import * as pulumi from "@pulumi/pulumi"; + import * as aws from "@pulumi/aws"; + + const example = new aws.apigatewayv2.Integration("example", { + apiId: aws_apigatewayv2_api.example.id, + credentialsArn: aws_iam_role.example.arn, + description: "SQS example", + integrationType: "AWS_PROXY", + integrationSubtype: "SQS-SendMessage", + requestParameters: { + QueueUrl: "$request.header.queueUrl", + MessageBody: "$request.body.message", + }, + }); + ``` + ```python + import pulumi + import pulumi_aws as aws + + example = aws.apigatewayv2.Integration("example", + api_id=aws_apigatewayv2_api["example"]["id"], + credentials_arn=aws_iam_role["example"]["arn"], + description="SQS example", + integration_type="AWS_PROXY", + integration_subtype="SQS-SendMessage", + request_parameters={ + "QueueUrl": "$request.header.queueUrl", + "MessageBody": "$request.body.message", + }) + ``` + ```csharp + using System.Collections.Generic; + using System.Linq; + using Pulumi; + using Aws = Pulumi.Aws; + + return await Deployment.RunAsync(() => + { + var example = new Aws.ApiGatewayV2.Integration("example", new() + { + ApiId = aws_apigatewayv2_api.Example.Id, + CredentialsArn = aws_iam_role.Example.Arn, + Description = "SQS example", + IntegrationType = "AWS_PROXY", + IntegrationSubtype = "SQS-SendMessage", + RequestParameters = + { + { "QueueUrl", "$request.header.queueUrl" }, + { "MessageBody", "$request.body.message" }, + }, + }); + + }); + ``` + ```go + package main + + import ( + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + ) + + func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ + ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + CredentialsArn: pulumi.Any(aws_iam_role.Example.Arn), + Description: pulumi.String("SQS example"), + IntegrationType: pulumi.String("AWS_PROXY"), + IntegrationSubtype: pulumi.String("SQS-SendMessage"), + RequestParameters: pulumi.StringMap{ + "QueueUrl": pulumi.String("$request.header.queueUrl"), + "MessageBody": pulumi.String("$request.body.message"), + }, + }) + if err != nil { + return err + } + return nil + }) + } + ``` + ```java + package generated_program; + + import com.pulumi.Context; + import com.pulumi.Pulumi; + import com.pulumi.core.Output; + import com.pulumi.aws.apigatewayv2.Integration; + import com.pulumi.aws.apigatewayv2.IntegrationArgs; + import java.util.List; + import java.util.ArrayList; + import java.util.Map; + import java.io.File; + import java.nio.file.Files; + import java.nio.file.Paths; + + public class App { + public static void main(String[] args) { + Pulumi.run(App::stack); + } + + public static void stack(Context ctx) { + var example = new Integration("example", IntegrationArgs.builder() + .apiId(aws_apigatewayv2_api.example().id()) + .credentialsArn(aws_iam_role.example().arn()) + .description("SQS example") + .integrationType("AWS_PROXY") + .integrationSubtype("SQS-SendMessage") + .requestParameters(Map.ofEntries( + Map.entry("QueueUrl", "$request.header.queueUrl"), + Map.entry("MessageBody", "$request.body.message") + )) + .build()); + + } + } + ``` + ```yaml + resources: + example: + type: aws:apigatewayv2:Integration + properties: + apiId: ${aws_apigatewayv2_api.example.id} + credentialsArn: ${aws_iam_role.example.arn} + description: SQS example + integrationType: AWS_PROXY + integrationSubtype: SQS-SendMessage + requestParameters: + QueueUrl: $request.header.queueUrl + MessageBody: $request.body.message + ``` + {{% /example %}} + {{% example %}} + ### Private Integration + + ```typescript + import * as pulumi from "@pulumi/pulumi"; + import * as aws from "@pulumi/aws"; + + const example = new aws.apigatewayv2.Integration("example", { + apiId: aws_apigatewayv2_api.example.id, + credentialsArn: aws_iam_role.example.arn, + description: "Example with a load balancer", + integrationType: "HTTP_PROXY", + integrationUri: aws_lb_listener.example.arn, + integrationMethod: "ANY", + connectionType: "VPC_LINK", + connectionId: aws_apigatewayv2_vpc_link.example.id, + tlsConfig: { + serverNameToVerify: "example.com", + }, + requestParameters: { + "append:header.authforintegration": "$context.authorizer.authorizerResponse", + "overwrite:path": "staticValueForIntegration", + }, + responseParameters: [ + { + statusCode: "403", + mappings: { + "append:header.auth": "$context.authorizer.authorizerResponse", + }, + }, + { + statusCode: "200", + mappings: { + "overwrite:statuscode": "204", + }, + }, + ], + }); + ``` + ```python + import pulumi + import pulumi_aws as aws + + example = aws.apigatewayv2.Integration("example", + api_id=aws_apigatewayv2_api["example"]["id"], + credentials_arn=aws_iam_role["example"]["arn"], + description="Example with a load balancer", + integration_type="HTTP_PROXY", + integration_uri=aws_lb_listener["example"]["arn"], + integration_method="ANY", + connection_type="VPC_LINK", + connection_id=aws_apigatewayv2_vpc_link["example"]["id"], + tls_config=aws.apigatewayv2.IntegrationTlsConfigArgs( + server_name_to_verify="example.com", + ), + request_parameters={ + "append:header.authforintegration": "$context.authorizer.authorizerResponse", + "overwrite:path": "staticValueForIntegration", + }, + response_parameters=[ + aws.apigatewayv2.IntegrationResponseParameterArgs( + status_code="403", + mappings={ + "append:header.auth": "$context.authorizer.authorizerResponse", + }, + ), + aws.apigatewayv2.IntegrationResponseParameterArgs( + status_code="200", + mappings={ + "overwrite:statuscode": "204", + }, + ), + ]) + ``` + ```csharp + using System.Collections.Generic; + using System.Linq; + using Pulumi; + using Aws = Pulumi.Aws; + + return await Deployment.RunAsync(() => + { + var example = new Aws.ApiGatewayV2.Integration("example", new() + { + ApiId = aws_apigatewayv2_api.Example.Id, + CredentialsArn = aws_iam_role.Example.Arn, + Description = "Example with a load balancer", + IntegrationType = "HTTP_PROXY", + IntegrationUri = aws_lb_listener.Example.Arn, + IntegrationMethod = "ANY", + ConnectionType = "VPC_LINK", + ConnectionId = aws_apigatewayv2_vpc_link.Example.Id, + TlsConfig = new Aws.ApiGatewayV2.Inputs.IntegrationTlsConfigArgs + { + ServerNameToVerify = "example.com", + }, + RequestParameters = + { + { "append:header.authforintegration", "$context.authorizer.authorizerResponse" }, + { "overwrite:path", "staticValueForIntegration" }, + }, + ResponseParameters = new[] + { + new Aws.ApiGatewayV2.Inputs.IntegrationResponseParameterArgs + { + StatusCode = "403", + Mappings = + { + { "append:header.auth", "$context.authorizer.authorizerResponse" }, + }, + }, + new Aws.ApiGatewayV2.Inputs.IntegrationResponseParameterArgs + { + StatusCode = "200", + Mappings = + { + { "overwrite:statuscode", "204" }, + }, + }, + }, + }); + + }); + ``` + ```go + package main + + import ( + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + ) + + func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ + ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + CredentialsArn: pulumi.Any(aws_iam_role.Example.Arn), + Description: pulumi.String("Example with a load balancer"), + IntegrationType: pulumi.String("HTTP_PROXY"), + IntegrationUri: pulumi.Any(aws_lb_listener.Example.Arn), + IntegrationMethod: pulumi.String("ANY"), + ConnectionType: pulumi.String("VPC_LINK"), + ConnectionId: pulumi.Any(aws_apigatewayv2_vpc_link.Example.Id), + TlsConfig: &apigatewayv2.IntegrationTlsConfigArgs{ + ServerNameToVerify: pulumi.String("example.com"), + }, + RequestParameters: pulumi.StringMap{ + "append:header.authforintegration": pulumi.String("$context.authorizer.authorizerResponse"), + "overwrite:path": pulumi.String("staticValueForIntegration"), + }, + ResponseParameters: apigatewayv2.IntegrationResponseParameterArray{ + &apigatewayv2.IntegrationResponseParameterArgs{ + StatusCode: pulumi.String("403"), + Mappings: pulumi.StringMap{ + "append:header.auth": pulumi.String("$context.authorizer.authorizerResponse"), + }, + }, + &apigatewayv2.IntegrationResponseParameterArgs{ + StatusCode: pulumi.String("200"), + Mappings: pulumi.StringMap{ + "overwrite:statuscode": pulumi.String("204"), + }, + }, + }, + }) + if err != nil { + return err + } + return nil + }) + } + ``` + ```java + package generated_program; + + import com.pulumi.Context; + import com.pulumi.Pulumi; + import com.pulumi.core.Output; + import com.pulumi.aws.apigatewayv2.Integration; + import com.pulumi.aws.apigatewayv2.IntegrationArgs; + import com.pulumi.aws.apigatewayv2.inputs.IntegrationTlsConfigArgs; + import com.pulumi.aws.apigatewayv2.inputs.IntegrationResponseParameterArgs; + import java.util.List; + import java.util.ArrayList; + import java.util.Map; + import java.io.File; + import java.nio.file.Files; + import java.nio.file.Paths; + + public class App { + public static void main(String[] args) { + Pulumi.run(App::stack); + } + + public static void stack(Context ctx) { + var example = new Integration("example", IntegrationArgs.builder() + .apiId(aws_apigatewayv2_api.example().id()) + .credentialsArn(aws_iam_role.example().arn()) + .description("Example with a load balancer") + .integrationType("HTTP_PROXY") + .integrationUri(aws_lb_listener.example().arn()) + .integrationMethod("ANY") + .connectionType("VPC_LINK") + .connectionId(aws_apigatewayv2_vpc_link.example().id()) + .tlsConfig(IntegrationTlsConfigArgs.builder() + .serverNameToVerify("example.com") + .build()) + .requestParameters(Map.ofEntries( + Map.entry("append:header.authforintegration", "$context.authorizer.authorizerResponse"), + Map.entry("overwrite:path", "staticValueForIntegration") + )) + .responseParameters( + IntegrationResponseParameterArgs.builder() + .statusCode(403) + .mappings(Map.of("append:header.auth", "$context.authorizer.authorizerResponse")) + .build(), + IntegrationResponseParameterArgs.builder() + .statusCode(200) + .mappings(Map.of("overwrite:statuscode", "204")) + .build()) + .build()); + + } + } + ``` + ```yaml + resources: + example: + type: aws:apigatewayv2:Integration + properties: + apiId: ${aws_apigatewayv2_api.example.id} + credentialsArn: ${aws_iam_role.example.arn} + description: Example with a load balancer + integrationType: HTTP_PROXY + integrationUri: ${aws_lb_listener.example.arn} + integrationMethod: ANY + connectionType: VPC_LINK + connectionId: ${aws_apigatewayv2_vpc_link.example.id} + tlsConfig: + serverNameToVerify: example.com + requestParameters: + append:header.authforintegration: $context.authorizer.authorizerResponse + overwrite:path: staticValueForIntegration + responseParameters: + - statusCode: 403 + mappings: + append:header.auth: $context.authorizer.authorizerResponse + - statusCode: 200 + mappings: + overwrite:statuscode: '204' + ``` + {{% /example %}} + {{% /examples %}} + + ## Import + + Using `pulumi import`, import `aws_apigatewayv2_integration` using the API identifier and integration identifier. For example: + + ```sh + $ pulumi import aws:apigatewayv2/integration:Integration example aabbccddee/1122334 + ``` + -> __Note:__ The API Gateway managed integration created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. + + + :param pulumi.Input[str] connection_id: ID of the VPC link for a private integration. Supported only for HTTP APIs. Must be between 1 and 1024 characters in length. + :param pulumi.Input[str] connection_type: Type of the network connection to the integration endpoint. Valid values: `INTERNET`, `VPC_LINK`. Default is `INTERNET`. + :param pulumi.Input[str] credentials_arn: Credentials required for the integration, if any. + :param pulumi.Input[str] description: Description of the integration. + :param pulumi.Input[str] integration_method: Integration's HTTP method. Must be specified if `integration_type` is not `MOCK`. + :param pulumi.Input[str] integration_subtype: AWS service action to invoke. Supported only for HTTP APIs when `integration_type` is `AWS_PROXY`. See the [AWS service integration reference](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html) documentation for supported values. Must be between 1 and 128 characters in length. + :param pulumi.Input[str] integration_type: Integration type of an integration. + Valid values: `AWS` (supported only for WebSocket APIs), `AWS_PROXY`, `HTTP` (supported only for WebSocket APIs), `HTTP_PROXY`, `MOCK` (supported only for WebSocket APIs). For an HTTP API private integration, use `HTTP_PROXY`. + :param pulumi.Input[str] integration_uri: URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`. + For an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service. + Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + :param 'pulumi_aws.lambda_.Function' lambda_: A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + :param pulumi.Input[str] lambda_invoke_arn: The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + :param pulumi.Input[str] payload_format_version: The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. + :param pulumi.Input[Mapping[str, pulumi.Input[str]]] request_parameters: For WebSocket APIs, a key-value map specifying request parameters that are passed from the method request to the backend. + For HTTP APIs with a specified `integration_subtype`, a key-value map specifying parameters that are passed to `AWS_PROXY` integrations. + For HTTP APIs without a specified `integration_subtype`, a key-value map specifying how to transform HTTP requests before sending them to the backend. + See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html) for details. + :param pulumi.Input[Sequence[pulumi.Input['pulumi_aws.apigatewayv2.IntegrationResponseParameterArgs']]] response_parameters: Mappings to transform the HTTP response from a backend integration before returning the response to clients. Supported only for HTTP APIs. + :param pulumi.Input[int] timeout_milliseconds: Custom timeout between 50 and 29,000 milliseconds for WebSocket APIs and between 50 and 30,000 milliseconds for HTTP APIs. + The default timeout is 29 seconds for WebSocket APIs and 30 seconds for HTTP APIs. + this provider will only perform drift detection of its value when present in a configuration. + :param pulumi.Input['pulumi_aws.apigatewayv2.IntegrationTlsConfigArgs'] tls_config: TLS configuration for a private integration. Supported only for HTTP APIs. + """ + if connection_id is not None: + pulumi.set(__self__, "connection_id", connection_id) + if connection_type is not None: + pulumi.set(__self__, "connection_type", connection_type) + if credentials_arn is not None: + pulumi.set(__self__, "credentials_arn", credentials_arn) + if description is not None: + pulumi.set(__self__, "description", description) + if integration_method is not None: + pulumi.set(__self__, "integration_method", integration_method) + if integration_subtype is not None: + pulumi.set(__self__, "integration_subtype", integration_subtype) + if integration_type is not None: + pulumi.set(__self__, "integration_type", integration_type) + if integration_uri is not None: + pulumi.set(__self__, "integration_uri", integration_uri) + if lambda_ is not None: + pulumi.set(__self__, "lambda_", lambda_) + if lambda_invoke_arn is not None: + pulumi.set(__self__, "lambda_invoke_arn", lambda_invoke_arn) + if payload_format_version is not None: + pulumi.set(__self__, "payload_format_version", payload_format_version) + if request_parameters is not None: + pulumi.set(__self__, "request_parameters", request_parameters) + if response_parameters is not None: + pulumi.set(__self__, "response_parameters", response_parameters) + if timeout_milliseconds is not None: + pulumi.set(__self__, "timeout_milliseconds", timeout_milliseconds) + if tls_config is not None: + pulumi.set(__self__, "tls_config", tls_config) + + @property + @pulumi.getter(name="connectionId") + def connection_id(self) -> Optional[pulumi.Input[str]]: + """ + ID of the VPC link for a private integration. Supported only for HTTP APIs. Must be between 1 and 1024 characters in length. + """ + return pulumi.get(self, "connection_id") + + @connection_id.setter + def connection_id(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "connection_id", value) + + @property + @pulumi.getter(name="connectionType") + def connection_type(self) -> Optional[pulumi.Input[str]]: + """ + Type of the network connection to the integration endpoint. Valid values: `INTERNET`, `VPC_LINK`. Default is `INTERNET`. + """ + return pulumi.get(self, "connection_type") + + @connection_type.setter + def connection_type(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "connection_type", value) + + @property + @pulumi.getter(name="credentialsArn") + def credentials_arn(self) -> Optional[pulumi.Input[str]]: + """ + Credentials required for the integration, if any. + """ + return pulumi.get(self, "credentials_arn") + + @credentials_arn.setter + def credentials_arn(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "credentials_arn", value) + + @property + @pulumi.getter + def description(self) -> Optional[pulumi.Input[str]]: + """ + Description of the integration. + """ + return pulumi.get(self, "description") + + @description.setter + def description(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "description", value) + + @property + @pulumi.getter(name="integrationMethod") + def integration_method(self) -> Optional[pulumi.Input[str]]: + """ + Integration's HTTP method. Must be specified if `integration_type` is not `MOCK`. + """ + return pulumi.get(self, "integration_method") + + @integration_method.setter + def integration_method(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "integration_method", value) + + @property + @pulumi.getter(name="integrationSubtype") + def integration_subtype(self) -> Optional[pulumi.Input[str]]: + """ + AWS service action to invoke. Supported only for HTTP APIs when `integration_type` is `AWS_PROXY`. See the [AWS service integration reference](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html) documentation for supported values. Must be between 1 and 128 characters in length. + """ + return pulumi.get(self, "integration_subtype") + + @integration_subtype.setter + def integration_subtype(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "integration_subtype", value) + + @property + @pulumi.getter(name="integrationType") + def integration_type(self) -> Optional[pulumi.Input[str]]: + """ + Integration type of an integration. + Valid values: `AWS` (supported only for WebSocket APIs), `AWS_PROXY`, `HTTP` (supported only for WebSocket APIs), `HTTP_PROXY`, `MOCK` (supported only for WebSocket APIs). For an HTTP API private integration, use `HTTP_PROXY`. + """ + return pulumi.get(self, "integration_type") + + @integration_type.setter + def integration_type(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "integration_type", value) + + @property + @pulumi.getter(name="integrationUri") + def integration_uri(self) -> Optional[pulumi.Input[str]]: + """ + URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`. + For an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service. + Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + """ + return pulumi.get(self, "integration_uri") + + @integration_uri.setter + def integration_uri(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "integration_uri", value) + + @property + @pulumi.getter(name="lambda") + def lambda_(self) -> Optional['pulumi_aws.lambda_.Function']: + """ + A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + """ + return pulumi.get(self, "lambda_") + + @lambda_.setter + def lambda_(self, value: Optional['pulumi_aws.lambda_.Function']): + pulumi.set(self, "lambda_", value) + + @property + @pulumi.getter(name="lambdaInvokeArn") + def lambda_invoke_arn(self) -> Optional[pulumi.Input[str]]: + """ + The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + """ + return pulumi.get(self, "lambda_invoke_arn") + + @lambda_invoke_arn.setter + def lambda_invoke_arn(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "lambda_invoke_arn", value) + + @property + @pulumi.getter(name="payloadFormatVersion") + def payload_format_version(self) -> Optional[pulumi.Input[str]]: + """ + The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. + """ + return pulumi.get(self, "payload_format_version") + + @payload_format_version.setter + def payload_format_version(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "payload_format_version", value) + + @property + @pulumi.getter(name="requestParameters") + def request_parameters(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]: + """ + For WebSocket APIs, a key-value map specifying request parameters that are passed from the method request to the backend. + For HTTP APIs with a specified `integration_subtype`, a key-value map specifying parameters that are passed to `AWS_PROXY` integrations. + For HTTP APIs without a specified `integration_subtype`, a key-value map specifying how to transform HTTP requests before sending them to the backend. + See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html) for details. + """ + return pulumi.get(self, "request_parameters") + + @request_parameters.setter + def request_parameters(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]): + pulumi.set(self, "request_parameters", value) + + @property + @pulumi.getter(name="responseParameters") + def response_parameters(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['pulumi_aws.apigatewayv2.IntegrationResponseParameterArgs']]]]: + """ + Mappings to transform the HTTP response from a backend integration before returning the response to clients. Supported only for HTTP APIs. + """ + return pulumi.get(self, "response_parameters") + + @response_parameters.setter + def response_parameters(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['pulumi_aws.apigatewayv2.IntegrationResponseParameterArgs']]]]): + pulumi.set(self, "response_parameters", value) + + @property + @pulumi.getter(name="timeoutMilliseconds") + def timeout_milliseconds(self) -> Optional[pulumi.Input[int]]: + """ + Custom timeout between 50 and 29,000 milliseconds for WebSocket APIs and between 50 and 30,000 milliseconds for HTTP APIs. + The default timeout is 29 seconds for WebSocket APIs and 30 seconds for HTTP APIs. + this provider will only perform drift detection of its value when present in a configuration. + """ + return pulumi.get(self, "timeout_milliseconds") + + @timeout_milliseconds.setter + def timeout_milliseconds(self, value: Optional[pulumi.Input[int]]): + pulumi.set(self, "timeout_milliseconds", value) + + @property + @pulumi.getter(name="tlsConfig") + def tls_config(self) -> Optional[pulumi.Input['pulumi_aws.apigatewayv2.IntegrationTlsConfigArgs']]: + """ + TLS configuration for a private integration. Supported only for HTTP APIs. + """ + return pulumi.get(self, "tls_config") + + @tls_config.setter + def tls_config(self, value: Optional[pulumi.Input['pulumi_aws.apigatewayv2.IntegrationTlsConfigArgs']]): + pulumi.set(self, "tls_config", value) + + +@pulumi.input_type +class HttpRouteArgs: + def __init__(__self__, *, + api_key_required: Optional[pulumi.Input[bool]] = None, + authorization_scopes: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + authorization_type: Optional[pulumi.Input[str]] = None, + authorizer: Optional[pulumi.Input[str]] = None, + authorizer_id: Optional[pulumi.Input[str]] = None, + integration: Optional[pulumi.Input[str]] = None, + operation_name: Optional[pulumi.Input[str]] = None, + target: Optional[pulumi.Input[str]] = None): + """ + Manages an Amazon API Gateway Version 2 route. + More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html) for [WebSocket](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-develop-routes.html) and [HTTP](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-routes.html) APIs. + + {{% examples %}} + ## Example Usage + {{% example %}} + ### Basic + + ```typescript + import * as pulumi from "@pulumi/pulumi"; + import * as aws from "@pulumi/aws"; + + const exampleApi = new aws.apigatewayv2.Api("exampleApi", { + protocolType: "WEBSOCKET", + routeSelectionExpression: "$request.body.action", + }); + const exampleRoute = new aws.apigatewayv2.Route("exampleRoute", { + apiId: exampleApi.id, + routeKey: "$default", + }); + ``` + ```python + import pulumi + import pulumi_aws as aws + + example_api = aws.apigatewayv2.Api("exampleApi", + protocol_type="WEBSOCKET", + route_selection_expression="$request.body.action") + example_route = aws.apigatewayv2.Route("exampleRoute", + api_id=example_api.id, + route_key="$default") + ``` + ```csharp + using System.Collections.Generic; + using System.Linq; + using Pulumi; + using Aws = Pulumi.Aws; + + return await Deployment.RunAsync(() => + { + var exampleApi = new Aws.ApiGatewayV2.Api("exampleApi", new() + { + ProtocolType = "WEBSOCKET", + RouteSelectionExpression = "$request.body.action", + }); + + var exampleRoute = new Aws.ApiGatewayV2.Route("exampleRoute", new() + { + ApiId = exampleApi.Id, + RouteKey = "$default", + }); + + }); + ``` + ```go + package main + + import ( + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + ) + + func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + exampleApi, err := apigatewayv2.NewApi(ctx, "exampleApi", &apigatewayv2.ApiArgs{ + ProtocolType: pulumi.String("WEBSOCKET"), + RouteSelectionExpression: pulumi.String("$request.body.action"), + }) + if err != nil { + return err + } + _, err = apigatewayv2.NewRoute(ctx, "exampleRoute", &apigatewayv2.RouteArgs{ + ApiId: exampleApi.ID(), + RouteKey: pulumi.String("$default"), + }) + if err != nil { + return err + } + return nil + }) + } + ``` + ```java + package generated_program; + + import com.pulumi.Context; + import com.pulumi.Pulumi; + import com.pulumi.core.Output; + import com.pulumi.aws.apigatewayv2.Api; + import com.pulumi.aws.apigatewayv2.ApiArgs; + import com.pulumi.aws.apigatewayv2.Route; + import com.pulumi.aws.apigatewayv2.RouteArgs; + import java.util.List; + import java.util.ArrayList; + import java.util.Map; + import java.io.File; + import java.nio.file.Files; + import java.nio.file.Paths; + + public class App { + public static void main(String[] args) { + Pulumi.run(App::stack); + } + + public static void stack(Context ctx) { + var exampleApi = new Api("exampleApi", ApiArgs.builder() + .protocolType("WEBSOCKET") + .routeSelectionExpression("$request.body.action") + .build()); + + var exampleRoute = new Route("exampleRoute", RouteArgs.builder() + .apiId(exampleApi.id()) + .routeKey("$default") + .build()); + + } + } + ``` + ```yaml + resources: + exampleApi: + type: aws:apigatewayv2:Api + properties: + protocolType: WEBSOCKET + routeSelectionExpression: $request.body.action + exampleRoute: + type: aws:apigatewayv2:Route + properties: + apiId: ${exampleApi.id} + routeKey: $default + ``` + {{% /example %}} + {{% example %}} + ### HTTP Proxy Integration + + ```typescript + import * as pulumi from "@pulumi/pulumi"; + import * as aws from "@pulumi/aws"; + + const exampleApi = new aws.apigatewayv2.Api("exampleApi", {protocolType: "HTTP"}); + const exampleIntegration = new aws.apigatewayv2.Integration("exampleIntegration", { + apiId: exampleApi.id, + integrationType: "HTTP_PROXY", + integrationMethod: "ANY", + integrationUri: "https://example.com/{proxy}", + }); + const exampleRoute = new aws.apigatewayv2.Route("exampleRoute", { + apiId: exampleApi.id, + routeKey: "ANY /example/{proxy+}", + target: pulumi.interpolate`integrations/${exampleIntegration.id}`, + }); + ``` + ```python + import pulumi + import pulumi_aws as aws + + example_api = aws.apigatewayv2.Api("exampleApi", protocol_type="HTTP") + example_integration = aws.apigatewayv2.Integration("exampleIntegration", + api_id=example_api.id, + integration_type="HTTP_PROXY", + integration_method="ANY", + integration_uri="https://example.com/{proxy}") + example_route = aws.apigatewayv2.Route("exampleRoute", + api_id=example_api.id, + route_key="ANY /example/{proxy+}", + target=example_integration.id.apply(lambda id: f"integrations/{id}")) + ``` + ```csharp + using System.Collections.Generic; + using System.Linq; + using Pulumi; + using Aws = Pulumi.Aws; + + return await Deployment.RunAsync(() => + { + var exampleApi = new Aws.ApiGatewayV2.Api("exampleApi", new() + { + ProtocolType = "HTTP", + }); + + var exampleIntegration = new Aws.ApiGatewayV2.Integration("exampleIntegration", new() + { + ApiId = exampleApi.Id, + IntegrationType = "HTTP_PROXY", + IntegrationMethod = "ANY", + IntegrationUri = "https://example.com/{proxy}", + }); + + var exampleRoute = new Aws.ApiGatewayV2.Route("exampleRoute", new() + { + ApiId = exampleApi.Id, + RouteKey = "ANY /example/{proxy+}", + Target = exampleIntegration.Id.Apply(id => $"integrations/{id}"), + }); + + }); + ``` + ```go + package main + + import ( + "fmt" + + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + ) + + func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + exampleApi, err := apigatewayv2.NewApi(ctx, "exampleApi", &apigatewayv2.ApiArgs{ + ProtocolType: pulumi.String("HTTP"), + }) + if err != nil { + return err + } + exampleIntegration, err := apigatewayv2.NewIntegration(ctx, "exampleIntegration", &apigatewayv2.IntegrationArgs{ + ApiId: exampleApi.ID(), + IntegrationType: pulumi.String("HTTP_PROXY"), + IntegrationMethod: pulumi.String("ANY"), + IntegrationUri: pulumi.String("https://example.com/{proxy}"), + }) + if err != nil { + return err + } + _, err = apigatewayv2.NewRoute(ctx, "exampleRoute", &apigatewayv2.RouteArgs{ + ApiId: exampleApi.ID(), + RouteKey: pulumi.String("ANY /example/{proxy+}"), + Target: exampleIntegration.ID().ApplyT(func(id string) (string, error) { + return fmt.Sprintf("integrations/%v", id), nil + }).(pulumi.StringOutput), + }) + if err != nil { + return err + } + return nil + }) + } + ``` + ```java + package generated_program; + + import com.pulumi.Context; + import com.pulumi.Pulumi; + import com.pulumi.core.Output; + import com.pulumi.aws.apigatewayv2.Api; + import com.pulumi.aws.apigatewayv2.ApiArgs; + import com.pulumi.aws.apigatewayv2.Integration; + import com.pulumi.aws.apigatewayv2.IntegrationArgs; + import com.pulumi.aws.apigatewayv2.Route; + import com.pulumi.aws.apigatewayv2.RouteArgs; + import java.util.List; + import java.util.ArrayList; + import java.util.Map; + import java.io.File; + import java.nio.file.Files; + import java.nio.file.Paths; - @domain_configuration.setter - def domain_configuration(self, value: Optional[pulumi.Input['DomainConfigurationArgs']]): - pulumi.set(self, "domain_configuration", value) + public class App { + public static void main(String[] args) { + Pulumi.run(App::stack); + } - @property - @pulumi.getter(name="domainId") - def domain_id(self) -> Optional[pulumi.Input[str]]: - """ - Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. - """ - return pulumi.get(self, "domain_id") + public static void stack(Context ctx) { + var exampleApi = new Api("exampleApi", ApiArgs.builder() + .protocolType("HTTP") + .build()); - @domain_id.setter - def domain_id(self, value: Optional[pulumi.Input[str]]): - pulumi.set(self, "domain_id", value) + var exampleIntegration = new Integration("exampleIntegration", IntegrationArgs.builder() + .apiId(exampleApi.id()) + .integrationType("HTTP_PROXY") + .integrationMethod("ANY") + .integrationUri("https://example.com/{proxy}") + .build()); + var exampleRoute = new Route("exampleRoute", RouteArgs.builder() + .apiId(exampleApi.id()) + .routeKey("ANY /example/{proxy+}") + .target(exampleIntegration.id().applyValue(id -> String.format("integrations/%s", id))) + .build()); -@pulumi.input_type -class HttpAuthorizerArgs: - def __init__(__self__): - pass + } + } + ``` + ```yaml + resources: + exampleApi: + type: aws:apigatewayv2:Api + properties: + protocolType: HTTP + exampleIntegration: + type: aws:apigatewayv2:Integration + properties: + apiId: ${exampleApi.id} + integrationType: HTTP_PROXY + integrationMethod: ANY + integrationUri: https://example.com/{proxy} + exampleRoute: + type: aws:apigatewayv2:Route + properties: + apiId: ${exampleApi.id} + routeKey: ANY /example/{proxy+} + target: integrations/${exampleIntegration.id} + ``` + {{% /example %}} + {{% /examples %}} + + ## Import + Using `pulumi import`, import `aws_apigatewayv2_route` using the API identifier and route identifier. For example: -@pulumi.input_type -class HttpIntegrationArgs: - def __init__(__self__): - pass + ```sh + $ pulumi import aws:apigatewayv2/route:Route example aabbccddee/1122334 + ``` + -> __Note:__ The API Gateway managed route created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. -@pulumi.input_type -class HttpRouteArgs: - def __init__(__self__, *, - authorizer: Optional[pulumi.Input[str]] = None, - integration: Optional[pulumi.Input[str]] = None): - """ + :param pulumi.Input[bool] api_key_required: Boolean whether an API key is required for the route. Defaults to `false`. Supported only for WebSocket APIs. + :param pulumi.Input[Sequence[pulumi.Input[str]]] authorization_scopes: Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation. + :param pulumi.Input[str] authorization_type: Authorization type for the route. + For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + Defaults to `NONE`. :param pulumi.Input[str] authorizer: The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + :param pulumi.Input[str] authorizer_id: Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. :param pulumi.Input[str] integration: The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + :param pulumi.Input[str] operation_name: Operation name for the route. Must be between 1 and 64 characters in length. + :param pulumi.Input[str] target: Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. """ + if api_key_required is not None: + pulumi.set(__self__, "api_key_required", api_key_required) + if authorization_scopes is not None: + pulumi.set(__self__, "authorization_scopes", authorization_scopes) + if authorization_type is not None: + pulumi.set(__self__, "authorization_type", authorization_type) if authorizer is not None: pulumi.set(__self__, "authorizer", authorizer) + if authorizer_id is not None: + pulumi.set(__self__, "authorizer_id", authorizer_id) if integration is not None: pulumi.set(__self__, "integration", integration) + if operation_name is not None: + pulumi.set(__self__, "operation_name", operation_name) + if target is not None: + pulumi.set(__self__, "target", target) + + @property + @pulumi.getter(name="apiKeyRequired") + def api_key_required(self) -> Optional[pulumi.Input[bool]]: + """ + Boolean whether an API key is required for the route. Defaults to `false`. Supported only for WebSocket APIs. + """ + return pulumi.get(self, "api_key_required") + + @api_key_required.setter + def api_key_required(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "api_key_required", value) + + @property + @pulumi.getter(name="authorizationScopes") + def authorization_scopes(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]: + """ + Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation. + """ + return pulumi.get(self, "authorization_scopes") + + @authorization_scopes.setter + def authorization_scopes(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]): + pulumi.set(self, "authorization_scopes", value) + + @property + @pulumi.getter(name="authorizationType") + def authorization_type(self) -> Optional[pulumi.Input[str]]: + """ + Authorization type for the route. + For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + Defaults to `NONE`. + """ + return pulumi.get(self, "authorization_type") + + @authorization_type.setter + def authorization_type(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "authorization_type", value) @property @pulumi.getter @@ -488,6 +2368,18 @@ def authorizer(self) -> Optional[pulumi.Input[str]]: def authorizer(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "authorizer", value) + @property + @pulumi.getter(name="authorizerId") + def authorizer_id(self) -> Optional[pulumi.Input[str]]: + """ + Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. + """ + return pulumi.get(self, "authorizer_id") + + @authorizer_id.setter + def authorizer_id(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "authorizer_id", value) + @property @pulumi.getter def integration(self) -> Optional[pulumi.Input[str]]: @@ -500,10 +2392,306 @@ def integration(self) -> Optional[pulumi.Input[str]]: def integration(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "integration", value) + @property + @pulumi.getter(name="operationName") + def operation_name(self) -> Optional[pulumi.Input[str]]: + """ + Operation name for the route. Must be between 1 and 64 characters in length. + """ + return pulumi.get(self, "operation_name") + + @operation_name.setter + def operation_name(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "operation_name", value) + + @property + @pulumi.getter + def target(self) -> Optional[pulumi.Input[str]]: + """ + Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + """ + return pulumi.get(self, "target") + + @target.setter + def target(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "target", value) + @pulumi.input_type class HttpStageArgs: - def __init__(__self__): - pass + def __init__(__self__, *, + access_log_settings: Optional[pulumi.Input['pulumi_aws.apigatewayv2.StageAccessLogSettingsArgs']] = None, + auto_deploy: Optional[pulumi.Input[bool]] = None, + client_certificate_id: Optional[pulumi.Input[str]] = None, + default_route_settings: Optional[pulumi.Input['pulumi_aws.apigatewayv2.StageDefaultRouteSettingsArgs']] = None, + deployment_id: Optional[pulumi.Input[str]] = None, + description: Optional[pulumi.Input[str]] = None, + name: Optional[pulumi.Input[str]] = None, + route_settings: Optional[pulumi.Input[Sequence[pulumi.Input['pulumi_aws.apigatewayv2.StageRouteSettingArgs']]]] = None, + stage_variables: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, + tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None): + """ + Manages an Amazon API Gateway Version 2 stage. + More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). + + {{% examples %}} + ## Example Usage + {{% example %}} + ### Basic + + ```typescript + import * as pulumi from "@pulumi/pulumi"; + import * as aws from "@pulumi/aws"; + + const example = new aws.apigatewayv2.Stage("example", {apiId: aws_apigatewayv2_api.example.id}); + ``` + ```python + import pulumi + import pulumi_aws as aws + + example = aws.apigatewayv2.Stage("example", api_id=aws_apigatewayv2_api["example"]["id"]) + ``` + ```csharp + using System.Collections.Generic; + using System.Linq; + using Pulumi; + using Aws = Pulumi.Aws; + + return await Deployment.RunAsync(() => + { + var example = new Aws.ApiGatewayV2.Stage("example", new() + { + ApiId = aws_apigatewayv2_api.Example.Id, + }); + + }); + ``` + ```go + package main + + import ( + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + ) + + func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + _, err := apigatewayv2.NewStage(ctx, "example", &apigatewayv2.StageArgs{ + ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + }) + if err != nil { + return err + } + return nil + }) + } + ``` + ```java + package generated_program; + + import com.pulumi.Context; + import com.pulumi.Pulumi; + import com.pulumi.core.Output; + import com.pulumi.aws.apigatewayv2.Stage; + import com.pulumi.aws.apigatewayv2.StageArgs; + import java.util.List; + import java.util.ArrayList; + import java.util.Map; + import java.io.File; + import java.nio.file.Files; + import java.nio.file.Paths; + + public class App { + public static void main(String[] args) { + Pulumi.run(App::stack); + } + + public static void stack(Context ctx) { + var example = new Stage("example", StageArgs.builder() + .apiId(aws_apigatewayv2_api.example().id()) + .build()); + + } + } + ``` + ```yaml + resources: + example: + type: aws:apigatewayv2:Stage + properties: + apiId: ${aws_apigatewayv2_api.example.id} + ``` + {{% /example %}} + {{% /examples %}} + + ## Import + + Using `pulumi import`, import `aws_apigatewayv2_stage` using the API identifier and stage name. For example: + + ```sh + $ pulumi import aws:apigatewayv2/stage:Stage example aabbccddee/example-stage + ``` + -> __Note:__ The API Gateway managed stage created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. + + + :param pulumi.Input['pulumi_aws.apigatewayv2.StageAccessLogSettingsArgs'] access_log_settings: Settings for logging access in this stage. + Use the `aws.apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions). + :param pulumi.Input[bool] auto_deploy: Whether updates to an API automatically trigger a new deployment. Defaults to `false`. Applicable for HTTP APIs. + :param pulumi.Input[str] client_certificate_id: Identifier of a client certificate for the stage. Use the `aws.apigateway.ClientCertificate` resource to configure a client certificate. + Supported only for WebSocket APIs. + :param pulumi.Input['pulumi_aws.apigatewayv2.StageDefaultRouteSettingsArgs'] default_route_settings: Default route settings for the stage. + :param pulumi.Input[str] deployment_id: Deployment identifier of the stage. Use the `aws.apigatewayv2.Deployment` resource to configure a deployment. + :param pulumi.Input[str] description: Description for the stage. Must be less than or equal to 1024 characters in length. + :param pulumi.Input[str] name: Name of the stage. Must be between 1 and 128 characters in length. + + The following arguments are optional: + :param pulumi.Input[Sequence[pulumi.Input['pulumi_aws.apigatewayv2.StageRouteSettingArgs']]] route_settings: Route settings for the stage. + :param pulumi.Input[Mapping[str, pulumi.Input[str]]] stage_variables: Map that defines the stage variables for the stage. + :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Map of tags to assign to the stage. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + """ + if access_log_settings is not None: + pulumi.set(__self__, "access_log_settings", access_log_settings) + if auto_deploy is not None: + pulumi.set(__self__, "auto_deploy", auto_deploy) + if client_certificate_id is not None: + pulumi.set(__self__, "client_certificate_id", client_certificate_id) + if default_route_settings is not None: + pulumi.set(__self__, "default_route_settings", default_route_settings) + if deployment_id is not None: + pulumi.set(__self__, "deployment_id", deployment_id) + if description is not None: + pulumi.set(__self__, "description", description) + if name is not None: + pulumi.set(__self__, "name", name) + if route_settings is not None: + pulumi.set(__self__, "route_settings", route_settings) + if stage_variables is not None: + pulumi.set(__self__, "stage_variables", stage_variables) + if tags is not None: + pulumi.set(__self__, "tags", tags) + + @property + @pulumi.getter(name="accessLogSettings") + def access_log_settings(self) -> Optional[pulumi.Input['pulumi_aws.apigatewayv2.StageAccessLogSettingsArgs']]: + """ + Settings for logging access in this stage. + Use the `aws.apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions). + """ + return pulumi.get(self, "access_log_settings") + + @access_log_settings.setter + def access_log_settings(self, value: Optional[pulumi.Input['pulumi_aws.apigatewayv2.StageAccessLogSettingsArgs']]): + pulumi.set(self, "access_log_settings", value) + + @property + @pulumi.getter(name="autoDeploy") + def auto_deploy(self) -> Optional[pulumi.Input[bool]]: + """ + Whether updates to an API automatically trigger a new deployment. Defaults to `false`. Applicable for HTTP APIs. + """ + return pulumi.get(self, "auto_deploy") + + @auto_deploy.setter + def auto_deploy(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "auto_deploy", value) + + @property + @pulumi.getter(name="clientCertificateId") + def client_certificate_id(self) -> Optional[pulumi.Input[str]]: + """ + Identifier of a client certificate for the stage. Use the `aws.apigateway.ClientCertificate` resource to configure a client certificate. + Supported only for WebSocket APIs. + """ + return pulumi.get(self, "client_certificate_id") + + @client_certificate_id.setter + def client_certificate_id(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "client_certificate_id", value) + + @property + @pulumi.getter(name="defaultRouteSettings") + def default_route_settings(self) -> Optional[pulumi.Input['pulumi_aws.apigatewayv2.StageDefaultRouteSettingsArgs']]: + """ + Default route settings for the stage. + """ + return pulumi.get(self, "default_route_settings") + + @default_route_settings.setter + def default_route_settings(self, value: Optional[pulumi.Input['pulumi_aws.apigatewayv2.StageDefaultRouteSettingsArgs']]): + pulumi.set(self, "default_route_settings", value) + + @property + @pulumi.getter(name="deploymentId") + def deployment_id(self) -> Optional[pulumi.Input[str]]: + """ + Deployment identifier of the stage. Use the `aws.apigatewayv2.Deployment` resource to configure a deployment. + """ + return pulumi.get(self, "deployment_id") + + @deployment_id.setter + def deployment_id(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "deployment_id", value) + + @property + @pulumi.getter + def description(self) -> Optional[pulumi.Input[str]]: + """ + Description for the stage. Must be less than or equal to 1024 characters in length. + """ + return pulumi.get(self, "description") + + @description.setter + def description(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "description", value) + + @property + @pulumi.getter + def name(self) -> Optional[pulumi.Input[str]]: + """ + Name of the stage. Must be between 1 and 128 characters in length. + + The following arguments are optional: + """ + return pulumi.get(self, "name") + + @name.setter + def name(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "name", value) + + @property + @pulumi.getter(name="routeSettings") + def route_settings(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['pulumi_aws.apigatewayv2.StageRouteSettingArgs']]]]: + """ + Route settings for the stage. + """ + return pulumi.get(self, "route_settings") + + @route_settings.setter + def route_settings(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['pulumi_aws.apigatewayv2.StageRouteSettingArgs']]]]): + pulumi.set(self, "route_settings", value) + + @property + @pulumi.getter(name="stageVariables") + def stage_variables(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]: + """ + Map that defines the stage variables for the stage. + """ + return pulumi.get(self, "stage_variables") + + @stage_variables.setter + def stage_variables(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]): + pulumi.set(self, "stage_variables", value) + + @property + @pulumi.getter + def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]: + """ + Map of tags to assign to the stage. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + """ + return pulumi.get(self, "tags") + + @tags.setter + def tags(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]): + pulumi.set(self, "tags", value) diff --git a/sdk/python/pulumi_awsx/apigatewayv2/http_api.py b/sdk/python/pulumi_awsx/apigatewayv2/http_api.py index c970cd06d..97c45e18a 100644 --- a/sdk/python/pulumi_awsx/apigatewayv2/http_api.py +++ b/sdk/python/pulumi_awsx/apigatewayv2/http_api.py @@ -16,41 +16,41 @@ @pulumi.input_type class HttpApiArgs: def __init__(__self__, *, - routes: pulumi.Input[Mapping[str, pulumi.Input['HttpRouteArgs']]], + routes: Mapping[str, 'HttpRouteArgs'], api_key_selection_expression: Optional[pulumi.Input[str]] = None, - authorizers: Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpAuthorizerArgs']]]] = None, + authorizers: Optional[Mapping[str, 'HttpAuthorizerArgs']] = None, body: Optional[pulumi.Input[str]] = None, cors_configuration: Optional[pulumi.Input['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs']] = None, description: Optional[pulumi.Input[str]] = None, disable_execute_api_endpoint: Optional[pulumi.Input[bool]] = None, - domain_mappings: Optional[pulumi.Input[Mapping[str, pulumi.Input['DomainMappingArgs']]]] = None, + domain_mappings: Optional[Mapping[str, 'DomainMappingArgs']] = None, fail_on_warnings: Optional[pulumi.Input[bool]] = None, - integrations: Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpIntegrationArgs']]]] = None, + integrations: Optional[Mapping[str, 'HttpIntegrationArgs']] = None, name: Optional[pulumi.Input[str]] = None, route_selection_expression: Optional[pulumi.Input[str]] = None, - stages: Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpStageArgs']]]] = None, + stages: Optional[Mapping[str, 'HttpStageArgs']] = None, tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, version: Optional[pulumi.Input[str]] = None): """ The set of arguments for constructing a HttpApi resource. - :param pulumi.Input[Mapping[str, pulumi.Input['HttpRouteArgs']]] routes: The routes for the HTTP API. + :param Mapping[str, 'HttpRouteArgs'] routes: The routes for the HTTP API. :param pulumi.Input[str] api_key_selection_expression: An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. Applicable for WebSocket APIs. - :param pulumi.Input[Mapping[str, pulumi.Input['HttpAuthorizerArgs']]] authorizers: The authorizers for the HTTP API routes. + :param Mapping[str, 'HttpAuthorizerArgs'] authorizers: The authorizers for the HTTP API routes. :param pulumi.Input[str] body: An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. :param pulumi.Input['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs'] cors_configuration: Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. :param pulumi.Input[str] description: Description of the API. Must be less than or equal to 1024 characters in length. :param pulumi.Input[bool] disable_execute_api_endpoint: Whether clients can invoke the API by using the default `execute-api` endpoint. By default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`. To require that clients use a custom domain name to invoke the API, disable the default endpoint. - :param pulumi.Input[Mapping[str, pulumi.Input['DomainMappingArgs']]] domain_mappings: The domain names for the HTTP API. + :param Mapping[str, 'DomainMappingArgs'] domain_mappings: The domain names for the HTTP API. :param pulumi.Input[bool] fail_on_warnings: Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. - :param pulumi.Input[Mapping[str, pulumi.Input['HttpIntegrationArgs']]] integrations: The integrations for the HTTP API routes. + :param Mapping[str, 'HttpIntegrationArgs'] integrations: The integrations for the HTTP API routes. :param pulumi.Input[str] name: Name of the API. Must be less than or equal to 128 characters in length. :param pulumi.Input[str] route_selection_expression: The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. Defaults to `$request.method $request.path`. - :param pulumi.Input[Mapping[str, pulumi.Input['HttpStageArgs']]] stages: The deployment stages for the HTTP API. + :param Mapping[str, 'HttpStageArgs'] stages: The deployment stages for the HTTP API. :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. :param pulumi.Input[str] version: Version identifier for the API. Must be between 1 and 64 characters in length. """ @@ -86,14 +86,14 @@ def __init__(__self__, *, @property @pulumi.getter - def routes(self) -> pulumi.Input[Mapping[str, pulumi.Input['HttpRouteArgs']]]: + def routes(self) -> Mapping[str, 'HttpRouteArgs']: """ The routes for the HTTP API. """ return pulumi.get(self, "routes") @routes.setter - def routes(self, value: pulumi.Input[Mapping[str, pulumi.Input['HttpRouteArgs']]]): + def routes(self, value: Mapping[str, 'HttpRouteArgs']): pulumi.set(self, "routes", value) @property @@ -112,14 +112,14 @@ def api_key_selection_expression(self, value: Optional[pulumi.Input[str]]): @property @pulumi.getter - def authorizers(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpAuthorizerArgs']]]]: + def authorizers(self) -> Optional[Mapping[str, 'HttpAuthorizerArgs']]: """ The authorizers for the HTTP API routes. """ return pulumi.get(self, "authorizers") @authorizers.setter - def authorizers(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpAuthorizerArgs']]]]): + def authorizers(self, value: Optional[Mapping[str, 'HttpAuthorizerArgs']]): pulumi.set(self, "authorizers", value) @property @@ -174,14 +174,14 @@ def disable_execute_api_endpoint(self, value: Optional[pulumi.Input[bool]]): @property @pulumi.getter(name="domainMappings") - def domain_mappings(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input['DomainMappingArgs']]]]: + def domain_mappings(self) -> Optional[Mapping[str, 'DomainMappingArgs']]: """ The domain names for the HTTP API. """ return pulumi.get(self, "domain_mappings") @domain_mappings.setter - def domain_mappings(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input['DomainMappingArgs']]]]): + def domain_mappings(self, value: Optional[Mapping[str, 'DomainMappingArgs']]): pulumi.set(self, "domain_mappings", value) @property @@ -198,14 +198,14 @@ def fail_on_warnings(self, value: Optional[pulumi.Input[bool]]): @property @pulumi.getter - def integrations(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpIntegrationArgs']]]]: + def integrations(self) -> Optional[Mapping[str, 'HttpIntegrationArgs']]: """ The integrations for the HTTP API routes. """ return pulumi.get(self, "integrations") @integrations.setter - def integrations(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpIntegrationArgs']]]]): + def integrations(self, value: Optional[Mapping[str, 'HttpIntegrationArgs']]): pulumi.set(self, "integrations", value) @property @@ -235,14 +235,14 @@ def route_selection_expression(self, value: Optional[pulumi.Input[str]]): @property @pulumi.getter - def stages(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpStageArgs']]]]: + def stages(self) -> Optional[Mapping[str, 'HttpStageArgs']]: """ The deployment stages for the HTTP API. """ return pulumi.get(self, "stages") @stages.setter - def stages(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input['HttpStageArgs']]]]): + def stages(self, value: Optional[Mapping[str, 'HttpStageArgs']]): pulumi.set(self, "stages", value) @property @@ -276,18 +276,18 @@ def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, api_key_selection_expression: Optional[pulumi.Input[str]] = None, - authorizers: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpAuthorizerArgs']]]]] = None, + authorizers: Optional[Mapping[str, pulumi.InputType['HttpAuthorizerArgs']]] = None, body: Optional[pulumi.Input[str]] = None, cors_configuration: Optional[pulumi.Input[pulumi.InputType['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs']]] = None, description: Optional[pulumi.Input[str]] = None, disable_execute_api_endpoint: Optional[pulumi.Input[bool]] = None, - domain_mappings: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['DomainMappingArgs']]]]] = None, + domain_mappings: Optional[Mapping[str, pulumi.InputType['DomainMappingArgs']]] = None, fail_on_warnings: Optional[pulumi.Input[bool]] = None, - integrations: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpIntegrationArgs']]]]] = None, + integrations: Optional[Mapping[str, pulumi.InputType['HttpIntegrationArgs']]] = None, name: Optional[pulumi.Input[str]] = None, route_selection_expression: Optional[pulumi.Input[str]] = None, - routes: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpRouteArgs']]]]] = None, - stages: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpStageArgs']]]]] = None, + routes: Optional[Mapping[str, pulumi.InputType['HttpRouteArgs']]] = None, + stages: Optional[Mapping[str, pulumi.InputType['HttpStageArgs']]] = None, tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, version: Optional[pulumi.Input[str]] = None, __props__=None): @@ -299,21 +299,21 @@ def __init__(__self__, :param pulumi.Input[str] api_key_selection_expression: An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. Applicable for WebSocket APIs. - :param pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpAuthorizerArgs']]]] authorizers: The authorizers for the HTTP API routes. + :param Mapping[str, pulumi.InputType['HttpAuthorizerArgs']] authorizers: The authorizers for the HTTP API routes. :param pulumi.Input[str] body: An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. :param pulumi.Input[pulumi.InputType['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs']] cors_configuration: Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. :param pulumi.Input[str] description: Description of the API. Must be less than or equal to 1024 characters in length. :param pulumi.Input[bool] disable_execute_api_endpoint: Whether clients can invoke the API by using the default `execute-api` endpoint. By default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`. To require that clients use a custom domain name to invoke the API, disable the default endpoint. - :param pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['DomainMappingArgs']]]] domain_mappings: The domain names for the HTTP API. + :param Mapping[str, pulumi.InputType['DomainMappingArgs']] domain_mappings: The domain names for the HTTP API. :param pulumi.Input[bool] fail_on_warnings: Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. - :param pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpIntegrationArgs']]]] integrations: The integrations for the HTTP API routes. + :param Mapping[str, pulumi.InputType['HttpIntegrationArgs']] integrations: The integrations for the HTTP API routes. :param pulumi.Input[str] name: Name of the API. Must be less than or equal to 128 characters in length. :param pulumi.Input[str] route_selection_expression: The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. Defaults to `$request.method $request.path`. - :param pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpRouteArgs']]]] routes: The routes for the HTTP API. - :param pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpStageArgs']]]] stages: The deployment stages for the HTTP API. + :param Mapping[str, pulumi.InputType['HttpRouteArgs']] routes: The routes for the HTTP API. + :param Mapping[str, pulumi.InputType['HttpStageArgs']] stages: The deployment stages for the HTTP API. :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. :param pulumi.Input[str] version: Version identifier for the API. Must be between 1 and 64 characters in length. """ @@ -342,18 +342,18 @@ def _internal_init(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, api_key_selection_expression: Optional[pulumi.Input[str]] = None, - authorizers: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpAuthorizerArgs']]]]] = None, + authorizers: Optional[Mapping[str, pulumi.InputType['HttpAuthorizerArgs']]] = None, body: Optional[pulumi.Input[str]] = None, cors_configuration: Optional[pulumi.Input[pulumi.InputType['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs']]] = None, description: Optional[pulumi.Input[str]] = None, disable_execute_api_endpoint: Optional[pulumi.Input[bool]] = None, - domain_mappings: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['DomainMappingArgs']]]]] = None, + domain_mappings: Optional[Mapping[str, pulumi.InputType['DomainMappingArgs']]] = None, fail_on_warnings: Optional[pulumi.Input[bool]] = None, - integrations: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpIntegrationArgs']]]]] = None, + integrations: Optional[Mapping[str, pulumi.InputType['HttpIntegrationArgs']]] = None, name: Optional[pulumi.Input[str]] = None, route_selection_expression: Optional[pulumi.Input[str]] = None, - routes: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpRouteArgs']]]]] = None, - stages: Optional[pulumi.Input[Mapping[str, pulumi.Input[pulumi.InputType['HttpStageArgs']]]]] = None, + routes: Optional[Mapping[str, pulumi.InputType['HttpRouteArgs']]] = None, + stages: Optional[Mapping[str, pulumi.InputType['HttpStageArgs']]] = None, tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, version: Optional[pulumi.Input[str]] = None, __props__=None): From 0bb5cafaabc3775fff8ef233c65da4868c57dfa8 Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Wed, 22 Nov 2023 22:36:08 +0000 Subject: [PATCH 09/18] Fix minor bugs from first test - First nodejs deployment passing. - Fix marking the HttpApi as a component. - Fix a couple of minor implementation details. - Go seems to have build issues now. --- awsx/apigatewayv2/httpApi.ts | 3 +- schema.json | 3 +- schemagen/pkg/gen/apigatewayv2.go | 1 + sdk/dotnet/Apigatewayv2/HttpApi.cs | 29 ++++----------- sdk/go/awsx/apigatewayv2/httpApi.go | 27 ++------------ .../com/pulumi/awsx/apigatewayv2/HttpApi.java | 27 ++++---------- sdk/nodejs/apigatewayv2/httpApi.ts | 18 ++-------- .../pulumi_awsx/apigatewayv2/http_api.py | 35 ++++--------------- 8 files changed, 28 insertions(+), 115 deletions(-) diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts index d42f7ca8c..cb20f2393 100644 --- a/awsx/apigatewayv2/httpApi.ts +++ b/awsx/apigatewayv2/httpApi.ts @@ -54,6 +54,7 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema if (lambdaInvokeArn !== undefined) { throw new Error(errOnlyOneArg()); } + integrationType = "AWS_PROXY"; lambdaInvokeArn = lambda.invokeArn; } if (lambdaInvokeArn !== undefined) { @@ -117,7 +118,7 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema if (integration === undefined) { throw new Error(`Could not find integration with key ${id}`); } - return `integrations/${integration.id}`; + return pulumi.interpolate`integrations/${integration.id}`; }); } let authorizerId = routeInput.authorizerId; diff --git a/schema.json b/schema.json index d7ee99dd5..ddc10b119 100644 --- a/schema.json +++ b/schema.json @@ -2192,7 +2192,8 @@ }, "requiredInputs": [ "routes" - ] + ], + "isComponent": true }, "awsx:cloudtrail:Trail": { "properties": { diff --git a/schemagen/pkg/gen/apigatewayv2.go b/schemagen/pkg/gen/apigatewayv2.go index 8c6d4d634..9f3d76b04 100644 --- a/schemagen/pkg/gen/apigatewayv2.go +++ b/schemagen/pkg/gen/apigatewayv2.go @@ -69,6 +69,7 @@ func httpApi(awsSpec schema.PackageSpec) schema.ResourceSpec { inputProperties[k] = renameAwsPropertyRefs(awsSpec, v) } return schema.ResourceSpec{ + IsComponent: true, ObjectTypeSpec: schema.ObjectTypeSpec{ Description: "Creates an HTTP API with associated sub-resources.", Type: "awsx:apigatewayv2:httpApi", diff --git a/sdk/dotnet/Apigatewayv2/HttpApi.cs b/sdk/dotnet/Apigatewayv2/HttpApi.cs index 2e2c8b8fb..ae7f9a5f0 100644 --- a/sdk/dotnet/Apigatewayv2/HttpApi.cs +++ b/sdk/dotnet/Apigatewayv2/HttpApi.cs @@ -13,7 +13,7 @@ namespace Pulumi.Awsx.Apigatewayv2 /// Creates an HTTP API with associated sub-resources. /// [AwsxResourceType("awsx:apigatewayv2:HttpApi")] - public partial class HttpApi : global::Pulumi.CustomResource + public partial class HttpApi : global::Pulumi.ComponentResource { /// /// The underlying API resource. @@ -71,39 +71,22 @@ public partial class HttpApi : global::Pulumi.CustomResource /// The unique name of the resource /// The arguments used to populate this resource's properties /// A bag of options that control this resource's behavior - public HttpApi(string name, HttpApiArgs args, CustomResourceOptions? options = null) - : base("awsx:apigatewayv2:HttpApi", name, args ?? new HttpApiArgs(), MakeResourceOptions(options, "")) + public HttpApi(string name, HttpApiArgs args, ComponentResourceOptions? options = null) + : base("awsx:apigatewayv2:HttpApi", name, args ?? new HttpApiArgs(), MakeResourceOptions(options, ""), remote: true) { } - private HttpApi(string name, Input id, CustomResourceOptions? options = null) - : base("awsx:apigatewayv2:HttpApi", name, null, MakeResourceOptions(options, id)) + private static ComponentResourceOptions MakeResourceOptions(ComponentResourceOptions? options, Input? id) { - } - - private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input? id) - { - var defaultOptions = new CustomResourceOptions + var defaultOptions = new ComponentResourceOptions { Version = Utilities.Version, }; - var merged = CustomResourceOptions.Merge(defaultOptions, options); + var merged = ComponentResourceOptions.Merge(defaultOptions, options); // Override the ID if one was specified for consistency with other language SDKs. merged.Id = id ?? merged.Id; return merged; } - /// - /// Get an existing HttpApi resource's state with the given name, ID, and optional extra - /// properties used to qualify the lookup. - /// - /// - /// The unique name of the resulting resource. - /// The unique provider ID of the resource to lookup. - /// A bag of options that control this resource's behavior - public static HttpApi Get(string name, Input id, CustomResourceOptions? options = null) - { - return new HttpApi(name, id, options); - } } public sealed class HttpApiArgs : global::Pulumi.ResourceArgs diff --git a/sdk/go/awsx/apigatewayv2/httpApi.go b/sdk/go/awsx/apigatewayv2/httpApi.go index ca2ce400e..0196ab6e3 100644 --- a/sdk/go/awsx/apigatewayv2/httpApi.go +++ b/sdk/go/awsx/apigatewayv2/httpApi.go @@ -16,7 +16,7 @@ import ( // Creates an HTTP API with associated sub-resources. type HttpApi struct { - pulumi.CustomResourceState + pulumi.ResourceState // The underlying API resource. Api apigatewayv2.ApiOutput `pulumi:"api"` @@ -48,36 +48,13 @@ func NewHttpApi(ctx *pulumi.Context, } opts = internal.PkgResourceDefaultOpts(opts) var resource HttpApi - err := ctx.RegisterResource("awsx:apigatewayv2:HttpApi", name, args, &resource, opts...) + err := ctx.RegisterRemoteComponentResource("awsx:apigatewayv2:HttpApi", name, args, &resource, opts...) if err != nil { return nil, err } return &resource, nil } -// GetHttpApi gets an existing HttpApi resource's state with the given name, ID, and optional -// state properties that are used to uniquely qualify the lookup (nil if not required). -func GetHttpApi(ctx *pulumi.Context, - name string, id pulumi.IDInput, state *HttpApiState, opts ...pulumi.ResourceOption) (*HttpApi, error) { - var resource HttpApi - err := ctx.ReadResource("awsx:apigatewayv2:HttpApi", name, id, state, &resource, opts...) - if err != nil { - return nil, err - } - return &resource, nil -} - -// Input properties used for looking up and filtering HttpApi resources. -type httpApiState struct { -} - -type HttpApiState struct { -} - -func (HttpApiState) ElementType() reflect.Type { - return reflect.TypeOf((*httpApiState)(nil)).Elem() -} - type httpApiArgs struct { // An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). // Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApi.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApi.java index bc14061ca..dfaf4f433 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApi.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApi.java @@ -26,7 +26,7 @@ * */ @ResourceType(type="awsx:apigatewayv2:HttpApi") -public class HttpApi extends com.pulumi.resources.CustomResource { +public class HttpApi extends com.pulumi.resources.ComponentResource { /** * The underlying API resource. * @@ -161,30 +161,15 @@ public HttpApi(String name, HttpApiArgs args) { * @param args The arguments to use to populate this resource's properties. * @param options A bag of options that control this resource's behavior. */ - public HttpApi(String name, HttpApiArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { - super("awsx:apigatewayv2:HttpApi", name, args == null ? HttpApiArgs.Empty : args, makeResourceOptions(options, Codegen.empty())); + public HttpApi(String name, HttpApiArgs args, @Nullable com.pulumi.resources.ComponentResourceOptions options) { + super("awsx:apigatewayv2:HttpApi", name, args == null ? HttpApiArgs.Empty : args, makeResourceOptions(options, Codegen.empty()), true); } - private HttpApi(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { - super("awsx:apigatewayv2:HttpApi", name, null, makeResourceOptions(options, id)); - } - - private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { - var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() + private static com.pulumi.resources.ComponentResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.ComponentResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.ComponentResourceOptions.builder() .version(Utilities.getVersion()) .build(); - return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); + return com.pulumi.resources.ComponentResourceOptions.merge(defaultOptions, options, id); } - /** - * Get an existing Host resource's state with the given name, ID, and optional extra - * properties used to qualify the lookup. - * - * @param name The _unique_ name of the resulting resource. - * @param id The _unique_ provider ID of the resource to lookup. - * @param options Optional settings to control the behavior of the CustomResource. - */ - public static HttpApi get(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { - return new HttpApi(name, id, options); - } } diff --git a/sdk/nodejs/apigatewayv2/httpApi.ts b/sdk/nodejs/apigatewayv2/httpApi.ts index 12e2a0059..9695077bd 100644 --- a/sdk/nodejs/apigatewayv2/httpApi.ts +++ b/sdk/nodejs/apigatewayv2/httpApi.ts @@ -12,19 +12,7 @@ import * as pulumiAws from "@pulumi/aws"; /** * Creates an HTTP API with associated sub-resources. */ -export class HttpApi extends pulumi.CustomResource { - /** - * Get an existing HttpApi resource's state with the given name, ID, and optional extra - * properties used to qualify the lookup. - * - * @param name The _unique_ name of the resulting resource. - * @param id The _unique_ provider ID of the resource to lookup. - * @param opts Optional settings to control the behavior of the CustomResource. - */ - public static get(name: string, id: pulumi.Input, opts?: pulumi.CustomResourceOptions): HttpApi { - return new HttpApi(name, undefined as any, { ...opts, id: id }); - } - +export class HttpApi extends pulumi.ComponentResource { /** @internal */ public static readonly __pulumiType = 'awsx:apigatewayv2:HttpApi'; @@ -79,7 +67,7 @@ export class HttpApi extends pulumi.CustomResource { * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ - constructor(name: string, args: HttpApiArgs, opts?: pulumi.CustomResourceOptions) { + constructor(name: string, args: HttpApiArgs, opts?: pulumi.ComponentResourceOptions) { let resourceInputs: pulumi.Inputs = {}; opts = opts || {}; if (!opts.id) { @@ -116,7 +104,7 @@ export class HttpApi extends pulumi.CustomResource { resourceInputs["stages"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); - super(HttpApi.__pulumiType, name, resourceInputs, opts); + super(HttpApi.__pulumiType, name, resourceInputs, opts, true /*remote*/); } } diff --git a/sdk/python/pulumi_awsx/apigatewayv2/http_api.py b/sdk/python/pulumi_awsx/apigatewayv2/http_api.py index 97c45e18a..272a5d581 100644 --- a/sdk/python/pulumi_awsx/apigatewayv2/http_api.py +++ b/sdk/python/pulumi_awsx/apigatewayv2/http_api.py @@ -270,7 +270,7 @@ def version(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "version", value) -class HttpApi(pulumi.CustomResource): +class HttpApi(pulumi.ComponentResource): @overload def __init__(__self__, resource_name: str, @@ -360,7 +360,9 @@ def _internal_init(__self__, opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts) if not isinstance(opts, pulumi.ResourceOptions): raise TypeError('Expected resource options to be a ResourceOptions instance') - if opts.id is None: + if opts.id is not None: + raise ValueError('ComponentResource classes do not support opts.id') + else: if __props__ is not None: raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource') __props__ = HttpApiArgs.__new__(HttpApiArgs) @@ -390,33 +392,8 @@ def _internal_init(__self__, 'awsx:apigatewayv2:HttpApi', resource_name, __props__, - opts) - - @staticmethod - def get(resource_name: str, - id: pulumi.Input[str], - opts: Optional[pulumi.ResourceOptions] = None) -> 'HttpApi': - """ - Get an existing HttpApi resource's state with the given name, id, and optional extra - properties used to qualify the lookup. - - :param str resource_name: The unique name of the resulting resource. - :param pulumi.Input[str] id: The unique provider ID of the resource to lookup. - :param pulumi.ResourceOptions opts: Options for the resource. - """ - opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) - - __props__ = HttpApiArgs.__new__(HttpApiArgs) - - __props__.__dict__["api"] = None - __props__.__dict__["api_mappings"] = None - __props__.__dict__["authorizers"] = None - __props__.__dict__["deployment"] = None - __props__.__dict__["domain_names"] = None - __props__.__dict__["integrations"] = None - __props__.__dict__["routes"] = None - __props__.__dict__["stages"] = None - return HttpApi(resource_name, opts=opts, __props__=__props__) + opts, + remote=True) @property @pulumi.getter From 4c0ecc202f19a0303d215950abfa5df15435dff2 Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Thu, 23 Nov 2023 09:28:06 +0000 Subject: [PATCH 10/18] Fix lint warning It's not possible to make some variables `const` and some `let` when unpacking the original inputs. --- awsx/apigatewayv2/httpApi.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts index cb20f2393..fe8f79e4f 100644 --- a/awsx/apigatewayv2/httpApi.ts +++ b/awsx/apigatewayv2/httpApi.ts @@ -48,6 +48,7 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema function errOnlyOneArg() { return `Exactly one of lambda, lambdaInvokeArn or integrationUri must be specified for integration ${integrationKey}`; } + /* tslint:disable-next-line */ let { integrationType, integrationUri, lambda, lambdaInvokeArn, ...integrationArgs } = integrationInput; if (lambda !== undefined) { From 85085dbe492ed2318291ccbf45b273be9a24b29b Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Thu, 23 Nov 2023 10:04:24 +0000 Subject: [PATCH 11/18] Simplify passing lambdas Just give single way of passing lambdas - by ARN. Passing a whole lambda seems to turn the whole integrations map into an output which doesn't match the types. - Auto-construct invoke ARN from the lambda ARN. - Automatically add a permission for the API Gateway to call the lambda. --- awsx/apigatewayv2/httpApi.ts | 29 +++++----- awsx/schema-types.ts | 6 +-- schema.json | 9 +--- schemagen/pkg/gen/apigatewayv2.go | 11 +--- .../Inputs/HttpIntegrationArgs.cs | 12 ++--- sdk/go/awsx/apigatewayv2/pulumiTypes.go | 7 +-- .../inputs/HttpIntegrationArgs.java | 54 +++++-------------- sdk/nodejs/types/input.ts | 8 +-- .../pulumi_awsx/apigatewayv2/_inputs.py | 38 ++++--------- 9 files changed, 53 insertions(+), 121 deletions(-) diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts index fe8f79e4f..c0b7996a2 100644 --- a/awsx/apigatewayv2/httpApi.ts +++ b/awsx/apigatewayv2/httpApi.ts @@ -46,19 +46,11 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema const integrationsMap = new Map(); for (const [integrationKey, integrationInput] of Object.entries(integrations ?? {})) { function errOnlyOneArg() { - return `Exactly one of lambda, lambdaInvokeArn or integrationUri must be specified for integration ${integrationKey}`; + return `Only one of lambdaArn or integrationUri must be specified for integration ${integrationKey}`; } /* tslint:disable-next-line */ - let { integrationType, integrationUri, lambda, lambdaInvokeArn, ...integrationArgs } = - integrationInput; - if (lambda !== undefined) { - if (lambdaInvokeArn !== undefined) { - throw new Error(errOnlyOneArg()); - } - integrationType = "AWS_PROXY"; - lambdaInvokeArn = lambda.invokeArn; - } - if (lambdaInvokeArn !== undefined) { + let { integrationType, integrationUri, lambdaArn, ...integrationArgs } = integrationInput; + if (lambdaArn !== undefined) { if (integrationUri !== undefined) { throw new Error(errOnlyOneArg()); } @@ -68,9 +60,20 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema ); } integrationType = "AWS_PROXY"; + const region = aws.getRegionOutput({}, { parent }).name; + const lambdaInvokeArn = pulumi.interpolate`arn:aws:apigateway:${region}:lambda:path/2015-03-31/functions/${lambdaArn}/invocations`; integrationUri = lambdaInvokeArn; + new aws.lambda.Permission( + `${name}-${integrationKey}-lambda-permission`, + { + function: lambdaArn, + principal: "apigateway.amazonaws.com", + sourceArn: pulumi.interpolate`${api.executionArn}/*/*`, + action: "lambda:InvokeFunction", + }, + { parent }, + ); } - const integrationName = `${name}-${integrationKey}`; if (integrationType === undefined) { throw new Error(`integrationType must be specified for custom integration ${integrationKey}`); @@ -78,7 +81,7 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema integrationsMap.set( integrationKey, new aws.apigatewayv2.Integration( - integrationName, + `${name}-${integrationKey}`, { apiId: api.id, integrationType, diff --git a/awsx/schema-types.ts b/awsx/schema-types.ts index c5ffc47e1..360812b03 100644 --- a/awsx/schema-types.ts +++ b/awsx/schema-types.ts @@ -441,8 +441,7 @@ export interface HttpIntegrationInputs { readonly integrationSubtype?: pulumi.Input; readonly integrationType?: pulumi.Input; readonly integrationUri?: pulumi.Input; - readonly lambda?: aws.lambda.Function; - readonly lambdaInvokeArn?: pulumi.Input; + readonly lambdaArn?: pulumi.Input; readonly payloadFormatVersion?: pulumi.Input; readonly requestParameters?: pulumi.Input>>; readonly responseParameters?: pulumi.Input[]>; @@ -458,8 +457,7 @@ export interface HttpIntegrationOutputs { readonly integrationSubtype?: pulumi.Output; readonly integrationType?: pulumi.Output; readonly integrationUri?: pulumi.Output; - readonly lambda?: aws.lambda.Function; - readonly lambdaInvokeArn?: pulumi.Output; + readonly lambdaArn?: pulumi.Output; readonly payloadFormatVersion?: pulumi.Output; readonly requestParameters?: pulumi.Output>; readonly responseParameters?: pulumi.Output; diff --git a/schema.json b/schema.json index ddc10b119..753286df1 100644 --- a/schema.json +++ b/schema.json @@ -201,14 +201,9 @@ "type": "string", "description": "URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`.\nFor an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service.\n Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified." }, - "lambda": { - "$ref": "/aws/v6.9.0/schema.json#/resources/aws:lambda/function:Function", - "plain": true, - "description": "A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified." - }, - "lambdaInvokeArn": { + "lambdaArn": { "type": "string", - "description": "The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified." + "description": "The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration and give permission for the API Gateway to execute the lambda. Exactly one of `lambdaArn` or `integrationUri` must be specified." }, "payloadFormatVersion": { "type": "string", diff --git a/schemagen/pkg/gen/apigatewayv2.go b/schemagen/pkg/gen/apigatewayv2.go index 9f3d76b04..ce332290c 100644 --- a/schemagen/pkg/gen/apigatewayv2.go +++ b/schemagen/pkg/gen/apigatewayv2.go @@ -155,15 +155,8 @@ func httpIntegration(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { delete(properties, "contentHandlingStrategy") delete(properties, "passthroughBehavior") delete(properties, "templateSelectionExpression") - properties["lambda"] = schema.PropertySpec{ - Description: "A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified.", - TypeSpec: schema.TypeSpec{ - Ref: packageRef(awsSpec, "/resources/aws:lambda/function:Function"), - Plain: true, - }, - } - properties["lambdaInvokeArn"] = schema.PropertySpec{ - Description: "The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified.", + properties["lambdaArn"] = schema.PropertySpec{ + Description: "The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration and give permission for the API Gateway to execute the lambda. Exactly one of `lambdaArn` or `integrationUri` must be specified.", TypeSpec: schema.TypeSpec{ Type: "string", }, diff --git a/sdk/dotnet/Apigatewayv2/Inputs/HttpIntegrationArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/HttpIntegrationArgs.cs index 2bb021c66..83591c827 100644 --- a/sdk/dotnet/Apigatewayv2/Inputs/HttpIntegrationArgs.cs +++ b/sdk/dotnet/Apigatewayv2/Inputs/HttpIntegrationArgs.cs @@ -744,16 +744,10 @@ public sealed class HttpIntegrationArgs : global::Pulumi.ResourceArgs public Input? IntegrationUri { get; set; } /// - /// A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + /// The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration and give permission for the API Gateway to execute the lambda. Exactly one of `lambdaArn` or `integrationUri` must be specified. /// - [Input("lambda")] - public Pulumi.Aws.Lambda.Function? Lambda { get; set; } - - /// - /// The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. - /// - [Input("lambdaInvokeArn")] - public Input? LambdaInvokeArn { get; set; } + [Input("lambdaArn")] + public Input? LambdaArn { get; set; } /// /// The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. diff --git a/sdk/go/awsx/apigatewayv2/pulumiTypes.go b/sdk/go/awsx/apigatewayv2/pulumiTypes.go index 45427ce63..526b53a38 100644 --- a/sdk/go/awsx/apigatewayv2/pulumiTypes.go +++ b/sdk/go/awsx/apigatewayv2/pulumiTypes.go @@ -8,7 +8,6 @@ import ( "reflect" "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" - "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" "github.com/pulumi/pulumi-awsx/sdk/v2/go/awsx/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/pulumi/pulumi/sdk/v3/go/pulumix" @@ -848,10 +847,8 @@ type HttpIntegration struct { // For an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service. // Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. IntegrationUri *string `pulumi:"integrationUri"` - // A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. - Lambda *lambda.Function `pulumi:"lambda"` - // The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. - LambdaInvokeArn *string `pulumi:"lambdaInvokeArn"` + // The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration and give permission for the API Gateway to execute the lambda. Exactly one of `lambdaArn` or `integrationUri` must be specified. + LambdaArn *string `pulumi:"lambdaArn"` // The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. PayloadFormatVersion *string `pulumi:"payloadFormatVersion"` // For WebSocket APIs, a key-value map specifying request parameters that are passed from the method request to the backend. diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpIntegrationArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpIntegrationArgs.java index ad3cf7f7d..b975d98a0 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpIntegrationArgs.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpIntegrationArgs.java @@ -5,7 +5,6 @@ import com.pulumi.aws.apigatewayv2.inputs.IntegrationResponseParameterArgs; import com.pulumi.aws.apigatewayv2.inputs.IntegrationTlsConfigArgs; -import com.pulumi.aws.lambda.Function; import com.pulumi.core.Output; import com.pulumi.core.annotations.Import; import java.lang.Integer; @@ -331,33 +330,18 @@ public Optional> integrationUri() { } /** - * A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration and give permission for the API Gateway to execute the lambda. Exactly one of `lambdaArn` or `integrationUri` must be specified. * */ - @Import(name="lambda") - private @Nullable Function lambda; + @Import(name="lambdaArn") + private @Nullable Output lambdaArn; /** - * @return A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * @return The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration and give permission for the API Gateway to execute the lambda. Exactly one of `lambdaArn` or `integrationUri` must be specified. * */ - public Optional lambda() { - return Optional.ofNullable(this.lambda); - } - - /** - * The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. - * - */ - @Import(name="lambdaInvokeArn") - private @Nullable Output lambdaInvokeArn; - - /** - * @return The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. - * - */ - public Optional> lambdaInvokeArn() { - return Optional.ofNullable(this.lambdaInvokeArn); + public Optional> lambdaArn() { + return Optional.ofNullable(this.lambdaArn); } /** @@ -456,8 +440,7 @@ private HttpIntegrationArgs(HttpIntegrationArgs $) { this.integrationSubtype = $.integrationSubtype; this.integrationType = $.integrationType; this.integrationUri = $.integrationUri; - this.lambda = $.lambda; - this.lambdaInvokeArn = $.lambdaInvokeArn; + this.lambdaArn = $.lambdaArn; this.payloadFormatVersion = $.payloadFormatVersion; this.requestParameters = $.requestParameters; this.responseParameters = $.responseParameters; @@ -658,35 +641,24 @@ public Builder integrationUri(String integrationUri) { } /** - * @param lambda A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. - * - * @return builder - * - */ - public Builder lambda(@Nullable Function lambda) { - $.lambda = lambda; - return this; - } - - /** - * @param lambdaInvokeArn The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * @param lambdaArn The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration and give permission for the API Gateway to execute the lambda. Exactly one of `lambdaArn` or `integrationUri` must be specified. * * @return builder * */ - public Builder lambdaInvokeArn(@Nullable Output lambdaInvokeArn) { - $.lambdaInvokeArn = lambdaInvokeArn; + public Builder lambdaArn(@Nullable Output lambdaArn) { + $.lambdaArn = lambdaArn; return this; } /** - * @param lambdaInvokeArn The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * @param lambdaArn The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration and give permission for the API Gateway to execute the lambda. Exactly one of `lambdaArn` or `integrationUri` must be specified. * * @return builder * */ - public Builder lambdaInvokeArn(String lambdaInvokeArn) { - return lambdaInvokeArn(Output.of(lambdaInvokeArn)); + public Builder lambdaArn(String lambdaArn) { + return lambdaArn(Output.of(lambdaArn)); } /** diff --git a/sdk/nodejs/types/input.ts b/sdk/nodejs/types/input.ts index 699435976..708f37e27 100644 --- a/sdk/nodejs/types/input.ts +++ b/sdk/nodejs/types/input.ts @@ -1518,13 +1518,9 @@ export namespace apigatewayv2 { */ integrationUri?: pulumi.Input; /** - * A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + * The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration and give permission for the API Gateway to execute the lambda. Exactly one of `lambdaArn` or `integrationUri` must be specified. */ - lambda?: pulumiAws.lambda.Function; - /** - * The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. - */ - lambdaInvokeArn?: pulumi.Input; + lambdaArn?: pulumi.Input; /** * The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. */ diff --git a/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py b/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py index 3a0c580dc..950a93e70 100644 --- a/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py +++ b/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py @@ -1028,8 +1028,7 @@ def __init__(__self__, *, integration_subtype: Optional[pulumi.Input[str]] = None, integration_type: Optional[pulumi.Input[str]] = None, integration_uri: Optional[pulumi.Input[str]] = None, - lambda_: Optional['pulumi_aws.lambda_.Function'] = None, - lambda_invoke_arn: Optional[pulumi.Input[str]] = None, + lambda_arn: Optional[pulumi.Input[str]] = None, payload_format_version: Optional[pulumi.Input[str]] = None, request_parameters: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, response_parameters: Optional[pulumi.Input[Sequence[pulumi.Input['pulumi_aws.apigatewayv2.IntegrationResponseParameterArgs']]]] = None, @@ -1727,8 +1726,7 @@ def __init__(__self__, *, :param pulumi.Input[str] integration_uri: URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`. For an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. - :param 'pulumi_aws.lambda_.Function' lambda_: A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. - :param pulumi.Input[str] lambda_invoke_arn: The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + :param pulumi.Input[str] lambda_arn: The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration and give permission for the API Gateway to execute the lambda. Exactly one of `lambdaArn` or `integrationUri` must be specified. :param pulumi.Input[str] payload_format_version: The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. :param pulumi.Input[Mapping[str, pulumi.Input[str]]] request_parameters: For WebSocket APIs, a key-value map specifying request parameters that are passed from the method request to the backend. For HTTP APIs with a specified `integration_subtype`, a key-value map specifying parameters that are passed to `AWS_PROXY` integrations. @@ -1756,10 +1754,8 @@ def __init__(__self__, *, pulumi.set(__self__, "integration_type", integration_type) if integration_uri is not None: pulumi.set(__self__, "integration_uri", integration_uri) - if lambda_ is not None: - pulumi.set(__self__, "lambda_", lambda_) - if lambda_invoke_arn is not None: - pulumi.set(__self__, "lambda_invoke_arn", lambda_invoke_arn) + if lambda_arn is not None: + pulumi.set(__self__, "lambda_arn", lambda_arn) if payload_format_version is not None: pulumi.set(__self__, "payload_format_version", payload_format_version) if request_parameters is not None: @@ -1871,28 +1867,16 @@ def integration_uri(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "integration_uri", value) @property - @pulumi.getter(name="lambda") - def lambda_(self) -> Optional['pulumi_aws.lambda_.Function']: + @pulumi.getter(name="lambdaArn") + def lambda_arn(self) -> Optional[pulumi.Input[str]]: """ - A lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration and give permission for the API Gateway to execute the lambda. Exactly one of `lambdaArn` or `integrationUri` must be specified. """ - return pulumi.get(self, "lambda_") + return pulumi.get(self, "lambda_arn") - @lambda_.setter - def lambda_(self, value: Optional['pulumi_aws.lambda_.Function']): - pulumi.set(self, "lambda_", value) - - @property - @pulumi.getter(name="lambdaInvokeArn") - def lambda_invoke_arn(self) -> Optional[pulumi.Input[str]]: - """ - The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration. Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. - """ - return pulumi.get(self, "lambda_invoke_arn") - - @lambda_invoke_arn.setter - def lambda_invoke_arn(self, value: Optional[pulumi.Input[str]]): - pulumi.set(self, "lambda_invoke_arn", value) + @lambda_arn.setter + def lambda_arn(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "lambda_arn", value) @property @pulumi.getter(name="payloadFormatVersion") From 0ebb9a59e6c724cf3c23d337975c17375afed144 Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Mon, 27 Nov 2023 11:00:15 +0000 Subject: [PATCH 12/18] Allow integrations inline --- awsx/apigatewayv2/httpApi.ts | 52 +- awsx/schema-types.ts | 6 +- schema.json | 11 +- schemagen/pkg/gen/apigatewayv2.go | 14 +- sdk/dotnet/Apigatewayv2/HttpApi.cs | 2 +- .../Apigatewayv2/Inputs/HttpRouteArgs.cs | 11 +- sdk/go/awsx/apigatewayv2/httpApi.go | 4 +- sdk/go/awsx/apigatewayv2/pulumiTypes.go | 748 +++++++++++++++++- .../pulumi/awsx/apigatewayv2/HttpApiArgs.java | 6 +- .../apigatewayv2/inputs/HttpRouteArgs.java | 50 +- sdk/nodejs/apigatewayv2/httpApi.ts | 2 +- sdk/nodejs/types/input.ts | 9 +- .../pulumi_awsx/apigatewayv2/_inputs.py | 28 +- .../pulumi_awsx/apigatewayv2/http_api.py | 6 +- 14 files changed, 889 insertions(+), 60 deletions(-) diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts index c0b7996a2..a9f3feaaa 100644 --- a/awsx/apigatewayv2/httpApi.ts +++ b/awsx/apigatewayv2/httpApi.ts @@ -44,15 +44,14 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema ); const integrationsMap = new Map(); - for (const [integrationKey, integrationInput] of Object.entries(integrations ?? {})) { - function errOnlyOneArg() { - return `Only one of lambdaArn or integrationUri must be specified for integration ${integrationKey}`; - } - /* tslint:disable-next-line */ + const integrationResources: aws.apigatewayv2.Integration[] = []; + function addIntegration(integrationKey: string, integrationInput: schema.HttpIntegrationInputs) { let { integrationType, integrationUri, lambdaArn, ...integrationArgs } = integrationInput; if (lambdaArn !== undefined) { if (integrationUri !== undefined) { - throw new Error(errOnlyOneArg()); + throw new Error( + `Only one of lambdaArn or integrationUri must be specified for integration ${integrationKey}`, + ); } if (integrationType !== undefined && integrationType !== "AWS_PROXY") { throw new Error( @@ -78,21 +77,23 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema if (integrationType === undefined) { throw new Error(`integrationType must be specified for custom integration ${integrationKey}`); } - integrationsMap.set( - integrationKey, - new aws.apigatewayv2.Integration( - `${name}-${integrationKey}`, - { - apiId: api.id, - integrationType, - integrationUri, - ...integrationArgs, - }, - { parent }, - ), + const integrationResource = new aws.apigatewayv2.Integration( + `${name}-${integrationKey}`, + { + apiId: api.id, + integrationType, + integrationUri, + ...integrationArgs, + }, + { parent }, ); + integrationsMap.set(integrationKey, integrationResource); + integrationResources.push(integrationResource); + } + for (const [integrationKey, integrationInput] of Object.entries(integrations ?? {})) { + /* tslint:disable-next-line */ + addIntegration(integrationKey, integrationInput); } - const integrationResources = Array.from(integrationsMap.values()); const authorizersMap = new Map(); for (const [authorizerKey, authorizerInput] of Object.entries(authorizers ?? {})) { @@ -114,10 +115,10 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema const routeResources: aws.apigatewayv2.Route[] = []; for (const [routeKey, routeInput] of Object.entries(routes)) { const routeName = routeKey.replace(/\W+/g, "-"); - const { integration, authorizer, ...routeArgs } = routeInput; + const { integration, integrationName, authorizer, ...routeArgs } = routeInput; let target = routeInput.target; - if (integration !== undefined) { - target = pulumi.output(integration).apply((id) => { + if (integrationName !== undefined) { + target = pulumi.output(integrationName).apply((id) => { const integration = integrationsMap.get(id); if (integration === undefined) { throw new Error(`Could not find integration with key ${id}`); @@ -125,6 +126,11 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema return pulumi.interpolate`integrations/${integration.id}`; }); } + if (integration !== undefined) { + const integrationKey = `${routeName}-integration`; + addIntegration(integrationKey, integration); + target = pulumi.interpolate`integrations/${integrationsMap.get(integrationKey)!.id}`; + } let authorizerId = routeInput.authorizerId; if (authorizer !== undefined) { authorizerId = pulumi.output(authorizer).apply((id) => { @@ -147,7 +153,7 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema }, { parent, - dependsOn: integrationResources, + dependsOn: [...integrationResources, ...authorizerResources], }, ), ); diff --git a/awsx/schema-types.ts b/awsx/schema-types.ts index 360812b03..46796bd19 100644 --- a/awsx/schema-types.ts +++ b/awsx/schema-types.ts @@ -470,7 +470,8 @@ export interface HttpRouteInputs { readonly authorizationType?: pulumi.Input; readonly authorizer?: pulumi.Input; readonly authorizerId?: pulumi.Input; - readonly integration?: pulumi.Input; + readonly integration?: HttpIntegrationInputs; + readonly integrationName?: pulumi.Input; readonly operationName?: pulumi.Input; readonly target?: pulumi.Input; } @@ -480,7 +481,8 @@ export interface HttpRouteOutputs { readonly authorizationType?: pulumi.Output; readonly authorizer?: pulumi.Output; readonly authorizerId?: pulumi.Output; - readonly integration?: pulumi.Output; + readonly integration?: HttpIntegrationOutputs; + readonly integrationName?: pulumi.Output; readonly operationName?: pulumi.Output; readonly target?: pulumi.Output; } diff --git a/schema.json b/schema.json index 753286df1..5d46e7929 100644 --- a/schema.json +++ b/schema.json @@ -261,8 +261,13 @@ "description": "Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route.\n" }, "integration": { + "$ref": "#/types/awsx:apigatewayv2:HttpIntegration", + "plain": true, + "description": "Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified." + }, + "integrationName": { "type": "string", - "description": "The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified." + "description": "The name of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. Only one of `integration`, `integrationName` or `target` can be specified. This does not need to be prefixed with \"integrations/\"." }, "operationName": { "type": "string", @@ -270,7 +275,7 @@ }, "target": { "type": "string", - "description": "Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource.\n" + "description": "Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource.\n Only one of `integration`, `integrationName` or `target` can be specified." } }, "type": "object" @@ -2145,7 +2150,7 @@ "plain": true }, "plain": true, - "description": "The integrations for the HTTP API routes." + "description": "A map of integrations keyed by name for the HTTP API routes." }, "name": { "type": "string", diff --git a/schemagen/pkg/gen/apigatewayv2.go b/schemagen/pkg/gen/apigatewayv2.go index ce332290c..23210412c 100644 --- a/schemagen/pkg/gen/apigatewayv2.go +++ b/schemagen/pkg/gen/apigatewayv2.go @@ -40,7 +40,7 @@ func httpApi(awsSpec schema.PackageSpec) schema.ResourceSpec { TypeSpec: plainStringMapOfLocalRefs("apigatewayv2", "HttpRoute"), }, "integrations": { - Description: "The integrations for the HTTP API routes.", + Description: "A map of integrations keyed by name for the HTTP API routes.", TypeSpec: plainStringMapOfLocalRefs("apigatewayv2", "HttpIntegration"), }, "authorizers": { @@ -126,7 +126,14 @@ func httpRoute(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { delete(properties, "routeResponseSelectionExpression") delete(properties, "modelSelectionExpression") properties["integration"] = schema.PropertySpec{ - Description: "The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified.", + Description: "Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified.", + TypeSpec: schema.TypeSpec{ + Ref: localRef("apigatewayv2", "HttpIntegration"), + Plain: true, + }, + } + properties["integrationName"] = schema.PropertySpec{ + Description: "The name of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. Only one of `integration`, `integrationName` or `target` can be specified. This does not need to be prefixed with \"integrations/\".", TypeSpec: schema.TypeSpec{ Type: "string", }, @@ -137,6 +144,9 @@ func httpRoute(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { Type: "string", }, } + target := properties["target"] + target.Description += " Only one of `integration`, `integrationName` or `target` can be specified." + properties["target"] = target return schema.ComplexTypeSpec{ ObjectTypeSpec: schema.ObjectTypeSpec{ Type: "object", diff --git a/sdk/dotnet/Apigatewayv2/HttpApi.cs b/sdk/dotnet/Apigatewayv2/HttpApi.cs index ae7f9a5f0..dfc637f5d 100644 --- a/sdk/dotnet/Apigatewayv2/HttpApi.cs +++ b/sdk/dotnet/Apigatewayv2/HttpApi.cs @@ -159,7 +159,7 @@ public sealed class HttpApiArgs : global::Pulumi.ResourceArgs private Dictionary? _integrations; /// - /// The integrations for the HTTP API routes. + /// A map of integrations keyed by name for the HTTP API routes. /// public Dictionary Integrations { diff --git a/sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs index 37faa3e5a..f8879f064 100644 --- a/sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs +++ b/sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs @@ -368,10 +368,16 @@ public InputList AuthorizationScopes public Input? AuthorizerId { get; set; } /// - /// The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + /// Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified. /// [Input("integration")] - public Input? Integration { get; set; } + public Inputs.HttpIntegrationArgs? Integration { get; set; } + + /// + /// The name of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. Only one of `integration`, `integrationName` or `target` can be specified. This does not need to be prefixed with "integrations/". + /// + [Input("integrationName")] + public Input? IntegrationName { get; set; } /// /// Operation name for the route. Must be between 1 and 64 characters in length. @@ -381,6 +387,7 @@ public InputList AuthorizationScopes /// /// Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + /// Only one of `integration`, `integrationName` or `target` can be specified. /// [Input("target")] public Input? Target { get; set; } diff --git a/sdk/go/awsx/apigatewayv2/httpApi.go b/sdk/go/awsx/apigatewayv2/httpApi.go index 0196ab6e3..b5f7b8b33 100644 --- a/sdk/go/awsx/apigatewayv2/httpApi.go +++ b/sdk/go/awsx/apigatewayv2/httpApi.go @@ -76,7 +76,7 @@ type httpApiArgs struct { DomainMappings map[string]DomainMapping `pulumi:"domainMappings"` // Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. FailOnWarnings *bool `pulumi:"failOnWarnings"` - // The integrations for the HTTP API routes. + // A map of integrations keyed by name for the HTTP API routes. Integrations map[string]HttpIntegration `pulumi:"integrations"` // Name of the API. Must be less than or equal to 128 characters in length. Name *string `pulumi:"name"` @@ -115,7 +115,7 @@ type HttpApiArgs struct { DomainMappings map[string]DomainMappingArgs // Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. FailOnWarnings pulumi.BoolPtrInput - // The integrations for the HTTP API routes. + // A map of integrations keyed by name for the HTTP API routes. Integrations map[string]HttpIntegrationArgs // Name of the API. Must be less than or equal to 128 characters in length. Name pulumi.StringPtrInput diff --git a/sdk/go/awsx/apigatewayv2/pulumiTypes.go b/sdk/go/awsx/apigatewayv2/pulumiTypes.go index 526b53a38..1ad404b18 100644 --- a/sdk/go/awsx/apigatewayv2/pulumiTypes.go +++ b/sdk/go/awsx/apigatewayv2/pulumiTypes.go @@ -866,6 +866,743 @@ type HttpIntegration struct { TlsConfig *apigatewayv2.IntegrationTlsConfig `pulumi:"tlsConfig"` } +// HttpIntegrationInput is an input type that accepts HttpIntegrationArgs and HttpIntegrationOutput values. +// You can construct a concrete instance of `HttpIntegrationInput` via: +// +// HttpIntegrationArgs{...} +type HttpIntegrationInput interface { + pulumi.Input + + ToHttpIntegrationOutput() HttpIntegrationOutput + ToHttpIntegrationOutputWithContext(context.Context) HttpIntegrationOutput +} + +// Manages an Amazon API Gateway Version 2 integration. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// IntegrationType: pulumi.String("MOCK"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Lambda Integration +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// exampleFunction, err := lambda.NewFunction(ctx, "exampleFunction", &lambda.FunctionArgs{ +// Code: pulumi.NewFileArchive("example.zip"), +// Role: pulumi.Any(aws_iam_role.Example.Arn), +// Handler: pulumi.String("index.handler"), +// Runtime: pulumi.String("nodejs16.x"), +// }) +// if err != nil { +// return err +// } +// _, err = apigatewayv2.NewIntegration(ctx, "exampleIntegration", &apigatewayv2.IntegrationArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// IntegrationType: pulumi.String("AWS_PROXY"), +// ConnectionType: pulumi.String("INTERNET"), +// ContentHandlingStrategy: pulumi.String("CONVERT_TO_TEXT"), +// Description: pulumi.String("Lambda example"), +// IntegrationMethod: pulumi.String("POST"), +// IntegrationUri: exampleFunction.InvokeArn, +// PassthroughBehavior: pulumi.String("WHEN_NO_MATCH"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### AWS Service Integration +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// CredentialsArn: pulumi.Any(aws_iam_role.Example.Arn), +// Description: pulumi.String("SQS example"), +// IntegrationType: pulumi.String("AWS_PROXY"), +// IntegrationSubtype: pulumi.String("SQS-SendMessage"), +// RequestParameters: pulumi.StringMap{ +// "QueueUrl": pulumi.String("$request.header.queueUrl"), +// "MessageBody": pulumi.String("$request.body.message"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Private Integration +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// CredentialsArn: pulumi.Any(aws_iam_role.Example.Arn), +// Description: pulumi.String("Example with a load balancer"), +// IntegrationType: pulumi.String("HTTP_PROXY"), +// IntegrationUri: pulumi.Any(aws_lb_listener.Example.Arn), +// IntegrationMethod: pulumi.String("ANY"), +// ConnectionType: pulumi.String("VPC_LINK"), +// ConnectionId: pulumi.Any(aws_apigatewayv2_vpc_link.Example.Id), +// TlsConfig: &apigatewayv2.IntegrationTlsConfigArgs{ +// ServerNameToVerify: pulumi.String("example.com"), +// }, +// RequestParameters: pulumi.StringMap{ +// "append:header.authforintegration": pulumi.String("$context.authorizer.authorizerResponse"), +// "overwrite:path": pulumi.String("staticValueForIntegration"), +// }, +// ResponseParameters: apigatewayv2.IntegrationResponseParameterArray{ +// &apigatewayv2.IntegrationResponseParameterArgs{ +// StatusCode: pulumi.String("403"), +// Mappings: pulumi.StringMap{ +// "append:header.auth": pulumi.String("$context.authorizer.authorizerResponse"), +// }, +// }, +// &apigatewayv2.IntegrationResponseParameterArgs{ +// StatusCode: pulumi.String("200"), +// Mappings: pulumi.StringMap{ +// "overwrite:statuscode": pulumi.String("204"), +// }, +// }, +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_integration` using the API identifier and integration identifier. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/integration:Integration example aabbccddee/1122334 +// +// ``` +// +// -> __Note:__ The API Gateway managed integration created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. +type HttpIntegrationArgs struct { + // ID of the VPC link for a private integration. Supported only for HTTP APIs. Must be between 1 and 1024 characters in length. + ConnectionId pulumi.StringPtrInput `pulumi:"connectionId"` + // Type of the network connection to the integration endpoint. Valid values: `INTERNET`, `VPC_LINK`. Default is `INTERNET`. + ConnectionType pulumi.StringPtrInput `pulumi:"connectionType"` + // Credentials required for the integration, if any. + CredentialsArn pulumi.StringPtrInput `pulumi:"credentialsArn"` + // Description of the integration. + Description pulumi.StringPtrInput `pulumi:"description"` + // Integration's HTTP method. Must be specified if `integration_type` is not `MOCK`. + IntegrationMethod pulumi.StringPtrInput `pulumi:"integrationMethod"` + // AWS service action to invoke. Supported only for HTTP APIs when `integration_type` is `AWS_PROXY`. See the [AWS service integration reference](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html) documentation for supported values. Must be between 1 and 128 characters in length. + IntegrationSubtype pulumi.StringPtrInput `pulumi:"integrationSubtype"` + // Integration type of an integration. + // Valid values: `AWS` (supported only for WebSocket APIs), `AWS_PROXY`, `HTTP` (supported only for WebSocket APIs), `HTTP_PROXY`, `MOCK` (supported only for WebSocket APIs). For an HTTP API private integration, use `HTTP_PROXY`. + IntegrationType pulumi.StringPtrInput `pulumi:"integrationType"` + // URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`. + // For an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service. + // Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. + IntegrationUri pulumi.StringPtrInput `pulumi:"integrationUri"` + // The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration and give permission for the API Gateway to execute the lambda. Exactly one of `lambdaArn` or `integrationUri` must be specified. + LambdaArn pulumi.StringPtrInput `pulumi:"lambdaArn"` + // The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. + PayloadFormatVersion pulumi.StringPtrInput `pulumi:"payloadFormatVersion"` + // For WebSocket APIs, a key-value map specifying request parameters that are passed from the method request to the backend. + // For HTTP APIs with a specified `integration_subtype`, a key-value map specifying parameters that are passed to `AWS_PROXY` integrations. + // For HTTP APIs without a specified `integration_subtype`, a key-value map specifying how to transform HTTP requests before sending them to the backend. + // See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html) for details. + RequestParameters pulumi.StringMapInput `pulumi:"requestParameters"` + // Mappings to transform the HTTP response from a backend integration before returning the response to clients. Supported only for HTTP APIs. + ResponseParameters apigatewayv2.IntegrationResponseParameterArrayInput `pulumi:"responseParameters"` + // Custom timeout between 50 and 29,000 milliseconds for WebSocket APIs and between 50 and 30,000 milliseconds for HTTP APIs. + // The default timeout is 29 seconds for WebSocket APIs and 30 seconds for HTTP APIs. + // this provider will only perform drift detection of its value when present in a configuration. + TimeoutMilliseconds pulumi.IntPtrInput `pulumi:"timeoutMilliseconds"` + // TLS configuration for a private integration. Supported only for HTTP APIs. + TlsConfig apigatewayv2.IntegrationTlsConfigPtrInput `pulumi:"tlsConfig"` +} + +func (HttpIntegrationArgs) ElementType() reflect.Type { + return reflect.TypeOf((*HttpIntegration)(nil)).Elem() +} + +func (i HttpIntegrationArgs) ToHttpIntegrationOutput() HttpIntegrationOutput { + return i.ToHttpIntegrationOutputWithContext(context.Background()) +} + +func (i HttpIntegrationArgs) ToHttpIntegrationOutputWithContext(ctx context.Context) HttpIntegrationOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpIntegrationOutput) +} + +func (i HttpIntegrationArgs) ToOutput(ctx context.Context) pulumix.Output[HttpIntegration] { + return pulumix.Output[HttpIntegration]{ + OutputState: i.ToHttpIntegrationOutputWithContext(ctx).OutputState, + } +} + +func (i HttpIntegrationArgs) ToHttpIntegrationPtrOutput() HttpIntegrationPtrOutput { + return i.ToHttpIntegrationPtrOutputWithContext(context.Background()) +} + +func (i HttpIntegrationArgs) ToHttpIntegrationPtrOutputWithContext(ctx context.Context) HttpIntegrationPtrOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpIntegrationOutput).ToHttpIntegrationPtrOutputWithContext(ctx) +} + +// HttpIntegrationPtrInput is an input type that accepts HttpIntegrationArgs, HttpIntegrationPtr and HttpIntegrationPtrOutput values. +// You can construct a concrete instance of `HttpIntegrationPtrInput` via: +// +// HttpIntegrationArgs{...} +// +// or: +// +// nil +type HttpIntegrationPtrInput interface { + pulumi.Input + + ToHttpIntegrationPtrOutput() HttpIntegrationPtrOutput + ToHttpIntegrationPtrOutputWithContext(context.Context) HttpIntegrationPtrOutput +} + +type httpIntegrationPtrType HttpIntegrationArgs + +func HttpIntegrationPtr(v *HttpIntegrationArgs) HttpIntegrationPtrInput { + return (*httpIntegrationPtrType)(v) +} + +func (*httpIntegrationPtrType) ElementType() reflect.Type { + return reflect.TypeOf((**HttpIntegration)(nil)).Elem() +} + +func (i *httpIntegrationPtrType) ToHttpIntegrationPtrOutput() HttpIntegrationPtrOutput { + return i.ToHttpIntegrationPtrOutputWithContext(context.Background()) +} + +func (i *httpIntegrationPtrType) ToHttpIntegrationPtrOutputWithContext(ctx context.Context) HttpIntegrationPtrOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpIntegrationPtrOutput) +} + +func (i *httpIntegrationPtrType) ToOutput(ctx context.Context) pulumix.Output[*HttpIntegration] { + return pulumix.Output[*HttpIntegration]{ + OutputState: i.ToHttpIntegrationPtrOutputWithContext(ctx).OutputState, + } +} + +// Manages an Amazon API Gateway Version 2 integration. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// IntegrationType: pulumi.String("MOCK"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Lambda Integration +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// exampleFunction, err := lambda.NewFunction(ctx, "exampleFunction", &lambda.FunctionArgs{ +// Code: pulumi.NewFileArchive("example.zip"), +// Role: pulumi.Any(aws_iam_role.Example.Arn), +// Handler: pulumi.String("index.handler"), +// Runtime: pulumi.String("nodejs16.x"), +// }) +// if err != nil { +// return err +// } +// _, err = apigatewayv2.NewIntegration(ctx, "exampleIntegration", &apigatewayv2.IntegrationArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// IntegrationType: pulumi.String("AWS_PROXY"), +// ConnectionType: pulumi.String("INTERNET"), +// ContentHandlingStrategy: pulumi.String("CONVERT_TO_TEXT"), +// Description: pulumi.String("Lambda example"), +// IntegrationMethod: pulumi.String("POST"), +// IntegrationUri: exampleFunction.InvokeArn, +// PassthroughBehavior: pulumi.String("WHEN_NO_MATCH"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### AWS Service Integration +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// CredentialsArn: pulumi.Any(aws_iam_role.Example.Arn), +// Description: pulumi.String("SQS example"), +// IntegrationType: pulumi.String("AWS_PROXY"), +// IntegrationSubtype: pulumi.String("SQS-SendMessage"), +// RequestParameters: pulumi.StringMap{ +// "QueueUrl": pulumi.String("$request.header.queueUrl"), +// "MessageBody": pulumi.String("$request.body.message"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Private Integration +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// CredentialsArn: pulumi.Any(aws_iam_role.Example.Arn), +// Description: pulumi.String("Example with a load balancer"), +// IntegrationType: pulumi.String("HTTP_PROXY"), +// IntegrationUri: pulumi.Any(aws_lb_listener.Example.Arn), +// IntegrationMethod: pulumi.String("ANY"), +// ConnectionType: pulumi.String("VPC_LINK"), +// ConnectionId: pulumi.Any(aws_apigatewayv2_vpc_link.Example.Id), +// TlsConfig: &apigatewayv2.IntegrationTlsConfigArgs{ +// ServerNameToVerify: pulumi.String("example.com"), +// }, +// RequestParameters: pulumi.StringMap{ +// "append:header.authforintegration": pulumi.String("$context.authorizer.authorizerResponse"), +// "overwrite:path": pulumi.String("staticValueForIntegration"), +// }, +// ResponseParameters: apigatewayv2.IntegrationResponseParameterArray{ +// &apigatewayv2.IntegrationResponseParameterArgs{ +// StatusCode: pulumi.String("403"), +// Mappings: pulumi.StringMap{ +// "append:header.auth": pulumi.String("$context.authorizer.authorizerResponse"), +// }, +// }, +// &apigatewayv2.IntegrationResponseParameterArgs{ +// StatusCode: pulumi.String("200"), +// Mappings: pulumi.StringMap{ +// "overwrite:statuscode": pulumi.String("204"), +// }, +// }, +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_integration` using the API identifier and integration identifier. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/integration:Integration example aabbccddee/1122334 +// +// ``` +// +// -> __Note:__ The API Gateway managed integration created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. +type HttpIntegrationOutput struct{ *pulumi.OutputState } + +func (HttpIntegrationOutput) ElementType() reflect.Type { + return reflect.TypeOf((*HttpIntegration)(nil)).Elem() +} + +func (o HttpIntegrationOutput) ToHttpIntegrationOutput() HttpIntegrationOutput { + return o +} + +func (o HttpIntegrationOutput) ToHttpIntegrationOutputWithContext(ctx context.Context) HttpIntegrationOutput { + return o +} + +func (o HttpIntegrationOutput) ToHttpIntegrationPtrOutput() HttpIntegrationPtrOutput { + return o.ToHttpIntegrationPtrOutputWithContext(context.Background()) +} + +func (o HttpIntegrationOutput) ToHttpIntegrationPtrOutputWithContext(ctx context.Context) HttpIntegrationPtrOutput { + return o.ApplyTWithContext(ctx, func(_ context.Context, v HttpIntegration) *HttpIntegration { + return &v + }).(HttpIntegrationPtrOutput) +} + +func (o HttpIntegrationOutput) ToOutput(ctx context.Context) pulumix.Output[HttpIntegration] { + return pulumix.Output[HttpIntegration]{ + OutputState: o.OutputState, + } +} + +// ID of the VPC link for a private integration. Supported only for HTTP APIs. Must be between 1 and 1024 characters in length. +func (o HttpIntegrationOutput) ConnectionId() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpIntegration) *string { return v.ConnectionId }).(pulumi.StringPtrOutput) +} + +// Type of the network connection to the integration endpoint. Valid values: `INTERNET`, `VPC_LINK`. Default is `INTERNET`. +func (o HttpIntegrationOutput) ConnectionType() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpIntegration) *string { return v.ConnectionType }).(pulumi.StringPtrOutput) +} + +// Credentials required for the integration, if any. +func (o HttpIntegrationOutput) CredentialsArn() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpIntegration) *string { return v.CredentialsArn }).(pulumi.StringPtrOutput) +} + +// Description of the integration. +func (o HttpIntegrationOutput) Description() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpIntegration) *string { return v.Description }).(pulumi.StringPtrOutput) +} + +// Integration's HTTP method. Must be specified if `integration_type` is not `MOCK`. +func (o HttpIntegrationOutput) IntegrationMethod() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpIntegration) *string { return v.IntegrationMethod }).(pulumi.StringPtrOutput) +} + +// AWS service action to invoke. Supported only for HTTP APIs when `integration_type` is `AWS_PROXY`. See the [AWS service integration reference](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html) documentation for supported values. Must be between 1 and 128 characters in length. +func (o HttpIntegrationOutput) IntegrationSubtype() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpIntegration) *string { return v.IntegrationSubtype }).(pulumi.StringPtrOutput) +} + +// Integration type of an integration. +// Valid values: `AWS` (supported only for WebSocket APIs), `AWS_PROXY`, `HTTP` (supported only for WebSocket APIs), `HTTP_PROXY`, `MOCK` (supported only for WebSocket APIs). For an HTTP API private integration, use `HTTP_PROXY`. +func (o HttpIntegrationOutput) IntegrationType() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpIntegration) *string { return v.IntegrationType }).(pulumi.StringPtrOutput) +} + +// URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`. +// For an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service. +// +// Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. +func (o HttpIntegrationOutput) IntegrationUri() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpIntegration) *string { return v.IntegrationUri }).(pulumi.StringPtrOutput) +} + +// The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration and give permission for the API Gateway to execute the lambda. Exactly one of `lambdaArn` or `integrationUri` must be specified. +func (o HttpIntegrationOutput) LambdaArn() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpIntegration) *string { return v.LambdaArn }).(pulumi.StringPtrOutput) +} + +// The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. +func (o HttpIntegrationOutput) PayloadFormatVersion() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpIntegration) *string { return v.PayloadFormatVersion }).(pulumi.StringPtrOutput) +} + +// For WebSocket APIs, a key-value map specifying request parameters that are passed from the method request to the backend. +// For HTTP APIs with a specified `integration_subtype`, a key-value map specifying parameters that are passed to `AWS_PROXY` integrations. +// For HTTP APIs without a specified `integration_subtype`, a key-value map specifying how to transform HTTP requests before sending them to the backend. +// See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html) for details. +func (o HttpIntegrationOutput) RequestParameters() pulumi.StringMapOutput { + return o.ApplyT(func(v HttpIntegration) map[string]string { return v.RequestParameters }).(pulumi.StringMapOutput) +} + +// Mappings to transform the HTTP response from a backend integration before returning the response to clients. Supported only for HTTP APIs. +func (o HttpIntegrationOutput) ResponseParameters() apigatewayv2.IntegrationResponseParameterArrayOutput { + return o.ApplyT(func(v HttpIntegration) []apigatewayv2.IntegrationResponseParameter { return v.ResponseParameters }).(apigatewayv2.IntegrationResponseParameterArrayOutput) +} + +// Custom timeout between 50 and 29,000 milliseconds for WebSocket APIs and between 50 and 30,000 milliseconds for HTTP APIs. +// The default timeout is 29 seconds for WebSocket APIs and 30 seconds for HTTP APIs. +// this provider will only perform drift detection of its value when present in a configuration. +func (o HttpIntegrationOutput) TimeoutMilliseconds() pulumi.IntPtrOutput { + return o.ApplyT(func(v HttpIntegration) *int { return v.TimeoutMilliseconds }).(pulumi.IntPtrOutput) +} + +// TLS configuration for a private integration. Supported only for HTTP APIs. +func (o HttpIntegrationOutput) TlsConfig() apigatewayv2.IntegrationTlsConfigPtrOutput { + return o.ApplyT(func(v HttpIntegration) *apigatewayv2.IntegrationTlsConfig { return v.TlsConfig }).(apigatewayv2.IntegrationTlsConfigPtrOutput) +} + +type HttpIntegrationPtrOutput struct{ *pulumi.OutputState } + +func (HttpIntegrationPtrOutput) ElementType() reflect.Type { + return reflect.TypeOf((**HttpIntegration)(nil)).Elem() +} + +func (o HttpIntegrationPtrOutput) ToHttpIntegrationPtrOutput() HttpIntegrationPtrOutput { + return o +} + +func (o HttpIntegrationPtrOutput) ToHttpIntegrationPtrOutputWithContext(ctx context.Context) HttpIntegrationPtrOutput { + return o +} + +func (o HttpIntegrationPtrOutput) ToOutput(ctx context.Context) pulumix.Output[*HttpIntegration] { + return pulumix.Output[*HttpIntegration]{ + OutputState: o.OutputState, + } +} + +func (o HttpIntegrationPtrOutput) Elem() HttpIntegrationOutput { + return o.ApplyT(func(v *HttpIntegration) HttpIntegration { + if v != nil { + return *v + } + var ret HttpIntegration + return ret + }).(HttpIntegrationOutput) +} + +// ID of the VPC link for a private integration. Supported only for HTTP APIs. Must be between 1 and 1024 characters in length. +func (o HttpIntegrationPtrOutput) ConnectionId() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HttpIntegration) *string { + if v == nil { + return nil + } + return v.ConnectionId + }).(pulumi.StringPtrOutput) +} + +// Type of the network connection to the integration endpoint. Valid values: `INTERNET`, `VPC_LINK`. Default is `INTERNET`. +func (o HttpIntegrationPtrOutput) ConnectionType() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HttpIntegration) *string { + if v == nil { + return nil + } + return v.ConnectionType + }).(pulumi.StringPtrOutput) +} + +// Credentials required for the integration, if any. +func (o HttpIntegrationPtrOutput) CredentialsArn() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HttpIntegration) *string { + if v == nil { + return nil + } + return v.CredentialsArn + }).(pulumi.StringPtrOutput) +} + +// Description of the integration. +func (o HttpIntegrationPtrOutput) Description() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HttpIntegration) *string { + if v == nil { + return nil + } + return v.Description + }).(pulumi.StringPtrOutput) +} + +// Integration's HTTP method. Must be specified if `integration_type` is not `MOCK`. +func (o HttpIntegrationPtrOutput) IntegrationMethod() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HttpIntegration) *string { + if v == nil { + return nil + } + return v.IntegrationMethod + }).(pulumi.StringPtrOutput) +} + +// AWS service action to invoke. Supported only for HTTP APIs when `integration_type` is `AWS_PROXY`. See the [AWS service integration reference](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html) documentation for supported values. Must be between 1 and 128 characters in length. +func (o HttpIntegrationPtrOutput) IntegrationSubtype() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HttpIntegration) *string { + if v == nil { + return nil + } + return v.IntegrationSubtype + }).(pulumi.StringPtrOutput) +} + +// Integration type of an integration. +// Valid values: `AWS` (supported only for WebSocket APIs), `AWS_PROXY`, `HTTP` (supported only for WebSocket APIs), `HTTP_PROXY`, `MOCK` (supported only for WebSocket APIs). For an HTTP API private integration, use `HTTP_PROXY`. +func (o HttpIntegrationPtrOutput) IntegrationType() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HttpIntegration) *string { + if v == nil { + return nil + } + return v.IntegrationType + }).(pulumi.StringPtrOutput) +} + +// URI of the Lambda function for a Lambda proxy integration, when `integration_type` is `AWS_PROXY`. +// For an `HTTP` integration, specify a fully-qualified URL. For an HTTP API private integration, specify the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service. +// +// Exactly one of `lambda`, `lambdaInvokeArn` or `integrationUri` must be specified. +func (o HttpIntegrationPtrOutput) IntegrationUri() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HttpIntegration) *string { + if v == nil { + return nil + } + return v.IntegrationUri + }).(pulumi.StringPtrOutput) +} + +// The ARN of a lambda function to invoke for the integration. This is used to automatically calculate the `integrationType` and `integrationUri` property of the integration and give permission for the API Gateway to execute the lambda. Exactly one of `lambdaArn` or `integrationUri` must be specified. +func (o HttpIntegrationPtrOutput) LambdaArn() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HttpIntegration) *string { + if v == nil { + return nil + } + return v.LambdaArn + }).(pulumi.StringPtrOutput) +} + +// The [format of the payload](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format) sent to an integration. Valid values: `1.0`, `2.0`. Default is `1.0`. +func (o HttpIntegrationPtrOutput) PayloadFormatVersion() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HttpIntegration) *string { + if v == nil { + return nil + } + return v.PayloadFormatVersion + }).(pulumi.StringPtrOutput) +} + +// For WebSocket APIs, a key-value map specifying request parameters that are passed from the method request to the backend. +// For HTTP APIs with a specified `integration_subtype`, a key-value map specifying parameters that are passed to `AWS_PROXY` integrations. +// For HTTP APIs without a specified `integration_subtype`, a key-value map specifying how to transform HTTP requests before sending them to the backend. +// See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html) for details. +func (o HttpIntegrationPtrOutput) RequestParameters() pulumi.StringMapOutput { + return o.ApplyT(func(v *HttpIntegration) map[string]string { + if v == nil { + return nil + } + return v.RequestParameters + }).(pulumi.StringMapOutput) +} + +// Mappings to transform the HTTP response from a backend integration before returning the response to clients. Supported only for HTTP APIs. +func (o HttpIntegrationPtrOutput) ResponseParameters() apigatewayv2.IntegrationResponseParameterArrayOutput { + return o.ApplyT(func(v *HttpIntegration) []apigatewayv2.IntegrationResponseParameter { + if v == nil { + return nil + } + return v.ResponseParameters + }).(apigatewayv2.IntegrationResponseParameterArrayOutput) +} + +// Custom timeout between 50 and 29,000 milliseconds for WebSocket APIs and between 50 and 30,000 milliseconds for HTTP APIs. +// The default timeout is 29 seconds for WebSocket APIs and 30 seconds for HTTP APIs. +// this provider will only perform drift detection of its value when present in a configuration. +func (o HttpIntegrationPtrOutput) TimeoutMilliseconds() pulumi.IntPtrOutput { + return o.ApplyT(func(v *HttpIntegration) *int { + if v == nil { + return nil + } + return v.TimeoutMilliseconds + }).(pulumi.IntPtrOutput) +} + +// TLS configuration for a private integration. Supported only for HTTP APIs. +func (o HttpIntegrationPtrOutput) TlsConfig() apigatewayv2.IntegrationTlsConfigPtrOutput { + return o.ApplyT(func(v *HttpIntegration) *apigatewayv2.IntegrationTlsConfig { + if v == nil { + return nil + } + return v.TlsConfig + }).(apigatewayv2.IntegrationTlsConfigPtrOutput) +} + // Manages an Amazon API Gateway Version 2 route. // More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html) for [WebSocket](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-develop-routes.html) and [HTTP](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-routes.html) APIs. // @@ -973,11 +1710,14 @@ type HttpRoute struct { Authorizer *string `pulumi:"authorizer"` // Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. AuthorizerId *string `pulumi:"authorizerId"` - // The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. - Integration *string `pulumi:"integration"` + // Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified. + Integration *HttpIntegration `pulumi:"integration"` + // The name of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. Only one of `integration`, `integrationName` or `target` can be specified. This does not need to be prefixed with "integrations/". + IntegrationName *string `pulumi:"integrationName"` // Operation name for the route. Must be between 1 and 64 characters in length. OperationName *string `pulumi:"operationName"` // Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + // Only one of `integration`, `integrationName` or `target` can be specified. Target *string `pulumi:"target"` } @@ -1051,6 +1791,10 @@ type HttpStage struct { func init() { pulumi.RegisterInputType(reflect.TypeOf((*DomainConfigurationInput)(nil)).Elem(), DomainConfigurationArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*DomainConfigurationPtrInput)(nil)).Elem(), DomainConfigurationArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpIntegrationInput)(nil)).Elem(), HttpIntegrationArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpIntegrationPtrInput)(nil)).Elem(), HttpIntegrationArgs{}) pulumi.RegisterOutputType(DomainConfigurationOutput{}) pulumi.RegisterOutputType(DomainConfigurationPtrOutput{}) + pulumi.RegisterOutputType(HttpIntegrationOutput{}) + pulumi.RegisterOutputType(HttpIntegrationPtrOutput{}) } diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApiArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApiArgs.java index 221ef2713..bda40da4d 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApiArgs.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApiArgs.java @@ -152,14 +152,14 @@ public Optional> failOnWarnings() { } /** - * The integrations for the HTTP API routes. + * A map of integrations keyed by name for the HTTP API routes. * */ @Import(name="integrations") private @Nullable Map integrations; /** - * @return The integrations for the HTTP API routes. + * @return A map of integrations keyed by name for the HTTP API routes. * */ public Optional> integrations() { @@ -453,7 +453,7 @@ public Builder failOnWarnings(Boolean failOnWarnings) { } /** - * @param integrations The integrations for the HTTP API routes. + * @param integrations A map of integrations keyed by name for the HTTP API routes. * * @return builder * diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java index 76243cd36..551a95635 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java @@ -3,6 +3,7 @@ package com.pulumi.awsx.apigatewayv2.inputs; +import com.pulumi.awsx.apigatewayv2.inputs.HttpIntegrationArgs; import com.pulumi.core.Output; import com.pulumi.core.annotations.Import; import java.lang.Boolean; @@ -198,20 +199,35 @@ public Optional> authorizerId() { } /** - * The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + * Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified. * */ @Import(name="integration") - private @Nullable Output integration; + private @Nullable HttpIntegrationArgs integration; /** - * @return The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + * @return Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified. * */ - public Optional> integration() { + public Optional integration() { return Optional.ofNullable(this.integration); } + /** + * The name of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. Only one of `integration`, `integrationName` or `target` can be specified. This does not need to be prefixed with "integrations/". + * + */ + @Import(name="integrationName") + private @Nullable Output integrationName; + + /** + * @return The name of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. Only one of `integration`, `integrationName` or `target` can be specified. This does not need to be prefixed with "integrations/". + * + */ + public Optional> integrationName() { + return Optional.ofNullable(this.integrationName); + } + /** * Operation name for the route. Must be between 1 and 64 characters in length. * @@ -229,6 +245,7 @@ public Optional> operationName() { /** * Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + * Only one of `integration`, `integrationName` or `target` can be specified. * */ @Import(name="target") @@ -236,6 +253,7 @@ public Optional> operationName() { /** * @return Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + * Only one of `integration`, `integrationName` or `target` can be specified. * */ public Optional> target() { @@ -251,6 +269,7 @@ private HttpRouteArgs(HttpRouteArgs $) { this.authorizer = $.authorizer; this.authorizerId = $.authorizerId; this.integration = $.integration; + this.integrationName = $.integrationName; this.operationName = $.operationName; this.target = $.target; } @@ -395,24 +414,35 @@ public Builder authorizerId(String authorizerId) { } /** - * @param integration The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + * @param integration Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified. * * @return builder * */ - public Builder integration(@Nullable Output integration) { + public Builder integration(@Nullable HttpIntegrationArgs integration) { $.integration = integration; return this; } /** - * @param integration The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + * @param integrationName The name of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. Only one of `integration`, `integrationName` or `target` can be specified. This does not need to be prefixed with "integrations/". + * + * @return builder + * + */ + public Builder integrationName(@Nullable Output integrationName) { + $.integrationName = integrationName; + return this; + } + + /** + * @param integrationName The name of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. Only one of `integration`, `integrationName` or `target` can be specified. This does not need to be prefixed with "integrations/". * * @return builder * */ - public Builder integration(String integration) { - return integration(Output.of(integration)); + public Builder integrationName(String integrationName) { + return integrationName(Output.of(integrationName)); } /** @@ -438,6 +468,7 @@ public Builder operationName(String operationName) { /** * @param target Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + * Only one of `integration`, `integrationName` or `target` can be specified. * * @return builder * @@ -449,6 +480,7 @@ public Builder target(@Nullable Output target) { /** * @param target Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + * Only one of `integration`, `integrationName` or `target` can be specified. * * @return builder * diff --git a/sdk/nodejs/apigatewayv2/httpApi.ts b/sdk/nodejs/apigatewayv2/httpApi.ts index 9695077bd..691e101df 100644 --- a/sdk/nodejs/apigatewayv2/httpApi.ts +++ b/sdk/nodejs/apigatewayv2/httpApi.ts @@ -149,7 +149,7 @@ export interface HttpApiArgs { */ failOnWarnings?: pulumi.Input; /** - * The integrations for the HTTP API routes. + * A map of integrations keyed by name for the HTTP API routes. */ integrations?: {[key: string]: inputs.apigatewayv2.HttpIntegrationArgs}; /** diff --git a/sdk/nodejs/types/input.ts b/sdk/nodejs/types/input.ts index 708f37e27..35749d4aa 100644 --- a/sdk/nodejs/types/input.ts +++ b/sdk/nodejs/types/input.ts @@ -1889,15 +1889,20 @@ export namespace apigatewayv2 { */ authorizerId?: pulumi.Input; /** - * The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + * Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified. */ - integration?: pulumi.Input; + integration?: inputs.apigatewayv2.HttpIntegrationArgs; + /** + * The name of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. Only one of `integration`, `integrationName` or `target` can be specified. This does not need to be prefixed with "integrations/". + */ + integrationName?: pulumi.Input; /** * Operation name for the route. Must be between 1 and 64 characters in length. */ operationName?: pulumi.Input; /** * Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + * Only one of `integration`, `integrationName` or `target` can be specified. */ target?: pulumi.Input; } diff --git a/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py b/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py index 950a93e70..c3d425c40 100644 --- a/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py +++ b/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py @@ -1952,7 +1952,8 @@ def __init__(__self__, *, authorization_type: Optional[pulumi.Input[str]] = None, authorizer: Optional[pulumi.Input[str]] = None, authorizer_id: Optional[pulumi.Input[str]] = None, - integration: Optional[pulumi.Input[str]] = None, + integration: Optional['HttpIntegrationArgs'] = None, + integration_name: Optional[pulumi.Input[str]] = None, operation_name: Optional[pulumi.Input[str]] = None, target: Optional[pulumi.Input[str]] = None): """ @@ -2280,9 +2281,11 @@ def __init__(__self__, *, Defaults to `NONE`. :param pulumi.Input[str] authorizer: The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. :param pulumi.Input[str] authorizer_id: Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. - :param pulumi.Input[str] integration: The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + :param 'HttpIntegrationArgs' integration: Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified. + :param pulumi.Input[str] integration_name: The name of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. Only one of `integration`, `integrationName` or `target` can be specified. This does not need to be prefixed with "integrations/". :param pulumi.Input[str] operation_name: Operation name for the route. Must be between 1 and 64 characters in length. :param pulumi.Input[str] target: Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + Only one of `integration`, `integrationName` or `target` can be specified. """ if api_key_required is not None: pulumi.set(__self__, "api_key_required", api_key_required) @@ -2296,6 +2299,8 @@ def __init__(__self__, *, pulumi.set(__self__, "authorizer_id", authorizer_id) if integration is not None: pulumi.set(__self__, "integration", integration) + if integration_name is not None: + pulumi.set(__self__, "integration_name", integration_name) if operation_name is not None: pulumi.set(__self__, "operation_name", operation_name) if target is not None: @@ -2366,16 +2371,28 @@ def authorizer_id(self, value: Optional[pulumi.Input[str]]): @property @pulumi.getter - def integration(self) -> Optional[pulumi.Input[str]]: + def integration(self) -> Optional['HttpIntegrationArgs']: """ - The key of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. One of `integration` or `target` must be specified. + Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified. """ return pulumi.get(self, "integration") @integration.setter - def integration(self, value: Optional[pulumi.Input[str]]): + def integration(self, value: Optional['HttpIntegrationArgs']): pulumi.set(self, "integration", value) + @property + @pulumi.getter(name="integrationName") + def integration_name(self) -> Optional[pulumi.Input[str]]: + """ + The name of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. Only one of `integration`, `integrationName` or `target` can be specified. This does not need to be prefixed with "integrations/". + """ + return pulumi.get(self, "integration_name") + + @integration_name.setter + def integration_name(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "integration_name", value) + @property @pulumi.getter(name="operationName") def operation_name(self) -> Optional[pulumi.Input[str]]: @@ -2393,6 +2410,7 @@ def operation_name(self, value: Optional[pulumi.Input[str]]): def target(self) -> Optional[pulumi.Input[str]]: """ Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + Only one of `integration`, `integrationName` or `target` can be specified. """ return pulumi.get(self, "target") diff --git a/sdk/python/pulumi_awsx/apigatewayv2/http_api.py b/sdk/python/pulumi_awsx/apigatewayv2/http_api.py index 272a5d581..2f545818e 100644 --- a/sdk/python/pulumi_awsx/apigatewayv2/http_api.py +++ b/sdk/python/pulumi_awsx/apigatewayv2/http_api.py @@ -46,7 +46,7 @@ def __init__(__self__, *, To require that clients use a custom domain name to invoke the API, disable the default endpoint. :param Mapping[str, 'DomainMappingArgs'] domain_mappings: The domain names for the HTTP API. :param pulumi.Input[bool] fail_on_warnings: Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. - :param Mapping[str, 'HttpIntegrationArgs'] integrations: The integrations for the HTTP API routes. + :param Mapping[str, 'HttpIntegrationArgs'] integrations: A map of integrations keyed by name for the HTTP API routes. :param pulumi.Input[str] name: Name of the API. Must be less than or equal to 128 characters in length. :param pulumi.Input[str] route_selection_expression: The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. Defaults to `$request.method $request.path`. @@ -200,7 +200,7 @@ def fail_on_warnings(self, value: Optional[pulumi.Input[bool]]): @pulumi.getter def integrations(self) -> Optional[Mapping[str, 'HttpIntegrationArgs']]: """ - The integrations for the HTTP API routes. + A map of integrations keyed by name for the HTTP API routes. """ return pulumi.get(self, "integrations") @@ -308,7 +308,7 @@ def __init__(__self__, To require that clients use a custom domain name to invoke the API, disable the default endpoint. :param Mapping[str, pulumi.InputType['DomainMappingArgs']] domain_mappings: The domain names for the HTTP API. :param pulumi.Input[bool] fail_on_warnings: Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. - :param Mapping[str, pulumi.InputType['HttpIntegrationArgs']] integrations: The integrations for the HTTP API routes. + :param Mapping[str, pulumi.InputType['HttpIntegrationArgs']] integrations: A map of integrations keyed by name for the HTTP API routes. :param pulumi.Input[str] name: Name of the API. Must be less than or equal to 128 characters in length. :param pulumi.Input[str] route_selection_expression: The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. Defaults to `$request.method $request.path`. From 284c08d49ca396ca5ba42d1629b0d95f5088b92f Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Mon, 27 Nov 2023 11:15:09 +0000 Subject: [PATCH 13/18] Allow inline route authorizer --- awsx/apigatewayv2/httpApi.ts | 50 +- awsx/schema-types.ts | 6 +- schema.json | 11 +- schemagen/pkg/gen/apigatewayv2.go | 11 +- sdk/dotnet/Apigatewayv2/HttpApi.cs | 2 +- .../Apigatewayv2/Inputs/HttpRouteArgs.cs | 10 +- sdk/go/awsx/apigatewayv2/httpApi.go | 4 +- sdk/go/awsx/apigatewayv2/pulumiTypes.go | 484 +++++++++++++++++- .../com/pulumi/awsx/apigatewayv2/HttpApi.java | 4 +- .../apigatewayv2/inputs/HttpRouteArgs.java | 56 +- sdk/nodejs/apigatewayv2/httpApi.ts | 2 +- sdk/nodejs/types/input.ts | 8 +- .../pulumi_awsx/apigatewayv2/_inputs.py | 26 +- .../pulumi_awsx/apigatewayv2/http_api.py | 2 +- 14 files changed, 621 insertions(+), 55 deletions(-) diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts index a9f3feaaa..74b79638a 100644 --- a/awsx/apigatewayv2/httpApi.ts +++ b/awsx/apigatewayv2/httpApi.ts @@ -15,6 +15,7 @@ import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; import * as schema from "../schema-types"; +import { countDefined } from "../utils"; export class HttpApi extends schema.HttpApi { constructor(name: string, args: schema.HttpApiArgs, opts?: pulumi.ComponentResourceOptions) { @@ -96,32 +97,39 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema } const authorizersMap = new Map(); - for (const [authorizerKey, authorizerInput] of Object.entries(authorizers ?? {})) { + const authorizerResources: aws.apigatewayv2.Authorizer[] = []; + function addAuthorizer(authorizerKey: string, authorizerInput: schema.HttpAuthorizerInputs) { const authorizerName = authorizerKey.replace(/\W+/g, "-"); - authorizersMap.set( - authorizerKey, - new aws.apigatewayv2.Authorizer( - `${name}-${authorizerName}`, - { - apiId: api.id, - ...authorizerInput, - }, - { parent }, - ), + const authorizerResource = new aws.apigatewayv2.Authorizer( + `${name}-${authorizerName}`, + { + apiId: api.id, + ...authorizerInput, + }, + { parent }, ); + authorizersMap.set(authorizerKey, authorizerResource); + authorizerResources.push(authorizerResource); + } + for (const [authorizerKey, authorizerInput] of Object.entries(authorizers ?? {})) { + addAuthorizer(authorizerKey, authorizerInput); } - const authorizerResources = Array.from(authorizersMap.values()); const routeResources: aws.apigatewayv2.Route[] = []; for (const [routeKey, routeInput] of Object.entries(routes)) { const routeName = routeKey.replace(/\W+/g, "-"); - const { integration, integrationName, authorizer, ...routeArgs } = routeInput; + const { integration, integrationName, authorizer, authorizerName, ...routeArgs } = routeInput; let target = routeInput.target; + if (countDefined([integration, integrationName, target]) > 1) { + throw new Error( + `Exactly one of integration, integrationName, or target must be specified for route ${routeKey}`, + ); + } if (integrationName !== undefined) { target = pulumi.output(integrationName).apply((id) => { const integration = integrationsMap.get(id); if (integration === undefined) { - throw new Error(`Could not find integration with key ${id}`); + throw new Error(`Could not find integration with name ${id}`); } return pulumi.interpolate`integrations/${integration.id}`; }); @@ -132,11 +140,21 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema target = pulumi.interpolate`integrations/${integrationsMap.get(integrationKey)!.id}`; } let authorizerId = routeInput.authorizerId; + if (countDefined([authorizer, authorizerName, authorizerId]) > 1) { + throw new Error( + `Exactly one of authorizer, authorizerName, or authorizerId must be specified for route ${routeKey}`, + ); + } if (authorizer !== undefined) { - authorizerId = pulumi.output(authorizer).apply((id) => { + const authorizerKey = `${routeName}-authorizer`; + addAuthorizer(authorizerKey, authorizer); + authorizerId = authorizersMap.get(authorizerKey)!.id; + } + if (authorizerName !== undefined) { + authorizerId = pulumi.output(authorizerName).apply((id) => { const authorizer = authorizersMap.get(id); if (authorizer === undefined) { - throw new Error(`Could not find authorizer with key ${id}`); + throw new Error(`Could not find authorizer with name ${id}`); } return authorizer.id; }); diff --git a/awsx/schema-types.ts b/awsx/schema-types.ts index 46796bd19..9e8a02d44 100644 --- a/awsx/schema-types.ts +++ b/awsx/schema-types.ts @@ -468,8 +468,9 @@ export interface HttpRouteInputs { readonly apiKeyRequired?: pulumi.Input; readonly authorizationScopes?: pulumi.Input[]>; readonly authorizationType?: pulumi.Input; - readonly authorizer?: pulumi.Input; + readonly authorizer?: HttpAuthorizerInputs; readonly authorizerId?: pulumi.Input; + readonly authorizerName?: pulumi.Input; readonly integration?: HttpIntegrationInputs; readonly integrationName?: pulumi.Input; readonly operationName?: pulumi.Input; @@ -479,8 +480,9 @@ export interface HttpRouteOutputs { readonly apiKeyRequired?: pulumi.Output; readonly authorizationScopes?: pulumi.Output; readonly authorizationType?: pulumi.Output; - readonly authorizer?: pulumi.Output; + readonly authorizer?: HttpAuthorizerOutputs; readonly authorizerId?: pulumi.Output; + readonly authorizerName?: pulumi.Output; readonly integration?: HttpIntegrationOutputs; readonly integrationName?: pulumi.Output; readonly operationName?: pulumi.Output; diff --git a/schema.json b/schema.json index 5d46e7929..a77eef17a 100644 --- a/schema.json +++ b/schema.json @@ -253,13 +253,18 @@ "description": "Authorization type for the route.\nFor WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer.\nFor HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer.\nDefaults to `NONE`.\n" }, "authorizer": { - "type": "string", - "description": "The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route." + "$ref": "#/types/awsx:apigatewayv2:HttpAuthorizer", + "plain": true, + "description": "Details of the authorizer to be created for this route. Only one of `authorizer`, `authorizerName` or `target` can be specified." }, "authorizerId": { "type": "string", "description": "Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route.\n" }, + "authorizerName": { + "type": "string", + "description": "The name of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route." + }, "integration": { "$ref": "#/types/awsx:apigatewayv2:HttpIntegration", "plain": true, @@ -2055,7 +2060,7 @@ "items": { "$ref": "/aws/v6.9.0/schema.json#/resources/aws:apigatewayv2%2fauthorizer:Authorizer" }, - "description": "The authorizers for the HTTP API routes." + "description": "The authorizers for the HTTP API routes. This is a map from authorizer name to the authorizer arguments." }, "deployment": { "$ref": "/aws/v6.9.0/schema.json#/resources/aws:apigatewayv2%2fdeployment:Deployment", diff --git a/schemagen/pkg/gen/apigatewayv2.go b/schemagen/pkg/gen/apigatewayv2.go index 23210412c..f99945637 100644 --- a/schemagen/pkg/gen/apigatewayv2.go +++ b/schemagen/pkg/gen/apigatewayv2.go @@ -87,7 +87,7 @@ func httpApi(awsSpec schema.PackageSpec) schema.ResourceSpec { TypeSpec: arrayOfAwsType(awsSpec, "apigatewayv2", "integration"), }, "authorizers": { - Description: "The authorizers for the HTTP API routes.", + Description: "The authorizers for the HTTP API routes. This is a map from authorizer name to the authorizer arguments.", TypeSpec: arrayOfAwsType(awsSpec, "apigatewayv2", "authorizer"), }, "stages": { @@ -139,7 +139,14 @@ func httpRoute(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { }, } properties["authorizer"] = schema.PropertySpec{ - Description: "The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route.", + Description: "Details of the authorizer to be created for this route. Only one of `authorizer`, `authorizerName` or `target` can be specified.", + TypeSpec: schema.TypeSpec{ + Ref: localRef("apigatewayv2", "HttpAuthorizer"), + Plain: true, + }, + } + properties["authorizerName"] = schema.PropertySpec{ + Description: "The name of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route.", TypeSpec: schema.TypeSpec{ Type: "string", }, diff --git a/sdk/dotnet/Apigatewayv2/HttpApi.cs b/sdk/dotnet/Apigatewayv2/HttpApi.cs index dfc637f5d..4709bb379 100644 --- a/sdk/dotnet/Apigatewayv2/HttpApi.cs +++ b/sdk/dotnet/Apigatewayv2/HttpApi.cs @@ -28,7 +28,7 @@ public partial class HttpApi : global::Pulumi.ComponentResource public Output> ApiMappings { get; private set; } = null!; /// - /// The authorizers for the HTTP API routes. + /// The authorizers for the HTTP API routes. This is a map from authorizer name to the authorizer arguments. /// [Output("authorizers")] public Output> Authorizers { get; private set; } = null!; diff --git a/sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs index f8879f064..ff6ed8a7c 100644 --- a/sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs +++ b/sdk/dotnet/Apigatewayv2/Inputs/HttpRouteArgs.cs @@ -356,10 +356,10 @@ public InputList AuthorizationScopes public Input? AuthorizationType { get; set; } /// - /// The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + /// Details of the authorizer to be created for this route. Only one of `authorizer`, `authorizerName` or `target` can be specified. /// [Input("authorizer")] - public Input? Authorizer { get; set; } + public Inputs.HttpAuthorizerArgs? Authorizer { get; set; } /// /// Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. @@ -367,6 +367,12 @@ public InputList AuthorizationScopes [Input("authorizerId")] public Input? AuthorizerId { get; set; } + /// + /// The name of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + /// + [Input("authorizerName")] + public Input? AuthorizerName { get; set; } + /// /// Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified. /// diff --git a/sdk/go/awsx/apigatewayv2/httpApi.go b/sdk/go/awsx/apigatewayv2/httpApi.go index b5f7b8b33..a0fb975bc 100644 --- a/sdk/go/awsx/apigatewayv2/httpApi.go +++ b/sdk/go/awsx/apigatewayv2/httpApi.go @@ -22,7 +22,7 @@ type HttpApi struct { Api apigatewayv2.ApiOutput `pulumi:"api"` // The API mappings for the HTTP API. ApiMappings apigatewayv2.ApiMappingArrayOutput `pulumi:"apiMappings"` - // The authorizers for the HTTP API routes. + // The authorizers for the HTTP API routes. This is a map from authorizer name to the authorizer arguments. Authorizers apigatewayv2.AuthorizerArrayOutput `pulumi:"authorizers"` // The deployment for the HTTP API. Deployment apigatewayv2.DeploymentOutput `pulumi:"deployment"` @@ -253,7 +253,7 @@ func (o HttpApiOutput) ApiMappings() apigatewayv2.ApiMappingArrayOutput { return o.ApplyT(func(v *HttpApi) apigatewayv2.ApiMappingArrayOutput { return v.ApiMappings }).(apigatewayv2.ApiMappingArrayOutput) } -// The authorizers for the HTTP API routes. +// The authorizers for the HTTP API routes. This is a map from authorizer name to the authorizer arguments. func (o HttpApiOutput) Authorizers() apigatewayv2.AuthorizerArrayOutput { return o.ApplyT(func(v *HttpApi) apigatewayv2.AuthorizerArrayOutput { return v.Authorizers }).(apigatewayv2.AuthorizerArrayOutput) } diff --git a/sdk/go/awsx/apigatewayv2/pulumiTypes.go b/sdk/go/awsx/apigatewayv2/pulumiTypes.go index 1ad404b18..b2e4bac41 100644 --- a/sdk/go/awsx/apigatewayv2/pulumiTypes.go +++ b/sdk/go/awsx/apigatewayv2/pulumiTypes.go @@ -660,6 +660,480 @@ type HttpAuthorizer struct { Name *string `pulumi:"name"` } +// HttpAuthorizerInput is an input type that accepts HttpAuthorizerArgs and HttpAuthorizerOutput values. +// You can construct a concrete instance of `HttpAuthorizerInput` via: +// +// HttpAuthorizerArgs{...} +type HttpAuthorizerInput interface { + pulumi.Input + + ToHttpAuthorizerOutput() HttpAuthorizerOutput + ToHttpAuthorizerOutputWithContext(context.Context) HttpAuthorizerOutput +} + +// Manages an Amazon API Gateway Version 2 authorizer. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). +// +// ## Example Usage +// ### Basic WebSocket API +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewAuthorizer(ctx, "example", &apigatewayv2.AuthorizerArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// AuthorizerType: pulumi.String("REQUEST"), +// AuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn), +// IdentitySources: pulumi.StringArray{ +// pulumi.String("route.request.header.Auth"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Basic HTTP API +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewAuthorizer(ctx, "example", &apigatewayv2.AuthorizerArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// AuthorizerType: pulumi.String("REQUEST"), +// AuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn), +// IdentitySources: pulumi.StringArray{ +// pulumi.String("$request.header.Authorization"), +// }, +// AuthorizerPayloadFormatVersion: pulumi.String("2.0"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_authorizer` using the API identifier and authorizer identifier. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/authorizer:Authorizer example aabbccddee/1122334 +// +// ``` +type HttpAuthorizerArgs struct { + // Required credentials as an IAM role for API Gateway to invoke the authorizer. + // Supported only for `REQUEST` authorizers. + AuthorizerCredentialsArn pulumi.StringPtrInput `pulumi:"authorizerCredentialsArn"` + // Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. + // Valid values: `1.0`, `2.0`. + AuthorizerPayloadFormatVersion pulumi.StringPtrInput `pulumi:"authorizerPayloadFormatVersion"` + // Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. + // If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. + // Supported only for HTTP API Lambda authorizers. + AuthorizerResultTtlInSeconds pulumi.IntPtrInput `pulumi:"authorizerResultTtlInSeconds"` + // Authorizer type. Valid values: `JWT`, `REQUEST`. + // Specify `REQUEST` for a Lambda function using incoming request parameters. + // For HTTP APIs, specify `JWT` to use JSON Web Tokens. + AuthorizerType pulumi.StringInput `pulumi:"authorizerType"` + // Authorizer's Uniform Resource Identifier (URI). + // For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invoke_arn` attribute of the `aws.lambda.Function` resource. + // Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length. + AuthorizerUri pulumi.StringPtrInput `pulumi:"authorizerUri"` + // Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. + // Supported only for HTTP APIs. + EnableSimpleResponses pulumi.BoolPtrInput `pulumi:"enableSimpleResponses"` + // Identity sources for which authorization is requested. + // For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. + // For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. + IdentitySources pulumi.StringArrayInput `pulumi:"identitySources"` + // Configuration of a JWT authorizer. Required for the `JWT` authorizer type. + // Supported only for HTTP APIs. + JwtConfiguration apigatewayv2.AuthorizerJwtConfigurationPtrInput `pulumi:"jwtConfiguration"` + // Name of the authorizer. Must be between 1 and 128 characters in length. + Name pulumi.StringPtrInput `pulumi:"name"` +} + +func (HttpAuthorizerArgs) ElementType() reflect.Type { + return reflect.TypeOf((*HttpAuthorizer)(nil)).Elem() +} + +func (i HttpAuthorizerArgs) ToHttpAuthorizerOutput() HttpAuthorizerOutput { + return i.ToHttpAuthorizerOutputWithContext(context.Background()) +} + +func (i HttpAuthorizerArgs) ToHttpAuthorizerOutputWithContext(ctx context.Context) HttpAuthorizerOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpAuthorizerOutput) +} + +func (i HttpAuthorizerArgs) ToOutput(ctx context.Context) pulumix.Output[HttpAuthorizer] { + return pulumix.Output[HttpAuthorizer]{ + OutputState: i.ToHttpAuthorizerOutputWithContext(ctx).OutputState, + } +} + +func (i HttpAuthorizerArgs) ToHttpAuthorizerPtrOutput() HttpAuthorizerPtrOutput { + return i.ToHttpAuthorizerPtrOutputWithContext(context.Background()) +} + +func (i HttpAuthorizerArgs) ToHttpAuthorizerPtrOutputWithContext(ctx context.Context) HttpAuthorizerPtrOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpAuthorizerOutput).ToHttpAuthorizerPtrOutputWithContext(ctx) +} + +// HttpAuthorizerPtrInput is an input type that accepts HttpAuthorizerArgs, HttpAuthorizerPtr and HttpAuthorizerPtrOutput values. +// You can construct a concrete instance of `HttpAuthorizerPtrInput` via: +// +// HttpAuthorizerArgs{...} +// +// or: +// +// nil +type HttpAuthorizerPtrInput interface { + pulumi.Input + + ToHttpAuthorizerPtrOutput() HttpAuthorizerPtrOutput + ToHttpAuthorizerPtrOutputWithContext(context.Context) HttpAuthorizerPtrOutput +} + +type httpAuthorizerPtrType HttpAuthorizerArgs + +func HttpAuthorizerPtr(v *HttpAuthorizerArgs) HttpAuthorizerPtrInput { + return (*httpAuthorizerPtrType)(v) +} + +func (*httpAuthorizerPtrType) ElementType() reflect.Type { + return reflect.TypeOf((**HttpAuthorizer)(nil)).Elem() +} + +func (i *httpAuthorizerPtrType) ToHttpAuthorizerPtrOutput() HttpAuthorizerPtrOutput { + return i.ToHttpAuthorizerPtrOutputWithContext(context.Background()) +} + +func (i *httpAuthorizerPtrType) ToHttpAuthorizerPtrOutputWithContext(ctx context.Context) HttpAuthorizerPtrOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpAuthorizerPtrOutput) +} + +func (i *httpAuthorizerPtrType) ToOutput(ctx context.Context) pulumix.Output[*HttpAuthorizer] { + return pulumix.Output[*HttpAuthorizer]{ + OutputState: i.ToHttpAuthorizerPtrOutputWithContext(ctx).OutputState, + } +} + +// Manages an Amazon API Gateway Version 2 authorizer. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). +// +// ## Example Usage +// ### Basic WebSocket API +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewAuthorizer(ctx, "example", &apigatewayv2.AuthorizerArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// AuthorizerType: pulumi.String("REQUEST"), +// AuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn), +// IdentitySources: pulumi.StringArray{ +// pulumi.String("route.request.header.Auth"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### Basic HTTP API +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewAuthorizer(ctx, "example", &apigatewayv2.AuthorizerArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// AuthorizerType: pulumi.String("REQUEST"), +// AuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn), +// IdentitySources: pulumi.StringArray{ +// pulumi.String("$request.header.Authorization"), +// }, +// AuthorizerPayloadFormatVersion: pulumi.String("2.0"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_authorizer` using the API identifier and authorizer identifier. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/authorizer:Authorizer example aabbccddee/1122334 +// +// ``` +type HttpAuthorizerOutput struct{ *pulumi.OutputState } + +func (HttpAuthorizerOutput) ElementType() reflect.Type { + return reflect.TypeOf((*HttpAuthorizer)(nil)).Elem() +} + +func (o HttpAuthorizerOutput) ToHttpAuthorizerOutput() HttpAuthorizerOutput { + return o +} + +func (o HttpAuthorizerOutput) ToHttpAuthorizerOutputWithContext(ctx context.Context) HttpAuthorizerOutput { + return o +} + +func (o HttpAuthorizerOutput) ToHttpAuthorizerPtrOutput() HttpAuthorizerPtrOutput { + return o.ToHttpAuthorizerPtrOutputWithContext(context.Background()) +} + +func (o HttpAuthorizerOutput) ToHttpAuthorizerPtrOutputWithContext(ctx context.Context) HttpAuthorizerPtrOutput { + return o.ApplyTWithContext(ctx, func(_ context.Context, v HttpAuthorizer) *HttpAuthorizer { + return &v + }).(HttpAuthorizerPtrOutput) +} + +func (o HttpAuthorizerOutput) ToOutput(ctx context.Context) pulumix.Output[HttpAuthorizer] { + return pulumix.Output[HttpAuthorizer]{ + OutputState: o.OutputState, + } +} + +// Required credentials as an IAM role for API Gateway to invoke the authorizer. +// Supported only for `REQUEST` authorizers. +func (o HttpAuthorizerOutput) AuthorizerCredentialsArn() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpAuthorizer) *string { return v.AuthorizerCredentialsArn }).(pulumi.StringPtrOutput) +} + +// Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. +// Valid values: `1.0`, `2.0`. +func (o HttpAuthorizerOutput) AuthorizerPayloadFormatVersion() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpAuthorizer) *string { return v.AuthorizerPayloadFormatVersion }).(pulumi.StringPtrOutput) +} + +// Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. +// If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. +// Supported only for HTTP API Lambda authorizers. +func (o HttpAuthorizerOutput) AuthorizerResultTtlInSeconds() pulumi.IntPtrOutput { + return o.ApplyT(func(v HttpAuthorizer) *int { return v.AuthorizerResultTtlInSeconds }).(pulumi.IntPtrOutput) +} + +// Authorizer type. Valid values: `JWT`, `REQUEST`. +// Specify `REQUEST` for a Lambda function using incoming request parameters. +// For HTTP APIs, specify `JWT` to use JSON Web Tokens. +func (o HttpAuthorizerOutput) AuthorizerType() pulumi.StringOutput { + return o.ApplyT(func(v HttpAuthorizer) string { return v.AuthorizerType }).(pulumi.StringOutput) +} + +// Authorizer's Uniform Resource Identifier (URI). +// For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invoke_arn` attribute of the `aws.lambda.Function` resource. +// Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length. +func (o HttpAuthorizerOutput) AuthorizerUri() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpAuthorizer) *string { return v.AuthorizerUri }).(pulumi.StringPtrOutput) +} + +// Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. +// Supported only for HTTP APIs. +func (o HttpAuthorizerOutput) EnableSimpleResponses() pulumi.BoolPtrOutput { + return o.ApplyT(func(v HttpAuthorizer) *bool { return v.EnableSimpleResponses }).(pulumi.BoolPtrOutput) +} + +// Identity sources for which authorization is requested. +// For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. +// For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. +func (o HttpAuthorizerOutput) IdentitySources() pulumi.StringArrayOutput { + return o.ApplyT(func(v HttpAuthorizer) []string { return v.IdentitySources }).(pulumi.StringArrayOutput) +} + +// Configuration of a JWT authorizer. Required for the `JWT` authorizer type. +// Supported only for HTTP APIs. +func (o HttpAuthorizerOutput) JwtConfiguration() apigatewayv2.AuthorizerJwtConfigurationPtrOutput { + return o.ApplyT(func(v HttpAuthorizer) *apigatewayv2.AuthorizerJwtConfiguration { return v.JwtConfiguration }).(apigatewayv2.AuthorizerJwtConfigurationPtrOutput) +} + +// Name of the authorizer. Must be between 1 and 128 characters in length. +func (o HttpAuthorizerOutput) Name() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpAuthorizer) *string { return v.Name }).(pulumi.StringPtrOutput) +} + +type HttpAuthorizerPtrOutput struct{ *pulumi.OutputState } + +func (HttpAuthorizerPtrOutput) ElementType() reflect.Type { + return reflect.TypeOf((**HttpAuthorizer)(nil)).Elem() +} + +func (o HttpAuthorizerPtrOutput) ToHttpAuthorizerPtrOutput() HttpAuthorizerPtrOutput { + return o +} + +func (o HttpAuthorizerPtrOutput) ToHttpAuthorizerPtrOutputWithContext(ctx context.Context) HttpAuthorizerPtrOutput { + return o +} + +func (o HttpAuthorizerPtrOutput) ToOutput(ctx context.Context) pulumix.Output[*HttpAuthorizer] { + return pulumix.Output[*HttpAuthorizer]{ + OutputState: o.OutputState, + } +} + +func (o HttpAuthorizerPtrOutput) Elem() HttpAuthorizerOutput { + return o.ApplyT(func(v *HttpAuthorizer) HttpAuthorizer { + if v != nil { + return *v + } + var ret HttpAuthorizer + return ret + }).(HttpAuthorizerOutput) +} + +// Required credentials as an IAM role for API Gateway to invoke the authorizer. +// Supported only for `REQUEST` authorizers. +func (o HttpAuthorizerPtrOutput) AuthorizerCredentialsArn() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HttpAuthorizer) *string { + if v == nil { + return nil + } + return v.AuthorizerCredentialsArn + }).(pulumi.StringPtrOutput) +} + +// Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. +// Valid values: `1.0`, `2.0`. +func (o HttpAuthorizerPtrOutput) AuthorizerPayloadFormatVersion() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HttpAuthorizer) *string { + if v == nil { + return nil + } + return v.AuthorizerPayloadFormatVersion + }).(pulumi.StringPtrOutput) +} + +// Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. +// If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. +// Supported only for HTTP API Lambda authorizers. +func (o HttpAuthorizerPtrOutput) AuthorizerResultTtlInSeconds() pulumi.IntPtrOutput { + return o.ApplyT(func(v *HttpAuthorizer) *int { + if v == nil { + return nil + } + return v.AuthorizerResultTtlInSeconds + }).(pulumi.IntPtrOutput) +} + +// Authorizer type. Valid values: `JWT`, `REQUEST`. +// Specify `REQUEST` for a Lambda function using incoming request parameters. +// For HTTP APIs, specify `JWT` to use JSON Web Tokens. +func (o HttpAuthorizerPtrOutput) AuthorizerType() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HttpAuthorizer) *string { + if v == nil { + return nil + } + return &v.AuthorizerType + }).(pulumi.StringPtrOutput) +} + +// Authorizer's Uniform Resource Identifier (URI). +// For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invoke_arn` attribute of the `aws.lambda.Function` resource. +// Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length. +func (o HttpAuthorizerPtrOutput) AuthorizerUri() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HttpAuthorizer) *string { + if v == nil { + return nil + } + return v.AuthorizerUri + }).(pulumi.StringPtrOutput) +} + +// Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. +// Supported only for HTTP APIs. +func (o HttpAuthorizerPtrOutput) EnableSimpleResponses() pulumi.BoolPtrOutput { + return o.ApplyT(func(v *HttpAuthorizer) *bool { + if v == nil { + return nil + } + return v.EnableSimpleResponses + }).(pulumi.BoolPtrOutput) +} + +// Identity sources for which authorization is requested. +// For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. +// For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests. +func (o HttpAuthorizerPtrOutput) IdentitySources() pulumi.StringArrayOutput { + return o.ApplyT(func(v *HttpAuthorizer) []string { + if v == nil { + return nil + } + return v.IdentitySources + }).(pulumi.StringArrayOutput) +} + +// Configuration of a JWT authorizer. Required for the `JWT` authorizer type. +// Supported only for HTTP APIs. +func (o HttpAuthorizerPtrOutput) JwtConfiguration() apigatewayv2.AuthorizerJwtConfigurationPtrOutput { + return o.ApplyT(func(v *HttpAuthorizer) *apigatewayv2.AuthorizerJwtConfiguration { + if v == nil { + return nil + } + return v.JwtConfiguration + }).(apigatewayv2.AuthorizerJwtConfigurationPtrOutput) +} + +// Name of the authorizer. Must be between 1 and 128 characters in length. +func (o HttpAuthorizerPtrOutput) Name() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HttpAuthorizer) *string { + if v == nil { + return nil + } + return v.Name + }).(pulumi.StringPtrOutput) +} + // Manages an Amazon API Gateway Version 2 integration. // More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). // @@ -1706,10 +2180,12 @@ type HttpRoute struct { // For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. // Defaults to `NONE`. AuthorizationType *string `pulumi:"authorizationType"` - // The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. - Authorizer *string `pulumi:"authorizer"` + // Details of the authorizer to be created for this route. Only one of `authorizer`, `authorizerName` or `target` can be specified. + Authorizer *HttpAuthorizer `pulumi:"authorizer"` // Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. AuthorizerId *string `pulumi:"authorizerId"` + // The name of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + AuthorizerName *string `pulumi:"authorizerName"` // Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified. Integration *HttpIntegration `pulumi:"integration"` // The name of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. Only one of `integration`, `integrationName` or `target` can be specified. This does not need to be prefixed with "integrations/". @@ -1791,10 +2267,14 @@ type HttpStage struct { func init() { pulumi.RegisterInputType(reflect.TypeOf((*DomainConfigurationInput)(nil)).Elem(), DomainConfigurationArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*DomainConfigurationPtrInput)(nil)).Elem(), DomainConfigurationArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpAuthorizerInput)(nil)).Elem(), HttpAuthorizerArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpAuthorizerPtrInput)(nil)).Elem(), HttpAuthorizerArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*HttpIntegrationInput)(nil)).Elem(), HttpIntegrationArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*HttpIntegrationPtrInput)(nil)).Elem(), HttpIntegrationArgs{}) pulumi.RegisterOutputType(DomainConfigurationOutput{}) pulumi.RegisterOutputType(DomainConfigurationPtrOutput{}) + pulumi.RegisterOutputType(HttpAuthorizerOutput{}) + pulumi.RegisterOutputType(HttpAuthorizerPtrOutput{}) pulumi.RegisterOutputType(HttpIntegrationOutput{}) pulumi.RegisterOutputType(HttpIntegrationPtrOutput{}) } diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApi.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApi.java index dfaf4f433..d1298751b 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApi.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/HttpApi.java @@ -56,14 +56,14 @@ public Output>> apiMappings() { return Codegen.optional(this.apiMappings); } /** - * The authorizers for the HTTP API routes. + * The authorizers for the HTTP API routes. This is a map from authorizer name to the authorizer arguments. * */ @Export(name="authorizers", refs={List.class,Authorizer.class}, tree="[0,1]") private Output> authorizers; /** - * @return The authorizers for the HTTP API routes. + * @return The authorizers for the HTTP API routes. This is a map from authorizer name to the authorizer arguments. * */ public Output> authorizers() { diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java index 551a95635..0872e33f1 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/HttpRouteArgs.java @@ -3,6 +3,7 @@ package com.pulumi.awsx.apigatewayv2.inputs; +import com.pulumi.awsx.apigatewayv2.inputs.HttpAuthorizerArgs; import com.pulumi.awsx.apigatewayv2.inputs.HttpIntegrationArgs; import com.pulumi.core.Output; import com.pulumi.core.annotations.Import; @@ -169,17 +170,17 @@ public Optional> authorizationType() { } /** - * The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + * Details of the authorizer to be created for this route. Only one of `authorizer`, `authorizerName` or `target` can be specified. * */ @Import(name="authorizer") - private @Nullable Output authorizer; + private @Nullable HttpAuthorizerArgs authorizer; /** - * @return The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + * @return Details of the authorizer to be created for this route. Only one of `authorizer`, `authorizerName` or `target` can be specified. * */ - public Optional> authorizer() { + public Optional authorizer() { return Optional.ofNullable(this.authorizer); } @@ -198,6 +199,21 @@ public Optional> authorizerId() { return Optional.ofNullable(this.authorizerId); } + /** + * The name of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + * + */ + @Import(name="authorizerName") + private @Nullable Output authorizerName; + + /** + * @return The name of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + * + */ + public Optional> authorizerName() { + return Optional.ofNullable(this.authorizerName); + } + /** * Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified. * @@ -268,6 +284,7 @@ private HttpRouteArgs(HttpRouteArgs $) { this.authorizationType = $.authorizationType; this.authorizer = $.authorizer; this.authorizerId = $.authorizerId; + this.authorizerName = $.authorizerName; this.integration = $.integration; this.integrationName = $.integrationName; this.operationName = $.operationName; @@ -372,24 +389,25 @@ public Builder authorizationType(String authorizationType) { } /** - * @param authorizer The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + * @param authorizer Details of the authorizer to be created for this route. Only one of `authorizer`, `authorizerName` or `target` can be specified. * * @return builder * */ - public Builder authorizer(@Nullable Output authorizer) { + public Builder authorizer(@Nullable HttpAuthorizerArgs authorizer) { $.authorizer = authorizer; return this; } /** - * @param authorizer The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + * @param authorizerId Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. * * @return builder * */ - public Builder authorizer(String authorizer) { - return authorizer(Output.of(authorizer)); + public Builder authorizerId(@Nullable Output authorizerId) { + $.authorizerId = authorizerId; + return this; } /** @@ -398,19 +416,29 @@ public Builder authorizer(String authorizer) { * @return builder * */ - public Builder authorizerId(@Nullable Output authorizerId) { - $.authorizerId = authorizerId; + public Builder authorizerId(String authorizerId) { + return authorizerId(Output.of(authorizerId)); + } + + /** + * @param authorizerName The name of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + * + * @return builder + * + */ + public Builder authorizerName(@Nullable Output authorizerName) { + $.authorizerName = authorizerName; return this; } /** - * @param authorizerId Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. + * @param authorizerName The name of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. * * @return builder * */ - public Builder authorizerId(String authorizerId) { - return authorizerId(Output.of(authorizerId)); + public Builder authorizerName(String authorizerName) { + return authorizerName(Output.of(authorizerName)); } /** diff --git a/sdk/nodejs/apigatewayv2/httpApi.ts b/sdk/nodejs/apigatewayv2/httpApi.ts index 691e101df..4e122d939 100644 --- a/sdk/nodejs/apigatewayv2/httpApi.ts +++ b/sdk/nodejs/apigatewayv2/httpApi.ts @@ -36,7 +36,7 @@ export class HttpApi extends pulumi.ComponentResource { */ public /*out*/ readonly apiMappings!: pulumi.Output; /** - * The authorizers for the HTTP API routes. + * The authorizers for the HTTP API routes. This is a map from authorizer name to the authorizer arguments. */ public readonly authorizers!: pulumi.Output; /** diff --git a/sdk/nodejs/types/input.ts b/sdk/nodejs/types/input.ts index 35749d4aa..71ba84c60 100644 --- a/sdk/nodejs/types/input.ts +++ b/sdk/nodejs/types/input.ts @@ -1881,13 +1881,17 @@ export namespace apigatewayv2 { */ authorizationType?: pulumi.Input; /** - * The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + * Details of the authorizer to be created for this route. Only one of `authorizer`, `authorizerName` or `target` can be specified. */ - authorizer?: pulumi.Input; + authorizer?: inputs.apigatewayv2.HttpAuthorizerArgs; /** * Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. */ authorizerId?: pulumi.Input; + /** + * The name of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + */ + authorizerName?: pulumi.Input; /** * Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified. */ diff --git a/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py b/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py index c3d425c40..d13cde5f9 100644 --- a/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py +++ b/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py @@ -1950,8 +1950,9 @@ def __init__(__self__, *, api_key_required: Optional[pulumi.Input[bool]] = None, authorization_scopes: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, authorization_type: Optional[pulumi.Input[str]] = None, - authorizer: Optional[pulumi.Input[str]] = None, + authorizer: Optional['HttpAuthorizerArgs'] = None, authorizer_id: Optional[pulumi.Input[str]] = None, + authorizer_name: Optional[pulumi.Input[str]] = None, integration: Optional['HttpIntegrationArgs'] = None, integration_name: Optional[pulumi.Input[str]] = None, operation_name: Optional[pulumi.Input[str]] = None, @@ -2279,8 +2280,9 @@ def __init__(__self__, *, For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. Defaults to `NONE`. - :param pulumi.Input[str] authorizer: The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + :param 'HttpAuthorizerArgs' authorizer: Details of the authorizer to be created for this route. Only one of `authorizer`, `authorizerName` or `target` can be specified. :param pulumi.Input[str] authorizer_id: Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. + :param pulumi.Input[str] authorizer_name: The name of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. :param 'HttpIntegrationArgs' integration: Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified. :param pulumi.Input[str] integration_name: The name of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. Only one of `integration`, `integrationName` or `target` can be specified. This does not need to be prefixed with "integrations/". :param pulumi.Input[str] operation_name: Operation name for the route. Must be between 1 and 64 characters in length. @@ -2297,6 +2299,8 @@ def __init__(__self__, *, pulumi.set(__self__, "authorizer", authorizer) if authorizer_id is not None: pulumi.set(__self__, "authorizer_id", authorizer_id) + if authorizer_name is not None: + pulumi.set(__self__, "authorizer_name", authorizer_name) if integration is not None: pulumi.set(__self__, "integration", integration) if integration_name is not None: @@ -2347,14 +2351,14 @@ def authorization_type(self, value: Optional[pulumi.Input[str]]): @property @pulumi.getter - def authorizer(self) -> Optional[pulumi.Input[str]]: + def authorizer(self) -> Optional['HttpAuthorizerArgs']: """ - The key of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + Details of the authorizer to be created for this route. Only one of `authorizer`, `authorizerName` or `target` can be specified. """ return pulumi.get(self, "authorizer") @authorizer.setter - def authorizer(self, value: Optional[pulumi.Input[str]]): + def authorizer(self, value: Optional['HttpAuthorizerArgs']): pulumi.set(self, "authorizer", value) @property @@ -2369,6 +2373,18 @@ def authorizer_id(self) -> Optional[pulumi.Input[str]]: def authorizer_id(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "authorizer_id", value) + @property + @pulumi.getter(name="authorizerName") + def authorizer_name(self) -> Optional[pulumi.Input[str]]: + """ + The name of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + """ + return pulumi.get(self, "authorizer_name") + + @authorizer_name.setter + def authorizer_name(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "authorizer_name", value) + @property @pulumi.getter def integration(self) -> Optional['HttpIntegrationArgs']: diff --git a/sdk/python/pulumi_awsx/apigatewayv2/http_api.py b/sdk/python/pulumi_awsx/apigatewayv2/http_api.py index 2f545818e..9d0f7e811 100644 --- a/sdk/python/pulumi_awsx/apigatewayv2/http_api.py +++ b/sdk/python/pulumi_awsx/apigatewayv2/http_api.py @@ -415,7 +415,7 @@ def api_mappings(self) -> pulumi.Output[Optional[Sequence['pulumi_aws.apigateway @pulumi.getter def authorizers(self) -> pulumi.Output[Sequence['pulumi_aws.apigatewayv2.Authorizer']]: """ - The authorizers for the HTTP API routes. + The authorizers for the HTTP API routes. This is a map from authorizer name to the authorizer arguments. """ return pulumi.get(self, "authorizers") From 9739f824189ed9dd064152dbae18ca3da8aa3dbf Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Mon, 27 Nov 2023 11:16:58 +0000 Subject: [PATCH 14/18] Fix lint warnings --- awsx/apigatewayv2/httpApi.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts index 74b79638a..d30245ce5 100644 --- a/awsx/apigatewayv2/httpApi.ts +++ b/awsx/apigatewayv2/httpApi.ts @@ -47,6 +47,7 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema const integrationsMap = new Map(); const integrationResources: aws.apigatewayv2.Integration[] = []; function addIntegration(integrationKey: string, integrationInput: schema.HttpIntegrationInputs) { + /* tslint:disable-next-line */ let { integrationType, integrationUri, lambdaArn, ...integrationArgs } = integrationInput; if (lambdaArn !== undefined) { if (integrationUri !== undefined) { @@ -63,6 +64,7 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema const region = aws.getRegionOutput({}, { parent }).name; const lambdaInvokeArn = pulumi.interpolate`arn:aws:apigateway:${region}:lambda:path/2015-03-31/functions/${lambdaArn}/invocations`; integrationUri = lambdaInvokeArn; + /* tslint:disable-next-line */ new aws.lambda.Permission( `${name}-${integrationKey}-lambda-permission`, { @@ -92,7 +94,6 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema integrationResources.push(integrationResource); } for (const [integrationKey, integrationInput] of Object.entries(integrations ?? {})) { - /* tslint:disable-next-line */ addIntegration(integrationKey, integrationInput); } From 95884bb5cb0930de353004423652ef1e1354a96e Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Mon, 27 Nov 2023 13:13:59 +0000 Subject: [PATCH 15/18] Add example test --- awsx/apigatewayv2/httpApi.ts | 25 ++++++++-- examples/examples_nodejs_test.go | 9 ++++ examples/ts-http-api/Pulumi.yaml | 3 ++ examples/ts-http-api/index.ts | 77 ++++++++++++++++++++++++++++++ examples/ts-http-api/package.json | 11 +++++ examples/ts-http-api/tsconfig.json | 15 ++++++ 6 files changed, 136 insertions(+), 4 deletions(-) create mode 100644 examples/ts-http-api/Pulumi.yaml create mode 100644 examples/ts-http-api/index.ts create mode 100644 examples/ts-http-api/package.json create mode 100644 examples/ts-http-api/tsconfig.json diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts index d30245ce5..6f2e31820 100644 --- a/awsx/apigatewayv2/httpApi.ts +++ b/awsx/apigatewayv2/httpApi.ts @@ -111,6 +111,7 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema ); authorizersMap.set(authorizerKey, authorizerResource); authorizerResources.push(authorizerResource); + return authorizerResource; } for (const [authorizerKey, authorizerInput] of Object.entries(authorizers ?? {})) { addAuthorizer(authorizerKey, authorizerInput); @@ -141,6 +142,7 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema target = pulumi.interpolate`integrations/${integrationsMap.get(integrationKey)!.id}`; } let authorizerId = routeInput.authorizerId; + let authorizationType = routeInput.authorizationType; if (countDefined([authorizer, authorizerName, authorizerId]) > 1) { throw new Error( `Exactly one of authorizer, authorizerName, or authorizerId must be specified for route ${routeKey}`, @@ -148,17 +150,20 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema } if (authorizer !== undefined) { const authorizerKey = `${routeName}-authorizer`; - addAuthorizer(authorizerKey, authorizer); - authorizerId = authorizersMap.get(authorizerKey)!.id; + const authorizerResource = addAuthorizer(authorizerKey, authorizer); + authorizerId = authorizerResource.id; + authorizationType = authorizerResource.authorizerType.apply(mapRouteAuthorizerType); } if (authorizerName !== undefined) { - authorizerId = pulumi.output(authorizerName).apply((id) => { + const authorizer = pulumi.output(authorizerName).apply((id) => { const authorizer = authorizersMap.get(id); if (authorizer === undefined) { throw new Error(`Could not find authorizer with name ${id}`); } - return authorizer.id; + return authorizer; }); + authorizerId = authorizer.id; + authorizationType = authorizer.authorizerType.apply(mapRouteAuthorizerType); } routeResources.push( new aws.apigatewayv2.Route( @@ -169,6 +174,7 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema ...routeArgs, target, authorizerId, + authorizationType, }, { parent, @@ -256,3 +262,14 @@ function defaultStages(): Record { default: { autoDeploy: true }, }; } + +function mapRouteAuthorizerType(authorizerType: string) { + switch (authorizerType) { + case "JWT": + return "JWT"; + case "REQUEST": + return "CUSTOM"; + default: + throw new Error(`Unknown authorizer type ${authorizerType}`); + } +} diff --git a/examples/examples_nodejs_test.go b/examples/examples_nodejs_test.go index f0132e55b..1bb10b803 100644 --- a/examples/examples_nodejs_test.go +++ b/examples/examples_nodejs_test.go @@ -169,6 +169,15 @@ func TestVpcMultipleSimilarSubnetSpecArgs(t *testing.T) { integration.ProgramTest(t, &test) } +func TestHttpApi(t *testing.T) { + test := getNodeJSBaseOptions(t). + With(integration.ProgramTestOptions{ + Dir: filepath.Join(getCwd(t), "ts-http-api"), + }) + + integration.ProgramTest(t, &test) +} + func getNodeJSBaseOptions(t *testing.T) integration.ProgramTestOptions { base := getBaseOptions(t) nodeBase := base.With(integration.ProgramTestOptions{ diff --git a/examples/ts-http-api/Pulumi.yaml b/examples/ts-http-api/Pulumi.yaml new file mode 100644 index 000000000..c5c2db97a --- /dev/null +++ b/examples/ts-http-api/Pulumi.yaml @@ -0,0 +1,3 @@ +name: ts-http-api +runtime: nodejs +description: API Gateway V2 HTTP Api with authorization diff --git a/examples/ts-http-api/index.ts b/examples/ts-http-api/index.ts new file mode 100644 index 000000000..d73c1d181 --- /dev/null +++ b/examples/ts-http-api/index.ts @@ -0,0 +1,77 @@ +import * as pulumi from "@pulumi/pulumi"; +import * as aws from "@pulumi/aws"; +import * as awsx from "@pulumi/awsx"; + +const apiLambda = new aws.lambda.CallbackFunction("root-lambda", { + callback: async () => { + return { + statusCode: 200, + body: "Hello, world!", + }; + }, +}); + +const authLambda = new aws.lambda.CallbackFunction("auth-lambda", { + callback: async () => { + return { + isAuthorized: true, + context: { + exampleKey: "exampleValue", + }, + }; + }, +}); + +const userPool = new aws.cognito.UserPool("user-pool", {}); + +const userPoolClient = new aws.cognito.UserPoolClient("user-pool-client", { + userPoolId: userPool.id, + preventUserExistenceErrors: "ENABLED", +}); + +const api = new awsx.apigatewayv2.HttpApi("api", { + routes: { + "GET /inline-integration": { + integration: { + lambdaArn: apiLambda.arn, + }, + }, + "GET /inline-lambda-auth": { + integrationName: "reusable-integration", + authorizer: { + authorizerType: "REQUEST", + authorizerUri: authLambda.invokeArn, + authorizerPayloadFormatVersion: "2.0", + enableSimpleResponses: true, + }, + }, + "GET /cognito-auth": { + integrationName: "reusable-integration", + authorizerName: "cognito", + }, + }, + integrations: { + "reusable-integration": { + lambdaArn: apiLambda.arn, + }, + }, + authorizers: { + cognito: { + authorizerType: "JWT", + identitySources: ["$request.header.Authorization"], + jwtConfiguration: { + audiences: [userPoolClient.id], + issuer: pulumi.interpolate`https://${userPool.endpoint}`, + }, + }, + }, +}); + +new aws.lambda.Permission("auth-lambda-permission", { + function: authLambda.arn, + principal: "apigateway.amazonaws.com", + sourceArn: pulumi.interpolate`${api.api.executionArn}/*/*`, + action: "lambda:InvokeFunction", +}); + +export const url = api.api.apiEndpoint; diff --git a/examples/ts-http-api/package.json b/examples/ts-http-api/package.json new file mode 100644 index 000000000..9241f175e --- /dev/null +++ b/examples/ts-http-api/package.json @@ -0,0 +1,11 @@ +{ + "name": "ts-http-api", + "devDependencies": { + "@types/node": "^18.0.0" + }, + "dependencies": { + "@pulumi/aws": "^6.0.0", + "@pulumi/awsx": "latest", + "@pulumi/pulumi": "^3.0.0" + } +} \ No newline at end of file diff --git a/examples/ts-http-api/tsconfig.json b/examples/ts-http-api/tsconfig.json new file mode 100644 index 000000000..170a1dabf --- /dev/null +++ b/examples/ts-http-api/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "strict": true, + "outDir": "bin", + "target": "es2016", + "module": "commonjs", + "moduleResolution": "node", + "sourceMap": true, + "experimentalDecorators": true, + "pretty": true, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "forceConsistentCasingInFileNames": true + } +} From 84e5f21223398ee35c664cf4ea8cc7f5daf72608 Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Mon, 27 Nov 2023 14:40:55 +0000 Subject: [PATCH 16/18] Make all arguments inputty Work around https://github.com/pulumi/pulumi/issues/14662 where the Go SDK was failing to compile. --- awsx/apigatewayv2/httpApi.ts | 193 +++-- awsx/schema-types.ts | 10 +- schema.json | 15 +- schemagen/pkg/gen/apigatewayv2.go | 3 +- sdk/dotnet/Apigatewayv2/HttpApi.cs | 30 +- sdk/go/awsx/apigatewayv2/httpApi.go | 10 +- sdk/go/awsx/apigatewayv2/pulumiTypes.go | 757 +++++++++++++++++- sdk/nodejs/apigatewayv2/httpApi.ts | 10 +- .../pulumi_awsx/apigatewayv2/http_api.py | 70 +- 9 files changed, 920 insertions(+), 178 deletions(-) diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts index 6f2e31820..79650eaa9 100644 --- a/awsx/apigatewayv2/httpApi.ts +++ b/awsx/apigatewayv2/httpApi.ts @@ -16,6 +16,7 @@ import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; import * as schema from "../schema-types"; import { countDefined } from "../utils"; +import { isPromise } from "util/types"; export class HttpApi extends schema.HttpApi { constructor(name: string, args: schema.HttpApiArgs, opts?: pulumi.ComponentResourceOptions) { @@ -23,13 +24,15 @@ export class HttpApi extends schema.HttpApi { const result = buildHttpApi(this, name, args); this.api = result.api; - this.routes = result.routes; - this.integrations = result.integrations; - this.authorizers = result.authorizers; - this.stages = result.stages; + this.routes = pulumi.output(result.routes); + this.integrations = pulumi.output(result.integrations); + this.authorizers = pulumi.output(result.authorizers); + this.stages = pulumi.output(result.stages); this.deployment = result.deployment; - this.domainNames = result.domainNames; - this.apiMappings = result.apiMappings; + this.domainNames = pulumi + .output(result.domainNames) + .apply((domains) => domains.filter((d) => d !== undefined)) as any; + this.apiMappings = pulumi.output(result.apiMappings); } } @@ -44,9 +47,7 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema { parent }, ); - const integrationsMap = new Map(); - const integrationResources: aws.apigatewayv2.Integration[] = []; - function addIntegration(integrationKey: string, integrationInput: schema.HttpIntegrationInputs) { + function makeIntegration(integrationKey: string, integrationInput: schema.HttpIntegrationInputs) { /* tslint:disable-next-line */ let { integrationType, integrationUri, lambdaArn, ...integrationArgs } = integrationInput; if (lambdaArn !== undefined) { @@ -90,16 +91,26 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema }, { parent }, ); - integrationsMap.set(integrationKey, integrationResource); - integrationResources.push(integrationResource); + return integrationResource; } + const integrationsMap = new Map>(); for (const [integrationKey, integrationInput] of Object.entries(integrations ?? {})) { - addIntegration(integrationKey, integrationInput); + if (!pulumi.Output.isInstance(integrationInput) && !isPromise(integrationInput)) { + integrationsMap.set( + integrationKey, + pulumi.output(makeIntegration(integrationKey, integrationInput)), + ); + } else { + integrationsMap.set( + integrationKey, + pulumi + .output(integrationInput) + .apply((integration) => makeIntegration(integrationKey, integration)), + ); + } } - const authorizersMap = new Map(); - const authorizerResources: aws.apigatewayv2.Authorizer[] = []; - function addAuthorizer(authorizerKey: string, authorizerInput: schema.HttpAuthorizerInputs) { + function makeAuthorizer(authorizerKey: string, authorizerInput: schema.HttpAuthorizerInputs) { const authorizerName = authorizerKey.replace(/\W+/g, "-"); const authorizerResource = new aws.apigatewayv2.Authorizer( `${name}-${authorizerName}`, @@ -109,16 +120,26 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema }, { parent }, ); - authorizersMap.set(authorizerKey, authorizerResource); - authorizerResources.push(authorizerResource); return authorizerResource; } + const authorizersMap = new Map>(); for (const [authorizerKey, authorizerInput] of Object.entries(authorizers ?? {})) { - addAuthorizer(authorizerKey, authorizerInput); + if (!pulumi.Output.isInstance(authorizerInput) && !isPromise(authorizerInput)) { + authorizersMap.set( + authorizerKey, + pulumi.output(makeAuthorizer(authorizerKey, authorizerInput)), + ); + } else { + authorizersMap.set( + authorizerKey, + pulumi + .output(authorizerInput) + .apply((authorizer) => makeAuthorizer(authorizerKey, authorizer)), + ); + } } - const routeResources: aws.apigatewayv2.Route[] = []; - for (const [routeKey, routeInput] of Object.entries(routes)) { + function makeRoute(routeKey: string, routeInput: schema.HttpRouteInputs) { const routeName = routeKey.replace(/\W+/g, "-"); const { integration, integrationName, authorizer, authorizerName, ...routeArgs } = routeInput; let target = routeInput.target; @@ -138,8 +159,9 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema } if (integration !== undefined) { const integrationKey = `${routeName}-integration`; - addIntegration(integrationKey, integration); - target = pulumi.interpolate`integrations/${integrationsMap.get(integrationKey)!.id}`; + const integrationResource = makeIntegration(integrationKey, integration); + integrationsMap.set(integrationKey, pulumi.output(integrationResource)); + target = pulumi.interpolate`integrations/${integrationResource.id}`; } let authorizerId = routeInput.authorizerId; let authorizationType = routeInput.authorizationType; @@ -150,7 +172,7 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema } if (authorizer !== undefined) { const authorizerKey = `${routeName}-authorizer`; - const authorizerResource = addAuthorizer(authorizerKey, authorizer); + const authorizerResource = makeAuthorizer(authorizerKey, authorizer); authorizerId = authorizerResource.id; authorizationType = authorizerResource.authorizerType.apply(mapRouteAuthorizerType); } @@ -165,38 +187,52 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema authorizerId = authorizer.id; authorizationType = authorizer.authorizerType.apply(mapRouteAuthorizerType); } - routeResources.push( - new aws.apigatewayv2.Route( - `${name}-${routeName}`, - { - apiId: api.id, - routeKey, - ...routeArgs, - target, - authorizerId, - authorizationType, - }, - { - parent, - dependsOn: [...integrationResources, ...authorizerResources], - }, - ), + return new aws.apigatewayv2.Route( + `${name}-${routeName}`, + { + apiId: api.id, + routeKey, + ...routeArgs, + target, + authorizerId, + authorizationType, + }, + { + parent, + dependsOn: [ + ...Array.from(integrationsMap.values()), + ...Array.from(authorizersMap.values()), + ], + }, ); } + const routeResources: pulumi.Output[] = []; + for (const [routeKey, routeInput] of Object.entries(routes)) { + if (!pulumi.Output.isInstance(routeInput) && !isPromise(routeInput)) { + routeResources.push(pulumi.output(makeRoute(routeKey, routeInput))); + } else { + routeResources.push(pulumi.output(routeInput).apply((route) => makeRoute(routeKey, route))); + } + } - const stageResources: aws.apigatewayv2.Stage[] = []; - for (const [stageKey, stageInput] of Object.entries(stages ?? defaultStages())) { - stageResources.push( - new aws.apigatewayv2.Stage( - `${name}-${stageKey}`, - { - apiId: api.id, - ...stageInput, - }, - { parent }, - ), + function makeStage(stageKey: string, stageInput: schema.HttpStageInputs) { + return new aws.apigatewayv2.Stage( + `${name}-${stageKey}`, + { + apiId: api.id, + ...stageInput, + }, + { parent }, ); } + const stageResources: pulumi.Output[] = []; + for (const [stageKey, stageInput] of Object.entries(stages ?? defaultStages())) { + if (!pulumi.Output.isInstance(stageInput) && !isPromise(stageInput)) { + stageResources.push(pulumi.output(makeStage(stageKey, stageInput))); + } else { + stageResources.push(pulumi.output(stageInput).apply((stage) => makeStage(stageKey, stage))); + } + } const deploymentResource = new aws.apigatewayv2.Deployment( `${name}-deployment`, @@ -206,10 +242,8 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema { parent, dependsOn: [...routeResources, ...stageResources] }, ); - const domainResources: aws.apigatewayv2.DomainName[] = []; - const apiMappingResources: aws.apigatewayv2.ApiMapping[] = []; - for (const [domainName, domainInput] of Object.entries(domainMappings ?? {})) { - const { domainConfiguration, domainId, ...apiMappingArgs } = domainInput; + function makeDomainMapping(domainName: string, domainMappingInput: schema.DomainMappingInputs) { + const { domainConfiguration, domainId, ...apiMappingArgs } = domainMappingInput; if ( (domainId === undefined && domainConfiguration === undefined) || (domainId !== undefined && domainConfiguration !== undefined) @@ -220,8 +254,9 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema } let resolvedDomainId = domainId; const domainResourceName = domainName.replace(/\W+/g, "-"); + let domainResource: aws.apigatewayv2.DomainName | undefined; if (domainConfiguration !== undefined) { - const domain = new aws.apigatewayv2.DomainName( + domainResource = new aws.apigatewayv2.DomainName( `${name}-${domainResourceName}`, { domainName: domainName, @@ -229,27 +264,47 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema }, { parent }, ); - domainResources.push(domain); - resolvedDomainId = domain.id; + resolvedDomainId = domainResource.id; } - apiMappingResources.push( - new aws.apigatewayv2.ApiMapping( - `${name}-${domainResourceName}`, - { - apiId: api.id, - domainName: resolvedDomainId!, - ...apiMappingArgs, - }, - { parent, dependsOn: domainResources }, - ), + const apiMappingResource = new aws.apigatewayv2.ApiMapping( + `${name}-${domainResourceName}`, + { + apiId: api.id, + domainName: resolvedDomainId!, + ...apiMappingArgs, + }, + { + parent, + dependsOn: pulumi + .output(domainResources) + .apply((r) => r.filter((d) => d !== undefined)) as any, + }, ); + return { apiMappingResource, domainResource }; + } + const domainResources: pulumi.Output[] = []; + const apiMappingResources: pulumi.Output[] = []; + for (const [domainName, domainInput] of Object.entries(domainMappings ?? {})) { + if (!pulumi.Output.isInstance(domainInput) && !isPromise(domainInput)) { + const { apiMappingResource, domainResource } = makeDomainMapping(domainName, domainInput); + if (domainResource !== undefined) { + domainResources.push(pulumi.output(domainResource)); + } + apiMappingResources.push(pulumi.output(apiMappingResource)); + } else { + const createdResources = pulumi + .output(domainInput) + .apply((domain) => makeDomainMapping(domainName, domain)); + domainResources.push(createdResources.domainResource); + apiMappingResources.push(createdResources.apiMappingResource); + } } return { api, routes: routeResources, - integrations: integrationResources, - authorizers: authorizerResources, + integrations: Array.from(integrationsMap.values()), + authorizers: Array.from(authorizersMap.values()), stages: stageResources, deployment: deploymentResource, domainNames: domainResources, diff --git a/awsx/schema-types.ts b/awsx/schema-types.ts index 9e8a02d44..9a5819340 100644 --- a/awsx/schema-types.ts +++ b/awsx/schema-types.ts @@ -40,18 +40,18 @@ export abstract class HttpApi extends (pulumi.ComponentResource); - readonly authorizers?: Record; + readonly authorizers?: Record>; readonly body?: pulumi.Input; readonly corsConfiguration?: pulumi.Input; readonly description?: pulumi.Input; readonly disableExecuteApiEndpoint?: pulumi.Input; - readonly domainMappings?: Record; + readonly domainMappings?: Record>; readonly failOnWarnings?: pulumi.Input; - readonly integrations?: Record; + readonly integrations?: Record>; readonly name?: pulumi.Input; readonly routeSelectionExpression?: pulumi.Input; - readonly routes: Record; - readonly stages?: Record; + readonly routes: Record>; + readonly stages?: Record>; readonly tags?: pulumi.Input>>; readonly version?: pulumi.Input; } diff --git a/schema.json b/schema.json index a77eef17a..a763b42e6 100644 --- a/schema.json +++ b/schema.json @@ -2113,8 +2113,7 @@ "authorizers": { "type": "object", "additionalProperties": { - "$ref": "#/types/awsx:apigatewayv2:HttpAuthorizer", - "plain": true + "$ref": "#/types/awsx:apigatewayv2:HttpAuthorizer" }, "plain": true, "description": "The authorizers for the HTTP API routes." @@ -2138,8 +2137,7 @@ "domainMappings": { "type": "object", "additionalProperties": { - "$ref": "#/types/awsx:apigatewayv2:DomainMapping", - "plain": true + "$ref": "#/types/awsx:apigatewayv2:DomainMapping" }, "plain": true, "description": "The domain names for the HTTP API." @@ -2151,8 +2149,7 @@ "integrations": { "type": "object", "additionalProperties": { - "$ref": "#/types/awsx:apigatewayv2:HttpIntegration", - "plain": true + "$ref": "#/types/awsx:apigatewayv2:HttpIntegration" }, "plain": true, "description": "A map of integrations keyed by name for the HTTP API routes." @@ -2168,8 +2165,7 @@ "routes": { "type": "object", "additionalProperties": { - "$ref": "#/types/awsx:apigatewayv2:HttpRoute", - "plain": true + "$ref": "#/types/awsx:apigatewayv2:HttpRoute" }, "plain": true, "description": "The routes for the HTTP API." @@ -2177,8 +2173,7 @@ "stages": { "type": "object", "additionalProperties": { - "$ref": "#/types/awsx:apigatewayv2:HttpStage", - "plain": true + "$ref": "#/types/awsx:apigatewayv2:HttpStage" }, "plain": true, "description": "The deployment stages for the HTTP API." diff --git a/schemagen/pkg/gen/apigatewayv2.go b/schemagen/pkg/gen/apigatewayv2.go index f99945637..d3d9d2fca 100644 --- a/schemagen/pkg/gen/apigatewayv2.go +++ b/schemagen/pkg/gen/apigatewayv2.go @@ -263,8 +263,7 @@ func plainStringMapOfLocalRefs(module, name string) schema.TypeSpec { return schema.TypeSpec{ Type: "object", AdditionalProperties: &schema.TypeSpec{ - Ref: localRef(module, name), - Plain: true, + Ref: localRef(module, name), }, Plain: true, } diff --git a/sdk/dotnet/Apigatewayv2/HttpApi.cs b/sdk/dotnet/Apigatewayv2/HttpApi.cs index 4709bb379..ee90f5110 100644 --- a/sdk/dotnet/Apigatewayv2/HttpApi.cs +++ b/sdk/dotnet/Apigatewayv2/HttpApi.cs @@ -100,14 +100,14 @@ public sealed class HttpApiArgs : global::Pulumi.ResourceArgs public Input? ApiKeySelectionExpression { get; set; } [Input("authorizers")] - private Dictionary? _authorizers; + private Dictionary>? _authorizers; /// /// The authorizers for the HTTP API routes. /// - public Dictionary Authorizers + public Dictionary> Authorizers { - get => _authorizers ?? (_authorizers = new Dictionary()); + get => _authorizers ?? (_authorizers = new Dictionary>()); set => _authorizers = value; } @@ -138,14 +138,14 @@ public sealed class HttpApiArgs : global::Pulumi.ResourceArgs public Input? DisableExecuteApiEndpoint { get; set; } [Input("domainMappings")] - private Dictionary? _domainMappings; + private Dictionary>? _domainMappings; /// /// The domain names for the HTTP API. /// - public Dictionary DomainMappings + public Dictionary> DomainMappings { - get => _domainMappings ?? (_domainMappings = new Dictionary()); + get => _domainMappings ?? (_domainMappings = new Dictionary>()); set => _domainMappings = value; } @@ -156,14 +156,14 @@ public sealed class HttpApiArgs : global::Pulumi.ResourceArgs public Input? FailOnWarnings { get; set; } [Input("integrations")] - private Dictionary? _integrations; + private Dictionary>? _integrations; /// /// A map of integrations keyed by name for the HTTP API routes. /// - public Dictionary Integrations + public Dictionary> Integrations { - get => _integrations ?? (_integrations = new Dictionary()); + get => _integrations ?? (_integrations = new Dictionary>()); set => _integrations = value; } @@ -181,26 +181,26 @@ public sealed class HttpApiArgs : global::Pulumi.ResourceArgs public Input? RouteSelectionExpression { get; set; } [Input("routes", required: true)] - private Dictionary? _routes; + private Dictionary>? _routes; /// /// The routes for the HTTP API. /// - public Dictionary Routes + public Dictionary> Routes { - get => _routes ?? (_routes = new Dictionary()); + get => _routes ?? (_routes = new Dictionary>()); set => _routes = value; } [Input("stages")] - private Dictionary? _stages; + private Dictionary>? _stages; /// /// The deployment stages for the HTTP API. /// - public Dictionary Stages + public Dictionary> Stages { - get => _stages ?? (_stages = new Dictionary()); + get => _stages ?? (_stages = new Dictionary>()); set => _stages = value; } diff --git a/sdk/go/awsx/apigatewayv2/httpApi.go b/sdk/go/awsx/apigatewayv2/httpApi.go index a0fb975bc..c0e50eb3a 100644 --- a/sdk/go/awsx/apigatewayv2/httpApi.go +++ b/sdk/go/awsx/apigatewayv2/httpApi.go @@ -100,7 +100,7 @@ type HttpApiArgs struct { // Applicable for WebSocket APIs. ApiKeySelectionExpression pulumi.StringPtrInput // The authorizers for the HTTP API routes. - Authorizers map[string]HttpAuthorizerArgs + Authorizers map[string]HttpAuthorizerInput // An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. Body pulumi.StringPtrInput // Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. @@ -112,20 +112,20 @@ type HttpApiArgs struct { // To require that clients use a custom domain name to invoke the API, disable the default endpoint. DisableExecuteApiEndpoint pulumi.BoolPtrInput // The domain names for the HTTP API. - DomainMappings map[string]DomainMappingArgs + DomainMappings map[string]DomainMappingInput // Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. FailOnWarnings pulumi.BoolPtrInput // A map of integrations keyed by name for the HTTP API routes. - Integrations map[string]HttpIntegrationArgs + Integrations map[string]HttpIntegrationInput // Name of the API. Must be less than or equal to 128 characters in length. Name pulumi.StringPtrInput // The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. // Defaults to `$request.method $request.path`. RouteSelectionExpression pulumi.StringPtrInput // The routes for the HTTP API. - Routes map[string]HttpRouteArgs + Routes map[string]HttpRouteInput // The deployment stages for the HTTP API. - Stages map[string]HttpStageArgs + Stages map[string]HttpStageInput // Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. Tags pulumi.StringMapInput // Version identifier for the API. Must be between 1 and 64 characters in length. diff --git a/sdk/go/awsx/apigatewayv2/pulumiTypes.go b/sdk/go/awsx/apigatewayv2/pulumiTypes.go index b2e4bac41..daa5c0899 100644 --- a/sdk/go/awsx/apigatewayv2/pulumiTypes.go +++ b/sdk/go/awsx/apigatewayv2/pulumiTypes.go @@ -554,6 +554,166 @@ type DomainMapping struct { Stage string `pulumi:"stage"` } +// DomainMappingInput is an input type that accepts DomainMappingArgs and DomainMappingOutput values. +// You can construct a concrete instance of `DomainMappingInput` via: +// +// DomainMappingArgs{...} +type DomainMappingInput interface { + pulumi.Input + + ToDomainMappingOutput() DomainMappingOutput + ToDomainMappingOutputWithContext(context.Context) DomainMappingOutput +} + +// Manages an Amazon API Gateway Version 2 API mapping. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), +// Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com +// +// ``` +type DomainMappingArgs struct { + // The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). + ApiMappingKey pulumi.StringPtrInput `pulumi:"apiMappingKey"` + // Configuration of the domain name to create. Cannot be specified together with `domainId`. + DomainConfiguration *DomainConfigurationArgs `pulumi:"domainConfiguration"` + // Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + DomainId pulumi.StringPtrInput `pulumi:"domainId"` + // API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. + Stage pulumi.StringInput `pulumi:"stage"` +} + +func (DomainMappingArgs) ElementType() reflect.Type { + return reflect.TypeOf((*DomainMapping)(nil)).Elem() +} + +func (i DomainMappingArgs) ToDomainMappingOutput() DomainMappingOutput { + return i.ToDomainMappingOutputWithContext(context.Background()) +} + +func (i DomainMappingArgs) ToDomainMappingOutputWithContext(ctx context.Context) DomainMappingOutput { + return pulumi.ToOutputWithContext(ctx, i).(DomainMappingOutput) +} + +func (i DomainMappingArgs) ToOutput(ctx context.Context) pulumix.Output[DomainMapping] { + return pulumix.Output[DomainMapping]{ + OutputState: i.ToDomainMappingOutputWithContext(ctx).OutputState, + } +} + +// Manages an Amazon API Gateway Version 2 API mapping. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), +// Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com +// +// ``` +type DomainMappingOutput struct{ *pulumi.OutputState } + +func (DomainMappingOutput) ElementType() reflect.Type { + return reflect.TypeOf((*DomainMapping)(nil)).Elem() +} + +func (o DomainMappingOutput) ToDomainMappingOutput() DomainMappingOutput { + return o +} + +func (o DomainMappingOutput) ToDomainMappingOutputWithContext(ctx context.Context) DomainMappingOutput { + return o +} + +func (o DomainMappingOutput) ToOutput(ctx context.Context) pulumix.Output[DomainMapping] { + return pulumix.Output[DomainMapping]{ + OutputState: o.OutputState, + } +} + +// The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). +func (o DomainMappingOutput) ApiMappingKey() pulumi.StringPtrOutput { + return o.ApplyT(func(v DomainMapping) *string { return v.ApiMappingKey }).(pulumi.StringPtrOutput) +} + +// Configuration of the domain name to create. Cannot be specified together with `domainId`. +func (o DomainMappingOutput) DomainConfiguration() DomainConfigurationPtrOutput { + return o.ApplyT(func(v DomainMapping) *DomainConfiguration { return v.DomainConfiguration }).(DomainConfigurationPtrOutput) +} + +// Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. +func (o DomainMappingOutput) DomainId() pulumi.StringPtrOutput { + return o.ApplyT(func(v DomainMapping) *string { return v.DomainId }).(pulumi.StringPtrOutput) +} + +// API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. +func (o DomainMappingOutput) Stage() pulumi.StringOutput { + return o.ApplyT(func(v DomainMapping) string { return v.Stage }).(pulumi.StringOutput) +} + // Manages an Amazon API Gateway Version 2 authorizer. // More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). // @@ -2197,8 +2357,19 @@ type HttpRoute struct { Target *string `pulumi:"target"` } -// Manages an Amazon API Gateway Version 2 stage. -// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). +// HttpRouteInput is an input type that accepts HttpRouteArgs and HttpRouteOutput values. +// You can construct a concrete instance of `HttpRouteInput` via: +// +// HttpRouteArgs{...} +type HttpRouteInput interface { + pulumi.Input + + ToHttpRouteOutput() HttpRouteOutput + ToHttpRouteOutputWithContext(context.Context) HttpRouteOutput +} + +// Manages an Amazon API Gateway Version 2 route. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html) for [WebSocket](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-develop-routes.html) and [HTTP](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-routes.html) APIs. // // ## Example Usage // ### Basic @@ -2214,8 +2385,61 @@ type HttpRoute struct { // // func main() { // pulumi.Run(func(ctx *pulumi.Context) error { -// _, err := apigatewayv2.NewStage(ctx, "example", &apigatewayv2.StageArgs{ -// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// exampleApi, err := apigatewayv2.NewApi(ctx, "exampleApi", &apigatewayv2.ApiArgs{ +// ProtocolType: pulumi.String("WEBSOCKET"), +// RouteSelectionExpression: pulumi.String("$request.body.action"), +// }) +// if err != nil { +// return err +// } +// _, err = apigatewayv2.NewRoute(ctx, "exampleRoute", &apigatewayv2.RouteArgs{ +// ApiId: exampleApi.ID(), +// RouteKey: pulumi.String("$default"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### HTTP Proxy Integration +// ```go +// package main +// +// import ( +// +// "fmt" +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// exampleApi, err := apigatewayv2.NewApi(ctx, "exampleApi", &apigatewayv2.ApiArgs{ +// ProtocolType: pulumi.String("HTTP"), +// }) +// if err != nil { +// return err +// } +// exampleIntegration, err := apigatewayv2.NewIntegration(ctx, "exampleIntegration", &apigatewayv2.IntegrationArgs{ +// ApiId: exampleApi.ID(), +// IntegrationType: pulumi.String("HTTP_PROXY"), +// IntegrationMethod: pulumi.String("ANY"), +// IntegrationUri: pulumi.String("https://example.com/{proxy}"), +// }) +// if err != nil { +// return err +// } +// _, err = apigatewayv2.NewRoute(ctx, "exampleRoute", &apigatewayv2.RouteArgs{ +// ApiId: exampleApi.ID(), +// RouteKey: pulumi.String("ANY /example/{proxy+}"), +// Target: exampleIntegration.ID().ApplyT(func(id string) (string, error) { +// return fmt.Sprintf("integrations/%v", id), nil +// }).(pulumi.StringOutput), // }) // if err != nil { // return err @@ -2228,53 +2452,522 @@ type HttpRoute struct { // // ## Import // -// Using `pulumi import`, import `aws_apigatewayv2_stage` using the API identifier and stage name. For example: +// Using `pulumi import`, import `aws_apigatewayv2_route` using the API identifier and route identifier. For example: // // ```sh // -// $ pulumi import aws:apigatewayv2/stage:Stage example aabbccddee/example-stage +// $ pulumi import aws:apigatewayv2/route:Route example aabbccddee/1122334 // // ``` // -// -> __Note:__ The API Gateway managed stage created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. -type HttpStage struct { - // Settings for logging access in this stage. - // Use the `aws.apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions). - AccessLogSettings *apigatewayv2.StageAccessLogSettings `pulumi:"accessLogSettings"` - // Whether updates to an API automatically trigger a new deployment. Defaults to `false`. Applicable for HTTP APIs. - AutoDeploy *bool `pulumi:"autoDeploy"` - // Identifier of a client certificate for the stage. Use the `aws.apigateway.ClientCertificate` resource to configure a client certificate. - // Supported only for WebSocket APIs. - ClientCertificateId *string `pulumi:"clientCertificateId"` - // Default route settings for the stage. - DefaultRouteSettings *apigatewayv2.StageDefaultRouteSettings `pulumi:"defaultRouteSettings"` - // Deployment identifier of the stage. Use the `aws.apigatewayv2.Deployment` resource to configure a deployment. - DeploymentId *string `pulumi:"deploymentId"` - // Description for the stage. Must be less than or equal to 1024 characters in length. - Description *string `pulumi:"description"` - // Name of the stage. Must be between 1 and 128 characters in length. - // - // The following arguments are optional: - Name *string `pulumi:"name"` - // Route settings for the stage. - RouteSettings []apigatewayv2.StageRouteSetting `pulumi:"routeSettings"` - // Map that defines the stage variables for the stage. - StageVariables map[string]string `pulumi:"stageVariables"` - // Map of tags to assign to the stage. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. - Tags map[string]string `pulumi:"tags"` +// -> __Note:__ The API Gateway managed route created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. +type HttpRouteArgs struct { + // Boolean whether an API key is required for the route. Defaults to `false`. Supported only for WebSocket APIs. + ApiKeyRequired pulumi.BoolPtrInput `pulumi:"apiKeyRequired"` + // Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation. + AuthorizationScopes pulumi.StringArrayInput `pulumi:"authorizationScopes"` + // Authorization type for the route. + // For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + // For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. + // Defaults to `NONE`. + AuthorizationType pulumi.StringPtrInput `pulumi:"authorizationType"` + // Details of the authorizer to be created for this route. Only one of `authorizer`, `authorizerName` or `target` can be specified. + Authorizer *HttpAuthorizerArgs `pulumi:"authorizer"` + // Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. + AuthorizerId pulumi.StringPtrInput `pulumi:"authorizerId"` + // The name of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. + AuthorizerName pulumi.StringPtrInput `pulumi:"authorizerName"` + // Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified. + Integration *HttpIntegrationArgs `pulumi:"integration"` + // The name of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. Only one of `integration`, `integrationName` or `target` can be specified. This does not need to be prefixed with "integrations/". + IntegrationName pulumi.StringPtrInput `pulumi:"integrationName"` + // Operation name for the route. Must be between 1 and 64 characters in length. + OperationName pulumi.StringPtrInput `pulumi:"operationName"` + // Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. + // Only one of `integration`, `integrationName` or `target` can be specified. + Target pulumi.StringPtrInput `pulumi:"target"` +} + +func (HttpRouteArgs) ElementType() reflect.Type { + return reflect.TypeOf((*HttpRoute)(nil)).Elem() +} + +func (i HttpRouteArgs) ToHttpRouteOutput() HttpRouteOutput { + return i.ToHttpRouteOutputWithContext(context.Background()) +} + +func (i HttpRouteArgs) ToHttpRouteOutputWithContext(ctx context.Context) HttpRouteOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpRouteOutput) +} + +func (i HttpRouteArgs) ToOutput(ctx context.Context) pulumix.Output[HttpRoute] { + return pulumix.Output[HttpRoute]{ + OutputState: i.ToHttpRouteOutputWithContext(ctx).OutputState, + } +} + +// Manages an Amazon API Gateway Version 2 route. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html) for [WebSocket](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-develop-routes.html) and [HTTP](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-routes.html) APIs. +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// exampleApi, err := apigatewayv2.NewApi(ctx, "exampleApi", &apigatewayv2.ApiArgs{ +// ProtocolType: pulumi.String("WEBSOCKET"), +// RouteSelectionExpression: pulumi.String("$request.body.action"), +// }) +// if err != nil { +// return err +// } +// _, err = apigatewayv2.NewRoute(ctx, "exampleRoute", &apigatewayv2.RouteArgs{ +// ApiId: exampleApi.ID(), +// RouteKey: pulumi.String("$default"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// ### HTTP Proxy Integration +// ```go +// package main +// +// import ( +// +// "fmt" +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// exampleApi, err := apigatewayv2.NewApi(ctx, "exampleApi", &apigatewayv2.ApiArgs{ +// ProtocolType: pulumi.String("HTTP"), +// }) +// if err != nil { +// return err +// } +// exampleIntegration, err := apigatewayv2.NewIntegration(ctx, "exampleIntegration", &apigatewayv2.IntegrationArgs{ +// ApiId: exampleApi.ID(), +// IntegrationType: pulumi.String("HTTP_PROXY"), +// IntegrationMethod: pulumi.String("ANY"), +// IntegrationUri: pulumi.String("https://example.com/{proxy}"), +// }) +// if err != nil { +// return err +// } +// _, err = apigatewayv2.NewRoute(ctx, "exampleRoute", &apigatewayv2.RouteArgs{ +// ApiId: exampleApi.ID(), +// RouteKey: pulumi.String("ANY /example/{proxy+}"), +// Target: exampleIntegration.ID().ApplyT(func(id string) (string, error) { +// return fmt.Sprintf("integrations/%v", id), nil +// }).(pulumi.StringOutput), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_route` using the API identifier and route identifier. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/route:Route example aabbccddee/1122334 +// +// ``` +// +// -> __Note:__ The API Gateway managed route created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. +type HttpRouteOutput struct{ *pulumi.OutputState } + +func (HttpRouteOutput) ElementType() reflect.Type { + return reflect.TypeOf((*HttpRoute)(nil)).Elem() +} + +func (o HttpRouteOutput) ToHttpRouteOutput() HttpRouteOutput { + return o +} + +func (o HttpRouteOutput) ToHttpRouteOutputWithContext(ctx context.Context) HttpRouteOutput { + return o +} + +func (o HttpRouteOutput) ToOutput(ctx context.Context) pulumix.Output[HttpRoute] { + return pulumix.Output[HttpRoute]{ + OutputState: o.OutputState, + } +} + +// Boolean whether an API key is required for the route. Defaults to `false`. Supported only for WebSocket APIs. +func (o HttpRouteOutput) ApiKeyRequired() pulumi.BoolPtrOutput { + return o.ApplyT(func(v HttpRoute) *bool { return v.ApiKeyRequired }).(pulumi.BoolPtrOutput) +} + +// Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation. +func (o HttpRouteOutput) AuthorizationScopes() pulumi.StringArrayOutput { + return o.ApplyT(func(v HttpRoute) []string { return v.AuthorizationScopes }).(pulumi.StringArrayOutput) +} + +// Authorization type for the route. +// For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. +// For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. +// Defaults to `NONE`. +func (o HttpRouteOutput) AuthorizationType() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpRoute) *string { return v.AuthorizationType }).(pulumi.StringPtrOutput) +} + +// Details of the authorizer to be created for this route. Only one of `authorizer`, `authorizerName` or `target` can be specified. +func (o HttpRouteOutput) Authorizer() HttpAuthorizerPtrOutput { + return o.ApplyT(func(v HttpRoute) *HttpAuthorizer { return v.Authorizer }).(HttpAuthorizerPtrOutput) +} + +// Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route. +func (o HttpRouteOutput) AuthorizerId() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpRoute) *string { return v.AuthorizerId }).(pulumi.StringPtrOutput) +} + +// The name of the target authorizer for the route specified in the `authorizers` property. This is used to automatically calculate the `authorizerId` property of the route. +func (o HttpRouteOutput) AuthorizerName() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpRoute) *string { return v.AuthorizerName }).(pulumi.StringPtrOutput) +} + +// Details of the integration to be created for this route. Only one of `integration`, `integrationName` or `target` can be specified. +func (o HttpRouteOutput) Integration() HttpIntegrationPtrOutput { + return o.ApplyT(func(v HttpRoute) *HttpIntegration { return v.Integration }).(HttpIntegrationPtrOutput) +} + +// The name of the target integration for the route specified in the `integrations` property. This is used to automatically calculate the `target` property of the route. Only one of `integration`, `integrationName` or `target` can be specified. This does not need to be prefixed with "integrations/". +func (o HttpRouteOutput) IntegrationName() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpRoute) *string { return v.IntegrationName }).(pulumi.StringPtrOutput) +} + +// Operation name for the route. Must be between 1 and 64 characters in length. +func (o HttpRouteOutput) OperationName() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpRoute) *string { return v.OperationName }).(pulumi.StringPtrOutput) +} + +// Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource. +// +// Only one of `integration`, `integrationName` or `target` can be specified. +func (o HttpRouteOutput) Target() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpRoute) *string { return v.Target }).(pulumi.StringPtrOutput) +} + +// Manages an Amazon API Gateway Version 2 stage. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewStage(ctx, "example", &apigatewayv2.StageArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_stage` using the API identifier and stage name. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/stage:Stage example aabbccddee/example-stage +// +// ``` +// +// -> __Note:__ The API Gateway managed stage created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. +type HttpStage struct { + // Settings for logging access in this stage. + // Use the `aws.apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions). + AccessLogSettings *apigatewayv2.StageAccessLogSettings `pulumi:"accessLogSettings"` + // Whether updates to an API automatically trigger a new deployment. Defaults to `false`. Applicable for HTTP APIs. + AutoDeploy *bool `pulumi:"autoDeploy"` + // Identifier of a client certificate for the stage. Use the `aws.apigateway.ClientCertificate` resource to configure a client certificate. + // Supported only for WebSocket APIs. + ClientCertificateId *string `pulumi:"clientCertificateId"` + // Default route settings for the stage. + DefaultRouteSettings *apigatewayv2.StageDefaultRouteSettings `pulumi:"defaultRouteSettings"` + // Deployment identifier of the stage. Use the `aws.apigatewayv2.Deployment` resource to configure a deployment. + DeploymentId *string `pulumi:"deploymentId"` + // Description for the stage. Must be less than or equal to 1024 characters in length. + Description *string `pulumi:"description"` + // Name of the stage. Must be between 1 and 128 characters in length. + // + // The following arguments are optional: + Name *string `pulumi:"name"` + // Route settings for the stage. + RouteSettings []apigatewayv2.StageRouteSetting `pulumi:"routeSettings"` + // Map that defines the stage variables for the stage. + StageVariables map[string]string `pulumi:"stageVariables"` + // Map of tags to assign to the stage. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + Tags map[string]string `pulumi:"tags"` +} + +// HttpStageInput is an input type that accepts HttpStageArgs and HttpStageOutput values. +// You can construct a concrete instance of `HttpStageInput` via: +// +// HttpStageArgs{...} +type HttpStageInput interface { + pulumi.Input + + ToHttpStageOutput() HttpStageOutput + ToHttpStageOutputWithContext(context.Context) HttpStageOutput +} + +// Manages an Amazon API Gateway Version 2 stage. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewStage(ctx, "example", &apigatewayv2.StageArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_stage` using the API identifier and stage name. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/stage:Stage example aabbccddee/example-stage +// +// ``` +// +// -> __Note:__ The API Gateway managed stage created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. +type HttpStageArgs struct { + // Settings for logging access in this stage. + // Use the `aws.apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions). + AccessLogSettings apigatewayv2.StageAccessLogSettingsPtrInput `pulumi:"accessLogSettings"` + // Whether updates to an API automatically trigger a new deployment. Defaults to `false`. Applicable for HTTP APIs. + AutoDeploy pulumi.BoolPtrInput `pulumi:"autoDeploy"` + // Identifier of a client certificate for the stage. Use the `aws.apigateway.ClientCertificate` resource to configure a client certificate. + // Supported only for WebSocket APIs. + ClientCertificateId pulumi.StringPtrInput `pulumi:"clientCertificateId"` + // Default route settings for the stage. + DefaultRouteSettings apigatewayv2.StageDefaultRouteSettingsPtrInput `pulumi:"defaultRouteSettings"` + // Deployment identifier of the stage. Use the `aws.apigatewayv2.Deployment` resource to configure a deployment. + DeploymentId pulumi.StringPtrInput `pulumi:"deploymentId"` + // Description for the stage. Must be less than or equal to 1024 characters in length. + Description pulumi.StringPtrInput `pulumi:"description"` + // Name of the stage. Must be between 1 and 128 characters in length. + // + // The following arguments are optional: + Name pulumi.StringPtrInput `pulumi:"name"` + // Route settings for the stage. + RouteSettings apigatewayv2.StageRouteSettingArrayInput `pulumi:"routeSettings"` + // Map that defines the stage variables for the stage. + StageVariables pulumi.StringMapInput `pulumi:"stageVariables"` + // Map of tags to assign to the stage. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. + Tags pulumi.StringMapInput `pulumi:"tags"` +} + +func (HttpStageArgs) ElementType() reflect.Type { + return reflect.TypeOf((*HttpStage)(nil)).Elem() +} + +func (i HttpStageArgs) ToHttpStageOutput() HttpStageOutput { + return i.ToHttpStageOutputWithContext(context.Background()) +} + +func (i HttpStageArgs) ToHttpStageOutputWithContext(ctx context.Context) HttpStageOutput { + return pulumi.ToOutputWithContext(ctx, i).(HttpStageOutput) +} + +func (i HttpStageArgs) ToOutput(ctx context.Context) pulumix.Output[HttpStage] { + return pulumix.Output[HttpStage]{ + OutputState: i.ToHttpStageOutputWithContext(ctx).OutputState, + } +} + +// Manages an Amazon API Gateway Version 2 stage. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewStage(ctx, "example", &apigatewayv2.StageArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_stage` using the API identifier and stage name. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/stage:Stage example aabbccddee/example-stage +// +// ``` +// +// -> __Note:__ The API Gateway managed stage created as part of [_quick_create_](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported. +type HttpStageOutput struct{ *pulumi.OutputState } + +func (HttpStageOutput) ElementType() reflect.Type { + return reflect.TypeOf((*HttpStage)(nil)).Elem() +} + +func (o HttpStageOutput) ToHttpStageOutput() HttpStageOutput { + return o +} + +func (o HttpStageOutput) ToHttpStageOutputWithContext(ctx context.Context) HttpStageOutput { + return o +} + +func (o HttpStageOutput) ToOutput(ctx context.Context) pulumix.Output[HttpStage] { + return pulumix.Output[HttpStage]{ + OutputState: o.OutputState, + } +} + +// Settings for logging access in this stage. +// Use the `aws.apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions). +func (o HttpStageOutput) AccessLogSettings() apigatewayv2.StageAccessLogSettingsPtrOutput { + return o.ApplyT(func(v HttpStage) *apigatewayv2.StageAccessLogSettings { return v.AccessLogSettings }).(apigatewayv2.StageAccessLogSettingsPtrOutput) +} + +// Whether updates to an API automatically trigger a new deployment. Defaults to `false`. Applicable for HTTP APIs. +func (o HttpStageOutput) AutoDeploy() pulumi.BoolPtrOutput { + return o.ApplyT(func(v HttpStage) *bool { return v.AutoDeploy }).(pulumi.BoolPtrOutput) +} + +// Identifier of a client certificate for the stage. Use the `aws.apigateway.ClientCertificate` resource to configure a client certificate. +// Supported only for WebSocket APIs. +func (o HttpStageOutput) ClientCertificateId() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpStage) *string { return v.ClientCertificateId }).(pulumi.StringPtrOutput) +} + +// Default route settings for the stage. +func (o HttpStageOutput) DefaultRouteSettings() apigatewayv2.StageDefaultRouteSettingsPtrOutput { + return o.ApplyT(func(v HttpStage) *apigatewayv2.StageDefaultRouteSettings { return v.DefaultRouteSettings }).(apigatewayv2.StageDefaultRouteSettingsPtrOutput) +} + +// Deployment identifier of the stage. Use the `aws.apigatewayv2.Deployment` resource to configure a deployment. +func (o HttpStageOutput) DeploymentId() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpStage) *string { return v.DeploymentId }).(pulumi.StringPtrOutput) +} + +// Description for the stage. Must be less than or equal to 1024 characters in length. +func (o HttpStageOutput) Description() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpStage) *string { return v.Description }).(pulumi.StringPtrOutput) +} + +// Name of the stage. Must be between 1 and 128 characters in length. +// +// The following arguments are optional: +func (o HttpStageOutput) Name() pulumi.StringPtrOutput { + return o.ApplyT(func(v HttpStage) *string { return v.Name }).(pulumi.StringPtrOutput) +} + +// Route settings for the stage. +func (o HttpStageOutput) RouteSettings() apigatewayv2.StageRouteSettingArrayOutput { + return o.ApplyT(func(v HttpStage) []apigatewayv2.StageRouteSetting { return v.RouteSettings }).(apigatewayv2.StageRouteSettingArrayOutput) +} + +// Map that defines the stage variables for the stage. +func (o HttpStageOutput) StageVariables() pulumi.StringMapOutput { + return o.ApplyT(func(v HttpStage) map[string]string { return v.StageVariables }).(pulumi.StringMapOutput) +} + +// Map of tags to assign to the stage. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. +func (o HttpStageOutput) Tags() pulumi.StringMapOutput { + return o.ApplyT(func(v HttpStage) map[string]string { return v.Tags }).(pulumi.StringMapOutput) } func init() { pulumi.RegisterInputType(reflect.TypeOf((*DomainConfigurationInput)(nil)).Elem(), DomainConfigurationArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*DomainConfigurationPtrInput)(nil)).Elem(), DomainConfigurationArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*DomainMappingInput)(nil)).Elem(), DomainMappingArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*HttpAuthorizerInput)(nil)).Elem(), HttpAuthorizerArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*HttpAuthorizerPtrInput)(nil)).Elem(), HttpAuthorizerArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*HttpIntegrationInput)(nil)).Elem(), HttpIntegrationArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*HttpIntegrationPtrInput)(nil)).Elem(), HttpIntegrationArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpRouteInput)(nil)).Elem(), HttpRouteArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*HttpStageInput)(nil)).Elem(), HttpStageArgs{}) pulumi.RegisterOutputType(DomainConfigurationOutput{}) pulumi.RegisterOutputType(DomainConfigurationPtrOutput{}) + pulumi.RegisterOutputType(DomainMappingOutput{}) pulumi.RegisterOutputType(HttpAuthorizerOutput{}) pulumi.RegisterOutputType(HttpAuthorizerPtrOutput{}) pulumi.RegisterOutputType(HttpIntegrationOutput{}) pulumi.RegisterOutputType(HttpIntegrationPtrOutput{}) + pulumi.RegisterOutputType(HttpRouteOutput{}) + pulumi.RegisterOutputType(HttpStageOutput{}) } diff --git a/sdk/nodejs/apigatewayv2/httpApi.ts b/sdk/nodejs/apigatewayv2/httpApi.ts index 4e122d939..15a9f5502 100644 --- a/sdk/nodejs/apigatewayv2/httpApi.ts +++ b/sdk/nodejs/apigatewayv2/httpApi.ts @@ -121,7 +121,7 @@ export interface HttpApiArgs { /** * The authorizers for the HTTP API routes. */ - authorizers?: {[key: string]: inputs.apigatewayv2.HttpAuthorizerArgs}; + authorizers?: {[key: string]: pulumi.Input}; /** * An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. */ @@ -143,7 +143,7 @@ export interface HttpApiArgs { /** * The domain names for the HTTP API. */ - domainMappings?: {[key: string]: inputs.apigatewayv2.DomainMappingArgs}; + domainMappings?: {[key: string]: pulumi.Input}; /** * Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. */ @@ -151,7 +151,7 @@ export interface HttpApiArgs { /** * A map of integrations keyed by name for the HTTP API routes. */ - integrations?: {[key: string]: inputs.apigatewayv2.HttpIntegrationArgs}; + integrations?: {[key: string]: pulumi.Input}; /** * Name of the API. Must be less than or equal to 128 characters in length. */ @@ -164,11 +164,11 @@ export interface HttpApiArgs { /** * The routes for the HTTP API. */ - routes: {[key: string]: inputs.apigatewayv2.HttpRouteArgs}; + routes: {[key: string]: pulumi.Input}; /** * The deployment stages for the HTTP API. */ - stages?: {[key: string]: inputs.apigatewayv2.HttpStageArgs}; + stages?: {[key: string]: pulumi.Input}; /** * Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ diff --git a/sdk/python/pulumi_awsx/apigatewayv2/http_api.py b/sdk/python/pulumi_awsx/apigatewayv2/http_api.py index 9d0f7e811..ba0970c10 100644 --- a/sdk/python/pulumi_awsx/apigatewayv2/http_api.py +++ b/sdk/python/pulumi_awsx/apigatewayv2/http_api.py @@ -16,41 +16,41 @@ @pulumi.input_type class HttpApiArgs: def __init__(__self__, *, - routes: Mapping[str, 'HttpRouteArgs'], + routes: Mapping[str, pulumi.Input['HttpRouteArgs']], api_key_selection_expression: Optional[pulumi.Input[str]] = None, - authorizers: Optional[Mapping[str, 'HttpAuthorizerArgs']] = None, + authorizers: Optional[Mapping[str, pulumi.Input['HttpAuthorizerArgs']]] = None, body: Optional[pulumi.Input[str]] = None, cors_configuration: Optional[pulumi.Input['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs']] = None, description: Optional[pulumi.Input[str]] = None, disable_execute_api_endpoint: Optional[pulumi.Input[bool]] = None, - domain_mappings: Optional[Mapping[str, 'DomainMappingArgs']] = None, + domain_mappings: Optional[Mapping[str, pulumi.Input['DomainMappingArgs']]] = None, fail_on_warnings: Optional[pulumi.Input[bool]] = None, - integrations: Optional[Mapping[str, 'HttpIntegrationArgs']] = None, + integrations: Optional[Mapping[str, pulumi.Input['HttpIntegrationArgs']]] = None, name: Optional[pulumi.Input[str]] = None, route_selection_expression: Optional[pulumi.Input[str]] = None, - stages: Optional[Mapping[str, 'HttpStageArgs']] = None, + stages: Optional[Mapping[str, pulumi.Input['HttpStageArgs']]] = None, tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, version: Optional[pulumi.Input[str]] = None): """ The set of arguments for constructing a HttpApi resource. - :param Mapping[str, 'HttpRouteArgs'] routes: The routes for the HTTP API. + :param Mapping[str, pulumi.Input['HttpRouteArgs']] routes: The routes for the HTTP API. :param pulumi.Input[str] api_key_selection_expression: An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. Applicable for WebSocket APIs. - :param Mapping[str, 'HttpAuthorizerArgs'] authorizers: The authorizers for the HTTP API routes. + :param Mapping[str, pulumi.Input['HttpAuthorizerArgs']] authorizers: The authorizers for the HTTP API routes. :param pulumi.Input[str] body: An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. :param pulumi.Input['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs'] cors_configuration: Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. :param pulumi.Input[str] description: Description of the API. Must be less than or equal to 1024 characters in length. :param pulumi.Input[bool] disable_execute_api_endpoint: Whether clients can invoke the API by using the default `execute-api` endpoint. By default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`. To require that clients use a custom domain name to invoke the API, disable the default endpoint. - :param Mapping[str, 'DomainMappingArgs'] domain_mappings: The domain names for the HTTP API. + :param Mapping[str, pulumi.Input['DomainMappingArgs']] domain_mappings: The domain names for the HTTP API. :param pulumi.Input[bool] fail_on_warnings: Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. - :param Mapping[str, 'HttpIntegrationArgs'] integrations: A map of integrations keyed by name for the HTTP API routes. + :param Mapping[str, pulumi.Input['HttpIntegrationArgs']] integrations: A map of integrations keyed by name for the HTTP API routes. :param pulumi.Input[str] name: Name of the API. Must be less than or equal to 128 characters in length. :param pulumi.Input[str] route_selection_expression: The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. Defaults to `$request.method $request.path`. - :param Mapping[str, 'HttpStageArgs'] stages: The deployment stages for the HTTP API. + :param Mapping[str, pulumi.Input['HttpStageArgs']] stages: The deployment stages for the HTTP API. :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. :param pulumi.Input[str] version: Version identifier for the API. Must be between 1 and 64 characters in length. """ @@ -86,14 +86,14 @@ def __init__(__self__, *, @property @pulumi.getter - def routes(self) -> Mapping[str, 'HttpRouteArgs']: + def routes(self) -> Mapping[str, pulumi.Input['HttpRouteArgs']]: """ The routes for the HTTP API. """ return pulumi.get(self, "routes") @routes.setter - def routes(self, value: Mapping[str, 'HttpRouteArgs']): + def routes(self, value: Mapping[str, pulumi.Input['HttpRouteArgs']]): pulumi.set(self, "routes", value) @property @@ -112,14 +112,14 @@ def api_key_selection_expression(self, value: Optional[pulumi.Input[str]]): @property @pulumi.getter - def authorizers(self) -> Optional[Mapping[str, 'HttpAuthorizerArgs']]: + def authorizers(self) -> Optional[Mapping[str, pulumi.Input['HttpAuthorizerArgs']]]: """ The authorizers for the HTTP API routes. """ return pulumi.get(self, "authorizers") @authorizers.setter - def authorizers(self, value: Optional[Mapping[str, 'HttpAuthorizerArgs']]): + def authorizers(self, value: Optional[Mapping[str, pulumi.Input['HttpAuthorizerArgs']]]): pulumi.set(self, "authorizers", value) @property @@ -174,14 +174,14 @@ def disable_execute_api_endpoint(self, value: Optional[pulumi.Input[bool]]): @property @pulumi.getter(name="domainMappings") - def domain_mappings(self) -> Optional[Mapping[str, 'DomainMappingArgs']]: + def domain_mappings(self) -> Optional[Mapping[str, pulumi.Input['DomainMappingArgs']]]: """ The domain names for the HTTP API. """ return pulumi.get(self, "domain_mappings") @domain_mappings.setter - def domain_mappings(self, value: Optional[Mapping[str, 'DomainMappingArgs']]): + def domain_mappings(self, value: Optional[Mapping[str, pulumi.Input['DomainMappingArgs']]]): pulumi.set(self, "domain_mappings", value) @property @@ -198,14 +198,14 @@ def fail_on_warnings(self, value: Optional[pulumi.Input[bool]]): @property @pulumi.getter - def integrations(self) -> Optional[Mapping[str, 'HttpIntegrationArgs']]: + def integrations(self) -> Optional[Mapping[str, pulumi.Input['HttpIntegrationArgs']]]: """ A map of integrations keyed by name for the HTTP API routes. """ return pulumi.get(self, "integrations") @integrations.setter - def integrations(self, value: Optional[Mapping[str, 'HttpIntegrationArgs']]): + def integrations(self, value: Optional[Mapping[str, pulumi.Input['HttpIntegrationArgs']]]): pulumi.set(self, "integrations", value) @property @@ -235,14 +235,14 @@ def route_selection_expression(self, value: Optional[pulumi.Input[str]]): @property @pulumi.getter - def stages(self) -> Optional[Mapping[str, 'HttpStageArgs']]: + def stages(self) -> Optional[Mapping[str, pulumi.Input['HttpStageArgs']]]: """ The deployment stages for the HTTP API. """ return pulumi.get(self, "stages") @stages.setter - def stages(self, value: Optional[Mapping[str, 'HttpStageArgs']]): + def stages(self, value: Optional[Mapping[str, pulumi.Input['HttpStageArgs']]]): pulumi.set(self, "stages", value) @property @@ -276,18 +276,18 @@ def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, api_key_selection_expression: Optional[pulumi.Input[str]] = None, - authorizers: Optional[Mapping[str, pulumi.InputType['HttpAuthorizerArgs']]] = None, + authorizers: Optional[Mapping[str, pulumi.Input[pulumi.InputType['HttpAuthorizerArgs']]]] = None, body: Optional[pulumi.Input[str]] = None, cors_configuration: Optional[pulumi.Input[pulumi.InputType['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs']]] = None, description: Optional[pulumi.Input[str]] = None, disable_execute_api_endpoint: Optional[pulumi.Input[bool]] = None, - domain_mappings: Optional[Mapping[str, pulumi.InputType['DomainMappingArgs']]] = None, + domain_mappings: Optional[Mapping[str, pulumi.Input[pulumi.InputType['DomainMappingArgs']]]] = None, fail_on_warnings: Optional[pulumi.Input[bool]] = None, - integrations: Optional[Mapping[str, pulumi.InputType['HttpIntegrationArgs']]] = None, + integrations: Optional[Mapping[str, pulumi.Input[pulumi.InputType['HttpIntegrationArgs']]]] = None, name: Optional[pulumi.Input[str]] = None, route_selection_expression: Optional[pulumi.Input[str]] = None, - routes: Optional[Mapping[str, pulumi.InputType['HttpRouteArgs']]] = None, - stages: Optional[Mapping[str, pulumi.InputType['HttpStageArgs']]] = None, + routes: Optional[Mapping[str, pulumi.Input[pulumi.InputType['HttpRouteArgs']]]] = None, + stages: Optional[Mapping[str, pulumi.Input[pulumi.InputType['HttpStageArgs']]]] = None, tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, version: Optional[pulumi.Input[str]] = None, __props__=None): @@ -299,21 +299,21 @@ def __init__(__self__, :param pulumi.Input[str] api_key_selection_expression: An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions). Valid values: `$context.authorizer.usageIdentifierKey`, `$request.header.x-api-key`. Defaults to `$request.header.x-api-key`. Applicable for WebSocket APIs. - :param Mapping[str, pulumi.InputType['HttpAuthorizerArgs']] authorizers: The authorizers for the HTTP API routes. + :param Mapping[str, pulumi.Input[pulumi.InputType['HttpAuthorizerArgs']]] authorizers: The authorizers for the HTTP API routes. :param pulumi.Input[str] body: An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs. :param pulumi.Input[pulumi.InputType['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs']] cors_configuration: Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html). Applicable for HTTP APIs. :param pulumi.Input[str] description: Description of the API. Must be less than or equal to 1024 characters in length. :param pulumi.Input[bool] disable_execute_api_endpoint: Whether clients can invoke the API by using the default `execute-api` endpoint. By default, clients can invoke the API with the default `{api_id}.execute-api.{region}.amazonaws.com endpoint`. To require that clients use a custom domain name to invoke the API, disable the default endpoint. - :param Mapping[str, pulumi.InputType['DomainMappingArgs']] domain_mappings: The domain names for the HTTP API. + :param Mapping[str, pulumi.Input[pulumi.InputType['DomainMappingArgs']]] domain_mappings: The domain names for the HTTP API. :param pulumi.Input[bool] fail_on_warnings: Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs. - :param Mapping[str, pulumi.InputType['HttpIntegrationArgs']] integrations: A map of integrations keyed by name for the HTTP API routes. + :param Mapping[str, pulumi.Input[pulumi.InputType['HttpIntegrationArgs']]] integrations: A map of integrations keyed by name for the HTTP API routes. :param pulumi.Input[str] name: Name of the API. Must be less than or equal to 128 characters in length. :param pulumi.Input[str] route_selection_expression: The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API. Defaults to `$request.method $request.path`. - :param Mapping[str, pulumi.InputType['HttpRouteArgs']] routes: The routes for the HTTP API. - :param Mapping[str, pulumi.InputType['HttpStageArgs']] stages: The deployment stages for the HTTP API. + :param Mapping[str, pulumi.Input[pulumi.InputType['HttpRouteArgs']]] routes: The routes for the HTTP API. + :param Mapping[str, pulumi.Input[pulumi.InputType['HttpStageArgs']]] stages: The deployment stages for the HTTP API. :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Map of tags to assign to the API. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. :param pulumi.Input[str] version: Version identifier for the API. Must be between 1 and 64 characters in length. """ @@ -342,18 +342,18 @@ def _internal_init(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, api_key_selection_expression: Optional[pulumi.Input[str]] = None, - authorizers: Optional[Mapping[str, pulumi.InputType['HttpAuthorizerArgs']]] = None, + authorizers: Optional[Mapping[str, pulumi.Input[pulumi.InputType['HttpAuthorizerArgs']]]] = None, body: Optional[pulumi.Input[str]] = None, cors_configuration: Optional[pulumi.Input[pulumi.InputType['pulumi_aws.apigatewayv2.ApiCorsConfigurationArgs']]] = None, description: Optional[pulumi.Input[str]] = None, disable_execute_api_endpoint: Optional[pulumi.Input[bool]] = None, - domain_mappings: Optional[Mapping[str, pulumi.InputType['DomainMappingArgs']]] = None, + domain_mappings: Optional[Mapping[str, pulumi.Input[pulumi.InputType['DomainMappingArgs']]]] = None, fail_on_warnings: Optional[pulumi.Input[bool]] = None, - integrations: Optional[Mapping[str, pulumi.InputType['HttpIntegrationArgs']]] = None, + integrations: Optional[Mapping[str, pulumi.Input[pulumi.InputType['HttpIntegrationArgs']]]] = None, name: Optional[pulumi.Input[str]] = None, route_selection_expression: Optional[pulumi.Input[str]] = None, - routes: Optional[Mapping[str, pulumi.InputType['HttpRouteArgs']]] = None, - stages: Optional[Mapping[str, pulumi.InputType['HttpStageArgs']]] = None, + routes: Optional[Mapping[str, pulumi.Input[pulumi.InputType['HttpRouteArgs']]]] = None, + stages: Optional[Mapping[str, pulumi.Input[pulumi.InputType['HttpStageArgs']]]] = None, tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, version: Optional[pulumi.Input[str]] = None, __props__=None): From e51205aae56a0b7fb529c84f4d2bf69ab666123b Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Mon, 27 Nov 2023 14:47:35 +0000 Subject: [PATCH 17/18] Skip autonaming for stages These names only have to be unique within the API. Skipping autonaming makes the created name and therefore URL predictable. --- awsx/apigatewayv2/httpApi.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts index 79650eaa9..3d2b537e6 100644 --- a/awsx/apigatewayv2/httpApi.ts +++ b/awsx/apigatewayv2/httpApi.ts @@ -220,6 +220,7 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema `${name}-${stageKey}`, { apiId: api.id, + name: stageKey, ...stageInput, }, { parent }, From 3d7688f96dcfef910a1ee83739fac57fd5355f83 Mon Sep 17 00:00:00 2001 From: Daniel Bradley Date: Mon, 27 Nov 2023 15:49:44 +0000 Subject: [PATCH 18/18] Rename domain properties - Rename DomainConfiguration type and property to DomainName to match original resource name. --- awsx/apigatewayv2/httpApi.ts | 18 +- awsx/schema-types.ts | 24 +- schema.json | 54 +- schemagen/pkg/gen/apigatewayv2.go | 22 +- .../Apigatewayv2/Inputs/DomainMappingArgs.cs | 12 +- ...ConfigurationArgs.cs => DomainNameArgs.cs} | 6 +- sdk/go/awsx/apigatewayv2/pulumiTypes.go | 582 +++++++++--------- .../inputs/DomainMappingArgs.java | 48 +- ...igurationArgs.java => DomainNameArgs.java} | 20 +- sdk/nodejs/types/input.ts | 276 ++++----- .../pulumi_awsx/apigatewayv2/_inputs.py | 376 +++++------ 11 files changed, 717 insertions(+), 721 deletions(-) rename sdk/dotnet/Apigatewayv2/Inputs/{DomainConfigurationArgs.cs => DomainNameArgs.cs} (98%) rename sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/{DomainConfigurationArgs.java => DomainNameArgs.java} (93%) diff --git a/awsx/apigatewayv2/httpApi.ts b/awsx/apigatewayv2/httpApi.ts index 3d2b537e6..3c00bf52a 100644 --- a/awsx/apigatewayv2/httpApi.ts +++ b/awsx/apigatewayv2/httpApi.ts @@ -243,25 +243,25 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema { parent, dependsOn: [...routeResources, ...stageResources] }, ); - function makeDomainMapping(domainName: string, domainMappingInput: schema.DomainMappingInputs) { - const { domainConfiguration, domainId, ...apiMappingArgs } = domainMappingInput; + function makeDomainMapping(domainKey: string, domainMappingInput: schema.DomainMappingInputs) { + const { domainName, domainId, ...apiMappingArgs } = domainMappingInput; if ( - (domainId === undefined && domainConfiguration === undefined) || - (domainId !== undefined && domainConfiguration !== undefined) + (domainId === undefined && domainName === undefined) || + (domainId !== undefined && domainName !== undefined) ) { throw new Error( - `Exactly one of domainId or domainConfiguration must be specified for domain ${domainName}`, + `Exactly one of domainId or domainConfiguration must be specified for domain ${domainKey}`, ); } let resolvedDomainId = domainId; - const domainResourceName = domainName.replace(/\W+/g, "-"); + const domainResourceName = domainKey.replace(/\W+/g, "-"); let domainResource: aws.apigatewayv2.DomainName | undefined; - if (domainConfiguration !== undefined) { + if (domainName !== undefined) { domainResource = new aws.apigatewayv2.DomainName( `${name}-${domainResourceName}`, { - domainName: domainName, - ...domainConfiguration, + domainName: domainKey, + ...domainName, }, { parent }, ); diff --git a/awsx/schema-types.ts b/awsx/schema-types.ts index 9a5819340..e593f2a76 100644 --- a/awsx/schema-types.ts +++ b/awsx/schema-types.ts @@ -388,28 +388,28 @@ export interface TargetGroupAttachmentArgs { readonly targetGroup?: pulumi.Input; readonly targetGroupArn?: pulumi.Input; } -export interface DomainConfigurationInputs { - readonly domainNameConfiguration: pulumi.Input; - readonly mutualTlsAuthentication?: pulumi.Input; - readonly tags?: pulumi.Input>>; -} -export interface DomainConfigurationOutputs { - readonly domainNameConfiguration: pulumi.Output; - readonly mutualTlsAuthentication?: pulumi.Output; - readonly tags?: pulumi.Output>; -} export interface DomainMappingInputs { readonly apiMappingKey?: pulumi.Input; - readonly domainConfiguration?: DomainConfigurationInputs; readonly domainId?: pulumi.Input; + readonly domainName?: DomainNameInputs; readonly stage: pulumi.Input; } export interface DomainMappingOutputs { readonly apiMappingKey?: pulumi.Output; - readonly domainConfiguration?: DomainConfigurationOutputs; readonly domainId?: pulumi.Output; + readonly domainName?: DomainNameOutputs; readonly stage: pulumi.Output; } +export interface DomainNameInputs { + readonly domainNameConfiguration: pulumi.Input; + readonly mutualTlsAuthentication?: pulumi.Input; + readonly tags?: pulumi.Input>>; +} +export interface DomainNameOutputs { + readonly domainNameConfiguration: pulumi.Output; + readonly mutualTlsAuthentication?: pulumi.Output; + readonly tags?: pulumi.Output>; +} export interface HttpAuthorizerInputs { readonly authorizerCredentialsArn?: pulumi.Input; readonly authorizerPayloadFormatVersion?: pulumi.Input; diff --git a/schema.json b/schema.json index a763b42e6..60ccab4b3 100644 --- a/schema.json +++ b/schema.json @@ -66,7 +66,33 @@ }, "config": {}, "types": { - "awsx:apigatewayv2:DomainConfiguration": { + "awsx:apigatewayv2:DomainMapping": { + "description": "Manages an Amazon API Gateway Version 2 API mapping.\nMore information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html).\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Basic\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.ApiMapping(\"example\", {\n apiId: aws_apigatewayv2_api.example.id,\n domainName: aws_apigatewayv2_domain_name.example.id,\n stage: aws_apigatewayv2_stage.example.id,\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.ApiMapping(\"example\",\n api_id=aws_apigatewayv2_api[\"example\"][\"id\"],\n domain_name=aws_apigatewayv2_domain_name[\"example\"][\"id\"],\n stage=aws_apigatewayv2_stage[\"example\"][\"id\"])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.ApiMapping(\"example\", new()\n {\n ApiId = aws_apigatewayv2_api.Example.Id,\n DomainName = aws_apigatewayv2_domain_name.Example.Id,\n Stage = aws_apigatewayv2_stage.Example.Id,\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewApiMapping(ctx, \"example\", \u0026apigatewayv2.ApiMappingArgs{\n\t\t\tApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),\n\t\t\tDomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id),\n\t\t\tStage: pulumi.Any(aws_apigatewayv2_stage.Example.Id),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.ApiMapping;\nimport com.pulumi.aws.apigatewayv2.ApiMappingArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new ApiMapping(\"example\", ApiMappingArgs.builder() \n .apiId(aws_apigatewayv2_api.example().id())\n .domainName(aws_apigatewayv2_domain_name.example().id())\n .stage(aws_apigatewayv2_stage.example().id())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:ApiMapping\n properties:\n apiId: ${aws_apigatewayv2_api.example.id}\n domainName: ${aws_apigatewayv2_domain_name.example.id}\n stage: ${aws_apigatewayv2_stage.example.id}\n```\n{{% /example %}}\n{{% /examples %}}\n\n## Import\n\nUsing `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example:\n\n```sh\n $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com\n```\n ", + "properties": { + "apiMappingKey": { + "type": "string", + "description": "The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html).\n" + }, + "domainId": { + "type": "string", + "description": "Identifier of an existing domain. Cannot be specified together with `DomainName`." + }, + "domainName": { + "$ref": "#/types/awsx:apigatewayv2:DomainName", + "plain": true, + "description": "Configuration of the domain name to create. Cannot be specified together with `domainId`." + }, + "stage": { + "type": "string", + "description": "API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage.\n" + } + }, + "type": "object", + "required": [ + "stage" + ] + }, + "awsx:apigatewayv2:DomainName": { "description": "Manages an Amazon API Gateway Version 2 domain name.\nMore information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html).\n\n\u003e **Note:** This resource establishes ownership of and the TLS settings for\na particular domain name. An API stage can be associated with the domain name using the `aws.apigatewayv2.ApiMapping` resource.\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Basic\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.DomainName(\"example\", {\n domainName: \"ws-api.example.com\",\n domainNameConfiguration: {\n certificateArn: aws_acm_certificate.example.arn,\n endpointType: \"REGIONAL\",\n securityPolicy: \"TLS_1_2\",\n },\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.DomainName(\"example\",\n domain_name=\"ws-api.example.com\",\n domain_name_configuration=aws.apigatewayv2.DomainNameDomainNameConfigurationArgs(\n certificate_arn=aws_acm_certificate[\"example\"][\"arn\"],\n endpoint_type=\"REGIONAL\",\n security_policy=\"TLS_1_2\",\n ))\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.DomainName(\"example\", new()\n {\n Domain = \"ws-api.example.com\",\n DomainNameConfiguration = new Aws.ApiGatewayV2.Inputs.DomainNameDomainNameConfigurationArgs\n {\n CertificateArn = aws_acm_certificate.Example.Arn,\n EndpointType = \"REGIONAL\",\n SecurityPolicy = \"TLS_1_2\",\n },\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewDomainName(ctx, \"example\", \u0026apigatewayv2.DomainNameArgs{\n\t\t\tDomainName: pulumi.String(\"ws-api.example.com\"),\n\t\t\tDomainNameConfiguration: \u0026apigatewayv2.DomainNameDomainNameConfigurationArgs{\n\t\t\t\tCertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn),\n\t\t\t\tEndpointType: pulumi.String(\"REGIONAL\"),\n\t\t\t\tSecurityPolicy: pulumi.String(\"TLS_1_2\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.DomainName;\nimport com.pulumi.aws.apigatewayv2.DomainNameArgs;\nimport com.pulumi.aws.apigatewayv2.inputs.DomainNameDomainNameConfigurationArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new DomainName(\"example\", DomainNameArgs.builder() \n .domainName(\"ws-api.example.com\")\n .domainNameConfiguration(DomainNameDomainNameConfigurationArgs.builder()\n .certificateArn(aws_acm_certificate.example().arn())\n .endpointType(\"REGIONAL\")\n .securityPolicy(\"TLS_1_2\")\n .build())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:DomainName\n properties:\n domainName: ws-api.example.com\n domainNameConfiguration:\n certificateArn: ${aws_acm_certificate.example.arn}\n endpointType: REGIONAL\n securityPolicy: TLS_1_2\n```\n{{% /example %}}\n{{% example %}}\n### Associated Route 53 Resource Record\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst exampleDomainName = new aws.apigatewayv2.DomainName(\"exampleDomainName\", {\n domainName: \"http-api.example.com\",\n domainNameConfiguration: {\n certificateArn: aws_acm_certificate.example.arn,\n endpointType: \"REGIONAL\",\n securityPolicy: \"TLS_1_2\",\n },\n});\nconst exampleRecord = new aws.route53.Record(\"exampleRecord\", {\n name: exampleDomainName.domainName,\n type: \"A\",\n zoneId: aws_route53_zone.example.zone_id,\n aliases: [{\n name: exampleDomainName.domainNameConfiguration.apply(domainNameConfiguration =\u003e domainNameConfiguration.targetDomainName),\n zoneId: exampleDomainName.domainNameConfiguration.apply(domainNameConfiguration =\u003e domainNameConfiguration.hostedZoneId),\n evaluateTargetHealth: false,\n }],\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample_domain_name = aws.apigatewayv2.DomainName(\"exampleDomainName\",\n domain_name=\"http-api.example.com\",\n domain_name_configuration=aws.apigatewayv2.DomainNameDomainNameConfigurationArgs(\n certificate_arn=aws_acm_certificate[\"example\"][\"arn\"],\n endpoint_type=\"REGIONAL\",\n security_policy=\"TLS_1_2\",\n ))\nexample_record = aws.route53.Record(\"exampleRecord\",\n name=example_domain_name.domain_name,\n type=\"A\",\n zone_id=aws_route53_zone[\"example\"][\"zone_id\"],\n aliases=[aws.route53.RecordAliasArgs(\n name=example_domain_name.domain_name_configuration.target_domain_name,\n zone_id=example_domain_name.domain_name_configuration.hosted_zone_id,\n evaluate_target_health=False,\n )])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var exampleDomainName = new Aws.ApiGatewayV2.DomainName(\"exampleDomainName\", new()\n {\n Domain = \"http-api.example.com\",\n DomainNameConfiguration = new Aws.ApiGatewayV2.Inputs.DomainNameDomainNameConfigurationArgs\n {\n CertificateArn = aws_acm_certificate.Example.Arn,\n EndpointType = \"REGIONAL\",\n SecurityPolicy = \"TLS_1_2\",\n },\n });\n\n var exampleRecord = new Aws.Route53.Record(\"exampleRecord\", new()\n {\n Name = exampleDomainName.Domain,\n Type = \"A\",\n ZoneId = aws_route53_zone.Example.Zone_id,\n Aliases = new[]\n {\n new Aws.Route53.Inputs.RecordAliasArgs\n {\n Name = exampleDomainName.DomainNameConfiguration.Apply(domainNameConfiguration =\u003e domainNameConfiguration.TargetDomainName),\n ZoneId = exampleDomainName.DomainNameConfiguration.Apply(domainNameConfiguration =\u003e domainNameConfiguration.HostedZoneId),\n EvaluateTargetHealth = false,\n },\n },\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\texampleDomainName, err := apigatewayv2.NewDomainName(ctx, \"exampleDomainName\", \u0026apigatewayv2.DomainNameArgs{\n\t\t\tDomainName: pulumi.String(\"http-api.example.com\"),\n\t\t\tDomainNameConfiguration: \u0026apigatewayv2.DomainNameDomainNameConfigurationArgs{\n\t\t\t\tCertificateArn: pulumi.Any(aws_acm_certificate.Example.Arn),\n\t\t\t\tEndpointType: pulumi.String(\"REGIONAL\"),\n\t\t\t\tSecurityPolicy: pulumi.String(\"TLS_1_2\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = route53.NewRecord(ctx, \"exampleRecord\", \u0026route53.RecordArgs{\n\t\t\tName: exampleDomainName.DomainName,\n\t\t\tType: pulumi.String(\"A\"),\n\t\t\tZoneId: pulumi.Any(aws_route53_zone.Example.Zone_id),\n\t\t\tAliases: route53.RecordAliasArray{\n\t\t\t\t\u0026route53.RecordAliasArgs{\n\t\t\t\t\tName: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) {\n\t\t\t\t\t\treturn \u0026domainNameConfiguration.TargetDomainName, nil\n\t\t\t\t\t}).(pulumi.StringPtrOutput),\n\t\t\t\t\tZoneId: exampleDomainName.DomainNameConfiguration.ApplyT(func(domainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration) (*string, error) {\n\t\t\t\t\t\treturn \u0026domainNameConfiguration.HostedZoneId, nil\n\t\t\t\t\t}).(pulumi.StringPtrOutput),\n\t\t\t\t\tEvaluateTargetHealth: pulumi.Bool(false),\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.DomainName;\nimport com.pulumi.aws.apigatewayv2.DomainNameArgs;\nimport com.pulumi.aws.apigatewayv2.inputs.DomainNameDomainNameConfigurationArgs;\nimport com.pulumi.aws.route53.Record;\nimport com.pulumi.aws.route53.RecordArgs;\nimport com.pulumi.aws.route53.inputs.RecordAliasArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var exampleDomainName = new DomainName(\"exampleDomainName\", DomainNameArgs.builder() \n .domainName(\"http-api.example.com\")\n .domainNameConfiguration(DomainNameDomainNameConfigurationArgs.builder()\n .certificateArn(aws_acm_certificate.example().arn())\n .endpointType(\"REGIONAL\")\n .securityPolicy(\"TLS_1_2\")\n .build())\n .build());\n\n var exampleRecord = new Record(\"exampleRecord\", RecordArgs.builder() \n .name(exampleDomainName.domainName())\n .type(\"A\")\n .zoneId(aws_route53_zone.example().zone_id())\n .aliases(RecordAliasArgs.builder()\n .name(exampleDomainName.domainNameConfiguration().applyValue(domainNameConfiguration -\u003e domainNameConfiguration.targetDomainName()))\n .zoneId(exampleDomainName.domainNameConfiguration().applyValue(domainNameConfiguration -\u003e domainNameConfiguration.hostedZoneId()))\n .evaluateTargetHealth(false)\n .build())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n exampleDomainName:\n type: aws:apigatewayv2:DomainName\n properties:\n domainName: http-api.example.com\n domainNameConfiguration:\n certificateArn: ${aws_acm_certificate.example.arn}\n endpointType: REGIONAL\n securityPolicy: TLS_1_2\n exampleRecord:\n type: aws:route53:Record\n properties:\n name: ${exampleDomainName.domainName}\n type: A\n zoneId: ${aws_route53_zone.example.zone_id}\n aliases:\n - name: ${exampleDomainName.domainNameConfiguration.targetDomainName}\n zoneId: ${exampleDomainName.domainNameConfiguration.hostedZoneId}\n evaluateTargetHealth: false\n```\n{{% /example %}}\n{{% /examples %}}\n\n## Import\n\nUsing `pulumi import`, import `aws_apigatewayv2_domain_name` using the domain name. For example:\n\n```sh\n $ pulumi import aws:apigatewayv2/domainName:DomainName example ws-api.example.com\n```\n ", "properties": { "domainNameConfiguration": { @@ -90,32 +116,6 @@ "domainNameConfiguration" ] }, - "awsx:apigatewayv2:DomainMapping": { - "description": "Manages an Amazon API Gateway Version 2 API mapping.\nMore information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html).\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Basic\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.ApiMapping(\"example\", {\n apiId: aws_apigatewayv2_api.example.id,\n domainName: aws_apigatewayv2_domain_name.example.id,\n stage: aws_apigatewayv2_stage.example.id,\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.ApiMapping(\"example\",\n api_id=aws_apigatewayv2_api[\"example\"][\"id\"],\n domain_name=aws_apigatewayv2_domain_name[\"example\"][\"id\"],\n stage=aws_apigatewayv2_stage[\"example\"][\"id\"])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.ApiMapping(\"example\", new()\n {\n ApiId = aws_apigatewayv2_api.Example.Id,\n DomainName = aws_apigatewayv2_domain_name.Example.Id,\n Stage = aws_apigatewayv2_stage.Example.Id,\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewApiMapping(ctx, \"example\", \u0026apigatewayv2.ApiMappingArgs{\n\t\t\tApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),\n\t\t\tDomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id),\n\t\t\tStage: pulumi.Any(aws_apigatewayv2_stage.Example.Id),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.ApiMapping;\nimport com.pulumi.aws.apigatewayv2.ApiMappingArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new ApiMapping(\"example\", ApiMappingArgs.builder() \n .apiId(aws_apigatewayv2_api.example().id())\n .domainName(aws_apigatewayv2_domain_name.example().id())\n .stage(aws_apigatewayv2_stage.example().id())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:ApiMapping\n properties:\n apiId: ${aws_apigatewayv2_api.example.id}\n domainName: ${aws_apigatewayv2_domain_name.example.id}\n stage: ${aws_apigatewayv2_stage.example.id}\n```\n{{% /example %}}\n{{% /examples %}}\n\n## Import\n\nUsing `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example:\n\n```sh\n $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com\n```\n ", - "properties": { - "apiMappingKey": { - "type": "string", - "description": "The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html).\n" - }, - "domainConfiguration": { - "$ref": "#/types/awsx:apigatewayv2:DomainConfiguration", - "plain": true, - "description": "Configuration of the domain name to create. Cannot be specified together with `domainId`." - }, - "domainId": { - "type": "string", - "description": "Identifier of an existing domain. Cannot be specified together with `domainConfiguration`." - }, - "stage": { - "type": "string", - "description": "API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage.\n" - } - }, - "type": "object", - "required": [ - "stage" - ] - }, "awsx:apigatewayv2:HttpAuthorizer": { "description": "Manages an Amazon API Gateway Version 2 authorizer.\nMore information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html).\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Basic WebSocket API\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.Authorizer(\"example\", {\n apiId: aws_apigatewayv2_api.example.id,\n authorizerType: \"REQUEST\",\n authorizerUri: aws_lambda_function.example.invoke_arn,\n identitySources: [\"route.request.header.Auth\"],\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.Authorizer(\"example\",\n api_id=aws_apigatewayv2_api[\"example\"][\"id\"],\n authorizer_type=\"REQUEST\",\n authorizer_uri=aws_lambda_function[\"example\"][\"invoke_arn\"],\n identity_sources=[\"route.request.header.Auth\"])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.Authorizer(\"example\", new()\n {\n ApiId = aws_apigatewayv2_api.Example.Id,\n AuthorizerType = \"REQUEST\",\n AuthorizerUri = aws_lambda_function.Example.Invoke_arn,\n IdentitySources = new[]\n {\n \"route.request.header.Auth\",\n },\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewAuthorizer(ctx, \"example\", \u0026apigatewayv2.AuthorizerArgs{\n\t\t\tApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),\n\t\t\tAuthorizerType: pulumi.String(\"REQUEST\"),\n\t\t\tAuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn),\n\t\t\tIdentitySources: pulumi.StringArray{\n\t\t\t\tpulumi.String(\"route.request.header.Auth\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.Authorizer;\nimport com.pulumi.aws.apigatewayv2.AuthorizerArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new Authorizer(\"example\", AuthorizerArgs.builder() \n .apiId(aws_apigatewayv2_api.example().id())\n .authorizerType(\"REQUEST\")\n .authorizerUri(aws_lambda_function.example().invoke_arn())\n .identitySources(\"route.request.header.Auth\")\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:Authorizer\n properties:\n apiId: ${aws_apigatewayv2_api.example.id}\n authorizerType: REQUEST\n authorizerUri: ${aws_lambda_function.example.invoke_arn}\n identitySources:\n - route.request.header.Auth\n```\n{{% /example %}}\n{{% example %}}\n### Basic HTTP API\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\n\nconst example = new aws.apigatewayv2.Authorizer(\"example\", {\n apiId: aws_apigatewayv2_api.example.id,\n authorizerType: \"REQUEST\",\n authorizerUri: aws_lambda_function.example.invoke_arn,\n identitySources: [\"$request.header.Authorization\"],\n authorizerPayloadFormatVersion: \"2.0\",\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\n\nexample = aws.apigatewayv2.Authorizer(\"example\",\n api_id=aws_apigatewayv2_api[\"example\"][\"id\"],\n authorizer_type=\"REQUEST\",\n authorizer_uri=aws_lambda_function[\"example\"][\"invoke_arn\"],\n identity_sources=[\"$request.header.Authorization\"],\n authorizer_payload_format_version=\"2.0\")\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Aws.ApiGatewayV2.Authorizer(\"example\", new()\n {\n ApiId = aws_apigatewayv2_api.Example.Id,\n AuthorizerType = \"REQUEST\",\n AuthorizerUri = aws_lambda_function.Example.Invoke_arn,\n IdentitySources = new[]\n {\n \"$request.header.Authorization\",\n },\n AuthorizerPayloadFormatVersion = \"2.0\",\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := apigatewayv2.NewAuthorizer(ctx, \"example\", \u0026apigatewayv2.AuthorizerArgs{\n\t\t\tApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),\n\t\t\tAuthorizerType: pulumi.String(\"REQUEST\"),\n\t\t\tAuthorizerUri: pulumi.Any(aws_lambda_function.Example.Invoke_arn),\n\t\t\tIdentitySources: pulumi.StringArray{\n\t\t\t\tpulumi.String(\"$request.header.Authorization\"),\n\t\t\t},\n\t\t\tAuthorizerPayloadFormatVersion: pulumi.String(\"2.0\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.apigatewayv2.Authorizer;\nimport com.pulumi.aws.apigatewayv2.AuthorizerArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new Authorizer(\"example\", AuthorizerArgs.builder() \n .apiId(aws_apigatewayv2_api.example().id())\n .authorizerType(\"REQUEST\")\n .authorizerUri(aws_lambda_function.example().invoke_arn())\n .identitySources(\"$request.header.Authorization\")\n .authorizerPayloadFormatVersion(\"2.0\")\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: aws:apigatewayv2:Authorizer\n properties:\n apiId: ${aws_apigatewayv2_api.example.id}\n authorizerType: REQUEST\n authorizerUri: ${aws_lambda_function.example.invoke_arn}\n identitySources:\n - $request.header.Authorization\n authorizerPayloadFormatVersion: '2.0'\n```\n{{% /example %}}\n{{% /examples %}}\n\n## Import\n\nUsing `pulumi import`, import `aws_apigatewayv2_authorizer` using the API identifier and authorizer identifier. For example:\n\n```sh\n $ pulumi import aws:apigatewayv2/authorizer:Authorizer example aabbccddee/1122334\n```\n ", "properties": { diff --git a/schemagen/pkg/gen/apigatewayv2.go b/schemagen/pkg/gen/apigatewayv2.go index d3d9d2fca..32704b395 100644 --- a/schemagen/pkg/gen/apigatewayv2.go +++ b/schemagen/pkg/gen/apigatewayv2.go @@ -22,12 +22,12 @@ func generateApiGatewayV2(awsSpec schema.PackageSpec) schema.PackageSpec { "awsx:apigatewayv2:HttpApi": httpApi(awsSpec), }, Types: map[string]schema.ComplexTypeSpec{ - "awsx:apigatewayv2:HttpRoute": httpRoute(awsSpec), - "awsx:apigatewayv2:HttpIntegration": httpIntegration(awsSpec), - "awsx:apigatewayv2:HttpAuthorizer": httpAuthorizer(awsSpec), - "awsx:apigatewayv2:HttpStage": httpStage(awsSpec), - "awsx:apigatewayv2:DomainMapping": domainMapping(awsSpec), - "awsx:apigatewayv2:DomainConfiguration": domainConfiguration(awsSpec), + "awsx:apigatewayv2:HttpRoute": httpRoute(awsSpec), + "awsx:apigatewayv2:HttpIntegration": httpIntegration(awsSpec), + "awsx:apigatewayv2:HttpAuthorizer": httpAuthorizer(awsSpec), + "awsx:apigatewayv2:HttpStage": httpStage(awsSpec), + "awsx:apigatewayv2:DomainMapping": domainMapping(awsSpec), + "awsx:apigatewayv2:DomainName": domainName(awsSpec), }, } } @@ -221,16 +221,16 @@ func domainMapping(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { original := awsSpec.Resources["aws:apigatewayv2/apiMapping:ApiMapping"] properties := renameAwsPropertiesRefs(awsSpec, original.InputProperties) delete(properties, "apiId") - delete(properties, "domainName") - properties["domainConfiguration"] = schema.PropertySpec{ + delete(properties, "domainName") // Inferred from the map key + properties["domainName"] = schema.PropertySpec{ Description: "Configuration of the domain name to create. Cannot be specified together with `domainId`.", TypeSpec: schema.TypeSpec{ - Ref: localRef("apigatewayv2", "DomainConfiguration"), + Ref: localRef("apigatewayv2", "DomainName"), Plain: true, }, } properties["domainId"] = schema.PropertySpec{ - Description: "Identifier of an existing domain. Cannot be specified together with `domainConfiguration`.", + Description: "Identifier of an existing domain. Cannot be specified together with `DomainName`.", TypeSpec: schema.TypeSpec{ Type: "string", }, @@ -245,7 +245,7 @@ func domainMapping(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { } } -func domainConfiguration(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { +func domainName(awsSpec schema.PackageSpec) schema.ComplexTypeSpec { original := awsSpec.Resources["aws:apigatewayv2/domainName:DomainName"] properties := renameAwsPropertiesRefs(awsSpec, original.InputProperties) delete(properties, "domainName") diff --git a/sdk/dotnet/Apigatewayv2/Inputs/DomainMappingArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/DomainMappingArgs.cs index c9f766922..14473e724 100644 --- a/sdk/dotnet/Apigatewayv2/Inputs/DomainMappingArgs.cs +++ b/sdk/dotnet/Apigatewayv2/Inputs/DomainMappingArgs.cs @@ -137,16 +137,16 @@ public sealed class DomainMappingArgs : global::Pulumi.ResourceArgs public Input? ApiMappingKey { get; set; } /// - /// Configuration of the domain name to create. Cannot be specified together with `domainId`. + /// Identifier of an existing domain. Cannot be specified together with `DomainName`. /// - [Input("domainConfiguration")] - public Inputs.DomainConfigurationArgs? DomainConfiguration { get; set; } + [Input("domainId")] + public Input? DomainId { get; set; } /// - /// Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + /// Configuration of the domain name to create. Cannot be specified together with `domainId`. /// - [Input("domainId")] - public Input? DomainId { get; set; } + [Input("domainName")] + public Inputs.DomainNameArgs? DomainName { get; set; } /// /// API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. diff --git a/sdk/dotnet/Apigatewayv2/Inputs/DomainConfigurationArgs.cs b/sdk/dotnet/Apigatewayv2/Inputs/DomainNameArgs.cs similarity index 98% rename from sdk/dotnet/Apigatewayv2/Inputs/DomainConfigurationArgs.cs rename to sdk/dotnet/Apigatewayv2/Inputs/DomainNameArgs.cs index 4f65c282e..f20f7d2d1 100644 --- a/sdk/dotnet/Apigatewayv2/Inputs/DomainConfigurationArgs.cs +++ b/sdk/dotnet/Apigatewayv2/Inputs/DomainNameArgs.cs @@ -349,7 +349,7 @@ namespace Pulumi.Awsx.Apigatewayv2.Inputs /// ``` /// /// - public sealed class DomainConfigurationArgs : global::Pulumi.ResourceArgs + public sealed class DomainNameArgs : global::Pulumi.ResourceArgs { /// /// Domain name configuration. See below. @@ -375,9 +375,9 @@ public InputMap Tags set => _tags = value; } - public DomainConfigurationArgs() + public DomainNameArgs() { } - public static new DomainConfigurationArgs Empty => new DomainConfigurationArgs(); + public static new DomainNameArgs Empty => new DomainNameArgs(); } } diff --git a/sdk/go/awsx/apigatewayv2/pulumiTypes.go b/sdk/go/awsx/apigatewayv2/pulumiTypes.go index daa5c0899..7de30fe06 100644 --- a/sdk/go/awsx/apigatewayv2/pulumiTypes.go +++ b/sdk/go/awsx/apigatewayv2/pulumiTypes.go @@ -15,6 +15,217 @@ import ( var _ = internal.GetEnvOrDefault +// Manages an Amazon API Gateway Version 2 API mapping. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), +// Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com +// +// ``` +type DomainMapping struct { + // The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). + ApiMappingKey *string `pulumi:"apiMappingKey"` + // Identifier of an existing domain. Cannot be specified together with `DomainName`. + DomainId *string `pulumi:"domainId"` + // Configuration of the domain name to create. Cannot be specified together with `domainId`. + DomainName *DomainName `pulumi:"domainName"` + // API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. + Stage string `pulumi:"stage"` +} + +// DomainMappingInput is an input type that accepts DomainMappingArgs and DomainMappingOutput values. +// You can construct a concrete instance of `DomainMappingInput` via: +// +// DomainMappingArgs{...} +type DomainMappingInput interface { + pulumi.Input + + ToDomainMappingOutput() DomainMappingOutput + ToDomainMappingOutputWithContext(context.Context) DomainMappingOutput +} + +// Manages an Amazon API Gateway Version 2 API mapping. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), +// Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com +// +// ``` +type DomainMappingArgs struct { + // The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). + ApiMappingKey pulumi.StringPtrInput `pulumi:"apiMappingKey"` + // Identifier of an existing domain. Cannot be specified together with `DomainName`. + DomainId pulumi.StringPtrInput `pulumi:"domainId"` + // Configuration of the domain name to create. Cannot be specified together with `domainId`. + DomainName *DomainNameArgs `pulumi:"domainName"` + // API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. + Stage pulumi.StringInput `pulumi:"stage"` +} + +func (DomainMappingArgs) ElementType() reflect.Type { + return reflect.TypeOf((*DomainMapping)(nil)).Elem() +} + +func (i DomainMappingArgs) ToDomainMappingOutput() DomainMappingOutput { + return i.ToDomainMappingOutputWithContext(context.Background()) +} + +func (i DomainMappingArgs) ToDomainMappingOutputWithContext(ctx context.Context) DomainMappingOutput { + return pulumi.ToOutputWithContext(ctx, i).(DomainMappingOutput) +} + +func (i DomainMappingArgs) ToOutput(ctx context.Context) pulumix.Output[DomainMapping] { + return pulumix.Output[DomainMapping]{ + OutputState: i.ToDomainMappingOutputWithContext(ctx).OutputState, + } +} + +// Manages an Amazon API Gateway Version 2 API mapping. +// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). +// +// ## Example Usage +// ### Basic +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ +// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), +// DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), +// Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## Import +// +// Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: +// +// ```sh +// +// $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com +// +// ``` +type DomainMappingOutput struct{ *pulumi.OutputState } + +func (DomainMappingOutput) ElementType() reflect.Type { + return reflect.TypeOf((*DomainMapping)(nil)).Elem() +} + +func (o DomainMappingOutput) ToDomainMappingOutput() DomainMappingOutput { + return o +} + +func (o DomainMappingOutput) ToDomainMappingOutputWithContext(ctx context.Context) DomainMappingOutput { + return o +} + +func (o DomainMappingOutput) ToOutput(ctx context.Context) pulumix.Output[DomainMapping] { + return pulumix.Output[DomainMapping]{ + OutputState: o.OutputState, + } +} + +// The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). +func (o DomainMappingOutput) ApiMappingKey() pulumi.StringPtrOutput { + return o.ApplyT(func(v DomainMapping) *string { return v.ApiMappingKey }).(pulumi.StringPtrOutput) +} + +// Identifier of an existing domain. Cannot be specified together with `DomainName`. +func (o DomainMappingOutput) DomainId() pulumi.StringPtrOutput { + return o.ApplyT(func(v DomainMapping) *string { return v.DomainId }).(pulumi.StringPtrOutput) +} + +// Configuration of the domain name to create. Cannot be specified together with `domainId`. +func (o DomainMappingOutput) DomainName() DomainNamePtrOutput { + return o.ApplyT(func(v DomainMapping) *DomainName { return v.DomainName }).(DomainNamePtrOutput) +} + +// API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. +func (o DomainMappingOutput) Stage() pulumi.StringOutput { + return o.ApplyT(func(v DomainMapping) string { return v.Stage }).(pulumi.StringOutput) +} + // Manages an Amazon API Gateway Version 2 domain name. // More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). // @@ -110,7 +321,7 @@ var _ = internal.GetEnvOrDefault // $ pulumi import aws:apigatewayv2/domainName:DomainName example ws-api.example.com // // ``` -type DomainConfiguration struct { +type DomainName struct { // Domain name configuration. See below. DomainNameConfiguration apigatewayv2.DomainNameDomainNameConfiguration `pulumi:"domainNameConfiguration"` // Mutual TLS authentication configuration for the domain name. @@ -119,15 +330,15 @@ type DomainConfiguration struct { Tags map[string]string `pulumi:"tags"` } -// DomainConfigurationInput is an input type that accepts DomainConfigurationArgs and DomainConfigurationOutput values. -// You can construct a concrete instance of `DomainConfigurationInput` via: +// DomainNameInput is an input type that accepts DomainNameArgs and DomainNameOutput values. +// You can construct a concrete instance of `DomainNameInput` via: // -// DomainConfigurationArgs{...} -type DomainConfigurationInput interface { +// DomainNameArgs{...} +type DomainNameInput interface { pulumi.Input - ToDomainConfigurationOutput() DomainConfigurationOutput - ToDomainConfigurationOutputWithContext(context.Context) DomainConfigurationOutput + ToDomainNameOutput() DomainNameOutput + ToDomainNameOutputWithContext(context.Context) DomainNameOutput } // Manages an Amazon API Gateway Version 2 domain name. @@ -225,7 +436,7 @@ type DomainConfigurationInput interface { // $ pulumi import aws:apigatewayv2/domainName:DomainName example ws-api.example.com // // ``` -type DomainConfigurationArgs struct { +type DomainNameArgs struct { // Domain name configuration. See below. DomainNameConfiguration apigatewayv2.DomainNameDomainNameConfigurationInput `pulumi:"domainNameConfiguration"` // Mutual TLS authentication configuration for the domain name. @@ -234,68 +445,68 @@ type DomainConfigurationArgs struct { Tags pulumi.StringMapInput `pulumi:"tags"` } -func (DomainConfigurationArgs) ElementType() reflect.Type { - return reflect.TypeOf((*DomainConfiguration)(nil)).Elem() +func (DomainNameArgs) ElementType() reflect.Type { + return reflect.TypeOf((*DomainName)(nil)).Elem() } -func (i DomainConfigurationArgs) ToDomainConfigurationOutput() DomainConfigurationOutput { - return i.ToDomainConfigurationOutputWithContext(context.Background()) +func (i DomainNameArgs) ToDomainNameOutput() DomainNameOutput { + return i.ToDomainNameOutputWithContext(context.Background()) } -func (i DomainConfigurationArgs) ToDomainConfigurationOutputWithContext(ctx context.Context) DomainConfigurationOutput { - return pulumi.ToOutputWithContext(ctx, i).(DomainConfigurationOutput) +func (i DomainNameArgs) ToDomainNameOutputWithContext(ctx context.Context) DomainNameOutput { + return pulumi.ToOutputWithContext(ctx, i).(DomainNameOutput) } -func (i DomainConfigurationArgs) ToOutput(ctx context.Context) pulumix.Output[DomainConfiguration] { - return pulumix.Output[DomainConfiguration]{ - OutputState: i.ToDomainConfigurationOutputWithContext(ctx).OutputState, +func (i DomainNameArgs) ToOutput(ctx context.Context) pulumix.Output[DomainName] { + return pulumix.Output[DomainName]{ + OutputState: i.ToDomainNameOutputWithContext(ctx).OutputState, } } -func (i DomainConfigurationArgs) ToDomainConfigurationPtrOutput() DomainConfigurationPtrOutput { - return i.ToDomainConfigurationPtrOutputWithContext(context.Background()) +func (i DomainNameArgs) ToDomainNamePtrOutput() DomainNamePtrOutput { + return i.ToDomainNamePtrOutputWithContext(context.Background()) } -func (i DomainConfigurationArgs) ToDomainConfigurationPtrOutputWithContext(ctx context.Context) DomainConfigurationPtrOutput { - return pulumi.ToOutputWithContext(ctx, i).(DomainConfigurationOutput).ToDomainConfigurationPtrOutputWithContext(ctx) +func (i DomainNameArgs) ToDomainNamePtrOutputWithContext(ctx context.Context) DomainNamePtrOutput { + return pulumi.ToOutputWithContext(ctx, i).(DomainNameOutput).ToDomainNamePtrOutputWithContext(ctx) } -// DomainConfigurationPtrInput is an input type that accepts DomainConfigurationArgs, DomainConfigurationPtr and DomainConfigurationPtrOutput values. -// You can construct a concrete instance of `DomainConfigurationPtrInput` via: +// DomainNamePtrInput is an input type that accepts DomainNameArgs, DomainNamePtr and DomainNamePtrOutput values. +// You can construct a concrete instance of `DomainNamePtrInput` via: // -// DomainConfigurationArgs{...} +// DomainNameArgs{...} // // or: // // nil -type DomainConfigurationPtrInput interface { +type DomainNamePtrInput interface { pulumi.Input - ToDomainConfigurationPtrOutput() DomainConfigurationPtrOutput - ToDomainConfigurationPtrOutputWithContext(context.Context) DomainConfigurationPtrOutput + ToDomainNamePtrOutput() DomainNamePtrOutput + ToDomainNamePtrOutputWithContext(context.Context) DomainNamePtrOutput } -type domainConfigurationPtrType DomainConfigurationArgs +type domainNamePtrType DomainNameArgs -func DomainConfigurationPtr(v *DomainConfigurationArgs) DomainConfigurationPtrInput { - return (*domainConfigurationPtrType)(v) +func DomainNamePtr(v *DomainNameArgs) DomainNamePtrInput { + return (*domainNamePtrType)(v) } -func (*domainConfigurationPtrType) ElementType() reflect.Type { - return reflect.TypeOf((**DomainConfiguration)(nil)).Elem() +func (*domainNamePtrType) ElementType() reflect.Type { + return reflect.TypeOf((**DomainName)(nil)).Elem() } -func (i *domainConfigurationPtrType) ToDomainConfigurationPtrOutput() DomainConfigurationPtrOutput { - return i.ToDomainConfigurationPtrOutputWithContext(context.Background()) +func (i *domainNamePtrType) ToDomainNamePtrOutput() DomainNamePtrOutput { + return i.ToDomainNamePtrOutputWithContext(context.Background()) } -func (i *domainConfigurationPtrType) ToDomainConfigurationPtrOutputWithContext(ctx context.Context) DomainConfigurationPtrOutput { - return pulumi.ToOutputWithContext(ctx, i).(DomainConfigurationPtrOutput) +func (i *domainNamePtrType) ToDomainNamePtrOutputWithContext(ctx context.Context) DomainNamePtrOutput { + return pulumi.ToOutputWithContext(ctx, i).(DomainNamePtrOutput) } -func (i *domainConfigurationPtrType) ToOutput(ctx context.Context) pulumix.Output[*DomainConfiguration] { - return pulumix.Output[*DomainConfiguration]{ - OutputState: i.ToDomainConfigurationPtrOutputWithContext(ctx).OutputState, +func (i *domainNamePtrType) ToOutput(ctx context.Context) pulumix.Output[*DomainName] { + return pulumix.Output[*DomainName]{ + OutputState: i.ToDomainNamePtrOutputWithContext(ctx).OutputState, } } @@ -394,88 +605,84 @@ func (i *domainConfigurationPtrType) ToOutput(ctx context.Context) pulumix.Outpu // $ pulumi import aws:apigatewayv2/domainName:DomainName example ws-api.example.com // // ``` -type DomainConfigurationOutput struct{ *pulumi.OutputState } +type DomainNameOutput struct{ *pulumi.OutputState } -func (DomainConfigurationOutput) ElementType() reflect.Type { - return reflect.TypeOf((*DomainConfiguration)(nil)).Elem() +func (DomainNameOutput) ElementType() reflect.Type { + return reflect.TypeOf((*DomainName)(nil)).Elem() } -func (o DomainConfigurationOutput) ToDomainConfigurationOutput() DomainConfigurationOutput { +func (o DomainNameOutput) ToDomainNameOutput() DomainNameOutput { return o } -func (o DomainConfigurationOutput) ToDomainConfigurationOutputWithContext(ctx context.Context) DomainConfigurationOutput { +func (o DomainNameOutput) ToDomainNameOutputWithContext(ctx context.Context) DomainNameOutput { return o } -func (o DomainConfigurationOutput) ToDomainConfigurationPtrOutput() DomainConfigurationPtrOutput { - return o.ToDomainConfigurationPtrOutputWithContext(context.Background()) +func (o DomainNameOutput) ToDomainNamePtrOutput() DomainNamePtrOutput { + return o.ToDomainNamePtrOutputWithContext(context.Background()) } -func (o DomainConfigurationOutput) ToDomainConfigurationPtrOutputWithContext(ctx context.Context) DomainConfigurationPtrOutput { - return o.ApplyTWithContext(ctx, func(_ context.Context, v DomainConfiguration) *DomainConfiguration { +func (o DomainNameOutput) ToDomainNamePtrOutputWithContext(ctx context.Context) DomainNamePtrOutput { + return o.ApplyTWithContext(ctx, func(_ context.Context, v DomainName) *DomainName { return &v - }).(DomainConfigurationPtrOutput) + }).(DomainNamePtrOutput) } -func (o DomainConfigurationOutput) ToOutput(ctx context.Context) pulumix.Output[DomainConfiguration] { - return pulumix.Output[DomainConfiguration]{ +func (o DomainNameOutput) ToOutput(ctx context.Context) pulumix.Output[DomainName] { + return pulumix.Output[DomainName]{ OutputState: o.OutputState, } } // Domain name configuration. See below. -func (o DomainConfigurationOutput) DomainNameConfiguration() apigatewayv2.DomainNameDomainNameConfigurationOutput { - return o.ApplyT(func(v DomainConfiguration) apigatewayv2.DomainNameDomainNameConfiguration { - return v.DomainNameConfiguration - }).(apigatewayv2.DomainNameDomainNameConfigurationOutput) +func (o DomainNameOutput) DomainNameConfiguration() apigatewayv2.DomainNameDomainNameConfigurationOutput { + return o.ApplyT(func(v DomainName) apigatewayv2.DomainNameDomainNameConfiguration { return v.DomainNameConfiguration }).(apigatewayv2.DomainNameDomainNameConfigurationOutput) } // Mutual TLS authentication configuration for the domain name. -func (o DomainConfigurationOutput) MutualTlsAuthentication() apigatewayv2.DomainNameMutualTlsAuthenticationPtrOutput { - return o.ApplyT(func(v DomainConfiguration) *apigatewayv2.DomainNameMutualTlsAuthentication { - return v.MutualTlsAuthentication - }).(apigatewayv2.DomainNameMutualTlsAuthenticationPtrOutput) +func (o DomainNameOutput) MutualTlsAuthentication() apigatewayv2.DomainNameMutualTlsAuthenticationPtrOutput { + return o.ApplyT(func(v DomainName) *apigatewayv2.DomainNameMutualTlsAuthentication { return v.MutualTlsAuthentication }).(apigatewayv2.DomainNameMutualTlsAuthenticationPtrOutput) } // Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. -func (o DomainConfigurationOutput) Tags() pulumi.StringMapOutput { - return o.ApplyT(func(v DomainConfiguration) map[string]string { return v.Tags }).(pulumi.StringMapOutput) +func (o DomainNameOutput) Tags() pulumi.StringMapOutput { + return o.ApplyT(func(v DomainName) map[string]string { return v.Tags }).(pulumi.StringMapOutput) } -type DomainConfigurationPtrOutput struct{ *pulumi.OutputState } +type DomainNamePtrOutput struct{ *pulumi.OutputState } -func (DomainConfigurationPtrOutput) ElementType() reflect.Type { - return reflect.TypeOf((**DomainConfiguration)(nil)).Elem() +func (DomainNamePtrOutput) ElementType() reflect.Type { + return reflect.TypeOf((**DomainName)(nil)).Elem() } -func (o DomainConfigurationPtrOutput) ToDomainConfigurationPtrOutput() DomainConfigurationPtrOutput { +func (o DomainNamePtrOutput) ToDomainNamePtrOutput() DomainNamePtrOutput { return o } -func (o DomainConfigurationPtrOutput) ToDomainConfigurationPtrOutputWithContext(ctx context.Context) DomainConfigurationPtrOutput { +func (o DomainNamePtrOutput) ToDomainNamePtrOutputWithContext(ctx context.Context) DomainNamePtrOutput { return o } -func (o DomainConfigurationPtrOutput) ToOutput(ctx context.Context) pulumix.Output[*DomainConfiguration] { - return pulumix.Output[*DomainConfiguration]{ +func (o DomainNamePtrOutput) ToOutput(ctx context.Context) pulumix.Output[*DomainName] { + return pulumix.Output[*DomainName]{ OutputState: o.OutputState, } } -func (o DomainConfigurationPtrOutput) Elem() DomainConfigurationOutput { - return o.ApplyT(func(v *DomainConfiguration) DomainConfiguration { +func (o DomainNamePtrOutput) Elem() DomainNameOutput { + return o.ApplyT(func(v *DomainName) DomainName { if v != nil { return *v } - var ret DomainConfiguration + var ret DomainName return ret - }).(DomainConfigurationOutput) + }).(DomainNameOutput) } // Domain name configuration. See below. -func (o DomainConfigurationPtrOutput) DomainNameConfiguration() apigatewayv2.DomainNameDomainNameConfigurationPtrOutput { - return o.ApplyT(func(v *DomainConfiguration) *apigatewayv2.DomainNameDomainNameConfiguration { +func (o DomainNamePtrOutput) DomainNameConfiguration() apigatewayv2.DomainNameDomainNameConfigurationPtrOutput { + return o.ApplyT(func(v *DomainName) *apigatewayv2.DomainNameDomainNameConfiguration { if v == nil { return nil } @@ -484,8 +691,8 @@ func (o DomainConfigurationPtrOutput) DomainNameConfiguration() apigatewayv2.Dom } // Mutual TLS authentication configuration for the domain name. -func (o DomainConfigurationPtrOutput) MutualTlsAuthentication() apigatewayv2.DomainNameMutualTlsAuthenticationPtrOutput { - return o.ApplyT(func(v *DomainConfiguration) *apigatewayv2.DomainNameMutualTlsAuthentication { +func (o DomainNamePtrOutput) MutualTlsAuthentication() apigatewayv2.DomainNameMutualTlsAuthenticationPtrOutput { + return o.ApplyT(func(v *DomainName) *apigatewayv2.DomainNameMutualTlsAuthentication { if v == nil { return nil } @@ -494,8 +701,8 @@ func (o DomainConfigurationPtrOutput) MutualTlsAuthentication() apigatewayv2.Dom } // Map of tags to assign to the domain name. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. -func (o DomainConfigurationPtrOutput) Tags() pulumi.StringMapOutput { - return o.ApplyT(func(v *DomainConfiguration) map[string]string { +func (o DomainNamePtrOutput) Tags() pulumi.StringMapOutput { + return o.ApplyT(func(v *DomainName) map[string]string { if v == nil { return nil } @@ -503,217 +710,6 @@ func (o DomainConfigurationPtrOutput) Tags() pulumi.StringMapOutput { }).(pulumi.StringMapOutput) } -// Manages an Amazon API Gateway Version 2 API mapping. -// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). -// -// ## Example Usage -// ### Basic -// ```go -// package main -// -// import ( -// -// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" -// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" -// -// ) -// -// func main() { -// pulumi.Run(func(ctx *pulumi.Context) error { -// _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ -// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), -// DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), -// Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), -// }) -// if err != nil { -// return err -// } -// return nil -// }) -// } -// -// ``` -// -// ## Import -// -// Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: -// -// ```sh -// -// $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com -// -// ``` -type DomainMapping struct { - // The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). - ApiMappingKey *string `pulumi:"apiMappingKey"` - // Configuration of the domain name to create. Cannot be specified together with `domainId`. - DomainConfiguration *DomainConfiguration `pulumi:"domainConfiguration"` - // Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. - DomainId *string `pulumi:"domainId"` - // API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. - Stage string `pulumi:"stage"` -} - -// DomainMappingInput is an input type that accepts DomainMappingArgs and DomainMappingOutput values. -// You can construct a concrete instance of `DomainMappingInput` via: -// -// DomainMappingArgs{...} -type DomainMappingInput interface { - pulumi.Input - - ToDomainMappingOutput() DomainMappingOutput - ToDomainMappingOutputWithContext(context.Context) DomainMappingOutput -} - -// Manages an Amazon API Gateway Version 2 API mapping. -// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). -// -// ## Example Usage -// ### Basic -// ```go -// package main -// -// import ( -// -// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" -// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" -// -// ) -// -// func main() { -// pulumi.Run(func(ctx *pulumi.Context) error { -// _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ -// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), -// DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), -// Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), -// }) -// if err != nil { -// return err -// } -// return nil -// }) -// } -// -// ``` -// -// ## Import -// -// Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: -// -// ```sh -// -// $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com -// -// ``` -type DomainMappingArgs struct { - // The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). - ApiMappingKey pulumi.StringPtrInput `pulumi:"apiMappingKey"` - // Configuration of the domain name to create. Cannot be specified together with `domainId`. - DomainConfiguration *DomainConfigurationArgs `pulumi:"domainConfiguration"` - // Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. - DomainId pulumi.StringPtrInput `pulumi:"domainId"` - // API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. - Stage pulumi.StringInput `pulumi:"stage"` -} - -func (DomainMappingArgs) ElementType() reflect.Type { - return reflect.TypeOf((*DomainMapping)(nil)).Elem() -} - -func (i DomainMappingArgs) ToDomainMappingOutput() DomainMappingOutput { - return i.ToDomainMappingOutputWithContext(context.Background()) -} - -func (i DomainMappingArgs) ToDomainMappingOutputWithContext(ctx context.Context) DomainMappingOutput { - return pulumi.ToOutputWithContext(ctx, i).(DomainMappingOutput) -} - -func (i DomainMappingArgs) ToOutput(ctx context.Context) pulumix.Output[DomainMapping] { - return pulumix.Output[DomainMapping]{ - OutputState: i.ToDomainMappingOutputWithContext(ctx).OutputState, - } -} - -// Manages an Amazon API Gateway Version 2 API mapping. -// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). -// -// ## Example Usage -// ### Basic -// ```go -// package main -// -// import ( -// -// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" -// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" -// -// ) -// -// func main() { -// pulumi.Run(func(ctx *pulumi.Context) error { -// _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ -// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), -// DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), -// Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), -// }) -// if err != nil { -// return err -// } -// return nil -// }) -// } -// -// ``` -// -// ## Import -// -// Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: -// -// ```sh -// -// $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com -// -// ``` -type DomainMappingOutput struct{ *pulumi.OutputState } - -func (DomainMappingOutput) ElementType() reflect.Type { - return reflect.TypeOf((*DomainMapping)(nil)).Elem() -} - -func (o DomainMappingOutput) ToDomainMappingOutput() DomainMappingOutput { - return o -} - -func (o DomainMappingOutput) ToDomainMappingOutputWithContext(ctx context.Context) DomainMappingOutput { - return o -} - -func (o DomainMappingOutput) ToOutput(ctx context.Context) pulumix.Output[DomainMapping] { - return pulumix.Output[DomainMapping]{ - OutputState: o.OutputState, - } -} - -// The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). -func (o DomainMappingOutput) ApiMappingKey() pulumi.StringPtrOutput { - return o.ApplyT(func(v DomainMapping) *string { return v.ApiMappingKey }).(pulumi.StringPtrOutput) -} - -// Configuration of the domain name to create. Cannot be specified together with `domainId`. -func (o DomainMappingOutput) DomainConfiguration() DomainConfigurationPtrOutput { - return o.ApplyT(func(v DomainMapping) *DomainConfiguration { return v.DomainConfiguration }).(DomainConfigurationPtrOutput) -} - -// Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. -func (o DomainMappingOutput) DomainId() pulumi.StringPtrOutput { - return o.ApplyT(func(v DomainMapping) *string { return v.DomainId }).(pulumi.StringPtrOutput) -} - -// API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. -func (o DomainMappingOutput) Stage() pulumi.StringOutput { - return o.ApplyT(func(v DomainMapping) string { return v.Stage }).(pulumi.StringOutput) -} - // Manages an Amazon API Gateway Version 2 authorizer. // More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). // @@ -2952,18 +2948,18 @@ func (o HttpStageOutput) Tags() pulumi.StringMapOutput { } func init() { - pulumi.RegisterInputType(reflect.TypeOf((*DomainConfigurationInput)(nil)).Elem(), DomainConfigurationArgs{}) - pulumi.RegisterInputType(reflect.TypeOf((*DomainConfigurationPtrInput)(nil)).Elem(), DomainConfigurationArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*DomainMappingInput)(nil)).Elem(), DomainMappingArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*DomainNameInput)(nil)).Elem(), DomainNameArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*DomainNamePtrInput)(nil)).Elem(), DomainNameArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*HttpAuthorizerInput)(nil)).Elem(), HttpAuthorizerArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*HttpAuthorizerPtrInput)(nil)).Elem(), HttpAuthorizerArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*HttpIntegrationInput)(nil)).Elem(), HttpIntegrationArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*HttpIntegrationPtrInput)(nil)).Elem(), HttpIntegrationArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*HttpRouteInput)(nil)).Elem(), HttpRouteArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*HttpStageInput)(nil)).Elem(), HttpStageArgs{}) - pulumi.RegisterOutputType(DomainConfigurationOutput{}) - pulumi.RegisterOutputType(DomainConfigurationPtrOutput{}) pulumi.RegisterOutputType(DomainMappingOutput{}) + pulumi.RegisterOutputType(DomainNameOutput{}) + pulumi.RegisterOutputType(DomainNamePtrOutput{}) pulumi.RegisterOutputType(HttpAuthorizerOutput{}) pulumi.RegisterOutputType(HttpAuthorizerPtrOutput{}) pulumi.RegisterOutputType(HttpIntegrationOutput{}) diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainMappingArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainMappingArgs.java index 5f70428e5..88b7528e8 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainMappingArgs.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainMappingArgs.java @@ -3,7 +3,7 @@ package com.pulumi.awsx.apigatewayv2.inputs; -import com.pulumi.awsx.apigatewayv2.inputs.DomainConfigurationArgs; +import com.pulumi.awsx.apigatewayv2.inputs.DomainNameArgs; import com.pulumi.core.Output; import com.pulumi.core.annotations.Import; import java.lang.String; @@ -78,33 +78,33 @@ public Optional> apiMappingKey() { } /** - * Configuration of the domain name to create. Cannot be specified together with `domainId`. + * Identifier of an existing domain. Cannot be specified together with `DomainName`. * */ - @Import(name="domainConfiguration") - private @Nullable DomainConfigurationArgs domainConfiguration; + @Import(name="domainId") + private @Nullable Output domainId; /** - * @return Configuration of the domain name to create. Cannot be specified together with `domainId`. + * @return Identifier of an existing domain. Cannot be specified together with `DomainName`. * */ - public Optional domainConfiguration() { - return Optional.ofNullable(this.domainConfiguration); + public Optional> domainId() { + return Optional.ofNullable(this.domainId); } /** - * Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + * Configuration of the domain name to create. Cannot be specified together with `domainId`. * */ - @Import(name="domainId") - private @Nullable Output domainId; + @Import(name="domainName") + private @Nullable DomainNameArgs domainName; /** - * @return Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + * @return Configuration of the domain name to create. Cannot be specified together with `domainId`. * */ - public Optional> domainId() { - return Optional.ofNullable(this.domainId); + public Optional domainName() { + return Optional.ofNullable(this.domainName); } /** @@ -126,8 +126,8 @@ private DomainMappingArgs() {} private DomainMappingArgs(DomainMappingArgs $) { this.apiMappingKey = $.apiMappingKey; - this.domainConfiguration = $.domainConfiguration; this.domainId = $.domainId; + this.domainName = $.domainName; this.stage = $.stage; } @@ -171,35 +171,35 @@ public Builder apiMappingKey(String apiMappingKey) { } /** - * @param domainConfiguration Configuration of the domain name to create. Cannot be specified together with `domainId`. + * @param domainId Identifier of an existing domain. Cannot be specified together with `DomainName`. * * @return builder * */ - public Builder domainConfiguration(@Nullable DomainConfigurationArgs domainConfiguration) { - $.domainConfiguration = domainConfiguration; + public Builder domainId(@Nullable Output domainId) { + $.domainId = domainId; return this; } /** - * @param domainId Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + * @param domainId Identifier of an existing domain. Cannot be specified together with `DomainName`. * * @return builder * */ - public Builder domainId(@Nullable Output domainId) { - $.domainId = domainId; - return this; + public Builder domainId(String domainId) { + return domainId(Output.of(domainId)); } /** - * @param domainId Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. + * @param domainName Configuration of the domain name to create. Cannot be specified together with `domainId`. * * @return builder * */ - public Builder domainId(String domainId) { - return domainId(Output.of(domainId)); + public Builder domainName(@Nullable DomainNameArgs domainName) { + $.domainName = domainName; + return this; } /** diff --git a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainConfigurationArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainNameArgs.java similarity index 93% rename from sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainConfigurationArgs.java rename to sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainNameArgs.java index e047717fa..ee3f30c8b 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainConfigurationArgs.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/apigatewayv2/inputs/DomainNameArgs.java @@ -116,9 +116,9 @@ * ``` * */ -public final class DomainConfigurationArgs extends com.pulumi.resources.ResourceArgs { +public final class DomainNameArgs extends com.pulumi.resources.ResourceArgs { - public static final DomainConfigurationArgs Empty = new DomainConfigurationArgs(); + public static final DomainNameArgs Empty = new DomainNameArgs(); /** * Domain name configuration. See below. @@ -165,9 +165,9 @@ public Optional>> tags() { return Optional.ofNullable(this.tags); } - private DomainConfigurationArgs() {} + private DomainNameArgs() {} - private DomainConfigurationArgs(DomainConfigurationArgs $) { + private DomainNameArgs(DomainNameArgs $) { this.domainNameConfiguration = $.domainNameConfiguration; this.mutualTlsAuthentication = $.mutualTlsAuthentication; this.tags = $.tags; @@ -176,19 +176,19 @@ private DomainConfigurationArgs(DomainConfigurationArgs $) { public static Builder builder() { return new Builder(); } - public static Builder builder(DomainConfigurationArgs defaults) { + public static Builder builder(DomainNameArgs defaults) { return new Builder(defaults); } public static final class Builder { - private DomainConfigurationArgs $; + private DomainNameArgs $; public Builder() { - $ = new DomainConfigurationArgs(); + $ = new DomainNameArgs(); } - public Builder(DomainConfigurationArgs defaults) { - $ = new DomainConfigurationArgs(Objects.requireNonNull(defaults)); + public Builder(DomainNameArgs defaults) { + $ = new DomainNameArgs(Objects.requireNonNull(defaults)); } /** @@ -254,7 +254,7 @@ public Builder tags(Map tags) { return tags(Output.of(tags)); } - public DomainConfigurationArgs build() { + public DomainNameArgs build() { $.domainNameConfiguration = Objects.requireNonNull($.domainNameConfiguration, "expected parameter 'domainNameConfiguration' to be non-null"); return $; } diff --git a/sdk/nodejs/types/input.ts b/sdk/nodejs/types/input.ts index 71ba84c60..8434bbd6b 100644 --- a/sdk/nodejs/types/input.ts +++ b/sdk/nodejs/types/input.ts @@ -10,6 +10,143 @@ import * as pulumiAws from "@pulumi/aws"; import * as utilities from "../utilities"; export namespace apigatewayv2 { + /** + * Manages an Amazon API Gateway Version 2 API mapping. + * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). + * + * {{% examples %}} + * ## Example Usage + * {{% example %}} + * ### Basic + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as aws from "@pulumi/aws"; + * + * const example = new aws.apigatewayv2.ApiMapping("example", { + * apiId: aws_apigatewayv2_api.example.id, + * domainName: aws_apigatewayv2_domain_name.example.id, + * stage: aws_apigatewayv2_stage.example.id, + * }); + * ``` + * ```python + * import pulumi + * import pulumi_aws as aws + * + * example = aws.apigatewayv2.ApiMapping("example", + * api_id=aws_apigatewayv2_api["example"]["id"], + * domain_name=aws_apigatewayv2_domain_name["example"]["id"], + * stage=aws_apigatewayv2_stage["example"]["id"]) + * ``` + * ```csharp + * using System.Collections.Generic; + * using System.Linq; + * using Pulumi; + * using Aws = Pulumi.Aws; + * + * return await Deployment.RunAsync(() => + * { + * var example = new Aws.ApiGatewayV2.ApiMapping("example", new() + * { + * ApiId = aws_apigatewayv2_api.Example.Id, + * DomainName = aws_apigatewayv2_domain_name.Example.Id, + * Stage = aws_apigatewayv2_stage.Example.Id, + * }); + * + * }); + * ``` + * ```go + * package main + * + * import ( + * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + * "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + * ) + * + * func main() { + * pulumi.Run(func(ctx *pulumi.Context) error { + * _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ + * ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + * DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), + * Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), + * }) + * if err != nil { + * return err + * } + * return nil + * }) + * } + * ``` + * ```java + * package generated_program; + * + * import com.pulumi.Context; + * import com.pulumi.Pulumi; + * import com.pulumi.core.Output; + * import com.pulumi.aws.apigatewayv2.ApiMapping; + * import com.pulumi.aws.apigatewayv2.ApiMappingArgs; + * import java.util.List; + * import java.util.ArrayList; + * import java.util.Map; + * import java.io.File; + * import java.nio.file.Files; + * import java.nio.file.Paths; + * + * public class App { + * public static void main(String[] args) { + * Pulumi.run(App::stack); + * } + * + * public static void stack(Context ctx) { + * var example = new ApiMapping("example", ApiMappingArgs.builder() + * .apiId(aws_apigatewayv2_api.example().id()) + * .domainName(aws_apigatewayv2_domain_name.example().id()) + * .stage(aws_apigatewayv2_stage.example().id()) + * .build()); + * + * } + * } + * ``` + * ```yaml + * resources: + * example: + * type: aws:apigatewayv2:ApiMapping + * properties: + * apiId: ${aws_apigatewayv2_api.example.id} + * domainName: ${aws_apigatewayv2_domain_name.example.id} + * stage: ${aws_apigatewayv2_stage.example.id} + * ``` + * {{% /example %}} + * {{% /examples %}} + * + * ## Import + * + * Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: + * + * ```sh + * $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com + * ``` + * + */ + export interface DomainMappingArgs { + /** + * The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). + */ + apiMappingKey?: pulumi.Input; + /** + * Identifier of an existing domain. Cannot be specified together with `DomainName`. + */ + domainId?: pulumi.Input; + /** + * Configuration of the domain name to create. Cannot be specified together with `domainId`. + */ + domainName?: inputs.apigatewayv2.DomainNameArgs; + /** + * API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. + */ + stage: pulumi.Input; + } + /** * Manages an Amazon API Gateway Version 2 domain name. * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). @@ -349,7 +486,7 @@ export namespace apigatewayv2 { * ``` * */ - export interface DomainConfigurationArgs { + export interface DomainNameArgs { /** * Domain name configuration. See below. */ @@ -364,143 +501,6 @@ export namespace apigatewayv2 { tags?: pulumi.Input<{[key: string]: pulumi.Input}>; } - /** - * Manages an Amazon API Gateway Version 2 API mapping. - * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). - * - * {{% examples %}} - * ## Example Usage - * {{% example %}} - * ### Basic - * - * ```typescript - * import * as pulumi from "@pulumi/pulumi"; - * import * as aws from "@pulumi/aws"; - * - * const example = new aws.apigatewayv2.ApiMapping("example", { - * apiId: aws_apigatewayv2_api.example.id, - * domainName: aws_apigatewayv2_domain_name.example.id, - * stage: aws_apigatewayv2_stage.example.id, - * }); - * ``` - * ```python - * import pulumi - * import pulumi_aws as aws - * - * example = aws.apigatewayv2.ApiMapping("example", - * api_id=aws_apigatewayv2_api["example"]["id"], - * domain_name=aws_apigatewayv2_domain_name["example"]["id"], - * stage=aws_apigatewayv2_stage["example"]["id"]) - * ``` - * ```csharp - * using System.Collections.Generic; - * using System.Linq; - * using Pulumi; - * using Aws = Pulumi.Aws; - * - * return await Deployment.RunAsync(() => - * { - * var example = new Aws.ApiGatewayV2.ApiMapping("example", new() - * { - * ApiId = aws_apigatewayv2_api.Example.Id, - * DomainName = aws_apigatewayv2_domain_name.Example.Id, - * Stage = aws_apigatewayv2_stage.Example.Id, - * }); - * - * }); - * ``` - * ```go - * package main - * - * import ( - * "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" - * "github.com/pulumi/pulumi/sdk/v3/go/pulumi" - * ) - * - * func main() { - * pulumi.Run(func(ctx *pulumi.Context) error { - * _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ - * ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), - * DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), - * Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), - * }) - * if err != nil { - * return err - * } - * return nil - * }) - * } - * ``` - * ```java - * package generated_program; - * - * import com.pulumi.Context; - * import com.pulumi.Pulumi; - * import com.pulumi.core.Output; - * import com.pulumi.aws.apigatewayv2.ApiMapping; - * import com.pulumi.aws.apigatewayv2.ApiMappingArgs; - * import java.util.List; - * import java.util.ArrayList; - * import java.util.Map; - * import java.io.File; - * import java.nio.file.Files; - * import java.nio.file.Paths; - * - * public class App { - * public static void main(String[] args) { - * Pulumi.run(App::stack); - * } - * - * public static void stack(Context ctx) { - * var example = new ApiMapping("example", ApiMappingArgs.builder() - * .apiId(aws_apigatewayv2_api.example().id()) - * .domainName(aws_apigatewayv2_domain_name.example().id()) - * .stage(aws_apigatewayv2_stage.example().id()) - * .build()); - * - * } - * } - * ``` - * ```yaml - * resources: - * example: - * type: aws:apigatewayv2:ApiMapping - * properties: - * apiId: ${aws_apigatewayv2_api.example.id} - * domainName: ${aws_apigatewayv2_domain_name.example.id} - * stage: ${aws_apigatewayv2_stage.example.id} - * ``` - * {{% /example %}} - * {{% /examples %}} - * - * ## Import - * - * Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: - * - * ```sh - * $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com - * ``` - * - */ - export interface DomainMappingArgs { - /** - * The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). - */ - apiMappingKey?: pulumi.Input; - /** - * Configuration of the domain name to create. Cannot be specified together with `domainId`. - */ - domainConfiguration?: inputs.apigatewayv2.DomainConfigurationArgs; - /** - * Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. - */ - domainId?: pulumi.Input; - /** - * API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. - */ - stage: pulumi.Input; - } - /** * Manages an Amazon API Gateway Version 2 authorizer. * More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). diff --git a/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py b/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py index d13cde5f9..b026d4786 100644 --- a/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py +++ b/sdk/python/pulumi_awsx/apigatewayv2/_inputs.py @@ -11,8 +11,8 @@ import pulumi_aws __all__ = [ - 'DomainConfigurationArgs', 'DomainMappingArgs', + 'DomainNameArgs', 'HttpAuthorizerArgs', 'HttpIntegrationArgs', 'HttpRouteArgs', @@ -20,7 +20,193 @@ ] @pulumi.input_type -class DomainConfigurationArgs: +class DomainMappingArgs: + def __init__(__self__, *, + stage: pulumi.Input[str], + api_mapping_key: Optional[pulumi.Input[str]] = None, + domain_id: Optional[pulumi.Input[str]] = None, + domain_name: Optional['DomainNameArgs'] = None): + """ + Manages an Amazon API Gateway Version 2 API mapping. + More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). + + {{% examples %}} + ## Example Usage + {{% example %}} + ### Basic + + ```typescript + import * as pulumi from "@pulumi/pulumi"; + import * as aws from "@pulumi/aws"; + + const example = new aws.apigatewayv2.ApiMapping("example", { + apiId: aws_apigatewayv2_api.example.id, + domainName: aws_apigatewayv2_domain_name.example.id, + stage: aws_apigatewayv2_stage.example.id, + }); + ``` + ```python + import pulumi + import pulumi_aws as aws + + example = aws.apigatewayv2.ApiMapping("example", + api_id=aws_apigatewayv2_api["example"]["id"], + domain_name=aws_apigatewayv2_domain_name["example"]["id"], + stage=aws_apigatewayv2_stage["example"]["id"]) + ``` + ```csharp + using System.Collections.Generic; + using System.Linq; + using Pulumi; + using Aws = Pulumi.Aws; + + return await Deployment.RunAsync(() => + { + var example = new Aws.ApiGatewayV2.ApiMapping("example", new() + { + ApiId = aws_apigatewayv2_api.Example.Id, + DomainName = aws_apigatewayv2_domain_name.Example.Id, + Stage = aws_apigatewayv2_stage.Example.Id, + }); + + }); + ``` + ```go + package main + + import ( + "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + ) + + func main() { + pulumi.Run(func(ctx *pulumi.Context) error { + _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ + ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), + DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), + Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), + }) + if err != nil { + return err + } + return nil + }) + } + ``` + ```java + package generated_program; + + import com.pulumi.Context; + import com.pulumi.Pulumi; + import com.pulumi.core.Output; + import com.pulumi.aws.apigatewayv2.ApiMapping; + import com.pulumi.aws.apigatewayv2.ApiMappingArgs; + import java.util.List; + import java.util.ArrayList; + import java.util.Map; + import java.io.File; + import java.nio.file.Files; + import java.nio.file.Paths; + + public class App { + public static void main(String[] args) { + Pulumi.run(App::stack); + } + + public static void stack(Context ctx) { + var example = new ApiMapping("example", ApiMappingArgs.builder() + .apiId(aws_apigatewayv2_api.example().id()) + .domainName(aws_apigatewayv2_domain_name.example().id()) + .stage(aws_apigatewayv2_stage.example().id()) + .build()); + + } + } + ``` + ```yaml + resources: + example: + type: aws:apigatewayv2:ApiMapping + properties: + apiId: ${aws_apigatewayv2_api.example.id} + domainName: ${aws_apigatewayv2_domain_name.example.id} + stage: ${aws_apigatewayv2_stage.example.id} + ``` + {{% /example %}} + {{% /examples %}} + + ## Import + + Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: + + ```sh + $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com + ``` + + :param pulumi.Input[str] stage: API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. + :param pulumi.Input[str] api_mapping_key: The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). + :param pulumi.Input[str] domain_id: Identifier of an existing domain. Cannot be specified together with `DomainName`. + :param 'DomainNameArgs' domain_name: Configuration of the domain name to create. Cannot be specified together with `domainId`. + """ + pulumi.set(__self__, "stage", stage) + if api_mapping_key is not None: + pulumi.set(__self__, "api_mapping_key", api_mapping_key) + if domain_id is not None: + pulumi.set(__self__, "domain_id", domain_id) + if domain_name is not None: + pulumi.set(__self__, "domain_name", domain_name) + + @property + @pulumi.getter + def stage(self) -> pulumi.Input[str]: + """ + API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. + """ + return pulumi.get(self, "stage") + + @stage.setter + def stage(self, value: pulumi.Input[str]): + pulumi.set(self, "stage", value) + + @property + @pulumi.getter(name="apiMappingKey") + def api_mapping_key(self) -> Optional[pulumi.Input[str]]: + """ + The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). + """ + return pulumi.get(self, "api_mapping_key") + + @api_mapping_key.setter + def api_mapping_key(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "api_mapping_key", value) + + @property + @pulumi.getter(name="domainId") + def domain_id(self) -> Optional[pulumi.Input[str]]: + """ + Identifier of an existing domain. Cannot be specified together with `DomainName`. + """ + return pulumi.get(self, "domain_id") + + @domain_id.setter + def domain_id(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "domain_id", value) + + @property + @pulumi.getter(name="domainName") + def domain_name(self) -> Optional['DomainNameArgs']: + """ + Configuration of the domain name to create. Cannot be specified together with `domainId`. + """ + return pulumi.get(self, "domain_name") + + @domain_name.setter + def domain_name(self, value: Optional['DomainNameArgs']): + pulumi.set(self, "domain_name", value) + + +@pulumi.input_type +class DomainNameArgs: def __init__(__self__, *, domain_name_configuration: pulumi.Input['pulumi_aws.apigatewayv2.DomainNameDomainNameConfigurationArgs'], mutual_tls_authentication: Optional[pulumi.Input['pulumi_aws.apigatewayv2.DomainNameMutualTlsAuthenticationArgs']] = None, @@ -410,192 +596,6 @@ def tags(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]): pulumi.set(self, "tags", value) -@pulumi.input_type -class DomainMappingArgs: - def __init__(__self__, *, - stage: pulumi.Input[str], - api_mapping_key: Optional[pulumi.Input[str]] = None, - domain_configuration: Optional['DomainConfigurationArgs'] = None, - domain_id: Optional[pulumi.Input[str]] = None): - """ - Manages an Amazon API Gateway Version 2 API mapping. - More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html). - - {{% examples %}} - ## Example Usage - {{% example %}} - ### Basic - - ```typescript - import * as pulumi from "@pulumi/pulumi"; - import * as aws from "@pulumi/aws"; - - const example = new aws.apigatewayv2.ApiMapping("example", { - apiId: aws_apigatewayv2_api.example.id, - domainName: aws_apigatewayv2_domain_name.example.id, - stage: aws_apigatewayv2_stage.example.id, - }); - ``` - ```python - import pulumi - import pulumi_aws as aws - - example = aws.apigatewayv2.ApiMapping("example", - api_id=aws_apigatewayv2_api["example"]["id"], - domain_name=aws_apigatewayv2_domain_name["example"]["id"], - stage=aws_apigatewayv2_stage["example"]["id"]) - ``` - ```csharp - using System.Collections.Generic; - using System.Linq; - using Pulumi; - using Aws = Pulumi.Aws; - - return await Deployment.RunAsync(() => - { - var example = new Aws.ApiGatewayV2.ApiMapping("example", new() - { - ApiId = aws_apigatewayv2_api.Example.Id, - DomainName = aws_apigatewayv2_domain_name.Example.Id, - Stage = aws_apigatewayv2_stage.Example.Id, - }); - - }); - ``` - ```go - package main - - import ( - "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" - "github.com/pulumi/pulumi/sdk/v3/go/pulumi" - ) - - func main() { - pulumi.Run(func(ctx *pulumi.Context) error { - _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ - ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id), - DomainName: pulumi.Any(aws_apigatewayv2_domain_name.Example.Id), - Stage: pulumi.Any(aws_apigatewayv2_stage.Example.Id), - }) - if err != nil { - return err - } - return nil - }) - } - ``` - ```java - package generated_program; - - import com.pulumi.Context; - import com.pulumi.Pulumi; - import com.pulumi.core.Output; - import com.pulumi.aws.apigatewayv2.ApiMapping; - import com.pulumi.aws.apigatewayv2.ApiMappingArgs; - import java.util.List; - import java.util.ArrayList; - import java.util.Map; - import java.io.File; - import java.nio.file.Files; - import java.nio.file.Paths; - - public class App { - public static void main(String[] args) { - Pulumi.run(App::stack); - } - - public static void stack(Context ctx) { - var example = new ApiMapping("example", ApiMappingArgs.builder() - .apiId(aws_apigatewayv2_api.example().id()) - .domainName(aws_apigatewayv2_domain_name.example().id()) - .stage(aws_apigatewayv2_stage.example().id()) - .build()); - - } - } - ``` - ```yaml - resources: - example: - type: aws:apigatewayv2:ApiMapping - properties: - apiId: ${aws_apigatewayv2_api.example.id} - domainName: ${aws_apigatewayv2_domain_name.example.id} - stage: ${aws_apigatewayv2_stage.example.id} - ``` - {{% /example %}} - {{% /examples %}} - - ## Import - - Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: - - ```sh - $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com - ``` - - :param pulumi.Input[str] stage: API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. - :param pulumi.Input[str] api_mapping_key: The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). - :param 'DomainConfigurationArgs' domain_configuration: Configuration of the domain name to create. Cannot be specified together with `domainId`. - :param pulumi.Input[str] domain_id: Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. - """ - pulumi.set(__self__, "stage", stage) - if api_mapping_key is not None: - pulumi.set(__self__, "api_mapping_key", api_mapping_key) - if domain_configuration is not None: - pulumi.set(__self__, "domain_configuration", domain_configuration) - if domain_id is not None: - pulumi.set(__self__, "domain_id", domain_id) - - @property - @pulumi.getter - def stage(self) -> pulumi.Input[str]: - """ - API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage. - """ - return pulumi.get(self, "stage") - - @stage.setter - def stage(self, value: pulumi.Input[str]): - pulumi.set(self, "stage", value) - - @property - @pulumi.getter(name="apiMappingKey") - def api_mapping_key(self) -> Optional[pulumi.Input[str]]: - """ - The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html). - """ - return pulumi.get(self, "api_mapping_key") - - @api_mapping_key.setter - def api_mapping_key(self, value: Optional[pulumi.Input[str]]): - pulumi.set(self, "api_mapping_key", value) - - @property - @pulumi.getter(name="domainConfiguration") - def domain_configuration(self) -> Optional['DomainConfigurationArgs']: - """ - Configuration of the domain name to create. Cannot be specified together with `domainId`. - """ - return pulumi.get(self, "domain_configuration") - - @domain_configuration.setter - def domain_configuration(self, value: Optional['DomainConfigurationArgs']): - pulumi.set(self, "domain_configuration", value) - - @property - @pulumi.getter(name="domainId") - def domain_id(self) -> Optional[pulumi.Input[str]]: - """ - Identifier of an existing domain. Cannot be specified together with `domainConfiguration`. - """ - return pulumi.get(self, "domain_id") - - @domain_id.setter - def domain_id(self, value: Optional[pulumi.Input[str]]): - pulumi.set(self, "domain_id", value) - - @pulumi.input_type class HttpAuthorizerArgs: def __init__(__self__, *,