Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial work on pulumi platform provider #330

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/canary.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/pull-request-lint.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions .github/workflows/pulumi-pull.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions .github/workflows/pulumi-release.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .mergify.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ publishing them for you.
| [ngrok](./ngrok) | [@winglibs/ngrok](https://www.npmjs.com/package/@winglibs/ngrok) | * |
| [openai](./openai) | [@winglibs/openai](https://www.npmjs.com/package/@winglibs/openai) | * |
| [postgres](./postgres) | [@winglibs/postgres](https://www.npmjs.com/package/@winglibs/postgres) | sim, tf-aws |
| [pulumi](./pulumi) | [@winglibs/pulumi](https://www.npmjs.com/package/@winglibs/pulumi) | sim |
| [python](./python) | [@winglibs/python](https://www.npmjs.com/package/@winglibs/python) | sim, tf-aws |
| [react](./react) | [@winglibs/react](https://www.npmjs.com/package/@winglibs/react) | sim, tf-aws |
| [redis](./redis) | [@winglibs/redis](https://www.npmjs.com/package/@winglibs/redis) | sim |
Expand Down
2 changes: 2 additions & 0 deletions pulumi/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target/
node_modules/
21 changes: 21 additions & 0 deletions pulumi/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Wing

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
27 changes: 27 additions & 0 deletions pulumi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# pulumi

## Prerequisites

* [winglang](https://winglang.io).

## Installation

```sh
npm i @winglibs/pulumi
```

## Usage

```js
bring pulumi;

let adder = new pulumi.Adder();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you also added support for compiling some standard lib resources to pulumi (bucket, queue and function). Should this be documented here too?

```

## Coverage



## License

This library is licensed under the [MIT License](./LICENSE).
20 changes: 20 additions & 0 deletions pulumi/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -euo pipefail

scriptdir=$(cd $(dirname $0) && pwd)

entrypoint=${1:-}

if [ -z "$entrypoint" ]; then
echo "Usage: $0 <entrypoint>"
exit 1
fi

basename=$(basename $entrypoint .w)
dirname=$(dirname $entrypoint)
echo $dirname

wing compile -t $scriptdir/lib/index.js $entrypoint

cd $dirname/target/${basename}.pulumi
pulumi up
10 changes: 10 additions & 0 deletions pulumi/examples/bucket.main.w
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
bring cloud;

let b = new cloud.Bucket(public: true, cors: true);

b.addObject("first.txt", "Uploaded during deployment");

new cloud.Function(inflight () => {
b.put("hello.txt", "Hello, World!");
});

6 changes: 6 additions & 0 deletions pulumi/examples/function.main.w
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bring cloud;

new cloud.Function(inflight () => {
log("hey!");
return "Hello, World!";
});
11 changes: 11 additions & 0 deletions pulumi/examples/queue.main.w
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
bring cloud;

let queue = new cloud.Queue();

let b = new cloud.Bucket();

queue.setConsumer(inflight (message) => {
log("new message: {message}");
b.put("hello.txt", message);
});

8 changes: 8 additions & 0 deletions pulumi/lib.test.w
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
bring expect;
bring "./lib.w" as l;

let adder = new l.Adder();

test "add() adds two numbers" {
expect.equal(adder.add(1, 2), 3);
}
5 changes: 5 additions & 0 deletions pulumi/lib.w
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pub class Adder {
pub inflight add(x: num, y: num): num {
return x + y;
}
}
Loading
Loading