Skip to main content

API Reference

Resources

Api

Base class for AWS API.

Initializers

bring aws;

new aws.Api(props?: ApiProps);
NameTypeDescription
props
ApiProps
No description.

propsOptional

Methods

NameDescription
connect
Add a inflight handler to the api for CONNECT requests on the given path.
delete
Add a inflight handler to the api for DELETE requests on the given path.
get
Add a inflight handler to the api for GET requests on the given path.
head
Add a inflight handler to the api for HEAD requests on the given path.
options
Add a inflight handler to the api for OPTIONS requests on the given path.
patch
Add a inflight handler to the api for PATCH requests on the given path.
post
Add a inflight handler to the api for POST requests on the given path.
put
Add a inflight handler to the api for PUT requests on the given path.

connect
connect(path: str, inflight: IApiEndpointHandler, props?: ApiConnectOptions): void

Add a inflight handler to the api for CONNECT requests on the given path.

pathRequired
  • Type: str

inflightRequired

propsOptional

delete
delete(path: str, inflight: IApiEndpointHandler, props?: ApiDeleteOptions): void

Add a inflight handler to the api for DELETE requests on the given path.

pathRequired
  • Type: str

inflightRequired

propsOptional

get
get(path: str, inflight: IApiEndpointHandler, props?: ApiGetOptions): void

Add a inflight handler to the api for GET requests on the given path.

pathRequired
  • Type: str

inflightRequired

propsOptional

head
head(path: str, inflight: IApiEndpointHandler, props?: ApiHeadOptions): void

Add a inflight handler to the api for HEAD requests on the given path.

pathRequired
  • Type: str

inflightRequired

propsOptional

options
options(path: str, inflight: IApiEndpointHandler, props?: ApiOptionsOptions): void

Add a inflight handler to the api for OPTIONS requests on the given path.

pathRequired
  • Type: str

inflightRequired

propsOptional

patch
patch(path: str, inflight: IApiEndpointHandler, props?: ApiPatchOptions): void

Add a inflight handler to the api for PATCH requests on the given path.

pathRequired
  • Type: str

inflightRequired

propsOptional

post
post(path: str, inflight: IApiEndpointHandler, props?: ApiPostOptions): void

Add a inflight handler to the api for POST requests on the given path.

pathRequired
  • Type: str

inflightRequired

propsOptional

put
put(path: str, inflight: IApiEndpointHandler, props?: ApiPutOptions): void

Add a inflight handler to the api for PUT requests on the given path.

pathRequired
  • Type: str

inflightRequired

propsOptional

Static Functions

NameDescription
onLiftType
A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.
toInflight
Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.
renderCorsHeaders
Generates an object containing default CORS response headers and OPTIONS response headers.
renderOpenApiPath
Converts input path to a valid OpenAPI path (replaces : based path params with {}).
from
If the api is an AWS RestApi, return a helper interface for working with it.

onLiftType
bring aws;

aws.Api.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

toInflight
bring aws;

aws.Api.toInflight(obj: IResource);

Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

NOTE: This statement must be executed within an async context.

objRequired

renderCorsHeaders
bring aws;

aws.Api.renderCorsHeaders(corsOptions?: ApiCorsOptions);

Generates an object containing default CORS response headers and OPTIONS response headers.

corsOptionsOptional

The CORS options to generate the headers from.


renderOpenApiPath
bring aws;

aws.Api.renderOpenApiPath(path: str);

Converts input path to a valid OpenAPI path (replaces : based path params with {}).

pathRequired
  • Type: str

The path to convert (assumes path is valid).


from
bring aws;

aws.Api.from(api: Api);

If the api is an AWS RestApi, return a helper interface for working with it.

apiRequired

The cloud.Api.


Properties

NameTypeDescription
node
constructs.NodeThe tree node.
url
strThe base URL of the API endpoint.
deploymentId
strRestApi deployment id.
invokeUrl
strInvoke URL.
restApiArn
strRestApi arn.
restApiId
strRestApi id.
restApiName
strRestApi id.
stageName
strRestApi stage name.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


urlRequired
url: str;
  • Type: str

The base URL of the API endpoint.


deploymentIdRequired
deploymentId: str;
  • Type: str

RestApi deployment id.


invokeUrlRequired
invokeUrl: str;
  • Type: str

