Class CfnRestApi
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.apigateway.CfnRestApi
- All Implemented Interfaces:
IInspectable,ITaggable,IRestApiRef,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.113.0 (build fc68b25)",
date="2025-10-14T12:28:04.075Z")
@Stability(Stable)
public class CfnRestApi
extends CfnResource
implements IInspectable, IRestApiRef, ITaggable
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:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.apigateway.*;
Object body;
Object policy;
CfnRestApi cfnRestApi = CfnRestApi.Builder.create(this, "MyCfnRestApi")
.apiKeySourceType("apiKeySourceType")
.binaryMediaTypes(List.of("binaryMediaTypes"))
.body(body)
.bodyS3Location(S3LocationProperty.builder()
.bucket("bucket")
.eTag("eTag")
.key("key")
.version("version")
.build())
.cloneFrom("cloneFrom")
.description("description")
.disableExecuteApiEndpoint(false)
.endpointConfiguration(EndpointConfigurationProperty.builder()
.ipAddressType("ipAddressType")
.types(List.of("types"))
.vpcEndpointIds(List.of("vpcEndpointIds"))
.build())
.failOnWarnings(false)
.minimumCompressionSize(123)
.mode("mode")
.name("name")
.parameters(Map.of(
"parametersKey", "parameters"))
.policy(policy)
.securityPolicy("securityPolicy")
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnRestApi.static interfaceTheEndpointConfigurationproperty type specifies the endpoint types and IP address types of a REST API.static interfaceS3Locationis a property of the AWS::ApiGateway::RestApi resource that specifies the Amazon S3 location of a OpenAPI (formerly Swagger) file that defines a set of RESTful APIs in JSON or YAML.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.apigateway.IRestApiRef
IRestApiRef.Jsii$Default, IRestApiRef.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnRestApi(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnRestApi(software.amazon.jsii.JsiiObjectRef objRef) CfnRestApi(software.constructs.Construct scope, String id) CfnRestApi(software.constructs.Construct scope, String id, CfnRestApiProps props) -
Method Summary
Modifier and TypeMethodDescriptionstatic IRestApiReffromRestApiId(software.constructs.Construct scope, String id, String restApiId) Creates a new IRestApiRef from a restApiId.The source of the API key for metering requests according to a usage plan.The string identifier of the associated RestApi.The root resource ID for aRestApiresource, such asa0bc123d4e.The list of binary media types supported by the RestApi.getBody()An OpenAPI specification that defines a set of RESTful APIs in JSON format.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.The ID of the RestApi that you want to clone from.The description of the RestApi.Specifies whether clients can invoke your API by using the defaultexecute-apiendpoint.A list of the endpoint types and IP address types of the API.A query parameter to indicate whether to rollback the API update (true) or not (false) when a warning is encountered.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.getMode()This property applies only when you use OpenAPI to define your REST API.getName()The name of the RestApi.Custom header parameters as part of the request.A policy document that contains the permissions for theRestApiresource.A reference to a RestApi resource.getTags()Tag Manager which manages the tags for this resource.The key-value map of strings.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetApiKeySourceType(String value) The source of the API key for metering requests according to a usage plan.voidsetBinaryMediaTypes(List<String> value) The list of binary media types supported by the RestApi.voidAn OpenAPI specification that defines a set of RESTful APIs in JSON format.voidsetBodyS3Location(IResolvable value) 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.voidThe 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.voidsetCloneFrom(String value) The ID of the RestApi that you want to clone from.voidsetDescription(String value) The description of the RestApi.voidSpecifies whether clients can invoke your API by using the defaultexecute-apiendpoint.voidSpecifies whether clients can invoke your API by using the defaultexecute-apiendpoint.voidA list of the endpoint types and IP address types of the API.voidA list of the endpoint types and IP address types of the API.voidsetFailOnWarnings(Boolean value) A query parameter to indicate whether to rollback the API update (true) or not (false) when a warning is encountered.voidsetFailOnWarnings(IResolvable value) A query parameter to indicate whether to rollback the API update (true) or not (false) when a warning is encountered.voidsetMinimumCompressionSize(Number value) 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.voidThis property applies only when you use OpenAPI to define your REST API.voidThe name of the RestApi.voidsetParameters(Map<String, String> value) Custom header parameters as part of the request.voidsetParameters(IResolvable value) Custom header parameters as part of the request.voidA policy document that contains the permissions for theRestApiresource.voidsetSecurityPolicy(String value) voidsetTagsRaw(List<CfnTag> value) The key-value map of strings.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnRestApi
protected CfnRestApi(software.amazon.jsii.JsiiObjectRef objRef) -
CfnRestApi
protected CfnRestApi(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnRestApi
@Stability(Stable) public CfnRestApi(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnRestApiProps props) - Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.props- Resource properties.
-
CfnRestApi
@Stability(Stable) public CfnRestApi(@NotNull software.constructs.Construct scope, @NotNull String id) - Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.
-
-
Method Details
-
fromRestApiId
@Stability(Stable) @NotNull public static IRestApiRef fromRestApiId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String restApiId) Creates a new IRestApiRef from a restApiId.- Parameters:
scope- This parameter is required.id- This parameter is required.restApiId- This parameter is required.
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrRestApiId
The string identifier of the associated RestApi. -
getAttrRootResourceId
The root resource ID for aRestApiresource, such asa0bc123d4e. -
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getRestApiRef
A reference to a RestApi resource.- Specified by:
getRestApiRefin interfaceIRestApiRef
-
getTags
Tag Manager which manages the tags for this resource. -
getApiKeySourceType
The source of the API key for metering requests according to a usage plan. -
setApiKeySourceType
The source of the API key for metering requests according to a usage plan. -
getBinaryMediaTypes
The list of binary media types supported by the RestApi. -
setBinaryMediaTypes
The list of binary media types supported by the RestApi. -
getBody
An OpenAPI specification that defines a set of RESTful APIs in JSON format. -
setBody
An OpenAPI specification that defines a set of RESTful APIs in JSON format. -
getBodyS3Location
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. -
setBodyS3Location
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. -
setBodyS3Location
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. -
getCloneFrom
The ID of the RestApi that you want to clone from. -
setCloneFrom
The ID of the RestApi that you want to clone from. -
getDescription
The description of the RestApi. -
setDescription
The description of the RestApi. -
getDisableExecuteApiEndpoint
Specifies whether clients can invoke your API by using the defaultexecute-apiendpoint. -
setDisableExecuteApiEndpoint
Specifies whether clients can invoke your API by using the defaultexecute-apiendpoint. -
setDisableExecuteApiEndpoint
Specifies whether clients can invoke your API by using the defaultexecute-apiendpoint. -
getEndpointConfiguration
A list of the endpoint types and IP address types of the API. -
setEndpointConfiguration
A list of the endpoint types and IP address types of the API. -
setEndpointConfiguration
@Stability(Stable) public void setEndpointConfiguration(@Nullable CfnRestApi.EndpointConfigurationProperty value) A list of the endpoint types and IP address types of the API. -
getFailOnWarnings
A query parameter to indicate whether to rollback the API update (true) or not (false) when a warning is encountered. -
setFailOnWarnings
A query parameter to indicate whether to rollback the API update (true) or not (false) when a warning is encountered. -
setFailOnWarnings
A query parameter to indicate whether to rollback the API update (true) or not (false) when a warning is encountered. -
getMinimumCompressionSize
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. -
setMinimumCompressionSize
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. -
getMode
This property applies only when you use OpenAPI to define your REST API. -
setMode
This property applies only when you use OpenAPI to define your REST API. -
getName
The name of the RestApi. -
setName
The name of the RestApi. -
getParameters
Custom header parameters as part of the request. -
setParameters
Custom header parameters as part of the request. -
setParameters
Custom header parameters as part of the request. -
getPolicy
A policy document that contains the permissions for theRestApiresource. -
setPolicy
A policy document that contains the permissions for theRestApiresource. -
getSecurityPolicy
-
setSecurityPolicy
-
getTagsRaw
The key-value map of strings. -
setTagsRaw
The key-value map of strings.
-