Interface IRestApiBaseProps
Represents the props that all Rest APIs share.
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IRestApiBaseProps
Syntax (vb)
Public Interface IRestApiBaseProps
Remarks
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.APIGateway;
using Amazon.CDK.AWS.CertificateManager;
using Amazon.CDK.AWS.IAM;
using Amazon.CDK.AWS.S3;
IAccessLogDestination accessLogDestination;
AccessLogFormat accessLogFormat;
Bucket bucket;
Certificate certificate;
PolicyDocument policyDocument;
var restApiBaseProps = new RestApiBaseProps {
CloudWatchRole = false,
CloudWatchRoleRemovalPolicy = RemovalPolicy.DESTROY,
Deploy = false,
DeployOptions = new StageOptions {
AccessLogDestination = accessLogDestination,
AccessLogFormat = accessLogFormat,
CacheClusterEnabled = false,
CacheClusterSize = "cacheClusterSize",
CacheDataEncrypted = false,
CacheTtl = Duration.Minutes(30),
CachingEnabled = false,
ClientCertificateId = "clientCertificateId",
DataTraceEnabled = false,
Description = "description",
DocumentationVersion = "documentationVersion",
LoggingLevel = MethodLoggingLevel.OFF,
MethodOptions = new Dictionary<string, MethodDeploymentOptions> {
{ "methodOptionsKey", new MethodDeploymentOptions {
CacheDataEncrypted = false,
CacheTtl = Duration.Minutes(30),
CachingEnabled = false,
DataTraceEnabled = false,
LoggingLevel = MethodLoggingLevel.OFF,
MetricsEnabled = false,
ThrottlingBurstLimit = 123,
ThrottlingRateLimit = 123
} }
},
MetricsEnabled = false,
StageName = "stageName",
ThrottlingBurstLimit = 123,
ThrottlingRateLimit = 123,
TracingEnabled = false,
Variables = new Dictionary<string, string> {
{ "variablesKey", "variables" }
}
},
Description = "description",
DisableExecuteApiEndpoint = false,
DomainName = new DomainNameOptions {
Certificate = certificate,
DomainName = "domainName",
// the properties below are optional
BasePath = "basePath",
EndpointType = EndpointType.EDGE,
Mtls = new MTLSConfig {
Bucket = bucket,
Key = "key",
// the properties below are optional
Version = "version"
},
SecurityPolicy = SecurityPolicy.TLS_1_0
},
EndpointExportName = "endpointExportName",
EndpointTypes = new [] { EndpointType.EDGE },
FailOnWarnings = false,
Parameters = new Dictionary<string, string> {
{ "parametersKey", "parameters" }
},
Policy = policyDocument,
RestApiName = "restApiName",
RetainDeployments = false
};
Synopsis
Properties
CloudWatchRole | Automatically configure an AWS CloudWatch role for API Gateway. |
CloudWatchRoleRemovalPolicy | The removal policy applied to the AWS CloudWatch role when this resource is removed from the application. |
Deploy | Indicates if a Deployment should be automatically created for this API, and recreated when the API model (resources, methods) changes. |
DeployOptions | Options for the API Gateway stage that will always point to the latest deployment when |
Description | A description of the RestApi construct. |
DisableExecuteApiEndpoint | Specifies whether clients can invoke the API using the default execute-api endpoint. |
DomainName | Configure a custom domain name and map it to this API. |
EndpointExportName | Export name for the CfnOutput containing the API endpoint. |
EndpointTypes | A list of the endpoint types of the API. |
FailOnWarnings | Indicates whether to roll back the resource if a warning occurs while API Gateway is creating the RestApi resource. |
Parameters | Custom header parameters for the request. |
Policy | A policy document that contains the permissions for this RestApi. |
RestApiName | A name for the API Gateway RestApi resource. |
RetainDeployments | Retains old deployment resources when the API changes. |
Properties
CloudWatchRole
Automatically configure an AWS CloudWatch role for API Gateway.
virtual Nullable<bool> CloudWatchRole { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: - false if @aws-cdk/aws-apigateway:disableCloudWatchRole
is enabled, true otherwise
CloudWatchRoleRemovalPolicy
The removal policy applied to the AWS CloudWatch role when this resource is removed from the application.
virtual Nullable<RemovalPolicy> CloudWatchRoleRemovalPolicy { get; }
Property Value
System.Nullable<RemovalPolicy>
Remarks
Requires cloudWatchRole
to be enabled.
Default: - RemovalPolicy.RETAIN
Deploy
Indicates if a Deployment should be automatically created for this API, and recreated when the API model (resources, methods) changes.
virtual Nullable<bool> Deploy { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Since API Gateway deployments are immutable, When this option is enabled (by default), an AWS::ApiGateway::Deployment resource will automatically created with a logical ID that hashes the API model (methods, resources and options). This means that when the model changes, the logical ID of this CloudFormation resource will change, and a new deployment will be created.
If this is set, latestDeployment
will refer to the Deployment
object
and deploymentStage
will refer to a Stage
that points to this
deployment. To customize the stage options, use the deployOptions
property.
A CloudFormation Output will also be defined with the root URL endpoint of this REST API.
Default: true
DeployOptions
Options for the API Gateway stage that will always point to the latest deployment when deploy
is enabled.
virtual IStageOptions DeployOptions { get; }
Property Value
Remarks
If deploy
is disabled,
this value cannot be set.
Default: - Based on defaults of StageOptions
.
Description
A description of the RestApi construct.
virtual string Description { get; }
Property Value
System.String
Remarks
Default: - 'Automatically created by the RestApi construct'
DisableExecuteApiEndpoint
Specifies whether clients can invoke the API using the default execute-api endpoint.
virtual Nullable<bool> DisableExecuteApiEndpoint { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
To require that clients use a custom domain name to invoke the API, disable the default endpoint.
Default: false
See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html
DomainName
Configure a custom domain name and map it to this API.
virtual IDomainNameOptions DomainName { get; }
Property Value
Remarks
Default: - no domain name is defined, use addDomainName
or directly define a DomainName
.
EndpointExportName
Export name for the CfnOutput containing the API endpoint.
virtual string EndpointExportName { get; }
Property Value
System.String
Remarks
Default: - when no export name is given, output will be created without export
EndpointTypes
A list of the endpoint types of the API.
virtual EndpointType[] EndpointTypes { get; }
Property Value
Remarks
Use this property when creating an API.
Default: EndpointType.EDGE
FailOnWarnings
Indicates whether to roll back the resource if a warning occurs while API Gateway is creating the RestApi resource.
virtual Nullable<bool> FailOnWarnings { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
Parameters
Custom header parameters for the request.
virtual IDictionary<string, string> Parameters { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.String>
Remarks
Default: - No parameters.
See: https://docs.aws.amazon.com/cli/latest/reference/apigateway/import-rest-api.html
Policy
A policy document that contains the permissions for this RestApi.
virtual PolicyDocument Policy { get; }
Property Value
Remarks
Default: - No policy.
RestApiName
A name for the API Gateway RestApi resource.
virtual string RestApiName { get; }
Property Value
System.String
Remarks
Default: - ID of the RestApi construct.
RetainDeployments
Retains old deployment resources when the API changes.
virtual Nullable<bool> RetainDeployments { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
This allows manually reverting stages to point to old deployments via the AWS Console.
Default: false