Invoke URL.


restApiArnRequired
restApiArn: str;
  • Type: str

RestApi arn.


restApiIdRequired
restApiId: str;
  • Type: str

RestApi id.


restApiNameRequired
restApiName: str;
  • Type: str

RestApi id.


stageNameRequired
stageName: str;
  • Type: str

RestApi stage name.


Bucket

Base class for AWS Buckets.

Initializers

bring aws;

new aws.Bucket(props?: BucketProps);
NameTypeDescription
props
BucketProps
No description.

propsOptional

Methods

NameDescription
addCorsRule
Add cors configuration to the bucket.
addFile
Add a file to the bucket from system folder.
addObject
Add a file to the bucket that is uploaded when the app is deployed.
onCreate
Run an inflight whenever a file is uploaded to the bucket.
onDelete
Run an inflight whenever a file is deleted from the bucket.
onEvent
Run an inflight whenever a file is uploaded, modified, or deleted from the bucket.
onUpdate
Run an inflight whenever a file is updated in the bucket.

addCorsRule
addCorsRule(value: BucketCorsOptions): void

Add cors configuration to the bucket.

valueRequired

addFile
addFile(key: str, path: str, encoding?: str): void

Add a file to the bucket from system folder.

keyRequired
  • Type: str

The key or name to associate with the file.


pathRequired
  • Type: str

The path to the file on the local system.


encodingOptional
  • Type: str

The encoding to use when reading the file.

Defaults to "utf-8".


addObject
addObject(path: str, content: str): void

Add a file to the bucket that is uploaded when the app is deployed.

TODO: In the future this will support uploading any Blob type or referencing a file from the local filesystem.

pathRequired
  • Type: str

contentRequired
  • Type: str

onCreate
onCreate(fn: IBucketEventHandler, opts?: BucketOnCreateOptions): void

Run an inflight whenever a file is uploaded to the bucket.

fnRequired

optsOptional

onDelete
onDelete(fn: IBucketEventHandler, opts?: BucketOnDeleteOptions): void

Run an inflight whenever a file is deleted from the bucket.

fnRequired

optsOptional

onEvent
onEvent(fn: IBucketEventHandler, opts?: BucketOnEventOptions): void

Run an inflight whenever a file is uploaded, modified, or deleted from the bucket.

fnRequired

optsOptional

onUpdate
onUpdate(fn: IBucketEventHandler, opts?: BucketOnUpdateOptions): void

Run an inflight whenever a file is updated in the bucket.

fnRequired

optsOptional

Static Functions

NameDescription
onLiftType
A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.
toInflight
Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.
from
If the bucket is an AWS Bucket, return a helper interface for working with it.

onLiftType
bring aws;

aws.Bucket.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

toInflight
bring aws;

aws.Bucket.toInflight(obj: IResource);

Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

NOTE: This statement must be executed within an async context.

objRequired

from
bring aws;

aws.Bucket.from(bucket: Bucket);

If the bucket is an AWS Bucket, return a helper interface for working with it.

bucketRequired

The cloud.Bucket.


Properties

NameTypeDescription
node
constructs.NodeThe tree node.
bucketArn
strAWS Bucket arn.
bucketDomainName
strBucket domain name.
bucketName
strAWS Bucket name.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


bucketArnRequired
bucketArn: str;
  • Type: str

AWS Bucket arn.


bucketDomainNameRequired
bucketDomainName: str;
  • Type: str

Bucket domain name.


bucketNameRequired
bucketName: str;
  • Type: str

AWS Bucket name.


BucketRef

A reference to an external S3 bucket.

Initializers

bring aws;

new aws.BucketRef(bucketName: str);
NameTypeDescription
bucketName
strNo description.

bucketNameRequired
  • Type: str

Methods

Inflight Methods
NameDescription
bucketRegion
Get the region of the bucket.

bucketRegion
inflight bucketRegion(): str

Get the region of the bucket.

Static Functions

NameDescription
onLiftType
A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.
toInflight
Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

onLiftType
bring aws;

aws.BucketRef.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

toInflight
bring aws;

aws.BucketRef.toInflight(obj: IResource);

Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

NOTE: This statement must be executed within an async context.

objRequired

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
bucketArn
strThe ARN of this bucket.
bucketDomainName
strThe domain name of this bucket.
bucketName
strThe Name of this bucket.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


