Skip to content

Commit e9fc330

Browse files
authored
Initial golang and typescript SDK and templates (#271)
* 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
1 parent d5f7426 commit e9fc330

File tree

101 files changed

+18582
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+18582
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ go.work
3434
.history/
3535
# Built Visual Studio Code Extensions
3636
*.vsix
37+
38+
sdk/typescript/node_modules/*
39+
sdk/typescript/bin/*

.vscode/settings.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"jasmineExplorer.nodeArgv": [
3+
"-r",
4+
"ts-node/register"
5+
],
6+
"jasmineExplorer.config": "sdk/typescript/jasmine.json",
7+
}

CHANGELOG_PENDING.md

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
- Add support for rolling back to a specific version of an environment.
2222
[#305](https://github.com/pulumi/esc/pull/305)
2323

24+
- Add a new ESC SDK for Go and Typescript
25+
[#271](https://github.com/pulumi/esc/pull/271)
26+
2427
### Bug Fixes
2528

2629
- Ensure that redacted output is flushed in `esc run`

Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,11 @@ test:: build
4141

4242
test_cover:: build
4343
${GO} test --timeout 30m -count 1 -coverpkg=github.com/pulumi/esc/... -race -coverprofile=coverage.out -parallel ${CONCURRENCY} ./...
44+
45+
.PHONY: generate_go_client_sdk
46+
generate_go_client_sdk:
47+
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
48+
49+
.PHONY: generate_ts_client_sdk
50+
generate_ts_client_sdk:
51+
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

openapitools.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
3+
"spaces": 2,
4+
"generator-cli": {
5+
"version": "7.4.0"
6+
}
7+
}

sdk/esc-api.rest

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
@token = {{$processEnv PULUMI_ACCESS_TOKEN}}
2+
@organization = {{$processEnv PULUMI_ORG}}
3+
4+
GET https://api.pulumi.com/api/preview/environments/{{organization}} HTTP/1.1
5+
Authorization: token {{token}}
6+
###
7+
8+
GET https://api.pulumi.com/api/preview/environments/{{organization}}/sdk-test HTTP/1.1
9+
Authorization: token {{token}}
10+
11+
###
12+
# @name openAPI
13+
POST https://api.pulumi.com/api/preview/environments/{{organization}}/sdk-test/open?duration=1h HTTP/1.1
14+
Authorization: token {{token}}
15+
16+
@openId = {{openAPI.response.body.id}}
17+
###
18+
GET https://api.pulumi.com/api/preview/environments/{{organization}}/sdk-test/open/{{openId}} HTTP/1.1
19+
Authorization: token {{token}}
20+
21+
###
22+
23+
HEAD https://api.pulumi.com/api/preview/environments/{{organization}}/sdk-test HTTP/1.1
24+
Authorization: token {{token}}
25+
26+
###
27+
28+
POST https://api.pulumi.com/api/preview/environments/{{organization}}/sdk-test HTTP/1.1
29+
Authorization: token {{token}}
30+
Content-Type: application/yaml
31+
32+
###
33+
34+
PATCH https://api.pulumi.com/api/preview/environments/{{organization}}/sdk-test HTTP/1.1
35+
Authorization: token {{token}}
36+
Content-Type: application/yaml
37+
38+
values:
39+
foo: bar
40+
baz: auto
41+
test: 123
42+
43+
###
44+
45+
DELETE https://api.pulumi.com/api/preview/environments/{{organization}}/sdk-test HTTP/1.1
46+
Authorization: token {{token}}

sdk/go/.openapi-generator-ignore

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
24+
25+
git_push.sh
26+
.travis.yml
27+
.gitignore
28+
README.md
29+
test/*
30+
docs/*
31+
api/*

sdk/go/.openapi-generator/FILES

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
api_esc.go
2+
client.go
3+
configuration.go
4+
model_access.go
5+
model_accessor.go
6+
model_check_environment.go
7+
model_environment.go
8+
model_environment_definition.go
9+
model_environment_definition_values.go
10+
model_environment_diagnostic.go
11+
model_environment_diagnostics.go
12+
model_error.go
13+
model_evaluated_execution_context.go
14+
model_expr.go
15+
model_expr_builtin.go
16+
model_interpolation.go
17+
model_open_environment.go
18+
model_org_environment.go
19+
model_org_environments.go
20+
model_pos.go
21+
model_property_accessor.go
22+
model_range.go
23+
model_reference.go
24+
model_trace.go
25+
model_value.go
26+
response.go
27+
utils.go

sdk/go/.openapi-generator/VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.4.0

0 commit comments

Comments
 (0)