Skip to content

Latest commit

 

History

History
770 lines (473 loc) · 28.7 KB

API.md

File metadata and controls

770 lines (473 loc) · 28.7 KB

API Reference

Constructs

ApiGateways

Initializers

import { ApiGateways } from '@softchef/cdk-apigateways'

new ApiGateways(scope: Construct, id: string, props: ApiGatewaysProps)
Name Type Description
scope constructs.Construct No description.
id string No description.
props ApiGatewaysProps No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { ApiGateways } from '@softchef/cdk-apigateways'

ApiGateways.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
distribution aws-cdk-lib.aws_cloudfront.Distribution CloudFront distribution.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


distributionRequired
public readonly distribution: Distribution;
  • Type: aws-cdk-lib.aws_cloudfront.Distribution

CloudFront distribution.


Structs

ApiGatewaysProps

Initializer

import { ApiGatewaysProps } from '@softchef/cdk-apigateways'

const apiGatewaysProps: ApiGatewaysProps = { ... }

Properties

Name Type Description
documentation Documentation Specify the documentation config.
originApisConfig OriginApiConfig[] Mix the APIs with specified behaviors.
stageName string All of APIs stage name, all stage names must be the same.
distribution DistributionProps Specify the CloudFront distribution properties.

documentationRequired
public readonly documentation: Documentation;

Specify the documentation config.


originApisConfigRequired
public readonly originApisConfig: OriginApiConfig[];

Mix the APIs with specified behaviors.


stageNameRequired
public readonly stageName: string;
  • Type: string

All of APIs stage name, all stage names must be the same.


distributionOptional
public readonly distribution: DistributionProps;

Specify the CloudFront distribution properties.


CustomPage

Initializer

import { CustomPage } from '@softchef/cdk-apigateways'

const customPage: CustomPage = { ... }

Properties

Name Type Description
cssStyles string Specify css styles to embedded to static page.
pageTitle string Specify page title to static page.

cssStylesOptional
public readonly cssStyles: string;
  • Type: string

Specify css styles to embedded to static page.


pageTitleOptional
public readonly pageTitle: string;
  • Type: string

Specify page title to static page.


DistributionProps

Initializer

import { DistributionProps } from '@softchef/cdk-apigateways'

const distributionProps: DistributionProps = { ... }

Properties

Name Type Description
certificate aws-cdk-lib.aws_certificatemanager.ICertificate A certificate to associate with the distribution.
comment string Any comments you want to include about the distribution.
defaultRootObject string The object that you want CloudFront to request from your origin (for example, index.html) when a viewer requests the root URL for your distribution. If no default object is set, the request goes to the origin's root (e.g., example.com/).
domainNames string[] Alternative domain names for this distribution.
enabled boolean Enable or disable the distribution.
enableIpv6 boolean Whether CloudFront will respond to IPv6 DNS requests with an IPv6 address.
enableLogging boolean Enable access logging for the distribution.
errorResponses aws-cdk-lib.aws_cloudfront.ErrorResponse[] How CloudFront should handle requests that are not successful (e.g., PageNotFound).
geoRestriction aws-cdk-lib.aws_cloudfront.GeoRestriction Controls the countries in which your content is distributed.
httpVersion aws-cdk-lib.aws_cloudfront.HttpVersion Specify the maximum HTTP version that you want viewers to use to communicate with CloudFront.
logBucket aws-cdk-lib.aws_s3.IBucket The Amazon S3 bucket to store the access logs in.
logFilePrefix string An optional string that you want CloudFront to prefix to the access log filenames for this distribution.
logIncludesCookies boolean Specifies whether you want CloudFront to include cookies in access logs.
minimumProtocolVersion aws-cdk-lib.aws_cloudfront.SecurityPolicyProtocol The minimum version of the SSL protocol that you want CloudFront to use for HTTPS connections.
webAclId string Unique identifier that specifies the AWS WAF web ACL to associate with this CloudFront distribution.

certificateOptional
public readonly certificate: ICertificate;
  • Type: aws-cdk-lib.aws_certificatemanager.ICertificate
  • Default: the CloudFront wildcard certificate (*.cloudfront.net) will be used.

A certificate to associate with the distribution.

The certificate must be located in N. Virginia (us-east-1).


commentOptional
public readonly comment: string;
  • Type: string
  • Default: no comment

Any comments you want to include about the distribution.


defaultRootObjectOptional
public readonly defaultRootObject: string;
  • Type: string
  • Default: no default root object

The object that you want CloudFront to request from your origin (for example, index.html) when a viewer requests the root URL for your distribution. If no default object is set, the request goes to the origin's root (e.g., example.com/).