bucketArnRequired
bucketArn: str;
  • Type: str

The ARN of this bucket.


bucketDomainNameRequired
bucketDomainName: str;
  • Type: str

The domain name of this bucket.


bucketNameRequired
bucketName: str;
  • Type: str

The Name of this bucket.


Counter

Base class for AWS Counters.

Initializers

bring aws;

new aws.Counter(props?: CounterProps);
NameTypeDescription
props
CounterProps
No description.

propsOptional

Static Functions

NameDescription
onLiftType
A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.
toInflight
Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.
from
If the table is an AWS Counter, return a helper interface for working with it.

onLiftType
bring aws;

aws.Counter.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

toInflight
bring aws;

aws.Counter.toInflight(obj: IResource);

Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

NOTE: This statement must be executed within an async context.

objRequired

from
bring aws;

aws.Counter.from(counter: Counter);

If the table is an AWS Counter, return a helper interface for working with it.

counterRequired

The cloud.Counter.


Properties

NameTypeDescription
node
constructs.NodeThe tree node.
initial
numThe initial value of the counter.
dynamoTableArn
strAWS Dynamodb arn.
dynamoTableName
strAWS Dynamodb name.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


initialRequired
initial: num;
  • Type: num

The initial value of the counter.


dynamoTableArnRequired
dynamoTableArn: str;
  • Type: str

AWS Dynamodb arn.


dynamoTableNameRequired
dynamoTableName: str;
  • Type: str

AWS Dynamodb name.


Domain

AWS implementation of cloud.Domain.

Initializers

bring aws;

new aws.Domain(props: DomainProps);
NameTypeDescription
props
DomainProps
No description.

propsRequired

Static Functions

NameDescription
onLiftType
A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.
toInflight
Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

onLiftType
bring aws;

aws.Domain.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

toInflight
bring aws;

aws.Domain.toInflight(obj: IResource);

Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

NOTE: This statement must be executed within an async context.

objRequired

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
domainName
strThe domain name.
acmCertificateArn
strThe AWS Certificate Manager (ACM) certificate arn value.
hostedZoneId
strThe hosted zone id value.
iamCertificate
strThe IAM certificate identifier value.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


domainNameRequired
domainName: str;
  • Type: str

The domain name.


acmCertificateArnOptional
acmCertificateArn: str;
  • Type: str

The AWS Certificate Manager (ACM) certificate arn value.


hostedZoneIdOptional
hostedZoneId: str;
  • Type: str

The hosted zone id value.


iamCertificateOptional
iamCertificate: str;
  • Type: str

The IAM certificate identifier value.


Function

Base class for AWS Functions.

Initializers

bring aws;

new aws.Function(handler: IFunctionHandler, props?: FunctionProps);
NameTypeDescription
handler
IFunctionHandler
No description.
props
FunctionProps
No description.

handlerRequired

propsOptional

Methods

NameDescription
addEnvironment
Add an environment variable to the function.
addLambdaLayer
Add a Lambda layer to the function.
addNetwork
Adds the host to the specified network.
addPolicyStatements
Add policy statements to the function's IAM role.

addEnvironment
addEnvironment(name: str, value: str): void

Add an environment variable to the function.

nameRequired
  • Type: str

valueRequired
  • Type: str

addLambdaLayer
addLambdaLayer(layerArn: str): void

Add a Lambda layer to the function.

layerArnRequired
  • Type: str

addNetwork
addNetwork(config: NetworkConfig): void

Adds the host to the specified network.

configRequired

addPolicyStatements
addPolicyStatements(...policies: Array<PolicyStatement>): void

Add policy statements to the function's IAM role.

policiesRequired

Static Functions

NameDescription
onLiftType
A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.
toInflight
Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.
context
Returns the current Lambda invocation context, if the host is an AWS Lambda.
from
If the inflight host is an AWS Lambda, return a helper interface for working with it.

onLiftType
bring aws;

aws.Function.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

toInflight
bring aws;

aws.Function.toInflight(obj: IResource);

Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

NOTE: This statement must be executed within an async context.

objRequired

context
bring aws;

aws.Function.context();

Returns the current Lambda invocation context, if the host is an AWS Lambda.

https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html

from
bring aws;

aws.Function.from(host: IInflightHost);

