Skip to main content

API Reference

Resources

Api

Functionality shared between all Api implementations.

Initializers

bring cloud;

new cloud.Api(props?: ApiProps)
NameTypeDescription
propsApiPropsNo description.

propsOptional

Methods

NameDescription
connectAdd a inflight handler to the api for CONNECT requests on the given path.
deleteAdd a inflight handler to the api for DELETE requests on the given path.
getAdd a inflight handler to the api for GET requests on the given path.
headAdd a inflight handler to the api for HEAD requests on the given path.
optionsAdd a inflight handler to the api for OPTIONS requests on the given path.
patchAdd a inflight handler to the api for PATCH requests on the given path.
postAdd a inflight handler to the api for POST requests on the given path.
putAdd a inflight handler to the api for PUT requests on the given path.

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

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

pathRequired
  • Type: str

The path to handle CONNECT requests for.


inflightRequired

The function to handle the request.


propsOptional

Options for the route.


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

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

pathRequired
  • Type: str

The path to handle DELETE requests for.


inflightRequired

The function to handle the request.


propsOptional

Options for the route.


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

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

pathRequired
  • Type: str

The path to handle GET requests for.


inflightRequired

The function to handle the request.


propsOptional

Options for the route.


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

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

pathRequired
  • Type: str

The path to handle HEAD requests for.


inflightRequired

The function to handle the request.


propsOptional

Options for the route.


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

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

pathRequired
  • Type: str

The path to handle OPTIONS requests for.


inflightRequired

The function to handle the request.


propsOptional

Options for the route.


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

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

pathRequired
  • Type: str

The path to handle PATCH requests for.


inflightRequired

The function to handle the request.


propsOptional

Options for the route.


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

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

pathRequired
  • Type: str

The path to handle POST requests for.


inflightRequired

The function to handle the request.


propsOptional

Options for the route.


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

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

pathRequired
  • Type: str

The path to handle PUT requests for.


inflightRequired

The function to handle the request.


propsOptional

Options for the route.


Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.
urlstrThe base URL of the API endpoint.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


urlRequired
url: str;
  • Type: str

The base URL of the API endpoint.


Bucket

Inflight client: @winglang/sdk.cloud.IBucketClient

Represents a cloud object store.

Initializers

bring cloud;

new cloud.Bucket(props?: BucketProps)
NameTypeDescription
propsBucketPropsNo description.

propsOptional

Methods

NameDescription
addObjectAdd a file to the bucket that is uploaded when the app is deployed.
onCreateRun an inflight whenever a file is uploaded to the bucket.
onDeleteRun an inflight whenever a file is deleted from the bucket.
onEventRun an inflight whenever a file is uploaded, modified, or deleted from the bucket.
onUpdateRun an inflight whenever a file is updated in the bucket.