domainNamesOptional
public readonly domainNames: string[];
  • Type: string[]
  • Default: The distribution will only support the default generated name (e.g., d111111abcdef8.cloudfront.net)

Alternative domain names for this distribution.

If you want to use your own domain name, such as www.example.com, instead of the cloudfront.net domain name, you can add an alternate domain name to your distribution. If you attach a certificate to the distribution, you must add (at least one of) the domain names of the certificate to this list.


enabledOptional
public readonly enabled: boolean;
  • Type: boolean
  • Default: true

Enable or disable the distribution.


enableIpv6Optional
public readonly enableIpv6: boolean;
  • Type: boolean
  • Default: true

Whether CloudFront will respond to IPv6 DNS requests with an IPv6 address.

If you specify false, CloudFront responds to IPv6 DNS requests with the DNS response code NOERROR and with no IP addresses. This allows viewers to submit a second request, for an IPv4 address for your distribution.


enableLoggingOptional
public readonly enableLogging: boolean;
  • Type: boolean
  • Default: false, unless logBucket is specified.

Enable access logging for the distribution.


errorResponsesOptional
public readonly errorResponses: ErrorResponse[];
  • Type: aws-cdk-lib.aws_cloudfront.ErrorResponse[]
  • Default: No custom error responses.

How CloudFront should handle requests that are not successful (e.g., PageNotFound).


geoRestrictionOptional
public readonly geoRestriction: GeoRestriction;
  • Type: aws-cdk-lib.aws_cloudfront.GeoRestriction
  • Default: No geographic restrictions

Controls the countries in which your content is distributed.


httpVersionOptional
public readonly httpVersion: HttpVersion;
  • Type: aws-cdk-lib.aws_cloudfront.HttpVersion
  • Default: HttpVersion.HTTP2

Specify the maximum HTTP version that you want viewers to use to communicate with CloudFront.

For viewers and CloudFront to use HTTP/2, viewers must support TLS 1.2 or later, and must support server name identification (SNI).


logBucketOptional
public readonly logBucket: IBucket;
  • Type: aws-cdk-lib.aws_s3.IBucket
  • Default: A bucket is created if enableLogging is true

The Amazon S3 bucket to store the access logs in.


logFilePrefixOptional
public readonly logFilePrefix: string;
  • Type: string
  • Default: no prefix

An optional string that you want CloudFront to prefix to the access log filenames for this distribution.


logIncludesCookiesOptional
public readonly logIncludesCookies: boolean;
  • Type: boolean
  • Default: false

Specifies whether you want CloudFront to include cookies in access logs.


minimumProtocolVersionOptional
public readonly minimumProtocolVersion: SecurityPolicyProtocol;
  • Type: aws-cdk-lib.aws_cloudfront.SecurityPolicyProtocol
  • Default: SecurityPolicyProtocol.TLS_V1_2_2021 if the '

The minimum version of the SSL protocol that you want CloudFront to use for HTTPS connections.

CloudFront serves your objects only to browsers or devices that support at least the SSL version that you specify.


webAclIdOptional
public readonly webAclId: string;
  • Type: string
  • Default: No AWS Web Application Firewall web access control list (web ACL).

Unique identifier that specifies the AWS WAF web ACL to associate with this CloudFront distribution.

To specify a web ACL created using the latest version of AWS WAF, use the ACL ARN, for example arn:aws:wafv2:us-east-1:123456789012:global/webacl/ExampleWebACL/473e64fd-f30b-4765-81a0-62ad96dd167a. To specify a web ACL created using AWS WAF Classic, use the ACL ID, for example 473e64fd-f30b-4765-81a0-62ad96dd167a.

https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CreateDistribution.html#API_CreateDistribution_RequestParameters.


Documentation

Initializer

import { Documentation } from '@softchef/cdk-apigateways'

const documentation: Documentation = { ... }

Properties

Name Type Description
customPage CustomPage Custom documentation page.
docsPrefix string Specify the documentation store prefix path.
file string Specify the documentation definitions path.
pannelType string Specify pannel type, Supports:.
s3Bucket aws-cdk-lib.aws_s3.IBucket Specify the documentation bucket to store static web page.

customPageOptional
public readonly customPage: CustomPage;

Custom documentation page.


docsPrefixOptional
public readonly docsPrefix: string;
  • Type: string

Specify the documentation store prefix path.


fileOptional
public readonly file: string;
  • Type: string

Specify the documentation definitions path.

Support format: Swagger 2.0, OpenAPI 3.0, OpenAPI 3.1


pannelTypeOptional
public readonly pannelType: string;
  • Type: string
  • Default: Redoc

Specify pannel type, Supports:.

Redoc: https://github.com/Redocly/redoc


