1. Packages
  2. AWS Cloud Control
  3. API Docs
  4. apigateway
  5. RestApi

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.27.0 published on Monday, Apr 14, 2025 by Pulumi

aws-native.apigateway.RestApi

Explore with Pulumi AI

The AWS::ApiGateway::RestApi resource creates a REST API. For more information, see restapi:create in the Amazon API Gateway REST API Reference. On January 1, 2016, the Swagger Specification was donated to the OpenAPI initiative, becoming the foundation of the OpenAPI Specification.

Example Usage

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var apiName = config.Require("apiName");
    var description = config.Require("description");
    var version = config.Require("version");
    var type = config.Require("type");
    var property = config.Require("property");
    var restApi = new AwsNative.ApiGateway.RestApi("restApi", new()
    {
        Name = apiName,
    });

    var documentationPart = new AwsNative.ApiGateway.DocumentationPart("documentationPart", new()
    {
        Location = new AwsNative.ApiGateway.Inputs.DocumentationPartLocationArgs
        {
            Type = System.Enum.Parse<AwsNative.ApiGateway.DocumentationPartLocationType>(type),
        },
        RestApiId = restApi.Id,
        Properties = property,
    });

    var documentationVersion = new AwsNative.ApiGateway.DocumentationVersion("documentationVersion", new()
    {
        Description = description,
        DocumentationVersionValue = version,
        RestApiId = restApi.Id,
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            documentationPart,
        },
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		apiName := cfg.Require("apiName")
		description := cfg.Require("description")
		version := cfg.Require("version")
		_type := cfg.Require("type")
		property := cfg.Require("property")
		restApi, err := apigateway.NewRestApi(ctx, "restApi", &apigateway.RestApiArgs{
			Name: pulumi.String(apiName),
		})
		if err != nil {
			return err
		}
		documentationPart, err := apigateway.NewDocumentationPart(ctx, "documentationPart", &apigateway.DocumentationPartArgs{
			Location: &apigateway.DocumentationPartLocationArgs{
				Type: apigateway.DocumentationPartLocationType(_type),
			},
			RestApiId:  restApi.ID(),
			Properties: pulumi.String(property),
		})
		if err != nil {
			return err
		}
		_, err = apigateway.NewDocumentationVersion(ctx, "documentationVersion", &apigateway.DocumentationVersionArgs{
			Description:          pulumi.String(description),
			DocumentationVersion: pulumi.String(version),
			RestApiId:            restApi.ID(),
		}, pulumi.DependsOn([]pulumi.Resource{
			documentationPart,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const config = new pulumi.Config();
const apiName = config.require("apiName");
const description = config.require("description");
const version = config.require("version");
const type = config.require("type");
const property = config.require("property");
const restApi = new aws_native.apigateway.RestApi("restApi", {name: apiName});
const documentationPart = new aws_native.apigateway.DocumentationPart("documentationPart", {
    location: {
        type: aws_native.apigateway.DocumentationPartLocationType[type],
    },
    restApiId: restApi.id,
    properties: property,
});
const documentationVersion = new aws_native.apigateway.DocumentationVersion("documentationVersion", {
    description: description,
    documentationVersion: version,
    restApiId: restApi.id,
}, {
    dependsOn: [documentationPart],
});
Copy
import pulumi
import pulumi_aws_native as aws_native

config = pulumi.Config()
api_name = config.require("apiName")
description = config.require("description")
version = config.require("version")
type = config.require("type")
property = config.require("property")
rest_api = aws_native.apigateway.RestApi("restApi", name=api_name)
documentation_part = aws_native.apigateway.DocumentationPart("documentationPart",
    location={
        "type": aws_native.apigateway.DocumentationPartLocationType(type),
    },
    rest_api_id=rest_api.id,
    properties=property)
documentation_version = aws_native.apigateway.DocumentationVersion("documentationVersion",
    description=description,
    documentation_version=version,
    rest_api_id=rest_api.id,
    opts = pulumi.ResourceOptions(depends_on=[documentation_part]))
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var apiName = config.Require("apiName");
    var description = config.Require("description");
    var version = config.Require("version");
    var type = config.Require("type");
    var property = config.Require("property");
    var restApi = new AwsNative.ApiGateway.RestApi("restApi", new()
    {
        Name = apiName,
    });

    var documentationPart = new AwsNative.ApiGateway.DocumentationPart("documentationPart", new()
    {
        Location = new AwsNative.ApiGateway.Inputs.DocumentationPartLocationArgs
        {
            Type = System.Enum.Parse<AwsNative.ApiGateway.DocumentationPartLocationType>(type),
        },
        RestApiId = restApi.Id,
        Properties = property,
    });

    var documentationVersion = new AwsNative.ApiGateway.DocumentationVersion("documentationVersion", new()
    {
        Description = description,
        DocumentationVersionValue = version,
        RestApiId = restApi.Id,
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            documentationPart,
        },
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		apiName := cfg.Require("apiName")
		description := cfg.Require("description")
		version := cfg.Require("version")
		_type := cfg.Require("type")
		property := cfg.Require("property")
		restApi, err := apigateway.NewRestApi(ctx, "restApi", &apigateway.RestApiArgs{
			Name: pulumi.String(apiName),
		})
		if err != nil {
			return err
		}
		documentationPart, err := apigateway.NewDocumentationPart(ctx, "documentationPart", &apigateway.DocumentationPartArgs{
			Location: &apigateway.DocumentationPartLocationArgs{
				Type: apigateway.DocumentationPartLocationType(_type),
			},
			RestApiId:  restApi.ID(),
			Properties: pulumi.String(property),
		})
		if err != nil {
			return err
		}
		_, err = apigateway.NewDocumentationVersion(ctx, "documentationVersion", &apigateway.DocumentationVersionArgs{
			Description:          pulumi.String(description),
			DocumentationVersion: pulumi.String(version),
			RestApiId:            restApi.ID(),
		}, pulumi.DependsOn([]pulumi.Resource{
			documentationPart,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const config = new pulumi.Config();
const apiName = config.require("apiName");
const description = config.require("description");
const version = config.require("version");
const type = config.require("type");
const property = config.require("property");
const restApi = new aws_native.apigateway.RestApi("restApi", {name: apiName});
const documentationPart = new aws_native.apigateway.DocumentationPart("documentationPart", {
    location: {
        type: aws_native.apigateway.DocumentationPartLocationType[type],
    },
    restApiId: restApi.id,
    properties: property,
});
const documentationVersion = new aws_native.apigateway.DocumentationVersion("documentationVersion", {
    description: description,
    documentationVersion: version,
    restApiId: restApi.id,
}, {
    dependsOn: [documentationPart],
});
Copy
import pulumi
import pulumi_aws_native as aws_native

config = pulumi.Config()
api_name = config.require("apiName")
description = config.require("description")
version = config.require("version")
type = config.require("type")
property = config.require("property")
rest_api = aws_native.apigateway.RestApi("restApi", name=api_name)
documentation_part = aws_native.apigateway.DocumentationPart("documentationPart",
    location={
        "type": aws_native.apigateway.DocumentationPartLocationType(type),
    },
    rest_api_id=rest_api.id,
    properties=property)
documentation_version = aws_native.apigateway.DocumentationVersion("documentationVersion",
    description=description,
    documentation_version=version,
    rest_api_id=rest_api.id,
    opts = pulumi.ResourceOptions(depends_on=[documentation_part]))
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var restApi = new AwsNative.ApiGateway.RestApi("restApi", new()
    {
        Name = "myRestApi",
    });

    var gatewayResponse = new AwsNative.ApiGateway.GatewayResponse("gatewayResponse", new()
    {
        ResponseParameters = 
        {
            { "gatewayresponse.header.Access-Control-Allow-Origin", "'*'" },
            { "gatewayresponse.header.Access-Control-Allow-Headers", "'*'" },
        },
        ResponseType = "MISSING_AUTHENTICATION_TOKEN",
        RestApiId = restApi.Id,
        StatusCode = "404",
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		restApi, err := apigateway.NewRestApi(ctx, "restApi", &apigateway.RestApiArgs{
			Name: pulumi.String("myRestApi"),
		})
		if err != nil {
			return err
		}
		_, err = apigateway.NewGatewayResponse(ctx, "gatewayResponse", &apigateway.GatewayResponseArgs{
			ResponseParameters: pulumi.StringMap{
				"gatewayresponse.header.Access-Control-Allow-Origin":  pulumi.String("'*'"),
				"gatewayresponse.header.Access-Control-Allow-Headers": pulumi.String("'*'"),
			},
			ResponseType: pulumi.String("MISSING_AUTHENTICATION_TOKEN"),
			RestApiId:    restApi.ID(),
			StatusCode:   pulumi.String("404"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const restApi = new aws_native.apigateway.RestApi("restApi", {name: "myRestApi"});
const gatewayResponse = new aws_native.apigateway.GatewayResponse("gatewayResponse", {
    responseParameters: {
        "gatewayresponse.header.Access-Control-Allow-Origin": "'*'",
        "gatewayresponse.header.Access-Control-Allow-Headers": "'*'",
    },
    responseType: "MISSING_AUTHENTICATION_TOKEN",
    restApiId: restApi.id,
    statusCode: "404",
});
Copy
import pulumi
import pulumi_aws_native as aws_native

rest_api = aws_native.apigateway.RestApi("restApi", name="myRestApi")
gateway_response = aws_native.apigateway.GatewayResponse("gatewayResponse",
    response_parameters={
        "gatewayresponse.header.Access-Control-Allow-Origin": "'*'",
        "gatewayresponse.header.Access-Control-Allow-Headers": "'*'",
    },
    response_type="MISSING_AUTHENTICATION_TOKEN",
    rest_api_id=rest_api.id,
    status_code="404")
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var restApi = new AwsNative.ApiGateway.RestApi("restApi", new()
    {
        Name = "myRestApi",
    });

    var gatewayResponse = new AwsNative.ApiGateway.GatewayResponse("gatewayResponse", new()
    {
        ResponseParameters = 
        {
            { "gatewayresponse.header.Access-Control-Allow-Origin", "'*'" },
            { "gatewayresponse.header.Access-Control-Allow-Headers", "'*'" },
        },
        ResponseType = "MISSING_AUTHENTICATION_TOKEN",
        RestApiId = restApi.Id,
        StatusCode = "404",
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		restApi, err := apigateway.NewRestApi(ctx, "restApi", &apigateway.RestApiArgs{
			Name: pulumi.String("myRestApi"),
		})
		if err != nil {
			return err
		}
		_, err = apigateway.NewGatewayResponse(ctx, "gatewayResponse", &apigateway.GatewayResponseArgs{
			ResponseParameters: pulumi.StringMap{
				"gatewayresponse.header.Access-Control-Allow-Origin":  pulumi.String("'*'"),
				"gatewayresponse.header.Access-Control-Allow-Headers": pulumi.String("'*'"),
			},
			ResponseType: pulumi.String("MISSING_AUTHENTICATION_TOKEN"),
			RestApiId:    restApi.ID(),
			StatusCode:   pulumi.String("404"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const restApi = new aws_native.apigateway.RestApi("restApi", {name: "myRestApi"});
const gatewayResponse = new aws_native.apigateway.GatewayResponse("gatewayResponse", {
    responseParameters: {
        "gatewayresponse.header.Access-Control-Allow-Origin": "'*'",
        "gatewayresponse.header.Access-Control-Allow-Headers": "'*'",
    },
    responseType: "MISSING_AUTHENTICATION_TOKEN",
    restApiId: restApi.id,
    statusCode: "404",
});
Copy
import pulumi
import pulumi_aws_native as aws_native

rest_api = aws_native.apigateway.RestApi("restApi", name="myRestApi")
gateway_response = aws_native.apigateway.GatewayResponse("gatewayResponse",
    response_parameters={
        "gatewayresponse.header.Access-Control-Allow-Origin": "'*'",
        "gatewayresponse.header.Access-Control-Allow-Headers": "'*'",
    },
    response_type="MISSING_AUTHENTICATION_TOKEN",
    rest_api_id=rest_api.id,
    status_code="404")
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var apiName = config.Require("apiName");
    var responseParameter1 = config.Require("responseParameter1");
    var responseParameter2 = config.Require("responseParameter2");
    var responseType = config.Require("responseType");
    var statusCode = config.Require("statusCode");
    var restApi = new AwsNative.ApiGateway.RestApi("restApi", new()
    {
        Name = apiName,
    });

    var gatewayResponse = new AwsNative.ApiGateway.GatewayResponse("gatewayResponse", new()
    {
        ResponseParameters = 
        {
            { "gatewayresponse.header.k1", responseParameter1 },
            { "gatewayresponse.header.k2", responseParameter2 },
        },
        ResponseType = responseType,
        RestApiId = restApi.Id,
        StatusCode = statusCode,
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		apiName := cfg.Require("apiName")
		responseParameter1 := cfg.Require("responseParameter1")
		responseParameter2 := cfg.Require("responseParameter2")
		responseType := cfg.Require("responseType")
		statusCode := cfg.Require("statusCode")
		restApi, err := apigateway.NewRestApi(ctx, "restApi", &apigateway.RestApiArgs{
			Name: pulumi.String(apiName),
		})
		if err != nil {
			return err
		}
		_, err = apigateway.NewGatewayResponse(ctx, "gatewayResponse", &apigateway.GatewayResponseArgs{
			ResponseParameters: pulumi.StringMap{
				"gatewayresponse.header.k1": pulumi.String(responseParameter1),
				"gatewayresponse.header.k2": pulumi.String(responseParameter2),
			},
			ResponseType: pulumi.String(responseType),
			RestApiId:    restApi.ID(),
			StatusCode:   pulumi.String(statusCode),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const config = new pulumi.Config();
const apiName = config.require("apiName");
const responseParameter1 = config.require("responseParameter1");
const responseParameter2 = config.require("responseParameter2");
const responseType = config.require("responseType");
const statusCode = config.require("statusCode");
const restApi = new aws_native.apigateway.RestApi("restApi", {name: apiName});
const gatewayResponse = new aws_native.apigateway.GatewayResponse("gatewayResponse", {
    responseParameters: {
        "gatewayresponse.header.k1": responseParameter1,
        "gatewayresponse.header.k2": responseParameter2,
    },
    responseType: responseType,
    restApiId: restApi.id,
    statusCode: statusCode,
});
Copy
import pulumi
import pulumi_aws_native as aws_native

config = pulumi.Config()
api_name = config.require("apiName")
response_parameter1 = config.require("responseParameter1")
response_parameter2 = config.require("responseParameter2")
response_type = config.require("responseType")
status_code = config.require("statusCode")
rest_api = aws_native.apigateway.RestApi("restApi", name=api_name)
gateway_response = aws_native.apigateway.GatewayResponse("gatewayResponse",
    response_parameters={
        "gatewayresponse.header.k1": response_parameter1,
        "gatewayresponse.header.k2": response_parameter2,
    },
    response_type=response_type,
    rest_api_id=rest_api.id,
    status_code=status_code)
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var apiName = config.Require("apiName");
    var responseParameter1 = config.Require("responseParameter1");
    var responseParameter2 = config.Require("responseParameter2");
    var responseType = config.Require("responseType");
    var statusCode = config.Require("statusCode");
    var restApi = new AwsNative.ApiGateway.RestApi("restApi", new()
    {
        Name = apiName,
    });

    var gatewayResponse = new AwsNative.ApiGateway.GatewayResponse("gatewayResponse", new()
    {
        ResponseParameters = 
        {
            { "gatewayresponse.header.k1", responseParameter1 },
            { "gatewayresponse.header.k2", responseParameter2 },
        },
        ResponseType = responseType,
        RestApiId = restApi.Id,
        StatusCode = statusCode,
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		apiName := cfg.Require("apiName")
		responseParameter1 := cfg.Require("responseParameter1")
		responseParameter2 := cfg.Require("responseParameter2")
		responseType := cfg.Require("responseType")
		statusCode := cfg.Require("statusCode")
		restApi, err := apigateway.NewRestApi(ctx, "restApi", &apigateway.RestApiArgs{
			Name: pulumi.String(apiName),
		})
		if err != nil {
			return err
		}
		_, err = apigateway.NewGatewayResponse(ctx, "gatewayResponse", &apigateway.GatewayResponseArgs{
			ResponseParameters: pulumi.StringMap{
				"gatewayresponse.header.k1": pulumi.String(responseParameter1),
				"gatewayresponse.header.k2": pulumi.String(responseParameter2),
			},
			ResponseType: pulumi.String(responseType),
			RestApiId:    restApi.ID(),
			StatusCode:   pulumi.String(statusCode),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const config = new pulumi.Config();
const apiName = config.require("apiName");
const responseParameter1 = config.require("responseParameter1");
const responseParameter2 = config.require("responseParameter2");
const responseType = config.require("responseType");
const statusCode = config.require("statusCode");
const restApi = new aws_native.apigateway.RestApi("restApi", {name: apiName});
const gatewayResponse = new aws_native.apigateway.GatewayResponse("gatewayResponse", {
    responseParameters: {
        "gatewayresponse.header.k1": responseParameter1,
        "gatewayresponse.header.k2": responseParameter2,
    },
    responseType: responseType,
    restApiId: restApi.id,
    statusCode: statusCode,
});
Copy
import pulumi
import pulumi_aws_native as aws_native

config = pulumi.Config()
api_name = config.require("apiName")
response_parameter1 = config.require("responseParameter1")
response_parameter2 = config.require("responseParameter2")
response_type = config.require("responseType")
status_code = config.require("statusCode")
rest_api = aws_native.apigateway.RestApi("restApi", name=api_name)
gateway_response = aws_native.apigateway.GatewayResponse("gatewayResponse",
    response_parameters={
        "gatewayresponse.header.k1": response_parameter1,
        "gatewayresponse.header.k2": response_parameter2,
    },
    response_type=response_type,
    rest_api_id=rest_api.id,
    status_code=status_code)
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var contentHandling = config.Require("contentHandling");
    var operationName = config.Get("operationName") ?? "testoperationName";
    var restApiName = config.Get("restApiName") ?? "testrestApiName";
    var validatorName = config.Get("validatorName") ?? "testvalidatorName";
    var validateRequestBody = config.Get("validateRequestBody") ?? "testvalidateRequestBody";
    var validateRequestParameters = config.Get("validateRequestParameters") ?? true;
    var restApi = new AwsNative.ApiGateway.RestApi("restApi", new()
    {
        Name = restApiName,
    });

    var requestValidator = new AwsNative.ApiGateway.RequestValidator("requestValidator", new()
    {
        Name = validatorName,
        RestApiId = restApi.Id,
        ValidateRequestBody = validateRequestBody,
        ValidateRequestParameters = validateRequestParameters,
    });

    var method = new AwsNative.ApiGateway.Method("method", new()
    {
        HttpMethod = "POST",
        ResourceId = restApi.RootResourceId,
        RestApiId = restApi.Id,
        AuthorizationType = "NONE",
        Integration = new AwsNative.ApiGateway.Inputs.MethodIntegrationArgs
        {
            Type = AwsNative.ApiGateway.MethodIntegrationType.Mock,
            ContentHandling = System.Enum.Parse<AwsNative.ApiGateway.MethodIntegrationContentHandling>(contentHandling),
            IntegrationResponses = new[]
            {
                new AwsNative.ApiGateway.Inputs.MethodIntegrationResponseArgs
                {
                    ContentHandling = System.Enum.Parse<AwsNative.ApiGateway.MethodIntegrationResponseContentHandling>(contentHandling),
                    StatusCode = "400",
                },
            },
        },
        RequestValidatorId = requestValidator.Id,
        OperationName = operationName,
    });

    return new Dictionary<string, object?>
    {
        ["rootResourceId"] = restApi.RootResourceId,
    };
});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		contentHandling := cfg.Require("contentHandling")
		operationName := "testoperationName"
		if param := cfg.Get("operationName"); param != "" {
			operationName = param
		}
		restApiName := "testrestApiName"
		if param := cfg.Get("restApiName"); param != "" {
			restApiName = param
		}
		validatorName := "testvalidatorName"
		if param := cfg.Get("validatorName"); param != "" {
			validatorName = param
		}
		validateRequestBody := "testvalidateRequestBody"
		if param := cfg.Get("validateRequestBody"); param != "" {
			validateRequestBody = param
		}
		validateRequestParameters := true
		if param := cfg.Get("validateRequestParameters"); param != "" {
			validateRequestParameters = param
		}
		restApi, err := apigateway.NewRestApi(ctx, "restApi", &apigateway.RestApiArgs{
			Name: pulumi.String(restApiName),
		})
		if err != nil {
			return err
		}
		requestValidator, err := apigateway.NewRequestValidator(ctx, "requestValidator", &apigateway.RequestValidatorArgs{
			Name:                      pulumi.String(validatorName),
			RestApiId:                 restApi.ID(),
			ValidateRequestBody:       pulumi.String(validateRequestBody),
			ValidateRequestParameters: pulumi.String(validateRequestParameters),
		})
		if err != nil {
			return err
		}
		_, err = apigateway.NewMethod(ctx, "method", &apigateway.MethodArgs{
			HttpMethod:        pulumi.String("POST"),
			ResourceId:        restApi.RootResourceId,
			RestApiId:         restApi.ID(),
			AuthorizationType: pulumi.String("NONE"),
			Integration: &apigateway.MethodIntegrationArgs{
				Type:            apigateway.MethodIntegrationTypeMock,
				ContentHandling: apigateway.MethodIntegrationContentHandling(contentHandling),
				IntegrationResponses: apigateway.MethodIntegrationResponseArray{
					&apigateway.MethodIntegrationResponseArgs{
						ContentHandling: apigateway.MethodIntegrationResponseContentHandling(contentHandling),
						StatusCode:      pulumi.String("400"),
					},
				},
			},
			RequestValidatorId: requestValidator.ID(),
			OperationName:      pulumi.String(operationName),
		})
		if err != nil {
			return err
		}
		ctx.Export("rootResourceId", restApi.RootResourceId)
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const config = new pulumi.Config();
const contentHandling = config.require("contentHandling");
const operationName = config.get("operationName") || "testoperationName";
const restApiName = config.get("restApiName") || "testrestApiName";
const validatorName = config.get("validatorName") || "testvalidatorName";
const validateRequestBody = config.get("validateRequestBody") || "testvalidateRequestBody";
const validateRequestParameters = config.get("validateRequestParameters") || true;
const restApi = new aws_native.apigateway.RestApi("restApi", {name: restApiName});
const requestValidator = new aws_native.apigateway.RequestValidator("requestValidator", {
    name: validatorName,
    restApiId: restApi.id,
    validateRequestBody: validateRequestBody,
    validateRequestParameters: validateRequestParameters,
});
const method = new aws_native.apigateway.Method("method", {
    httpMethod: "POST",
    resourceId: restApi.rootResourceId,
    restApiId: restApi.id,
    authorizationType: "NONE",
    integration: {
        type: aws_native.apigateway.MethodIntegrationType.Mock,
        contentHandling: aws_native.apigateway.MethodIntegrationContentHandling[contentHandling],
        integrationResponses: [{
            contentHandling: aws_native.apigateway.MethodIntegrationResponseContentHandling[contentHandling],
            statusCode: "400",
        }],
    },
    requestValidatorId: requestValidator.id,
    operationName: operationName,
});
export const rootResourceId = restApi.rootResourceId;
Copy
import pulumi
import pulumi_aws_native as aws_native

config = pulumi.Config()
content_handling = config.require("contentHandling")
operation_name = config.get("operationName")
if operation_name is None:
    operation_name = "testoperationName"
rest_api_name = config.get("restApiName")
if rest_api_name is None:
    rest_api_name = "testrestApiName"
validator_name = config.get("validatorName")
if validator_name is None:
    validator_name = "testvalidatorName"
validate_request_body = config.get("validateRequestBody")
if validate_request_body is None:
    validate_request_body = "testvalidateRequestBody"
validate_request_parameters = config.get("validateRequestParameters")
if validate_request_parameters is None:
    validate_request_parameters = True
rest_api = aws_native.apigateway.RestApi("restApi", name=rest_api_name)
request_validator = aws_native.apigateway.RequestValidator("requestValidator",
    name=validator_name,
    rest_api_id=rest_api.id,
    validate_request_body=validate_request_body,
    validate_request_parameters=validate_request_parameters)
method = aws_native.apigateway.Method("method",
    http_method="POST",
    resource_id=rest_api.root_resource_id,
    rest_api_id=rest_api.id,
    authorization_type="NONE",
    integration={
        "type": aws_native.apigateway.MethodIntegrationType.MOCK,
        "content_handling": aws_native.apigateway.MethodIntegrationContentHandling(content_handling),
        "integration_responses": [{
            "content_handling": aws_native.apigateway.MethodIntegrationResponseContentHandling(content_handling),
            "status_code": "400",
        }],
    },
    request_validator_id=request_validator.id,
    operation_name=operation_name)
pulumi.export("rootResourceId", rest_api.root_resource_id)
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var contentHandling = config.Require("contentHandling");
    var operationName = config.Get("operationName") ?? "testoperationName";
    var restApiName = config.Get("restApiName") ?? "testrestApiName";
    var validatorName = config.Get("validatorName") ?? "testvalidatorName";
    var validateRequestBody = config.Get("validateRequestBody") ?? "testvalidateRequestBody";
    var validateRequestParameters = config.Get("validateRequestParameters") ?? true;
    var restApi = new AwsNative.ApiGateway.RestApi("restApi", new()
    {
        Name = restApiName,
    });

    var requestValidator = new AwsNative.ApiGateway.RequestValidator("requestValidator", new()
    {
        Name = validatorName,
        RestApiId = restApi.Id,
        ValidateRequestBody = validateRequestBody,
        ValidateRequestParameters = validateRequestParameters,
    });

    var method = new AwsNative.ApiGateway.Method("method", new()
    {
        HttpMethod = "POST",
        ResourceId = restApi.RootResourceId,
        RestApiId = restApi.Id,
        AuthorizationType = "NONE",
        Integration = new AwsNative.ApiGateway.Inputs.MethodIntegrationArgs
        {
            Type = AwsNative.ApiGateway.MethodIntegrationType.Mock,
            ContentHandling = System.Enum.Parse<AwsNative.ApiGateway.MethodIntegrationContentHandling>(contentHandling),
            IntegrationResponses = new[]
            {
                new AwsNative.ApiGateway.Inputs.MethodIntegrationResponseArgs
                {
                    ContentHandling = System.Enum.Parse<AwsNative.ApiGateway.MethodIntegrationResponseContentHandling>(contentHandling),
                    StatusCode = "400",
                },
            },
        },
        RequestValidatorId = requestValidator.Id,
        OperationName = operationName,
    });

    return new Dictionary<string, object?>
    {
        ["rootResourceId"] = restApi.RootResourceId,
    };
});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		contentHandling := cfg.Require("contentHandling")
		operationName := "testoperationName"
		if param := cfg.Get("operationName"); param != "" {
			operationName = param
		}
		restApiName := "testrestApiName"
		if param := cfg.Get("restApiName"); param != "" {
			restApiName = param
		}
		validatorName := "testvalidatorName"
		if param := cfg.Get("validatorName"); param != "" {
			validatorName = param
		}
		validateRequestBody := "testvalidateRequestBody"
		if param := cfg.Get("validateRequestBody"); param != "" {
			validateRequestBody = param
		}
		validateRequestParameters := true
		if param := cfg.Get("validateRequestParameters"); param != "" {
			validateRequestParameters = param
		}
		restApi, err := apigateway.NewRestApi(ctx, "restApi", &apigateway.RestApiArgs{
			Name: pulumi.String(restApiName),
		})
		if err != nil {
			return err
		}
		requestValidator, err := apigateway.NewRequestValidator(ctx, "requestValidator", &apigateway.RequestValidatorArgs{
			Name:                      pulumi.String(validatorName),
			RestApiId:                 restApi.ID(),
			ValidateRequestBody:       pulumi.String(validateRequestBody),
			ValidateRequestParameters: pulumi.String(validateRequestParameters),
		})
		if err != nil {
			return err
		}
		_, err = apigateway.NewMethod(ctx, "method", &apigateway.MethodArgs{
			HttpMethod:        pulumi.String("POST"),
			ResourceId:        restApi.RootResourceId,
			RestApiId:         restApi.ID(),
			AuthorizationType: pulumi.String("NONE"),
			Integration: &apigateway.MethodIntegrationArgs{
				Type:            apigateway.MethodIntegrationTypeMock,
				ContentHandling: apigateway.MethodIntegrationContentHandling(contentHandling),
				IntegrationResponses: apigateway.MethodIntegrationResponseArray{
					&apigateway.MethodIntegrationResponseArgs{
						ContentHandling: apigateway.MethodIntegrationResponseContentHandling(contentHandling),
						StatusCode:      pulumi.String("400"),
					},
				},
			},
			RequestValidatorId: requestValidator.ID(),
			OperationName:      pulumi.String(operationName),
		})
		if err != nil {
			return err
		}
		ctx.Export("rootResourceId", restApi.RootResourceId)
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const config = new pulumi.Config();
const contentHandling = config.require("contentHandling");
const operationName = config.get("operationName") || "testoperationName";
const restApiName = config.get("restApiName") || "testrestApiName";
const validatorName = config.get("validatorName") || "testvalidatorName";
const validateRequestBody = config.get("validateRequestBody") || "testvalidateRequestBody";
const validateRequestParameters = config.get("validateRequestParameters") || true;
const restApi = new aws_native.apigateway.RestApi("restApi", {name: restApiName});
const requestValidator = new aws_native.apigateway.RequestValidator("requestValidator", {
    name: validatorName,
    restApiId: restApi.id,
    validateRequestBody: validateRequestBody,
    validateRequestParameters: validateRequestParameters,
});
const method = new aws_native.apigateway.Method("method", {
    httpMethod: "POST",
    resourceId: restApi.rootResourceId,
    restApiId: restApi.id,
    authorizationType: "NONE",
    integration: {
        type: aws_native.apigateway.MethodIntegrationType.Mock,
        contentHandling: aws_native.apigateway.MethodIntegrationContentHandling[contentHandling],
        integrationResponses: [{
            contentHandling: aws_native.apigateway.MethodIntegrationResponseContentHandling[contentHandling],
            statusCode: "400",
        }],
    },
    requestValidatorId: requestValidator.id,
    operationName: operationName,
});
export const rootResourceId = restApi.rootResourceId;
Copy
import pulumi
import pulumi_aws_native as aws_native

config = pulumi.Config()
content_handling = config.require("contentHandling")
operation_name = config.get("operationName")
if operation_name is None:
    operation_name = "testoperationName"
rest_api_name = config.get("restApiName")
if rest_api_name is None:
    rest_api_name = "testrestApiName"
validator_name = config.get("validatorName")
if validator_name is None:
    validator_name = "testvalidatorName"
validate_request_body = config.get("validateRequestBody")
if validate_request_body is None:
    validate_request_body = "testvalidateRequestBody"
validate_request_parameters = config.get("validateRequestParameters")
if validate_request_parameters is None:
    validate_request_parameters = True
rest_api = aws_native.apigateway.RestApi("restApi", name=rest_api_name)
request_validator = aws_native.apigateway.RequestValidator("requestValidator",
    name=validator_name,
    rest_api_id=rest_api.id,
    validate_request_body=validate_request_body,
    validate_request_parameters=validate_request_parameters)
method = aws_native.apigateway.Method("method",
    http_method="POST",
    resource_id=rest_api.root_resource_id,
    rest_api_id=rest_api.id,
    authorization_type="NONE",
    integration={
        "type": aws_native.apigateway.MethodIntegrationType.MOCK,
        "content_handling": aws_native.apigateway.MethodIntegrationContentHandling(content_handling),
        "integration_responses": [{
            "content_handling": aws_native.apigateway.MethodIntegrationResponseContentHandling(content_handling),
            "status_code": "400",
        }],
    },
    request_validator_id=request_validator.id,
    operation_name=operation_name)
pulumi.export("rootResourceId", rest_api.root_resource_id)
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var apiName = config.Require("apiName");
    var validatorName = config.Require("validatorName");
    var validateRequestBody = config.Require("validateRequestBody");
    var validateRequestParameters = config.Require("validateRequestParameters");
    var restApi = new AwsNative.ApiGateway.RestApi("restApi", new()
    {
        Name = apiName,
    });

    var requestValidator = new AwsNative.ApiGateway.RequestValidator("requestValidator", new()
    {
        Name = validatorName,
        RestApiId = restApi.Id,
        ValidateRequestBody = validateRequestBody,
        ValidateRequestParameters = validateRequestParameters,
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		apiName := cfg.Require("apiName")
		validatorName := cfg.Require("validatorName")
		validateRequestBody := cfg.Require("validateRequestBody")
		validateRequestParameters := cfg.Require("validateRequestParameters")
		restApi, err := apigateway.NewRestApi(ctx, "restApi", &apigateway.RestApiArgs{
			Name: pulumi.String(apiName),
		})
		if err != nil {
			return err
		}
		_, err = apigateway.NewRequestValidator(ctx, "requestValidator", &apigateway.RequestValidatorArgs{
			Name:                      pulumi.String(validatorName),
			RestApiId:                 restApi.ID(),
			ValidateRequestBody:       pulumi.String(validateRequestBody),
			ValidateRequestParameters: pulumi.String(validateRequestParameters),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const config = new pulumi.Config();
const apiName = config.require("apiName");
const validatorName = config.require("validatorName");
const validateRequestBody = config.require("validateRequestBody");
const validateRequestParameters = config.require("validateRequestParameters");
const restApi = new aws_native.apigateway.RestApi("restApi", {name: apiName});
const requestValidator = new aws_native.apigateway.RequestValidator("requestValidator", {
    name: validatorName,
    restApiId: restApi.id,
    validateRequestBody: validateRequestBody,
    validateRequestParameters: validateRequestParameters,
});
Copy
import pulumi
import pulumi_aws_native as aws_native

config = pulumi.Config()
api_name = config.require("apiName")
validator_name = config.require("validatorName")
validate_request_body = config.require("validateRequestBody")
validate_request_parameters = config.require("validateRequestParameters")
rest_api = aws_native.apigateway.RestApi("restApi", name=api_name)
request_validator = aws_native.apigateway.RequestValidator("requestValidator",
    name=validator_name,
    rest_api_id=rest_api.id,
    validate_request_body=validate_request_body,
    validate_request_parameters=validate_request_parameters)
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var apiName = config.Require("apiName");
    var validatorName = config.Require("validatorName");
    var validateRequestBody = config.Require("validateRequestBody");
    var validateRequestParameters = config.Require("validateRequestParameters");
    var restApi = new AwsNative.ApiGateway.RestApi("restApi", new()
    {
        Name = apiName,
    });

    var requestValidator = new AwsNative.ApiGateway.RequestValidator("requestValidator", new()
    {
        Name = validatorName,
        RestApiId = restApi.Id,
        ValidateRequestBody = validateRequestBody,
        ValidateRequestParameters = validateRequestParameters,
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		apiName := cfg.Require("apiName")
		validatorName := cfg.Require("validatorName")
		validateRequestBody := cfg.Require("validateRequestBody")
		validateRequestParameters := cfg.Require("validateRequestParameters")
		restApi, err := apigateway.NewRestApi(ctx, "restApi", &apigateway.RestApiArgs{
			Name: pulumi.String(apiName),
		})
		if err != nil {
			return err
		}
		_, err = apigateway.NewRequestValidator(ctx, "requestValidator", &apigateway.RequestValidatorArgs{
			Name:                      pulumi.String(validatorName),
			RestApiId:                 restApi.ID(),
			ValidateRequestBody:       pulumi.String(validateRequestBody),
			ValidateRequestParameters: pulumi.String(validateRequestParameters),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const config = new pulumi.Config();
const apiName = config.require("apiName");
const validatorName = config.require("validatorName");
const validateRequestBody = config.require("validateRequestBody");
const validateRequestParameters = config.require("validateRequestParameters");
const restApi = new aws_native.apigateway.RestApi("restApi", {name: apiName});
const requestValidator = new aws_native.apigateway.RequestValidator("requestValidator", {
    name: validatorName,
    restApiId: restApi.id,
    validateRequestBody: validateRequestBody,
    validateRequestParameters: validateRequestParameters,
});
Copy
import pulumi
import pulumi_aws_native as aws_native

config = pulumi.Config()
api_name = config.require("apiName")
validator_name = config.require("validatorName")
validate_request_body = config.require("validateRequestBody")
validate_request_parameters = config.require("validateRequestParameters")
rest_api = aws_native.apigateway.RestApi("restApi", name=api_name)
request_validator = aws_native.apigateway.RequestValidator("requestValidator",
    name=validator_name,
    rest_api_id=rest_api.id,
    validate_request_body=validate_request_body,
    validate_request_parameters=validate_request_parameters)
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var apiName = config.Require("apiName");
    var type = config.Require("type");
    var myRestApi = new AwsNative.ApiGateway.RestApi("myRestApi", new()
    {
        EndpointConfiguration = new AwsNative.ApiGateway.Inputs.RestApiEndpointConfigurationArgs
        {
            Types = new[]
            {
                type,
            },
        },
        Name = apiName,
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		apiName := cfg.Require("apiName")
		_type := cfg.Require("type")
		_, err := apigateway.NewRestApi(ctx, "myRestApi", &apigateway.RestApiArgs{
			EndpointConfiguration: &apigateway.RestApiEndpointConfigurationArgs{
				Types: pulumi.StringArray{
					pulumi.String(_type),
				},
			},
			Name: pulumi.String(apiName),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const config = new pulumi.Config();
const apiName = config.require("apiName");
const type = config.require("type");
const myRestApi = new aws_native.apigateway.RestApi("myRestApi", {
    endpointConfiguration: {
        types: [type],
    },
    name: apiName,
});
Copy
import pulumi
import pulumi_aws_native as aws_native

config = pulumi.Config()
api_name = config.require("apiName")
type = config.require("type")
my_rest_api = aws_native.apigateway.RestApi("myRestApi",
    endpoint_configuration={
        "types": [type],
    },
    name=api_name)
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var apiName = config.Require("apiName");
    var type = config.Require("type");
    var myRestApi = new AwsNative.ApiGateway.RestApi("myRestApi", new()
    {
        EndpointConfiguration = new AwsNative.ApiGateway.Inputs.RestApiEndpointConfigurationArgs
        {
            Types = new[]
            {
                type,
            },
        },
        Name = apiName,
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		apiName := cfg.Require("apiName")
		_type := cfg.Require("type")
		_, err := apigateway.NewRestApi(ctx, "myRestApi", &apigateway.RestApiArgs{
			EndpointConfiguration: &apigateway.RestApiEndpointConfigurationArgs{
				Types: pulumi.StringArray{
					pulumi.String(_type),
				},
			},
			Name: pulumi.String(apiName),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const config = new pulumi.Config();
const apiName = config.require("apiName");
const type = config.require("type");
const myRestApi = new aws_native.apigateway.RestApi("myRestApi", {
    endpointConfiguration: {
        types: [type],
    },
    name: apiName,
});
Copy
import pulumi
import pulumi_aws_native as aws_native

config = pulumi.Config()
api_name = config.require("apiName")
type = config.require("type")
my_rest_api = aws_native.apigateway.RestApi("myRestApi",
    endpoint_configuration={
        "types": [type],
    },
    name=api_name)
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var restApi = new AwsNative.ApiGateway.RestApi("restApi", new()
    {
        Body = new Dictionary<string, object?>
        {
            ["swagger"] = 2,
            ["info"] = new Dictionary<string, object?>
            {
                ["version"] = "0.0.1",
                ["title"] = "test",
            },
            ["basePath"] = "/pete",
            ["schemes"] = new[]
            {
                "https",
            },
            ["definitions"] = new Dictionary<string, object?>
            {
                ["empty"] = new Dictionary<string, object?>
                {
                    ["type"] = "object",
                },
            },
        },
        Name = "myApi",
        Parameters = 
        {
            { "endpointConfigurationTypes", "REGIONAL" },
        },
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := apigateway.NewRestApi(ctx, "restApi", &apigateway.RestApiArgs{
			Body: pulumi.Any(map[string]interface{}{
				"swagger": 2,
				"info": map[string]interface{}{
					"version": "0.0.1",
					"title":   "test",
				},
				"basePath": "/pete",
				"schemes": []string{
					"https",
				},
				"definitions": map[string]interface{}{
					"empty": map[string]interface{}{
						"type": "object",
					},
				},
			}),
			Name: pulumi.String("myApi"),
			Parameters: pulumi.StringMap{
				"endpointConfigurationTypes": pulumi.String("REGIONAL"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const restApi = new aws_native.apigateway.RestApi("restApi", {
    body: {
        swagger: 2,
        info: {
            version: "0.0.1",
            title: "test",
        },
        basePath: "/pete",
        schemes: ["https"],
        definitions: {
            empty: {
                type: "object",
            },
        },
    },
    name: "myApi",
    parameters: {
        endpointConfigurationTypes: "REGIONAL",
    },
});
Copy
import pulumi
import pulumi_aws_native as aws_native

rest_api = aws_native.apigateway.RestApi("restApi",
    body={
        "swagger": 2,
        "info": {
            "version": "0.0.1",
            "title": "test",
        },
        "basePath": "/pete",
        "schemes": ["https"],
        "definitions": {
            "empty": {
                "type": "object",
            },
        },
    },
    name="myApi",
    parameters={
        "endpointConfigurationTypes": "REGIONAL",
    })
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var restApi = new AwsNative.ApiGateway.RestApi("restApi", new()
    {
        Body = new Dictionary<string, object?>
        {
            ["swagger"] = 2,
            ["info"] = new Dictionary<string, object?>
            {
                ["version"] = "0.0.1",
                ["title"] = "test",
            },
            ["basePath"] = "/pete",
            ["schemes"] = new[]
            {
                "https",
            },
            ["definitions"] = new Dictionary<string, object?>
            {
                ["empty"] = new Dictionary<string, object?>
                {
                    ["type"] = "object",
                },
            },
        },
        Name = "myApi",
        Parameters = 
        {
            { "endpointConfigurationTypes", "REGIONAL" },
        },
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := apigateway.NewRestApi(ctx, "restApi", &apigateway.RestApiArgs{
			Body: pulumi.Any(map[string]interface{}{
				"swagger": 2,
				"info": map[string]interface{}{
					"version": "0.0.1",
					"title":   "test",
				},
				"basePath": "/pete",
				"schemes": []string{
					"https",
				},
				"definitions": map[string]interface{}{
					"empty": map[string]interface{}{
						"type": "object",
					},
				},
			}),
			Name: pulumi.String("myApi"),
			Parameters: pulumi.StringMap{
				"endpointConfigurationTypes": pulumi.String("REGIONAL"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const restApi = new aws_native.apigateway.RestApi("restApi", {
    body: {
        swagger: 2,
        info: {
            version: "0.0.1",
            title: "test",
        },
        basePath: "/pete",
        schemes: ["https"],
        definitions: {
            empty: {
                type: "object",
            },
        },
    },
    name: "myApi",
    parameters: {
        endpointConfigurationTypes: "REGIONAL",
    },
});
Copy
import pulumi
import pulumi_aws_native as aws_native

rest_api = aws_native.apigateway.RestApi("restApi",
    body={
        "swagger": 2,
        "info": {
            "version": "0.0.1",
            "title": "test",
        },
        "basePath": "/pete",
        "schemes": ["https"],
        "definitions": {
            "empty": {
                "type": "object",
            },
        },
    },
    name="myApi",
    parameters={
        "endpointConfigurationTypes": "REGIONAL",
    })
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var apiKeySourceType = config.Require("apiKeySourceType");
    var apiName = config.Require("apiName");
    var binaryMediaType1 = config.Require("binaryMediaType1");
    var binaryMediaType2 = config.Require("binaryMediaType2");
    var minimumCompressionSize = config.Require("minimumCompressionSize");
    var myRestApi = new AwsNative.ApiGateway.RestApi("myRestApi", new()
    {
        ApiKeySourceType = apiKeySourceType,
        BinaryMediaTypes = new[]
        {
            binaryMediaType1,
            binaryMediaType2,
        },
        MinimumCompressionSize = minimumCompressionSize,
        Name = apiName,
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		apiKeySourceType := cfg.Require("apiKeySourceType")
		apiName := cfg.Require("apiName")
		binaryMediaType1 := cfg.Require("binaryMediaType1")
		binaryMediaType2 := cfg.Require("binaryMediaType2")
		minimumCompressionSize := cfg.Require("minimumCompressionSize")
		_, err := apigateway.NewRestApi(ctx, "myRestApi", &apigateway.RestApiArgs{
			ApiKeySourceType: pulumi.String(apiKeySourceType),
			BinaryMediaTypes: pulumi.StringArray{
				pulumi.String(binaryMediaType1),
				pulumi.String(binaryMediaType2),
			},
			MinimumCompressionSize: pulumi.String(minimumCompressionSize),
			Name:                   pulumi.String(apiName),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const config = new pulumi.Config();
const apiKeySourceType = config.require("apiKeySourceType");
const apiName = config.require("apiName");
const binaryMediaType1 = config.require("binaryMediaType1");
const binaryMediaType2 = config.require("binaryMediaType2");
const minimumCompressionSize = config.require("minimumCompressionSize");
const myRestApi = new aws_native.apigateway.RestApi("myRestApi", {
    apiKeySourceType: apiKeySourceType,
    binaryMediaTypes: [
        binaryMediaType1,
        binaryMediaType2,
    ],
    minimumCompressionSize: minimumCompressionSize,
    name: apiName,
});
Copy
import pulumi
import pulumi_aws_native as aws_native

config = pulumi.Config()
api_key_source_type = config.require("apiKeySourceType")
api_name = config.require("apiName")
binary_media_type1 = config.require("binaryMediaType1")
binary_media_type2 = config.require("binaryMediaType2")
minimum_compression_size = config.require("minimumCompressionSize")
my_rest_api = aws_native.apigateway.RestApi("myRestApi",
    api_key_source_type=api_key_source_type,
    binary_media_types=[
        binary_media_type1,
        binary_media_type2,
    ],
    minimum_compression_size=minimum_compression_size,
    name=api_name)
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var apiKeySourceType = config.Require("apiKeySourceType");
    var apiName = config.Require("apiName");
    var binaryMediaType1 = config.Require("binaryMediaType1");
    var binaryMediaType2 = config.Require("binaryMediaType2");
    var minimumCompressionSize = config.Require("minimumCompressionSize");
    var myRestApi = new AwsNative.ApiGateway.RestApi("myRestApi", new()
    {
        ApiKeySourceType = apiKeySourceType,
        BinaryMediaTypes = new[]
        {
            binaryMediaType1,
            binaryMediaType2,
        },
        MinimumCompressionSize = minimumCompressionSize,
        Name = apiName,
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		apiKeySourceType := cfg.Require("apiKeySourceType")
		apiName := cfg.Require("apiName")
		binaryMediaType1 := cfg.Require("binaryMediaType1")
		binaryMediaType2 := cfg.Require("binaryMediaType2")
		minimumCompressionSize := cfg.Require("minimumCompressionSize")
		_, err := apigateway.NewRestApi(ctx, "myRestApi", &apigateway.RestApiArgs{
			ApiKeySourceType: pulumi.String(apiKeySourceType),
			BinaryMediaTypes: pulumi.StringArray{
				pulumi.String(binaryMediaType1),
				pulumi.String(binaryMediaType2),
			},
			MinimumCompressionSize: pulumi.String(minimumCompressionSize),
			Name:                   pulumi.String(apiName),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const config = new pulumi.Config();
const apiKeySourceType = config.require("apiKeySourceType");
const apiName = config.require("apiName");
const binaryMediaType1 = config.require("binaryMediaType1");
const binaryMediaType2 = config.require("binaryMediaType2");
const minimumCompressionSize = config.require("minimumCompressionSize");
const myRestApi = new aws_native.apigateway.RestApi("myRestApi", {
    apiKeySourceType: apiKeySourceType,
    binaryMediaTypes: [
        binaryMediaType1,
        binaryMediaType2,
    ],
    minimumCompressionSize: minimumCompressionSize,
    name: apiName,
});
Copy
import pulumi
import pulumi_aws_native as aws_native

config = pulumi.Config()
api_key_source_type = config.require("apiKeySourceType")
api_name = config.require("apiName")
binary_media_type1 = config.require("binaryMediaType1")
binary_media_type2 = config.require("binaryMediaType2")
minimum_compression_size = config.require("minimumCompressionSize")
my_rest_api = aws_native.apigateway.RestApi("myRestApi",
    api_key_source_type=api_key_source_type,
    binary_media_types=[
        binary_media_type1,
        binary_media_type2,
    ],
    minimum_compression_size=minimum_compression_size,
    name=api_name)
Copy

Coming soon!

Create RestApi Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new RestApi(name: string, args?: RestApiArgs, opts?: CustomResourceOptions);
@overload
def RestApi(resource_name: str,
            args: Optional[RestApiArgs] = None,
            opts: Optional[ResourceOptions] = None)

@overload
def RestApi(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            api_key_source_type: Optional[str] = None,
            binary_media_types: Optional[Sequence[str]] = None,
            body: Optional[Any] = None,
            body_s3_location: Optional[RestApiS3LocationArgs] = None,
            clone_from: Optional[str] = None,
            description: Optional[str] = None,
            disable_execute_api_endpoint: Optional[bool] = None,
            endpoint_configuration: Optional[RestApiEndpointConfigurationArgs] = None,
            fail_on_warnings: Optional[bool] = None,
            minimum_compression_size: Optional[int] = None,
            mode: Optional[str] = None,
            name: Optional[str] = None,
            parameters: Optional[Mapping[str, str]] = None,
            policy: Optional[Any] = None,
            tags: Optional[Sequence[_root_inputs.TagArgs]] = None)
func NewRestApi(ctx *Context, name string, args *RestApiArgs, opts ...ResourceOption) (*RestApi, error)
public RestApi(string name, RestApiArgs? args = null, CustomResourceOptions? opts = null)
public RestApi(String name, RestApiArgs args)
public RestApi(String name, RestApiArgs args, CustomResourceOptions options)
type: aws-native:apigateway:RestApi
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args RestApiArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args RestApiArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args RestApiArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args RestApiArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. RestApiArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

RestApi Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The RestApi resource accepts the following input properties:

ApiKeySourceType string
The source of the API key for metering requests according to a usage plan. Valid values are: HEADER to read the API key from the X-API-Key header of a request. AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.
BinaryMediaTypes List<string>
The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded text payloads.
Body object

An OpenAPI specification that defines a set of RESTful APIs in JSON format. For YAML templates, you can also provide the specification in YAML format.

Search the CloudFormation User Guide for AWS::ApiGateway::RestApi for more information about the expected schema for this property.

BodyS3Location Pulumi.AwsNative.ApiGateway.Inputs.RestApiS3Location
The Amazon Simple Storage Service (Amazon S3) location that points to an OpenAPI file, which defines a set of RESTful APIs in JSON or YAML format.
CloneFrom string
The ID of the RestApi that you want to clone from.
Description string
The description of the RestApi.
DisableExecuteApiEndpoint bool
Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint
EndpointConfiguration Pulumi.AwsNative.ApiGateway.Inputs.RestApiEndpointConfiguration
A list of the endpoint types of the API. Use this property when creating an API. When importing an existing API, specify the endpoint configuration types using the Parameters property.
FailOnWarnings bool
A query parameter to indicate whether to rollback the API update ( true ) or not ( false ) when a warning is encountered. The default value is false .
MinimumCompressionSize int
A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.
Mode string
This property applies only when you use OpenAPI to define your REST API. The Mode determines how API Gateway handles resource updates. Valid values are overwrite or merge. For overwrite, the new API definition replaces the existing one. The existing API identifier remains unchanged. For merge, the new API definition is merged with the existing API. If you don't specify this property, a default value is chosen. For REST APIs created before March 29, 2021, the default is overwrite. For REST APIs created after March 29, 2021, the new API definition takes precedence, but any container types such as endpoint configurations and binary media types are merged with the existing API. Use the default mode to define top-level RestApi properties in addition to using OpenAPI. Generally, it's preferred to use API Gateway's OpenAPI extensions to model these properties.
Name string
The name of the RestApi. A name is required if the REST API is not based on an OpenAPI specification.
Parameters Dictionary<string, string>
Custom header parameters as part of the request. For example, to exclude DocumentationParts from an imported API, set ignore=documentation as a parameters value, as in the AWS CLI command of aws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json' .
Policy object

A policy document that contains the permissions for the RestApi resource. To set the ARN for the policy, use the !Join intrinsic function with "" as delimiter and values of "execute-api:/" and "*".

Search the CloudFormation User Guide for AWS::ApiGateway::RestApi for more information about the expected schema for this property.

Tags List<Pulumi.AwsNative.Inputs.Tag>
The key-value map of strings. The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters and must not start with aws: . The tag value can be up to 256 characters.
ApiKeySourceType string
The source of the API key for metering requests according to a usage plan. Valid values are: HEADER to read the API key from the X-API-Key header of a request. AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.
BinaryMediaTypes []string
The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded text payloads.
Body interface{}

An OpenAPI specification that defines a set of RESTful APIs in JSON format. For YAML templates, you can also provide the specification in YAML format.

Search the CloudFormation User Guide for AWS::ApiGateway::RestApi for more information about the expected schema for this property.

BodyS3Location RestApiS3LocationArgs
The Amazon Simple Storage Service (Amazon S3) location that points to an OpenAPI file, which defines a set of RESTful APIs in JSON or YAML format.
CloneFrom string
The ID of the RestApi that you want to clone from.
Description string
The description of the RestApi.
DisableExecuteApiEndpoint bool
Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint
EndpointConfiguration RestApiEndpointConfigurationArgs
A list of the endpoint types of the API. Use this property when creating an API. When importing an existing API, specify the endpoint configuration types using the Parameters property.
FailOnWarnings bool
A query parameter to indicate whether to rollback the API update ( true ) or not ( false ) when a warning is encountered. The default value is false .
MinimumCompressionSize int
A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.
Mode string
This property applies only when you use OpenAPI to define your REST API. The Mode determines how API Gateway handles resource updates. Valid values are overwrite or merge. For overwrite, the new API definition replaces the existing one. The existing API identifier remains unchanged. For merge, the new API definition is merged with the existing API. If you don't specify this property, a default value is chosen. For REST APIs created before March 29, 2021, the default is overwrite. For REST APIs created after March 29, 2021, the new API definition takes precedence, but any container types such as endpoint configurations and binary media types are merged with the existing API. Use the default mode to define top-level RestApi properties in addition to using OpenAPI. Generally, it's preferred to use API Gateway's OpenAPI extensions to model these properties.
Name string
The name of the RestApi. A name is required if the REST API is not based on an OpenAPI specification.
Parameters map[string]string
Custom header parameters as part of the request. For example, to exclude DocumentationParts from an imported API, set ignore=documentation as a parameters value, as in the AWS CLI command of aws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json' .
Policy interface{}

A policy document that contains the permissions for the RestApi resource. To set the ARN for the policy, use the !Join intrinsic function with "" as delimiter and values of "execute-api:/" and "*".

Search the CloudFormation User Guide for AWS::ApiGateway::RestApi for more information about the expected schema for this property.

Tags TagArgs
The key-value map of strings. The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters and must not start with aws: . The tag value can be up to 256 characters.
apiKeySourceType String
The source of the API key for metering requests according to a usage plan. Valid values are: HEADER to read the API key from the X-API-Key header of a request. AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.
binaryMediaTypes List<String>
The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded text payloads.
body Object

An OpenAPI specification that defines a set of RESTful APIs in JSON format. For YAML templates, you can also provide the specification in YAML format.

Search the CloudFormation User Guide for AWS::ApiGateway::RestApi for more information about the expected schema for this property.

bodyS3Location RestApiS3Location
The Amazon Simple Storage Service (Amazon S3) location that points to an OpenAPI file, which defines a set of RESTful APIs in JSON or YAML format.
cloneFrom String
The ID of the RestApi that you want to clone from.
description String
The description of the RestApi.
disableExecuteApiEndpoint Boolean
Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint
endpointConfiguration RestApiEndpointConfiguration
A list of the endpoint types of the API. Use this property when creating an API. When importing an existing API, specify the endpoint configuration types using the Parameters property.
failOnWarnings Boolean
A query parameter to indicate whether to rollback the API update ( true ) or not ( false ) when a warning is encountered. The default value is false .
minimumCompressionSize Integer
A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.
mode String
This property applies only when you use OpenAPI to define your REST API. The Mode determines how API Gateway handles resource updates. Valid values are overwrite or merge. For overwrite, the new API definition replaces the existing one. The existing API identifier remains unchanged. For merge, the new API definition is merged with the existing API. If you don't specify this property, a default value is chosen. For REST APIs created before March 29, 2021, the default is overwrite. For REST APIs created after March 29, 2021, the new API definition takes precedence, but any container types such as endpoint configurations and binary media types are merged with the existing API. Use the default mode to define top-level RestApi properties in addition to using OpenAPI. Generally, it's preferred to use API Gateway's OpenAPI extensions to model these properties.
name String
The name of the RestApi. A name is required if the REST API is not based on an OpenAPI specification.
parameters Map<String,String>
Custom header parameters as part of the request. For example, to exclude DocumentationParts from an imported API, set ignore=documentation as a parameters value, as in the AWS CLI command of aws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json' .
policy Object

A policy document that contains the permissions for the RestApi resource. To set the ARN for the policy, use the !Join intrinsic function with "" as delimiter and values of "execute-api:/" and "*".

Search the CloudFormation User Guide for AWS::ApiGateway::RestApi for more information about the expected schema for this property.

tags List<Tag>
The key-value map of strings. The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters and must not start with aws: . The tag value can be up to 256 characters.
apiKeySourceType string
The source of the API key for metering requests according to a usage plan. Valid values are: HEADER to read the API key from the X-API-Key header of a request. AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.
binaryMediaTypes string[]
The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded text payloads.
body any

An OpenAPI specification that defines a set of RESTful APIs in JSON format. For YAML templates, you can also provide the specification in YAML format.

Search the CloudFormation User Guide for AWS::ApiGateway::RestApi for more information about the expected schema for this property.

bodyS3Location RestApiS3Location
The Amazon Simple Storage Service (Amazon S3) location that points to an OpenAPI file, which defines a set of RESTful APIs in JSON or YAML format.
cloneFrom string
The ID of the RestApi that you want to clone from.
description string
The description of the RestApi.
disableExecuteApiEndpoint boolean
Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint
endpointConfiguration RestApiEndpointConfiguration
A list of the endpoint types of the API. Use this property when creating an API. When importing an existing API, specify the endpoint configuration types using the Parameters property.
failOnWarnings boolean
A query parameter to indicate whether to rollback the API update ( true ) or not ( false ) when a warning is encountered. The default value is false .
minimumCompressionSize number
A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.
mode string
This property applies only when you use OpenAPI to define your REST API. The Mode determines how API Gateway handles resource updates. Valid values are overwrite or merge. For overwrite, the new API definition replaces the existing one. The existing API identifier remains unchanged. For merge, the new API definition is merged with the existing API. If you don't specify this property, a default value is chosen. For REST APIs created before March 29, 2021, the default is overwrite. For REST APIs created after March 29, 2021, the new API definition takes precedence, but any container types such as endpoint configurations and binary media types are merged with the existing API. Use the default mode to define top-level RestApi properties in addition to using OpenAPI. Generally, it's preferred to use API Gateway's OpenAPI extensions to model these properties.
name string
The name of the RestApi. A name is required if the REST API is not based on an OpenAPI specification.
parameters {[key: string]: string}
Custom header parameters as part of the request. For example, to exclude DocumentationParts from an imported API, set ignore=documentation as a parameters value, as in the AWS CLI command of aws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json' .
policy any

A policy document that contains the permissions for the RestApi resource. To set the ARN for the policy, use the !Join intrinsic function with "" as delimiter and values of "execute-api:/" and "*".

Search the CloudFormation User Guide for AWS::ApiGateway::RestApi for more information about the expected schema for this property.

tags Tag[]
The key-value map of strings. The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters and must not start with aws: . The tag value can be up to 256 characters.
api_key_source_type str
The source of the API key for metering requests according to a usage plan. Valid values are: HEADER to read the API key from the X-API-Key header of a request. AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.
binary_media_types Sequence[str]
The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded text payloads.
body Any

An OpenAPI specification that defines a set of RESTful APIs in JSON format. For YAML templates, you can also provide the specification in YAML format.

Search the CloudFormation User Guide for AWS::ApiGateway::RestApi for more information about the expected schema for this property.

body_s3_location RestApiS3LocationArgs
The Amazon Simple Storage Service (Amazon S3) location that points to an OpenAPI file, which defines a set of RESTful APIs in JSON or YAML format.
clone_from str
The ID of the RestApi that you want to clone from.
description str
The description of the RestApi.
disable_execute_api_endpoint bool
Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint
endpoint_configuration RestApiEndpointConfigurationArgs
A list of the endpoint types of the API. Use this property when creating an API. When importing an existing API, specify the endpoint configuration types using the Parameters property.
fail_on_warnings bool
A query parameter to indicate whether to rollback the API update ( true ) or not ( false ) when a warning is encountered. The default value is false .
minimum_compression_size int
A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.
mode str
This property applies only when you use OpenAPI to define your REST API. The Mode determines how API Gateway handles resource updates. Valid values are overwrite or merge. For overwrite, the new API definition replaces the existing one. The existing API identifier remains unchanged. For merge, the new API definition is merged with the existing API. If you don't specify this property, a default value is chosen. For REST APIs created before March 29, 2021, the default is overwrite. For REST APIs created after March 29, 2021, the new API definition takes precedence, but any container types such as endpoint configurations and binary media types are merged with the existing API. Use the default mode to define top-level RestApi properties in addition to using OpenAPI. Generally, it's preferred to use API Gateway's OpenAPI extensions to model these properties.
name str
The name of the RestApi. A name is required if the REST API is not based on an OpenAPI specification.
parameters Mapping[str, str]
Custom header parameters as part of the request. For example, to exclude DocumentationParts from an imported API, set ignore=documentation as a parameters value, as in the AWS CLI command of aws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json' .
policy Any

A policy document that contains the permissions for the RestApi resource. To set the ARN for the policy, use the !Join intrinsic function with "" as delimiter and values of "execute-api:/" and "*".

Search the CloudFormation User Guide for AWS::ApiGateway::RestApi for more information about the expected schema for this property.

tags Sequence[TagArgs]
The key-value map of strings. The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters and must not start with aws: . The tag value can be up to 256 characters.
apiKeySourceType String
The source of the API key for metering requests according to a usage plan. Valid values are: HEADER to read the API key from the X-API-Key header of a request. AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.
binaryMediaTypes List<String>
The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded text payloads.
body Any

An OpenAPI specification that defines a set of RESTful APIs in JSON format. For YAML templates, you can also provide the specification in YAML format.

Search the CloudFormation User Guide for AWS::ApiGateway::RestApi for more information about the expected schema for this property.

bodyS3Location Property Map
The Amazon Simple Storage Service (Amazon S3) location that points to an OpenAPI file, which defines a set of RESTful APIs in JSON or YAML format.
cloneFrom String
The ID of the RestApi that you want to clone from.
description String
The description of the RestApi.
disableExecuteApiEndpoint Boolean
Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint
endpointConfiguration Property Map
A list of the endpoint types of the API. Use this property when creating an API. When importing an existing API, specify the endpoint configuration types using the Parameters property.
failOnWarnings Boolean
A query parameter to indicate whether to rollback the API update ( true ) or not ( false ) when a warning is encountered. The default value is false .
minimumCompressionSize Number
A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.
mode String
This property applies only when you use OpenAPI to define your REST API. The Mode determines how API Gateway handles resource updates. Valid values are overwrite or merge. For overwrite, the new API definition replaces the existing one. The existing API identifier remains unchanged. For merge, the new API definition is merged with the existing API. If you don't specify this property, a default value is chosen. For REST APIs created before March 29, 2021, the default is overwrite. For REST APIs created after March 29, 2021, the new API definition takes precedence, but any container types such as endpoint configurations and binary media types are merged with the existing API. Use the default mode to define top-level RestApi properties in addition to using OpenAPI. Generally, it's preferred to use API Gateway's OpenAPI extensions to model these properties.
name String
The name of the RestApi. A name is required if the REST API is not based on an OpenAPI specification.
parameters Map<String>
Custom header parameters as part of the request. For example, to exclude DocumentationParts from an imported API, set ignore=documentation as a parameters value, as in the AWS CLI command of aws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json' .
policy Any

A policy document that contains the permissions for the RestApi resource. To set the ARN for the policy, use the !Join intrinsic function with "" as delimiter and values of "execute-api:/" and "*".

Search the CloudFormation User Guide for AWS::ApiGateway::RestApi for more information about the expected schema for this property.

tags List<Property Map>
The key-value map of strings. The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters and must not start with aws: . The tag value can be up to 256 characters.

Outputs

All input properties are implicitly available as output properties. Additionally, the RestApi resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
RestApiId string
The string identifier of the associated RestApi.
RootResourceId string
The root resource ID for a RestApi resource, such as a0bc123d4e .
Id string
The provider-assigned unique ID for this managed resource.
RestApiId string
The string identifier of the associated RestApi.
RootResourceId string
The root resource ID for a RestApi resource, such as a0bc123d4e .
id String
The provider-assigned unique ID for this managed resource.
restApiId String
The string identifier of the associated RestApi.
rootResourceId String
The root resource ID for a RestApi resource, such as a0bc123d4e .
id string
The provider-assigned unique ID for this managed resource.
restApiId string
The string identifier of the associated RestApi.
rootResourceId string
The root resource ID for a RestApi resource, such as a0bc123d4e .
id str
The provider-assigned unique ID for this managed resource.
rest_api_id str
The string identifier of the associated RestApi.
root_resource_id str
The root resource ID for a RestApi resource, such as a0bc123d4e .
id String
The provider-assigned unique ID for this managed resource.
restApiId String
The string identifier of the associated RestApi.
rootResourceId String
The root resource ID for a RestApi resource, such as a0bc123d4e .

Supporting Types

RestApiEndpointConfiguration
, RestApiEndpointConfigurationArgs

IpAddressType string
The IP address types that can invoke an API (RestApi). Use ipv4 to allow only IPv4 addresses to invoke an API, or use dualstack to allow both IPv4 and IPv6 addresses to invoke an API. For the PRIVATE endpoint type, only dualstack is supported.
Types List<string>
A list of endpoint types of an API (RestApi) or its custom domain name (DomainName). For an edge-optimized API and its custom domain name, the endpoint type is "EDGE" . For a regional API and its custom domain name, the endpoint type is REGIONAL . For a private API, the endpoint type is PRIVATE .
VpcEndpointIds List<string>
A list of VpcEndpointIds of an API (RestApi) against which to create Route53 ALIASes. It is only supported for PRIVATE endpoint type.
IpAddressType string
The IP address types that can invoke an API (RestApi). Use ipv4 to allow only IPv4 addresses to invoke an API, or use dualstack to allow both IPv4 and IPv6 addresses to invoke an API. For the PRIVATE endpoint type, only dualstack is supported.
Types []string
A list of endpoint types of an API (RestApi) or its custom domain name (DomainName). For an edge-optimized API and its custom domain name, the endpoint type is "EDGE" . For a regional API and its custom domain name, the endpoint type is REGIONAL . For a private API, the endpoint type is PRIVATE .
VpcEndpointIds []string
A list of VpcEndpointIds of an API (RestApi) against which to create Route53 ALIASes. It is only supported for PRIVATE endpoint type.
ipAddressType String
The IP address types that can invoke an API (RestApi). Use ipv4 to allow only IPv4 addresses to invoke an API, or use dualstack to allow both IPv4 and IPv6 addresses to invoke an API. For the PRIVATE endpoint type, only dualstack is supported.
types List<String>
A list of endpoint types of an API (RestApi) or its custom domain name (DomainName). For an edge-optimized API and its custom domain name, the endpoint type is "EDGE" . For a regional API and its custom domain name, the endpoint type is REGIONAL . For a private API, the endpoint type is PRIVATE .
vpcEndpointIds List<String>
A list of VpcEndpointIds of an API (RestApi) against which to create Route53 ALIASes. It is only supported for PRIVATE endpoint type.
ipAddressType string
The IP address types that can invoke an API (RestApi). Use ipv4 to allow only IPv4 addresses to invoke an API, or use dualstack to allow both IPv4 and IPv6 addresses to invoke an API. For the PRIVATE endpoint type, only dualstack is supported.
types string[]
A list of endpoint types of an API (RestApi) or its custom domain name (DomainName). For an edge-optimized API and its custom domain name, the endpoint type is "EDGE" . For a regional API and its custom domain name, the endpoint type is REGIONAL . For a private API, the endpoint type is PRIVATE .
vpcEndpointIds string[]
A list of VpcEndpointIds of an API (RestApi) against which to create Route53 ALIASes. It is only supported for PRIVATE endpoint type.
ip_address_type str
The IP address types that can invoke an API (RestApi). Use ipv4 to allow only IPv4 addresses to invoke an API, or use dualstack to allow both IPv4 and IPv6 addresses to invoke an API. For the PRIVATE endpoint type, only dualstack is supported.
types Sequence[str]
A list of endpoint types of an API (RestApi) or its custom domain name (DomainName). For an edge-optimized API and its custom domain name, the endpoint type is "EDGE" . For a regional API and its custom domain name, the endpoint type is REGIONAL . For a private API, the endpoint type is PRIVATE .
vpc_endpoint_ids Sequence[str]
A list of VpcEndpointIds of an API (RestApi) against which to create Route53 ALIASes. It is only supported for PRIVATE endpoint type.
ipAddressType String
The IP address types that can invoke an API (RestApi). Use ipv4 to allow only IPv4 addresses to invoke an API, or use dualstack to allow both IPv4 and IPv6 addresses to invoke an API. For the PRIVATE endpoint type, only dualstack is supported.
types List<String>
A list of endpoint types of an API (RestApi) or its custom domain name (DomainName). For an edge-optimized API and its custom domain name, the endpoint type is "EDGE" . For a regional API and its custom domain name, the endpoint type is REGIONAL . For a private API, the endpoint type is PRIVATE .
vpcEndpointIds List<String>
A list of VpcEndpointIds of an API (RestApi) against which to create Route53 ALIASes. It is only supported for PRIVATE endpoint type.

RestApiS3Location
, RestApiS3LocationArgs

Bucket string
The name of the S3 bucket where the OpenAPI file is stored.
ETag string
The Amazon S3 ETag (a file checksum) of the OpenAPI file. If you don't specify a value, API Gateway skips ETag validation of your OpenAPI file.
Key string
The file name of the OpenAPI file (Amazon S3 object name).
Version string
For versioning-enabled buckets, a specific version of the OpenAPI file.
Bucket string
The name of the S3 bucket where the OpenAPI file is stored.
ETag string
The Amazon S3 ETag (a file checksum) of the OpenAPI file. If you don't specify a value, API Gateway skips ETag validation of your OpenAPI file.
Key string
The file name of the OpenAPI file (Amazon S3 object name).
Version string
For versioning-enabled buckets, a specific version of the OpenAPI file.
bucket String
The name of the S3 bucket where the OpenAPI file is stored.
eTag String
The Amazon S3 ETag (a file checksum) of the OpenAPI file. If you don't specify a value, API Gateway skips ETag validation of your OpenAPI file.
key String
The file name of the OpenAPI file (Amazon S3 object name).
version String
For versioning-enabled buckets, a specific version of the OpenAPI file.
bucket string
The name of the S3 bucket where the OpenAPI file is stored.
eTag string
The Amazon S3 ETag (a file checksum) of the OpenAPI file. If you don't specify a value, API Gateway skips ETag validation of your OpenAPI file.
key string
The file name of the OpenAPI file (Amazon S3 object name).
version string
For versioning-enabled buckets, a specific version of the OpenAPI file.
bucket str
The name of the S3 bucket where the OpenAPI file is stored.
e_tag str
The Amazon S3 ETag (a file checksum) of the OpenAPI file. If you don't specify a value, API Gateway skips ETag validation of your OpenAPI file.
key str
The file name of the OpenAPI file (Amazon S3 object name).
version str
For versioning-enabled buckets, a specific version of the OpenAPI file.
bucket String
The name of the S3 bucket where the OpenAPI file is stored.
eTag String
The Amazon S3 ETag (a file checksum) of the OpenAPI file. If you don't specify a value, API Gateway skips ETag validation of your OpenAPI file.
key String
The file name of the OpenAPI file (Amazon S3 object name).
version String
For versioning-enabled buckets, a specific version of the OpenAPI file.

Tag
, TagArgs

Key This property is required. string
The key name of the tag
Value This property is required. string
The value of the tag
Key This property is required. string
The key name of the tag
Value This property is required. string
The value of the tag
key This property is required. String
The key name of the tag
value This property is required. String
The value of the tag
key This property is required. string
The key name of the tag
value This property is required. string
The value of the tag
key This property is required. str
The key name of the tag
value This property is required. str
The value of the tag
key This property is required. String
The key name of the tag
value This property is required. String
The value of the tag

Package Details

Repository
AWS Native pulumi/pulumi-aws-native
License
Apache-2.0