If the inflight host is an AWS Lambda, return a helper interface for working with it.

hostRequired

The inflight host.


Properties

NameTypeDescription
node
constructs.NodeThe tree node.
env
MutMap<str>Returns the set of environment variables for this function.
functionArn
strAWS Function arn.
functionName
strAWS Function name.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


envRequired
env: MutMap<str>;
  • Type: MutMap<str>

Returns the set of environment variables for this function.


functionArnRequired
functionArn: str;
  • Type: str

AWS Function arn.


functionNameRequired
functionName: str;
  • Type: str

AWS Function name.


FunctionRef

A reference to an external Lambda function.

Initializers

bring aws;

new aws.FunctionRef(functionArn: str);
NameTypeDescription
functionArn
strNo description.

functionArnRequired
  • Type: str

Methods

Inflight Methods
NameDescription
invoke
Invokes the function with a payload and waits for the result.
invokeAsync
Kicks off the execution of the function with a payload and returns immediately while the function is running.

invoke
inflight invoke(payload?: Json): Json?

Invokes the function with a payload and waits for the result.

payloadOptional

payload to pass to the function.

If not defined, an empty string will be passed.


invokeAsync
inflight invokeAsync(payload?: Json): void

Kicks off the execution of the function with a payload and returns immediately while the function is running.

payloadOptional

payload to pass to the function.

If not defined, an empty string will be passed.


Static Functions

NameDescription
onLiftType
A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.
toInflight
Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

onLiftType
bring aws;

aws.FunctionRef.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

toInflight
bring aws;

aws.FunctionRef.toInflight(obj: IResource);

Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

NOTE: This statement must be executed within an async context.

objRequired

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
functionArn
strThe ARN of this function.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


functionArnRequired
functionArn: str;
  • Type: str

The ARN of this function.


Queue

Base class for AWS Queues.

Initializers

bring aws;

new aws.Queue(props?: QueueProps);
NameTypeDescription
props
QueueProps
No description.

propsOptional

Methods

NameDescription
setConsumer
Create a function to consume messages from this queue.

setConsumer
setConsumer(handler: IQueueSetConsumerHandler, props?: QueueSetConsumerOptions): Function

Create a function to consume messages from this queue.

handlerRequired

propsOptional

Static Functions

NameDescription
onLiftType
A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.
toInflight
Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.
from
If the queue is an AWS SQS, return a helper interface for working with it.

onLiftType
bring aws;

aws.Queue.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

toInflight
bring aws;

aws.Queue.toInflight(obj: IResource);

Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

NOTE: This statement must be executed within an async context.

objRequired

from
bring aws;

aws.Queue.from(queue: Queue);

If the queue is an AWS SQS, return a helper interface for working with it.

queueRequired

The cloud.Queue.


Properties

NameTypeDescription
node
constructs.NodeThe tree node.
queueArn
strAWS Queue arn.
queueName
strAWS Queue name.
queueUrl
strAWS Queue url.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


queueArnRequired
queueArn: str;
  • Type: str

AWS Queue arn.


queueNameRequired
queueName: str;
  • Type: str

AWS Queue name.


queueUrlRequired
queueUrl: str;
  • Type: str

AWS Queue url.


QueueRef

A reference to an external SQS queue.

Initializers

bring aws;

new aws.QueueRef(queueArn: str);
NameTypeDescription
queueArn
strNo description.

queueArnRequired
  • Type: str

Methods

Inflight Methods
NameDescription
queueUrl
Get the queue URL.

queueUrl
inflight queueUrl(): str

Get the queue URL.

Static Functions

NameDescription
onLiftType
A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.
toInflight
Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

onLiftType
bring aws;

aws.QueueRef.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

toInflight
bring aws;

aws.QueueRef.toInflight(obj: IResource);

Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

NOTE: This statement must be executed within an async context.

objRequired

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
queueArn
strThe ARN of this queue.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


queueArnRequired
queueArn: str;
  • Type: str

The ARN of this queue.


Secret

Base class for AWS Secrets.

Initializers

bring aws;

new aws.Secret(props?: SecretProps);
NameTypeDescription
props
SecretProps
No description.

propsOptional

Static Functions

NameDescription
onLiftType
A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.
toInflight
Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

onLiftType
bring aws;

aws.Secret.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

toInflight
bring aws;