s3BucketOptional
public readonly s3Bucket: IBucket;
  • Type: aws-cdk-lib.aws_s3.IBucket

Specify the documentation bucket to store static web page.


OriginApiConfig

Initializer

import { OriginApiConfig } from '@softchef/cdk-apigateways'

const originApiConfig: OriginApiConfig = { ... }

Properties

Name Type Description
originApi aws-cdk-lib.aws_apigateway.RestApi | @aws-cdk/aws-apigatewayv2-alpha.HttpApi | @softchef/cdk-restapi.RestApi The origin api are supported AWS RestApi/HttpApi & @softchef/cdk-restapi.
path string The origin api path.
allowedMethods aws-cdk-lib.aws_cloudfront.AllowedMethods HTTP methods to allow for this behavior.
cachedMethods aws-cdk-lib.aws_cloudfront.CachedMethods HTTP methods to cache for this behavior.
cachePolicy aws-cdk-lib.aws_cloudfront.ICachePolicy The cache policy for this behavior.
compress boolean Whether you want CloudFront to automatically compress certain files for this cache behavior.
originApiAuthorizationType OriginApiAuthorizationType The origin api which authorization type.
originRequestPolicy aws-cdk-lib.aws_cloudfront.IOriginRequestPolicy The origin request policy for this behavior.
responseHeadersPolicy aws-cdk-lib.aws_cloudfront.IResponseHeadersPolicy The response headers policy for this behavior.
viewerProtocolPolicy aws-cdk-lib.aws_cloudfront.ViewerProtocolPolicy The protocol that viewers can use to access the files controlled by this behavior.

originApiRequired
public readonly originApi: RestApi | HttpApi | RestApi;
  • Type: aws-cdk-lib.aws_apigateway.RestApi | @aws-cdk/aws-apigatewayv2-alpha.HttpApi | @softchef/cdk-restapi.RestApi

The origin api are supported AWS RestApi/HttpApi & @softchef/cdk-restapi.


pathRequired
public readonly path: string;
  • Type: string

The origin api path.

Ex: https://{ApiId}.execute-api.{region}.amazonaws.com/{StageName}/articles, the path is articles.


allowedMethodsOptional
public readonly allowedMethods: AllowedMethods;
  • Type: aws-cdk-lib.aws_cloudfront.AllowedMethods
  • Default: AllowedMethods.ALLOW_GET_HEAD

HTTP methods to allow for this behavior.


cachedMethodsOptional
public readonly cachedMethods: CachedMethods;
  • Type: aws-cdk-lib.aws_cloudfront.CachedMethods
  • Default: CachedMethods.CACHE_GET_HEAD

HTTP methods to cache for this behavior.


cachePolicyOptional
public readonly cachePolicy: ICachePolicy;
  • Type: aws-cdk-lib.aws_cloudfront.ICachePolicy
  • Default: CachePolicy.CACHING_OPTIMIZED

The cache policy for this behavior.

The cache policy determines what values are included in the cache key, and the time-to-live (TTL) values for the cache.

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html.


compressOptional
public readonly compress: boolean;
  • Type: boolean
  • Default: true

Whether you want CloudFront to automatically compress certain files for this cache behavior.

See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html#compressed-content-cloudfront-file-types for file types CloudFront will compress.


originApiAuthorizationTypeOptional
public readonly originApiAuthorizationType: OriginApiAuthorizationType;

The origin api which authorization type.


originRequestPolicyOptional
public readonly originRequestPolicy: IOriginRequestPolicy;
  • Type: aws-cdk-lib.aws_cloudfront.IOriginRequestPolicy
  • Default: none

The origin request policy for this behavior.

The origin request policy determines which values (e.g., headers, cookies) are included in requests that CloudFront sends to the origin.


responseHeadersPolicyOptional
public readonly responseHeadersPolicy: IResponseHeadersPolicy;
  • Type: aws-cdk-lib.aws_cloudfront.IResponseHeadersPolicy
  • Default: none

The response headers policy for this behavior.

The response headers policy determines which headers are included in responses


viewerProtocolPolicyOptional
public readonly viewerProtocolPolicy: ViewerProtocolPolicy;
  • Type: aws-cdk-lib.aws_cloudfront.ViewerProtocolPolicy
  • Default: ViewerProtocolPolicy.ALLOW_ALL

The protocol that viewers can use to access the files controlled by this behavior.


Enums

OriginApiAuthorizationType

Members

Name Description
NONE Open access.
IAM Use AWS IAM permissions.
COGNITO Use an AWS Cognito user pool.

NONE

Open access.


IAM

Use AWS IAM permissions.


COGNITO

Use an AWS Cognito user pool.