addObject
addObject(key: str, body: 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.

keyRequired
  • Type: str

bodyRequired
  • Type: str

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

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

fnRequired

optsOptional

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

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

fnRequired

optsOptional

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

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

fnRequired

optsOptional

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

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

fnRequired

optsOptional

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


Counter

Inflight client: @winglang/sdk.cloud.ICounterClient

Represents a distributed atomic counter.

Initializers

bring cloud;

new cloud.Counter(props?: CounterProps)
NameTypeDescription
propsCounterPropsNo description.

propsOptional

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.
initialnumThe initial value of the counter.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


initialRequired
initial: num;
  • Type: num

The initial value of the counter.


Function

Inflight client: @winglang/sdk.cloud.IFunctionClient

Represents a function.

Initializers

bring cloud;

new cloud.Function(inflight: IFunctionHandler, props?: FunctionProps)
NameTypeDescription
inflightIFunctionHandlerNo description.
propsFunctionPropsNo description.

inflightRequired

propsOptional

Methods

NameDescription
addEnvironmentAdd an environment variable to the function.

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

Add an environment variable to the function.

nameRequired
  • Type: str

valueRequired
  • Type: str

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.
envMutMap<str>Returns the set of environment variables for this function.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


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

Returns the set of environment variables for this function.


Queue

Inflight client: @winglang/sdk.cloud.IQueueClient

Represents a queue.

Initializers

bring cloud;

new cloud.Queue(props?: QueueProps)
NameTypeDescription
propsQueuePropsNo description.

propsOptional

Methods

NameDescription
addConsumerCreate a function to consume messages from this queue.

addConsumer
addConsumer(handler: IQueueAddConsumerHandler, props?: QueueAddConsumerProps): Function

Create a function to consume messages from this queue.

handlerRequired

propsOptional

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


Resource

Shared behavior between all Wing SDK resources.

Initializers

bring std;

new std.Resource()
NameTypeDescription

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


Schedule

Inflight client: @winglang/sdk.cloud.IScheduleClient

Represents a schedule.

Initializers

bring cloud;

new cloud.Schedule(props?: ScheduleProps)
NameTypeDescription
propsSchedulePropsNo description.

propsOptional

Methods

NameDescription
onTickCreate a function that runs when receiving the scheduled event.

onTick
onTick(inflight: IScheduleOnTickHandler, props?: ScheduleOnTickProps): Function

Create a function that runs when receiving the scheduled event.

inflightRequired

propsOptional

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


Secret

Inflight client: @winglang/sdk.cloud.ISecretClient

Represents a cloud secret.

Initializers

bring cloud;

new cloud.Secret(props?: SecretProps)
NameTypeDescription
propsSecretPropsNo description.

propsOptional

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


Service

Inflight client: @winglang/sdk.cloud.IServiceClient

Represents a service.

Initializers

bring cloud;

new cloud.Service(props: ServiceProps)
NameTypeDescription
propsServicePropsNo description.

propsRequired

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


Table

Inflight client: @winglang/sdk.cloud.ITableClient

Represents a NoSQL database table that can be used to store and query data.

Initializers

bring cloud;

new cloud.Table(props: TableProps)
NameTypeDescription
propsTablePropsNo description.

propsRequired

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.
columnsMutMap<ColumnType>Table columns.
namestrTable name.
primaryKeystrTable primary key name.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


columnsRequired
columns: MutMap<ColumnType>;

Table columns.


nameRequired
name: str;
  • Type: str

Table name.


primaryKeyRequired
primaryKey: str;
  • Type: str

Table primary key name.


Test

Inflight client: @winglang/sdk.cloud.ITestClient

Represents a unit test.

Initializers

bring std;

new std.Test(inflight: ITestHandler, props?: TestProps)
NameTypeDescription
inflightITestHandlerNo description.
propsTestPropsNo description.

inflightRequired

propsOptional

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


TestRunner

Inflight client: @winglang/sdk.cloud.ITestRunnerClient

Represents a test engine.

Initializers

bring cloud;

new cloud.TestRunner(props?: TestRunnerProps)
NameTypeDescription
propsTestRunnerPropsNo description.

propsOptional

Methods

NameDescription
findTestsFind all tests in the construct tree.

findTests
findTests(): MutArray<Test>

Find all tests in the construct tree.

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


Topic

Inflight client: @winglang/sdk.cloud.ITopicClient

Represents a topic.

Initializers

bring cloud;

new cloud.Topic(props?: TopicProps)
NameTypeDescription
propsTopicPropsNo description.

propsOptional

Methods

NameDescription
onMessageRun an inflight whenever an message is published to the topic.

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

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

inflightRequired

propsOptional

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


Website

Inflight client: @winglang/sdk.cloud.IWebsiteClient

Represents a cloud static website.

Initializers

bring cloud;

new cloud.Website(props: WebsiteProps)
NameTypeDescription
propsWebsitePropsNo description.

propsRequired

Methods

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

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.


Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.
pathstrAbsolute local path to the website's static files.
urlstrThe website's url.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


pathRequired
path: str;
  • Type: str

Absolute local path to the website's static files.


urlRequired
url: str;
  • Type: str

The website's url.


Structs

AddConnectionProps

Props for Resource.addConnection.

Initializer

bring std;

let AddConnectionProps = std.AddConnectionProps{ ... }

Properties

NameTypeDescription
fromIResourceThe resource creating the connection to to.
relationshipstrThe type of relationship between the resources.
toIResourceThe resource from is connecting to.
implicitboolWhether the relationship is implicit, i.e. it is not explicitly defined by the user.

fromRequired
from: IResource;

The resource creating the connection to to.


relationshipRequired
relationship: str;
  • Type: str

The type of relationship between the resources.


toRequired
to: IResource;

The resource from is connecting to.


implicitOptional
implicit: bool;
  • Type: bool
  • Default: false

Whether the relationship is implicit, i.e. it is not explicitly defined by the user.


ApiConnectProps

Options for Api patch endpoint.

Initializer

bring cloud;

let ApiConnectProps = cloud.ApiConnectProps{ ... }

ApiDeleteProps

Options for Api put endpoint.

Initializer

bring cloud;

let ApiDeleteProps = cloud.ApiDeleteProps{ ... }

ApiGetProps

Options for Api get endpoint.

Initializer

bring cloud;

let ApiGetProps = cloud.ApiGetProps{ ... }

ApiHeadProps

Options for Api patch endpoint.

Initializer

bring cloud;

let ApiHeadProps = cloud.ApiHeadProps{ ... }

ApiOptionsProps

Options for Api patch endpoint.

Initializer

bring cloud;

let ApiOptionsProps = cloud.ApiOptionsProps{ ... }

ApiPatchProps

Options for Api patch endpoint.

Initializer

bring cloud;

let ApiPatchProps = cloud.ApiPatchProps{ ... }

ApiPostProps

Options for Api post endpoint.

Initializer

bring cloud;

let ApiPostProps = cloud.ApiPostProps{ ... }

ApiProps

Properties for Api.

Initializer

bring cloud;

let ApiProps = cloud.ApiProps{ ... }

ApiPutProps

Options for Api put endpoint.

Initializer

bring cloud;

let ApiPutProps = cloud.ApiPutProps{ ... }

ApiRequest

Shape of a request to an inflight handler.

Initializer

bring cloud;

let ApiRequest = cloud.ApiRequest{ ... }

Properties

NameTypeDescription
methodHttpMethodThe request's HTTP method.
pathstrThe request's path.
queryMutMap<str>The request's query string values.
varsMutMap<str>The path variables.
bodyjsonThe request's body.
headersMutMap<str>The request's headers.

methodRequired
method: HttpMethod;

The request's HTTP method.


pathRequired
path: str;
  • Type: str

The request's path.


queryRequired
query: MutMap<str>;
  • Type: MutMap<str>

The request's query string values.


varsRequired
vars: MutMap<str>;
  • Type: MutMap<str>

The path variables.


bodyOptional
body: json;
  • Type: json

The request's body.


headersOptional
headers: MutMap<str>;
  • Type: MutMap<str>

The request's headers.


ApiResponse

Shape of a response from a inflight handler.

Initializer

bring cloud;

let ApiResponse = cloud.ApiResponse{ ... }

Properties

NameTypeDescription
statusnumThe response's status code.
bodyjsonThe response's body.
headersMutMap<str>The response's headers.

statusRequired
status: num;
  • Type: num

The response's status code.


bodyOptional
body: json;
  • Type: json

The response's body.


headersOptional
headers: MutMap<str>;
  • Type: MutMap<str>

The response's headers.


BucketDeleteOptions

Interface for delete method inside Bucket.

Initializer

bring cloud;

let BucketDeleteOptions = cloud.BucketDeleteOptions{ ... }

Properties

NameTypeDescription
mustExistboolCheck failures on the method and retrieve errors if any.

mustExistOptional
mustExist: bool;
  • Type: bool
  • Default: false

Check failures on the method and retrieve errors if any.


BucketEvent

on_event notification payload- will be in use after solving issue: https://github.com/winglang/wing/issues/1927.

Initializer

bring cloud;

let BucketEvent = cloud.BucketEvent{ ... }

Properties

NameTypeDescription
keystrthe bucket key that triggered the event.
typeBucketEventTypetype of event.

keyRequired
key: str;
  • Type: str

the bucket key that triggered the event.


typeRequired
type: BucketEventType;

type of event.


BucketOnCreateProps

on create event options.

Initializer

bring cloud;

let BucketOnCreateProps = cloud.BucketOnCreateProps{ ... }

BucketOnDeleteProps

on delete event options.

Initializer

bring cloud;

let BucketOnDeleteProps = cloud.BucketOnDeleteProps{ ... }

BucketOnEventProps

on any event options.

Initializer

bring cloud;

let BucketOnEventProps = cloud.BucketOnEventProps{ ... }

BucketOnUpdateProps

on update event options.

Initializer

bring cloud;

let BucketOnUpdateProps = cloud.BucketOnUpdateProps{ ... }

BucketProps

Properties for Bucket.

Initializer

bring cloud;

let BucketProps = cloud.BucketProps{ ... }

Properties

NameTypeDescription
publicboolWhether the bucket's objects should be publicly accessible.

publicOptional
public: bool;
  • Type: bool
  • Default: false

Whether the bucket's objects should be publicly accessible.


Connection

A connection between two resources.

Initializer

bring std;

let Connection = std.Connection{ ... }

Properties

NameTypeDescription
directionDirectionThe direction of the connection.
implicitboolWhether the relationship is implicit, i.e. it is not explicitly defined by the user.
relationshipstrThe type of relationship with the resource.
resourceIResourceThe resource this connection is to.

directionRequired
direction: Direction;

The direction of the connection.


implicitRequired
implicit: bool;
  • Type: bool

Whether the relationship is implicit, i.e. it is not explicitly defined by the user.


relationshipRequired
relationship: str;
  • Type: str

The type of relationship with the resource.


resourceRequired
resource: IResource;

The resource this connection is to.


CounterProps

Properties for Counter.

Initializer

bring cloud;

let CounterProps = cloud.CounterProps{ ... }

Properties

NameTypeDescription
initialnumThe initial value of the counter.

initialOptional
initial: num;
  • Type: num
  • Default: 0

The initial value of the counter.


DisplayProps

Properties for the Display class.

Initializer

bring std;

let DisplayProps = std.DisplayProps{ ... }

Properties

NameTypeDescription
descriptionstrDescription of the resource.
hiddenboolWhether the resource should be hidden from the UI.
titlestrTitle of the resource.

descriptionOptional
description: str;
  • Type: str
  • Default: No description.

Description of the resource.


hiddenOptional
hidden: bool;
  • Type: bool
  • Default: Undefined

Whether the resource should be hidden from the UI.


titleOptional
title: str;
  • Type: str
  • Default: No title.

Title of the resource.


FunctionProps

Properties for Function.

This is the type users see when constructing a cloud.Function instance.

Initializer

bring cloud;

let FunctionProps = cloud.FunctionProps{ ... }

Properties

NameTypeDescription
envMutMap<str>Environment variables to pass to the function.
memorynumThe amount of memory to allocate to the function, in MB.
timeoutDurationThe maximum amount of time the function can run.

envOptional
env: MutMap<str>;
  • Type: MutMap<str>
  • Default: No environment variables.

Environment variables to pass to the function.


memoryOptional
memory: num;
  • Type: num
  • Default: 128

The amount of memory to allocate to the function, in MB.


timeoutOptional
timeout: Duration;

The maximum amount of time the function can run.


GetSecretValueOptions

Options when getting a secret value.

Initializer

bring cloud;

let GetSecretValueOptions = cloud.GetSecretValueOptions{ ... }

Properties

NameTypeDescription
cacheboolWhether to cache the value.

cacheOptional
cache: bool;
  • Type: bool
  • Default: true

Whether to cache the value.


QueueAddConsumerProps

Options for Queue.addConsumer.

Initializer

bring cloud;

let QueueAddConsumerProps = cloud.QueueAddConsumerProps{ ... }

Properties

NameTypeDescription
envMutMap<str>Environment variables to pass to the function.
memorynumThe amount of memory to allocate to the function, in MB.
timeoutDurationThe maximum amount of time the function can run.
batchSizenumThe maximum number of messages to send to subscribers at once.

envOptional
env: MutMap<str>;
  • Type: MutMap<str>
  • Default: No environment variables.

Environment variables to pass to the function.


memoryOptional
memory: num;
  • Type: num
  • Default: 128

The amount of memory to allocate to the function, in MB.


timeoutOptional
timeout: Duration;

The maximum amount of time the function can run.


batchSizeOptional
batchSize: num;
  • Type: num
  • Default: 1

The maximum number of messages to send to subscribers at once.


QueueProps

Properties for Queue.

Initializer

bring cloud;

let QueueProps = cloud.QueueProps{ ... }

Properties

NameTypeDescription
initialMessagesMutArray<str>Initialize the queue with a set of messages.
retentionPeriodDurationHow long a queue retains a message.
timeoutDurationHow long a queue's consumers have to process a message.

initialMessagesOptional
initialMessages: MutArray<str>;
  • Type: MutArray<str>
  • Default: []

Initialize the queue with a set of messages.


retentionPeriodOptional
retentionPeriod: Duration;

How long a queue retains a message.


timeoutOptional
timeout: Duration;

How long a queue's consumers have to process a message.


ScheduleOnTickProps

Options for Schedule.onTick.

Initializer

bring cloud;

let ScheduleOnTickProps = cloud.ScheduleOnTickProps{ ... }

Properties

NameTypeDescription
envMutMap<str>Environment variables to pass to the function.
memorynumThe amount of memory to allocate to the function, in MB.
timeoutDurationThe maximum amount of time the function can run.

envOptional
env: MutMap<str>;
  • Type: MutMap<str>
  • Default: No environment variables.

Environment variables to pass to the function.


memoryOptional
memory: num;
  • Type: num
  • Default: 128

The amount of memory to allocate to the function, in MB.


timeoutOptional
timeout: Duration;

The maximum amount of time the function can run.


ScheduleProps

Properties for Schedule.

Initializer

bring cloud;

let ScheduleProps = cloud.ScheduleProps{ ... }

Properties

NameTypeDescription
cronstrTrigger events according to a cron schedule using the UNIX cron format.
rateDurationTrigger events at a periodic rate.

cronOptional
cron: str;
  • Type: str
  • Default: undefined

Trigger events according to a cron schedule using the UNIX cron format.

[minute][hour] [day of month][month] [day of week]


Example

"0/1 * ? * *"
rateOptional
rate: Duration;

Trigger events at a periodic rate.


Example

1m

SecretProps

Properties for Secret.

Initializer

bring cloud;

let SecretProps = cloud.SecretProps{ ... }

Properties

NameTypeDescription
namestrThe secret's name.

nameOptional
name: str;
  • Type: str
  • Default: a new secret is provisioned with a generated name

The secret's name.

If no name is provided then a new secret is provisioned in the target. If a name is provided then the resource will reference an existing secret in the target.


ServiceOnStartProps

Options for Service.onStart.

Initializer

bring cloud;

let ServiceOnStartProps = cloud.ServiceOnStartProps{ ... }

Properties

NameTypeDescription
envMutMap<str>Environment variables to pass to the function.
memorynumThe amount of memory to allocate to the function, in MB.
timeoutDurationThe maximum amount of time the function can run.

envOptional
env: MutMap<str>;
  • Type: MutMap<str>
  • Default: No environment variables.

Environment variables to pass to the function.


memoryOptional
memory: num;
  • Type: num
  • Default: 128

The amount of memory to allocate to the function, in MB.


timeoutOptional
timeout: Duration;

The maximum amount of time the function can run.


ServiceProps

Properties for Service.

Initializer

bring cloud;

let ServiceProps = cloud.ServiceProps{ ... }

Properties

NameTypeDescription
onStartIServiceOnEventHandlerHandler to run with the service starts.
autoStartboolWhether the service should start automatically.
onStopIServiceOnEventHandlerHandler to run with the service stops.

onStartRequired
onStart: IServiceOnEventHandler;

Handler to run with the service starts.


autoStartOptional
autoStart: bool;
  • Type: bool
  • Default: true

Whether the service should start automatically.


onStopOptional
onStop: IServiceOnEventHandler;

Handler to run with the service stops.


TableProps

Properties for Table.

Initializer

bring cloud;

let TableProps = cloud.TableProps{ ... }

Properties

NameTypeDescription
columnsMutMap<ColumnType>The table's columns.
namestrThe table's name.
primaryKeystrThe table's primary key.

columnsOptional
columns: MutMap<ColumnType>;

The table's columns.


nameOptional
name: str;
  • Type: str
  • Default: undefined

The table's name.


primaryKeyOptional
primaryKey: str;
  • Type: str
  • Default: undefined

The table's primary key.

No two rows can have the same value for the primary key.


TestProps

Properties for Test.

This is the type users see when constructing a std.Test instance.

Initializer

bring std;

let TestProps = std.TestProps{ ... }

Properties

NameTypeDescription
envMutMap<str>Environment variables to pass to the function.
memorynumThe amount of memory to allocate to the function, in MB.
timeoutDurationThe maximum amount of time the function can run.

envOptional
env: MutMap<str>;
  • Type: MutMap<str>
  • Default: No environment variables.

Environment variables to pass to the function.


memoryOptional
memory: num;
  • Type: num
  • Default: 128

The amount of memory to allocate to the function, in MB.


timeoutOptional
timeout: Duration;

The maximum amount of time the function can run.


TestResult

A result of a single test.

Initializer

bring cloud;

let TestResult = cloud.TestResult{ ... }

Properties

NameTypeDescription
passboolWhether the test passed.
pathstrThe path of the test.
tracesMutArray<Trace>List of traces emitted during the test.
errorstrThe error message if the test failed.

passRequired
pass: bool;
  • Type: bool

Whether the test passed.


pathRequired
path: str;
  • Type: str

The path of the test.


tracesRequired
traces: MutArray<Trace>;

List of traces emitted during the test.


errorOptional
error: str;
  • Type: str

The error message if the test failed.


TestRunnerProps

Properties for TestRunner.

Initializer

bring cloud;

let TestRunnerProps = cloud.TestRunnerProps{ ... }

TopicOnMessageProps

Options for Topic.onMessage.

Initializer

bring cloud;

let TopicOnMessageProps = cloud.TopicOnMessageProps{ ... }

Properties

NameTypeDescription
envMutMap<str>Environment variables to pass to the function.
memorynumThe amount of memory to allocate to the function, in MB.
timeoutDurationThe maximum amount of time the function can run.

envOptional
env: MutMap<str>;
  • Type: MutMap<str>
  • Default: No environment variables.

Environment variables to pass to the function.


memoryOptional
memory: num;
  • Type: num
  • Default: 128

The amount of memory to allocate to the function, in MB.


timeoutOptional
timeout: Duration;

The maximum amount of time the function can run.


TopicProps

Properties for Topic.

Initializer

bring cloud;

let TopicProps = cloud.TopicProps{ ... }

Trace

Represents an trace emitted during simulation.

Initializer

bring cloud;

let Trace = cloud.Trace{ ... }

Properties

NameTypeDescription
dataanyA JSON blob with structured data.
sourcePathstrThe path of the resource that emitted the trace.
sourceTypestrThe type of the source that emitted the trace.
timestampstrThe timestamp of the event, in ISO 8601 format.
typeTraceTypeThe type of a trace.

dataRequired
data: any;
  • Type: any

A JSON blob with structured data.


sourcePathRequired
sourcePath: str;
  • Type: str

The path of the resource that emitted the trace.


sourceTypeRequired
sourceType: str;
  • Type: str

The type of the source that emitted the trace.


timestampRequired
timestamp: str;
  • Type: str

The timestamp of the event, in ISO 8601 format.


Example

2020-01-01T00:00:00.000Z
typeRequired
type: TraceType;

The type of a trace.


WebsiteProps

website props.

Initializer

bring cloud;

let WebsiteProps = cloud.WebsiteProps{ ... }

Properties

NameTypeDescription
pathstrLocal path to the website's static files, relative to the Wing source file or absolute.
domainstrThe website's custom domain name.

pathRequired
path: str;
  • Type: str

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


Example

"./dist"
domainOptional
domain: str;
  • Type: str
  • Default: a domain is generated by the cloud provider

The website's custom domain name.


Example

"example.com"

Classes

Boolean

Boolean.

Initializers

bring std;

new std.Boolean()
NameTypeDescription

Static Functions

NameDescription
fromJsonParse a boolean from Json.

fromJson
bring std;

std.Boolean.fromJson(json: Json)

Parse a boolean from Json.

jsonRequired

to parse boolean from.


Display

Information on how to display a resource in the UI.

Initializers

bring std;

new std.Display(props?: DisplayProps)
NameTypeDescription
propsDisplayPropsNo description.

propsOptional

Properties

NameTypeDescription
descriptionstrDescription of the resource.
hiddenboolWhether the resource should be hidden from the UI.
titlestrTitle of the resource.

descriptionOptional
description: str;
  • Type: str

Description of the resource.


hiddenOptional
hidden: bool;
  • Type: bool

Whether the resource should be hidden from the UI.


titleOptional
title: str;
  • Type: str

Title of the resource.


Duration

Represents a length of time.

Static Functions

NameDescription
fromHoursCreate a Duration representing an amount of hours.
fromMinutesCreate a Duration representing an amount of minutes.
fromSecondsCreate a Duration representing an amount of seconds.

fromHours
bring std;

std.Duration.fromHours(amount: num)

Create a Duration representing an amount of hours.

amountRequired
  • Type: num

the amount of Hours the Duration will represent.


fromMinutes
bring std;

std.Duration.fromMinutes(amount: num)

Create a Duration representing an amount of minutes.

amountRequired
  • Type: num

the amount of Minutes the Duration will represent.


fromSeconds
bring std;

std.Duration.fromSeconds(amount: num)

Create a Duration representing an amount of seconds.

amountRequired
  • Type: num

the amount of Seconds the Duration will represent.


Properties

NameTypeDescription
hoursnumReturn the total number of hours in this Duration.
minutesnumReturn the total number of minutes in this Duration.
secondsnumReturn the total number of seconds in this Duration.

hoursRequired
hours: num;
  • Type: num

Return the total number of hours in this Duration.


minutesRequired
minutes: num;
  • Type: num

Return the total number of minutes in this Duration.


secondsRequired
seconds: num;
  • Type: num

Return the total number of seconds in this Duration.


ImmutableArray

Immutable Array.

Initializers

bring std;

new std.ImmutableArray()
NameTypeDescription

Methods

NameDescription
atGet the value at the given index.
concatMerge arr to the end of this array.
containsChecks if this array includes searchElement.
copyMutCreate a mutable shallow copy of this array.
indexOfReturns the index of the first occurrence of searchElement found.
joinReturns a new string containing the concatenated values in this array, separated by commas or a specified separator string.
lastIndexOfReturns the index of the last occurrence of searchElement found.

at
at(index: num): T1

Get the value at the given index.

indexRequired
  • Type: num

index of the value to get.


concat
concat(arr: ImmutableArray): ImmutableArray

Merge arr to the end of this array.

arrRequired

array to merge.


contains
contains(searchElement: T1): bool

Checks if this array includes searchElement.

searchElementRequired

to search for.


copyMut
copyMut(): MutableArray

Create a mutable shallow copy of this array.

indexOf
indexOf(searchElement: T1): num

Returns the index of the first occurrence of searchElement found.

searchElementRequired

to search for.


join
join(separator?: str): str

Returns a new string containing the concatenated values in this array, separated by commas or a specified separator string.

If the array has only one item, then that item will be returned without using the separator.

separatorOptional
  • Type: str

lastIndexOf
lastIndexOf(searchElement: T1): num

Returns the index of the last occurrence of searchElement found.

searchElementRequired

to search for.


Properties

NameTypeDescription
lengthnumThe length of the array.

lengthRequired
length: num;
  • Type: num

The length of the array.


ImmutableMap

Immutable Map.

Initializers

bring std;

new std.ImmutableMap()
NameTypeDescription

Methods

NameDescription
copyMutCreate a mutable shallow copy of this map.
getReturns a specified element from the map.
hasReturns a boolean indicating whether an element with the specified key exists or not.
keysReturns the keys of this map.
sizeReturns the number of elements in the map.
valuesReturns the values of this map.

copyMut
copyMut(): MutableMap

Create a mutable shallow copy of this map.

get
get(key: str): T1

Returns a specified element from the map.

If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the map.

keyRequired
  • Type: str

The key of the element to return.


has
has(key: str): bool

Returns a boolean indicating whether an element with the specified key exists or not.

keyRequired
  • Type: str

The key of the element to test for presence.


keys
keys(): ImmutableArray

Returns the keys of this map.

size
size(): num

Returns the number of elements in the map.

TODO: For now this has to be a method rather than a getter as macros only work on methods https://github.com/winglang/wing/issues/1658

values
values(): ImmutableArray

Returns the values of this map.

ImmutableSet

Immutable Set.

Initializers

bring std;

new std.ImmutableSet()
NameTypeDescription

Methods

NameDescription
copyMutCreate a mutable shallow copy of this set.
hasReturns a boolean indicating whether an element with the specified value exists in the set.

copyMut
copyMut(): MutableSet

Create a mutable shallow copy of this set.

has
has(value: T1): bool

Returns a boolean indicating whether an element with the specified value exists in the set.

valueRequired

The value to test for presence in the Set object.


Properties

NameTypeDescription
sizenumThe length of the set.

sizeRequired
size: num;
  • Type: num

The length of the set.


Json

Immutable Json.

Initializers

bring std;

new std.Json()
NameTypeDescription

Methods

NameDescription
getReturns a specified element from the Json.
getAtReturns a specified element at a given index from Json Array.

get
get(key: str): Json

Returns a specified element from the Json.

keyRequired
  • Type: str

The key of the element to return.


getAt
getAt(index: num): Json

Returns a specified element at a given index from Json Array.

indexRequired
  • Type: num

The index of the element in the Json Array to return.


Static Functions

NameDescription
cloneCreates a immutable deep clone of the Json.
cloneMutCreates a mutable deep clone of the Json.
deleteDeletes a key in a given Json.
keysReturns the keys from the Json object.
parseParse a string into a Json.
stringifyFormats Json as string.
tryParseTry to parse a string into a Json.
valuesReturns the values from the Json.

clone
bring std;

std.Json.clone(json: Json)

Creates a immutable deep clone of the Json.

jsonRequired

to clone.


cloneMut
bring std;

std.Json.cloneMut(json: Json)

Creates a mutable deep clone of the Json.

jsonRequired

to clone.


delete
bring std;

std.Json.delete(json: Json, key: str)

Deletes a key in a given Json.

jsonRequired

to delete key from.


keyRequired
  • Type: str

the key to delete.


keys
bring std;

std.Json.keys(json: Json)

Returns the keys from the Json object.

jsonRequired

to get keys from.


parse
bring std;

std.Json.parse(str: str)

Parse a string into a Json.

strRequired
  • Type: str

to parse as Json.


stringify
bring std;

std.Json.stringify(json: Json, indent?: num)

Formats Json as string.

(JSON.stringify($args$))

jsonRequired

to format as string.


indentOptional
  • Type: num

tryParse
bring std;

std.Json.tryParse(str: str)

Try to parse a string into a Json.

strRequired
  • Type: str

to parse as Json.


values
bring std;

std.Json.values(json: Json)

Returns the values from the Json.

jsonRequired

to get values from.


MutableArray

Mutable Array.

Initializers

bring std;

new std.MutableArray()
NameTypeDescription

Methods

NameDescription
atGet the value at the given index.
concatMerge arr to the end of this array.
containsChecks if this array includes searchElement.
copyCreate an immutable shallow copy of this array.
indexOfReturns the index of the first occurrence of searchElement found.
joinReturns a new string containing the concatenated values in this array, separated by commas or a specified separator string.
lastIndexOfReturns the index of the last occurrence of searchElement found.
popRemove value from end of array.
pushAdd value to end of array.

at
at(index: num): T1

Get the value at the given index.

indexRequired
  • Type: num

index of the value to get.


concat
concat(arr: MutableArray): MutableArray

Merge arr to the end of this array.

arrRequired

array to merge.


contains
contains(searchElement: T1): bool

Checks if this array includes searchElement.

searchElementRequired

to search for.


copy
copy(): ImmutableArray

Create an immutable shallow copy of this array.

indexOf
indexOf(searchElement: T1): num

Returns the index of the first occurrence of searchElement found.

searchElementRequired

to search for.


join
join(separator?: str): str

Returns a new string containing the concatenated values in this array, separated by commas or a specified separator string.

If the array has only one item, then that item will be returned without using the separator.

separatorOptional
  • Type: str

lastIndexOf
lastIndexOf(searchElement: T1): num

Returns the index of the last occurrence of searchElement found.

searchElementRequired

to search for.


pop
pop(): T1

Remove value from end of array.

push
push(value: T1): void

Add value to end of array.

valueRequired

value to add.


Properties

NameTypeDescription
lengthnumThe length of the array.

lengthRequired
length: num;
  • Type: num

The length of the array.


MutableMap

Mutable Map.

Initializers

bring std;

new std.MutableMap()
NameTypeDescription

Methods

NameDescription
clearRemoves all elements.
copyCreate an immutable shallow copy of this map.
deleteRemoves the specified element from a map.
getReturns a specified element from the map.
hasReturns a boolean indicating whether an element with the specified key exists or not.
keysReturns the keys of this map.
setAdds or updates an entry in a Map object with a specified key and a value.
sizeReturns the number of elements in the map.
valuesReturns the values of this map.

clear
clear(): void

Removes all elements.

copy
copy(): ImmutableMap

Create an immutable shallow copy of this map.

delete
delete(key: str): bool

Removes the specified element from a map.

keyRequired
  • Type: str

The key.


get
get(key: str): T1

Returns a specified element from the map.

If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the map.

keyRequired
  • Type: str

The key of the element to return.


has
has(key: str): bool

Returns a boolean indicating whether an element with the specified key exists or not.

keyRequired
  • Type: str

The key of the element to test for presence.


keys
keys(): ImmutableArray

Returns the keys of this map.

set
set(key: str, value: T1): void

Adds or updates an entry in a Map object with a specified key and a value.

TODO: revisit this macro after we support indexed args https://github.com/winglang/wing/issues/1659

keyRequired
  • Type: str

The key of the element to add.


valueRequired

The value of the element to add.


size
size(): num

Returns the number of elements in the map.

TODO: For now this has to be a method rather than a getter as macros only work on methods https://github.com/winglang/wing/issues/1658

values
values(): ImmutableArray

Returns the values of this map.

MutableSet

Mutable Set.

Initializers

bring std;

new std.MutableSet()
NameTypeDescription

Methods

NameDescription
addAdd value to set.
clearThe clear() method removes all elements from a set.
copyCreate an immutable shallow copy of this set.
deleteRemoves a specified value from a set, if it is in the set.
hasReturns a boolean indicating whether an element with the specified value exists in the set.

add
add(value: T1): MutableSet

Add value to set.

valueRequired

value to add.


clear
clear(): void

The clear() method removes all elements from a set.

copy
copy(): ImmutableSet

Create an immutable shallow copy of this set.

delete
delete(value: T1): bool

Removes a specified value from a set, if it is in the set.

valueRequired

The value to remove from the set.


has
has(value: T1): bool

Returns a boolean indicating whether an element with the specified value exists in the set.

valueRequired

The value to test for presence in the Set object.


Properties

NameTypeDescription
sizenumThe length of the set.

sizeRequired
size: num;
  • Type: num

The length of the set.


MutJson

Mutable Json.

Initializers

bring std;

new std.MutJson()
NameTypeDescription

Methods

NameDescription
getReturns a specified element from the Json.
getAtReturns a specified element at a given index from MutJson Array.
setAdds or updates an element in MutJson with a specific key and value.
setAtSet element in MutJson Array with a specific key and value.

get
get(key: str): MutJson

Returns a specified element from the Json.

keyRequired
  • Type: str

The key of the element to return.


getAt
getAt(index: num): MutJson

Returns a specified element at a given index from MutJson Array.

indexRequired
  • Type: num

The index of the element in the MutJson Array to return.


set
set(key: str, value: any): void

Adds or updates an element in MutJson with a specific key and value.

keyRequired
  • Type: str

The key of the element to add.


valueRequired
  • Type: any

The value of the element to add.


setAt
setAt(index: num, value: any): void

Set element in MutJson Array with a specific key and value.

indexRequired
  • Type: num

valueRequired
  • Type: any

The value of the element to set.


Number

Number.

Initializers

bring std;

new std.Number()
NameTypeDescription

Static Functions

NameDescription
fromJsonParse a number from Json.
fromStrParse a number from string.

fromJson
bring std;

std.Number.fromJson(json: Json)

Parse a number from Json.

jsonRequired

to parse number from.


fromStr
bring std;

std.Number.fromStr(str: str)

Parse a number from string.

strRequired
  • Type: str

to parse number from.


Range

Range.

Initializers

bring std;

new std.Range()
NameTypeDescription

String

String.

Initializers

bring std;

new std.String()
NameTypeDescription

Methods

NameDescription
atReturns the character at the specified index.
concatCombines the text of two (or more) strings and returns a new string.
containsChecks if string includes substring.
endsWithDoes this string end with the given searchString?
indexOfReturns the index of the first occurrence of searchString found.
lowercaseReturns this string in lower case.
splitSplits string by separator.
startsWithDoes this string start with the given searchString?
substringReturns a string between indexStart, indexEnd.
trimRemoves white spaces from start and end of this string.
uppercaseReturns this string in upper case.

at
at(index: num): str

Returns the character at the specified index.

indexRequired
  • Type: num

position of the character.


concat
concat(strN: str): str

Combines the text of two (or more) strings and returns a new string.

strNRequired
  • Type: str

one or more strings to concatenate to this string.


contains
contains(searchString: str): bool

Checks if string includes substring.

searchStringRequired
  • Type: str

substring to search for.


endsWith
endsWith(searchString: str): bool

Does this string end with the given searchString?

searchStringRequired
  • Type: str

substring to search for.


indexOf
indexOf(searchString: str): num

Returns the index of the first occurrence of searchString found.

searchStringRequired
  • Type: str

substring to search for.


lowercase
lowercase(): str

Returns this string in lower case.

split
split(separator: str): MutArray<str>

Splits string by separator.

separatorRequired
  • Type: str

separator to split by.


startsWith
startsWith(searchString: str): bool

Does this string start with the given searchString?

searchStringRequired
  • Type: str

substring to search for.


substring
substring(indexStart: num, indexEnd?: num): str

Returns a string between indexStart, indexEnd.

indexStartRequired
  • Type: num

index of the character we slice at.


indexEndOptional
  • Type: num

optional - index of the character we end slicing at.


trim
trim(): str

Removes white spaces from start and end of this string.

uppercase
uppercase(): str

Returns this string in upper case.

Static Functions

NameDescription
fromJsonParse string from Json.

fromJson
bring std;

std.String.fromJson(json: Json)

Parse string from Json.

jsonRequired

to create string from.


Properties

NameTypeDescription
lengthnumThe length of the string.

lengthRequired
length: num;
  • Type: num

The length of the string.


T1

Generic type argument.

This type is replaced at compile time.

Initializers

bring std;

new std.T1()
NameTypeDescription

Protocols

IApiClient

Inflight methods and members of cloud.Api.

IApiEndpointHandler

Inflight client: @winglang/sdk.cloud.IApiEndpointHandlerClient

Represents a resource with an inflight "handle" method that can be passed to one of the Api request preflight methods.

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


IApiEndpointHandlerClient

Inflight client for IApiEndpointHandler.

Methods

NameDescription
handleInflight that will be called when a request is made to the endpoint.

handle
handle(request: ApiRequest): ApiResponse

Inflight client: true

Inflight that will be called when a request is made to the endpoint.

requestRequired

IBucketClient

Inflight interface for Bucket.

Methods

NameDescription
deleteDelete an existing object using a key from the bucket.
existsCheck if an object exists in the bucket.
getRetrieve an object from the bucket.
getJsonRetrieve a Json object from the bucket.
listRetrieve existing objects keys from the bucket.
publicUrlReturns a url to the given file.
putPut an object in the bucket.
putJsonPut a Json object in the bucket.
tryDeleteDelete an object from the bucket if it exists.
tryGetGet an object from the bucket if it exists.
tryGetJsonGets an object from the bucket if it exists, parsing it as Json.

delete
delete(key: str, opts?: BucketDeleteOptions): void

Inflight client: true

Delete an existing object using a key from the bucket.

keyRequired
  • Type: str

Key of the object.


optsOptional

Options available for delete an item from a bucket.


exists
exists(key: str): bool

Inflight client: true

Check if an object exists in the bucket.

keyRequired
  • Type: str

Key of the object.


get
get(key: str): str

Inflight client: true

Retrieve an object from the bucket.

keyRequired
  • Type: str

Key of the object.


getJson
getJson(key: str): Json

Inflight client: true

Retrieve a Json object from the bucket.

keyRequired
  • Type: str

Key of the object.


list
list(prefix?: str): MutArray<str>

Inflight client: true

Retrieve existing objects keys from the bucket.

prefixOptional
  • Type: str

Limits the response to keys that begin with the specified prefix.


publicUrl
publicUrl(key: str): str

Inflight client: true

Returns a url to the given file.

keyRequired
  • Type: str

put
put(key: str, body: str): void

Inflight client: true

Put an object in the bucket.

keyRequired
  • Type: str

Key of the object.


bodyRequired
  • Type: str

Content of the object we want to store into the bucket.


putJson
putJson(key: str, body: Json): void

Inflight client: true

Put a Json object in the bucket.

keyRequired
  • Type: str

Key of the object.


bodyRequired

Json object that we want to store into the bucket.


tryDelete
tryDelete(key: str): bool

Inflight client: true

Delete an object from the bucket if it exists.

keyRequired
  • Type: str

Key of the object.


tryGet
tryGet(key: str): str

Inflight client: true

Get an object from the bucket if it exists.

keyRequired
  • Type: str

Key of the object.


tryGetJson
tryGetJson(key: str): Json

Inflight client: true

Gets an object from the bucket if it exists, parsing it as Json.

keyRequired
  • Type: str

Key of the object.


IBucketEventHandler

Inflight client: @winglang/sdk.cloud.IBucketEventHandlerClient

Represents a resource with an inflight "handle" method that can be passed to the bucket events.

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


IBucketEventHandlerClient

Represents a resource with an inflight "handle" method that can be passed to the bucket events.

Methods

NameDescription
handleFunction that will be called when an event notification is fired.

handle
handle(key: str, type: BucketEventType): void

Inflight client: true

Function that will be called when an event notification is fired.

keyRequired
  • Type: str

typeRequired

ICounterClient

Inflight interface for Counter.

Methods

NameDescription
decDecrement the counter, returning the previous value.
incIncrements the counter atomically by a certain amount and returns the previous value.
peekGet the current value of the counter.
resetReset a counter to a given value.

dec
dec(amount?: num): num

Inflight client: true

Decrement the counter, returning the previous value.

amountOptional
  • Type: num

amount to decrement (default is 1).


inc
inc(amount?: num): num

Inflight client: true

Increments the counter atomically by a certain amount and returns the previous value.

amountOptional
  • Type: num

amount to increment (default is 1).


peek
peek(): num

Inflight client: true

Get the current value of the counter.

Using this API may introduce race conditions since the value can change between the time it is read and the time it is used in your code.

reset
reset(value?: num): void

Inflight client: true

Reset a counter to a given value.

valueOptional
  • Type: num

value to reset (default is 0).


IFunctionClient

Inflight interface for Function.

Methods

NameDescription
invokeInvoke the function asynchronously with a given payload.

invoke
invoke(payload: str): str

Inflight client: true

Invoke the function asynchronously with a given payload.

payloadRequired
  • Type: str

IFunctionHandler

Inflight client: @winglang/sdk.cloud.IFunctionHandlerClient

Represents a resource with an inflight "handle" method that can be used to create a cloud.Function.

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


IFunctionHandlerClient

Inflight client for IFunctionHandler.

Methods

NameDescription
handleEntrypoint function that will be called when the cloud function is invoked.

handle
handle(event: str): void

Inflight client: true

Entrypoint function that will be called when the cloud function is invoked.

eventRequired
  • Type: str

IInflightHost

A resource that can run inflight code.

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


IQueueAddConsumerHandler

Inflight client: @winglang/sdk.cloud.IQueueAddConsumerHandlerClient

Represents a resource with an inflight "handle" method that can be passed to Queue.addConsumer.

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


IQueueAddConsumerHandlerClient

Inflight client for IQueueAddConsumerHandler.

Methods

NameDescription
handleFunction that will be called when a message is received from the queue.

handle
handle(message: str): void

Inflight client: true

Function that will be called when a message is received from the queue.

messageRequired
  • Type: str

IQueueClient

Inflight interface for Queue.

Methods

NameDescription
approxSizeRetrieve the approximate number of messages in the queue.
popPop a message from the queue.
purgePurge all of the messages in the queue.
pushPush a message to the queue.

approxSize
approxSize(): num

Inflight client: true

Retrieve the approximate number of messages in the queue.

pop
pop(): str

Inflight client: true

Pop a message from the queue.

purge
purge(): void

Inflight client: true

Purge all of the messages in the queue.

push
push(message: str): void

Inflight client: true

Push a message to the queue.

messageRequired
  • Type: str

Payload to send to the queue.


IResource

Abstract interface for Resource.

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


IScheduleClient

Inflight interface for Schedule.

IScheduleOnTickHandler

Inflight client: @winglang/sdk.cloud.IScheduleOnTickHandlerClient

Represents a resource with an inflight "handle" method that can be passed to Schedule.on_tick.

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


IScheduleOnTickHandlerClient

Inflight client for IScheduleOnTickHandler.

Methods

NameDescription
handleFunction that will be called when a message is received from the schedule.

handle
handle(): void

Inflight client: true

Function that will be called when a message is received from the schedule.

ISecretClient

Inflight interface for Secret.

Methods

NameDescription
valueRetrieve the value of the secret.
valueJsonRetrieve the Json value of the secret.

value
value(options?: GetSecretValueOptions): str

Inflight client: true

Retrieve the value of the secret.

optionsOptional

valueJson
valueJson(options?: GetSecretValueOptions): Json

Inflight client: true

Retrieve the Json value of the secret.

optionsOptional

IServiceClient

Inflight interface for Service.

Methods

NameDescription
startStart the service.
stopStop the service.

start
start(): void

Inflight client: true

Start the service.

stop
stop(): void

Inflight client: true

Stop the service.

IServiceOnEventClient

Inflight client for IServiceOnEventHandler.

Methods

NameDescription
handleFunction that will be called for service events.

handle
handle(): void

Inflight client: true

Function that will be called for service events.

IServiceOnEventHandler

Inflight client: @winglang/sdk.cloud.IServiceOnEventClient

Represents a resource with an inflight "handle" method that can be passed to ServiceProps.on_start || ServiceProps.on_stop.

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


ITableClient

Inflight interface for Table.

Methods

NameDescription
deleteDelete a row from the table, by primary key.
getGet a row from the table, by primary key.
insertInsert a row into the table.
listList all rows in the table.
updateUpdate a row in the table.

delete
delete(key: str): void

Inflight client: true

Delete a row from the table, by primary key.

keyRequired
  • Type: str

primary key to delete the row.


get
get(key: str): Json

Inflight client: true

Get a row from the table, by primary key.

keyRequired
  • Type: str

primary key to search.


insert
insert(key: str, row: Json): void

Inflight client: true

Insert a row into the table.

keyRequired
  • Type: str

primary key to insert the row.


rowRequired

data to be inserted.


list
list(): MutArray<Json>

Inflight client: true

List all rows in the table.

update
update(key: str, row: Json): void

Inflight client: true

Update a row in the table.

keyRequired
  • Type: str

primary key to update the row.


rowRequired

data to be updated.


ITestHandler

Inflight client: @winglang/sdk.std.ITestHandlerClient

Interface with an inflight "handle" method that can be used to construct a std.Test.

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


ITestHandlerClient

Inflight client for ITestHandler.

Methods

NameDescription
handleInflight function that will be called when the test is run.

handle
handle(): void

Inflight client: true

Inflight function that will be called when the test is run.

ITestRunnerClient

Inflight interface for TestRunner.

Methods

NameDescription
listTestsList all tests available for this test engine.
runTestRun a test with a given path and return the result.

listTests
listTests(): MutArray<str>

Inflight client: true

List all tests available for this test engine.

runTest
runTest(path: str): TestResult

Inflight client: true

Run a test with a given path and return the result.

pathRequired
  • Type: str

ITopicClient

Inflight interface for Topic.

Methods

NameDescription
publishPublish message to topic.

publish
publish(message: str): void

Inflight client: true

Publish message to topic.

messageRequired
  • Type: str

Payload to publish to Topic.


ITopicOnMessageHandler

Inflight client: @winglang/sdk.cloud.ITopicOnMessageHandlerClient

Represents a resource with an inflight "handle" method that can be passed to Topic.on_message.

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
displayDisplayInformation on how to display a resource in the UI.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


displayRequired
display: Display;

Information on how to display a resource in the UI.


ITopicOnMessageHandlerClient

Inflight client for ITopicOnMessageHandler.

Methods

NameDescription
handleFunction that will be called when a message is received from the topic.

handle
handle(event: str): void

Inflight client: true

Function that will be called when a message is received from the topic.

eventRequired
  • Type: str

IWebsiteClient

Inflight methods and members of cloud.Website.

Enums

BucketEventType

bucket events to subscribe to.

Members

NameDescription
CREATEcreate.
DELETEdelete.
UPDATEupdate.

CREATE

create.


DELETE

delete.


UPDATE

update.


ColumnType

Table column types.

Members

NameDescription
STRINGstring type.
NUMBERnumber type.
BOOLEANbool type.
DATEdate type.
JSONjson type.

STRING

string type.


NUMBER

number type.


BOOLEAN

bool type.


DATE

date type.


JSON

json type.


Direction

The direction of a connection.

Visually speaking, if a resource A has an outbound connection with resource B, the arrow would point from A to B, and vice versa for inbound connections.

Members

NameDescription
OUTBOUNDIndicates that this resource calls, triggers, or references the resource it is connected to.
INBOUNDIndicates that this resource is called, triggered, or referenced by the resource it is connected to.

OUTBOUND

Indicates that this resource calls, triggers, or references the resource it is connected to.


INBOUND

Indicates that this resource is called, triggered, or referenced by the resource it is connected to.


HttpMethod

Allowed HTTP methods for a endpoint.

Members

NameDescription
GETGet.
HEADHead.
POSTPost.
PUTPut.
DELETEDelete.
CONNECTConnect.
OPTIONSOptions.
PATCHPatch.

GET

Get.


HEAD

Head.


POST

Post.


PUT

Put.


DELETE

Delete.


CONNECT

Connect.


OPTIONS

Options.


PATCH

Patch.


TraceType

The type of a trace.

Members

NameDescription
RESOURCEA trace representing a resource activity.
LOGA trace representing a message emitted by the logger.

RESOURCE

A trace representing a resource activity.


LOG

A trace representing a message emitted by the logger.