aws.Secret.toInflight(obj: IResource);

Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

NOTE: This statement must be executed within an async context.

objRequired

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
name
strGet secret name.
secretArn
strAWS Secret ARN.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


nameOptional
name: str;
  • Type: str

Get secret name.


secretArnRequired
secretArn: str;
  • Type: str

AWS Secret ARN.


SecretRef

A reference to an existing secret.

Initializers

bring aws;

new aws.SecretRef(secretArn: str);
NameTypeDescription
secretArn
strNo description.

secretArnRequired
  • Type: str

Methods

Inflight Methods
NameDescription
value
Retrieve the value of the secret.
valueJson
Retrieve the Json value of the secret.

value
inflight value(options?: GetSecretValueOptions): str

Retrieve the value of the secret.

optionsOptional

valueJson
inflight valueJson(options?: GetSecretValueOptions): Json

Retrieve the Json value of the secret.

optionsOptional

Static Functions

NameDescription
onLiftType
A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.
toInflight
Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

onLiftType
bring aws;

aws.SecretRef.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

toInflight
bring aws;

aws.SecretRef.toInflight(obj: IResource);

Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

NOTE: This statement must be executed within an async context.

objRequired

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
secretArn
strThe ARN of the secret.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


secretArnRequired
secretArn: str;
  • Type: str

The ARN of the secret.


Service

Base class for AWS Services.

Initializers

bring aws;

new aws.Service(handler: IServiceHandler, props?: ServiceProps);
NameTypeDescription
handler
IServiceHandler
No description.
props
ServiceProps
No description.

handlerRequired

propsOptional

Methods

NameDescription
addEnvironment
Add an environment variable to the function.
addNetwork
Adds the host to the specified network.
addPolicyStatements
Add policy statements to the function's IAM role.

addEnvironment
addEnvironment(name: str, value: str): void

Add an environment variable to the function.

nameRequired
  • Type: str

valueRequired
  • Type: str

addNetwork
addNetwork(config: NetworkConfig): void

Adds the host to the specified network.

configRequired

addPolicyStatements
addPolicyStatements(...policies: Array<PolicyStatement>): void

Add policy statements to the function's IAM role.

policiesRequired

Static Functions

NameDescription
onLiftType
A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.
toInflight
Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

onLiftType
bring aws;

aws.Service.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

toInflight
bring aws;

aws.Service.toInflight(obj: IResource);

Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

NOTE: This statement must be executed within an async context.

objRequired

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
env
MutMap<str>Returns the set of environment variables for this function.
clusterName
strAWS ECS cluster name.
serviceName
strAWS ECS service name.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


envRequired
env: MutMap<str>;
  • Type: MutMap<str>

Returns the set of environment variables for this function.


clusterNameRequired
clusterName: str;
  • Type: str

AWS ECS cluster name.


serviceNameRequired
serviceName: str;
  • Type: str

AWS ECS service name.


Topic

Base class for AWS Topics.

Initializers

bring aws;

new aws.Topic(props?: TopicProps);
NameTypeDescription
props
TopicProps
No description.

propsOptional

Methods

NameDescription
onMessage
Run an inflight whenever an message is published to the topic.
subscribeQueue
Subscribing queue to the topic.

onMessage
onMessage(inflight: ITopicOnMessageHandler, props?: TopicOnMessageOptions): Function

Run an inflight whenever an message is published to the topic.

inflightRequired

propsOptional

subscribeQueue
subscribeQueue(queue: Queue, props?: TopicSubscribeQueueOptions): void

Subscribing queue to the topic.

queueRequired

propsOptional

Static Functions

NameDescription
onLiftType
A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.
toInflight
Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.
from
If the topic is an AWS SNS, return a helper interface for working with it.

onLiftType
bring aws;

aws.Topic.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

toInflight
bring aws;

aws.Topic.toInflight(obj: IResource);

Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

NOTE: This statement must be executed within an async context.

objRequired

from
bring aws;

aws.Topic.from(topic: Topic);

If the topic is an AWS SNS, return a helper interface for working with it.

topicRequired

The cloud.Topic.


Properties

NameTypeDescription
node
constructs.NodeThe tree node.
topicArn
strAWS Topic arn.
topicName
strAWS Topic name.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


topicArnRequired
topicArn: str;
  • Type: str

AWS Topic arn.


