Class SpecRestApi
Represents a REST API in Amazon API Gateway, created with an OpenAPI specification.
Inherited Members
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class SpecRestApi : RestApiBase, IRestApi, IResource
Syntax (vb)
Public Class SpecRestApi
Inherits RestApiBase
Implements IRestApi, IResource
Remarks
Some properties normally accessible on @see RestApi
- such as the description -
must be declared in the specification. All Resources and Methods need to be defined as
part of the OpenAPI specification file, and cannot be added via the CDK.
By default, the API will automatically be deployed and accessible from a public endpoint.
Resource: AWS::ApiGateway::RestApi
ExampleMetadata: infused
Examples
Integration integration;
var api = new SpecRestApi(this, "books-api", new SpecRestApiProps {
ApiDefinition = ApiDefinition.FromAsset("path-to-file.json")
});
var booksResource = api.Root.AddResource("books");
booksResource.AddMethod("GET", integration);
Synopsis
Constructors
SpecRestApi(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
SpecRestApi(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
SpecRestApi(Construct, String, ISpecRestApiProps) |
Properties
RestApiId | The ID of this API Gateway RestApi. |
RestApiRootResourceId | The resource ID of the root resource. |
Root | Represents the root resource of this API endpoint ('/'). |
Constructors
SpecRestApi(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected SpecRestApi(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
SpecRestApi(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected SpecRestApi(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
SpecRestApi(Construct, String, ISpecRestApiProps)
public SpecRestApi(Construct scope, string id, ISpecRestApiProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props ISpecRestApiProps
Properties
RestApiId
The ID of this API Gateway RestApi.
public override string RestApiId { get; }
Property Value
System.String
Overrides
RestApiRootResourceId
The resource ID of the root resource.
public override string RestApiRootResourceId { get; }
Property Value
System.String
Overrides
Remarks
Attribute: true
Root
Represents the root resource of this API endpoint ('/').
public override IResource Root { get; }
Property Value
Overrides
Remarks
Resources and Methods are added to this resource.