Skip to content

Commit

Permalink
Switch C# codegen to schema (#1132)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhailshilkov authored May 29, 2020
1 parent 61b22dd commit 72b173c
Show file tree
Hide file tree
Showing 1,310 changed files with 67,485 additions and 71,244 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
## HEAD (Unreleased)

### Improvements

- .NET SDK updated to align with other Pulumi .NET SDKs. (https://github.com/pulumi/pulumi-kubernetes/pull/1132)
- Deprecated resources are now marked as `Obsolete`.
- Many classes are moved to new locations on disk while preserving the public namespaces and API.
- Several unused argument/output classes were removed without any impact on resources (e.g. `DeploymentRollbackArgs`).
- Fixed the type of some properties in `JSONSchemaPropsArgs` (there's no need to have 2nd-level inputs there):
- `InputList<InputJson>` -> `InputList<JsonElement>`
- `InputMap<Union<TArgs, InputList<string>>>` -> `InputMap<Union<TArgs, ImmutableArray<string>>>`

## 2.2.2 (May 27, 2020)

- 2.2.1 SDK release process failed, so pushing a new tag.
Expand Down
63 changes: 10 additions & 53 deletions provider/cmd/pulumi-gen-kubernetes/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi-kubernetes/provider/v2/pkg/gen"
"github.com/pulumi/pulumi/pkg/v2/codegen"
dotnetgen "github.com/pulumi/pulumi/pkg/v2/codegen/dotnet"
gogen "github.com/pulumi/pulumi/pkg/v2/codegen/go"
"github.com/pulumi/pulumi/pkg/v2/codegen/schema"
"github.com/pulumi/pulumi/sdk/v2/go/common/util/contract"
Expand Down Expand Up @@ -100,7 +101,7 @@ func main() {
writePythonClient(data, outdir, templateDir)
case "dotnet":
templateDir := path.Join(TemplateDir, "dotnet-templates")
writeDotnetClient(data, outdir, templateDir)
writeDotnetClient(pkg, data, outdir, templateDir)
case "go":
templateDir := path.Join(TemplateDir, "go-templates")
writeGoClient(pkg, outdir, templateDir)
Expand Down Expand Up @@ -272,73 +273,29 @@ func writePythonClient(data map[string]interface{}, outdir, templateDir string)
}
}

func writeDotnetClient(data map[string]interface{}, outdir, templateDir string) {

inputAPIcs, ouputAPIcs, yamlcs, kindsCs, err := gen.DotnetClient(data, templateDir)
if err != nil {
panic(err)
}

err = os.MkdirAll(outdir, 0700)
if err != nil {
panic(err)
}

typesDir := fmt.Sprintf("%s/Types", outdir)
err = os.MkdirAll(typesDir, 0700)
if err != nil {
panic(err)
}

err = ioutil.WriteFile(fmt.Sprintf("%s/Input.cs", typesDir), []byte(inputAPIcs), 0777)
if err != nil {
panic(err)
}

err = ioutil.WriteFile(fmt.Sprintf("%s/Output.cs", typesDir), []byte(ouputAPIcs), 0777)
if err != nil {
panic(err)
}

err = ioutil.WriteFile(fmt.Sprintf("%s/Yaml/Yaml.cs", outdir), []byte(yamlcs), 0777)
func writeDotnetClient(pkg *schema.Package, data map[string]interface{}, outdir, templateDir string) {
files, err := dotnetgen.GeneratePackage("pulumigen", pkg, nil)
if err != nil {
panic(err)
}
for filename, contents := range files {
path := filepath.Join(outdir, filename)

for path, contents := range kindsCs {
filename := filepath.Join(outdir, path)
err := os.MkdirAll(filepath.Dir(filename), 0700)
if err != nil {
if err = os.MkdirAll(filepath.Dir(path), 0755); err != nil {
panic(err)
}
err = ioutil.WriteFile(filename, []byte(contents), 0777)
err := ioutil.WriteFile(path, contents, 0644)
if err != nil {
panic(err)
}
}

err = CopyFile(filepath.Join(templateDir, "README.md"), filepath.Join(outdir, "README.md"))
if err != nil {
panic(err)
}

err = CopyFile(filepath.Join(templateDir, "Utilities.cs"), filepath.Join(outdir, "Utilities.cs"))
yamlcs, err := gen.DotnetYaml(data, templateDir)
if err != nil {
panic(err)
}

err = CopyFile(filepath.Join(templateDir, "Provider.cs"), filepath.Join(outdir, "Provider.cs"))
if err != nil {
panic(err)
}

err = CopyFile(filepath.Join(templateDir, "logo.png"), filepath.Join(outdir, "logo.png"))
if err != nil {
panic(err)
}

err = CopyFile(
filepath.Join(templateDir, "Pulumi.Kubernetes.csproj"), filepath.Join(outdir, "Pulumi.Kubernetes.csproj"))
err = ioutil.WriteFile(fmt.Sprintf("%s/Yaml/Yaml.cs", outdir), []byte(yamlcs), 0777)
if err != nil {
panic(err)
}
Expand Down
4 changes: 2 additions & 2 deletions provider/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ require (
github.com/imdario/mergo v0.3.8
github.com/mitchellh/go-wordwrap v1.0.0
github.com/pkg/errors v0.9.1
github.com/pulumi/pulumi/pkg/v2 v2.2.2-0.20200514204320-e677c7d6dca3
github.com/pulumi/pulumi/sdk/v2 v2.2.2-0.20200514204320-e677c7d6dca3
github.com/pulumi/pulumi/pkg/v2 v2.3.0
github.com/pulumi/pulumi/sdk/v2 v2.3.0
github.com/stretchr/testify v1.5.1
google.golang.org/grpc v1.28.0
k8s.io/api v0.18.0
Expand Down
18 changes: 12 additions & 6 deletions provider/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkY
github.com/aws/aws-sdk-go v1.15.27/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0=
github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.19.45/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.29.27/go.mod h1:1KvfttTE3SPKMpo8g2c6jL3ZKfXtFvKscTgahTma5Xg=
github.com/aws/aws-sdk-go v1.30.7/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
Expand Down Expand Up @@ -326,12 +326,15 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46Ok=
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
Expand Down Expand Up @@ -445,12 +448,12 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/pulumi/pulumi/pkg/v2 v2.2.2-0.20200514204320-e677c7d6dca3 h1:s5Pol/uvx0CREUv9g7zwKT5AAl0A8q4KJozXB4RRQ50=
github.com/pulumi/pulumi/pkg/v2 v2.2.2-0.20200514204320-e677c7d6dca3/go.mod h1:hXaFYjGEnsQ7qGRJbCDhjuGh7sip3TsaOGNkU3ADt9s=
github.com/pulumi/pulumi/pkg/v2 v2.3.0 h1:ujk+Cv9h+PdC/w15xPN0hCbYkhUaanSMPoGvmviGFsM=
github.com/pulumi/pulumi/pkg/v2 v2.3.0/go.mod h1:O/MWGU3wbUGXPzZzWBiPQUjD8iE2AJnrjq6fsRKSB+s=
github.com/pulumi/pulumi/sdk/v2 v2.0.0 h1:3VMXbEo3bqeaU+YDt8ufVBLD0WhLYE3tG3t/nIZ3Iac=
github.com/pulumi/pulumi/sdk/v2 v2.0.0/go.mod h1:W7k1UDYerc5o97mHnlHHp5iQZKEby+oQrQefWt+2RF4=
github.com/pulumi/pulumi/sdk/v2 v2.2.2-0.20200514204320-e677c7d6dca3 h1:uCVadlcmLexcm6WHJv1EFB3E9PKqWQt/+zVuNC+WpjM=
github.com/pulumi/pulumi/sdk/v2 v2.2.2-0.20200514204320-e677c7d6dca3/go.mod h1:QNbWpL4gvf3X0lUFT7TXA2Jo1ff/Ti2l97AyFGYwvW4=
github.com/pulumi/pulumi/sdk/v2 v2.3.0 h1:uvRYCmoHILKlyyIbXa5CcLSKKt9n2s8j+GKTffpXQf4=
github.com/pulumi/pulumi/sdk/v2 v2.3.0/go.mod h1:cvivzHVRA5Xu3NSE/obmHzO3L693IJSd5QccQuBOMUE=
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
Expand All @@ -459,6 +462,8 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
github.com/sabhiram/go-gitignore v0.0.0-20180611051255-d3107576ba94 h1:G04eS0JkAIVZfaJLjla9dNxkJCPiKIGZlw9AfOhzOD0=
github.com/sabhiram/go-gitignore v0.0.0-20180611051255-d3107576ba94/go.mod h1:b18R55ulyQ/h3RaWyloPyER7fWQVZvimKKhnI5OfrJQ=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
Expand Down Expand Up @@ -536,7 +541,8 @@ go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
gocloud.dev v0.19.0/go.mod h1:SmKwiR8YwIMMJvQBKLsC3fHNyMwXLw3PMDO+VVteJMI=
gocloud.dev/secrets/hashivault v0.19.0/go.mod h1:doHlds85r+VwAs0T46bhjLwboWUfgfo3ovqDA8azNWo=
gocloud.dev v0.19.1-0.20200517170643-46480dc2c3dd/go.mod h1:fvG7ZAkwaV3B1N49m64LkHoO/1bhgGBYyuK1egT06I4=
gocloud.dev/secrets/hashivault v0.19.1-0.20200517170643-46480dc2c3dd/go.mod h1:Us/bsVAl9RPzZR+OXgyY2LyIfyugQoNKJm+7VRZfOi0=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
Expand Down
40 changes: 0 additions & 40 deletions provider/pkg/gen/dotnet-templates/Pulumi.Kubernetes.csproj

This file was deleted.

13 changes: 0 additions & 13 deletions provider/pkg/gen/dotnet-templates/README.md

This file was deleted.

153 changes: 0 additions & 153 deletions provider/pkg/gen/dotnet-templates/Utilities.cs

This file was deleted.

Loading

0 comments on commit 72b173c

Please sign in to comment.