Skip to main content

API Reference

Resources

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.
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.


bucketNameRequired
bucketName: str;
  • Type: str

The Name of this bucket.


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.


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.


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.


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.


Classes

Api

A helper class for working with AWS apis.

Initializers

bring aws;

new aws.Api();
NameTypeDescription

Static Functions

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

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.


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

Bucket

A helper class for working with AWS buckets.

Initializers

bring aws;

new aws.Bucket();
NameTypeDescription

Static Functions

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

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.


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.


Counter

A helper class for working with AWS Counters.

Initializers

bring aws;

new aws.Counter();
NameTypeDescription

Static Functions

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

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.


Function

A helper class for working with AWS functions.

Initializers

bring aws;

new aws.Function();
NameTypeDescription

Static Functions

NameDescription
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.

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.


Queue

A helper class for working with AWS queues.

Initializers

bring aws;

new aws.Queue();
NameTypeDescription

Static Functions

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

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.


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.


Topic

A helper class for working with AWS topics.

Initializers

bring aws;

new aws.Topic();
NameTypeDescription

Static Functions

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

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.


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.


Website

A helper class for working with AWS buckets.

Initializers

bring aws;

new aws.Website();
NameTypeDescription

Static Functions

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

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.


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.
bucketName
strAWS Bucket name.

bucketArnRequired
bucketArn: str;
  • Type: str

AWS Bucket arn.


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.


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.