topicNameRequired
topicName: str;
  • Type: str

AWS Topic name.


Website

Base class for AWS Websites.

Initializers

bring aws;

new aws.Website(props: WebsiteProps);
NameTypeDescription
props
WebsiteProps
No description.

propsRequired

Methods

NameDescription
addFile
Add a file to the website during deployment.
addJson
Add a JSON file with custom values during the website's deployment.

addFile
addFile(path: str, data: str, options?: AddFileOptions): str

Add a file to the website during deployment.

If the path conflicts with file path from the website's static assets, an error will be thrown.

pathRequired
  • Type: str

the file path it will be uploaded as.


dataRequired
  • Type: str

the data to write to the file.


optionsOptional

configure the file's options.


addJson
addJson(path: str, data: Json): str

Add a JSON file with custom values during the website's deployment.

If the path conflicts with file path from the website's static assets, an error will be thrown.

pathRequired
  • Type: str

the file path it will be uploaded as.


dataRequired

the data to write to the file.


Static Functions

NameDescription
onLiftType
A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.
toInflight
Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.
from
If the bucket is an AWS Bucket, return a helper interface for working with it.

onLiftType
bring aws;

aws.Website.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

toInflight
bring aws;

aws.Website.toInflight(obj: IResource);

Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

NOTE: This statement must be executed within an async context.

objRequired

from
bring aws;

aws.Website.from(website: Website);

If the bucket is an AWS Bucket, return a helper interface for working with it.

websiteRequired

The cloud.Bucket.


Properties

NameTypeDescription
node
constructs.NodeThe tree node.
path
strAbsolute local path to the website's static files.
url
strThe website's url.
bucketArn
strAWS Bucket arn.
bucketName
strAWS Bucket name.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


pathRequired
path: str;
  • Type: str

Absolute local path to the website's static files.


urlRequired
url: str;
  • Type: str

The website's url.


bucketArnRequired
bucketArn: str;
  • Type: str

AWS Bucket arn.


bucketNameRequired
bucketName: str;
  • Type: str

AWS Bucket name.


Classes

ApiEndpointHandler

A helper class for working with AWS api endpoint handlers.

Initializers

bring aws;

new aws.ApiEndpointHandler();
NameTypeDescription

Static Functions

NameDescription
toFunctionHandler
Returns a cloud.Function handler for handling requests from a cloud.Api.

toFunctionHandler
bring aws;

aws.ApiEndpointHandler.toFunctionHandler(handler: IApiEndpointHandler, headers?: MutMap<str>);

Returns a cloud.Function handler for handling requests from a cloud.Api.

handlerRequired

The onRequest handler.


headersOptional
  • Type: MutMap<str>

HTTP response headers to add to all responses (used by CORS).


AwsInflightHost

Represents an inflight host on AWS.

Static Functions

NameDescription
isAwsInflightHost
Returns true if obj implements IAwsInflightHost.

isAwsInflightHost
bring aws;

aws.AwsInflightHost.isAwsInflightHost(obj: any);

Returns true if obj implements IAwsInflightHost.

objRequired
  • Type: any

BucketEventHandler

Utility class to work with bucket event handlers.

Initializers

bring aws;

new aws.BucketEventHandler();
NameTypeDescription

Static Functions

NameDescription
toTopicOnMessageHandler
Converts a cloud.IBucketEventHandler to a cloud.ITopicOnMessageHandler.

toTopicOnMessageHandler
bring aws;

aws.BucketEventHandler.toTopicOnMessageHandler(handler: IBucketEventHandler, eventType: BucketEventType);

Converts a cloud.IBucketEventHandler to a cloud.ITopicOnMessageHandler.

handlerRequired

the handler to convert.


eventTypeRequired

the event type.


QueueSetConsumerHandler

Utility class for working with the queue consumer handler.

Initializers

bring aws;

new aws.QueueSetConsumerHandler();
NameTypeDescription

Static Functions

NameDescription
toFunctionHandler
Converts a queue consumer handler to a function handler.

toFunctionHandler
bring aws;

aws.QueueSetConsumerHandler.toFunctionHandler(handler: IQueueSetConsumerHandler);

Converts a queue consumer handler to a function handler.

handlerRequired

The queue consumer handler.


TopicOnMessageHandler

A helper class for working with AWS topic on message handlers.

