Skip to content

Commit

Permalink
feat(sdk): custom inflight hosts for aws resources (#6508)
Browse files Browse the repository at this point in the history
Previously, AWS resources could only be lifted into AWS Lambda functions. This changes allows any object that implements the `IAwsInflightHost` interface to be used as a host.

Misc: added `std.Resource.toInflight(obj)` which can be used to call the internal `_toInflight()` implementation of a preflight object.

## Checklist

- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [x] Tests added (always)
- [x] Docs updated (only required for features)
- [x] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
  • Loading branch information
eladb authored May 18, 2024
1 parent 4160efc commit 75206d8
Show file tree
Hide file tree
Showing 66 changed files with 1,162 additions and 212 deletions.
271 changes: 241 additions & 30 deletions docs/docs/04-standard-library/aws/api-reference.md

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions docs/docs/04-standard-library/cloud/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ Options for the route.
| **Name** | **Description** |
| --- | --- |
| <code><a href="#@winglang/sdk.cloud.Api.onLiftType">onLiftType</a></code> | A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. |
| <code><a href="#@winglang/sdk.cloud.Api.toInflight">toInflight</a></code> | Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource. |
| <code><a href="#@winglang/sdk.cloud.Api.renderCorsHeaders">renderCorsHeaders</a></code> | Generates an object containing default CORS response headers and OPTIONS response headers. |
| <code><a href="#@winglang/sdk.cloud.Api.renderOpenApiPath">renderOpenApiPath</a></code> | Converts input path to a valid OpenAPI path (replaces `:` based path params with `{}`). |
Expand Down Expand Up @@ -454,6 +455,24 @@ other capabilities to the inflight host.
---
##### `toInflight` <a name="toInflight" id="@winglang/sdk.cloud.Api.toInflight"></a>
```wing
bring cloud;

cloud.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`<sup>Required</sup> <a name="obj" id="@winglang/sdk.cloud.Api.toInflight.parameter.obj"></a>
- *Type:* <a href="#@winglang/sdk.std.IResource">IResource</a>
---
##### `renderCorsHeaders` <a name="renderCorsHeaders" id="@winglang/sdk.cloud.Api.renderCorsHeaders"></a>
```wing
Expand Down
19 changes: 19 additions & 0 deletions docs/docs/04-standard-library/cloud/bucket.md
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ Key of the object.
| **Name** | **Description** |
| --- | --- |
| <code><a href="#@winglang/sdk.cloud.Bucket.onLiftType">onLiftType</a></code> | A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. |
| <code><a href="#@winglang/sdk.cloud.Bucket.toInflight">toInflight</a></code> | Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource. |

---

Expand Down Expand Up @@ -670,6 +671,24 @@ other capabilities to the inflight host.

---

##### `toInflight` <a name="toInflight" id="@winglang/sdk.cloud.Bucket.toInflight"></a>

```wing
bring cloud;
cloud.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`<sup>Required</sup> <a name="obj" id="@winglang/sdk.cloud.Bucket.toInflight.parameter.obj"></a>

- *Type:* <a href="#@winglang/sdk.std.IResource">IResource</a>

---

#### Properties <a name="Properties" id="Properties"></a>

| **Name** | **Type** | **Description** |
Expand Down
19 changes: 19 additions & 0 deletions docs/docs/04-standard-library/cloud/counter.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ specify the key to be set.
| **Name** | **Description** |
| --- | --- |
| <code><a href="#@winglang/sdk.cloud.Counter.onLiftType">onLiftType</a></code> | A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. |
| <code><a href="#@winglang/sdk.cloud.Counter.toInflight">toInflight</a></code> | Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource. |

---

Expand Down Expand Up @@ -255,6 +256,24 @@ other capabilities to the inflight host.

---

##### `toInflight` <a name="toInflight" id="@winglang/sdk.cloud.Counter.toInflight"></a>

```wing
bring cloud;
cloud.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`<sup>Required</sup> <a name="obj" id="@winglang/sdk.cloud.Counter.toInflight.parameter.obj"></a>

- *Type:* <a href="#@winglang/sdk.std.IResource">IResource</a>

---

#### Properties <a name="Properties" id="Properties"></a>

| **Name** | **Type** | **Description** |
Expand Down
19 changes: 19 additions & 0 deletions docs/docs/04-standard-library/cloud/domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ new cloud.Domain(props: DomainProps);
| **Name** | **Description** |
| --- | --- |
| <code><a href="#@winglang/sdk.cloud.Domain.onLiftType">onLiftType</a></code> | A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. |
| <code><a href="#@winglang/sdk.cloud.Domain.toInflight">toInflight</a></code> | Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource. |

---

Expand Down Expand Up @@ -125,6 +126,24 @@ other capabilities to the inflight host.

---

##### `toInflight` <a name="toInflight" id="@winglang/sdk.cloud.Domain.toInflight"></a>

```wing
bring cloud;
cloud.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`<sup>Required</sup> <a name="obj" id="@winglang/sdk.cloud.Domain.toInflight.parameter.obj"></a>

- *Type:* <a href="#@winglang/sdk.std.IResource">IResource</a>

---

#### Properties <a name="Properties" id="Properties"></a>

| **Name** | **Type** | **Description** |
Expand Down
19 changes: 19 additions & 0 deletions docs/docs/04-standard-library/cloud/endpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ new cloud.Endpoint(url: str, props?: EndpointProps);
| **Name** | **Description** |
| --- | --- |
| <code><a href="#@winglang/sdk.cloud.Endpoint.onLiftType">onLiftType</a></code> | A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. |
| <code><a href="#@winglang/sdk.cloud.Endpoint.toInflight">toInflight</a></code> | Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource. |

---

Expand Down Expand Up @@ -204,6 +205,24 @@ other capabilities to the inflight host.

---

##### `toInflight` <a name="toInflight" id="@winglang/sdk.cloud.Endpoint.toInflight"></a>

```wing
bring cloud;
cloud.Endpoint.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`<sup>Required</sup> <a name="obj" id="@winglang/sdk.cloud.Endpoint.toInflight.parameter.obj"></a>

- *Type:* <a href="#@winglang/sdk.std.IResource">IResource</a>

---

#### Properties <a name="Properties" id="Properties"></a>

| **Name** | **Type** | **Description** |
Expand Down
19 changes: 19 additions & 0 deletions docs/docs/04-standard-library/cloud/function.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ If not defined, an empty string will be passed.
| **Name** | **Description** |
| --- | --- |
| <code><a href="#@winglang/sdk.cloud.Function.onLiftType">onLiftType</a></code> | A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. |
| <code><a href="#@winglang/sdk.cloud.Function.toInflight">toInflight</a></code> | Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource. |
---
Expand Down Expand Up @@ -280,6 +281,24 @@ other capabilities to the inflight host.
---
##### `toInflight` <a name="toInflight" id="@winglang/sdk.cloud.Function.toInflight"></a>
```wing
bring cloud;

cloud.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`<sup>Required</sup> <a name="obj" id="@winglang/sdk.cloud.Function.toInflight.parameter.obj"></a>
- *Type:* <a href="#@winglang/sdk.std.IResource">IResource</a>
---
#### Properties <a name="Properties" id="Properties"></a>
| **Name** | **Type** | **Description** |
Expand Down
19 changes: 19 additions & 0 deletions docs/docs/04-standard-library/cloud/on-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ new cloud.OnDeploy(handler: IOnDeployHandler, props?: OnDeployProps);
| **Name** | **Description** |
| --- | --- |
| <code><a href="#@winglang/sdk.cloud.OnDeploy.onLiftType">onLiftType</a></code> | A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. |
| <code><a href="#@winglang/sdk.cloud.OnDeploy.toInflight">toInflight</a></code> | Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource. |

---

Expand Down Expand Up @@ -135,6 +136,24 @@ other capabilities to the inflight host.

---

##### `toInflight` <a name="toInflight" id="@winglang/sdk.cloud.OnDeploy.toInflight"></a>

```wing
bring cloud;
cloud.OnDeploy.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`<sup>Required</sup> <a name="obj" id="@winglang/sdk.cloud.OnDeploy.toInflight.parameter.obj"></a>

- *Type:* <a href="#@winglang/sdk.std.IResource">IResource</a>

---

#### Properties <a name="Properties" id="Properties"></a>

| **Name** | **Type** | **Description** |
Expand Down
19 changes: 19 additions & 0 deletions docs/docs/04-standard-library/cloud/queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ Each message must be non-empty.
| **Name** | **Description** |
| --- | --- |
| <code><a href="#@winglang/sdk.cloud.Queue.onLiftType">onLiftType</a></code> | A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. |
| <code><a href="#@winglang/sdk.cloud.Queue.toInflight">toInflight</a></code> | Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource. |

---

Expand Down Expand Up @@ -262,6 +263,24 @@ other capabilities to the inflight host.

---

##### `toInflight` <a name="toInflight" id="@winglang/sdk.cloud.Queue.toInflight"></a>

```wing
bring cloud;
cloud.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`<sup>Required</sup> <a name="obj" id="@winglang/sdk.cloud.Queue.toInflight.parameter.obj"></a>

- *Type:* <a href="#@winglang/sdk.std.IResource">IResource</a>

---

#### Properties <a name="Properties" id="Properties"></a>

| **Name** | **Type** | **Description** |
Expand Down
19 changes: 19 additions & 0 deletions docs/docs/04-standard-library/cloud/schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ Create a function that runs when receiving the scheduled event.
| **Name** | **Description** |
| --- | --- |
| <code><a href="#@winglang/sdk.cloud.Schedule.onLiftType">onLiftType</a></code> | A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. |
| <code><a href="#@winglang/sdk.cloud.Schedule.toInflight">toInflight</a></code> | Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource. |

---

Expand Down Expand Up @@ -152,6 +153,24 @@ other capabilities to the inflight host.

---

##### `toInflight` <a name="toInflight" id="@winglang/sdk.cloud.Schedule.toInflight"></a>

```wing
bring cloud;
cloud.Schedule.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`<sup>Required</sup> <a name="obj" id="@winglang/sdk.cloud.Schedule.toInflight.parameter.obj"></a>

- *Type:* <a href="#@winglang/sdk.std.IResource">IResource</a>

---

#### Properties <a name="Properties" id="Properties"></a>

| **Name** | **Type** | **Description** |
Expand Down
19 changes: 19 additions & 0 deletions docs/docs/04-standard-library/cloud/secret.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ Retrieve the Json value of the secret.
| **Name** | **Description** |
| --- | --- |
| <code><a href="#@winglang/sdk.cloud.Secret.onLiftType">onLiftType</a></code> | A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. |
| <code><a href="#@winglang/sdk.cloud.Secret.toInflight">toInflight</a></code> | Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource. |

---

Expand Down Expand Up @@ -183,6 +184,24 @@ other capabilities to the inflight host.

---

##### `toInflight` <a name="toInflight" id="@winglang/sdk.cloud.Secret.toInflight"></a>

```wing
bring cloud;
cloud.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`<sup>Required</sup> <a name="obj" id="@winglang/sdk.cloud.Secret.toInflight.parameter.obj"></a>

- *Type:* <a href="#@winglang/sdk.std.IResource">IResource</a>

---

#### Properties <a name="Properties" id="Properties"></a>

| **Name** | **Type** | **Description** |
Expand Down
19 changes: 19 additions & 0 deletions docs/docs/04-standard-library/cloud/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ Stop the service.
| **Name** | **Description** |
| --- | --- |
| <code><a href="#@winglang/sdk.cloud.Service.onLiftType">onLiftType</a></code> | A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. |
| <code><a href="#@winglang/sdk.cloud.Service.toInflight">toInflight</a></code> | Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource. |

---

Expand Down Expand Up @@ -261,6 +262,24 @@ other capabilities to the inflight host.

---

##### `toInflight` <a name="toInflight" id="@winglang/sdk.cloud.Service.toInflight"></a>

```wing
bring cloud;
cloud.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`<sup>Required</sup> <a name="obj" id="@winglang/sdk.cloud.Service.toInflight.parameter.obj"></a>

- *Type:* <a href="#@winglang/sdk.std.IResource">IResource</a>

---

#### Properties <a name="Properties" id="Properties"></a>

| **Name** | **Type** | **Description** |
Expand Down
19 changes: 19 additions & 0 deletions docs/docs/04-standard-library/cloud/topic.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ Payload to publish to Topic.
| **Name** | **Description** |
| --- | --- |
| <code><a href="#@winglang/sdk.cloud.Topic.onLiftType">onLiftType</a></code> | A hook called by the Wing compiler once for each inflight host that needs to use this type inflight. |
| <code><a href="#@winglang/sdk.cloud.Topic.toInflight">toInflight</a></code> | Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource. |

---

Expand Down Expand Up @@ -254,6 +255,24 @@ other capabilities to the inflight host.

---

##### `toInflight` <a name="toInflight" id="@winglang/sdk.cloud.Topic.toInflight"></a>

```wing
bring cloud;
cloud.Topic.toInflight(obj: IResource);
```

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

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

###### `obj`<sup>Required</sup> <a name="obj" id="@winglang/sdk.cloud.Topic.toInflight.parameter.obj"></a>

- *Type:* <a href="#@winglang/sdk.std.IResource">IResource</a>

---

#### Properties <a name="Properties" id="Properties"></a>

| **Name** | **Type** | **Description** |
Expand Down
Loading

0 comments on commit 75206d8

Please sign in to comment.