diff --git a/api_versioned_docs/version-latest/04-standard-library/aws/api-reference.md b/api_versioned_docs/version-latest/04-standard-library/aws/api-reference.md index 2651d0c2..c0a86f60 100644 --- a/api_versioned_docs/version-latest/04-standard-library/aws/api-reference.md +++ b/api_versioned_docs/version-latest/04-standard-library/aws/api-reference.md @@ -12,25 +12,1547 @@ sidebar_position: 100 ## Resources +### Api + +- *Implements:* IAwsApi + +Base class for AWS API. + +#### Initializers + +```wing +bring aws; + +new aws.Api(props?: ApiProps); +``` + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| props | ApiProps | *No description.* | + +--- + +##### `props`Optional + +- *Type:* ApiProps + +--- + +#### Methods + +| **Name** | **Description** | +| --- | --- | +| 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` + +```wing +connect(path: str, inflight: IApiEndpointHandler, props?: ApiConnectOptions): void +``` + +Add a inflight handler to the api for CONNECT requests on the given path. + +###### `path`Required + +- *Type:* str + +--- + +###### `inflight`Required + +- *Type:* IApiEndpointHandler + +--- + +###### `props`Optional + +- *Type:* ApiConnectOptions + +--- + +##### `delete` + +```wing +delete(path: str, inflight: IApiEndpointHandler, props?: ApiDeleteOptions): void +``` + +Add a inflight handler to the api for DELETE requests on the given path. + +###### `path`Required + +- *Type:* str + +--- + +###### `inflight`Required + +- *Type:* IApiEndpointHandler + +--- + +###### `props`Optional + +- *Type:* ApiDeleteOptions + +--- + +##### `get` + +```wing +get(path: str, inflight: IApiEndpointHandler, props?: ApiGetOptions): void +``` + +Add a inflight handler to the api for GET requests on the given path. + +###### `path`Required + +- *Type:* str + +--- + +###### `inflight`Required + +- *Type:* IApiEndpointHandler + +--- + +###### `props`Optional + +- *Type:* ApiGetOptions + +--- + +##### `head` + +```wing +head(path: str, inflight: IApiEndpointHandler, props?: ApiHeadOptions): void +``` + +Add a inflight handler to the api for HEAD requests on the given path. + +###### `path`Required + +- *Type:* str + +--- + +###### `inflight`Required + +- *Type:* IApiEndpointHandler + +--- + +###### `props`Optional + +- *Type:* ApiHeadOptions + +--- + +##### `options` + +```wing +options(path: str, inflight: IApiEndpointHandler, props?: ApiOptionsOptions): void +``` + +Add a inflight handler to the api for OPTIONS requests on the given path. + +###### `path`Required + +- *Type:* str + +--- + +###### `inflight`Required + +- *Type:* IApiEndpointHandler + +--- + +###### `props`Optional + +- *Type:* ApiOptionsOptions + +--- + +##### `patch` + +```wing +patch(path: str, inflight: IApiEndpointHandler, props?: ApiPatchOptions): void +``` + +Add a inflight handler to the api for PATCH requests on the given path. + +###### `path`Required + +- *Type:* str + +--- + +###### `inflight`Required + +- *Type:* IApiEndpointHandler + +--- + +###### `props`Optional + +- *Type:* ApiPatchOptions + +--- + +##### `post` + +```wing +post(path: str, inflight: IApiEndpointHandler, props?: ApiPostOptions): void +``` + +Add a inflight handler to the api for POST requests on the given path. + +###### `path`Required + +- *Type:* str + +--- + +###### `inflight`Required + +- *Type:* IApiEndpointHandler + +--- + +###### `props`Optional + +- *Type:* ApiPostOptions + +--- + +##### `put` + +```wing +put(path: str, inflight: IApiEndpointHandler, props?: ApiPutOptions): void +``` + +Add a inflight handler to the api for PUT requests on the given path. + +###### `path`Required + +- *Type:* str + +--- + +###### `inflight`Required + +- *Type:* IApiEndpointHandler + +--- + +###### `props`Optional + +- *Type:* ApiPutOptions + +--- + +#### Static Functions + +| **Name** | **Description** | +| --- | --- | +| 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` + +```wing +bring aws; + +aws.Api.onLiftType(host: IInflightHost, ops: MutArray); +``` + +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. + +###### `host`Required + +- *Type:* IInflightHost + +--- + +###### `ops`Required + +- *Type:* MutArray<str> + +--- + +##### `toInflight` + +```wing +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. + +###### `obj`Required + +- *Type:* IResource + +--- + +##### `renderCorsHeaders` + +```wing +bring aws; + +aws.Api.renderCorsHeaders(corsOptions?: ApiCorsOptions); +``` + +Generates an object containing default CORS response headers and OPTIONS response headers. + +###### `corsOptions`Optional + +- *Type:* ApiCorsOptions + +The CORS options to generate the headers from. + +--- + +##### `renderOpenApiPath` + +```wing +bring aws; + +aws.Api.renderOpenApiPath(path: str); +``` + +Converts input path to a valid OpenAPI path (replaces `:` based path params with `{}`). + +###### `path`Required + +- *Type:* str + +The path to convert (assumes path is valid). + +--- + +##### `from` + +```wing +bring aws; + +aws.Api.from(api: Api); +``` + +If the api is an AWS RestApi, return a helper interface for working with it. + +###### `api`Required + +- *Type:* Api + +The cloud.Api. + +--- + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| node | constructs.Node | The tree node. | +| url | str | The base URL of the API endpoint. | +| deploymentId | str | RestApi deployment id. | +| invokeUrl | str | Invoke URL. | +| restApiArn | str | RestApi arn. | +| restApiId | str | RestApi id. | +| restApiName | str | RestApi id. | +| stageName | str | RestApi stage name. | + +--- + +##### `node`Required + +```wing +node: Node; +``` + +- *Type:* constructs.Node + +The tree node. + +--- + +##### `url`Required + +```wing +url: str; +``` + +- *Type:* str + +The base URL of the API endpoint. + +--- + +##### `deploymentId`Required + +```wing +deploymentId: str; +``` + +- *Type:* str + +RestApi deployment id. + +--- + +##### `invokeUrl`Required + +```wing +invokeUrl: str; +``` + +- *Type:* str + +Invoke URL. + +--- + +##### `restApiArn`Required + +```wing +restApiArn: str; +``` + +- *Type:* str + +RestApi arn. + +--- + +##### `restApiId`Required + +```wing +restApiId: str; +``` + +- *Type:* str + +RestApi id. + +--- + +##### `restApiName`Required + +```wing +restApiName: str; +``` + +- *Type:* str + +RestApi id. + +--- + +##### `stageName`Required + +```wing +stageName: str; +``` + +- *Type:* str + +RestApi stage name. + +--- + + +### Bucket + +- *Implements:* IAwsBucket + +Base class for AWS Buckets. + +#### Initializers + +```wing +bring aws; + +new aws.Bucket(props?: BucketProps); +``` + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| props | BucketProps | *No description.* | + +--- + +##### `props`Optional + +- *Type:* BucketProps + +--- + +#### Methods + +| **Name** | **Description** | +| --- | --- | +| 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` + +```wing +addCorsRule(value: BucketCorsOptions): void +``` + +Add cors configuration to the bucket. + +###### `value`Required + +- *Type:* BucketCorsOptions + +--- + +##### `addFile` + +```wing +addFile(key: str, path: str, encoding?: str): void +``` + +Add a file to the bucket from system folder. + +###### `key`Required + +- *Type:* str + +The key or name to associate with the file. + +--- + +###### `path`Required + +- *Type:* str + +The path to the file on the local system. + +--- + +###### `encoding`Optional + +- *Type:* str + +The encoding to use when reading the file. + +Defaults to "utf-8". + +--- + +##### `addObject` + +```wing +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. + +###### `path`Required + +- *Type:* str + +--- + +###### `content`Required + +- *Type:* str + +--- + +##### `onCreate` + +```wing +onCreate(fn: IBucketEventHandler, opts?: BucketOnCreateOptions): void +``` + +Run an inflight whenever a file is uploaded to the bucket. + +###### `fn`Required + +- *Type:* IBucketEventHandler + +--- + +###### `opts`Optional + +- *Type:* BucketOnCreateOptions + +--- + +##### `onDelete` + +```wing +onDelete(fn: IBucketEventHandler, opts?: BucketOnDeleteOptions): void +``` + +Run an inflight whenever a file is deleted from the bucket. + +###### `fn`Required + +- *Type:* IBucketEventHandler + +--- + +###### `opts`Optional + +- *Type:* BucketOnDeleteOptions + +--- + +##### `onEvent` + +```wing +onEvent(fn: IBucketEventHandler, opts?: BucketOnEventOptions): void +``` + +Run an inflight whenever a file is uploaded, modified, or deleted from the bucket. + +###### `fn`Required + +- *Type:* IBucketEventHandler + +--- + +###### `opts`Optional + +- *Type:* BucketOnEventOptions + +--- + +##### `onUpdate` + +```wing +onUpdate(fn: IBucketEventHandler, opts?: BucketOnUpdateOptions): void +``` + +Run an inflight whenever a file is updated in the bucket. + +###### `fn`Required + +- *Type:* IBucketEventHandler + +--- + +###### `opts`Optional + +- *Type:* BucketOnUpdateOptions + +--- + +#### Static Functions + +| **Name** | **Description** | +| --- | --- | +| 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` + +```wing +bring aws; + +aws.Bucket.onLiftType(host: IInflightHost, ops: MutArray); +``` + +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. + +###### `host`Required + +- *Type:* IInflightHost + +--- + +###### `ops`Required + +- *Type:* MutArray<str> + +--- + +##### `toInflight` + +```wing +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. + +###### `obj`Required + +- *Type:* IResource + +--- + +##### `from` + +```wing +bring aws; + +aws.Bucket.from(bucket: Bucket); +``` + +If the bucket is an AWS Bucket, return a helper interface for working with it. + +###### `bucket`Required + +- *Type:* Bucket + +The cloud.Bucket. + +--- + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| node | constructs.Node | The tree node. | +| bucketArn | str | AWS Bucket arn. | +| bucketDomainName | str | Bucket domain name. | +| bucketName | str | AWS Bucket name. | + +--- + +##### `node`Required + +```wing +node: Node; +``` + +- *Type:* constructs.Node + +The tree node. + +--- + +##### `bucketArn`Required + +```wing +bucketArn: str; +``` + +- *Type:* str + +AWS Bucket arn. + +--- + +##### `bucketDomainName`Required + +```wing +bucketDomainName: str; +``` + +- *Type:* str + +Bucket domain name. + +--- + +##### `bucketName`Required + +```wing +bucketName: str; +``` + +- *Type:* str + +AWS Bucket name. + +--- + + ### BucketRef -A reference to an external S3 bucket. +A reference to an external S3 bucket. + +#### Initializers + +```wing +bring aws; + +new aws.BucketRef(bucketName: str); +``` + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| bucketName | str | *No description.* | + +--- + +##### `bucketName`Required + +- *Type:* str + +--- + +#### Methods + +##### Inflight Methods + +| **Name** | **Description** | +| --- | --- | +| bucketRegion | Get the region of the bucket. | + +--- + +##### `bucketRegion` + +```wing +inflight bucketRegion(): str +``` + +Get the region of the bucket. + +#### Static Functions + +| **Name** | **Description** | +| --- | --- | +| 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` + +```wing +bring aws; + +aws.BucketRef.onLiftType(host: IInflightHost, ops: MutArray); +``` + +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. + +###### `host`Required + +- *Type:* IInflightHost + +--- + +###### `ops`Required + +- *Type:* MutArray<str> + +--- + +##### `toInflight` + +```wing +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. + +###### `obj`Required + +- *Type:* IResource + +--- + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| node | constructs.Node | The tree node. | +| bucketArn | str | The ARN of this bucket. | +| bucketDomainName | str | The domain name of this bucket. | +| bucketName | str | The Name of this bucket. | + +--- + +##### `node`Required + +```wing +node: Node; +``` + +- *Type:* constructs.Node + +The tree node. + +--- + +##### `bucketArn`Required + +```wing +bucketArn: str; +``` + +- *Type:* str + +The ARN of this bucket. + +--- + +##### `bucketDomainName`Required + +```wing +bucketDomainName: str; +``` + +- *Type:* str + +The domain name of this bucket. + +--- + +##### `bucketName`Required + +```wing +bucketName: str; +``` + +- *Type:* str + +The Name of this bucket. + +--- + + +### Counter + +- *Implements:* IAwsCounter + +Base class for AWS Counters. + +#### Initializers + +```wing +bring aws; + +new aws.Counter(props?: CounterProps); +``` + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| props | CounterProps | *No description.* | + +--- + +##### `props`Optional + +- *Type:* CounterProps + +--- + + +#### Static Functions + +| **Name** | **Description** | +| --- | --- | +| 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` + +```wing +bring aws; + +aws.Counter.onLiftType(host: IInflightHost, ops: MutArray); +``` + +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. + +###### `host`Required + +- *Type:* IInflightHost + +--- + +###### `ops`Required + +- *Type:* MutArray<str> + +--- + +##### `toInflight` + +```wing +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. + +###### `obj`Required + +- *Type:* IResource + +--- + +##### `from` + +```wing +bring aws; + +aws.Counter.from(counter: Counter); +``` + +If the table is an AWS Counter, return a helper interface for working with it. + +###### `counter`Required + +- *Type:* Counter + +The cloud.Counter. + +--- + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| node | constructs.Node | The tree node. | +| initial | num | The initial value of the counter. | +| dynamoTableArn | str | AWS Dynamodb arn. | +| dynamoTableName | str | AWS Dynamodb name. | + +--- + +##### `node`Required + +```wing +node: Node; +``` + +- *Type:* constructs.Node + +The tree node. + +--- + +##### `initial`Required + +```wing +initial: num; +``` + +- *Type:* num + +The initial value of the counter. + +--- + +##### `dynamoTableArn`Required + +```wing +dynamoTableArn: str; +``` + +- *Type:* str + +AWS Dynamodb arn. + +--- + +##### `dynamoTableName`Required + +```wing +dynamoTableName: str; +``` + +- *Type:* str + +AWS Dynamodb name. + +--- + + +### Domain + +AWS implementation of `cloud.Domain`. + +#### Initializers + +```wing +bring aws; + +new aws.Domain(props: DomainProps); +``` + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| props | DomainProps | *No description.* | + +--- + +##### `props`Required + +- *Type:* DomainProps + +--- + + +#### Static Functions + +| **Name** | **Description** | +| --- | --- | +| 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` + +```wing +bring aws; + +aws.Domain.onLiftType(host: IInflightHost, ops: MutArray); +``` + +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. + +###### `host`Required + +- *Type:* IInflightHost + +--- + +###### `ops`Required + +- *Type:* MutArray<str> + +--- + +##### `toInflight` + +```wing +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. + +###### `obj`Required + +- *Type:* IResource + +--- + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| node | constructs.Node | The tree node. | +| domainName | str | The domain name. | +| acmCertificateArn | str | The AWS Certificate Manager (ACM) certificate arn value. | +| hostedZoneId | str | The hosted zone id value. | +| iamCertificate | str | The IAM certificate identifier value. | + +--- + +##### `node`Required + +```wing +node: Node; +``` + +- *Type:* constructs.Node + +The tree node. + +--- + +##### `domainName`Required + +```wing +domainName: str; +``` + +- *Type:* str + +The domain name. + +--- + +##### `acmCertificateArn`Optional + +```wing +acmCertificateArn: str; +``` + +- *Type:* str + +The AWS Certificate Manager (ACM) certificate arn value. + +--- + +##### `hostedZoneId`Optional + +```wing +hostedZoneId: str; +``` + +- *Type:* str + +The hosted zone id value. + +--- + +##### `iamCertificate`Optional + +```wing +iamCertificate: str; +``` + +- *Type:* str + +The IAM certificate identifier value. + +--- + + +### Function + +- *Implements:* IAwsFunction + +Base class for AWS Functions. + +#### Initializers + +```wing +bring aws; + +new aws.Function(handler: IFunctionHandler, props?: FunctionProps); +``` + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| handler | IFunctionHandler | *No description.* | +| props | FunctionProps | *No description.* | + +--- + +##### `handler`Required + +- *Type:* IFunctionHandler + +--- + +##### `props`Optional + +- *Type:* FunctionProps + +--- + +#### Methods + +| **Name** | **Description** | +| --- | --- | +| 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` + +```wing +addEnvironment(name: str, value: str): void +``` + +Add an environment variable to the function. + +###### `name`Required + +- *Type:* str + +--- + +###### `value`Required + +- *Type:* str + +--- + +##### `addLambdaLayer` + +```wing +addLambdaLayer(layerArn: str): void +``` + +Add a Lambda layer to the function. + +###### `layerArn`Required + +- *Type:* str + +--- + +##### `addNetwork` + +```wing +addNetwork(config: NetworkConfig): void +``` + +Adds the host to the specified network. + +###### `config`Required + +- *Type:* NetworkConfig + +--- + +##### `addPolicyStatements` + +```wing +addPolicyStatements(...policies: Array): void +``` + +Add policy statements to the function's IAM role. + +###### `policies`Required + +- *Type:* PolicyStatement + +--- + +#### Static Functions + +| **Name** | **Description** | +| --- | --- | +| 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` + +```wing +bring aws; + +aws.Function.onLiftType(host: IInflightHost, ops: MutArray); +``` + +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. + +###### `host`Required + +- *Type:* IInflightHost + +--- + +###### `ops`Required + +- *Type:* MutArray<str> + +--- + +##### `toInflight` + +```wing +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. + +###### `obj`Required + +- *Type:* IResource + +--- + +##### `context` + +```wing +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](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html) + +##### `from` + +```wing +bring aws; + +aws.Function.from(host: IInflightHost); +``` + +If the inflight host is an AWS Lambda, return a helper interface for working with it. + +###### `host`Required + +- *Type:* IInflightHost + +The inflight host. + +--- + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| node | constructs.Node | The tree node. | +| env | MutMap<str> | Returns the set of environment variables for this function. | +| functionArn | str | AWS Function arn. | +| functionName | str | AWS Function name. | + +--- + +##### `node`Required + +```wing +node: Node; +``` + +- *Type:* constructs.Node + +The tree node. + +--- + +##### `env`Required + +```wing +env: MutMap; +``` + +- *Type:* MutMap<str> + +Returns the set of environment variables for this function. + +--- + +##### `functionArn`Required + +```wing +functionArn: str; +``` + +- *Type:* str + +AWS Function arn. + +--- + +##### `functionName`Required + +```wing +functionName: str; +``` -#### Initializers +- *Type:* str + +AWS Function name. + +--- + + +### FunctionRef + +A reference to an external Lambda function. + +#### Initializers ```wing bring aws; -new aws.BucketRef(bucketName: str); +new aws.FunctionRef(functionArn: str); ``` | **Name** | **Type** | **Description** | | --- | --- | --- | -| bucketName | str | *No description.* | +| functionArn | str | *No description.* | --- -##### `bucketName`Required +##### `functionArn`Required - *Type:* str @@ -42,33 +1564,62 @@ new aws.BucketRef(bucketName: str); | **Name** | **Description** | | --- | --- | -| bucketRegion | Get the region of the bucket. | +| 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. | --- -##### `bucketRegion` +##### `invoke` ```wing -inflight bucketRegion(): str +inflight invoke(payload?: Json): Json? ``` -Get the region of the bucket. +Invokes the function with a payload and waits for the result. + +###### `payload`Optional + +- *Type:* Json + +payload to pass to the function. + +If not defined, an empty string will be passed. + +--- + +##### `invokeAsync` + +```wing +inflight invokeAsync(payload?: Json): void +``` + +Kicks off the execution of the function with a payload and returns immediately while the function is running. + +###### `payload`Optional + +- *Type:* Json + +payload to pass to the function. + +If not defined, an empty string will be passed. + +--- #### Static Functions | **Name** | **Description** | | --- | --- | -| 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 | 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` +##### `onLiftType` ```wing bring aws; -aws.BucketRef.onLiftType(host: IInflightHost, ops: MutArray); +aws.FunctionRef.onLiftType(host: IInflightHost, ops: MutArray); ``` A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. @@ -79,31 +1630,31 @@ 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. -###### `host`Required +###### `host`Required - *Type:* IInflightHost --- -###### `ops`Required +###### `ops`Required - *Type:* MutArray<str> --- -##### `toInflight` +##### `toInflight` ```wing bring aws; -aws.BucketRef.toInflight(obj: IResource); +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. -###### `obj`Required +###### `obj`Required - *Type:* IResource @@ -113,14 +1664,12 @@ NOTE: This statement must be executed within an async context. | **Name** | **Type** | **Description** | | --- | --- | --- | -| node | constructs.Node | The tree node. | -| bucketArn | str | The ARN of this bucket. | -| bucketDomainName | str | The domain name of this bucket. | -| bucketName | str | The Name of this bucket. | +| node | constructs.Node | The tree node. | +| functionArn | str | The ARN of this function. | --- -##### `node`Required +##### `node`Required ```wing node: Node; @@ -132,83 +1681,264 @@ The tree node. --- -##### `bucketArn`Required +##### `functionArn`Required ```wing -bucketArn: str; +functionArn: str; ``` - *Type:* str -The ARN of this bucket. +The ARN of this function. --- -##### `bucketDomainName`Required + +### Queue + +- *Implements:* IAwsQueue + +Base class for AWS Queues. + +#### Initializers ```wing -bucketDomainName: str; +bring aws; + +new aws.Queue(props?: QueueProps); +``` + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| props | QueueProps | *No description.* | + +--- + +##### `props`Optional + +- *Type:* QueueProps + +--- + +#### Methods + +| **Name** | **Description** | +| --- | --- | +| setConsumer | Create a function to consume messages from this queue. | + +--- + +##### `setConsumer` + +```wing +setConsumer(handler: IQueueSetConsumerHandler, props?: QueueSetConsumerOptions): Function +``` + +Create a function to consume messages from this queue. + +###### `handler`Required + +- *Type:* IQueueSetConsumerHandler + +--- + +###### `props`Optional + +- *Type:* QueueSetConsumerOptions + +--- + +#### Static Functions + +| **Name** | **Description** | +| --- | --- | +| 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` + +```wing +bring aws; + +aws.Queue.onLiftType(host: IInflightHost, ops: MutArray); +``` + +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. + +###### `host`Required + +- *Type:* IInflightHost + +--- + +###### `ops`Required + +- *Type:* MutArray<str> + +--- + +##### `toInflight` + +```wing +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. + +###### `obj`Required + +- *Type:* IResource + +--- + +##### `from` + +```wing +bring aws; + +aws.Queue.from(queue: Queue); +``` + +If the queue is an AWS SQS, return a helper interface for working with it. + +###### `queue`Required + +- *Type:* Queue + +The cloud.Queue. + +--- + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| node | constructs.Node | The tree node. | +| queueArn | str | AWS Queue arn. | +| queueName | str | AWS Queue name. | +| queueUrl | str | AWS Queue url. | + +--- + +##### `node`Required + +```wing +node: Node; +``` + +- *Type:* constructs.Node + +The tree node. + +--- + +##### `queueArn`Required + +```wing +queueArn: str; ``` - *Type:* str -The domain name of this bucket. +AWS Queue arn. --- -##### `bucketName`Required +##### `queueName`Required ```wing -bucketName: str; +queueName: str; ``` - *Type:* str -The Name of this bucket. +AWS Queue name. --- +##### `queueUrl`Required -### Domain +```wing +queueUrl: str; +``` -AWS implementation of `cloud.Domain`. +- *Type:* str -#### Initializers +AWS Queue url. + +--- + + +### QueueRef + +A reference to an external SQS queue. + +#### Initializers ```wing bring aws; -new aws.Domain(props: DomainProps); +new aws.QueueRef(queueArn: str); ``` | **Name** | **Type** | **Description** | | --- | --- | --- | -| props | DomainProps | *No description.* | +| queueArn | str | *No description.* | --- -##### `props`Required +##### `queueArn`Required + +- *Type:* str + +--- + +#### Methods + +##### Inflight Methods -- *Type:* DomainProps +| **Name** | **Description** | +| --- | --- | +| queueUrl | Get the queue URL. | --- +##### `queueUrl` + +```wing +inflight queueUrl(): str +``` + +Get the queue URL. #### Static Functions | **Name** | **Description** | | --- | --- | -| 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 | 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` +##### `onLiftType` ```wing bring aws; -aws.Domain.onLiftType(host: IInflightHost, ops: MutArray); +aws.QueueRef.onLiftType(host: IInflightHost, ops: MutArray); ``` A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. @@ -219,31 +1949,31 @@ 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. -###### `host`Required +###### `host`Required - *Type:* IInflightHost --- -###### `ops`Required +###### `ops`Required - *Type:* MutArray<str> --- -##### `toInflight` +##### `toInflight` ```wing bring aws; -aws.Domain.toInflight(obj: IResource); +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. -###### `obj`Required +###### `obj`Required - *Type:* IResource @@ -253,15 +1983,12 @@ NOTE: This statement must be executed within an async context. | **Name** | **Type** | **Description** | | --- | --- | --- | -| node | constructs.Node | The tree node. | -| domainName | str | The domain name. | -| acmCertificateArn | str | The AWS Certificate Manager (ACM) certificate arn value. | -| hostedZoneId | str | The hosted zone id value. | -| iamCertificate | str | The IAM certificate identifier value. | +| node | constructs.Node | The tree node. | +| queueArn | str | The ARN of this queue. | --- -##### `node`Required +##### `node`Required ```wing node: Node; @@ -273,141 +2000,61 @@ The tree node. --- -##### `domainName`Required - -```wing -domainName: str; -``` - -- *Type:* str - -The domain name. - ---- - -##### `acmCertificateArn`Optional - -```wing -acmCertificateArn: str; -``` - -- *Type:* str - -The AWS Certificate Manager (ACM) certificate arn value. - ---- - -##### `hostedZoneId`Optional +##### `queueArn`Required ```wing -hostedZoneId: str; +queueArn: str; ``` - *Type:* str -The hosted zone id value. +The ARN of this queue. --- -##### `iamCertificate`Optional - -```wing -iamCertificate: str; -``` - -- *Type:* str - -The IAM certificate identifier value. - ---- +### Secret -### FunctionRef +- *Implements:* IAwsSecret -A reference to an external Lambda function. +Base class for AWS Secrets. -#### Initializers +#### Initializers ```wing bring aws; -new aws.FunctionRef(functionArn: str); +new aws.Secret(props?: SecretProps); ``` | **Name** | **Type** | **Description** | | --- | --- | --- | -| functionArn | str | *No description.* | - ---- - -##### `functionArn`Required - -- *Type:* str - ---- - -#### Methods - -##### Inflight Methods - -| **Name** | **Description** | -| --- | --- | -| 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. | +| props | SecretProps | *No description.* | --- -##### `invoke` - -```wing -inflight invoke(payload?: Json): Json? -``` - -Invokes the function with a payload and waits for the result. - -###### `payload`Optional - -- *Type:* Json - -payload to pass to the function. +##### `props`Optional -If not defined, an empty string will be passed. +- *Type:* SecretProps --- -##### `invokeAsync` - -```wing -inflight invokeAsync(payload?: Json): void -``` - -Kicks off the execution of the function with a payload and returns immediately while the function is running. - -###### `payload`Optional - -- *Type:* Json - -payload to pass to the function. - -If not defined, an empty string will be passed. - ---- #### Static Functions | **Name** | **Description** | | --- | --- | -| 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 | 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` +##### `onLiftType` ```wing bring aws; -aws.FunctionRef.onLiftType(host: IInflightHost, ops: MutArray); +aws.Secret.onLiftType(host: IInflightHost, ops: MutArray); ``` A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. @@ -418,31 +2065,31 @@ 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. -###### `host`Required +###### `host`Required - *Type:* IInflightHost --- -###### `ops`Required +###### `ops`Required - *Type:* MutArray<str> --- -##### `toInflight` +##### `toInflight` ```wing bring aws; -aws.FunctionRef.toInflight(obj: IResource); +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. -###### `obj`Required +###### `obj`Required - *Type:* IResource @@ -452,12 +2099,13 @@ NOTE: This statement must be executed within an async context. | **Name** | **Type** | **Description** | | --- | --- | --- | -| node | constructs.Node | The tree node. | -| functionArn | str | The ARN of this function. | +| node | constructs.Node | The tree node. | +| name | str | Get secret name. | +| secretArn | str | AWS Secret ARN. | --- -##### `node`Required +##### `node`Required ```wing node: Node; @@ -469,38 +2117,50 @@ The tree node. --- -##### `functionArn`Required +##### `name`Optional ```wing -functionArn: str; +name: str; ``` - *Type:* str -The ARN of this function. +Get secret name. --- +##### `secretArn`Required -### QueueRef +```wing +secretArn: str; +``` -A reference to an external SQS queue. +- *Type:* str -#### Initializers +AWS Secret ARN. + +--- + + +### SecretRef + +A reference to an existing secret. + +#### Initializers ```wing bring aws; -new aws.QueueRef(queueArn: str); +new aws.SecretRef(secretArn: str); ``` | **Name** | **Type** | **Description** | | --- | --- | --- | -| queueArn | str | *No description.* | +| secretArn | str | *No description.* | --- -##### `queueArn`Required +##### `secretArn`Required - *Type:* str @@ -512,33 +2172,54 @@ new aws.QueueRef(queueArn: str); | **Name** | **Description** | | --- | --- | -| queueUrl | Get the queue URL. | +| value | Retrieve the value of the secret. | +| valueJson | Retrieve the Json value of the secret. | --- -##### `queueUrl` +##### `value` ```wing -inflight queueUrl(): str +inflight value(options?: GetSecretValueOptions): str ``` -Get the queue URL. +Retrieve the value of the secret. + +###### `options`Optional + +- *Type:* GetSecretValueOptions + +--- + +##### `valueJson` + +```wing +inflight valueJson(options?: GetSecretValueOptions): Json +``` + +Retrieve the Json value of the secret. + +###### `options`Optional + +- *Type:* GetSecretValueOptions + +--- #### Static Functions | **Name** | **Description** | | --- | --- | -| 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 | 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` +##### `onLiftType` ```wing bring aws; -aws.QueueRef.onLiftType(host: IInflightHost, ops: MutArray); +aws.SecretRef.onLiftType(host: IInflightHost, ops: MutArray); ``` A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. @@ -549,31 +2230,31 @@ 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. -###### `host`Required +###### `host`Required - *Type:* IInflightHost --- -###### `ops`Required +###### `ops`Required - *Type:* MutArray<str> --- -##### `toInflight` +##### `toInflight` ```wing bring aws; -aws.QueueRef.toInflight(obj: IResource); +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. -###### `obj`Required +###### `obj`Required - *Type:* IResource @@ -583,12 +2264,12 @@ NOTE: This statement must be executed within an async context. | **Name** | **Type** | **Description** | | --- | --- | --- | -| node | constructs.Node | The tree node. | -| queueArn | str | The ARN of this queue. | +| node | constructs.Node | The tree node. | +| secretArn | str | The ARN of the secret. | --- -##### `node`Required +##### `node`Required ```wing node: Node; @@ -600,79 +2281,107 @@ The tree node. --- -##### `queueArn`Required +##### `secretArn`Required ```wing -queueArn: str; +secretArn: str; ``` - *Type:* str -The ARN of this queue. +The ARN of the secret. --- -### SecretRef +### Service -A reference to an existing secret. +- *Implements:* IAwsService -#### Initializers +Base class for AWS Services. + +#### Initializers ```wing bring aws; -new aws.SecretRef(secretArn: str); +new aws.Service(handler: IServiceHandler, props?: ServiceProps); ``` | **Name** | **Type** | **Description** | | --- | --- | --- | -| secretArn | str | *No description.* | +| handler | IServiceHandler | *No description.* | +| props | ServiceProps | *No description.* | + +--- + +##### `handler`Required + +- *Type:* IServiceHandler --- -##### `secretArn`Required +##### `props`Optional + +- *Type:* ServiceProps + +--- + +#### Methods + +| **Name** | **Description** | +| --- | --- | +| 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` + +```wing +addEnvironment(name: str, value: str): void +``` + +Add an environment variable to the function. + +###### `name`Required - *Type:* str --- -#### Methods - -##### Inflight Methods +###### `value`Required -| **Name** | **Description** | -| --- | --- | -| value | Retrieve the value of the secret. | -| valueJson | Retrieve the Json value of the secret. | +- *Type:* str --- -##### `value` +##### `addNetwork` ```wing -inflight value(options?: GetSecretValueOptions): str +addNetwork(config: NetworkConfig): void ``` -Retrieve the value of the secret. +Adds the host to the specified network. -###### `options`Optional +###### `config`Required -- *Type:* GetSecretValueOptions +- *Type:* NetworkConfig --- -##### `valueJson` +##### `addPolicyStatements` ```wing -inflight valueJson(options?: GetSecretValueOptions): Json +addPolicyStatements(...policies: Array): void ``` -Retrieve the Json value of the secret. +Add policy statements to the function's IAM role. -###### `options`Optional +###### `policies`Required -- *Type:* GetSecretValueOptions +- *Type:* PolicyStatement --- @@ -680,17 +2389,17 @@ Retrieve the Json value of the secret. | **Name** | **Description** | | --- | --- | -| 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 | 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` +##### `onLiftType` ```wing bring aws; -aws.SecretRef.onLiftType(host: IInflightHost, ops: MutArray); +aws.Service.onLiftType(host: IInflightHost, ops: MutArray); ``` A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. @@ -701,31 +2410,31 @@ 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. -###### `host`Required +###### `host`Required - *Type:* IInflightHost --- -###### `ops`Required +###### `ops`Required - *Type:* MutArray<str> --- -##### `toInflight` +##### `toInflight` ```wing bring aws; -aws.SecretRef.toInflight(obj: IResource); +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. -###### `obj`Required +###### `obj`Required - *Type:* IResource @@ -735,12 +2444,14 @@ NOTE: This statement must be executed within an async context. | **Name** | **Type** | **Description** | | --- | --- | --- | -| node | constructs.Node | The tree node. | -| secretArn | str | The ARN of the secret. | +| node | constructs.Node | The tree node. | +| env | MutMap<str> | Returns the set of environment variables for this function. | +| clusterName | str | AWS ECS cluster name. | +| serviceName | str | AWS ECS service name. | --- -##### `node`Required +##### `node`Required ```wing node: Node; @@ -752,367 +2463,493 @@ The tree node. --- -##### `secretArn`Required +##### `env`Required ```wing -secretArn: str; +env: MutMap; +``` + +- *Type:* MutMap<str> + +Returns the set of environment variables for this function. + +--- + +##### `clusterName`Required + +```wing +clusterName: str; ``` - *Type:* str -The ARN of the secret. +AWS ECS cluster name. --- +##### `serviceName`Required -## Classes +```wing +serviceName: str; +``` -### Api +- *Type:* str -A helper class for working with AWS apis. +AWS ECS service name. -#### Initializers +--- + + +### Topic + +- *Implements:* IAwsTopic + +Base class for AWS Topics. + +#### Initializers ```wing bring aws; -new aws.Api(); +new aws.Topic(props?: TopicProps); ``` | **Name** | **Type** | **Description** | | --- | --- | --- | +| props | TopicProps | *No description.* | --- +##### `props`Optional -#### Static Functions +- *Type:* TopicProps + +--- + +#### Methods | **Name** | **Description** | | --- | --- | -| from | If the api is an AWS RestApi, return a helper interface for working with it. | +| onMessage | Run an inflight whenever an message is published to the topic. | +| subscribeQueue | Subscribing queue to the topic. | --- -##### `from` +##### `onMessage` ```wing -bring aws; - -aws.Api.from(api: Api); +onMessage(inflight: ITopicOnMessageHandler, props?: TopicOnMessageOptions): Function ``` -If the api is an AWS RestApi, return a helper interface for working with it. - -###### `api`Required +Run an inflight whenever an message is published to the topic. -- *Type:* Api +###### `inflight`Required -The cloud.Api. +- *Type:* ITopicOnMessageHandler --- +###### `props`Optional +- *Type:* TopicOnMessageOptions -### ApiEndpointHandler - -A helper class for working with AWS api endpoint handlers. +--- -#### Initializers +##### `subscribeQueue` ```wing -bring aws; - -new aws.ApiEndpointHandler(); +subscribeQueue(queue: Queue, props?: TopicSubscribeQueueOptions): void ``` -| **Name** | **Type** | **Description** | -| --- | --- | --- | +Subscribing queue to the topic. + +###### `queue`Required + +- *Type:* Queue --- +###### `props`Optional + +- *Type:* TopicSubscribeQueueOptions + +--- #### Static Functions | **Name** | **Description** | | --- | --- | -| toFunctionHandler | Returns a `cloud.Function` handler for handling requests from a `cloud.Api`. | +| 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. | --- -##### `toFunctionHandler` +##### `onLiftType` ```wing bring aws; -aws.ApiEndpointHandler.toFunctionHandler(handler: IApiEndpointHandler, headers?: MutMap); +aws.Topic.onLiftType(host: IInflightHost, ops: MutArray); ``` -Returns a `cloud.Function` handler for handling requests from a `cloud.Api`. +A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. -###### `handler`Required +The list of requested inflight methods +needed by the inflight host are given by `ops`. -- *Type:* IApiEndpointHandler +This method is commonly used for adding permissions, environment variables, or +other capabilities to the inflight host. -The `onRequest` handler. +###### `host`Required ---- +- *Type:* IInflightHost -###### `headers`Optional +--- -- *Type:* MutMap<str> +###### `ops`Required -HTTP response headers to add to all responses (used by CORS). +- *Type:* MutArray<str> --- +##### `toInflight` +```wing +bring aws; -### AwsInflightHost +aws.Topic.toInflight(obj: IResource); +``` -Represents an inflight host on AWS. +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. -#### Static Functions +###### `obj`Required -| **Name** | **Description** | -| --- | --- | -| isAwsInflightHost | Returns `true` if `obj` implements `IAwsInflightHost`. | +- *Type:* IResource --- -##### `isAwsInflightHost` +##### `from` ```wing bring aws; -aws.AwsInflightHost.isAwsInflightHost(obj: any); +aws.Topic.from(topic: Topic); ``` -Returns `true` if `obj` implements `IAwsInflightHost`. +If the topic is an AWS SNS, return a helper interface for working with it. -###### `obj`Required +###### `topic`Required -- *Type:* any +- *Type:* Topic + +The cloud.Topic. --- +#### Properties +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| node | constructs.Node | The tree node. | +| topicArn | str | AWS Topic arn. | +| topicName | str | AWS Topic name. | -### Bucket +--- -A helper class for working with AWS buckets. +##### `node`Required -#### Initializers +```wing +node: Node; +``` + +- *Type:* constructs.Node + +The tree node. + +--- + +##### `topicArn`Required + +```wing +topicArn: str; +``` + +- *Type:* str + +AWS Topic arn. + +--- + +##### `topicName`Required + +```wing +topicName: str; +``` + +- *Type:* str + +AWS Topic name. + +--- + + +### Website + +- *Implements:* IAwsWebsite + +Base class for AWS Websites. + +#### Initializers ```wing bring aws; -new aws.Bucket(); +new aws.Website(props: WebsiteProps); ``` | **Name** | **Type** | **Description** | | --- | --- | --- | +| props | WebsiteProps | *No description.* | --- +##### `props`Required -#### Static Functions +- *Type:* WebsiteProps + +--- + +#### Methods | **Name** | **Description** | | --- | --- | -| from | If the bucket is an AWS Bucket, return a helper interface for working with it. | +| addFile | Add a file to the website during deployment. | +| addJson | Add a JSON file with custom values during the website's deployment. | --- -##### `from` +##### `addFile` ```wing -bring aws; - -aws.Bucket.from(bucket: Bucket); +addFile(path: str, data: str, options?: AddFileOptions): str ``` -If the bucket is an AWS Bucket, return a helper interface for working with it. +Add a file to the website during deployment. -###### `bucket`Required +If the path conflicts with file path from the website's static assets, an error will be thrown. -- *Type:* Bucket +###### `path`Required -The cloud.Bucket. +- *Type:* str + +the file path it will be uploaded as. --- +###### `data`Required + +- *Type:* str +the data to write to the file. -### BucketEventHandler +--- -Utility class to work with bucket event handlers. +###### `options`Optional -#### Initializers +- *Type:* AddFileOptions -```wing -bring aws; +configure the file's options. -new aws.BucketEventHandler(); +--- + +##### `addJson` + +```wing +addJson(path: str, data: Json): str ``` -| **Name** | **Type** | **Description** | -| --- | --- | --- | +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. + +###### `path`Required + +- *Type:* str + +the file path it will be uploaded as. --- +###### `data`Required + +- *Type:* Json + +the data to write to the file. + +--- #### Static Functions | **Name** | **Description** | | --- | --- | -| toTopicOnMessageHandler | Converts a `cloud.IBucketEventHandler` to a `cloud.ITopicOnMessageHandler`. | +| 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. | --- -##### `toTopicOnMessageHandler` +##### `onLiftType` ```wing bring aws; -aws.BucketEventHandler.toTopicOnMessageHandler(handler: IBucketEventHandler, eventType: BucketEventType); +aws.Website.onLiftType(host: IInflightHost, ops: MutArray); ``` -Converts a `cloud.IBucketEventHandler` to a `cloud.ITopicOnMessageHandler`. - -###### `handler`Required - -- *Type:* IBucketEventHandler - -the handler to convert. +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`. -###### `eventType`Required +This method is commonly used for adding permissions, environment variables, or +other capabilities to the inflight host. -- *Type:* BucketEventType +###### `host`Required -the event type. +- *Type:* IInflightHost --- +###### `ops`Required +- *Type:* MutArray<str> -### Counter - -A helper class for working with AWS Counters. +--- -#### Initializers +##### `toInflight` ```wing bring aws; -new aws.Counter(); +aws.Website.toInflight(obj: IResource); ``` -| **Name** | **Type** | **Description** | -| --- | --- | --- | - ---- +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. -#### Static Functions +###### `obj`Required -| **Name** | **Description** | -| --- | --- | -| from | If the table is an AWS Counter, return a helper interface for working with it. | +- *Type:* IResource --- -##### `from` +##### `from` ```wing bring aws; -aws.Counter.from(counter: Counter); +aws.Website.from(website: Website); ``` -If the table is an AWS Counter, return a helper interface for working with it. +If the bucket is an AWS Bucket, return a helper interface for working with it. -###### `counter`Required +###### `website`Required -- *Type:* Counter +- *Type:* Website -The cloud.Counter. +The cloud.Bucket. --- +#### Properties +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| node | constructs.Node | The tree node. | +| path | str | Absolute local path to the website's static files. | +| url | str | The website's url. | +| bucketArn | str | AWS Bucket arn. | +| bucketName | str | AWS Bucket name. | -### Function - -A helper class for working with AWS functions. +--- -#### Initializers +##### `node`Required ```wing -bring aws; - -new aws.Function(); +node: Node; ``` -| **Name** | **Type** | **Description** | -| --- | --- | --- | +- *Type:* constructs.Node + +The tree node. --- +##### `path`Required -#### Static Functions +```wing +path: str; +``` -| **Name** | **Description** | -| --- | --- | -| 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. | +- *Type:* str + +Absolute local path to the website's static files. --- -##### `context` +##### `url`Required ```wing -bring aws; - -aws.Function.context(); +url: str; ``` -Returns the current Lambda invocation context, if the host is an AWS Lambda. +- *Type:* str -> [https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html) +The website's url. -##### `from` +--- -```wing -bring aws; +##### `bucketArn`Required -aws.Function.from(host: IInflightHost); +```wing +bucketArn: str; ``` -If the inflight host is an AWS Lambda, return a helper interface for working with it. +- *Type:* str -###### `host`Required +AWS Bucket arn. -- *Type:* IInflightHost +--- -The inflight host. +##### `bucketName`Required + +```wing +bucketName: str; +``` + +- *Type:* str + +AWS Bucket name. --- +## Classes -### Queue +### ApiEndpointHandler -A helper class for working with AWS queues. +A helper class for working with AWS api endpoint handlers. -#### Initializers +#### Initializers ```wing bring aws; -new aws.Queue(); +new aws.ApiEndpointHandler(); ``` | **Name** | **Type** | **Description** | @@ -1125,86 +2962,79 @@ new aws.Queue(); | **Name** | **Description** | | --- | --- | -| from | If the queue is an AWS SQS, return a helper interface for working with it. | +| toFunctionHandler | Returns a `cloud.Function` handler for handling requests from a `cloud.Api`. | --- -##### `from` +##### `toFunctionHandler` ```wing bring aws; -aws.Queue.from(queue: Queue); +aws.ApiEndpointHandler.toFunctionHandler(handler: IApiEndpointHandler, headers?: MutMap); ``` -If the queue is an AWS SQS, return a helper interface for working with it. +Returns a `cloud.Function` handler for handling requests from a `cloud.Api`. -###### `queue`Required +###### `handler`Required -- *Type:* Queue +- *Type:* IApiEndpointHandler -The cloud.Queue. +The `onRequest` handler. --- +###### `headers`Optional +- *Type:* MutMap<str> -### QueueSetConsumerHandler - -Utility class for working with the queue consumer handler. +HTTP response headers to add to all responses (used by CORS). -#### Initializers +--- -```wing -bring aws; -new aws.QueueSetConsumerHandler(); -``` -| **Name** | **Type** | **Description** | -| --- | --- | --- | +### AwsInflightHost ---- +Represents an inflight host on AWS. #### Static Functions | **Name** | **Description** | | --- | --- | -| toFunctionHandler | Converts a queue consumer handler to a function handler. | +| isAwsInflightHost | Returns `true` if `obj` implements `IAwsInflightHost`. | --- -##### `toFunctionHandler` +##### `isAwsInflightHost` ```wing bring aws; -aws.QueueSetConsumerHandler.toFunctionHandler(handler: IQueueSetConsumerHandler); +aws.AwsInflightHost.isAwsInflightHost(obj: any); ``` -Converts a queue consumer handler to a function handler. - -###### `handler`Required +Returns `true` if `obj` implements `IAwsInflightHost`. -- *Type:* IQueueSetConsumerHandler +###### `obj`Required -The queue consumer handler. +- *Type:* any --- -### Topic +### BucketEventHandler -A helper class for working with AWS topics. +Utility class to work with bucket event handlers. -#### Initializers +#### Initializers ```wing bring aws; -new aws.Topic(); +new aws.BucketEventHandler(); ``` | **Name** | **Type** | **Description** | @@ -1217,40 +3047,48 @@ new aws.Topic(); | **Name** | **Description** | | --- | --- | -| from | If the topic is an AWS SNS, return a helper interface for working with it. | +| toTopicOnMessageHandler | Converts a `cloud.IBucketEventHandler` to a `cloud.ITopicOnMessageHandler`. | --- -##### `from` +##### `toTopicOnMessageHandler` ```wing bring aws; -aws.Topic.from(topic: Topic); +aws.BucketEventHandler.toTopicOnMessageHandler(handler: IBucketEventHandler, eventType: BucketEventType); ``` -If the topic is an AWS SNS, return a helper interface for working with it. +Converts a `cloud.IBucketEventHandler` to a `cloud.ITopicOnMessageHandler`. -###### `topic`Required +###### `handler`Required -- *Type:* Topic +- *Type:* IBucketEventHandler -The cloud.Topic. +the handler to convert. + +--- + +###### `eventType`Required + +- *Type:* BucketEventType + +the event type. --- -### TopicOnMessageHandler +### QueueSetConsumerHandler -A helper class for working with AWS topic on message handlers. +Utility class for working with the queue consumer handler. -#### Initializers +#### Initializers ```wing bring aws; -new aws.TopicOnMessageHandler(); +new aws.QueueSetConsumerHandler(); ``` | **Name** | **Type** | **Description** | @@ -1263,40 +3101,40 @@ new aws.TopicOnMessageHandler(); | **Name** | **Description** | | --- | --- | -| toFunctionHandler | Returns a `cloud.Function` handler for handling messages from a `cloud.Topic`. | +| toFunctionHandler | Converts a queue consumer handler to a function handler. | --- -##### `toFunctionHandler` +##### `toFunctionHandler` ```wing bring aws; -aws.TopicOnMessageHandler.toFunctionHandler(handler: ITopicOnMessageHandler); +aws.QueueSetConsumerHandler.toFunctionHandler(handler: IQueueSetConsumerHandler); ``` -Returns a `cloud.Function` handler for handling messages from a `cloud.Topic`. +Converts a queue consumer handler to a function handler. -###### `handler`Required +###### `handler`Required -- *Type:* ITopicOnMessageHandler +- *Type:* IQueueSetConsumerHandler -The `onMessage` handler. +The queue consumer handler. --- -### Website +### TopicOnMessageHandler -A helper class for working with AWS buckets. +A helper class for working with AWS topic on message handlers. -#### Initializers +#### Initializers ```wing bring aws; -new aws.Website(); +new aws.TopicOnMessageHandler(); ``` | **Name** | **Type** | **Description** | @@ -1309,25 +3147,25 @@ new aws.Website(); | **Name** | **Description** | | --- | --- | -| from | If the bucket is an AWS Bucket, return a helper interface for working with it. | +| toFunctionHandler | Returns a `cloud.Function` handler for handling messages from a `cloud.Topic`. | --- -##### `from` +##### `toFunctionHandler` ```wing bring aws; -aws.Website.from(website: Website); +aws.TopicOnMessageHandler.toFunctionHandler(handler: ITopicOnMessageHandler); ``` -If the bucket is an AWS Bucket, return a helper interface for working with it. +Returns a `cloud.Function` handler for handling messages from a `cloud.Topic`. -###### `website`Required +###### `handler`Required -- *Type:* Website +- *Type:* ITopicOnMessageHandler -The cloud.Bucket. +The `onMessage` handler. --- @@ -1516,7 +3354,7 @@ Resources. ### IAwsApi -- *Implemented By:* IAwsApi +- *Implemented By:* Api, IAwsApi A shared interface for AWS api. @@ -1608,7 +3446,7 @@ RestApi stage name. ### IAwsBucket -- *Implemented By:* IAwsBucket +- *Implemented By:* Bucket, IAwsBucket A shared interface for AWS buckets. @@ -1661,7 +3499,7 @@ AWS Bucket name. ### IAwsCounter -- *Implemented By:* IAwsCounter +- *Implemented By:* Counter, IAwsCounter A shared interface for AWS Counter. @@ -1703,7 +3541,7 @@ AWS Dynamodb name. - *Extends:* IAwsInflightHost -- *Implemented By:* IAwsFunction +- *Implemented By:* Function, IAwsFunction A shared interface for AWS functions. @@ -1781,7 +3619,7 @@ AWS Function name. - *Extends:* IInflightHost -- *Implemented By:* IAwsFunction, IAwsInflightHost +- *Implemented By:* Function, Service, IAwsFunction, IAwsInflightHost, IAwsService Represents an `IInflightHost` on AWS. @@ -1846,7 +3684,7 @@ The tree node. ### IAwsQueue -- *Implemented By:* IAwsQueue +- *Implemented By:* Queue, IAwsQueue A shared interface for AWS queues. @@ -1897,9 +3735,91 @@ AWS Queue url. --- +### IAwsSecret + +- *Implemented By:* Secret, IAwsSecret + +Shared interface for AWS Secrets. + + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| secretArn | str | AWS Secret ARN. | + +--- + +##### `secretArn`Required + +```wing +secretArn: str; +``` + +- *Type:* str + +AWS Secret ARN. + +--- + +### IAwsService + +- *Extends:* IAwsInflightHost + +- *Implemented By:* Service, IAwsService + +Shared interface for AWS Services. + + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| node | constructs.Node | The tree node. | +| clusterName | str | AWS ECS cluster name. | +| serviceName | str | AWS ECS service name. | + +--- + +##### `node`Required + +```wing +node: Node; +``` + +- *Type:* constructs.Node + +The tree node. + +--- + +##### `clusterName`Required + +```wing +clusterName: str; +``` + +- *Type:* str + +AWS ECS cluster name. + +--- + +##### `serviceName`Required + +```wing +serviceName: str; +``` + +- *Type:* str + +AWS ECS service name. + +--- + ### IAwsTopic -- *Implemented By:* IAwsTopic +- *Implemented By:* Topic, IAwsTopic A shared interface for AWS topics. @@ -1939,7 +3859,7 @@ AWS Topic name. ### IAwsWebsite -- *Implemented By:* IAwsWebsite +- *Implemented By:* Website, IAwsWebsite A shared interface for AWS website. diff --git a/api_versioned_docs/version-latest/04-standard-library/cloud/website.md b/api_versioned_docs/version-latest/04-standard-library/cloud/website.md index 0a0ebde3..276abf3d 100644 --- a/api_versioned_docs/version-latest/04-standard-library/cloud/website.md +++ b/api_versioned_docs/version-latest/04-standard-library/cloud/website.md @@ -501,7 +501,7 @@ The website's custom domain object. ### IWebsite -- *Implemented By:* Website, IWebsite +- *Implemented By:* Website, Website, IWebsite Base interface for a website. diff --git a/api_versioned_docs/version-latest/04-standard-library/std/resource.md b/api_versioned_docs/version-latest/04-standard-library/std/resource.md index 68a8b0c7..843ab9f7 100644 --- a/api_versioned_docs/version-latest/04-standard-library/std/resource.md +++ b/api_versioned_docs/version-latest/04-standard-library/std/resource.md @@ -75,7 +75,7 @@ Operations to lift on the object. - *Extends:* ILiftable -- *Implemented By:* BucketRef, Domain, FunctionRef, QueueRef, SecretRef, Api, Bucket, Counter, Domain, Endpoint, Function, OnDeploy, Queue, Schedule, Secret, Service, Topic, Website, Container, Policy, Resource, State, AutoIdResource, Resource, Test, TestRunner, Button, Field, FileBrowser, HttpClient, Section, Table, ValueField, VisualComponent, IAwsFunction, IAwsInflightHost, IApiEndpointHandler, IBucketEventHandler, IFunctionHandler, IOnDeployHandler, IQueueSetConsumerHandler, IScheduleOnTickHandler, IServiceHandler, IServiceStopHandler, ITopicOnMessageHandler, IResourceFactory, ISimulatorInflightHost, ISimulatorResource, IHostedLiftable, IInflight, IInflightHost, IResource, ITestHandler, IButtonHandler, IFieldHandler, IFileBrowserDeleteHandler, IFileBrowserGetHandler, IFileBrowserListHandler, IFileBrowserPutHandler, IHttpClientGetApiSpecHandler, IHttpClientGetUrlHandler, ITableScanHandler, IPredicateHandler +- *Implemented By:* Api, Bucket, BucketRef, Counter, Domain, Function, FunctionRef, Queue, QueueRef, Secret, SecretRef, Service, Topic, Website, Api, Bucket, Counter, Domain, Endpoint, Function, OnDeploy, Queue, Schedule, Secret, Service, Topic, Website, Container, Policy, Resource, State, AutoIdResource, Resource, Test, TestRunner, Button, Field, FileBrowser, HttpClient, Section, Table, ValueField, VisualComponent, IAwsFunction, IAwsInflightHost, IAwsService, IApiEndpointHandler, IBucketEventHandler, IFunctionHandler, IOnDeployHandler, IQueueSetConsumerHandler, IScheduleOnTickHandler, IServiceHandler, IServiceStopHandler, ITopicOnMessageHandler, IResourceFactory, ISimulatorInflightHost, ISimulatorResource, IHostedLiftable, IInflight, IInflightHost, IResource, ITestHandler, IButtonHandler, IFieldHandler, IFileBrowserDeleteHandler, IFileBrowserGetHandler, IFileBrowserListHandler, IFileBrowserPutHandler, IHttpClientGetApiSpecHandler, IHttpClientGetUrlHandler, ITableScanHandler, IPredicateHandler A liftable object that needs to be registered on the host as part of the lifting process.