Initializers

bring aws;

new aws.TopicOnMessageHandler();
NameTypeDescription

Static Functions

NameDescription
toFunctionHandler
Returns a cloud.Function handler for handling messages from a cloud.Topic.

toFunctionHandler
bring aws;

aws.TopicOnMessageHandler.toFunctionHandler(handler: ITopicOnMessageHandler);

Returns a cloud.Function handler for handling messages from a cloud.Topic.

handlerRequired

The onMessage handler.


Structs

AwsWebsiteProps

Options for AWS Website.

Initializer

bring aws;

let AwsWebsiteProps = aws.AwsWebsiteProps{ ... };

Properties

NameTypeDescription
path
strLocal path to the website's static files, relative to the Wing source file or absolute.
errorDocument
strName of the error document for the website.
domain
Domain
The website's custom domain object.

pathRequired
path: str;
  • Type: str

Local path to the website's static files, relative to the Wing source file or absolute.


Example

"./dist"
errorDocumentOptional
errorDocument: str;
  • Type: str
  • Default: undefined

Name of the error document for the website.


Example

"404.html"
domainOptional
domain: Domain;
  • Type: Domain
  • Default: undefined

The website's custom domain object.


NetworkConfig

Function network configuration used to hold data on subnets and security groups that should be used when a function is deployed within a VPC.

Initializer

bring aws;

let NetworkConfig = aws.NetworkConfig{ ... };

Properties

NameTypeDescription
securityGroupIds
MutArray<str>List of security groups to place function in.
subnetIds
MutArray<str>List of subnets to attach on function.

securityGroupIdsRequired
securityGroupIds: MutArray<str>;
  • Type: MutArray<str>

List of security groups to place function in.


subnetIdsRequired
subnetIds: MutArray<str>;
  • Type: MutArray<str>

List of subnets to attach on function.


PolicyStatement

AWS IAM Policy Statement.

Initializer

bring aws;

let PolicyStatement = aws.PolicyStatement{ ... };

Properties

NameTypeDescription
actions
MutArray<str>Actions.
effect
Effect
Effect ("Allow" or "Deny").
resources
MutArray<str>Resources.

actionsOptional
actions: MutArray<str>;
  • Type: MutArray<str>

Actions.


effectOptional
effect: Effect;

Effect ("Allow" or "Deny").


resourcesOptional
resources: MutArray<str>;
  • Type: MutArray<str>

Resources.


Protocols

IAwsApi

A shared interface for AWS api.

Properties

NameTypeDescription
deploymentId
strRestApi deployment id.
invokeUrl
strInvoke URL.
restApiArn
strRestApi arn.
restApiId
strRestApi id.
restApiName
strRestApi id.
stageName
strRestApi stage name.

deploymentIdRequired
deploymentId: str;
  • Type: str

RestApi deployment id.


invokeUrlRequired
invokeUrl: str;
  • Type: str

Invoke URL.


restApiArnRequired
restApiArn: str;
  • Type: str

RestApi arn.


restApiIdRequired
restApiId: str;
  • Type: str

RestApi id.


restApiNameRequired
restApiName: str;
  • Type: str

RestApi id.


stageNameRequired
stageName: str;
  • Type: str

RestApi stage name.


IAwsBucket

A shared interface for AWS buckets.

Properties

NameTypeDescription
bucketArn
strAWS Bucket arn.
bucketDomainName
strBucket domain name.
bucketName
strAWS Bucket name.

bucketArnRequired
bucketArn: str;
  • Type: str

AWS Bucket arn.


bucketDomainNameRequired
bucketDomainName: str;
  • Type: str

Bucket domain name.


bucketNameRequired
bucketName: str;
  • Type: str

AWS Bucket name.


IAwsCounter

A shared interface for AWS Counter.

Properties

NameTypeDescription
dynamoTableArn
strAWS Dynamodb arn.
dynamoTableName
strAWS Dynamodb name.

dynamoTableArnRequired
dynamoTableArn: str;
  • Type: str

AWS Dynamodb arn.


dynamoTableNameRequired
dynamoTableName: str;
  • Type: str

AWS Dynamodb name.


IAwsFunction

A shared interface for AWS functions.

Methods

NameDescription
addLambdaLayer
Add a Lambda layer to the function.

