Skip to content

Commit

Permalink
Initial golang and typescript SDK and templates (#271)
Browse files Browse the repository at this point in the history
* Initial golang and typescript SDK and templates

* Some fixes to tests

* fix esc package name for go sdk

* add files

* Add copyright to go sdk

* pr comments

* More copyrights

* Fix prettier issues

* Add changelog

* Add support for pulumi source and user agent
  • Loading branch information
cleverguy25 authored May 23, 2024
1 parent d5f7426 commit e9fc330
Show file tree
Hide file tree
Showing 101 changed files with 18,582 additions and 0 deletions.
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

0 comments on commit e9fc330

Please sign in to comment.