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 golang and typescript SDK and templates #271

Merged
merged 11 commits into from
May 23, 2024
Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ go.work
.history/
# Built Visual Studio Code Extensions
*.vsix

sdk/typescript/node_modules/*
sdk/typescript/bin/*
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"jasmineExplorer.nodeArgv": [
"-r",
"ts-node/register"
],
"jasmineExplorer.config": "sdk/typescript/jasmine.json",
}
3 changes: 3 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
- Add support for rolling back to a specific version of an environment.
[#305](https://github.com/pulumi/esc/pull/305)

- Add a new ESC SDK for Go and Typescript
[#271](https://github.com/pulumi/esc/pull/271)

### Bug Fixes

- Ensure that redacted output is flushed in `esc run`
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@ test:: build

test_cover:: build
${GO} test --timeout 30m -count 1 -coverpkg=github.com/pulumi/esc/... -race -coverprofile=coverage.out -parallel ${CONCURRENCY} ./...

.PHONY: generate_go_client_sdk
generate_go_client_sdk:
GO_POST_PROCESS_FILE="/usr/local/bin/gofmt -w" openapi-generator-cli generate -i ./sdk/swagger.yaml -p packageName=esc_sdk,withGoMod=false,isGoSubmodule=true,userAgent=esc-sdk/go/${VERSION} -t ./sdk/templates/go -g go -o ./sdk/go --git-repo-id esc --git-user-id pulumi

.PHONY: generate_ts_client_sdk
generate_ts_client_sdk:
TS_POST_PROCESS_FILE="/usr/local/bin/prettier --write" openapi-generator-cli generate -i ./sdk/swagger.yaml -p npmName=@pulumi/esc-sdk,userAgent=esc-sdk/ts/${VERSION} -t ./sdk/templates/typescript --enable-post-process-file -g typescript-axios -o ./sdk/typescript/esc/raw --git-repo-id esc --git-user-id pulumi
7 changes: 7 additions & 0 deletions openapitools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "7.4.0"
}
}
46 changes: 46 additions & 0 deletions sdk/esc-api.rest
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@token = {{$processEnv PULUMI_ACCESS_TOKEN}}
@organization = {{$processEnv PULUMI_ORG}}

GET https://api.pulumi.com/api/preview/environments/{{organization}} HTTP/1.1
Authorization: token {{token}}
###

GET https://api.pulumi.com/api/preview/environments/{{organization}}/sdk-test HTTP/1.1
Authorization: token {{token}}

###
# @name openAPI
POST https://api.pulumi.com/api/preview/environments/{{organization}}/sdk-test/open?duration=1h HTTP/1.1
Authorization: token {{token}}

@openId = {{openAPI.response.body.id}}
###
GET https://api.pulumi.com/api/preview/environments/{{organization}}/sdk-test/open/{{openId}} HTTP/1.1
Authorization: token {{token}}

###

HEAD https://api.pulumi.com/api/preview/environments/{{organization}}/sdk-test HTTP/1.1
Authorization: token {{token}}

###

POST https://api.pulumi.com/api/preview/environments/{{organization}}/sdk-test HTTP/1.1
Authorization: token {{token}}
Content-Type: application/yaml

###

PATCH https://api.pulumi.com/api/preview/environments/{{organization}}/sdk-test HTTP/1.1
Authorization: token {{token}}
Content-Type: application/yaml

values:
foo: bar
baz: auto
test: 123

###

DELETE https://api.pulumi.com/api/preview/environments/{{organization}}/sdk-test HTTP/1.1
Authorization: token {{token}}
31 changes: 31 additions & 0 deletions sdk/go/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

git_push.sh
.travis.yml
.gitignore
README.md
test/*
docs/*
api/*
27 changes: 27 additions & 0 deletions sdk/go/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
api_esc.go
client.go
configuration.go
model_access.go
model_accessor.go
model_check_environment.go
model_environment.go
model_environment_definition.go
model_environment_definition_values.go
model_environment_diagnostic.go
model_environment_diagnostics.go
model_error.go
model_evaluated_execution_context.go
model_expr.go
model_expr_builtin.go
model_interpolation.go
model_open_environment.go
model_org_environment.go
model_org_environments.go
model_pos.go
model_property_accessor.go
model_range.go
model_reference.go
model_trace.go
model_value.go
response.go
utils.go
1 change: 1 addition & 0 deletions sdk/go/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.4.0
Loading
Loading