addLambdaLayer
addLambdaLayer(layerArn: str): void

Add a Lambda layer to the function.

layerArnRequired
  • Type: str

The ARN of the layer.


Properties

NameTypeDescription
node
constructs.NodeThe tree node.
functionArn
strAWS Function arn.
functionName
strAWS Function name.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


functionArnRequired
functionArn: str;
  • Type: str

AWS Function arn.


functionNameRequired
functionName: str;
  • Type: str

AWS Function name.


IAwsInflightHost

Represents an IInflightHost on AWS.

Methods

NameDescription
addNetwork
Adds the host to the specified network.
addPolicyStatements
Add policy statements to the function's IAM role.

addNetwork
addNetwork(config: NetworkConfig): void

Adds the host to the specified network.

configRequired

The network configuration.


addPolicyStatements
addPolicyStatements(...policies: Array<PolicyStatement>): void

Add policy statements to the function's IAM role.

policiesRequired

Properties

NameTypeDescription
node
constructs.NodeThe tree node.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


IAwsQueue

A shared interface for AWS queues.

Properties

NameTypeDescription
queueArn
strAWS Queue arn.
queueName
strAWS Queue name.
queueUrl
strAWS Queue url.

queueArnRequired
queueArn: str;
  • Type: str

AWS Queue arn.


queueNameRequired
queueName: str;
  • Type: str

AWS Queue name.


queueUrlRequired
queueUrl: str;
  • Type: str

AWS Queue url.


IAwsSecret

Shared interface for AWS Secrets.

Properties

NameTypeDescription
secretArn
strAWS Secret ARN.

secretArnRequired
secretArn: str;
  • Type: str

AWS Secret ARN.


IAwsService

Shared interface for AWS Services.

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
clusterName
strAWS ECS cluster name.
serviceName
strAWS ECS service name.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


clusterNameRequired
clusterName: str;
  • Type: str

AWS ECS cluster name.


serviceNameRequired
serviceName: str;
  • Type: str

AWS ECS service name.


IAwsTopic

A shared interface for AWS topics.

Properties

NameTypeDescription
topicArn
strAWS Topic arn.
topicName
strAWS Topic name.

topicArnRequired
topicArn: str;
  • Type: str

AWS Topic arn.


topicNameRequired
topicName: str;
  • Type: str

AWS Topic name.


IAwsWebsite

A shared interface for AWS website.

Properties

NameTypeDescription
bucketArn
strAWS Bucket arn.
bucketName
strAWS Bucket name.

bucketArnRequired
bucketArn: str;
  • Type: str

AWS Bucket arn.


bucketNameRequired
bucketName: str;
  • Type: str

AWS Bucket name.


ILambdaContext

The AWS Lambda context object.

Methods

NameDescription
remainingTimeInMillis
Returns the number of milliseconds left before the execution times out.

remainingTimeInMillis
remainingTimeInMillis(): num

Returns the number of milliseconds left before the execution times out.

Properties

NameTypeDescription
awsRequestId
strThe identifier of the invocation request.
functionName
strThe name of the Lambda function.
functionVersion
strThe version of the function.
invokedFunctionArn
strThe Amazon Resource Name (ARN) that's used to invoke the function.
logGroupName
strThe log group for the function.
logStreamName
strThe log stream for the function instance.
memoryLimitInMB
strThe amount of memory that's allocated for the function.

awsRequestIdRequired
awsRequestId: str;
  • Type: str

The identifier of the invocation request.


functionNameRequired
functionName: str;
  • Type: str

The name of the Lambda function.


functionVersionRequired
functionVersion: str;
  • Type: str

The version of the function.


invokedFunctionArnRequired
invokedFunctionArn: str;
  • Type: str

The Amazon Resource Name (ARN) that's used to invoke the function.

Indicates if the invoker specified a version number or alias.


logGroupNameRequired
logGroupName: str;
  • Type: str

The log group for the function.


logStreamNameRequired
logStreamName: str;
  • Type: str

The log stream for the function instance.


memoryLimitInMBRequired
memoryLimitInMB: str;
  • Type: str

The amount of memory that's allocated for the function.


Enums

Effect

The Effect element of an AWS IAM policy statement.

Members

NameDescription
ALLOW
Allow.
DENY
Deny.

ALLOW

Allow.


DENY

Deny.