diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65ab7542..5c9b821d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,9 @@ jobs: build: if: "! github.event.pull_request.head.repo.fork" runs-on: ubuntu-latest - timeout-minutes: 30 + env: + BESOM_LANGHOST_SCALA_CLI_OPTS: "--server=false" + timeout-minutes: 45 steps: - uses: actions/checkout@v4 - uses: extractions/setup-just@v1 @@ -57,7 +59,7 @@ jobs: just-version: '1.14.0' # just for sanity - uses: pulumi/actions@v4 with: - pulumi-version: '3.94.2' + pulumi-version: '3.116.1' - uses: coursier/cache-action@v6.4.3 - uses: VirtusLab/scala-cli-setup@v1.1.0 with: @@ -83,3 +85,6 @@ jobs: - name: Integration test run: scala-cli --power test integration-tests + + - name: Test besom-cfg + run: just test-cfg diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index da032354..e4cdb746 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -36,9 +36,9 @@ jobs: with: pulumi-version: '3.94.2' - uses: coursier/cache-action@v6.4.3 - - uses: VirtusLab/scala-cli-setup@v1.1.0 + - uses: VirtusLab/scala-cli-setup@v1.3.2 with: - jvm: graalvm-java11:22.3.1 + jvm: graalvm-java17:22.3.3 power: true - name: Login in to pulumi run: pulumi login --local diff --git a/.github/workflows/templates.yml b/.github/workflows/templates.yml index 58d2e081..9cec95c3 100644 --- a/.github/workflows/templates.yml +++ b/.github/workflows/templates.yml @@ -36,9 +36,9 @@ jobs: with: pulumi-version: '3.94.2' - uses: coursier/cache-action@v6.4.3 - - uses: VirtusLab/scala-cli-setup@v1.1.0 + - uses: VirtusLab/scala-cli-setup@v1.3.2 with: - jvm: graalvm-java11:22.3.1 + jvm: graalvm-java17:22.3.3 power: true - name: Login in to pulumi run: pulumi login --local diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6e60ca01..f87cb004 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -211,7 +211,7 @@ just power-wash Make sure the repository is clean and there are no uncommitted changes: ```bash -git status -s | grep -v -q '^\s*M' || echo "STOP: DIRTY GIT REPO" +git status -s ``` #### Bump Besom version (skip for `SNAPSHOT` re-release) @@ -248,7 +248,7 @@ Look for: - `core.X.Y` - core part of the provider version - update the provider versions in `README.md` -##### Create release branch +#### Create release branch ```bash git checkout -b release/v$(cat version.txt) @@ -292,11 +292,13 @@ just publish-maven-all #### Publish packages (optional for patch versions) -To publish critical package(s): +To publish critical provider package(s): ```bash export GITHUB_TOKEN=$(gh auth token) -just clean-out cli packages maven aws awsx azure gcp docker kubernetes random command tls eks +just clean-out +just cli packages maven aws awsx azure gcp docker kubernetes random command tls eks +just cli packages maven aws-native google-native azure-native ``` Tip: to check what packages are required for `examples` and `templates` use: diff --git a/Justfile b/Justfile index 24929109..222f8798 100644 --- a/Justfile +++ b/Justfile @@ -1,7 +1,9 @@ # Big idea behind using a Justfile is so that we can have modules like in sbt. besom-version := `cat version.txt` +besom-cfg-version := `cat besom-cfg/version.txt` is-snapshot := if "{{besom-version}}" =~ '.*-SNAPSHOT' { "true" } else { "false" } +no-bloop-ci := if env_var_or_default('CI', "") == "true" { "--server=false" } else { "" } language-plugin-output-dir := justfile_directory() + "/.out/language-plugin" codegen-output-dir := justfile_directory() + "/.out/codegen" @@ -34,19 +36,26 @@ default: # Aggregate tasks #################### +# TODO aggregate tasks do not incorporate besom-cfg module (with the exception of clean-all) + +# TODO make this version-independent and SNAPSHOT-independent by computing short-version from version.txt +build-packages-for-templates-and-examples: + grep -hr "0.3-SNAPSHOT" examples/**/*.scala templates/**/*.scala | sed -n 's/.*besom-\([^:]*:[^"]*\).*-core.0.3-SNAPSHOT.*/\1/p' | sort -u | tr '\n' ' ' | xargs -I {} just cli packages local {} + # Cleans everything -clean-all: clean-json clean-sdk clean-out clean-compiler-plugin clean-codegen clean-scripts clean-test-integration clean-test-templates clean-test-examples clean-test-markdown +clean-all: clean-json clean-sdk clean-auto clean-out clean-compiler-plugin clean-codegen clean-scripts clean-test-integration clean-cfg clean-test-templates clean-test-examples clean-test-markdown # Compiles everything -compile-all: compile-json compile-sdk compile-codegen compile-scripts compile-compiler-plugin build-language-plugin +compile-all: compile-json compile-sdk compile-auto compile-codegen compile-scripts compile-compiler-plugin build-language-plugin # Tests everything -test-all: test-json test-sdk test-codegen test-scripts test-integration test-templates test-examples test-markdown +test-all: test-json test-sdk test-auto test-codegen test-scripts test-integration build-packages-for-templates-and-examples test-templates test-examples test-markdown # Publishes everything locally -publish-local-all: publish-local-json publish-local-sdk publish-local-codegen publish-local-scripts install-language-plugin +publish-local-all: publish-local-json publish-local-sdk publish-local-auto publish-local-codegen publish-local-scripts install-language-plugin # Publishes everything to Maven +# TODO add publish-maven-auto once stable publish-maven-all: publish-maven-json publish-maven-sdk publish-maven-codegen publish-maven-scripts # Runs all necessary checks before committing @@ -58,37 +67,37 @@ before-commit: compile-all test-all # Compiles core besom SDK compile-core: publish-local-json - scala-cli --power compile core --suppress-experimental-feature-warning + scala-cli --power compile {{no-bloop-ci}} core --suppress-experimental-feature-warning # Compiles besom cats-effect extension compile-cats: publish-local-core - scala-cli --power compile besom-cats --suppress-experimental-feature-warning + scala-cli --power compile {{no-bloop-ci}} besom-cats --suppress-experimental-feature-warning # Compiles besom zio extension compile-zio: publish-local-core - scala-cli --power compile besom-zio --suppress-experimental-feature-warning + scala-cli --power compile {{no-bloop-ci}} besom-zio --suppress-experimental-feature-warning # Compiles all SDK modules compile-sdk: compile-core compile-cats compile-zio compile-compiler-plugin # Compiles besom compiler plugin compile-compiler-plugin: - scala-cli --power compile compiler-plugin --suppress-experimental-feature-warning + scala-cli --power compile {{no-bloop-ci}} compiler-plugin --suppress-experimental-feature-warning # Runs tests for core besom SDK test-core: compile-core @if [ {{ coverage }} = "true" ]; then mkdir -p {{coverage-output-dir-core}}; fi - scala-cli --power test core {{ scala-cli-test-options-core }} --suppress-experimental-feature-warning + scala-cli --power test {{no-bloop-ci}} core {{ scala-cli-test-options-core }} --suppress-experimental-feature-warning # Runs tests for besom cats-effect extension test-cats: publish-local-core @if [ {{ coverage }} = "true" ]; then mkdir -p {{coverage-output-dir-cats}}; fi - scala-cli --power test besom-cats {{ scala-cli-test-options-cats }} --suppress-experimental-feature-warning + scala-cli --power test {{no-bloop-ci}} besom-cats {{ scala-cli-test-options-cats }} --suppress-experimental-feature-warning # Runs tests for besom zio extension test-zio: publish-local-core @if [ {{ coverage }} = "true" ]; then mkdir -p {{coverage-output-dir-zio}}; fi - scala-cli --power test besom-zio {{ scala-cli-test-options-zio }} --suppress-experimental-feature-warning + scala-cli --power test {{no-bloop-ci}} besom-zio {{ scala-cli-test-options-zio }} --suppress-experimental-feature-warning # Runs all tests test-sdk: test-core test-cats test-zio @@ -101,35 +110,35 @@ publish-maven-sdk: publish-maven-core publish-maven-cats publish-maven-zio publi # Publishes locally core besom SDK publish-local-core: publish-local-json - scala-cli --power publish local core --project-version {{besom-version}} --suppress-experimental-feature-warning + scala-cli --power publish local {{no-bloop-ci}} core --project-version {{besom-version}} --suppress-experimental-feature-warning # Publishes locally besom cats-effect extension publish-local-cats: publish-local-core - scala-cli --power publish local besom-cats --project-version {{besom-version}} --suppress-experimental-feature-warning + scala-cli --power publish local {{no-bloop-ci}} besom-cats --project-version {{besom-version}} --suppress-experimental-feature-warning # Publishes locally besom zio extension publish-local-zio: publish-local-core - scala-cli --power publish local besom-zio --project-version {{besom-version}} --suppress-experimental-feature-warning + scala-cli --power publish local {{no-bloop-ci}} besom-zio --project-version {{besom-version}} --suppress-experimental-feature-warning # Publishes locally besom compiler plugin publish-local-compiler-plugin: - scala-cli --power publish local compiler-plugin --project-version {{besom-version}} --suppress-experimental-feature-warning + scala-cli --power publish local {{no-bloop-ci}} compiler-plugin --project-version {{besom-version}} --suppress-experimental-feature-warning # Publishes core besom SDK to Maven publish-maven-core: - scala-cli --power publish core --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning + scala-cli --power publish {{no-bloop-ci}} core --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning # Publishes besom cats-effect extension to Maven publish-maven-cats: - scala-cli --power publish besom-cats --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning + scala-cli --power publish {{no-bloop-ci}} besom-cats --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning # Publishes besom zio extension to Maven publish-maven-zio: - scala-cli --power publish besom-zio --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning + scala-cli --power publish {{no-bloop-ci}} besom-zio --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning # Publishes besom compiler plugin to Maven publish-maven-compiler-plugin: - scala-cli --power publish compiler-plugin --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning + scala-cli --power publish {{no-bloop-ci}} compiler-plugin --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning # Cleans core build clean-core: @@ -164,11 +173,11 @@ clean-coverage: clean-sdk # Compiles json module compile-json: - scala-cli --power compile besom-json --suppress-experimental-feature-warning + scala-cli --power compile {{no-bloop-ci}} besom-json --suppress-experimental-feature-warning # Runs tests for json module test-json: - scala-cli --power test besom-json --suppress-experimental-feature-warning -v -v -v + scala-cli --power test {{no-bloop-ci}} besom-json --suppress-experimental-feature-warning # Cleans json module clean-json: @@ -176,11 +185,37 @@ clean-json: # Publishes locally json module publish-local-json: - scala-cli --power publish local besom-json --project-version {{besom-version}} --suppress-experimental-feature-warning + scala-cli --power publish local {{no-bloop-ci}} besom-json --project-version {{besom-version}} --suppress-experimental-feature-warning # Publishes json module to Maven publish-maven-json: - scala-cli --power publish besom-json --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning + scala-cli --power publish {{no-bloop-ci}} besom-json --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning + + +#################### +# Auto +#################### + +# Compiles auto module +compile-auto: publish-local-core + scala-cli --power compile auto --suppress-experimental-feature-warning + +# Runs tests for auto module +test-auto: compile-auto + scala-cli --power test auto --suppress-experimental-feature-warning + +# Cleans auto module +clean-auto: + scala-cli --power clean auto + +# Publishes locally auto module +publish-local-auto: test-auto + scala-cli --power publish local auto --project-version {{besom-version}} --suppress-experimental-feature-warning + +# Publishes auto module +publish-maven-auto: test-auto + scala-cli --power publish auto --project-version {{besom-version}} {{publish-maven-auth-options}} + #################### # Language plugin @@ -194,7 +229,7 @@ tidy-language-plugin: # Packages .jar file with language plugin bootstrap library package-language-plugin-bootstrap: mkdir -p {{language-plugin-output-dir}} && \ - scala-cli --power package language-plugin/bootstrap --suppress-experimental-feature-warning --assembly -o {{language-plugin-output-dir}}/bootstrap.jar -f + scala-cli --power package {{no-bloop-ci}} language-plugin/bootstrap --suppress-experimental-feature-warning --assembly -o {{language-plugin-output-dir}}/bootstrap.jar -f # Builds pulumi-language-scala binary build-language-plugin $GOOS="" $GOARCH="": @@ -253,17 +288,74 @@ publish-language-plugins-all: package-language-plugins-all just publish-language-plugin windows arm64 just publish-language-plugin windows amd64 +#################### +# Besom CFG +#################### + +# Compiles besom-cfg lib module +compile-cfg-lib: publish-local-json publish-local-core + scala-cli --power compile besom-cfg/lib --suppress-experimental-feature-warning + +# Compiles besom-cfg k8s module +compile-cfg-k8s: publish-local-cfg-lib + just cli packages local kubernetes:4.10.0 + scala-cli --power compile besom-cfg/k8s --suppress-experimental-feature-warning + +# Compiles all besom-cfg modules +compile-cfg: compile-cfg-lib compile-cfg-k8s + +# Publishes locally besom-cfg lib module +publish-local-cfg-lib: + scala-cli --power publish local besom-cfg/lib --project-version {{besom-cfg-version}} --suppress-experimental-feature-warning + +# Publishes locally besom-cfg k8s module +publish-local-cfg-k8s: compile-cfg-k8s + scala-cli --power publish local besom-cfg/k8s --project-version {{besom-cfg-version}} --suppress-experimental-feature-warning + +# Publishes locally all besom-cfg modules +publish-local-cfg: publish-local-cfg-lib publish-local-cfg-k8s + +# Publishes besom-cfg lib module to Maven +publish-maven-cfg-lib: + scala-cli --power publish besom-cfg/lib --project-version {{besom-cfg-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning + +# Publishes besom-cfg k8s module to Maven +publish-maven-cfg-k8s: + scala-cli --power publish besom-cfg/k8s --project-version {{besom-cfg-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning + +# Tests besom-cfg lib module +test-cfg-lib: compile-cfg-lib + scala-cli --power test besom-cfg/lib --suppress-experimental-feature-warning + +# Tests besom-cfg k8s module +test-cfg-k8s: publish-local-cfg-lib compile-cfg-k8s + scala-cli --power test besom-cfg/k8s --suppress-experimental-feature-warning + +# Runs all tests of besom-cfg +test-cfg: test-cfg-lib test-cfg-k8s + +# Cleans besom-cfg-lib build +clean-cfg-lib: + scala-cli clean besom-cfg/lib + +# Cleans besom-cfg-k8s build +clean-cfg-k8s: + scala-cli clean besom-cfg/k8s + +# Cleans all besom-cfg builds +clean-cfg: clean-cfg-lib clean-cfg-k8s + #################### # Codegen #################### # Compiles Besom codegen module compile-codegen: - scala-cli --power compile codegen --suppress-experimental-feature-warning + scala-cli --power compile {{no-bloop-ci}} codegen --suppress-experimental-feature-warning # Runs tests for Besom codegen test-codegen: - scala-cli --power test codegen --suppress-experimental-feature-warning + scala-cli --power test {{no-bloop-ci}} codegen --suppress-experimental-feature-warning # Cleans codegen build clean-codegen: @@ -271,11 +363,11 @@ clean-codegen: # Publishes locally Besom codegen publish-local-codegen: test-codegen - scala-cli --power publish local codegen --project-version {{besom-version}} --suppress-experimental-feature-warning + scala-cli --power publish local {{no-bloop-ci}} codegen --project-version {{besom-version}} --suppress-experimental-feature-warning # Publishes Besom codegen publish-maven-codegen: test-codegen - scala-cli --power publish codegen --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning + scala-cli --power publish {{no-bloop-ci}} codegen --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning #################### # Integration testing @@ -283,7 +375,7 @@ publish-maven-codegen: test-codegen # Runs all integration tests test-integration: test-integration-core test-integration-compiler-plugin test-integration-codegen test-integration-language-plugin - scala-cli --power test integration-tests + scala-cli --power test {{no-bloop-ci}} integration-tests # Cleans after integration tests clean-test-integration: clean-test-integration-codegen @@ -291,26 +383,26 @@ clean-test-integration: clean-test-integration-codegen # Runs integration tests for core test-integration-core: publish-local-codegen publish-local-sdk install-language-plugin publish-local-compiler-plugin - scala-cli --power test integration-tests --test-only 'besom.integration.core*' + scala-cli --power test {{no-bloop-ci}} integration-tests --test-only 'besom.integration.core*' # Runs integration tests for compiler plugin test-integration-compiler-plugin: publish-local-codegen publish-local-core install-language-plugin publish-local-compiler-plugin - scala-cli --power test integration-tests --test-only 'besom.integration.compilerplugin*' + scala-cli --power test {{no-bloop-ci}} integration-tests --test-only 'besom.integration.compilerplugin*' # Runs integration tests for language plugin test-integration-language-plugin: publish-local-codegen publish-local-core install-language-plugin publish-local-compiler-plugin export GITHUB_TOKEN=$(gh auth token); \ - scala-cli --power test integration-tests --test-only 'besom.integration.languageplugin*' + scala-cli --power test {{no-bloop-ci}} integration-tests --test-only 'besom.integration.languageplugin*' # Runs fast integration tests for codegen test-integration-codegen: publish-local-core publish-local-codegen export GITHUB_TOKEN=$(gh auth token); \ - scala-cli --power test integration-tests --test-only 'besom.integration.codegen*' + scala-cli --power test {{no-bloop-ci}} integration-tests --test-only 'besom.integration.codegen*' # Runs fast&slow integration tests for codegen test-integration-codegen-slow: publish-local-core publish-local-codegen export GITHUB_TOKEN=$(gh auth token); \ - scala-cli --power test integration-tests --test-only 'besom.integration.codegen*' -- --include-categories=Slow + scala-cli --power test {{no-bloop-ci}} integration-tests --test-only 'besom.integration.codegen*' -- --include-categories=Slow # Cleans after the codegen integration tests clean-test-integration-codegen: @@ -318,7 +410,7 @@ clean-test-integration-codegen: # Copies test schemas from pulumi repo to the testdata directory copy-test-schemas: - scala-cli run --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning scripts -- schemas all + scala-cli run {{no-bloop-ci}} --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning scripts -- schemas all #################### # Templates and examples @@ -329,7 +421,7 @@ test-template template-name: @echo "----------------------------------------" @echo "Testing template {{template-name}}" pulumi --non-interactive --logtostderr --color=never --emoji=false new -y --force --generate-only --dir target/test/{{template-name}} -n templates-test-{{template-name}} --stack templates-test-{{template-name}} ../../../templates/{{template-name}}/ - scala-cli compile target/test/{{template-name}} {{ci-opts}} --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning + scala-cli compile {{no-bloop-ci}} target/test/{{template-name}} {{ci-opts}} --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning # Cleans after a template test clean-test-template template-name: @@ -352,7 +444,7 @@ clean-test-templates: test-example example-name: @echo "----------------------------------------" @echo "Testing example {{example-name}}" - scala-cli compile examples/{{example-name}} {{ci-opts}} --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning + scala-cli compile -v -v -v {{no-bloop-ci}} examples/{{example-name}} {{ci-opts}} --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning # Cleans after an example test clean-test-example example-name: @@ -388,7 +480,7 @@ clean-test-markdown: # Compiles Besom scripts module compile-scripts: publish-local-codegen - scala-cli --power compile scripts --suppress-experimental-feature-warning + scala-cli --power compile {{no-bloop-ci}} scripts --suppress-experimental-feature-warning # Clean Besom scripts module clean-scripts: @@ -396,19 +488,19 @@ clean-scripts: # Runs tests for Besom scripts test-scripts: - scala-cli --power test scripts --suppress-experimental-feature-warning + scala-cli --power test {{no-bloop-ci}} scripts --suppress-experimental-feature-warning # Publishes locally Besom scripts module publish-local-scripts: test-scripts - scala-cli --power publish local scripts --project-version {{besom-version}} --suppress-experimental-feature-warning + scala-cli --power publish local {{no-bloop-ci}} scripts --project-version {{besom-version}} --suppress-experimental-feature-warning # Publishes Besom scripts module publish-maven-scripts: test-scripts - scala-cli --power publish scripts --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning + scala-cli --power publish {{no-bloop-ci}} scripts --project-version {{besom-version}} {{publish-maven-auth-options}} --suppress-experimental-feature-warning # Use Besom scripts directly cli *ARGS: - scala-cli run scripts {{ci-opts}} --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning scripts -- {{ARGS}} + scala-cli run {{no-bloop-ci}} scripts {{ci-opts}} --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning scripts -- {{ARGS}} # Create or Update GitHub release upsert-gh-release: @@ -431,6 +523,7 @@ power-wash: clean-all rm -rf ~/.m2/repository/org/virtuslab/ rm -rf ~/.cache/coursier/v1/https/repo1.maven.org/maven2/org/virtuslab/ # Linux rm -rf ~/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/virtuslab/ # Mac + rm -rf ~/Library/Caches/Coursier/v1/https/oss.sonatype.org/content/repositories/snapshots/org/virtuslab/ # Mac snapshots git clean -i -d -x -e ".idea" killall -9 java @@ -472,8 +565,8 @@ clean-slate-liftoff: clean-sdk #!/usr/bin/env sh just publish-local-core just publish-local-compiler-plugin - scala-cli run codegen -- named kubernetes 4.2.0 - scala-cli --power publish local .out/codegen/kubernetes/4.2.0/ --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning + scala-cli run {{no-bloop-ci}} codegen -- named kubernetes 4.2.0 + scala-cli --power publish local {{no-bloop-ci}} .out/codegen/kubernetes/4.2.0/ --suppress-experimental-feature-warning --suppress-directives-in-multiple-files-warning just clean-liftoff just liftoff diff --git a/README.md b/README.md index dc60cc00..e616fba3 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ using the Scala programming language. Scala support is currently in **Public Bet * **[Besom Docs](https://virtuslab.github.io/besom/)**: Learn about Besom concepts, follow user-guides, and consult the reference documentation. -* **[Examples](https://github.com/VirtusLab/besom/tree/v0.3.1/examples)**: Browse Scala examples across many clouds and scenarios including containers, serverless, +* **[Examples](https://github.com/VirtusLab/besom/tree/v0.3.2/examples)**: Browse Scala examples across many clouds and scenarios including containers, serverless, and infrastructure. ## Getting Started @@ -44,7 +44,7 @@ using the Scala programming language. Scala support is currently in **Public Bet To install the latest Scala Language Plugin release, run the following: ```bash - pulumi plugin install language scala 0.3.1 --server github://api.github.com/VirtusLab/besom + pulumi plugin install language scala 0.3.2 --server github://api.github.com/VirtusLab/besom ``` 4. **Create a new project**: @@ -58,7 +58,7 @@ using the Scala programming language. Scala support is currently in **Public Bet mkdir besom-demo && cd besom-demo ``` ```bash - pulumi new https://github.com/VirtusLab/besom/tree/v0.3.1/templates/aws + pulumi new https://github.com/VirtusLab/besom/tree/v0.3.2/templates/aws ``` 5. **Deploy to the Cloud**: @@ -94,7 +94,7 @@ using the Scala programming language. Scala support is currently in **Public Bet To learn more, head over to [virtuslab.github.io/besom](https://virtuslab.github.io/besom/) for much more information, including [tutorial](https://virtuslab.github.io/besom/docs/tutorial), -[examples](https://github.com/VirtusLab/besom/tree/v0.3.1/examples), +[examples](https://github.com/VirtusLab/besom/tree/v0.3.2/examples), and [architecture and programming model concepts](https://virtuslab.github.io/besom/docs/architecture). ## Explaining the project structure @@ -109,8 +109,8 @@ Resources created in `Pulumi.run { ... }` block will be created by Pulumi. A simple example using Scala CLI: ```scala //> using scala "3.3.1" -//> using plugin "org.virtuslab::besom-compiler-plugin:0.3.1" -//> using dep "org.virtuslab::besom-core:0.3.1" +//> using plugin "org.virtuslab::besom-compiler-plugin:0.3.2" +//> using dep "org.virtuslab::besom-core:0.3.2" //> using dep "org.virtuslab::besom-aws:6.31.0-core.0.3" import besom.* diff --git a/auto/.scalafmt.conf b/auto/.scalafmt.conf new file mode 100644 index 00000000..81666df6 --- /dev/null +++ b/auto/.scalafmt.conf @@ -0,0 +1,11 @@ +version = 3.5.2 +runner.dialect = scala3 +project.git = true +align = most +align.openParenCallSite = false +align.openParenDefnSite = false +align.tokens = [{code = "=>", owner = "Case"}, "<-", "%", "%%", "="] +indent.defnSite = 2 +maxColumn = 140 + +rewrite.scala3.insertEndMarkerMinLines = 40 diff --git a/auto/project.scala b/auto/project.scala new file mode 100644 index 00000000..0eacf5cf --- /dev/null +++ b/auto/project.scala @@ -0,0 +1,25 @@ +//> using scala 3.3.1 +//> using options -java-output-version:11 +//> using options -deprecation -feature -Werror -Wunused:all + +//> using dep org.virtuslab::besom-json:0.3.2 +//> using dep org.virtuslab::besom-core:0.3.2 +//> using dep org.virtuslab::scala-yaml:0.0.8 +//> using dep com.lihaoyi::os-lib:0.10.0 +//> using dep com.lihaoyi::os-lib-watch:0.10.0 +//> using dep org.eclipse.jgit:org.eclipse.jgit:6.8.0.202311291450-r +//> using dep org.eclipse.jgit:org.eclipse.jgit.ssh.jsch:6.8.0.202311291450-r +//> using dep org.slf4j:slf4j-nop:2.0.13 // TODO library should not have bindings for slf4j +//> using dep ma.chinespirit::tailf:0.1.0 + +//> using test.dep org.scalameta::munit:1.0.0-M10 + +//> using publish.name "besom-auto" +//> using publish.organization "org.virtuslab" +//> using publish.url "https://github.com/VirtusLab/besom" +//> using publish.vcs "github:VirtusLab/besom" +//> using publish.license "Apache-2.0" +//> using publish.repository "central" +//> using publish.developer "lbialy|Łukasz Biały|https://github.com/lbialy" +//> using publish.developer "pawelprazak|Paweł Prażak|https://github.com/pawelprazak" +//> using repository sonatype:snapshots \ No newline at end of file diff --git a/auto/src/main/scala/besom/auto/internal/AutoError.scala b/auto/src/main/scala/besom/auto/internal/AutoError.scala new file mode 100644 index 00000000..44b19c35 --- /dev/null +++ b/auto/src/main/scala/besom/auto/internal/AutoError.scala @@ -0,0 +1,142 @@ +package besom.auto.internal + +import scala.util.matching.Regex + +@SerialVersionUID(1L) +sealed abstract class BaseAutoError(message: Option[String], cause: Option[Throwable]) + extends Exception(message.orElse(cause.map(_.toString)).orNull, cause.orNull) + with Product + with Serializable + +@SerialVersionUID(1L) +case class AutoError(message: Option[String], cause: Option[Throwable]) extends BaseAutoError(message, cause) +object AutoError: + def apply(message: String) = new AutoError(Some(message), None) + def apply(message: String, cause: Throwable) = new AutoError(Some(message), Some(cause)) + def apply(cause: Throwable) = new AutoError(None, Some(cause)) + +@SerialVersionUID(1L) +case class ShellAutoError( + message: Option[String], + cause: Option[Throwable], + exitCode: Int, + stdout: String, + stderr: String, + command: Seq[String], + envVars: Map[String, String] +) extends BaseAutoError(message, cause): + def withMessage(message: String): ShellAutoError = copy(message = this.message.map(message + "; " + _).orElse(Some(message))) + + /** Returns true if the error was a result of selecting a stack that does not exist. + * + * @return + * `true` if the error was due to a non-existent stack. + */ + def isSelectStack404Error: Boolean = + val regex: Regex = "no stack named.*found".r + regex.findFirstIn(stderr).isDefined + + /** Returns true if the error was a result of a conflicting update locking the stack. + * + * @return + * `true` if the error was due to a conflicting update. + */ + def isConcurrentUpdateError: Boolean = + val conflictText = "[409] Conflict: Another update is currently in progress." + val localBackendConflictText = "the stack is currently locked by" + stderr.contains(conflictText) || stderr.contains(localBackendConflictText) + + /** Returns true if the error was a result of creating a stack that already exists. + * + * @return + * `true` if the error was due to a stack that already exists. + */ + def isCreateStack409Error: Boolean = + val regex: Regex = "stack.*already exists".r + regex.findFirstIn(stderr).isDefined + + /** Returns true if the pulumi core engine encountered an error (most likely a bug). + * + * @return + * `true` if the error was due to an unexpected engine error. + */ + def isUnexpectedEngineError: Boolean = + stdout.contains("The Pulumi CLI encountered a fatal error. This is a bug!") + +end ShellAutoError +object ShellAutoError: + def apply(message: String, exitCode: Int, stdout: String, stderr: String, command: Seq[String], envVars: Map[String, String]) = + new ShellAutoError( + Some(msg(Some(message), None, exitCode, stdout, stderr, command, envVars)), + None, + exitCode, + stdout, + stderr, + command, + envVars + ) + def apply( + message: String, + cause: Throwable, + exitCode: Int, + stdout: String, + stderr: String, + command: Seq[String], + envVars: Map[String, String] + ) = + new ShellAutoError( + Some(msg(Some(message), Some(cause), exitCode, stdout, stderr, command, envVars)), + Some(cause), + exitCode, + stdout, + stderr, + command, + envVars + ) + def apply(cause: Throwable, exitCode: Int, stdout: String, stderr: String, command: Seq[String], envVars: Map[String, String]) = + new ShellAutoError( + Some(msg(None, Some(cause), exitCode, stdout, stderr, command, envVars)), + Some(cause), + exitCode, + stdout, + stderr, + command, + envVars + ) + def apply(exitCode: Int, stdout: String, stderr: String, command: Seq[String], envVars: Map[String, String]) = + new ShellAutoError( + Some(msg(None, None, exitCode, stdout, stderr, command, envVars)), + None, + exitCode, + stdout, + stderr, + command, + envVars + ) + + private def msg( + message: Option[String], + cause: Option[Throwable], + exitCode: Int, + stdout: String, + stderr: String, + command: Seq[String], + envVars: Map[String, String] + ): String = { + s"""|${message.map(_ + "\n").getOrElse("")}${cause.map("cause: " + _.getMessage + "\n").getOrElse("")} + |command: ${redacted(command)} + |code: $exitCode + |stdout: + |$stdout + |stderr: + |$stderr + |env: + |${envVars.map { case (k, v) => s" $k=$v" }.mkString("\n")} + |""".stripMargin + } + + private def redacted(command: Seq[String]) = + val parts = if command.contains("-secret") then command.take(2) :+ "...[REDACTED]" else command + parts.mkString(" ") + +end ShellAutoError diff --git a/auto/src/main/scala/besom/auto/internal/Git.scala b/auto/src/main/scala/besom/auto/internal/Git.scala new file mode 100644 index 00000000..c907db86 --- /dev/null +++ b/auto/src/main/scala/besom/auto/internal/Git.scala @@ -0,0 +1,141 @@ +package besom.auto.internal + +import besom.util.* +import com.jcraft.jsch.JSch +import org.eclipse.jgit.api.{CloneCommand, TransportConfigCallback} +import org.eclipse.jgit.lib.ObjectId +import org.eclipse.jgit.revwalk.RevWalk +import org.eclipse.jgit.transport.ssh.jsch.JschConfigSessionFactory +import org.eclipse.jgit.transport.{CredentialsProvider, RefSpec, SshTransport, UsernamePasswordCredentialsProvider} + +import java.util.Collections +import scala.util.Using + +object Git: + private val RefPrefix = "refs/" + private val RefHeadPrefix = RefPrefix + "heads/" + private val RefTagPrefix = RefPrefix + "tags/" + private val RefRemotePrefix = RefPrefix + "remotes/" + + private class RichCloneCommand(private var depth: Option[Int] = None) extends CloneCommand: + def getCredentialsProvider: CredentialsProvider = credentialsProvider + def getTransportConfigCallback: TransportConfigCallback = transportConfigCallback + def getDepth: Option[Int] = depth + override def setDepth(depth: Int): CloneCommand = + val cmd = super.setDepth(depth) + this.depth = Some(depth) + cmd + + def setupGitRepo(workDir: os.Path, repoArgs: GitRepo): Either[Exception, os.Path] = + try + val cloneCommand = new RichCloneCommand() + + cloneCommand + .setRemote("origin") // be explicit so we can require it in remote refs + .setURI(repoArgs.url) + .setDirectory(workDir.toIO) + + if repoArgs.shallow then + cloneCommand + .setDepth(1) + .setCloneAllBranches(false) + + repoArgs.auth match + case GitAuth.UsernameAndPassword(username, password) => + cloneCommand.setCredentialsProvider(new UsernamePasswordCredentialsProvider(username, password)) + case GitAuth.PersonalAccessToken(token) => + // With Personal Access Token the username for use with a PAT can be + // *anything* but an empty string so we are setting this to 'git' + cloneCommand.setCredentialsProvider(new UsernamePasswordCredentialsProvider("git", token)) + case GitAuth.SSHPrivateKey(key, passphrase) => + val sshSessionFactory = new JschConfigSessionFactory(): + override protected def configureJSch(jsch: JSch): Unit = + jsch.removeAllIdentity() + jsch.addIdentity("key", key.getBytes(), null /* no pub key */, passphrase.asOption.map(_.getBytes()).orNull) + cloneCommand.setTransportConfigCallback { transport => + transport.asInstanceOf[SshTransport].setSshSessionFactory(sshSessionFactory) + } + case GitAuth.SSHPrivateKeyPath(keyPath, passphrase) => + val sshSessionFactory = new JschConfigSessionFactory(): + override protected def configureJSch(jsch: JSch): Unit = + jsch.removeAllIdentity() + jsch.addIdentity(keyPath, passphrase.asOption.map(_.getBytes()).orNull) + cloneCommand.setTransportConfigCallback { transport => + transport.asInstanceOf[SshTransport].setSshSessionFactory(sshSessionFactory) + } + case NotProvided => // do nothing + repoArgs.branch match + case branch: String => + // `Git.cloneRepository` will do appropriate fetching given a branch name. We must deal with + // different varieties, since people have been advised to use these as a workaround while only + // "refs/heads/" worked. + // + // If a reference name is not supplied, then clone will fetch all refs (and all objects + // referenced by those), and checking out a commit later will work as expected. + val ref = { + try + val refSpec = RefSpec(branch) + if refSpec.matchSource(RefRemotePrefix) + then + refSpec.getDestination match + case s"origin/$branch" => s"$RefHeadPrefix/$branch" + case _ => throw AutoError("a remote ref must begin with 'refs/remote/origin/', but got: '$branch'") + else if refSpec.matchSource(RefTagPrefix) then + branch // looks like `refs/tags/v1.0.0` -- respect this even though the field is `.Branch` + else if !refSpec.matchSource(RefHeadPrefix) then + s"$RefHeadPrefix/$branch" // not a remote, not refs/heads/branch; treat as a simple branch name + else + // already looks like a full branch name or tag, so use as is + refSpec.toString + catch case e: IllegalArgumentException => throw AutoError(s"Invalid branch name: '$branch'", e) + } + cloneCommand.setBranchesToClone(Collections.singletonList(ref)) + + case NotProvided => // do nothing + end match + // NOTE: pulumi has a workaround here for Azure DevOps requires, we might add if needed + val git = cloneCommand.call() + val repository = git.getRepository + + repoArgs.commitHash match + case commitHash: String => + // ensure that the commit has been fetched + val fetchCommand = git + .fetch() + .setRemote("origin") + .setRefSpecs(new RefSpec(s"$commitHash:$commitHash")) + .setCredentialsProvider(cloneCommand.getCredentialsProvider) + .setTransportConfigCallback(cloneCommand.getTransportConfigCallback) + + cloneCommand.getDepth.foreach { + fetchCommand.setDepth(_) + } + val _ = fetchCommand.call() + + // If a commit hash is provided, then we must check it out explicitly. Otherwise, the + // repository will be in a detached HEAD state, and the commit hash will be the only + // commit in the repository. + val commitId = ObjectId.fromString(commitHash) + Using.resource(new RevWalk(repository)) { revWalk => + val commit = revWalk.parseCommit(commitId) + val _ = git + .checkout() + .setName(commit.getName) + .setForced(true) // this method guarantees 'git --force' semantics + .call() + } + case NotProvided => // do nothing + end match + + val finalWorkDir = + if repoArgs.projectPath.asOption.nonEmpty then + val projectPath = os.rel / repoArgs.projectPath.asOption.get + workDir / projectPath + else workDir + + Right(finalWorkDir) + + catch case e: Exception => Left(e) + + end setupGitRepo +end Git diff --git a/auto/src/main/scala/besom/auto/internal/LocalWorkspace.scala b/auto/src/main/scala/besom/auto/internal/LocalWorkspace.scala new file mode 100644 index 00000000..755fb4d1 --- /dev/null +++ b/auto/src/main/scala/besom/auto/internal/LocalWorkspace.scala @@ -0,0 +1,1145 @@ +package besom.auto.internal + +import besom.json.* +import besom.model.{PackageName, SemanticVersion, FullyQualifiedStackName, StackName} +import besom.util.* +import besom.model +import os.Path + +import java.util.concurrent.atomic.AtomicReference +import scala.collection.immutable.Map +import scala.collection.mutable +import scala.language.implicitConversions +import scala.util.Try + +/** LocalWorkspace is a default implementation of the [[Workspace]] trait. A [[Workspace]] is the execution context containing a single + * Pulumi project, a program, and multiple stacks. Workspaces are used to manage the execution environment, providing various utilities + * such as plugin installation, environment configuration (`$PULUMI_HOME`), and creation, deletion, and listing of Stacks. + * [[LocalWorkspace]] relies on `Pulumi.yaml` and `Pulumi.[stack].yaml` as the intermediate format for [[Project]] and [[Stack]] settings. + * Modifying [[projectSettings]] will alter the [[Workspace]] `Pulumi.yaml` file, and setting config on a [[Stack]] will modify the + * `Pulumi.[stack].yaml` file. This is identical to the behavior of Pulumi CLI driven workspaces. + */ +trait LocalWorkspace extends Workspace: + import LocalWorkspace.* + + given Workspace = this + + /** Returns the settings object for the current project if any. [[LocalWorkspace]] reads settings from the `Pulumi.yaml` in the workspace. + * A workspace can contain only a single project at a time. + * @return + * a [[Project]] settings or error if any + */ + def projectSettings: Either[Exception, Project] = readProjectSettingsFromDir(workDir) + + /** Overwrites the settings object in the current project. There can only be a single project per workspace. Fails if new project name + * does not match old. Writes this value to a `Pulumi.yaml` file in [[workDir]]. + * + * @param settings + * the project settings to save + * @return + * an exception if the save failed, otherwise nothing + */ + def saveProjectSettings(settings: Project): Either[Exception, Unit] = Try { + val pulumiYamlPath = workDir / shell.pulumi.ProjectFileName() + settings.save(pulumiYamlPath) + }.toEither.flatten.left.map(e => AutoError(s"failed to save project settings: ${e.getMessage}", e)) + + /** Returns the settings object for the stack matching the specified stack name if any. Reads this from a `Pulumi.[stack].yaml` file in + * [[workDir]]. + * + * @param stackName + * the name of the stack + * @return + * a [[ProjectStack]] or an error if any + */ + def stackSettings(stackName: String): Either[Exception, ProjectStack] = + readStackSettingFromDir(workDir, stackName) + + /** Overwrites the settings object for the stack matching the specified stack name. Saves this to a `Pulumi.[stack].yaml` file in + * [[workDir]]. + * + * @param stackName + * the name of the stack + * @param settings + * The stack settings to save. + * @return + * an exception if the save failed, otherwise nothing. + */ + def saveStackSettings(stackName: String, settings: ProjectStack): Either[Exception, Unit] = Try { + val actualStackName = getStackSettingsName(stackName) + val pulumiYamlPath = workDir / shell.pulumi.StackFileName(actualStackName) + settings.save(pulumiYamlPath) + }.toEither.left.map(e => AutoError(s"failed to save stack settings: ${e.getMessage}", e)) + + /** This is a hook to provide additional args to every CLI commands before they are executed. Provided with stack name, returns a list of + * args to append to an invoked command `["--config=...", ]`. + * + * LocalWorkspace does not utilize this extensibility point. + * + * @param stackName + * the name of the stack + * @return + * a list of args to append to an invoked command + */ + def serializeArgsForOp(stackName: String): Either[Exception, List[String]] = + // not utilized for LocalWorkspace + Left(AutoError("LocalWorkspace does not utilize this extensibility point")) + + /** This is a hook executed after every command. Called with the stack name. An extensibility point to perform workspace cleanup. CLI + * operations may create/modify a `Pulumi.[stack].yaml` in [[workDir]]. + * + * LocalWorkspace does not utilize this extensibility point. + * + * @param stackName + * the name of the stack + * @return + * an exception if the cleanup failed, otherwise nothing + */ + def postCommandCallback(stackName: String): Either[Exception, Unit] = + // not utilized for LocalWorkspace + Left(AutoError("LocalWorkspace does not utilize this extensibility point")) + + /** Adds the specified environments to the provided stack's configuration. + * + * @param stackName + * the name of the stack + * @param envs + * the environments to add + * @return + * an exception if the add failed, otherwise nothing + */ + def addEnvironments( + stackName: String, + envs: String* + ): Either[Exception, Unit] = + + // 3.95 added this command (https://github.com/pulumi/pulumi/releases/tag/v3.95.0) + if pulumiVersion < model.SemanticVersion(3, 95, 0) + then Left(AutoError("addEnvironments requires Pulumi version >= 3.95.0")) + else + val args = Seq("config", "env", "add") ++ envs ++ Seq("--yes", "--stack", stackName) + pulumi(args)().fold( + e => Left(e.withMessage(s"failed to add environments to stack: '$stackName'")), + _ => Right(()) + ) + end if + end addEnvironments + + /** Lists the environments from the provided stack's configuration. + * + * @param stackName + * The name of the stack. + * @return + * Either an Exception or a list of environments. + */ + def listEnvironments(stackName: String): Either[Exception, List[String]] = + // 3.99 added this command (https://github.com/pulumi/pulumi/releases/tag/v3.99.0) + if pulumiVersion < model.SemanticVersion(3, 99, 0) + then Left(AutoError("listEnvironments requires Pulumi version >= 3.99.0")) + else + val args = Seq("config", "env", "ls", "--stack", stackName, "--json") + pulumi(args)().fold( + e => Left(e.withMessage(s"failed to list environments for stack: '$stackName'")), + r => r.out.parseJson[List[String]].left.map(e => AutoError(s"failed to parse environments for stack: '$stackName'", e)) + ) + end listEnvironments + + /** Removes the specified environment from the provided stack's configuration. + * + * @param stackName + * the name of the stack + * @param env + * the environment to remove + * @return + * an exception if the remove failed, otherwise nothing + */ + def removeEnvironment(stackName: String, env: String): Either[Exception, Unit] = + // 3.95 added this command (https://github.com/pulumi/pulumi/releases/tag/v3.95.0) + if pulumiVersion < model.SemanticVersion(3, 95, 0) + then Left(AutoError("removeEnvironment requires Pulumi version >= 3.95.0")) + else + val args = Seq("--stack", stackName, "config", "env", "rm", env, "--yes") + pulumi(args)() + .fold( + e => Left(e.withMessage(s"failed to remove environment from stack: '$stackName'")), + _ => Right(()) + ) + end removeEnvironment + + /** Returns the value associated with the specified stack name and key using the optional [[ConfigOption]]s, scoped to the current + * workspace. [[LocalWorkspace]] reads this config from the matching `Pulumi.[stack].yaml` file in [[workDir]]. + * + * @param stackName + * the name of the stack + * @param key + * the key to retrieve the value for + * @param options + * the optional [[ConfigOption]]s to use + * @return + * the config value or an error if any + */ + def getConfig( + stackName: String, + key: String, + options: ConfigOption* + ): Either[Exception, ConfigValue] = + val maybePath = options.collectFirst { case ConfigOption.Path => "--path" } + val args = Seq("--stack", stackName, "config", "get") ++ maybePath ++ Seq(key, "--show-secrets", "--json") + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to get config '$key' for stack: '$stackName'")) + case Right(r) => ConfigValue.fromJson(r.out) + end getConfig + + /** Returns the config map for the specified stack name, scoped to the current workspace. [[LocalWorkspace]] reads this config from the + * matching `Pulumi.stack.yaml` file in [[workDir]]. + * + * @param stackName + * the name of the stack + * @return + * the config map or an error if any + */ + def getAllConfig(stackName: String): Either[Exception, ConfigMap] = + val args = Seq("--stack", stackName, "config", "--show-secrets", "--json") + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to get all configs for stack: '$stackName'")) + case Right(r) => ConfigMap.fromJson(r.out) + end getAllConfig + + /** Sets the specified key-value pair on the provided stack name. [[LocalWorkspace]] writes this value to the matching + * `Pulumi.[stack].yaml` file in [[workDir]]. + * + * @param stackName + * the name of the stack + * @param key + * the key to set the value for + * @param value + * the config value to set + * @param options + * the optional [[ConfigOption]]s to use + * @return + * an exception if the set failed, otherwise nothing + */ + def setConfig( + stackName: String, + key: String, + value: ConfigValue, + options: ConfigOption* + ): Either[Exception, Unit] = + val maybePath = options.collectFirst { case ConfigOption.Path => "--path" } + val maybeSecret = if value.secret then "--secret" else "--plaintext" + val args = Seq("--stack", stackName, "config", "set") ++ maybePath ++ Seq(key, maybeSecret, "--", value.value) + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to set config '$key' for stack: '$stackName'")) + case Right(_) => Right(()) + end setConfig + + /** Sets all values in the provided config map for the specified stack name. [[LocalWorkspace]] writes the config to the matching + * `Pulumi.[stack].yaml` file in [[workDir]]. + * + * @param stackName + * the name of the stack + * @param config + * the [[ConfigMap]] to upsert against the existing config + * @param options + * the optional [[ConfigOption]]s to use + * @return + * an exception if the set failed, otherwise nothing + */ + def setAllConfig( + stackName: String, + config: ConfigMap, + options: ConfigOption* + ): Either[Exception, Unit] = + val maybePath = options.collectFirst { case ConfigOption.Path => "--path" } + val pairs: Seq[String] = config.flatMap { case (k, v) => + Seq(if v.secret then "--secret" else "--plaintext", s"$k=${v.value}") + }.toSeq + val args = Seq("--stack", stackName, "config", "set-all") ++ maybePath ++ ("--" +: pairs) + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to set all configs for stack: '$stackName'")) + case Right(_) => Right(()) + end setAllConfig + + /** Removes the specified key-value pair on the provided stack name. It will remove any matching values in the `Pulumi.[stack].yaml` file + * in [[workDir]]. + * + * @param stackName + * the name of the stack + * @param key + * the config key to remove + * @param options + * the optional [[ConfigOption]]s to use + * @return + * an exception if the remove failed, otherwise nothing + */ + def removeConfig( + stackName: String, + key: String, + options: ConfigOption* + ): Either[Exception, Unit] = + val maybePath = options.collectFirst { case ConfigOption.Path => "--path" } + val args = Seq("--stack", stackName, "config", "rm") ++ maybePath ++ Seq(key) + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to remove config '$key' for stack: '$stackName'")) + case _ => Right(()) + end removeConfig + + /** Removes all values in the provided key list for the specified stack name It will remove any matching values in the + * `Pulumi.[stack].yaml` file in [[workDir]]. + * + * @param stackName + * the name of the stack + * @param keys + * the list of keys to remove from the underlying config + * @param options + * the optional [[ConfigOption]]s to use + * @return + * an exception if the remove failed, otherwise nothing + */ + def removeAllConfig( + stackName: String, + keys: List[String], + options: ConfigOption* + ): Either[Exception, Unit] = + val maybePath = options.collectFirst { case ConfigOption.Path => "--path" } + val args = Seq("--stack", stackName, "config", "rm-all") ++ maybePath ++ keys + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to remove config '$keys' for stack: '$stackName'")) + case _ => Right(()) + end removeAllConfig + + /** Gets and sets the config map used with the last update for Stack matching stack name. It will overwrite all configuration in the + * `Pulumi.[stack].yaml` file in [[workDir]]. + * + * @param stackName + * the name of the stack + */ + def refreshConfig(stackName: String): Either[Exception, ConfigMap] = + val args = Seq("--stack", stackName, "config", "refresh", "--force") + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to refresh config for stack: '$stackName'")) + case _ => Right(()) + getAllConfig(stackName) + end refreshConfig + + /** Returns the value associated with the specified stack name and key, scoped to the [[LocalWorkspace]]. + * + * @param stackName + * the stack to read tag metadata from + * @param key + * the key to use for the tag lookup + * @return + * the tag value or an error if any + */ + def getTag(stackName: String, key: String): Either[Exception, String] = + val args = Seq("--stack", stackName, "stack", "tag", "get", key) + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to get stack tag '$key' for stack: '$stackName'")) + case Right(r) => Right(r.out) + end getTag + + /** Sets the specified key-value pair on the provided stack name. + * + * @param stackName + * the stack to set tag metadata on + * @param key + * the tag key to set + * @param value + * the tag value to set + * @return + * an exception if the set failed, otherwise nothing + */ + def setTag(stackName: String, key: String, value: String): Either[Exception, Unit] = + val args = Seq("--stack", stackName, "stack", "tag", "set", key, value) + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to set stack tag '$key' for stack: '$stackName'")) + case _ => Right(()) + end setTag + + /** Removes the specified key-value pair on the provided stack name. + * + * @param stackName + * the stack to remove tag metadata from + * @param key + * the tag key to remove + * @return + * an exception if the remove failed, otherwise nothing + */ + def removeTag(stackName: String, key: String): Either[Exception, Unit] = + val args = Seq("--stack", stackName, "stack", "tag", "rm", key) + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to remove stack tag '$key' for stack: '$stackName'")) + case _ => Right(()) + end removeTag + + /** Returns the tag map for the specified tag name, scoped to the current LocalWorkspace. + * + * @param stackName + * the stack to read tag metadata from + * @return + * the tag map or an error if any + */ + def listTags(stackName: String): Either[Exception, TagMap] = + val args = Seq("--stack", stackName, "stack", "tag", "list", "--json") + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to list stack tags for stack: '$stackName'")) + case Right(r) => TagMap.fromJson(r.out) + end listTags + + protected def envVars: AtomicReference[mutable.Map[String, String]] + def getEnvVars: Map[String, String] = envVars.get().toMap + def setEnvVars(variables: Map[String, String]): Unit = envVars.getAndUpdate(_ ++= variables) + def setEnvVar(key: String, value: String): Unit = envVars.getAndUpdate(_ += (key -> value)) + def unsetEnvVar(key: String): Unit = envVars.getAndUpdate(_ -= key) + + protected def rawSecretsProvider: AtomicReference[Option[String]] + def secretsProvider: Option[String] = rawSecretsProvider.get() + + /** Returns detailed information about the currently authenticated user, the logged-in Pulumi identity. + * @return + * the currently authenticated user details + */ + def whoAmI: Either[Exception, WhoAmIResult] = + // 3.58 added the --json flag (https://github.com/pulumi/pulumi/releases/tag/v3.58.0) + if pulumiVersion < model.SemanticVersion(3, 58, 0) + then Left(AutoError("whoAmI requires Pulumi version >= 3.58.0")) + else + val args = Seq("whoami", "--json") + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to get the currently authenticated user")) + case Right(r) => WhoAmIResult.fromJson(r.out) + end whoAmI + + /** The secrets provider to use for encryption and decryption of stack secrets. See: + * https://www.pulumi.com/docs/intro/concepts/secrets/#available-encryption-providers + * + * Valid secret providers types are `default`, `passphrase`, `awskms`, `azurekeyvault`, `gcpkms`, `hashivault`. + * + * To change the stack to use a cloud secrets backend, use the URL format, e.g.: `awskms://alias/ExampleAlias?region=us-east-1` + * + * @param stackName + * the name of the stack + * @param newSecretsProvider + * the new secrets provider to use + * @param options + * the optional [[ChangeSecretsProviderOption]]s to use + * @return + * the currently configured secrets provider + */ + def changeStackSecretsProvider( + stackName: String, + newSecretsProvider: String | SecretsProviderType, + options: ChangeSecretsProviderOption* + ): Either[Exception, Unit] = + val args: Seq[String] = Seq("stack", "change-secrets-provider", "--stack", stackName, newSecretsProvider) + + // If we're changing to a passphrase provider, we need to pass the new passphrase. + val maybeStdin = + if newSecretsProvider == "passphrase" then + options + .collectFirst { case NewPassphraseOption(newPassphrase) => + Seq(shell.ShellOption.Stdin(newPassphrase)) + } + .toRight { + AutoError("failed to change stack secrets provider, no new passphrase provided") + } + else Right(Seq.empty) + + for { + stdin <- maybeStdin + result <- pulumi(args)(stdin*) match + case Left(e) => Left(e.withMessage(s"failed to change stack secrets provider: '$newSecretsProvider'")) + case _ => Right(()) + } yield + // make sure we update the workspace secrets provider + this.rawSecretsProvider.set(Some(newSecretsProvider)) + result + end changeStackSecretsProvider + + /** Returns a summary of the currently selected stack, if any. + * @return + * the currently selected stack summary + */ + def stack: Either[Exception, Option[StackSummary]] = + listStacks.map(_.collectFirst { case s @ StackSummary(_, true, _, _, _, _) => s }) + + /** Creates and sets a new stack with the stack name, failing if one already exists. + * + * @param stackName + * the stack to create + * @return + * an exception if the create failed, otherwise nothing + */ + def createStack(stackName: String): Either[Exception, Stack] = + /*val maybeStackArgs = StackName.parse(stackName) match + case Left(e) => Left(e) + case Right(value) => + value.parts match + case (Some("organization"), _, stack) => Right(Seq(stack)) + case (Some(_), _, _) => Right(Seq("--stack", value)) + case (None, _, stack) => Right(Seq(stack)) + */ + val maybeSecretsProvider = secretsProvider.toSeq.flatMap(sp => Seq("--secrets-provider", sp)) + val maybeRemote = if remote then Seq("--remote") else Seq.empty + for + // stackArgs <- maybeStackArgs + res <- { + val args: Seq[String] = Seq("stack", "init") ++ Seq("--stack", stackName) ++ maybeSecretsProvider ++ maybeRemote + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to create stack: '$stackName'")) + case _ => + FullyQualifiedStackName + .parse(stackName) + .map(Stack(_, this)) + .left + .map(e => AutoError(s"failed to create stack: ${e.getMessage}", e)) + } + yield res + end createStack + + /** Selects and sets an existing stack matching the stack name, failing if none exists. + * + * @param stackName + * the stack to select + * @return + * an exception if the select failed, otherwise nothing + */ + def selectStack(stackName: String): Either[Exception, Stack] = + val maybeSelect = if !remote then Seq("select") else Seq.empty + val args = Seq("--stack", stackName, "stack") ++ maybeSelect + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to select stack: '$stackName'")) + case _ => FullyQualifiedStackName.parse(stackName).map(Stack(_, this)) + end selectStack + + /** Deletes the stack and all associated configuration and history. */ + def removeStack(stackName: String, options: RemoveOption*): Either[Exception, Unit] = + val maybeForce = options.collectFirst { case RemoveOption.Force => "--force" } + val args = Seq("--stack", stackName, "stack", "rm", "--yes") ++ maybeForce + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to remove stack: '$stackName'")) + case _ => Right(()) + end removeStack + + /** Returns all Stacks created under the current Project. This queries underlying backend may return stacks not present in the + * [[Workspace]] (as `Pulumi.[stack].yaml` files). + * @return + * a list of stack summaries + */ + def listStacks: Either[Exception, List[StackSummary]] = + pulumi("stack", "ls", "--json")() match + case Left(e) => Left(e.withMessage(s"failed to list stacks")) + case Right(r) => StackSummary.fromJsonList(r.out) + end listStacks + + /** Installs a plugin in the [[Workspace]], for example to use cloud providers like AWS or GCP. + * + * @param name + * the name of the plugin + * @param version + * the version of the plugin e.g. "v1.0.0" + * @param kind + * the kind of plugin, defaults to "resource" + * @param server + * the optional server to install the plugin from + * @return + * an exception if the install failed, otherwise nothing + */ + def installPlugin( + name: String, + version: String, + kind: String = "resource", + server: NotProvidedOr[String] = NotProvided + ): Either[Exception, Unit] = + val maybeServer = server.asOption.toSeq.flatMap(s => Seq("--server", s)) + val args = Seq("plugin", "install", kind, name, version) ++ maybeServer + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to install plugin: '$name'")) + case _ => Right(()) + end installPlugin + + /** Removes a plugin from the [[Workspace]] matching the specified name and version. + * + * @param name + * the optional name of the plugin + * @param versionRange + * optional semver range to check when removing plugins matching the given name e.g. "1.0.0", ">1.0.0". + * @param kind + * he kind of plugin, defaults to "resource" + * @return + * an exception if the remove failed, otherwise nothing + */ + def removePlugin( + name: NotProvidedOr[String] = NotProvided, + versionRange: NotProvidedOr[String] = NotProvided, + kind: String = "resource" + ): Either[Exception, Unit] = + val args = Seq("plugin", "rm", kind) ++ name.asOption ++ versionRange.asOption ++ Seq("--yes") + pulumi(args)() match + case Left(e) => Left(e.withMessage(s"failed to remove plugin: '$name'")) + case _ => Right(()) + end removePlugin + + /** Returns a list of all plugins installed in the [[Workspace]]. + * @return + * a list of plugin info + */ + def listPlugins: Either[Exception, List[PluginInfo]] = + pulumi("plugin", "ls", "--json")() match + case Left(e) => Left(e.withMessage(s"failed to list plugins")) + case Right(r) => PluginInfo.fromJsonList(r.out) + end listPlugins + + /** exports the deployment state of the stack. This can be combined with [[importStack]] to edit a stack's state (such as recovery from + * failed deployments). + * + * @param stackName + * the name of the stack + * @return + * the deployment state of the stack + */ + def exportStack(stackName: String): Either[Exception, UntypedDeployment] = + pulumi("--stack", stackName, "stack", "export", "--show-secrets")() match + case Left(e) => Left(e.withMessage(s"failed to export stack: '$stackName'")) + case Right(r) => UntypedDeployment.fromJson(r.out) + end exportStack + + /** imports the specified deployment state into a pre-existing stack. This can be combined with [[exportStack]] to edit a stack's state + * (such as recovery from failed deployments). + * + * @param stackName + * the name of the stack + * @param state + * the stack state to import + * @return + * an exception if the import failed, otherwise nothing + */ + def importStack(stackName: String, state: UntypedDeployment): Either[Exception, Unit] = + val maybeState = Try { + val tempFile = os.temp(prefix = "pulumi_auto", suffix = ".json") + os.write(tempFile, state.toJson) + }.toEither.left.map(e => AutoError(s"failed to import stack: ${e.getMessage}", e)) + + for tempFile <- maybeState + yield pulumi("--stack", stackName, "stack", "import", "--file", tempFile.toString)() match + case Left(e) => Left(e.withMessage(s"failed to import stack: '$stackName'")) + case _ => Right(()) + end importStack + + /** Gets the current set of [[Stack]] outputs from the last Stack.up operation. + * + * @param stackName + * the name of the stack + * @return + * the current set of [[Stack]] outputs from the last Stack.up + */ + def stackOutputs(stackName: String): Either[Exception, OutputMap] = + val maskedResult: Either[Exception, String] = pulumi("--stack", stackName, "stack", "output", "--json")() match + case Left(e) => Left(e.withMessage(s"failed to get stack outputs for stack: '$stackName'")) + case Right(r) => Right(r.out) + val plaintextResult: Either[Exception, String] = pulumi("--stack", stackName, "stack", "output", "--json", "--show-secrets")() match + case Left(e) => Left(e.withMessage(s"failed to get stack outputs for stack: '$stackName'")) + case Right(r) => Right(r.out) + // merge the masked and plaintext results, and mark any masked values as secret + for + masked <- maskedResult + plaintext <- plaintextResult + outputs <- OutputMap.fromJson(masked, plaintext) + yield outputs + + protected[auto] def repo: Option[GitRepo] + protected[auto] def remoteEnvVars: Map[String, EnvVarValue] + protected[auto] def preRunCommands: List[String] + protected[auto] def remoteSkipInstallDependencies: Boolean + +end LocalWorkspace + +object LocalWorkspace: + // minimal version of the Pulumi CLI that supports the Automation API + private val MinVersion = model.SemanticVersion(3, 2, 0) + // the extensions for Pulumi settings files + private val SettingsExtensions = List(".yaml", ".yml", ".json") + + /** Creates a new LocalWorkspace with the default options. + * + * @param options + * the configuration options for the workspace + * @return + * a new LocalWorkspace + */ + def apply(options: LocalWorkspaceOption*): Either[Exception, LocalWorkspace] = + val opts = LocalWorkspaceOptions.from(options*) + + val workDir: os.Path = { + val wd: os.Path = opts.workDir match + case NotProvided => os.temp.dir(prefix = "pulumi_auto") + case wd: os.Path => wd + + // if we have a repo, but no remote, then we need to clone the repo + opts.repo match + case repo: GitRepo if !opts.remote => + // now do the git clone + Git.setupGitRepo(wd, repo) match + case Left(e) => throw AutoError(s"failed to create workspace, unable to enlist in git repo: ${e.getMessage}", e) + case Right(projectDir) => projectDir + case _ => wd + } + + val pulumiHome = opts.pulumiHome.asOption + val envVars = AtomicReference(mutable.Map.from(opts.envVars)) + + // optOut indicates we should skip the version check. + val optOut: Boolean = shell.pulumi.env.pulumiAutomationApiSkipVersionCheck || + opts.envVars + .get(shell.pulumi.env.PulumiAutomationApiSkipVersionCheckEnv) + .map(isTruthy) + .getOrElse(false) + + val maybeCurrentVersion: Either[Exception, model.SemanticVersion] = pulumiVersion match + case Left(e) => Left(AutoError(s"failed to create workspace, unable to determine pulumi version: ${e.getMessage}", e)) + case Right(v) => + parseAndValidatePulumiVersion(MinVersion, v, optOut) match + case Left(e) => Left(AutoError(s"failed to create workspace, pulumi version is not supported: ${e.getMessage}", e)) + case r => r + + val remoteSupportChecked: Either[Exception, Unit] = + if !optOut && opts.remote then + // See if `--remote` is present in `pulumi preview --help`'s output. + supportsPulumiCmdFlag("--remote", "preview") match + case Left(e) => + Left(AutoError(s"failed to create workspace, unable to determine pulumi remote support: ${e.getMessage}", e)) + case Right(false) => Left(AutoError("Pulumi CLI does not support remote operations; please upgrade")) + case Right(true) => Right(()) + end match + else Right(()) + + val maybeWorkspace = for + currentVersion <- maybeCurrentVersion + _ <- remoteSupportChecked + yield InitializedLocalWorkspace( + workDir = workDir, + pulumiHome = pulumiHome, + envVars = envVars, + pulumiVersion = currentVersion, + program = opts.program.asOption, + remote = opts.remote, + project = opts.project.asOption, + stacks = opts.stacks, + rawSecretsProvider = AtomicReference(opts.secretsProvider.asOption), + repo = opts.repo.asOption, + remoteEnvVars = opts.remoteEnvVars, + preRunCommands = opts.preRunCommands, + remoteSkipInstallDependencies = opts.remoteSkipInstallDependencies + ) + + // save the project settings if provided + def saveProjectSettings(ws: Workspace): Either[Exception, Unit] = + opts.project match + case project: Project => + ws.saveProjectSettings(project) match + case Left(e) => Left(AutoError(s"failed to create workspace, unable to save project settings: ${e.getMessage}", e)) + case Right(_) => Right(()) // OK, saved + case NotProvided => Right(()) // no project to save, skip + end match + end saveProjectSettings + + // save all provided stack settings + def saveAllStackSettings(ws: Workspace): Either[Exception, Unit] = + def save(el: (String, ProjectStack)) = + val (stackName, stack) = el + ws.saveStackSettings(stackName, stack).left.map { e => + AutoError(s"failed to create workspace, unable to save stack settings: ${e.getMessage}", e) + } + end save + + val it = opts.stacks.iterator + while it.hasNext do + save(it.next()) match + case left @ Left(_) => return left + case Right(_) => // OK, saved + Right(()) + end saveAllStackSettings + + // run setup callback if we have a repo and we're not remote + def runRepoSetupFn(ws: Workspace): Either[Exception, Unit] = + opts.repo match + case repo: GitRepo if !opts.remote => + repo.setup.asOption match + // now run the setup callback + case Some(f: SetupFn) => + f.apply(ws).left.map { e => + AutoError(s"failed to create workspace, error while running git repository setup function: ${e.getMessage}", e) + } + case None => Right(()) // no repo setup callback, skip + case _ => Right(()) // no repo to setup or remote, skip the setup callback + end match + end runRepoSetupFn + + for + ws <- maybeWorkspace + _ <- saveProjectSettings(ws) + _ <- saveAllStackSettings(ws) + _ <- runRepoSetupFn(ws) + yield ws + end apply + + private def pulumiVersion: Either[Exception, String] = + shell.pulumi("version")() match + case Left(e) => Left(e.withMessage("could not determine pulumi version")) + case Right(r) => Right(r.out.trim) + end pulumiVersion + + private def parseAndValidatePulumiVersion( + minimalVersion: model.SemanticVersion, + currentVersion: String, + optOut: Boolean + ): Either[Exception, model.SemanticVersion] = + model.SemanticVersion.parseTolerant(currentVersion) match + case Left(e) => + Left( + AutoError( + s"Unable to parse Pulumi CLI version (skip with ${shell.pulumi.env.PulumiAutomationApiSkipVersionCheckEnv}=true): ${e.getMessage}" + ) + ) + case r @ Right(v) => + if !optOut && v < minimalVersion then + Left( + AutoError( + s"Pulumi CLI version is too old (skip with ${shell.pulumi.env.PulumiAutomationApiSkipVersionCheckEnv}=true): ${currentVersion} < ${v}" + ) + ) + else r + end parseAndValidatePulumiVersion + + /** Checks if a specified flag is supported by running a command with `--help` and checking if the flag is found within the resulting + * output. + * + * @param flag + * The flag to check for support + * @param additional + * The additional command arguments + * @return + * A boolean indicating if the flag is supported or an exception if the command failed + */ + private def supportsPulumiCmdFlag(flag: String, additional: os.Shellable*): Either[Exception, Boolean] = + import shell.ShellOption.* + // Run the command with `--help`, and then we'll look for the flag in the output. + val allArgs: Seq[os.Shellable] = "--help" +: additional + shell.pulumi(allArgs*)( + Env(shell.pulumi.env.PulumiDebugCommandsEnv, "true"), + Env(shell.pulumi.env.PulumiExperimentalEnv, "true") + ) match + case Left(e) => Left(e.withMessage(s"could not determine pulumi supported flags")) + case Right(r) => + // Does the help test in stdout mention the flag? If so, assume it's supported. + Right(r.out.contains(flag)) + + end supportsPulumiCmdFlag + + private[auto] final case class InitializedLocalWorkspace private[auto] ( + workDir: os.Path, + pulumiHome: Option[os.Path], + protected val envVars: AtomicReference[mutable.Map[String, String]], + program: Option[RunFunc], + protected val rawSecretsProvider: AtomicReference[Option[String]], + pulumiVersion: model.SemanticVersion, + remote: Boolean, + project: Option[Project], + stacks: Map[String, ProjectStack], + repo: Option[GitRepo], + remoteEnvVars: Map[String, EnvVarValue], + preRunCommands: List[String], + remoteSkipInstallDependencies: Boolean + ) extends LocalWorkspace + + // stack names come in many forms: + // s, o/p/s, u/p/s o/s + // so just return the last chunk which is what will be used in pulumi..yaml + private def getStackSettingsName(stackName: String) = StackName(stackName).parts._3 + + private def readProjectSettingsFromDir(workDir: os.Path): Either[Exception, Project] = + SettingsExtensions + .map { ext => workDir / shell.pulumi.ProjectFileName(ext) } + .collectFirst { + case projectPath if os.exists(projectPath) => + Project + .load(projectPath) + .left + .map(e => AutoError(s"failed to load project settings: ${e.getMessage}", e)) + } match + case Some(value) => value + case None => Left(AutoError("unable to find project settings in workspace")) + end readProjectSettingsFromDir + + private def readStackSettingFromDir(workDir: os.Path, stackName: String): Either[Exception, ProjectStack] = + val actualStackName = getStackSettingsName(stackName) + SettingsExtensions + .map { ext => workDir / shell.pulumi.StackFileName(actualStackName, ext) } + .collectFirst { + case projectPath if os.exists(projectPath) => + ProjectStack + .load(projectPath) + .left + .map(e => AutoError(s"failed to load stack settings: ${e.getMessage}", e)) + } match + case Some(value) => value + case None => Left(AutoError("unable to find stack settings in workspace")) + + private[auto] def getProjectSettings( + projectName: String, + opts: Seq[LocalWorkspaceOption] + ): Either[Exception, Project] = + val options = LocalWorkspaceOptions.from(opts*) + + options.project match + // If the Project is included in the opts, just use that. + case project: Project => Right(project) + case NotProvided => + // If WorkDir is specified, try to read any existing project settings before resorting to + // creating a default project. + options.workDir match + case path: os.Path => + readProjectSettingsFromDir(path) match + case Left(AutoError(Some(msg), _)) if msg == "unable to find project settings in workspace" => + defaultInlineProject(projectName) + case Left(e) => Left(AutoError(s"failed to load project '$projectName' settings: $e", e)) + case r => r + case NotProvided => + // If there was no workdir specified, create the default project. + defaultInlineProject(projectName) + end getProjectSettings + + private def defaultInlineProject(projectName: String): Either[Exception, Project] = + Try { + Project( + name = PackageName.parse(projectName), + runtime = "scala", + main = Some(os.pwd.toString()) + ) + }.toEither.left.map(e => AutoError(s"failed to create default project settings: ${e.getMessage}", e)) + end defaultInlineProject +end LocalWorkspace + +sealed trait LocalWorkspaceOption +object LocalWorkspaceOption: + + /** The directory to execute commands from and store state. Defaults to a tmp dir. + * @param path + * work directory to use + */ + case class WorkDir(path: os.Path) extends LocalWorkspaceOption + + /** The Pulumi program to execute. If none is supplied, the program identified in `$WORKDIR/Pulumi.yaml` will be used instead. + * @param program + * the Pulumi program to execute + */ + // not a case class because function won't be useful in equality checks + class Program(val program: RunFunc) extends LocalWorkspaceOption + object Program: + def apply(program: RunFunc): Program = new Program(program) + def unapply(p: Program): Option[RunFunc] = Some(p.program) + + /** The path to the Pulumi home directory. + * + * Overrides the metadata directory for pulumi commands. This customizes the location of `$PULUMI_HOME` where metadata is stored and + * plugins are installed. If not provided, will be read from the environment variable `PULUMI_HOME` or default to `~/.pulumi` + */ + case class PulumiHome(path: os.Path) extends LocalWorkspaceOption + + /** The project settings for the workspace. + */ + case class Project(project: besom.auto.internal.Project) extends LocalWorkspaceOption + + /** A map of `[stackName -> stack settings objects]` to seed the workspace. + */ + case class Stacks(stacks: Map[String, besom.auto.internal.ProjectStack]) extends LocalWorkspaceOption + + /** A git repo with a Pulumi Project to clone into the `workDir`. + */ + case class Repo(repo: GitRepo) extends LocalWorkspaceOption + + /** The Secrets Provider to use with the current Stack. + */ + case class SecretsProvider(provider: String) extends LocalWorkspaceOption + + /** A map of environment values scoped to the workspace. These values will be passed to all Workspace and Stack level commands. + */ + case class EnvVars(envVars: Map[String, String]) extends LocalWorkspaceOption + object EnvVars: + def apply(env: (String, String)*): EnvVars = new EnvVars(env.toMap) + def apply(key: String, value: String): EnvVars = EnvVars(Map(key -> value)) + + /** Whether the workspace represents a remote workspace. + */ + case object Remote extends LocalWorkspaceOption + + /** Remote environment variables to be passed to the remote Pulumi operation. + */ + case class RemoteEnvVars(envVars: Map[String, EnvVarValue]) extends LocalWorkspaceOption + + /** An optional list of arbitrary commands to run before the remote Pulumi operation is invoked. + */ + case class PreRunCommands(commands: List[String]) extends LocalWorkspaceOption + + /** Sets whether to skip the default dependency installation step. + */ + case object RemoteSkipInstallDependencies extends LocalWorkspaceOption + +end LocalWorkspaceOption + +/** The configuration options for a [[LocalWorkspace]]. + * + * @param workDir + * the directory to execute commands from and store state. Defaults to a tmp dir. + * @param program + * the Pulumi Program to execute. If none is supplied, the program identified in `$WORKDIR/Pulumi.yaml` will be used instead. + * @param pulumiHome + * the path to the Pulumi home directory.* Overrides the metadata directory for pulumi commands. This customizes the location of + * `$PULUMI_HOME` where metadata is stored and plugins are installed. If not provided, will be read from the environment variable + * `PULUMI_HOME` or default to `~/.pulumi` + * @param project + * the project settings for the workspace. + * @param stacks + * a map of `[stackName -> stack settings objects]` to seed the workspace. + * @param repo + * a git repo with a Pulumi Project to clone into the `workDir`. + * @param secretsProvider + * the Secrets Provider to use with the current Stack. + * @param envVars + * a map of environment values scoped to the workspace. These values will be passed to all Workspace and Stack level commands. + * @param remote + * whether the workspace represents a remote workspace. + * @param remoteEnvVars + * remote environment variables to be passed to the remote Pulumi operation. + * @param preRunCommands + * an optional list of arbitrary commands to run before the remote Pulumi operation is invoked. + * @param remoteSkipInstallDependencies + * sets whether to skip the default dependency installation step. + */ +case class LocalWorkspaceOptions( + workDir: NotProvidedOr[os.Path] = NotProvided, + program: NotProvidedOr[RunFunc] = NotProvided, + pulumiHome: NotProvidedOr[os.Path] = NotProvided, + project: NotProvidedOr[Project] = NotProvided, + stacks: Map[String, ProjectStack] = Map.empty, + repo: NotProvidedOr[GitRepo] = NotProvided, + secretsProvider: NotProvidedOr[String] = NotProvided, + envVars: Map[String, String] = Map.empty, + remote: Boolean = false, + remoteEnvVars: Map[String, EnvVarValue] = Map.empty, + preRunCommands: List[String] = List.empty, + remoteSkipInstallDependencies: Boolean = false +) +object LocalWorkspaceOptions: + /** Merge options, last specified value wins + * @return + * a new [[LocalWorkspaceOptions]] + */ + def from(opts: LocalWorkspaceOption*): LocalWorkspaceOptions = from(opts.toList) + def from(opts: List[LocalWorkspaceOption]): LocalWorkspaceOptions = + opts match + case LocalWorkspaceOption.WorkDir(path) :: tail => from(tail).copy(workDir = path) + case LocalWorkspaceOption.Program(program) :: tail => from(tail).copy(program = program) + case LocalWorkspaceOption.PulumiHome(path) :: tail => from(tail).copy(pulumiHome = path) + case LocalWorkspaceOption.Project(project) :: tail => from(tail).copy(project = project) + case LocalWorkspaceOption.Stacks(stacks) :: tail => from(tail).copy(stacks = stacks) + case LocalWorkspaceOption.Repo(repo) :: tail => from(tail).copy(repo = repo) + case LocalWorkspaceOption.SecretsProvider(provider) :: tail => from(tail).copy(secretsProvider = provider) + case LocalWorkspaceOption.Remote :: tail => from(tail).copy(remote = true) + case LocalWorkspaceOption.RemoteEnvVars(envVars) :: tail => from(tail).copy(remoteEnvVars = envVars) + case LocalWorkspaceOption.PreRunCommands(commands) :: tail => from(tail).copy(preRunCommands = commands) + case LocalWorkspaceOption.RemoteSkipInstallDependencies :: tail => from(tail).copy(remoteSkipInstallDependencies = true) + case LocalWorkspaceOption.EnvVars(env) :: tail => { + val old = from(tail*) + old.copy(envVars = old.envVars ++ env) + } + case Nil => LocalWorkspaceOptions() + case o => throw AutoError(s"Unknown LocalWorkspaceOption: $o") + +/** GitRepo contains info to acquire and setup a Pulumi program from a git repository. + * + * @param url + * URL to clone git repo + * @param projectPath + * Optional path relative to the repo root specifying location of the pulumi program. Specifying this option will update the + * [[Workspace.workDir]] accordingly. + * @param branch + * Optional branch to checkout. + * @param commitHash + * Optional commit to checkout. + * @param setup + * Optional function to execute after enlisting in the specified repo. + * @param auth + * GitAuth is the different Authentication options for the Git repository + * @param shallow + * Shallow disables fetching the repo's entire history. + */ +case class GitRepo( + url: String, + projectPath: NotProvidedOr[String] = NotProvided, + branch: NotProvidedOr[String] = NotProvided, + commitHash: NotProvidedOr[String] = NotProvided, + setup: NotProvidedOr[SetupFn] = NotProvided, + auth: NotProvidedOr[GitAuth] = NotProvided, + shallow: Boolean = false +) + +type SetupFn = Workspace => Either[Exception, Unit] + +/** GitAuth is the authentication details that can be specified for a private Git repo. + * + * There are 3 different authentication paths: + * - [[PersonalAccessToken]] + * - [[SSHPrivateKeyPath]] or [[SSHPrivateKey]] (and it's potential passphrase) + * - [[UsernameAndPassword]] + */ +sealed trait GitAuth +object GitAuth: + + /** Use GitHub Personal Access Token + * @param token + * a GitHub personal access token in replacement of your password + */ + case class PersonalAccessToken(token: String) extends GitAuth + + /** Use SSH Private Key + * + * When using [[SSHPrivateKeyPath]], the URL of the repository must be in the format `git@github.com:org/repository.git` - if the url is + * not in this format, then an error 'unable to clone repo: invalid auth method' will be returned + * + * @param path + * the absolute path to a private key for access to the git repo + * @param passphrase + * the optional passphrase for the SSH Private Key + */ + case class SSHPrivateKeyPath(path: String, passphrase: NotProvidedOr[String]) extends GitAuth + + /** Use SSH Private Key + * + * When using [[SSHPrivateKey]] the URL of the repository must be in the format `git@github.com:org/repository.git` - if the url is not + * in this format, then an error 'unable to clone repo: invalid auth method' will be returned + * @param key + * the (contents) private key for access to the git repo + * @param passphrase + * the optional passphrase for the SSH Private Key + */ + case class SSHPrivateKey(key: String, passphrase: NotProvidedOr[String]) extends GitAuth + + /** Use Username and Password + * @param username + * the username to use when authenticating to a git repository + * @param password + * the password that pairs with a username for authentication to a git repository + */ + case class UsernameAndPassword(username: String, password: String) extends GitAuth +end GitAuth + +/** EnvVarValue represents the value of an envvar. A value can be a secret, which is passed along to remote operations when used with remote + * workspaces, otherwise, it has no effect. + * + * @param value + * the value of the environment variable + * @param secret + * a boolean indicating whether the value is a secret or not + */ +case class EnvVarValue(value: String, secret: Boolean = false) diff --git a/auto/src/main/scala/besom/auto/internal/Stack.scala b/auto/src/main/scala/besom/auto/internal/Stack.scala new file mode 100644 index 00000000..9bc2964f --- /dev/null +++ b/auto/src/main/scala/besom/auto/internal/Stack.scala @@ -0,0 +1,1527 @@ +package besom.auto.internal + +import besom.internal.{LanguageRuntimeServer, LanguageRuntimeService} +import besom.json.* +import besom.util.* + +import scala.util.Try + +/** Stack is an isolated, independently configurable instance of a Pulumi program. Stack exposes methods for the full pulumi lifecycle + * (up/preview/refresh/destroy), as well as managing configuration. Multiple Stacks are commonly used to denote different phases of + * development (such as development, staging and production) or feature branches (such as feature-x-dev, jane-feature-x-dev). + * + * @param name + * the name identifying the stack + * @param workspace + * the underlying [[Workspace]] backing the [[Stack]] + */ +case class Stack(name: String, workspace: Workspace): + import besom.auto.internal.Stack.* + + protected[auto] def pulumi(additional: os.Shellable*)(opts: shell.ShellOption*): Either[ShellAutoError | AutoError, shell.Result] = + for + _ <- + if workspace.remote then + workspace + .serializeArgsForOp(name) + .left + .map(e => AutoError("Failed to run command, error getting additional args", e)) + else Right(()) + + result <- workspace.pulumi(additional)(opts*) + + _ <- + if workspace.remote then + workspace + .postCommandCallback(name) + .left + .map(e => AutoError("Command ran successfully, but failed to run post command callback", e)) + else Right(()) + yield result + end pulumi + + /** Edits the secrets provider for the stack. + * + * @see + * [[Workspace.changeStackSecretsProvider]] + * + * @param newSecretsProvider + * The new secrets provider. + * @param options + * The options for changing the secrets provider. + * @return + * Unit indicating success or failure. + */ + def changeSecretsProvider(newSecretsProvider: String, options: ChangeSecretsProviderOption*): Either[Exception, Unit] = + workspace.changeStackSecretsProvider(name, newSecretsProvider, options*) + + /** Preview preforms a dry-run update to a stack, returning pending changes. + * @see + * [[https://www.pulumi.com/docs/reference/cli/pulumi_preview/]] + * @param options + * the options for the preview operation + * @return + * the preview result or an error if any + */ + def preview(options: PreviewOption*): Either[Exception, PreviewResult] = + val opts = PreviewOptions.from(options*) + + val sharedArgs: Seq[String] = opts.debugLogOpts.asArgs + ++ opts.message.map(s"--message=" + _) + ++ Option.when(opts.expectNoChanges)("--expect-no-changes") + ++ Option.when(opts.diff)("--diff") + ++ opts.replace.map("--replace=" + _) + ++ opts.target.map("--target=" + _) + ++ opts.policyPacks.map("--policy-pack=" + _) + ++ opts.policyPackConfigs.map("--policy-pack-config=" + _) + ++ Option.when(opts.targetDependents)("--target-dependents") + ++ opts.parallel.filter(_ > 0).map(s"--parallel=" + _) + ++ opts.userAgent.map(s"--exec-agent=" + _) + ++ opts.color.map(s"--color=" + _) + ++ opts.plan.map(s"--save-plan=" + _) + ++ remoteArgs // Apply the remote args, if needed + + val kindArgs: Seq[String] = + if workspace.program.isDefined then + val address = startLanguageRuntimeServer() + Seq(s"--exec-kind=${ExecKind.AutoInline}", s"--client=$address") + else Seq(s"--exec-kind=${ExecKind.AutoLocal}") + + for + eventsPath <- eventLogsPath("preview") + r <- { + val watchArgs: Seq[String] = Seq("--event-log=" + eventsPath) + val args: Seq[String] = Seq("preview") ++ sharedArgs ++ kindArgs ++ watchArgs + pulumi(args)().left.map(AutoError("Preview failed", _)) // after this line pulumi cli is no longer running + } + summary <- extractSummaryEventFromEventLog(eventsPath) + yield PreviewResult(stdout = r.out, stderr = r.err, summary = summary.resourceChanges) + end preview + + def extractSummaryEventFromEventLog(path: os.Path): Either[Exception, SummaryEvent] = + val maybeEvents = os.read.lines(path).map(EngineEvent.fromJson(_)) + + if maybeEvents.forall(_.isRight) then + maybeEvents + .collectFirst { case Right(ee) if ee.summaryEvent.isDefined => ee.summaryEvent.get } + .toRight(AutoError("Failed to get preview summary, got no summary event")) + else + val err = + maybeEvents + .collect { case Left(e) => e } + .foldLeft(AutoError("Failed to get event log, got invalid events")) { case (acc, e) => + acc.addSuppressed(e) + acc + } + + Left(err) + + end extractSummaryEventFromEventLog + + /** Create or update the resources in a stack by executing the program in the Workspace. Update updates the resources in a stack by + * executing the program in the Workspace associated with this stack, if one is provided. + * @see + * [[https://www.pulumi.com/docs/reference/cli/pulumi_up/]] + * @param options + * the options for the update operation + * @return + * the update result or an error if any + */ + def up(options: UpOption*): Either[Exception, UpResult] = + val opts = UpOptions.from(options*) + + val sharedArgs = opts.debugLogOpts.asArgs + ++ opts.message.map(s"--message=" + _) + ++ Option.when(opts.expectNoChanges)("--expect-no-changes") + ++ Option.when(opts.diff)("--diff") + ++ opts.replace.map("--replace=" + _) + ++ opts.target.map("--target=" + _) + ++ opts.policyPacks.map("--policy-pack=" + _) + ++ opts.policyPackConfigs.map("--policy-pack-config=" + _) + ++ Option.when(opts.targetDependents)("--target-dependents") + ++ opts.parallel.filter(_ > 0).map(s"--parallel=" + _) + ++ opts.userAgent.map(s"--exec-agent=" + _) + ++ opts.color.map(s"--color=" + _) + ++ opts.plan.map(s"--plan=" + _) + ++ remoteArgs // Apply the remote args, if needed + + val kindArgs: Seq[String] = + if workspace.program.isDefined then + val address = startLanguageRuntimeServer() + Seq(s"--exec-kind=${ExecKind.AutoInline}", s"--client=$address") + else Seq(s"--exec-kind=${ExecKind.AutoLocal}") + + val watchArgs = Seq.empty[String] // TODO: missing event stream, implement watchArgs + + val args: Seq[String] = Seq("up", "--yes", "--skip-preview") ++ sharedArgs ++ kindArgs ++ watchArgs + + pulumi(args)( +// FIXME: missing streams, implement progressStreams and errorProgressStreams +// shell.Option.Stdout(opts.progressStreams), +// shell.Option.Stderr(opts.errorProgressStreams) + ) match + case Left(e) => Left(AutoError("Up failed", e)) + case Right(r) => + for + outputs <- outputs + history <- history( + pageSize = 1, + page = 1, + /* If it's a remote workspace, don't set ShowSecrets to prevent attempting to load the project file. */ + Option.when(opts.showSecrets && !isRemote)(HistoryOption.ShowSecrets).toSeq* + ).flatMap(_.headOption.toRight(AutoError("Failed to get history, result was empty"))) + yield UpResult( + stdout = r.out, + stderr = r.err, + outputs = outputs, + summary = history + ) + end up + + /** Refresh compares the current stack’s resource state with the state known to exist in the actual cloud provider. Any such changes are + * adopted into the current stack. + * + * @see + * [[https://www.pulumi.com/docs/reference/cli/pulumi_refresh/]] + * @param options + * the options for the refresh operation + * @return + * the refresh result or an error if any + */ + def refresh(options: RefreshOption*): Either[Exception, RefreshResult] = + val opts = RefreshOptions.from(options*) + + val sharedArgs = opts.debugLogOpts.asArgs + ++ opts.message.map(s"--message=" + _) + ++ Option.when(opts.expectNoChanges)("--expect-no-changes") + ++ opts.target.map("--target=" + _) + ++ opts.parallel.filter(_ > 0).map(s"--parallel=" + _) + ++ opts.userAgent.map(s"--exec-agent=" + _) + ++ opts.color.map(s"--color=" + _) + ++ (if workspace.program.isDefined then Seq(s"--exec-kind=${ExecKind.AutoInline}") else Seq(s"--exec-kind=${ExecKind.AutoLocal}")) + ++ remoteArgs // Apply the remote args, if needed + + val watchArgs = Seq.empty[String] // TODO: missing event stream, implement watchArgs + + val args: Seq[String] = Seq("refresh", "--yes", "--skip-preview") ++ sharedArgs ++ watchArgs + pulumi(args)() match + case Left(e) => Left(AutoError("Refresh failed", e)) + case Right(r) => + for history <- history( + pageSize = 1, + page = 1, + /* If it's a remote workspace, don't set ShowSecrets to prevent attempting to load the project file. */ + Option.when(opts.showSecrets && !isRemote)(HistoryOption.ShowSecrets).toSeq* + ).flatMap(_.headOption.toRight(AutoError("Failed to get history, result was empty"))) + yield RefreshResult( + stdout = r.out, + stderr = r.err, + summary = history + ) + end refresh + + /** Destroy deletes all resources in a stack, leaving all history and configuration intact. + * + * @see + * [[https://www.pulumi.com/docs/reference/cli/pulumi_destroy/]] + * @param options + * the options for the destroy operation + * @return + * the destroy result or an error if any + */ + def destroy(options: DestroyOption*): Either[Exception, DestroyResult] = + val opts = DestroyOptions.from(options*) + + val sharedArgs = opts.debugLogOpts.asArgs + ++ opts.message.map(s"--message=" + _) + ++ opts.target.map("--target=" + _) + ++ Option.when(opts.targetDependents)("--target-dependents") + ++ opts.parallel.filter(_ > 0).map(s"--parallel=" + _) + ++ opts.userAgent.map(s"--exec-agent=" + _) + ++ opts.color.map(s"--color=" + _) + ++ (if workspace.program.isDefined then Seq(s"--exec-kind=${ExecKind.AutoInline}") else Seq(s"--exec-kind=${ExecKind.AutoLocal}")) + ++ remoteArgs // Apply the remote args, if needed + + val watchArgs = Seq.empty[String] // TODO: missing event stream, implement watchArgs + + val args: Seq[String] = Seq("destroy", "--yes", "--skip-preview") ++ sharedArgs ++ watchArgs + pulumi(args)() match + case Left(e) => Left(AutoError("Destroy failed", e)) + case Right(r) => + for history <- history( + pageSize = 1, + page = 1, + /* If it's a remote workspace, don't set ShowSecrets to prevent attempting to load the project file. */ + Option.when(opts.showSecrets && !isRemote)(HistoryOption.ShowSecrets).toSeq* + ).flatMap(_.headOption.toRight(AutoError("Failed to get history, result was empty"))) + yield DestroyResult( + stdout = r.out, + stderr = r.err, + summary = history + ) + + end destroy + + /** Get the current set of [[Stack]] outputs from the last [[Stack.up]] + */ + def outputs: Either[Exception, OutputMap] = workspace.stackOutputs(name) + + /** History returns a list summarizing all previous and current results from [[Stack]] lifecycle operations (up/preview/refresh/destroy). + * + * @param pageSize + * used with 'page' to control number of results returned (e.g. 10) + * @param page + * used with 'page-size' to paginate results (e.g. 1) + * @param options + * the options for the history operation + * @return + * the history result or an error if any + */ + def history(pageSize: Int, page: Int, options: HistoryOption*): Either[Exception, List[UpdateSummary]] = + val opts = HistoryOptions.from(options*) + val args = Seq.empty[String] + ++ Option.when(opts.showSecrets)("--show-secrets") + ++ Option + .when(pageSize > 0) { + Seq(s"--page-size=$pageSize", s"--page=${if page < 1 then 1 else page}") + } + .toSeq + .flatten + + pulumi("stack", "history", "--json", args)().fold( + e => Left(AutoError("History failed", e)), + r => UpdateSummary.fromJsonList(r.out).left.map(e => AutoError("Failed to parse history JSON", e)) + ) + end history + + /** Adds environments to the end of a stack's import list. Imported environments are merged in order per the ESC merge rules. The list of + * environments behaves as if it were the import list in an anonymous environment. + * + * @param envs + * the environments to add + * @return + * returns nothing if successful, or an error if any + */ + def addEnvironments(envs: String*): Either[Exception, Unit] = + workspace.addEnvironments(name, envs*) + + /** ListEnvironments returns the list of environments from the stack's configuration. + * + * @return + * the list of environments or an error if any + */ + def listEnvironments: Either[Exception, List[String]] = + workspace.listEnvironments(name) + + /** Removes an environment from a stack's configuration. + * + * @param env + * the environment to remove + * @return + * nothing if successful, or an error if any + */ + def removeEnvironment(env: String): Either[Exception, Unit] = + workspace.removeEnvironment(name, env) + + /** Gets the config value associated with the specified key and the optional [[ConfigOption]]s. + * + * @param key + * the key of the config + * @param opts + * the optional [[ConfigOption]]s + * @return + * the [[ConfigValue]] or an error if any + */ + def getConfig(key: String, opts: ConfigOption*): Either[Exception, ConfigValue] = + workspace.getConfig(name, key, opts*) + + /** Gets the full config map. + * + * @return + * the ConfigMap or an error if any + */ + def getAllConfig: Either[Exception, ConfigMap] = + workspace.getAllConfig(name) + + /** Sets the specified config key-value pair using the optional [[ConfigOption]]s. + * + * @param key + * the key of the config + * @param value + * the value to set + * @return + * nothing if successful, or an error if any + */ + def setConfig(key: String, value: ConfigValue, options: ConfigOption*): Either[Exception, Unit] = + workspace.setConfig(name, key, value, options*) + + /** Sets all values in the provided config map using the optional [[ConfigOption]]s. + * + * @param config + * the config map to set. + * @param opts + * the optional [[ConfigOption]]s. + * @return + * nothing if successful, or an error if any + */ + def setAllConfig(config: ConfigMap, opts: ConfigOption*): Either[Exception, Unit] = + workspace.setAllConfig(name, config, opts*) + + /** Removes the specified config key-value pair using the optional [[ConfigOption]]s. + * + * @param key + * the key of the config to remove + * @param opts + * the optional ConfigOptions + * @return + * nothing if successful, or an error if any + */ + def removeConfig(key: String, opts: ConfigOption*): Either[Exception, Unit] = + workspace.removeConfig(name, key, opts*) + + /** Gets and sets the config map used with the last Update. + * @return + * the ConfigMap or an error if any + */ + def refreshConfig(): Either[Exception, ConfigMap] = + workspace.refreshConfig(name) + + /** Gets the tag value associated with specified key. + * + * @param key + * whe key of the tag + * @return + * the tag value or an error if any + */ + def getTag(key: String): Either[Exception, String] = + workspace.getTag(name, key) + + /** Sets a tag key-value pair on the stack. + * + * @param key + * the key of the tag + * @param value + * the value of the tag + * @return + * nothing if successful, or an error if any + */ + def setTag(key: String, value: String): Either[Exception, Unit] = + workspace.setTag(name, key, value) + + /** Removes the specified tag key-value pair from the stack. + * + * @param key + * the key of the tag to remove + * @return + * nothing if successful, or an error if any + */ + def removeTag(key: String): Either[Exception, Unit] = + workspace.removeTag(name, key) + + /** Returns the full key-value tag map associated with the stack. + * + * @return + * the tag map or an error if any + */ + def listTags: Either[Exception, Map[String, String]] = + workspace.listTags(name) + + /** @return + * a summary of the Stack including its URL + */ + def info: Either[Exception, Option[StackSummary]] = + for + _ <- workspace.selectStack(name) + s <- workspace.stack + yield s + end info + + /** Cancels a stack's currently running update. It returns an error if no update is currently running. Note that this operation is _very + * dangerous_, and may leave the stack in an inconsistent state if a resource operation was pending when the update was canceled. This + * command is not supported for local backends. + * + * @return + * nothing if successful, or an error if any + */ + def cancel(): Either[Exception, Unit] = + pulumi("cancel", "--yes")().fold( + e => Left(AutoError("Failed to cancel update", e)), + _ => Right(()) + ) + end cancel + + /** Exports the deployment state of the stack. This can be combined with [[Stack.importState]] to edit a stack's state (such as recovery + * from failed deployments). + * + * @return + * the deployment state of the stack or an error if any + */ + def exportState(): Either[Exception, UntypedDeployment] = + workspace.exportStack(name) + + /** Imports the specified deployment state into the stack. This can be combined with [[Stack.exportState]] to edit a stack's state (such + * as recovery from failed deployments). + * + * @param state + * The deployment state to import into the stack. + * @return + * nothing if successful, or an error if any + */ + def importState(state: UntypedDeployment): Either[Exception, Unit] = + workspace.importStack(name, state) + + /** @return + * returns true if the stack is remote + */ + def isRemote: Boolean = workspace.remote + + private def remoteArgs: Seq[String] = + def args( + repo: Option[GitRepo], + preRunCommands: List[String] = List.empty, + remoteEnvVars: Map[String, EnvVarValue] = Map.empty, + skipInstallDependencies: Boolean = false + ): Seq[String] = + repo.map(_.url).toSeq + ++ repo.flatMap(_.branch.map("--remote-git-branch=" + _)) + ++ repo.flatMap(_.commitHash.map("--remote-git-commit=" + _)) + ++ repo.flatMap(_.projectPath.map("--remote-git-repo-dir=" + _)) + ++ repo.toSeq.flatMap( + _.auth.asSeq.flatMap { + case GitAuth.PersonalAccessToken(token) => + Seq(s"--remote-git-auth-access-token=$token") + case GitAuth.SSHPrivateKey(key, passphrase) => + Seq(s"--remote-git-auth-ssh-private-key=$key") ++ passphrase.map("-remote-git-auth-password=" + _) + case GitAuth.SSHPrivateKeyPath(path, passphrase) => + Seq(s"--remote-git-auth-ssh-private-key-path=$path") ++ passphrase.map("-remote-git-auth-password=" + _) + case GitAuth.UsernameAndPassword(username, password) => + Seq(s"--remote-git-auth-username=$username", s"--remote-git-auth-password=$password") + } + ) + ++ preRunCommands.map("--remote-pre-run-command=" + _) + ++ remoteEnvVars.map { case (k, v) => s"--remote-env${if v.secret then "-secret" else ""}=$k=${v.value}" } + ++ Option.when(skipInstallDependencies)("--remote-skip-install-dependencies") + + workspace match + case ws: LocalWorkspace => + if !ws.remote then Seq.empty + else + args( + repo = ws.repo, + preRunCommands = ws.preRunCommands, + remoteEnvVars = ws.remoteEnvVars, + skipInstallDependencies = ws.remoteSkipInstallDependencies + ) + // TODO: implement RemoteWorkspace + case null => throw AutoError("Workspace is null") + case _ => throw AutoError(s"Unknown workspace type: ${workspace.getClass.getTypeName}") + end remoteArgs + + private def eventLogsPath(command: String): Either[Exception, os.Path] = + Try { + val logsDir = os.temp.dir(prefix = s"automation-logs-$command-") + val path = logsDir / "eventlog.txt" + os.write(path, "") + os.exists(path) match + case true => println(os.proc("ls", "-la", path).call().out.text()) // FIXME: remove the println, use logger + case false => throw AutoError(s"Failed to create event log file: $path") + path + }.toEither.left.map(e => AutoError("Failed to create temporary directory for event logs", e)) + end eventLogsPath + + private def startLanguageRuntimeServer(): String = + import concurrent.ExecutionContext.Implicits.global // FIXME: use a custom execution context + LanguageRuntimeServer(LanguageRuntimeService).start().toString + end startLanguageRuntimeServer + +end Stack + +object Stack: + /** A flag used to identify the origin of a command. */ + enum ExecKind(val value: String) extends Enum[ExecKind]: + override def toString: String = value + + /** Command originating from automation API using a traditional Pulumi project. */ + case AutoLocal extends ExecKind("auto.local") + + /** Command originating from automation API using an inline Pulumi project. + */ + case AutoInline extends ExecKind("auto.inline") + + /** Command originating from the CLI using a traditional Pulumi project. + */ + case CLI extends ExecKind("cli") + + def apply(name: String, workspace: Workspace): Stack = new Stack(name, workspace) + + /** Creates a new [[Stack]] using the given [[Workspace]] and stack name. It fails if a stack with that name already exists. + * + * @param stackName + * the name of the stack + * @param workspace + * the [[Workspace]] to use + * @return + * the [[Stack]] or an error if any + */ + def create(stackName: String, workspace: Workspace): Either[Exception, Stack] = + workspace.createStack(stackName) + + /** Selects a [[Stack]] using the given [[Workspace]] and stack name. It returns an error if the given [[Stack]] does not exist. + * @param stackName + * the name of the stack + * @param workspace + * the [[Workspace]] to use + * @return + * the [[Stack]] or an error if any + */ + def select(stackName: String, workspace: Workspace): Either[Exception, Stack] = + workspace.selectStack(stackName) + + /** Tries to select a [[Stack]] using the given [[Workspace]] and stack name, or falls back to trying to create the stack if it does not + * exist. + * + * @param stackName + * the name of the stack + * @param workspace + * the workspace to use + * @return + * the [[Stack]] or an error if any + */ + def upsert(stackName: String, workspace: Workspace): Either[Exception, Stack] = { + select(stackName, workspace).fold( + { + // If the stack is not found, attempt to create it. + case e: ShellAutoError if e.isSelectStack404Error => create(stackName, workspace) + case err => Left(err) + }, + Right(_) // If the stack was found, return it. + ) + } + +end Stack + +/** [[Stack.preview]] options + * @see + * [[PreviewOptions]] + */ +sealed trait PreviewOption +object PreviewOption: + + /** The number of resource operations to run in parallel at once during the update (1 for no parallelism). Defaults to unbounded. (default + * 2147483647) + */ + case class Parallel(n: Int) extends PreviewOption + + /** A message to associate with the preview operation + */ + case class Message(message: String) extends PreviewOption + + /** Will cause the preview to return an error if any changes occur + */ + case object ExpectNoChanges extends PreviewOption + + /** Displays operation as a rich diff showing the overall change + */ + case object Diff extends PreviewOption + + /** Specifies an array of resource URNs to explicitly replace during the preview + */ + case class Replace(urns: String*) extends PreviewOption + + /** Specifies an exclusive list of resource URNs to update + */ + case class Target(urns: String*) extends PreviewOption + + /** Allows updating of dependent targets discovered but not specified in the [[Target]] list + */ + case object TargetDependents extends PreviewOption + + /** Provides options for verbose logging to standard error, and enabling plugin logs. + */ + case class DebugLogging(debugOpts: LoggingOptions) extends PreviewOption + + // TODO: missing streams + + /** Allows specifying one or more Writers to redirect incremental preview stdout + */ +// case class ProgressStreams(writers: os.ProcessOutput*) extends PreviewOption + + /** Allows specifying one or more Writers to redirect incremental preview stderr + */ +// case class ErrorProgressStreams(writers: os.ProcessOutput*) extends PreviewOption + + /** Allows specifying one or more channels to receive the Pulumi event stream + */ +// case class EventStreams(channels: EngineEvent*) extends PreviewOption + + /** Specifies the agent responsible for the update, stored in backends as "environment.exec.agent" + */ + case class UserAgent(agent: String) extends PreviewOption + + /** Colorize output. Choices are: [[besom.auto.internal.Color.Always]], [[besom.auto.internal.Color.Never]], + * [[besom.auto.internal.Color.Raw]], [[besom.auto.internal.Color.Auto]] (default "Auto") + */ + case class Color(color: besom.auto.internal.Color) extends PreviewOption + + /** Saves an update plan to the given path. + */ + case class Plan(path: os.Path) extends PreviewOption + + /** Runs one or more policy packs as part of this update + */ + case class PolicyPacks(packs: String*) extends PreviewOption + + /** Path to a JSON file containing the config for the policy pack of the corresponding `--policy-pack` flag + */ + case class PolicyPackConfigs(path: os.Path*) extends PreviewOption +end PreviewOption + +/** [[Stack.preview]] options + * + * @see + * [[PreviewOption]] + * + * @param parallel + * the number of resource operations to run in parallel at once (1 for no parallelism). Defaults to unbounded. (default 2147483647) + * @param message + * message (optional) to associate with the preview operation + * @param expectNoChanges + * return an error if any changes occur during this preview + * @param diff + * diff displays operation as a rich diff showing the overall change + * @param replace + * Specify resources to replace + * @param target + * specify an exclusive list of resource URNs to update + * @param targetDependents + * allows updating of dependent targets discovered but not specified in the [[target]] list + * @param debugLogOpts + * specifies additional settings for debug logging + * @param progressStreams + * allows specifying one or more io.Writers to redirect incremental preview stdout + * @param errorProgressStreams + * allows specifying one or more io.Writers to redirect incremental preview stderr + * @param eventStreams + * allows specifying one or more channels to receive the Pulumi event stream + * @param userAgent + * the agent responsible for the update, stored in backends as "environment.exec.agent" + * @param color + * colorize output, choices are: always, never, raw, auto (default "auto") + * @param plan + * save an update plan to the given path + * @param policyPacks + * run one or more policy packs as part of this update + * @param policyPackConfigs + * path to JSON file containing the config for the policy pack of the corresponding "--policy-pack" flag + */ +private[auto] case class PreviewOptions( + parallel: NotProvidedOr[Int] = NotProvided, + message: NotProvidedOr[String] = NotProvided, + expectNoChanges: Boolean = false, + diff: Boolean = false, + replace: List[String] = List.empty, + target: List[String] = List.empty, + targetDependents: Boolean = false, + debugLogOpts: LoggingOptions = LoggingOptions(), +// progressStreams: List[os.ProcessOutput] = List.empty, // TODO: implement multiple writers +// errorProgressStreams: List[os.ProcessOutput] = List.empty, // TODO: implement multiple writers +// eventStreams: List[EngineEvent] = List.empty, // TODO: implement EngineEvent + userAgent: NotProvidedOr[String] = NotProvided, + color: NotProvidedOr[Color] = NotProvided, + plan: NotProvidedOr[os.Path] = NotProvided, + policyPacks: List[String] = List.empty, + policyPackConfigs: List[os.Path] = List.empty +) +object PreviewOptions: + /** Merge options, last specified value wins + * + * @return + * a new [[PreviewOptions]] + */ + def from(options: PreviewOption*): PreviewOptions = from(options.toList) + def from(options: List[PreviewOption]): PreviewOptions = + options match + case PreviewOption.Parallel(n) :: tail => from(tail*).copy(parallel = n) + case PreviewOption.Message(m) :: tail => from(tail*).copy(message = m) + case PreviewOption.ExpectNoChanges :: tail => from(tail*).copy(expectNoChanges = true) + case PreviewOption.Diff :: tail => from(tail*).copy(diff = true) + case PreviewOption.Replace(urns*) :: tail => from(tail*).copy(replace = urns.toList) + case PreviewOption.Target(urns*) :: tail => from(tail*).copy(target = urns.toList) + case PreviewOption.TargetDependents :: tail => from(tail*).copy(targetDependents = true) + case PreviewOption.DebugLogging(debugOpts) :: tail => from(tail*).copy(debugLogOpts = debugOpts) +// TODO: missing streams +// case PreviewOption.ProgressStreams(writers) :: tail => from(tail*).copy(progressStreams = writers) +// case PreviewOption.ErrorProgressStreams(writers) :: tail => from(tail*).copy(errorProgressStreams = writers) +// case PreviewOption.EventStreams(channels) :: tail => from(tail*).copy(eventStreams = channels) + case PreviewOption.UserAgent(agent) :: tail => from(tail*).copy(userAgent = agent) + case PreviewOption.Color(color) :: tail => from(tail*).copy(color = color) + case PreviewOption.Plan(path) :: tail => from(tail*).copy(plan = path) + case PreviewOption.PolicyPacks(packs*) :: tail => from(tail*).copy(policyPacks = packs.toList) + case PreviewOption.PolicyPackConfigs(paths*) :: tail => from(tail*).copy(policyPackConfigs = paths.toList) + case Nil => PreviewOptions() + case o => throw AutoError(s"Unknown preview option: $o") + +end PreviewOptions + +/** [[Stack.up]] options + * + * @see + * [[UpOption]] + */ +sealed trait UpOption +object UpOption: + /** The number of resource operations to run in parallel at once during the update (1 for no parallelism). Defaults to unbounded. (default + * 2147483647) + */ + case class Parallel(n: Int) extends UpOption + + /** Message (optional) to associate with the update operation + */ + case class Message(message: String) extends UpOption + + /** Will cause the update to return an error if any changes occur + */ + case object ExpectNoChanges extends UpOption + + /** Displays operation as a rich diff showing the overall change + */ + case object Diff extends UpOption + + /** Specifies an array of resource URNs to explicitly replace during the update + */ + case class Replace(urns: String*) extends UpOption + + /** Specifies an exclusive list of resource URNs to update + */ + case class Target(urns: String*) extends UpOption + + /** Allows updating of dependent targets discovered but not specified in the [[Target]] list + */ + case object TargetDependents extends UpOption + + /** Specifies additional settings for debug logging + */ + case class DebugLogging(debugOpts: LoggingOptions) extends UpOption + + // TODO: missing streams + + /** Allows specifying one or more io.Writers to redirect incremental update stdout + */ + // case class ProgressStreams(writers: os.ProcessOutput*) extends UpOption + /** Allows specifying one or more io.Writers to redirect incremental update stderr + */ +// case class ErrorProgressStreams(writers: os.ProcessOutput*) extends UpOption + /** Allows specifying one or more channels to receive the Pulumi event stream + */ +// case class EventStreams(channels: EngineEvent*) extends UpOption + + /** Specifies the agent responsible for the update, stored in backends as "environment.exec.agent" + */ + case class UserAgent(agent: String) extends UpOption + + /** Colorize output. Choices are: [[besom.auto.internal.Color.Always]], [[besom.auto.internal.Color.Never]], + * [[besom.auto.internal.Color.Raw]], + */ + case class Color(color: besom.auto.internal.Color) extends UpOption + + /** Use the update plan at the given path. + */ + case class Plan(path: os.Path) extends UpOption + + /** Run one or more policy packs as part of this update + */ + case class PolicyPacks(packs: String*) extends UpOption + + /** Path to a JSON file containing the config for the policy pack of the corresponding `--policy-pack` flag + */ + case class PolicyPackConfigs(path: os.Path*) extends UpOption + + /** Show config secrets when they appear. + */ + case object ShowSecrets extends UpOption +end UpOption + +/** [[Stack.up]] options + * + * @see + * [[UpOption]] + * + * @param parallel + * the number of resource operations to run in parallel at once (1 for no parallelism). Defaults to unbounded. (default 2147483647) + * @param message + * message (optional) to associate with the preview operation + * @param expectNoChanges + * return an error if any changes occur during this preview + * @param diff + * diff displays operation as a rich diff showing the overall change + * @param replace + * specify resources to replace + * @param target + * specify an exclusive list of resource URNs to update + * @param targetDependents + * allows updating of dependent targets discovered but not specified in the Target list + * @param debugLogOpts + * specifies additional settings for debug logging + * @param progressStreams + * allows specifying one or more io.Writers to redirect incremental preview stdout + * @param errorProgressStreams + * allows specifying one or more io.Writers to redirect incremental preview stderr + * @param eventStreams + * allows specifying one or more channels to receive the Pulumi event stream + * @param userAgent + * specifies the agent responsible for the update, stored in backends as "environment.exec.agent" + * @param color + * colorize output, choices are: always, never, raw, auto (default "auto") + * @param plan + * save an update plan to the given path + * @param policyPacks + * run one or more policy packs as part of this update + * @param policyPackConfigs + * path to JSON file containing the config for the policy pack of the corresponding "--policy-pack" flag + * @param showSecrets + * show config secrets when they appear + */ +case class UpOptions( + parallel: NotProvidedOr[Int] = NotProvided, + message: NotProvidedOr[String] = NotProvided, + expectNoChanges: Boolean = false, + diff: Boolean = false, + replace: List[String] = List.empty, + target: List[String] = List.empty, + targetDependents: Boolean = false, + debugLogOpts: LoggingOptions = LoggingOptions(), +// progressStreams: List[os.ProcessOutput] = List.empty, // TODO: implement multiple writers +// errorProgressStreams: List[os.ProcessOutput] = List.empty, // TODO: implement multiple writers +// eventStreams: List[EngineEvent] = List.empty, // TODO: implement EngineEvent + userAgent: NotProvidedOr[String] = NotProvided, + color: NotProvidedOr[Color] = NotProvided, + plan: NotProvidedOr[os.Path] = NotProvided, + policyPacks: List[String] = List.empty, + policyPackConfigs: List[os.Path] = List.empty, + showSecrets: Boolean = false +) +object UpOptions: + def from(options: UpOption*): UpOptions = from(options.toList) + def from(options: List[UpOption]): UpOptions = + options match + case UpOption.Parallel(n) :: tail => from(tail*).copy(parallel = n) + case UpOption.Message(m) :: tail => from(tail*).copy(message = m) + case UpOption.ExpectNoChanges :: tail => from(tail*).copy(expectNoChanges = true) + case UpOption.Diff :: tail => from(tail*).copy(diff = true) + case UpOption.Replace(urns*) :: tail => from(tail*).copy(replace = urns.toList) + case UpOption.Target(urns*) :: tail => from(tail*).copy(target = urns.toList) + case UpOption.TargetDependents :: tail => from(tail*).copy(targetDependents = true) + case UpOption.DebugLogging(debugOpts) :: tail => from(tail*).copy(debugLogOpts = debugOpts) +// TODO: missing streams +// case UpOption.ProgressStreams(writers) :: tail => from(tail*).copy(progressStreams = writers) +// case UpOption.ErrorProgressStreams(writers) :: tail => from(tail*).copy(errorProgressStreams = writers) +// case UpOption.EventStreams(channels) :: tail => from(tail*).copy(eventStreams = channels) + case UpOption.UserAgent(agent) :: tail => from(tail*).copy(userAgent = agent) + case UpOption.Color(color) :: tail => from(tail*).copy(color = color) + case UpOption.Plan(path) :: tail => from(tail*).copy(plan = path) + case UpOption.PolicyPacks(packs*) :: tail => from(tail*).copy(policyPacks = packs.toList) + case UpOption.PolicyPackConfigs(paths*) :: tail => from(tail*).copy(policyPackConfigs = paths.toList) + case UpOption.ShowSecrets :: tail => from(tail*).copy(showSecrets = true) + case Nil => UpOptions() + case o => throw AutoError(s"Unknown up option: $o") + +end UpOptions + +/** [[Stack.refresh]] options + * + * @see + * [[RefreshOption]] + */ +sealed trait RefreshOption +object RefreshOption: + + /** the number of resource operations to run in parallel at once (1 for no parallelism). Defaults to unbounded. (default 2147483647) + */ + case class Parallel(n: Int) extends RefreshOption + + /** Message (optional) to associate with the refresh operation + */ + case class Message(message: String) extends RefreshOption + + /** Will cause the refresh to return an error if any changes occur + */ + case object ExpectNoChanges extends RefreshOption + + /** Specifies an array of resource URNs to explicitly refresh + */ + case class Target(urns: String*) extends RefreshOption + + // TODO: missing streams + + /** Allows specifying one or more io.Writers to redirect incremental refresh stdout + */ +// case class ProgressStreams(writers: os.ProcessOutput*) extends RefreshOption + /** Allows specifying one or more io.Writers to redirect incremental refresh stderr + */ +// case class ErrorProgressStreams(writers: os.ProcessOutput*) extends RefreshOption + /** Allows specifying one or more channels to receive the Pulumi event stream + */ +// case class EventStreams(channels: EngineEvent*) extends RefreshOption + + /** Specifies additional settings for debug logging + */ + case class DebugLogging(debugOpts: LoggingOptions) extends RefreshOption + + /** Specifies the agent responsible for the refresh, stored in backends as "environment.exec.agent" + */ + case class UserAgent(agent: String) extends RefreshOption + + /** Colorize output. Choices are: [[besom.auto.internal.Color.Always]], [[besom.auto.internal.Color.Never]], + * [[besom.auto.internal.Color.Raw]], + */ + case class Color(color: besom.auto.internal.Color) extends RefreshOption + + /** Show config secrets when they appear. + */ + case object ShowSecrets extends RefreshOption + +end RefreshOption + +/** [[Stack.refresh]] options + * + * @see + * [[RefreshOption]] + * + * @param parallel + * the number of resource operations to run in parallel at once (1 for no parallelism). Defaults to unbounded. (default 2147483647) + * @param message + * message (optional) to associate with the refresh operation + * @param expectNoChanges + * return an error if any changes occur during this refresh + * @param target + * specify an exclusive list of resource URNs to update + * @param debugLogOpts + * specifies additional settings for debug logging + * @param progressStreams + * allows specifying one or more io.Writers to redirect incremental refresh stdout + * @param errorProgressStreams + * allows specifying one or more io.Writers to redirect incremental refresh stderr + * @param eventStreams + * allows specifying one or more channels to receive the Pulumi event stream + * @param userAgent + * specifies the agent responsible for the refresh, stored in backends as "environment.exec.agent" + * @param color + * colorize output, choices are: always, never, raw, auto (default "auto") + * @param showSecrets + * show config secrets when they appear + */ +case class RefreshOptions( + parallel: NotProvidedOr[Int] = NotProvided, + message: NotProvidedOr[String] = NotProvided, + expectNoChanges: Boolean = false, + target: List[String] = List.empty, + debugLogOpts: LoggingOptions = LoggingOptions(), +// progressStreams: List[os.ProcessOutput] = List.empty, // TODO: implement multiple writers +// errorProgressStreams: List[os.ProcessOutput] = List.empty, // TODO: implement multiple writers +// eventStreams: List[EngineEvent] = List.empty, // TODO: implement EngineEvent + userAgent: NotProvidedOr[String] = NotProvided, + color: NotProvidedOr[Color] = NotProvided, + showSecrets: Boolean = false +) +object RefreshOptions: + def from(options: RefreshOption*): RefreshOptions = from(options.toList) + def from(options: List[RefreshOption]): RefreshOptions = + options match + case RefreshOption.Parallel(n) :: tail => from(tail*).copy(parallel = n) + case RefreshOption.Message(m) :: tail => from(tail*).copy(message = m) + case RefreshOption.ExpectNoChanges :: tail => from(tail*).copy(expectNoChanges = true) + case RefreshOption.Target(urns*) :: tail => from(tail*).copy(target = urns.toList) + case RefreshOption.DebugLogging(debugOpts) :: tail => from(tail*).copy(debugLogOpts = debugOpts) +// TODO: missing streams +// case RefreshOption.ProgressStreams(writers) :: tail => from(tail*).copy(progressStreams = writers) +// case RefreshOption.ErrorProgressStreams(writers) :: tail => from(tail*).copy(errorProgressStreams = writers) +// case RefreshOption.EventStreams(channels) :: tail => from(tail*).copy(eventStreams = channels) + case RefreshOption.UserAgent(agent) :: tail => from(tail*).copy(userAgent = agent) + case RefreshOption.Color(color) :: tail => from(tail*).copy(color = color) + case RefreshOption.ShowSecrets :: tail => from(tail*).copy(showSecrets = true) + case Nil => RefreshOptions() + case o => throw AutoError(s"Unknown refresh option: $o") + +end RefreshOptions + +/** [[Stack.destroy]] options + * + * @see + * [[DestroyOption]] + */ +sealed trait DestroyOption +object DestroyOption: + + /** the number of resource operations to run in parallel at once (1 for no parallelism). Defaults to unbounded. (default 2147483647) + */ + case class Parallel(n: Int) extends DestroyOption + + /** Message (optional) to associate with the destroy operation + */ + case class Message(message: String) extends DestroyOption + + /** Specify exclusive list of resource URNs to destroy + */ + case class Target(urns: String*) extends DestroyOption + + /** Allows deleting of dependent targets discovered but not specified in the [[Target]] list + */ + case object TargetDependents extends DestroyOption + + /** Allows specifying one or more io.Writers to redirect incremental destroy stdout + */ +// case class ProgressStreams(writers: os.ProcessOutput*) extends DestroyOption + /** Allows specifying one or more io.Writers to redirect incremental destroy stderr + */ +// case class ErrorProgressStreams(writers: os.ProcessOutput*) extends DestroyOption + /** Allows specifying one or more channels to receive the Pulumi event stream + */ +// case class EventStreams(channels: EngineEvent*) extends DestroyOption + + /** Specifies additional settings for debug logging + */ + case class DebugLogging(debugOpts: LoggingOptions) extends DestroyOption + + /** Specifies the agent responsible for the destroy, stored in backends as "environment.exec.agent" + */ + case class UserAgent(agent: String) extends DestroyOption + + /** Colorize output. Choices are: [[besom.auto.internal.Color.Always]], [[besom.auto.internal.Color.Never]], + * [[besom.auto.internal.Color.Raw]], + */ + case class Color(color: besom.auto.internal.Color) extends DestroyOption + + /** Show config secrets when they appear. + */ + case object ShowSecrets extends DestroyOption + +end DestroyOption + +/** [[Stack.destroy]] options + * + * @see + * [[DestroyOption]] + * + * @param parallel + * the number of resource operations to run in parallel at once (1 for no parallelism). Defaults to unbounded. (default 2147483647) + * @param message + * message (optional) to associate with the destroy operation + * @param target + * specify an exclusive list of resource URNs to update + * @param targetDependents + * allows deleting of dependent targets discovered but not specified in the [[target]] list + * @param debugLogOpts + * specifies additional settings for debug logging + * @param progressStreams + * allows specifying one or more io.Writers to redirect incremental destroy stdout + * @param errorProgressStreams + * allows specifying one or more io.Writers to redirect incremental destroy stderr + * @param eventStreams + * allows specifying one or more channels to receive the Pulumi event stream + * @param userAgent + * specifies the agent responsible for the destroy, stored in backends as "environment.exec.agent" + * @param color + * colorize output, choices are: always, never, raw, auto (default "auto") + * @param showSecrets + * show config secrets when they appear + */ +case class DestroyOptions( + parallel: NotProvidedOr[Int] = NotProvided, + message: NotProvidedOr[String] = NotProvided, + target: List[String] = List.empty, + targetDependents: Boolean = false, + debugLogOpts: LoggingOptions = LoggingOptions(), +// progressStreams: List[os.ProcessOutput] = List.empty, // TODO: implement multiple writers +// errorProgressStreams: List[os.ProcessOutput] = List.empty, // TODO: implement multiple writers +// eventStreams: List[EngineEvent] = List.empty, // TODO: implement EngineEvent + userAgent: NotProvidedOr[String] = NotProvided, + color: NotProvidedOr[Color] = NotProvided, + showSecrets: Boolean = false +) +object DestroyOptions: + def from(options: DestroyOption*): DestroyOptions = from(options.toList) + def from(options: List[DestroyOption]): DestroyOptions = + options match + case DestroyOption.Parallel(n) :: tail => from(tail*).copy(parallel = n) + case DestroyOption.Message(m) :: tail => from(tail*).copy(message = m) + case DestroyOption.Target(urns*) :: tail => from(tail*).copy(target = urns.toList) + case DestroyOption.TargetDependents :: tail => from(tail*).copy(targetDependents = true) + case DestroyOption.DebugLogging(debugOpts) :: tail => from(tail*).copy(debugLogOpts = debugOpts) +// case DestroyOption.ProgressStreams(writers) :: tail => from(tail*).copy(progressStreams = writers) +// case DestroyOption.ErrorProgressStreams(writers) :: tail => from(tail*).copy(errorProgressStreams = writers) +// case DestroyOption.EventStreams(channels) :: tail => from(tail*).copy(eventStreams = channels) + case DestroyOption.UserAgent(agent) :: tail => from(tail*).copy(userAgent = agent) + case DestroyOption.Color(color) :: tail => from(tail*).copy(color = color) + case DestroyOption.ShowSecrets :: tail => from(tail*).copy(showSecrets = true) + case Nil => DestroyOptions() + case o => throw AutoError(s"Unknown destroy option: $o") + +end DestroyOptions + +/** [[Stack.history]] options + * + * @see + * [[HistoryOption]] + */ +sealed trait HistoryOption +object HistoryOption: + + /** Show config secrets when they appear. + */ + case object ShowSecrets extends HistoryOption + +end HistoryOption + +/** [[Stack.history]] options + * + * @see + * [[HistoryOption]] + * + * @param showSecrets + * show config secrets when they appear + */ +case class HistoryOptions( + showSecrets: Boolean = false +) +object HistoryOptions: + def from(options: HistoryOption*): HistoryOptions = from(options.toList) + def from(options: List[HistoryOption]): HistoryOptions = + options match + case HistoryOption.ShowSecrets :: tail => from(tail*).copy(showSecrets = true) + case Nil => HistoryOptions() + case null => throw AutoError(s"Unexpected null history option") + +end HistoryOptions + +/** Options for verbose logging to standard error, and enabling plugin logs. + * + * Note - These logs may include sensitive information that is provided from your execution environment to your cloud provider (and which + * Pulumi may not even itself be aware of). These options should be used with care. + * + * @param logLevel + * choose verbosity level of at least 1 (least verbose), if not specified, reverts to default log level + * @param logToStdErr + * specifies that all logs should be sent directly to stderr - making it more accessible and avoiding OS level buffering + * @param flowToPlugins + * reflects the logging settings to plugins as well as the CLI. This is useful when debugging a plugin + * @param tracing + * emit tracing to the specified endpoint. Use the `file:`` schema to write tracing data to a local file + * @param debug + * print detailed debugging output during resource operations + */ +case class LoggingOptions( + logLevel: NotProvidedOr[Int] = NotProvided, + logToStdErr: Boolean = false, + flowToPlugins: Boolean = false, + tracing: NotProvidedOr[String] = NotProvided, + debug: Boolean = false +): + private[auto] def asArgs: Seq[String] = + Seq( + logLevel.map(lvl => if lvl < 0 then 1 else lvl).map(lvl => s"-v=$lvl"), + Option.when(logToStdErr)("--logtostderr"), + Option.when(flowToPlugins)("--logflow"), + tracing.map(t => s"--tracing=$t"), + Option.when(debug)("--debug") + ).flatten + +/** Colorize output. Choices are: [[besom.auto.internal.Color.Always]], [[besom.auto.internal.Color.Never]], + * [[besom.auto.internal.Color.Raw]], [[besom.auto.internal.Color.Auto]] (default "Auto") + */ +enum Color(val value: String): + override def toString: String = value + + /** Always colorize output */ + case Always extends Color("always") + + /** Never colorize output. + */ + case Never extends Color("never") + + /** Raw colorize output. + */ + case Raw extends Color("raw") + + /** Automatically colorize output (default). + */ + case Auto extends Color("auto") +end Color + +/** PreviewResult is the output of [[Stack.preview]] describing the expected set of changes from the next [[Stack.up]] operation. + * @param stdout + * standard output + * @param stderr + * standard error + * @param summary + * the expected changes + */ +case class PreviewResult( + stdout: String, + stderr: String, + summary: Map[OpType, Int] +): + def permalink: Either[Exception, String] = ??? // TODO: implement GetPermalink +end PreviewResult + +/** UpResult contains information about a [[Stack.up]] operation, including [[outputs]], and a [[summary]] of the deployed changes. + * + * @param stdout + * standard output + * @param stderr + * standard error + * @param outputs + * the stack outputs + * @param summary + * the deployed changes + */ +case class UpResult( + stdout: String, + stderr: String, + outputs: OutputMap, + summary: UpdateSummary +): + def permalink: Either[Exception, String] = ??? // TODO: implement GetPermalink +end UpResult + +/** RefreshResult contains information about a [[Stack.refresh]] operation, including a [[summary]] of the deployed changes. + * + * @param stdout + * standard output + * @param stderr + * standard error + * @param summary + * the deployed changes + */ +case class RefreshResult( + stdout: String, + stderr: String, + summary: UpdateSummary +): + def permalink: Either[Exception, String] = ??? // TODO: implement GetPermalink +end RefreshResult + +/** DestroyResult contains information about a [[Stack.destroy]] operation, including a [[summary]] of the deployed changes. + * + * @param stdout + * standard output + * @param stderr + * standard error + * @param summary + * the deployed changes + */ +case class DestroyResult( + stdout: String, + stderr: String, + summary: UpdateSummary +): + def permalink: Either[Exception, String] = ??? // TODO: implement GetPermalink +end DestroyResult + +/** Provides a summary of a Stack lifecycle operation (up/preview/refresh/destroy). + * + * @param version + * The version of the update. + * @param kind + * The kind of operation being performed. + * @param startTime + * The start time of the operation. + * @param message + * The message associated with the operation. + * @param environment + * The environment variables during the operation. + * @param config + * The configuration used for the operation. + * @param result + * The result of the operation. + * @param endTime + * The end time of the operation. This is only present once the update finishes. + * @param resourceChanges + * The changes in resources during the operation. This is only present once the update finishes. + */ +case class UpdateSummary( + version: Int, + kind: String, + startTime: String, + message: String, + environment: Map[String, String], + config: ConfigMap, + result: Option[String], + endTime: Option[String], + resourceChanges: Option[Map[String, Int]] +) derives JsonFormat +object UpdateSummary: + def fromJsonList(json: String): Either[Exception, List[UpdateSummary]] = json.parseJson +end UpdateSummary + +/** Describes a Pulumi engine event, such as a change to a resource or diagnostic message. [[EngineEvent]] is a discriminated union of all + * possible event types, and exactly one field will be non-nil. + * + * @param sequence + * is a unique, and monotonically increasing number for each engine event sent to the Pulumi Service. Since events may be sent + * concurrently, and/or delayed via network routing, the sequence number is to ensure events can be placed into a total ordering. + * @param timestamp + * is a Unix timestamp (seconds) of when the event was emitted. + * @param summaryEvent + * represents a [[SummaryEvent]] + */ +case class EngineEvent( + sequence: Int, + timestamp: Int, + summaryEvent: Option[SummaryEvent] + // Ignore there rest for now +) +object EngineEvent: + implicit object EngineEventFormat extends RootJsonFormat[EngineEvent] { + def write(e: EngineEvent): JsObject = JsObject( + "sequence" -> JsNumber(e.sequence), + "timestamp" -> JsNumber(e.timestamp), + "summaryEvent" -> e.summaryEvent.toJson + ) + + def read(value: JsValue): EngineEvent = { + value.asJsObject.getFields("sequence", "timestamp", "summaryEvent") match { + case Seq(JsNumber(sequence), JsNumber(timestamp), summaryEvent) => + new EngineEvent( + sequence.toInt, + timestamp.toInt, + summaryEvent.convertTo[Option[SummaryEvent]] + ) + case Seq(JsNumber(sequence), JsNumber(timestamp), _*) => // Ignore events we don't care about + new EngineEvent( + sequence.toInt, + timestamp.toInt, + None + ) + } + } + } + + def fromJson(json: String): Either[Exception, EngineEvent] = json.parseJson +end EngineEvent + +/** SummaryEvent is emitted at the end of an update, with a summary of the changes made. + * + * @param maybeCorrupt + * is set if one or more of the resources is in an invalid state. + * @param durationSeconds + * is the number of seconds the update was executing. + * @param resourceChanges + * contains the count for resource change by type. + * @param policyPacks + * run during update. Maps PolicyPackName -> version. + */ +case class SummaryEvent( + maybeCorrupt: Boolean, + durationSeconds: Int, + resourceChanges: Map[OpType, Int], + policyPacks: Map[String, String] +) +object SummaryEvent: + implicit object SummaryEventFormat extends RootJsonFormat[SummaryEvent] { + def write(e: SummaryEvent): JsObject = JsObject( + "maybeCorrupt" -> JsBoolean(e.maybeCorrupt), + "durationSeconds" -> JsNumber(e.durationSeconds), + "resourceChanges" -> e.resourceChanges.toJson, + "PolicyPacks" -> e.policyPacks.toJson + ) + + def read(value: JsValue): SummaryEvent = { + value.asJsObject.getFields("maybeCorrupt", "durationSeconds", "resourceChanges", "PolicyPacks") match { + case Seq(JsBoolean(maybeCorrupt), JsNumber(durationSeconds), resourceChanges, policyPacks) => + new SummaryEvent( + maybeCorrupt, + durationSeconds.toInt, + resourceChanges.convertTo[Map[OpType, Int]], + policyPacks.convertTo[Map[String, String]] + ) + case _ => throw DeserializationException("SummaryEvent expected") + } + } + } +end SummaryEvent + +/** OpType describes the type of operation performed to a resource managed by Pulumi. Should generally mirror `deploy.StepOp` in the engine. + */ +enum OpType(value: String): + override def toString: String = value + + /** Indicates no change was made. */ + case Same extends OpType("same") + + /** Indicates a new resource was created. */ + case Create extends OpType("create") + + /** Indicates an existing resource was updated. */ + case Update extends OpType("update") + + /** Indicates an existing resource was deleted. */ + case Delete extends OpType("delete") + + /** Indicates an existing resource was replaced with a new one. */ + case Replace extends OpType("replace") + + /** Indicates a new resource was created for a replacement. */ + case CreateReplacement extends OpType("create-replacement") + + /** Indicates an existing resource was deleted after replacement. */ + case DeleteReplaced extends OpType("delete-replaced") + + /** Indicates reading an existing resource. */ + case Read extends OpType("read") + + /** Indicates reading an existing resource for a replacement. */ + case ReadReplacement extends OpType("read-replacement") + + /** Indicates refreshing an existing resource. */ + case Refresh extends OpType("refresh") + + /** Indicates removing a resource that was read. */ + case ReadDiscard extends OpType("discard") + + /** Indicates discarding a read resource that was replaced. */ + case DiscardReplaced extends OpType("discard-replaced") + + /** Indicates removing a pending replace resource. */ + case RemovePendingReplace extends OpType("remove-pending-replace") + + /** Indicates importing an existing resource. */ + case Import extends OpType("import") + + /** Indicates replacement of an existing resource with an imported resource. */ + case ImportReplacement extends OpType("import-replacement") +end OpType +object OpType: + implicit object OpTypeFormat extends RootJsonFormat[OpType] { + def write(e: OpType): JsObject = JsObject( + "value" -> JsString(e.toString) + ) + + def read(value: JsValue): OpType = { + value match { + case JsString(value) => + OpType.from(value).left.map(DeserializationException("OpType expected", _)).fold(throw _, identity) + case n => throw DeserializationException(s"OpType expected, got: $n") + } + } + } + + def from(value: String): Either[Exception, OpType] = + value match + case "same" => Right(Same) + case "create" => Right(Create) + case "update" => Right(Update) + case "delete" => Right(Delete) + case "replace" => Right(Replace) + case "create-replacement" => Right(CreateReplacement) + case "delete-replaced" => Right(DeleteReplaced) + case "read" => Right(Read) + case "read-replacement" => Right(ReadReplacement) + case "refresh" => Right(Refresh) + case "discard" => Right(ReadDiscard) + case "discard-replaced" => Right(DiscardReplaced) + case "remove-pending-replace" => Right(RemovePendingReplace) + case "import" => Right(Import) + case "import-replacement" => Right(ImportReplacement) + case _ => Left(Exception(s"Unknown OpType: $value")) + end from +end OpType diff --git a/auto/src/main/scala/besom/auto/internal/Workspace.scala b/auto/src/main/scala/besom/auto/internal/Workspace.scala new file mode 100644 index 00000000..f05fcf02 --- /dev/null +++ b/auto/src/main/scala/besom/auto/internal/Workspace.scala @@ -0,0 +1,855 @@ +package besom.auto.internal + +import besom.json.* +import besom.model +import besom.util.* +import org.virtuslab.yaml.* + +import scala.annotation.tailrec +import scala.language.implicitConversions +import scala.util.Try + +// FIXME: this is a hack to make the compiler happy + +object yamlHack: + import org.virtuslab.yaml.internal.dump.present.PresenterImpl + + def asYaml(node: Node): String = + val events = HackedSerializerImpl.toEvents(node) + PresenterImpl.asString(events) +end yamlHack + +given JsonFormat[Any] = new JsonFormat[Any]: + override def write(obj: Any): JsValue = + obj match + case s: String => JsString(s) + case i: Int => JsNumber(i) + case b: Boolean => JsBoolean(b) + case a: List[Any] => JsArray(a.map(write).toVector) +// case m: Map[String, Any] => JsObject(m.map((k, v) => (k, write(v)))) + override def read(json: JsValue): Any = + json match + case JsNull => None + case JsTrue => true + case JsFalse => false + case JsBoolean(b) => b + case JsString(s) => s + case JsNumber(i) => i + case JsArray(a) => a.map(read) + case JsObject(fs) => fs.map((k, v) => (k, read(v))) + +implicit def forOption[T](implicit encoder: YamlEncoder[T]): YamlEncoder[Option[T]] = { + case Some(value) => encoder.asNode(value) + case None => Node.ScalarNode(null) +} + +implicit def forAny: YamlEncoder[Any] = { + case value: String => YamlEncoder.forString.asNode(value) + case value: Int => YamlEncoder.forInt.asNode(value) + case value: Boolean => YamlEncoder.forBoolean.asNode(value) + case value: List[Any] => YamlEncoder.forList[Any].asNode(value) +// case value: Map[String, Any] => YamlEncoder.forMap[String, Any].asNode(value) +} + +given JsonFormat[model.QName] = new JsonFormat[model.QName]: + override def write(obj: model.QName): JsValue = JsString(obj) + override def read(json: JsValue): model.QName = json match + case JsString(s) => model.QName.parse(s) + case _ => throw new RuntimeException("QName must be a string") +given YamlCodec[model.QName] = new YamlCodec[model.QName]: + def asNode(obj: model.QName): Node = summon[YamlEncoder[String]].asNode(obj) + def construct(node: Node)(implicit settings: LoadSettings = LoadSettings.empty): Either[ConstructError, model.QName] = + summon[YamlDecoder[String]].construct(node).map(model.QName.parse(_)) + +given JsonFormat[String | ProjectRuntimeInfo] = new JsonFormat[String | ProjectRuntimeInfo]: + override def write(obj: String | ProjectRuntimeInfo): JsValue = obj match + case s: String => JsString(s) + case ProjectRuntimeInfo(n, _) => JsString(n) + override def read(json: JsValue): String | ProjectRuntimeInfo = json match + case JsString(s) => s + case _ => throw new RuntimeException("ProjectRuntimeInfo must be a string") + +given YamlCodec[String | ProjectRuntimeInfo] = new YamlCodec[String | ProjectRuntimeInfo]: + def asNode(obj: String | ProjectRuntimeInfo): Node = obj match + case s: String => summon[YamlEncoder[String]].asNode(s) + case p: ProjectRuntimeInfo => summon[YamlEncoder[ProjectRuntimeInfo]].asNode(p) + def construct(node: Node)(implicit settings: LoadSettings = LoadSettings.empty): Either[ConstructError, String | ProjectRuntimeInfo] = + summon[YamlDecoder[String]].construct(node).map(s => ProjectRuntimeInfo(s, Map.empty)) + +given JsonFormat[java.time.Instant] = new JsonFormat[java.time.Instant]: + override def write(obj: java.time.Instant): JsValue = JsString(obj.toString) + override def read(json: JsValue): java.time.Instant = json match + case JsString(s) => java.time.Instant.parse(s) + case _ => throw new RuntimeException("Instant must be a string") + +// FIXME: end of hack + +/** Workspace is the execution context containing a single Pulumi project, a program, and multiple stacks. + * + * Workspaces are used to manage the execution environment, providing various utilities such as plugin installation, environment + * configuration `$PULUMI_HOME`, and creation, deletion, and listing of Stacks. + */ +trait Workspace: + + protected[auto] def pulumi(additional: os.Shellable*)(opts: shell.ShellOption*): Either[ShellAutoError, shell.Result] = + val allArgs = additional + val allOpts = opts ++ List( + shell.ShellOption.Cwd(workDir) + ) ++ List( + shell.ShellOption.Env(getEnvVars), + shell.ShellOption.Env(shell.pulumi.env.PulumiDebugCommandsEnv -> "true") + ) ++ pulumiHome.map(path => shell.ShellOption.Env(shell.pulumi.env.PulumiHomeEnv, path.toString)) + ++ Option.when(remote)(shell.ShellOption.Env(shell.pulumi.env.PulumiExperimentalEnv -> "true")) + shell.pulumi(allArgs)(allOpts*) + end pulumi + + /** Returns the settings object for the current project if any. */ + def projectSettings: Either[Exception, Project] + + /** Overwrites the settings object in the current project. There can only be a single project per workspace. Fails is new project name + * does not match old. + */ + def saveProjectSettings(project: Project): Either[Exception, Unit] + + /** Returns the settings object for the stack matching the specified stack name if any. */ + def stackSettings(stackName: String): Either[Exception, ProjectStack] + + /** Overwrites the settings object for the stack matching the specified stack name. */ + def saveStackSettings(stackName: String, projectStack: ProjectStack): Either[Exception, Unit] + + /** This is hook to provide additional args to every CLI commands before they are executed. Provided with stack name, returns a list of + * args to append to an invoked command `["--config=...", ]`. + */ + def serializeArgsForOp(stackName: String): Either[Exception, List[String]] + + /** This is a hook executed after every command. Called with the stack name. An extensibility point to perform workspace cleanup (CLI + * operations may create/modify a `Pulumi.[stack].yaml`). + */ + def postCommandCallback(stackName: String): Either[Exception, Unit] + + /** Adds the specified environments to the provided stack's configuration. */ + def addEnvironments(stackName: String, envs: String*): Either[Exception, Unit] + + /** ListEnvironments returns the list of environments from the provided stack's configuration */ + def listEnvironments(stackName: String): Either[Exception, List[String]] + + /** Removes the specified environment from the provided stack's configuration. */ + def removeEnvironment(stackName: String, env: String): Either[Exception, Unit] + + /** Returns the value associated with the specified stack name and key using the optional [[ConfigOption]], scoped to the current + * workspace. + */ + def getConfig(stackName: String, key: String, options: ConfigOption*): Either[Exception, ConfigValue] + + /** Returns the config map for the specified stack name, scoped to the current workspace. */ + def getAllConfig(stackName: String): Either[Exception, ConfigMap] + + /** Sets the specified key-value pair on the provided stack name using the optional ConfigOptions. + */ + def setConfig( + stackName: String, + key: String, + value: ConfigValue, + options: ConfigOption* + ): Either[Exception, Unit] + + /** Sets all values in the provided config map for the specified stack name using the optional ConfigOptions. + */ + def setAllConfig( + stackName: String, + config: ConfigMap, + options: ConfigOption* + ): Either[Exception, Unit] + + /** Removes the specified key-value pair on the provided stack name using the optional ConfigOptions. + */ + def removeConfig(stackName: String, key: String, options: ConfigOption*): Either[Exception, Unit] + + /** Removes all values in the provided key list for the specified stack name using the optional ConfigOptions. + */ + def removeAllConfig( + stackName: String, + keys: List[String], + options: ConfigOption* + ): Either[Exception, Unit] + + /** Gets and sets the config map used with the last Update for Stack matching stack name. */ + def refreshConfig(stackName: String): Either[Exception, ConfigMap] + + /** Returns the value associated with the specified stack name and key. */ + def getTag(stackName: String, key: String): Either[Exception, String] + + /** Sets the specified key-value pair on the provided stack name. */ + def setTag(stackName: String, key: String, value: String): Either[Exception, Unit] + + /** Removes the specified key-value pair on the provided stack name. */ + def removeTag(stackName: String, key: String): Either[Exception, Unit] + + /** Returns the tag map for the specified stack name. */ + def listTags(stackName: String): Either[Exception, Map[String, String]] + + /** Returns the environment values scoped to the current workspace. */ + def getEnvVars: Map[String, String] + + /** Sets the specified map of environment values scoped to the current workspace. These values will be passed to all Workspace and Stack + * level commands. + */ + def setEnvVars(envVars: Map[String, String]): Unit + + /** Sets the specified environment value scoped to the current workspace. This value will be passed to all Workspace and Stack level + * commands. + */ + def setEnvVar(key: String, value: String): Unit + + /** Unsets the specified environment value scoped to the current workspace. This value will be removed from all Workspace and Stack level + * commands. + */ + def unsetEnvVar(key: String): Unit + + /** Returns the working directory to run Pulumi CLI commands. */ + def workDir: os.Path + + /** Returns the directory override for CLI metadata if set. This customizes the location of $PULUMI_HOME where metadata is stored and + * plugins are installed. + */ + def pulumiHome: Option[os.Path] + + /** The secrets provider to use for encryption and decryption of stack secrets. See: + * https://www.pulumi.com/docs/intro/concepts/secrets/#available-encryption-providers + */ + def secretsProvider: Option[String] + + /** Returns the version of the underlying Pulumi CLI/Engine. */ + def pulumiVersion: model.SemanticVersion + + /** Returns detailed information about the currently logged-in Pulumi identity. + */ + def whoAmI: Either[Exception, WhoAmIResult] + + /** Edits the secrets provider for the given stack. */ + def changeStackSecretsProvider( + stackName: String, + newSecretsProvider: String | SecretsProviderType, + options: ChangeSecretsProviderOption* + ): Either[Exception, Unit] + + /** Returns a summary of the currently selected stack, if any. */ + def stack: Either[Exception, Option[StackSummary]] + + /** Creates and sets a new stack with the stack name, failing if one already exists. */ + def createStack(stackName: String): Either[Exception, Stack] + + /** Selects and sets an existing stack matching the stack name, failing if none exists. */ + def selectStack(stackName: String): Either[Exception, Stack] + + /** Deletes the stack and all associated configuration and history. */ + def removeStack(stackName: String, options: RemoveOption*): Either[Exception, Unit] + + /** Returns all Stacks created under the current Project. This queries underlying backend and may return stacks not present in the + * Workspace. + */ + def listStacks: Either[Exception, List[StackSummary]] + + /** Acquires the plugin matching the specified name and version. */ + def installPlugin( + name: String, + version: String, + kind: String = "resource", + server: NotProvidedOr[String] = NotProvided + ): Either[Exception, Unit] + + /** Deletes the plugin matching the specified name and version. */ + def removePlugin( + name: NotProvidedOr[String] = NotProvided, + versionRange: NotProvidedOr[String] = NotProvided, + kind: String = "resource" + ): Either[Exception, Unit] + + /** Lists all installed plugins. */ + def listPlugins: Either[Exception, List[PluginInfo]] + + /** Program returns the program `pulumi.RunFunc` to be used for Preview/Update if any. If none is specified, the stack will refer to + * ProjectSettings for this information. + */ + def program: Option[RunFunc] + + /** Exports the deployment state of the stack matching the given name. This can be combined with ImportStack to edit a stack's state (such + * as recovery from failed deployments). + */ + def exportStack(stackName: String): Either[Exception, UntypedDeployment] + + /** Imports the specified deployment state into a pre-existing stack. This can be combined with ExportStack to edit a stack's state (such + * as recovery from failed deployments). + */ + def importStack(stackName: String, deployment: UntypedDeployment): Either[Exception, Unit] + + /** Gets the current set of Stack outputs from the last Stack.Up(). + */ + def stackOutputs(stackName: String): Either[Exception, OutputMap] + + protected[auto] def remote: Boolean + +end Workspace + +/** ConfigValue is a configuration value used by a Pulumi program. Allows differentiating between secret and plaintext values by setting the + * `Secret` property. + */ +case class ConfigValue(value: String, secret: Boolean = false) derives JsonFormat +object ConfigValue: + def fromJson(json: String): Either[Exception, ConfigValue] = json.parseJson[ConfigValue] + +/** ConfigOptions is a configuration option used by a Pulumi program. */ +enum ConfigOption: + /** Indicates that the key contains a path to a property in a map or list to get/set + */ + case Path + +/** ConfigMap is a map of ConfigValue used by Pulumi programs. Allows differentiating between secret and plaintext values. + */ +type ConfigMap = Map[String, ConfigValue] +object ConfigMap: + def fromJson(json: String): Either[Exception, ConfigMap] = json.parseJson[ConfigMap] + +/** TagMap is a key-value map of tag metadata associated with a stack. + */ +type TagMap = Map[String, String] +object TagMap: + def fromJson(json: String): Either[Exception, TagMap] = json.parseJson[TagMap] + +/** StackSummary is a description of a stack and its current status. + */ +case class StackSummary( + name: String, + current: Boolean, + lastUpdate: Option[String], + updateInProgress: Boolean, + resourceCount: Option[Int], + url: Option[String] +) derives JsonFormat +object StackSummary: + def fromJsonList(json: String): Either[Exception, List[StackSummary]] = + json.parseJson[List[StackSummary]] + +/** WhoAmIResult contains detailed information about the currently logged-in Pulumi identity. + */ +case class WhoAmIResult(user: String, organizations: List[String], url: String) derives JsonFormat +object WhoAmIResult: + def fromJson(json: String): Either[Exception, WhoAmIResult] = json.parseJson[WhoAmIResult] + +/** Basic secret provider types */ +enum SecretsProviderType(val value: String): + override def toString: String = value + case Default extends SecretsProviderType("default") + case Passphrase extends SecretsProviderType("passphrase") + case AwsKms extends SecretsProviderType("awskms") + case AzureKeyVault extends SecretsProviderType("azurekeyvault") + case GcpKms extends SecretsProviderType("gcpkms") + case HashiVault extends SecretsProviderType("hashivault") +object SecretsProviderType: + implicit inline def spt2Str(inline spt: String | SecretsProviderType): String = spt.toString + +/** Options for changing the secrets provider. + */ +sealed trait ChangeSecretsProviderOption + +/** Represents the new passphrase when changing to a `passphrase` provider. + * + * @param newPassphrase + * The new passphrase. + */ +case class NewPassphraseOption(newPassphrase: String) extends ChangeSecretsProviderOption + +/** Project is a Pulumi project manifest. + * + * JSON Schema is available at https://github.com/pulumi/pulumi/blob/v3.98.0/sdk/go/common/workspace/project.json + * + * @param name + * is a required fully qualified name of the project containing alphanumeric characters, hyphens, underscores, and periods. + * @param runtime + * is a required runtime that executes code, e.g.: scala, nodejs, python, go, dotnet, java or yaml. + * @param main + * is an optional override for the program's main entry-point location + * @param description + * is an optional informational description + * @param author + * is an optional author that created this project + * @param website + * is an optional website for additional info about this project + * @param license + * is the optional license governing this project's usage + * @param config + * config is a map of config property keys to either values or structured declarations. Non-object values are allowed to be set directly. + * Anything more complex must be defined using the structured schema declaration, or the nested value declaration both shown below. + * @param stackConfigDir + * indicates where to store the `Pulumi.[stack-name].yaml` files, combined with the folder `Pulumi.yaml` is in + * @param template + * is an optional template manifest, if this project is a template + * @param backend + * is an optional backend configuration + * @param options + * is an optional set of project options + * @param plugins + * contains available plugins + */ +case class Project( + name: model.PackageName, + runtime: String | ProjectRuntimeInfo, + main: Option[String] = None, + description: Option[String] = None, + author: Option[String] = None, + website: Option[String] = None, + license: Option[String] = None, + config: Map[String, ProjectConfigValue] = Map.empty, + stackConfigDir: Option[String] = None, + template: Option[ProjectTemplate] = None, + backend: Option[ProjectBackend] = None, + options: Option[ProjectOptions] = None, + plugins: Option[Plugins] = None +) derives JsonFormat, + YamlCodec: + def save(path: os.Path): Either[Exception, Unit] = + val content = path match + case p if p.ext == "json" => summon[JsonWriter[Project]].write(this).prettyPrint + case p if p.ext == "yaml" || p.ext == "yml" => yamlHack.asYaml(summon[YamlEncoder[Project]].asNode(this)) + end content + Try { + os.write.over(path, content, createFolders = true) + }.toEither.left.map(e => AutoError(s"Failed to write project to '$path'", e)) + end save + +end Project +object Project: + def load(path: os.Path): Either[Exception, Project] = + path match + case p if p.ext == "json" => + Try { + os.read(p) + }.toEither.left + .map(e => AutoError(s"Failed to read project from '$path'", e)) + .flatMap(_.parseJson[Project].left.map(e => AutoError(s"Failed to parse project from '$path'", e))) + case p if p.ext == "yaml" || p.ext == "yml" => + Try { + os.read(p) + }.toEither.left + .map(e => AutoError(s"Failed to read project from '$path'", e)) + .flatMap(_.as[Project].left.map(e => AutoError(s"Failed to read project from '$path': ${e.msg}"))) + +/** ProjectRuntimeInfo is a configuration for the runtime used by the project + * @param name + * required language runtime of the project, e.g: scala, nodejs, python, go, dotnet, java or yaml. + * @param options + * The runtime attribute has an additional property called options where you can further specify runtime configuration. + */ +case class ProjectRuntimeInfo( + name: String, + options: Map[String, String] = Map.empty +) derives JsonFormat, + YamlCodec + +/** A config value included in the project manifest. + * + * @param type + * The type of this config property, either string, boolean, integer, or array. + * @param description + * A description for this config property. + * @param items + * A nested structured declaration of the type of the items in the array. Required if type is array + * @param default + * The default value for this config property, must match the given type. + * @param value + * The value of this configuration property. + */ +sealed trait ProjectConfigValue +object ProjectConfigValue: + case class StringValue( + description: Option[String] = None, + default: Option[String] = None, + value: Option[String] = None, + secret: Boolean = false + ) extends ProjectConfigValue + derives JsonFormat, + YamlCodec + case class BooleanValue( + description: Option[String] = None, + default: Option[Boolean] = None, + value: Option[Boolean] = None, + secret: Boolean = false + ) extends ProjectConfigValue + derives JsonFormat, + YamlCodec + case class IntegerValue( + description: Option[String] = None, + default: Option[Int] = None, + value: Option[Int] = None, + secret: Boolean = false + ) extends ProjectConfigValue + derives JsonFormat, + YamlCodec + case class ArrayValue( + items: ProjectConfigItemsType, + description: Option[String] = None, + default: List[ProjectConfigValue] = List.empty, + value: List[ProjectConfigValue] = List.empty, + secret: Boolean = false + ) extends ProjectConfigValue + derives JsonFormat, + YamlCodec + + given JsonFormat[ProjectConfigValue] = new JsonFormat[ProjectConfigValue]: + override def write(obj: ProjectConfigValue): JsValue = obj match + case StringValue(desc, default, value, secret) => + JsObject( + "type" -> JsString("string"), + "description" -> desc.toJson, + "default" -> default.toJson, + "value" -> value.toJson, + "secret" -> secret.toJson + ) + case BooleanValue(desc, default, value, secret) => + JsObject( + "type" -> JsString("boolean"), + "description" -> desc.toJson, + "default" -> default.toJson, + "value" -> value.toJson, + "secret" -> secret.toJson + ) + case IntegerValue(desc, default, value, secret) => + JsObject( + "type" -> JsString("integer"), + "description" -> desc.toJson, + "default" -> default.toJson, + "value" -> value.toJson, + "secret" -> secret.toJson + ) + case ArrayValue(items, desc, default, value, secret) => + JsObject( + "type" -> JsString("array"), + "items" -> items.toJson, + "description" -> desc.toJson, + "default" -> default.toJson, + "value" -> value.toJson, + "secret" -> secret.toJson + ) + override def read(json: JsValue): ProjectConfigValue = json match + case JsObject(fs) => + fs.get("type") match + case Some(JsString("string")) => summon[JsonReader[StringValue]].read(json) + case Some(JsString("boolean")) => summon[JsonReader[BooleanValue]].read(json) + case Some(JsString("integer")) => summon[JsonReader[IntegerValue]].read(json) + case Some(JsString("array")) => summon[JsonReader[ArrayValue]].read(json) + case t => throw new Exception(s"ProjectConfigValue is invalid $t") + case _ => throw new Exception(s"ProjectConfigValue is invalid, expected object") + + given YamlCodec[ProjectConfigValue] = new YamlCodec[ProjectConfigValue]: + def asNode(obj: ProjectConfigValue): Node = obj match + case s: StringValue => summon[YamlEncoder[StringValue]].asNode(s) + case b: BooleanValue => summon[YamlEncoder[BooleanValue]].asNode(b) + case i: IntegerValue => summon[YamlEncoder[IntegerValue]].asNode(i) + case a: ArrayValue => summon[YamlEncoder[ArrayValue]].asNode(a) + def construct(node: Node)(implicit settings: LoadSettings = LoadSettings.empty): Either[ConstructError, ProjectConfigValue] = + node match + case Node.MappingNode(m, _) => + m.get(Node.ScalarNode("type")) match + case Some(Node.ScalarNode("string", _)) => summon[YamlDecoder[StringValue]].construct(node) + case Some(Node.ScalarNode("boolean", _)) => summon[YamlDecoder[BooleanValue]].construct(node) + case Some(Node.ScalarNode("integer", _)) => summon[YamlDecoder[IntegerValue]].construct(node) + case Some(Node.ScalarNode("array", _)) => summon[YamlDecoder[ArrayValue]].construct(node) + case Some(t) => Left(ConstructError(s"ProjectConfigValue is invalid: $t")) + case None => Left(ConstructError(s"ProjectConfigValue is invalid, field 'type' is missing")) + case _ => throw new Exception(s"ProjectConfigValue is invalid, expected object") +end ProjectConfigValue + +/** ProjectConfigItemsType is a config item type included in the project manifest. */ +sealed trait ProjectConfigItemsType +object ProjectConfigItemsType: + object StringType extends ProjectConfigItemsType + object BooleanType extends ProjectConfigItemsType + object IntegerType extends ProjectConfigItemsType + case class ArrayType(items: ProjectConfigItemsType) extends ProjectConfigItemsType + + given JsonFormat[ProjectConfigItemsType] = new JsonFormat[ProjectConfigItemsType]: + override def write(obj: ProjectConfigItemsType): JsValue = obj match + case StringType => JsObject("type" -> JsString("string")) + case BooleanType => JsObject("type" -> JsString("boolean")) + case IntegerType => JsObject("type" -> JsString("integer")) + case ArrayType(it) => JsObject("type" -> JsString("array"), "items" -> write(it)) + override def read(json: JsValue): ProjectConfigItemsType = json match + case JsObject(fs) => + fs.get("type") match + case Some(JsString("string")) => StringType + case Some(JsString("boolean")) => BooleanType + case Some(JsString("integer")) => IntegerType + case Some(JsString("array")) => ArrayType(read(fs("items"))) + case t => throw new Exception(s"ProjectConfigItemsType is invalid $t") + case _ => throw new Exception(s"ProjectConfigItemsType is invalid, field 'type' is missing") + + given YamlCodec[ProjectConfigItemsType] = new YamlCodec[ProjectConfigItemsType]: + def asNode(obj: ProjectConfigItemsType): Node = obj match + case StringType => Node.MappingNode((Node.ScalarNode("type"), Node.ScalarNode("string"))) + case BooleanType => Node.MappingNode((Node.ScalarNode("type"), Node.ScalarNode("boolean"))) + case IntegerType => Node.MappingNode((Node.ScalarNode("type"), Node.ScalarNode("integer"))) + case ArrayType(it) => + Node.MappingNode( + (Node.ScalarNode("type"), Node.ScalarNode("array")), + (Node.ScalarNode("items"), asNode(it)) + ) + @tailrec + def construct(node: Node)(implicit settings: LoadSettings = LoadSettings.empty): Either[ConstructError, ProjectConfigItemsType] = + node match + case n @ Node.MappingNode(m, _) => + m.get(Node.ScalarNode("type")) match + case Some(Node.ScalarNode("string", _)) => Right(StringType) + case Some(Node.ScalarNode("boolean", _)) => Right(BooleanType) + case Some(Node.ScalarNode("integer", _)) => Right(IntegerType) + case Some(Node.ScalarNode("array", _)) => + m.get(Node.ScalarNode("items")) match + case Some(it) => construct(it) + case None => Left(ConstructError(s"ProjectConfigItemsType is invalid, field 'items' is missing")) + case Some(t) => Left(ConstructError(s"ProjectConfigItemsType is invalid: $t")) + case None => Left(ConstructError(s"ProjectConfigItemsType is invalid, field 'type' is missing")) + case _ => throw new Exception(s"ProjectConfigItemsType is invalid, field 'type' is missing") +end ProjectConfigItemsType + +/** ProjectTemplate is a Pulumi project template manifest. + * + * @param description + * an optional description of the template + * @param quickstart + * contains optional text to be displayed after template creation + * @param config + * an optional template config + * @param important + * indicates the template is important and should be listed by default + */ +case class ProjectTemplate( + description: Option[String] = None, + quickstart: Option[String] = None, + config: Map[String, ProjectTemplateConfigValue] = Map.empty, + important: Boolean = false +) derives JsonFormat, + YamlCodec + +/** ProjectTemplateConfigValue is a config value included in the project template manifest. + * + * @param description + * an optional description for the config value + * @param default + * an optional default value for the config value + * @param secret + * may be set to true to indicate that the config value should be encrypted + */ +case class ProjectTemplateConfigValue( + description: Option[String] = None, + default: Option[String] = None, + secret: Boolean = false +) derives JsonFormat, + YamlCodec + +/** ProjectBackend is a configuration for backend used by project + * + * @param url + * is optional field to explicitly set backend url + */ +case class ProjectBackend(url: Option[String] = None) derives JsonFormat, YamlCodec + +/** ProjectOptions + * + * @param refresh + * is the ability to always run a refresh as part of a pulumi update / preview / destroy + */ +case class ProjectOptions(refresh: Option[String] = None) derives JsonFormat, YamlCodec + +/** PluginOptions + * + * @param name + * is the name of the plugin + * @param path + * is the path of the plugin + * @param version + * is the version of the plugin + */ +case class PluginOptions(name: String, path: String, version: Option[String] = None) derives JsonFormat, YamlCodec + +/** Plugins + * + * @param providers + * is the list of provider plugins + * @param languages + * is the list of language plugins + * @param analyzers + * is the list of analyzer plugins + */ +case class Plugins( + providers: List[PluginOptions] = List.empty, + languages: List[PluginOptions] = List.empty, + analyzers: List[PluginOptions] = List.empty +) derives JsonFormat, + YamlCodec + +/** ProjectStack holds stack specific information about a project. + * + * @param secretsProvider + * this stack's secrets provider + * @param encryptedKey + * the KMS-encrypted ciphertext for the data key used for secrets encryption. Only used for cloud-based secrets providers + * @param encryptionSalt + * this stack's base64 encoded encryption salt. Only used for passphrase-based secrets providers + * @param config + * an optional config bag + * @param environment + * an optional environment definition or list of environments + */ +case class ProjectStack( + secretsProvider: Option[String] = None, + encryptedKey: Option[String] = None, + encryptionSalt: Option[String] = None, + config: Map[String, Any] = Map.empty, // TODO FIXME UNBORK Map[String, Any] to ConfigMap + environment: Option[Environment] = None +) derives JsonFormat, + YamlCodec: + def asYaml: String = summon[YamlEncoder[ProjectStack]].asNode(this).asYaml + def save(path: os.Path): Unit = os.write.over(path, asYaml, createFolders = true) +object ProjectStack: + def load(path: os.Path): Either[Exception, ProjectStack] = + path match + case p if p.ext == "json" => + os.read(p).parseJson[ProjectStack].left.map(e => AutoError(s"Failed to read project stack from '$path'", e)) + case p if p.ext == "yaml" || p.ext == "yml" => + os.read(p).as[ProjectStack].left.map(e => AutoError(s"Failed to read project stack from '$path': ${e.msg}")) + +/** Environment is an optional environment definition or list of environments. + * + * @param envs + * a list of environments + */ +case class Environment(envs: List[String] = List.empty) derives JsonFormat, YamlCodec + +/** Settings defines workspace settings shared amongst many related projects. + * + * @param stack + * an optional default stack to use + */ +case class Settings(stack: Option[String] = None) derives JsonFormat, YamlCodec + +/** A parameter to be applied to a stack remove operation + */ +enum RemoveOption: + /** Force causes the remove operation to occur even if there are resources existing in the stack + */ + case Force + +/** UntypedDeployment contains an inner, untyped deployment structure. + * + * @param version + * indicates the schema of the encoded deployment + * @param deployment + * the opaque Pulumi deployment. This is conceptually of type `Deployment`, but we use `JsonNode` to permit round-tripping of stack + * contents when an older client is talking to a newer server. If we un-marshaled the contents, and then re-marshaled them, we could end + * up losing important information. + */ +case class UntypedDeployment( + version: Option[Int] = None, + deployment: Option[JsValue] = None +) derives JsonFormat: + def toJson: String = summon[JsonWriter[UntypedDeployment]].write(this).prettyPrint +object UntypedDeployment: + def fromJson(json: String): Either[Exception, UntypedDeployment] = json.parseJson[UntypedDeployment] + +/** PluginInfo provides basic information about a plugin. Each plugin gets installed into a system-wide location, by default + * `~/.pulumi/plugins/[kind]-[name]-[version]/`. A plugin may contain multiple files, however the primary loadable executable must be named + * `pulumi-[kind]-[name]`. + * + * @param name + * the simple name of the plugin + * @param path + * the path that a plugin was loaded from (this will always be a directory) + * @param kind + * the kind of the plugin (language, resource, etc) + * @param version + * the plugin's semantic version, if present + * @param size + * the size of the plugin, in bytes + * @param installTime + * the time the plugin was installed + * @param lastUsedTime + * the last time the plugin was used + * @param schemaPath + * if set, used as the path for loading and caching the schema + * @param schemaTime + * if set and newer than the file at SchemaPath, used to invalidate a cached schema + */ +// TODO: can be moved to model module and used in core and codegen +case class PluginInfo( + name: String, + path: String, + kind: PluginKind, + version: Option[String] = None, + size: Long, + installTime: java.time.Instant, + lastUsedTime: java.time.Instant, + schemaPath: Option[String] = None, + schemaTime: Option[java.time.Instant] = None +) derives JsonFormat: + override def toString: String = name + version.map("-" + _).getOrElse("") +object PluginInfo: + def fromJsonList(json: String): Either[Exception, List[PluginInfo]] = + json.parseJson[List[PluginInfo]] + +/** PluginKind represents a kind of a plugin that may be dynamically loaded and used by Pulumi. */ +enum PluginKind(val value: String): + /** Analyzer is a plugin that can be used as a resource analyzer. + */ + case Analyzer extends PluginKind("analyzer") + + /** Language is a plugin that can be used as a language host. + */ + case Language extends PluginKind("language") + + /** Resource is a plugin that can be used as a resource provider for custom CRUD operations. + */ + case Resource extends PluginKind("resource") + + /** Converter is a plugin that can be used to convert from other ecosystems to Pulumi. + */ + case Converter extends PluginKind("converter") +object PluginKind: + given JsonFormat[PluginKind] = new JsonFormat[PluginKind]: + override def write(obj: PluginKind): JsValue = JsString(obj.value) + override def read(json: JsValue): PluginKind = json match + case JsString(s) => PluginKind.from(s) + case _ => throw new RuntimeException("PluginKind must be a string") + + def from(value: String): PluginKind = value match + case "analyzer" => Analyzer + case "language" => Language + case "resource" => Resource + case "converter" => Converter + case _ => throw new RuntimeException(s"Unknown plugin kind: $value") + +type RunFunc = besom.Context => besom.Output[besom.internal.Exports] + +/** OutputValue models a Pulumi Stack output, providing the plaintext value and a boolean indicating secretness. + * + * @param value + * the plaintext value of the output + * @param secret + * a boolean indicating if the output is a secret + */ +case class OutputValue(value: Any, secret: Boolean = false) + +/** OutputMap is the output result of running a Pulumi program. It is represented as a map from string to OutputValue. + */ +type OutputMap = Map[String, OutputValue] +object OutputMap: + // represents the CLI response for an output marked as "secret" + private val SecretSentinel = "[secret]" + + private[auto] def fromJson( + masked: String, + plaintext: String + ): Either[Exception, OutputMap] = + for + m <- masked.parseJson[Map[String, String]].left.map(e => AutoError(s"Failed to parse masked output map", e)) + p <- plaintext.parseJson[Map[String, String]].left.map(e => AutoError(s"Failed to parse plaintext output map", e)) + yield for (k, v) <- p yield k -> OutputValue(v, m.get(k).contains(SecretSentinel)) +end OutputMap diff --git a/auto/src/main/scala/besom/auto/internal/auto.scala b/auto/src/main/scala/besom/auto/internal/auto.scala new file mode 100644 index 00000000..7131432a --- /dev/null +++ b/auto/src/main/scala/besom/auto/internal/auto.scala @@ -0,0 +1,484 @@ +package besom.auto.internal + +import LocalWorkspaceOption.* +import LocalWorkspace.* +import besom.util.* + +/** Log in to a local Pulumi backend. + * + * Will store your state information on your computer underneath the provided directory `file://[pulumiHome]`. It is then up to you to + * manage this state, including backing it up, using it in a team environment, and so on. Will set PULUMI_HOME to the provided path. + * + * Equivalent to `pulumi login file://[pulumiHome]/..` or `pulumi login file://~` or `pulumi login --local` + * + * @param pulumiHome + * the path to use for the local backend + * @return + * a [[Unit]] or an error if any + */ +def loginLocal(pulumiHome: NotProvidedOr[os.Path] = NotProvided): Either[Exception, Unit] = + pulumiHome match + case NotProvided => login(LoginOption.Local()) + case path: os.Path => login(LoginOption.Local(path / os.up), LoginOption.PulumiHome(path)) +end loginLocal + +/** Pulumi log in initialized the Pulumi state storage using the provided options. + * + * @param options + * the options to configure the login behavior + * @return + * a [[Unit]] or an error if any + */ +def login(options: LoginOption*): Either[Exception, Unit] = + val opts = LoginOptions.from(options.toList) + val args: Seq[String] = Seq.empty[String] + ++ opts.cloud.map("--cloud-url=" + _) + ++ opts.local.bimap("--local")("file://" + _) + ++ opts.defaultOrg.map("--default-org=" + _) + ++ Option.when(opts.allowInsecure)("--insecure") + val sOpts = Seq.empty[shell.ShellOption.Env] + ++ opts.pulumiHome.map(p => shell.ShellOption.Env(shell.pulumi.env.PulumiHomeEnv -> p.toString)) + ++ opts.pulumiAccessToken.map(t => shell.ShellOption.Env(shell.pulumi.env.PulumiAccessTokenEnv -> t)) + shell + .pulumi("login", args)(sOpts*) + .fold( + err => Left(AutoError(s"Failed to login: ${err.getMessage}", err)), + _ => Right(()) + ) +end login + +/** Log in to a Pulumi backend. + * + * Available backends are: + * - the managed Pulumi Cloud backend, e.g. `PulumiAccessToken("...")` + * - a self-hosted Pulumi Cloud backend, e.g. `Cloud("https://api.pulumi.acmecorp.com)` + * - an object storage backends, e.g. `Cloud("s3://my-bucket")` + * - a local computer backend, e.g. `Local(os.home)` + */ +sealed trait LoginOption +object LoginOption: + /** The URL of the Pulumi service to log in to. + * + * Equivalent to `pulumi login --cloud-url=[url]` + */ + case class Cloud(url: String) extends LoginOption + + /** The path to the Pulumi home directory. + * + * Overrides the metadata directory for `pulumi login`. This customizes the location of `$PULUMI_HOME` where metadata is stored. If not + * provided, will be read from the environment variable `PULUMI_HOME` or default to `~/.pulumi` + */ + case class PulumiHome(path: os.Path) extends LoginOption + + /** The Pulumi access token to use for logging in. + * + * If not provided, will be read from the environment variable `PULUMI_ACCESS_TOKEN`. + */ + case class PulumiAccessToken(token: String) extends LoginOption + + /** Use local log in to initialize the Pulumi state storage using the provided path. + * + * Will store your state information on your computer underneath the provided directory `file://[path]/.pulumi` It is then up to you to + * manage this state, including backing it up, using it in a team environment, and so on. + * + * Equivalent to `pulumi login file://[path]` or `pulumi login file://~` or `pulumi login --local` + * + * @param path + * the path to use for the local backend + */ + case class Local(path: NotProvidedOr[os.Path] = NotProvided) extends LoginOption + + /** A default org to associate with the login. Please note, currently, only the managed and self-hosted backends support organizations. + * + * Equivalent to `pulumi login --default-org=[org]` + * + * @param org + * the org to associate with the login + */ + case class DefaultOrg(org: String) extends LoginOption + + /** Allow insecure server connections when using SSL/TLS. + * + * Equivalent to `pulumi login --insecure` + */ + case object AllowInsecure extends LoginOption +end LoginOption + +/** Log in to a Pulumi backend. + * + * Available backends are: + * - the managed Pulumi Cloud backend, e.g. `PulumiAccessToken("...")` + * - a self-hosted Pulumi Cloud backend, e.g. `Cloud("https://api.pulumi.acmecorp.com)` + * - an object storage backends, e.g. `Cloud("s3://my-bucket")` + * - a local computer backend, e.g. `Local(os.home)` + * + * @param cloud + * the URL of the Pulumi service to log in to + * @param local + * the path to use for the local backend + * @param pulumiHome + * the path to the Pulumi home directory + * @param pulumiAccessToken + * the Pulumi access token to use for logging in + * @param defaultOrg + * a default org to associate with the login + * @param allowInsecure + * allow insecure server connections when using SSL/TLS + */ +case class LoginOptions( + cloud: NotProvidedOr[String] = NotProvided, + local: NotProvidedOr[os.Path] = NotProvided, + pulumiHome: NotProvidedOr[os.Path] = NotProvided, + pulumiAccessToken: NotProvidedOr[String] = NotProvided, + defaultOrg: NotProvidedOr[String] = NotProvided, + allowInsecure: Boolean = false +) +object LoginOptions: + def from(options: LoginOption*): LoginOptions = from(options.toList) + def from(options: List[LoginOption]): LoginOptions = + options match + case LoginOption.Cloud(url) :: tail => from(tail*).copy(cloud = url) + case LoginOption.Local(path) :: tail => from(tail*).copy(local = path) + case LoginOption.PulumiHome(path) :: tail => from(tail*).copy(pulumiHome = path) + case LoginOption.PulumiAccessToken(token) :: tail => from(tail*).copy(pulumiAccessToken = token) + case LoginOption.DefaultOrg(org) :: tail => from(tail*).copy(defaultOrg = org) + case LoginOption.AllowInsecure :: tail => from(tail*).copy(allowInsecure = true) + case Nil => LoginOptions() + case o => throw AutoError(s"Unknown login option: $o") + end from + +/** Log out of the Pulumi backend. + * @param options + * the options to configure the logout behavior + * @return + * a [[Unit]] or an error if any + */ +def logout(options: LogoutOption*): Either[Exception, Unit] = + val opts = LogoutOptions.from(options.toList) + val args = Seq.empty[String] + ++ opts.local.bimap("--local")(_.toString) + ++ opts.cloud.map("--cloud-url=" + _) + ++ Option.when(opts.all)("--all") + val sOpts = Seq.empty[shell.ShellOption.Env] + ++ opts.pulumiHome.map(p => shell.ShellOption.Env(shell.pulumi.env.PulumiHomeEnv -> p.toString)) + shell + .pulumi("logout", args)(sOpts*) + .fold( + err => Left(AutoError(s"Failed to logout: ${err.getMessage}", err)), + _ => Right(()) + ) +end logout + +/** Can be used to configure the [[logout]] behavior. + */ +sealed trait LogoutOption +object LogoutOption: + /** Logout of all backends. + */ + case object All extends LogoutOption + + /** A cloud URL to log out of (defaults to current cloud). + */ + case class Cloud(url: String) extends LogoutOption + + /** Log out of using local mode + */ + case class Local(path: NotProvidedOr[os.Path] = NotProvided) extends LogoutOption + + /** The path to the Pulumi home directory. + * + * Overrides the metadata directory for `pulumi logout`. This customizes the location of `$PULUMI_HOME` where metadata is stored. If not + * provided, will be read from the environment variable `PULUMI_HOME` or default to `~/.pulumi` + */ + case class PulumiHome(path: os.Path) extends LogoutOption + +/** Can be used to configure the [[logout]] behavior. + * @param all + * if true, log out of all backends + * @param local + * log out of using local mode with the provided path (defaults to `~`) + * @param cloud + * a cloud URL to log out of (defaults to current cloud) + * @param pulumiHome + * the path to the Pulumi home directory, if not provided, will be read from the environment variable `PULUMI_HOME` or default to + * `~/.pulumi` + */ +case class LogoutOptions( + all: Boolean = false, + local: NotProvidedOr[os.Path] = NotProvided, + cloud: NotProvidedOr[String] = NotProvided, + pulumiHome: NotProvidedOr[os.Path] = NotProvided +) +object LogoutOptions: + /** Creates a [[LogoutOptions]] from a list of [[LogoutOption]]s. + * @param options + * the list of [[LogoutOption]]s + * @return + * a [[LogoutOptions]] + */ + def from(options: LogoutOption*): LogoutOptions = from(options.toList) + + /** Creates a [[LogoutOptions]] from a list of [[LogoutOption]]s. + * @param options + * the list of [[LogoutOption]]s + * @return + * a [[LogoutOptions]] + */ + def from(options: List[LogoutOption]): LogoutOptions = + options match + case LogoutOption.All :: tail => from(tail*).copy(all = true) + case LogoutOption.Local(path) :: tail => from(tail*).copy(local = path) + case LogoutOption.Cloud(url) :: tail => from(tail*).copy(cloud = url) + case LogoutOption.PulumiHome(path) :: tail => from(tail*).copy(pulumiHome = path) + case Nil => LogoutOptions() + case o => throw AutoError(s"Unknown logout option: $o") + end from +end LogoutOptions + +/** Creates and configures a [[LocalWorkspace]]. + * + * [[LocalWorkspaceOption]]s can be used to configure things like e.g.: + * - [[WorkDir]] - the working directory + * - [[Program]] - the program to execute + * - [[Repo]] - the git repository to clone + * + * @param options + * options to pass to the [[LocalWorkspace]] + * @return + * a [[LocalWorkspace]] or an error if any + */ +def localWorkspace(options: LocalWorkspaceOption*): Either[Exception, LocalWorkspace] = LocalWorkspace(options*) + +/** Creates a [[Stack]] backed by a [[LocalWorkspace]] created on behalf of the user, from the specified [[WorkDir]]. + * + * This Workspace will pick up any available Settings files (`Pulumi.yaml`, `Pulumi.[stack].yaml`). + * @param stackName + * the name of the stack to create + * @param options + * options to pass to the [[LocalWorkspace]] + * @return + * a [[Stack]] backed by a [[LocalWorkspace]] or an error if any + */ +def createStackLocalSource( + stackName: String, + workDir: os.Path, + options: LocalWorkspaceOption* +): Either[Exception, Stack] = + for + ws <- localWorkspace(WorkDir(workDir) +: options*) + s <- Stack.create(stackName, ws) + yield s + +/** Creates or selects a [[Stack]] backed by a [[LocalWorkspace]] created on behalf of the user, from the specified [[WorkDir]]. If the + * [[Stack]] already exists, it will not throw an error and proceed to selecting the [[Stack]]. This [[Workspace]] will pick up any + * available Settings files (`Pulumi.yaml`, `Pulumi.[stack].yaml`). + * + * @param stackName + * the name of the stack to upsert + * @param workDir + * the working directory containing the project + * @param opts + * the options for the local workspace + * @return + * a [[Stack]] backed by a [[LocalWorkspace]] or an error if any + */ +def upsertStackLocalSource( + stackName: String, + workDir: os.Path, + opts: LocalWorkspaceOption* +): Either[Exception, Stack] = + for + ws <- localWorkspace(WorkDir(workDir) +: opts*) + s <- Stack.upsert(stackName, ws) + yield s + +/** Selects an existing [[Stack]] backed by a [[LocalWorkspace]] created on behalf of the user, from the specified [[WorkDir]]. This + * [[Workspace]] will pick up any available Settings files (`Pulumi.yaml`, `Pulumi.[stack].yaml`). + * + * @param stackName + * the name of the stack to select + * @param workDir + * the working directory containing the project + * @param opts + * the options for the local workspace + * @return + * a [[Stack]] backed by a [[LocalWorkspace]] or an error if any + */ +def selectStackLocalSource( + stackName: String, + workDir: os.Path, + opts: LocalWorkspaceOption* +): Either[Exception, Stack] = + for + ws <- localWorkspace(WorkDir(workDir) +: opts*) + s <- Stack.select(stackName, ws) + yield s + +/** Creates a [[Stack]] backed by a [[LocalWorkspace]] created on behalf of the user, with source code cloned from the specified + * [[GitRepo]]. This [[Workspace]] will pick up any available Settings files (`Pulumi.yaml`, `Pulumi.[stack].yaml`) that are cloned into + * the Workspace. Unless a [[WorkDir]] option is specified, the [[GitRepo]] will be clone into a new temporary directory provided by the + * OS. + * + * @param stackName + * the name of the stack to create + * @param repo + * the Git repository to clone + * @param opts + * the options for the local workspace + * @return + * a [[Stack]] backed by a [[LocalWorkspace]] or an error if any + */ +def createStackRemoteSource( + stackName: String, + repo: GitRepo, + opts: LocalWorkspaceOption* +): Either[Exception, Stack] = + for + ws <- localWorkspace(Repo(repo) +: opts*) + s <- Stack.create(stackName, ws) + yield s + +/** Creates a [[Stack]] backed by a [[LocalWorkspace]] created on behalf of the user, with source code cloned from the specified + * [[GitRepo]]. If the [[Stack]] already exists, it will not error and proceed to selecting the [[Stack]]. This [[Workspace]] will pick up + * any available Settings files (`Pulumi.yaml`, `Pulumi.[stack].yaml`) that are cloned into the [[Workspace]]. Unless a [[WorkDir]] option + * is specified, the [[GitRepo]] will be clone into a new temporary directory provided by the OS. + * @param stackName + * the name of the stack to upsert + * @param repo + * the Git repository to clone + * @param opts + * the options for the local workspace + * @return + * a [[Stack]] backed by a [[LocalWorkspace]] or an error if any + */ +def upsertStackRemoteSource( + stackName: String, + repo: GitRepo, + opts: LocalWorkspaceOption* +): Either[Exception, Stack] = + for + ws <- localWorkspace(Repo(repo) +: opts*) + s <- Stack.upsert(stackName, ws) + yield s + +/** Selects an existing [[Stack]] backed by a [[LocalWorkspace]] created on behalf of the user, with source code cloned from the specified + * [[GitRepo]]. This [[Workspace]] will pick up any available Settings files (`Pulumi.yaml`, `Pulumi.[stack].yaml`) that are cloned into + * the [[Workspace]]. Unless a [[WorkDir]] option is specified, the [[GitRepo]] will be clone into a new temporary directory provided by + * the OS. + * @param stackName + * the name of the stack to select + * @param repo + * the Git repository to clone + * @param opts + * the options for the local workspace + * @return + * a [[Stack]] backed by a [[LocalWorkspace]] or an error if any + */ +def selectStackRemoteSource( + stackName: String, + repo: GitRepo, + opts: LocalWorkspaceOption* +): Either[Exception, Stack] = + for + ws <- localWorkspace(Repo(repo) +: opts*) + s <- Stack.select(stackName, ws) + yield s + +/** Creates a [[Stack]] backed by a [[LocalWorkspace]] created on behalf of the user, with the specified program. If no [[Project]] option + * is specified, default project settings will be created on behalf of the user. Similarly, unless a [[WorkDir]] option is specified, the + * working directory will default to a new temporary directory provided by the OS. + * + * @param stackName + * the name of the stack to create + * @param projectName + * the name of the project + * @param program + * the Pulumi program to execute + * @param opts + * the options for the local workspace + * @return + * a [[Stack]] backed by a [[LocalWorkspace]] or an error if any + */ +def createStackInlineSource( + stackName: String, + projectName: String, + program: RunFunc, + opts: LocalWorkspaceOption* +): Either[Exception, Stack] = + val optsWithProgram = Program(program) +: opts + val allOpts: Either[AutoError, Seq[LocalWorkspaceOption]] = + getProjectSettings(projectName, optsWithProgram) match + case Left(e) => Left(AutoError(s"Failed to create stack '$stackName': ${e.getMessage}", e)) + case Right(proj) => Right(Project(proj) +: opts) + for + allOpts <- allOpts + ws <- localWorkspace(allOpts*) + s <- Stack.create(stackName, ws) + yield s +end createStackInlineSource + +/** Creates a [[Stack]] backed by a [[LocalWorkspace]] created on behalf of the user, with the specified program. If the [[Stack]] already + * exists, it will not error and proceed to selecting the [[Stack]]. If no [[Project]] option is specified, default project settings will + * be created on behalf of the user. Similarly, unless a [[WorkDir]] option is specified, the working directory will default to a new + * temporary directory provided by the OS. + * + * @param stackName + * the name of the stack to upsert + * @param projectName + * the name of the project + * @param program + * the Pulumi program to execute + * @param opts + * the options for the local workspace + * @return + * a [[Stack]] backed by a [[LocalWorkspace]] or an error if any + */ +def upsertStackInlineSource( + stackName: String, + projectName: String, + program: RunFunc, + opts: LocalWorkspaceOption* +): Either[Exception, Stack] = + val optsWithProgram = Program(program) +: opts + val allOpts: Either[AutoError, Seq[LocalWorkspaceOption]] = + getProjectSettings(projectName, optsWithProgram) match + case Left(e) => Left(AutoError(s"Failed to upsert stack '$stackName': ${e.getMessage}", e)) + case Right(proj) => Right(Project(proj) +: opts) + for + allOpts <- allOpts + ws <- localWorkspace(allOpts*) + s <- Stack.upsert(stackName, ws) + yield s +end upsertStackInlineSource + +/** Selects an existing [[Stack]] backed by a [[LocalWorkspace]] created on behalf of the user, with the specified program. If no + * [[Project]] option is specified, default project settings will be created on behalf of the user. Similarly, unless a [[WorkDir]] option + * is specified, the working directory will default to a new temporary directory provided by the OS. + * @param stackName + * the name of the stack to select + * @param projectName + * the name of the project + * @param program + * the Pulumi program to execute + * @param opts + * the options for the local workspace + * @return + * a [[Stack]] backed by a [[LocalWorkspace]] or an error if any + */ +def selectStackInlineSource( + stackName: String, + projectName: String, + program: RunFunc, + opts: LocalWorkspaceOption* +): Either[Exception, Stack] = + val optsWithProgram = Program(program) +: opts + val allOpts: Either[AutoError, Seq[LocalWorkspaceOption]] = + getProjectSettings(projectName, optsWithProgram) match + case Left(e) => Left(AutoError(s"Failed to select stack '$stackName': ${e.getMessage}", e)) + case Right(proj) => Right(Project(proj) +: opts) + for + allOpts <- allOpts + ws <- localWorkspace(allOpts*) + s <- Stack.select(stackName, ws) + yield s +end selectStackInlineSource diff --git a/auto/src/main/scala/besom/auto/internal/shell.scala b/auto/src/main/scala/besom/auto/internal/shell.scala new file mode 100644 index 00000000..e7fe32be --- /dev/null +++ b/auto/src/main/scala/besom/auto/internal/shell.scala @@ -0,0 +1,194 @@ +package besom.auto.internal + +import besom.util.* +import os.CommandResult + +import scala.io.Source + +object shell: + case class Result private ( + command: Seq[String], + exitCode: Int, + out: String, + err: String, + envVars: Map[String, String] + ): + def asError: ShellAutoError = ShellAutoError( + exitCode = exitCode, + stdout = out, + stderr = err, + command = command, + envVars = envVars + ) + + object Result: + def from(result: os.CommandResult, envVars: Map[String, String]): Either[ShellAutoError, Result] = + val res = Result(result.command, result.exitCode, result.out.text(), result.err.text(), envVars) + if res.exitCode == 0 then Right(res) else Left(res.asError) + end Result + + def apply(command: os.Shellable*)(opts: ShellOption*): Either[ShellAutoError, Result] = + val options = ShellOptions.from(opts*) + val result = os + .proc(command*) + .call( + cwd = options.cwd.asOption.orNull, + env = options.env, + stdin = options.stdin, + stdout = options.stdout, + stderr = options.stderr, + mergeErrIntoOut = options.mergeErrIntoOut, + timeout = options.timeout, + check = options.check, + propagateEnv = options.propagateEnv + ) + Result.from(result, options.env) + end apply + + sealed trait ShellOption + object ShellOption: + /** the working directory of the subprocess */ + case class Cwd(path: os.Path) extends ShellOption + + /** any additional environment variables you wish to set in the subprocess */ + case class Env(env: Map[String, String]) extends ShellOption + object Env: + def apply(env: (String, String)*): Env = new Env(env.toMap) + def apply(key: String, value: String): Env = Env(Map(key -> value)) + + /** Any data you wish to pass to the subprocess standard input. */ + case class Stdin(input: os.ProcessInput) extends ShellOption + + /** How the subprocess output stream is configured. */ + case class Stdout(output: os.ProcessOutput) extends ShellOption + + /** How the subprocess error stream is configured. */ + case class Stderr(output: os.ProcessOutput) extends ShellOption + + /** Whether to merge the subprocess error stream into its output stream. */ + case object MergeErrIntoOut extends ShellOption + + /** How long to wait for the subprocess to complete, in milliseconds. */ + case class Timeout(timeout: Long) extends ShellOption + + /** Whether to check the subprocess exit code and throw an exception if it is non-zero. Disable this to avoid throwing an exception if + * the subprocess. + */ + case object Check extends ShellOption + + /** Whether to propagate the current environment variables to the subprocess. Disable this to avoid passing in this parent process's + * environment variables to the subprocess. + */ + case object DontPropagateEnv extends ShellOption + + /** Options for the subprocess execution. + * @param cwd + * the working directory of the subprocess + * @param env + * any additional environment variables you wish to set in the subprocess + * @param stdin + * any data you wish to pass to the subprocess standard input + * @param stdout + * how the subprocess output stream is configured + * @param stderr + * how the subprocess error stream is configured + * @param mergeErrIntoOut + * whether to merge the subprocess error stream into its output stream + * @param timeout + * how long to wait for the subprocess to complete, in milliseconds + * @param check + * whether to check the subprocess exit code and throw an exception if it is non-zero + * @param propagateEnv + * whether to propagate the current environment variables to the subprocess + */ + case class ShellOptions( + cwd: NotProvidedOr[os.Path] = NotProvided, + env: Map[String, String] = Map.empty, + stdin: os.ProcessInput = os.Pipe, + stdout: os.ProcessOutput = os.Pipe, + stderr: os.ProcessOutput = os.Pipe, // in contrast to os lib we default to Pipe, because we use our own error handling + mergeErrIntoOut: Boolean = false, + timeout: Long = -1, + check: Boolean = false, // in contrast to os lib we default to false, because we use our own error handling + propagateEnv: Boolean = true + ) + + object ShellOptions: + def from(opts: ShellOption*): ShellOptions = from(opts.toList) + def from(opts: List[ShellOption]): ShellOptions = + opts match + case ShellOption.Cwd(path) :: tail => from(tail).copy(cwd = path) + case ShellOption.Stdin(input) :: tail => from(tail).copy(stdin = input) + case ShellOption.Stdout(output) :: tail => from(tail).copy(stdout = output) + case ShellOption.Stderr(output) :: tail => from(tail).copy(stderr = output) + case ShellOption.MergeErrIntoOut :: tail => from(tail).copy(mergeErrIntoOut = true) + case ShellOption.Timeout(timeout) :: tail => from(tail).copy(timeout = timeout) + case ShellOption.Check :: tail => from(tail).copy(check = true) + case ShellOption.DontPropagateEnv :: tail => from(tail).copy(propagateEnv = false) + case ShellOption.Env(env) :: tail => { + val old = from(tail*) + old.copy(env = old.env ++ env) + } + case Nil => ShellOptions() + case o => throw AutoError(s"Unknown shell option: $o") + + def env(name: String): Either[Exception, String] = + sys.env.get(name) match + case Some(v) => + Option(v).filter(_.trim.nonEmpty) match + case Some(value) => Right(value) + case None => Left(Exception(s"Environment variable $name is empty")) + case None => Left(Exception(s"Environment variable $name is not set")) + + object pulumi: + def ProjectFileName(ext: String = "yaml") = s"Pulumi.$ext" + def StackFileName(stackName: String, ext: String = "yaml") = s"Pulumi.$stackName.$ext" + + object env: + val PulumiHomeEnv = "PULUMI_HOME" + val PulumiAutomationApiSkipVersionCheckEnv = "PULUMI_AUTOMATION_API_SKIP_VERSION_CHECK" + val PulumiDebugCommandsEnv = "PULUMI_DEBUG_COMMANDS" + val PulumiExperimentalEnv = "PULUMI_EXPERIMENTAL" + val PulumiSkipUpdateCheckEnv = "PULUMI_SKIP_UPDATE_CHECK" + val PulumiAccessTokenEnv = "PULUMI_ACCESS_TOKEN" + val PulumiConfigPassphraseEnv = "PULUMI_CONFIG_PASSPHRASE" + val PulumiConfigPassphraseFileEnv = "PULUMI_CONFIG_PASSPHRASE_FILE" + + lazy val pulumiHome: Either[Exception, os.Path] = + shell.env(PulumiHomeEnv).map(os.Path(_)) + lazy val pulumiAutomationApiSkipVersionCheck: Boolean = + shell.env(PulumiAutomationApiSkipVersionCheckEnv).map(isTruthy).getOrElse(false) + lazy val pulumiAccessToken: Either[Exception, String] = + shell.env(PulumiAccessTokenEnv) + + end env + + // all commands should be run in non - interactive mode + // this causes commands to fail rather than prompting for input (and thus hanging indefinitely) + private val commonArgs: List[os.Shellable] = List("--non-interactive", "--logtostderr") + private val commonOpts: List[ShellOption] = List(ShellOption.Env(env.PulumiSkipUpdateCheckEnv -> "true")) + + def apply(additional: os.Shellable*)(opts: ShellOption*): Either[ShellAutoError, shell.Result] = + shell("pulumi", commonArgs ++ additional)(commonOpts ++ opts*) + + end pulumi + + import ma.chinespirit.tailf.Tail + + // FIXME probably requires a redesign? + def tail(path: os.Path): Either[Exception, Iterator[String] & AutoCloseable] = + Tail + .follow(path.toIO) + .left + .map(e => Exception(s"Failed to open $path for tailing", e)) + .map { is => + new Iterator[String] with AutoCloseable: + val src = scala.io.Source.fromInputStream(is) + val it = src.getLines() + + def hasNext: Boolean = it.hasNext + def next(): String = it.next() + def close(): Unit = src.close() + } + +end shell diff --git a/auto/src/main/scala/besom/internal/HackedSerializer.scala b/auto/src/main/scala/besom/internal/HackedSerializer.scala new file mode 100644 index 00000000..9caeace3 --- /dev/null +++ b/auto/src/main/scala/besom/internal/HackedSerializer.scala @@ -0,0 +1,35 @@ +package besom.auto.internal + +import org.virtuslab.yaml.Node +import org.virtuslab.yaml.internal.load.parse.EventKind +import org.virtuslab.yaml.internal.load.parse.EventKind._ +import org.virtuslab.yaml.internal.dump.serialize.Serializer + +object HackedSerializerImpl extends Serializer { + override def toEvents(node: Node): Seq[EventKind] = + Seq(DocumentStart()) ++ convertNode(node) ++ Seq(DocumentEnd()) + + private def convertNode(node: Node) = node match { + case scalar: Node.ScalarNode => convertScalarNode(scalar) + case mapping: Node.MappingNode => convertMappingNode(mapping) + case sequence: Node.SequenceNode => convertSequenceNode(sequence) + } + + private def convertMappingNode(node: Node.MappingNode): Seq[EventKind] = { + val events = node.mappings.toSeq.flatMap { + case (_, Node.ScalarNode(null, _)) => Seq.empty + case (_, Node.SequenceNode(s, _)) if s.isEmpty => Seq.empty + case (_, Node.MappingNode(m, _)) if m.isEmpty => Seq.empty + case (k, v) => Seq(convertNode(k), convertNode(v)) + }.flatten + Seq(MappingStart()) ++ events ++ Seq(MappingEnd) + } + + private def convertSequenceNode(node: Node.SequenceNode): Seq[EventKind] = { + val events = node.nodes.flatMap(convertNode(_)) + Seq(SequenceStart()) ++ events ++ Seq(SequenceEnd) + } + + private def convertScalarNode(node: Node.ScalarNode): Seq[EventKind] = + Seq(Scalar(node.value)) +} diff --git a/auto/src/main/scala/besom/model/FullyQualifiedStackName.scala b/auto/src/main/scala/besom/model/FullyQualifiedStackName.scala new file mode 100644 index 00000000..03cb7475 --- /dev/null +++ b/auto/src/main/scala/besom/model/FullyQualifiedStackName.scala @@ -0,0 +1,152 @@ +package besom.model + +import scala.compiletime.* +import scala.compiletime.ops.string.* +import scala.language.implicitConversions + +/** A stack name formatted with the least possible specificity: `stack` or `org/stack` or `org/project/stack` or `user/project/stack` + * + * The stack name is specified in one of the following formats: + * + * - `stack`: Identifies the stack name in the current user account or default organization, and the `project` specified by the nearest + * `Pulumi.yaml` project file. + * - `org/stack`: Identifies the stack stackName in the organization `org`, and the project specified by the nearest `Pulumi.yaml` + * project file. + * - `org/project/stack`: Identifies the `stack` name in the organization `org` and the `project`, `project` must match the project + * specified by the nearest `Pulumi.yaml` project file. + * + * For self-managed backends, the `org` portion of the stack name must always be the constant value `organization`. + */ +opaque type StackName <: String = String +object StackName extends StackNameFactory + +trait StackNameFactory: + + def apply(stackName: String): StackName = parse(stackName) match + case Right(stackName) => stackName + case Left(e) => throw e + + def parse(stackName: String): Either[Exception, StackName] = + if stackName.nonEmpty + then Right(stackName.asInstanceOf[StackName]) + else Left(Exception("StackName cannot be empty")) + + extension (stackName: StackName) + /** @return + * the [[StackName]] as a [[Tuple]] of [[String]]s, in the format `(org, project, stack)` + */ + def parts: (Option[String], Option[String], String) = stackName.split("/") match + case Array(stack) if stack.nonEmpty => (None, None, stack) + case Array(project, stack) if stack.nonEmpty => (None, Some(project), stack) + case Array(org, project, stack) if stack.nonEmpty => (Some(org), Some(project), stack) + case _ => throw IllegalArgumentException(s"Invalid StackName string: ${stackName}") + + /** @return + * the [[FullyQualifiedStackName]] for this stack name + */ + def asFullyQualified( + defaultOrganization: => String = "organization", + defaultProject: => String + ): FullyQualifiedStackName = + parts match + case (None, None, stack) => FullyQualifiedStackName(defaultOrganization, defaultProject, stack) + case (None, Some(project), stack) => FullyQualifiedStackName(defaultOrganization, project, stack) + case (Some(org), None, stack) => FullyQualifiedStackName(org, defaultProject, stack) + case (Some(org), Some(project), stack) => FullyQualifiedStackName(org, project, stack) + +end StackNameFactory + +/** A stack name formatted with the greatest possible specificity: `org/project/stack` or `user/project/stack` + * + * Using this format avoids ambiguity in stack identity guards creating or selecting the wrong stack. Note that filestate backends (local + * file, S3, Azure Blob, etc.) do not support stack names, and instead prefixes the stack name with the word `organization` and the project + * name, e.g. `organization/my-project-name/my-stack-name`. + * + * See: https://github.com/pulumi/pulumi/issues/2522 + */ +opaque type FullyQualifiedStackName <: StackName = StackName +object FullyQualifiedStackName extends FullyQualifiedStackNameFactory + +trait FullyQualifiedStackNameFactory: + + private val FullyQualifiedStackNamePattern = ".+/.+/.+".r + + /** Build a fully qualified stack name from its parts with default organization. + * + * @param project + * the project name + * @param stack + * the stack name + * @return + */ + def apply(project: String, stack: String): FullyQualifiedStackName = FullyQualifiedStackName("organization", project, stack) + + /** Build a fully qualified stack name from its parts. + * + * @param org + * the organization name + * @param project + * the project name + * @param stack + * the stack name + * @return + * a [[FullyQualifiedStackName]] if the string is valid, otherwise an exception is thrown + */ + def apply(org: String, project: String, stack: String): FullyQualifiedStackName = + val fqsn = s"${org}/${project}/${stack}" + parse(fqsn) match + case Right(fqsn) => fqsn + case Left(e) => throw e + + /** Parse a string into a [[FullyQualifiedStackName]]. + * @param s + * is a string to parse + * @return + * a [[FullyQualifiedStackName]] if the string is valid, otherwise `None` + */ + def parse(s: String): Either[Exception, FullyQualifiedStackName] = + if FullyQualifiedStackNamePattern.matches(s) then Right(unsafeOf(s)) + else Left(Exception(s"Expected FullyQualifiedStackName to match '$FullyQualifiedStackNamePattern', got: '$s'")) + + /** Parse a string into a [[FullyQualifiedStackName]]. + * + * @param s + * is a string to parse + * @return + * a [[FullyQualifiedStackName]] if the string is valid, otherwise a compile time error occurs + */ + inline def apply(s: String): FullyQualifiedStackName = + requireConst(s) + inline if !constValue[Matches[s.type, ".+/.+/.+"]] then error("Invalid FullyQualifiedStackName string. Must match '.+/.+/.+'") + else s + + implicit inline def str2FullyQualifiedStackName(inline s: String): FullyQualifiedStackName = FullyQualifiedStackName(s) + implicit inline def fqsn2Str(inline fqsn: String | FullyQualifiedStackName): String = fqsn + + private[model] def unsafeOf(s: String): FullyQualifiedStackName = + s.asInstanceOf[FullyQualifiedStackName] // FIXME: why this fails without cast? + + extension (fqsn: FullyQualifiedStackName) + /** @return + * the [[FullyQualifiedStackName]] as a [[Tuple]] of [[String]]s, in the format `(org, project, stack)` + */ + def parts: (String, String, String) = fqsn match + case s"${org}/${project}/${stack}" => (org, project, stack) + case _ => throw IllegalArgumentException(s"Invalid FullyQualifiedStackName string: ${fqsn}") + + /** @return + * the organization name + */ + def organization: String = parts._1 + + /** @return + * the project name + */ + def project: String = parts._2 + + /** @return + * the stack name + */ + def stack: String = parts._3 + +end FullyQualifiedStackNameFactory diff --git a/auto/src/main/scala/besom/model/Names.scala b/auto/src/main/scala/besom/model/Names.scala new file mode 100644 index 00000000..21960de5 --- /dev/null +++ b/auto/src/main/scala/besom/model/Names.scala @@ -0,0 +1,124 @@ +package besom.model + +import scala.compiletime.* +import scala.compiletime.ops.string.* +import scala.language.implicitConversions + +/** Name is an identifier. */ +opaque type Name <: String = String +object Name: + private val NameFirstCharRegexpPattern = "[A-Za-z0-9_.-]" + private val NameRestCharRegexpPattern = "[A-Za-z0-9_.-]*" + private[model] val NameRegexpPattern = NameFirstCharRegexpPattern + NameRestCharRegexpPattern + + private val NameRegexp = NameRegexpPattern.r + private[model] val NameFirstCharRegexp = ("^" + NameFirstCharRegexpPattern + "$").r + private[model] val NameRestCharRegexp = ("^" + NameRestCharRegexpPattern + "$").r + + /** IsName checks whether a string is a legal Name. */ + def isName(s: String): Boolean = s.nonEmpty && NameRegexp.findFirstIn(s).isDefined + + /** Parse a string into a [[Name]]. + * @param s + * is a string to parse + * @return + * a [[Name]] if the string is valid, otherwise a compile time error occurs + */ + inline def apply(s: String): Name = + requireConst(s) + inline if !constValue[Matches[s.type, "[A-Za-z0-9_.-][A-Za-z0-9_.-]*"]] then + error("Invalid Name string. Must match '[A-Za-z0-9_.-][A-Za-z0-9_.-]*'.") + else s + + implicit inline def str2Name(inline s: String): Name = Name(s) + + private[besom] def unsafeOf(s: String): Name = s + + extension (name: Name) + /** Turns a [[Name]] into a qualified name, this is legal, since Name's is a proper subset of QName's grammar. + * @return + * the [[Name]] as a [[QName]] + */ + def asQName: QName = QName.unsafeOf(name) + +end Name + +/** QName is a qualified identifier. The "/" character optionally delimits different pieces of the name. Each element conforms to Name + * regexp pattern. For example, "pulumi/pulumi/stack". + */ + +opaque type QName <: String = String +object QName: + /** Parse a string into a [[QName]]. + * @param s + * is a string to parse + * @return + * a [[QName]] if the string is valid, otherwise a compile time error occurs + */ + inline def apply(s: String): QName = + requireConst(s) + inline if !constValue[Matches[s.type, "([A-Za-z0-9_.-][A-Za-z0-9_.-]*/)*[A-Za-z0-9_.-][A-Za-z0-9_.-]*"]] then + error("Invalid QName string. Must match '([A-Za-z0-9_.-][A-Za-z0-9_.-]*/)*[A-Za-z0-9_.-][A-Za-z0-9_.-]*'.") + else s + + implicit inline def str2QName(inline s: String): QName = QName(s) + + private[besom] def unsafeOf(s: String): QName = s + + /** QNameDelimiter is what delimits Namespace and Name parts. */ + private val QNameDelimiter = "/" + private val QNameRegexpPattern = "(" + Name.NameRegexpPattern + "\\" + QNameDelimiter + ")*" + Name.NameRegexpPattern + private val QNameRegexp = QNameRegexpPattern.r + + /** IsQName checks whether a string is a legal QName. */ + def isQName(s: String): Boolean = s.nonEmpty && QNameRegexp.findFirstIn(s).isDefined + + /** Converts an arbitrary string into a [[QName]], converting the string to a valid [[QName]] if necessary. The conversion is + * deterministic, but also lossy. + */ + def parse(s: String): QName = + val output = s.split(QNameDelimiter).filter(_.nonEmpty).map { segment => + val chars = segment.toCharArray + if (!Name.NameFirstCharRegexp.matches(chars.head.toString)) chars.update(0, '_') + for (i <- 1 until chars.length) { + if (!Name.NameRestCharRegexp.matches(chars(i).toString)) chars.update(i, '_') + } + new String(chars) + } + val result = output.mkString(QNameDelimiter) + if (result.isEmpty) QName.unsafeOf("_") else QName.unsafeOf(result) + end parse + + extension (qname: QName) + /** Extracts the [[Name]] portion of a [[QName]] (dropping any namespace). */ + def name: Name = + val ix = qname.lastIndexOf(QNameDelimiter) + val nmn = if ix == -1 then qname else qname.substring(ix + 1) + assert(Name.isName(nmn), s"QName $qname has invalid name $nmn") + nmn + + /** Extracts the namespace portion of a [[QName]] (dropping the name), this may be empty. */ + def namespace: QName = + val ix = qname.lastIndexOf(QNameDelimiter) + val qn = if ix == -1 then "" else qname.substring(0, ix) + assert(isQName(qn), s"QName $qname has invalid namespace $qn") + QName.unsafeOf(qn) + +end QName + +/** PackageName is a qualified name referring to an imported package. */ +type PackageName = QName +object PackageName: + def parse(s: String): PackageName = QName.parse(s) + +/** ModuleName is a qualified name referring to an imported module from a package. */ +type ModuleName = QName + +/** ModuleMemberName is a simple name representing the module member's identifier. */ +type ModuleMemberName = Name + +/** ClassMemberName is a simple name representing the class member's identifier. */ +type ClassMemberName = Name + +/** TypeName is a simple name representing the type's name, without any package/module qualifiers. */ +type TypeName = Name diff --git a/auto/src/main/scala/besom/model/SemanticVersion.scala b/auto/src/main/scala/besom/model/SemanticVersion.scala new file mode 100644 index 00000000..38f6d8f1 --- /dev/null +++ b/auto/src/main/scala/besom/model/SemanticVersion.scala @@ -0,0 +1,123 @@ +package besom.model + +// TODO: move to separate module +// NOTICE: keep in sync with codegen/src/model/SemanticVersion.scala + +/** A semantic version as defined by https://semver.org/ + * + * @param major + * Major version number + * @param minor + * Minor version number + * @param patch + * Patch version number + * @param preRelease + * Pre-release version identifier + * @param buildMetadata + * Build metadata version identifier + */ +case class SemanticVersion( + major: Int, + minor: Int, + patch: Int, + preRelease: Option[String] = None, + buildMetadata: Option[String] = None +) extends Ordered[SemanticVersion]: + require(major >= 0, "major version must be non-negative") + require(minor >= 0, "minor version must be non-negative") + require(patch >= 0, "patch version must be non-negative") + + override def compare(that: SemanticVersion): Int = + import math.Ordered.orderingToOrdered + + val mainCompared = (major, minor, patch).compare((that.major, that.minor, that.patch)) + + // for pre release compare each dot separated identifier from left to right + lazy val thisPreRelease: Vector[Option[String]] = preRelease.map(_.split('.')).getOrElse(Array.empty[String]).toVector.map(Some(_)) + lazy val thatPreRelease: Vector[Option[String]] = that.preRelease.map(_.split('.')).getOrElse(Array.empty[String]).toVector.map(Some(_)) + + def comparePreReleaseIdentifier(thisIdentifeir: Option[String], thatIdentifier: Option[String]): Int = + (thisIdentifeir, thatIdentifier) match + case (Some(thisId), Some(thatId)) => + val thisIsNumeric = thisId.forall(_.isDigit) + val thatIsNumeric = thatId.forall(_.isDigit) + (thisIsNumeric, thatIsNumeric) match + case (true, true) => thisId.toInt.compare(thatId.toInt) + case (false, false) => thisId.compare(thatId) + case (true, false) => -1 // numeric identifiers have always lower precedence than non-numeric identifiers + case (false, true) => 1 // numeric identifiers have always lower precedence than non-numeric identifiers + /* A larger set of pre-release fields has a higher precedence than a smaller set, if all of the preceding identifiers are equal. */ + case (Some(_), None) => 1 // larger set of pre-release fields has higher precedence + case (None, Some(_)) => -1 // larger set of pre-release fields has higher precedence + case (None, None) => 0 + + lazy val preCompared: Int = + thisPreRelease + .zipAll(thatPreRelease, None, None) + .map(comparePreReleaseIdentifier.tupled) + .find(_ != 0) + .getOrElse( + thisPreRelease.length.compare(thatPreRelease.length) + ) // if all identifiers are equal, the version with fewer fields has lower precedence + + // ignore build metadata when comparing versions per semver spec https://semver.org/#spec-item-10 + + if mainCompared != 0 + then mainCompared + else if thisPreRelease.isEmpty && thatPreRelease.nonEmpty + then 1 // normal version has higher precedence than a pre-release version + else if thisPreRelease.nonEmpty && thatPreRelease.isEmpty + then -1 // normal version has higher precedence than a pre-release version + else preCompared // pre-release version has lower precedence than a normal version + end compare + + def isSnapshot: Boolean = preRelease.contains("SNAPSHOT") + + lazy val preReleaseString: String = preRelease.map("-" + _).getOrElse("") + lazy val buildMetadataString: String = buildMetadata.map("+" + _).getOrElse("") + + override def toString: String = s"$major.$minor.$patch$preReleaseString$buildMetadataString" + def toShortString: String = + val xyz = List(major) ++ Option.when(minor > 0)(minor) ++ Option.when(patch > 0)(patch) + xyz.mkString(".") + preReleaseString + buildMetadataString +end SemanticVersion + +//noinspection ScalaFileName +object SemanticVersion { + // https://semver.org/spec/v2.0.0.html#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string + private val versionRegex = + """^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$""".r + + def apply(major: Int, minor: Int, patch: Int): SemanticVersion = + new SemanticVersion(major, minor, patch, None, None) + + def apply(major: Int, minor: Int, patch: Int, preRelease: String): SemanticVersion = + new SemanticVersion(major, minor, patch, Some(preRelease), None) + + def apply(major: Int, minor: Int, patch: Int, preRelease: String, buildMetadata: String): SemanticVersion = + new SemanticVersion(major, minor, patch, Some(preRelease), Some(buildMetadata)) + + def parse(version: String): Either[Exception, SemanticVersion] = { + version match { + case versionRegex(major, minor, patch, preRelease, buildMetadata) => + Right(SemanticVersion(major.toInt, minor.toInt, patch.toInt, Option(preRelease), Option(buildMetadata))) + case _ => Left(Exception(s"Cannot parse as semantic version: '$version'")) + } + } + + /** ParseTolerant allows for certain version specifications that do not strictly adhere to semver specs to be parsed by this library. It + * does so by normalizing versions before passing them to [[parse]]. It currently trims spaces, removes a "v" prefix, and adds a 0 patch + * number to versions with only major and minor components specified. + */ + def parseTolerant(version: String): Either[Exception, SemanticVersion] = { + val str = version.trim.stripPrefix("v") + + // Split into major.minor.(patch+pr+meta) + val parts = str.split("\\.", 3) + if parts.length < 3 then + if parts.last.contains("+") || parts.last.contains("-") then + Left(Exception("Short version cannot contain PreRelease/Build meta data")) + else parse((parts.toList ::: List.fill(3 - parts.length)("0")).mkString(".")) + else parse(str) + } +} diff --git a/auto/src/test/scala/besom/auto/internal/LocalWorkspaceTest.scala b/auto/src/test/scala/besom/auto/internal/LocalWorkspaceTest.scala new file mode 100644 index 00000000..1eeebd16 --- /dev/null +++ b/auto/src/test/scala/besom/auto/internal/LocalWorkspaceTest.scala @@ -0,0 +1,74 @@ +package besom.auto.internal + +import besom.model.FullyQualifiedStackName +import besom.test.* +import besom.util.eitherOps + +class LocalWorkspaceTest extends munit.FunSuite: + + FunFixture[FullyQualifiedStackName]( + setup = t => fqsn(this.getClass, t), + teardown = _ => () + ).test("new stack remote source with setup") { generatedStackName => + val stackName = FullyQualifiedStackName("goproj", generatedStackName.stack) + val pulumiHomeDir = os.temp.dir() / ".pulumi" + loginLocal(pulumiHomeDir) + + val binName = "examplesBinary" + val bin = if System.getProperty("os.name").startsWith("Windows") then binName + ".exe" else binName + val binaryBuilder = (ws: Workspace) => { + shell("go", "build", "-o", bin, "main.go")(shell.ShellOption.Cwd(ws.workDir)).bimap( + e => e.withMessage("go build failed"), + _ => () + ) + } + + val res = for + stack <- createStackRemoteSource( + stackName, + GitRepo( + url = "https://github.com/pulumi/test-repo.git", + projectPath = "goproj", + setup = binaryBuilder + ), + LocalWorkspaceOption.Project( + Project( + name = "goproj", + runtime = ProjectRuntimeInfo( + name = "go", + options = Map("binary" -> binName) + ) + ) + ), + LocalWorkspaceOption.PulumiHome(pulumiHomeDir), + LocalWorkspaceOption.EnvVars(shell.pulumi.env.PulumiConfigPassphraseEnv -> "test") + ) + prevRes <- stack.preview() + upRes <- stack.up() + yield (prevRes, upRes) + res.fold( + e => fail(e.getMessage, e), + (prevRes, upRes) => { + assertEquals(prevRes.summary, Map(OpType.Create -> 1)) + assertEquals( + upRes.outputs, + Map( + "exp_cfg" -> OutputValue(""), + "exp_secret" -> OutputValue("", secret = true), + "exp_static" -> OutputValue("foo") + ) + ) + assertEquals(upRes.summary.kind, "update") + assertEquals( + upRes.summary.resourceChanges, + Some( + Map( + OpType.Create.toString -> 1 + ) + ) + ) + assertEquals(upRes.summary.result, Some("succeeded")) + } + ) + } +end LocalWorkspaceTest diff --git a/auto/src/test/scala/besom/auto/internal/ShellTest.scala b/auto/src/test/scala/besom/auto/internal/ShellTest.scala new file mode 100644 index 00000000..24a0dc59 --- /dev/null +++ b/auto/src/test/scala/besom/auto/internal/ShellTest.scala @@ -0,0 +1,29 @@ +package besom.auto.internal + +import besom.auto.internal.shell.* + +class ShellTest extends munit.FunSuite: + test("ShellOptions.from") { + val options = ShellOptions.from( + ShellOption.Cwd(os.pwd / "test"), + ShellOption.Env("FOO" -> "BAR"), + ShellOption.Env("FOO2" -> "BAR2"), + ShellOption.Stdin("input"), + ShellOption.Stdout(os.ProcessOutput.Readlines(_ => ())), + ShellOption.Stderr(os.ProcessOutput.Readlines(_ => ())), + ShellOption.Timeout(1000), + ShellOption.MergeErrIntoOut, + ShellOption.Check, + ShellOption.DontPropagateEnv + ) + + assertEquals(options.cwd, os.pwd / "test") + assertEquals(options.env, Map("FOO" -> "BAR", "FOO2" -> "BAR2")) + assertEquals(options.stdin.getClass.getTypeName, "os.ProcessInput$SourceInput") + assertEquals(options.stdout.getClass.getTypeName, "os.ProcessOutput$Readlines") + assertEquals(options.stderr.getClass.getTypeName, "os.ProcessOutput$Readlines") + assertEquals(options.timeout, 1000L) + assertEquals(options.mergeErrIntoOut, true) + assertEquals(options.check, true) + assertEquals(options.propagateEnv, false) + } diff --git a/auto/src/test/scala/besom/auto/internal/StackTest.scala b/auto/src/test/scala/besom/auto/internal/StackTest.scala new file mode 100644 index 00000000..7c6091cc --- /dev/null +++ b/auto/src/test/scala/besom/auto/internal/StackTest.scala @@ -0,0 +1,23 @@ +package besom.auto.internal + +import besom.util.eitherOps + +//noinspection ScalaFileName +class EngineEventJSONTest extends munit.FunSuite { + + test("EngineEvent should deserialize from JSON") { + val json = + """{"sequence":4,"timestamp":1704893590,"summaryEvent":{"maybeCorrupt":false,"durationSeconds":0,"resourceChanges":{"create":1},"PolicyPacks":{}}}""" + + val event: EngineEvent = EngineEvent.fromJson(json).get + + assertEquals(event.sequence, 4) + assertEquals(event.timestamp, 1704893590) + assert(event.summaryEvent.isDefined) + val summary: SummaryEvent = event.summaryEvent.get + assertEquals(summary.maybeCorrupt, false) + assertEquals(summary.durationSeconds, 0) + assertEquals(summary.resourceChanges(OpType.Create), 1) + assertEquals(summary.policyPacks, Map.empty) + } +} diff --git a/auto/src/test/scala/besom/model/FullyQualifiedStackNameTest.scala b/auto/src/test/scala/besom/model/FullyQualifiedStackNameTest.scala new file mode 100644 index 00000000..f59e5f6b --- /dev/null +++ b/auto/src/test/scala/besom/model/FullyQualifiedStackNameTest.scala @@ -0,0 +1,12 @@ +package besom.model + +class FullyQualifiedStackNameTest extends munit.FunSuite: + test("local name") { + val stackName = FullyQualifiedStackName("my-project", "my-stack") + assertEquals(stackName, "organization/my-project/my-stack") + } + + test("full name") { + val stackName = FullyQualifiedStackName("my-organization", "my-project", "my-stack") + assertEquals(stackName, "my-organization/my-project/my-stack") + } diff --git a/auto/src/test/scala/besom/model/NamesTest.scala b/auto/src/test/scala/besom/model/NamesTest.scala new file mode 100644 index 00000000..8432c37b --- /dev/null +++ b/auto/src/test/scala/besom/model/NamesTest.scala @@ -0,0 +1,146 @@ +package besom.model + +import besom.test.CompileAssertions + +class NamesTest extends munit.FunSuite with CompileAssertions: + + import QName.* // force use of QName extensions instead of TestOptionsConversions.name + + test("validation - all alpha") { + compiles("""import besom.model._ + val n = Name("simple") + """) + } + + test("validation - mixed-case alpha") { + compiles("""import besom.model._ + val n = Name("SiMplE") + """) + } + + test("validation - alphanumeric") { + compiles("""import besom.model._ + val n = Name("simple0") + """) + } + + test("validation - mixed-case alphanumeric") { + compiles("""import besom.model._ + val n = Name("SiMpLe0") + """) + } + + test("validation - permit underscore") { + compiles("""import besom.model._ + val n = Name("_") + """) + } + + test("validation - mixed-case alphanumeric/underscore") { + compiles("""import besom.model._ + val n = Name("s1MPl3_") + """) + compiles("""import besom.model._ + val n = Name("_s1MPl3") + """) + } + + test("validation - permit hyphens") { + compiles("""import besom.model._ + val n = Name("hy-phy") + """) + } + + test("validation - start with .") { + compiles("""import besom.model._ + val n = Name(".dotstart") + """) + } + + test("validation - start with -") { + compiles("""import besom.model._ + val n = Name("-hyphenstart") + """) + } + + test("validation - start with numbers") { + compiles("""import besom.model._ + val n = Name("0num") + """) + } + + test("validation - start with numbers") { + compiles("""import besom.model._ + val n = Name("9num") + """) + } + + test("validation - multi-part name") { + compiles("""import besom.model._ + val n = QName("namespace/complex") + """) + failsToCompile("""import besom.model._ + val n = Name("namespace/complex") + """) + } + + test("validation - multi-part, alphanumeric, etc. name") { + compiles("""import besom.model._ + val n = QName("_naMeSpace0/coMpl3x32") + """) + failsToCompile("""import besom.model._ + val n = Name("_naMeSpace0/coMpl3x32") + """) + } + + test("validation - even more complex parts") { + compiles("""import besom.model._ + val n = QName("n_ameSpace3/moRenam3sp4ce/_Complex5") + """) + failsToCompile("""import besom.model._ + val n = Name("n_ameSpace3/moRenam3sp4ce/_Complex5") + """) + } + + test("validation - bad characters") { + failsToCompile("""import besom.model._ + val n = QName("s!mple") + """) + failsToCompile("""import besom.model._ + val n = Name("s!mple") + """) + failsToCompile("""import besom.model._ + val n = QName("namesp@ce/complex") + """) + failsToCompile("""import besom.model._ + val n = Name("namesp@ce/complex") + """) + failsToCompile("""import besom.model._ + val n = QName("namespace/morenamespace/compl#x") + """) + failsToCompile("""import besom.model._ + val n = Name("namespace/morenamespace/compl#x") + """) + } + + test("parsing - simple name") { + assertEquals(Name("simple"), "simple") + assertEquals(QName("namespace/complex").name, "complex") + assertEquals(QName("ns1/ns2/ns3/ns4/complex").name, "complex") + assertEquals(QName("_/_/_/_/a0/c0Mpl3x_").name, "c0Mpl3x_") + } + + test("parsing - simple namespace") { + assertEquals(QName("namespace/complex").namespace, "namespace") + assertEquals(QName("ns1/ns2/ns3/ns4/complex").namespace, "ns1/ns2/ns3/ns4") + assertEquals(QName("_/_/_/_/a0/c0Mpl3x_").namespace, "_/_/_/_/a0") + } + + test("convert to QName") { + assertEquals(QName.parse("foo/bar"), "foo/bar") + assertEquals(QName.parse("https:"), "https_") + assertEquals(QName.parse("https://"), "https_") + assertEquals(QName.parse(""), "_") + assertEquals(QName.parse("///"), "_") + } +end NamesTest diff --git a/auto/src/test/scala/besom/test/CompileAssertions.scala b/auto/src/test/scala/besom/test/CompileAssertions.scala new file mode 100644 index 00000000..316f51c0 --- /dev/null +++ b/auto/src/test/scala/besom/test/CompileAssertions.scala @@ -0,0 +1,13 @@ +package besom.test + +trait CompileAssertions: + self: munit.FunSuite => + + inline def failsToCompile(inline code: String): Unit = + assert( + !scala.compiletime.testing.typeChecks(code), + s"Code compiled correctly when expecting type errors:${System.lineSeparator()}$code" + ) + + inline def compiles(inline code: String): Unit = + assert(scala.compiletime.testing.typeChecks(code), s"Code failed to compile:${System.lineSeparator()}$code") diff --git a/auto/src/test/scala/besom/test/Naming.scala b/auto/src/test/scala/besom/test/Naming.scala new file mode 100644 index 00000000..0f052680 --- /dev/null +++ b/auto/src/test/scala/besom/test/Naming.scala @@ -0,0 +1,22 @@ +package besom.test + +import besom.model.FullyQualifiedStackName + +/** SHA1 hash of a string + * + * @param s + * string to hash + * @return + * 40 character hex string of the hash for the given string + */ +def sha1(s: String): String = { + import java.security.MessageDigest + val bytes = MessageDigest.getInstance("SHA-1").digest(s.getBytes("UTF-8")) + String.format("%x", new java.math.BigInteger(1, bytes)) +} + +def stackName(name: String): String = "tests-" + sanitizeName(name) +def fqsn(`class`: Class[_], test: munit.TestOptions): FullyQualifiedStackName = + FullyQualifiedStackName(sanitizeName(`class`.getSimpleName, limit = 20), stackName(test.name)) +def sanitizeName(name: String, replacement: String = "-", limit: Int = 40): String = + name.replaceAll("[^a-zA-Z0-9]+", replacement).toLowerCase().take(limit).stripSuffix(replacement) diff --git a/besom-cats/project.scala b/besom-cats/project.scala index 1aac985e..8e1a69a1 100644 --- a/besom-cats/project.scala +++ b/besom-cats/project.scala @@ -2,7 +2,7 @@ //> using options "-java-output-version:11", "-Ykind-projector:underscores" //> using options "-deprecation", "-feature" -//> using dep "org.virtuslab::besom-core:0.3.1" +//> using dep "org.virtuslab::besom-core:0.3.2" //> using dep "org.typelevel::cats-effect:3.3.14" //> using test.dep "org.scalameta::munit:1.0.0-M10" diff --git a/besom-cfg/k8s/.scalafmt.conf b/besom-cfg/k8s/.scalafmt.conf new file mode 100644 index 00000000..f4d4b655 --- /dev/null +++ b/besom-cfg/k8s/.scalafmt.conf @@ -0,0 +1,11 @@ +version = 3.5.2 +runner.dialect = scala3 +project.git = true +align = most +align.openParenCallSite = false +align.openParenDefnSite = false +align.tokens = [{code = "=>", owner = "Case"}, "<-", "%", "%%", "="] +indent.defnSite = 2 +maxColumn = 140 + +rewrite.scala3.insertEndMarkerMinLines = 40 \ No newline at end of file diff --git a/besom-cfg/k8s/project.scala b/besom-cfg/k8s/project.scala new file mode 100644 index 00000000..2c985461 --- /dev/null +++ b/besom-cfg/k8s/project.scala @@ -0,0 +1,24 @@ +//> using scala 3.3.3 + +//> using dep com.lihaoyi::os-lib::0.9.3 +//> using dep org.virtuslab::besom-cfg:0.2.0-SNAPSHOT +//> using dep org.virtuslab::besom-kubernetes:4.13.1-core.0.3 +//> using dep com.lihaoyi::fansi::0.5.0 +//> using dep com.lihaoyi::fastparse:3.1.0 + +//> using test.resourceDir ./src/test/resources + +//> using test.dep com.lihaoyi::pprint:0.6.6 +//> using test.dep org.scalameta::munit:1.0.0-M11 + +//> using publish.name "besom-cfg-k8s" +//> using publish.organization "org.virtuslab" +//> using publish.url "https://github.com/VirtusLab/besom" +//> using publish.vcs "github:VirtusLab/besom" +//> using publish.license "Apache-2.0" +//> using publish.repository "central" +//> using publish.developer "lbialy|Łukasz Biały|https://github.com/lbialy" +//> using publish.developer "prolativ|Michał Pałka|https://github.com/prolativ" +//> using publish.developer "KacperFKorban|Kacper Korban|https://github.com/KacperFKorban" +//> using publish.developer "pawelprazak|Paweł Prażak|https://github.com/pawelprazak" +//> using repository sonatype:snapshots \ No newline at end of file diff --git a/besom-cfg/k8s/src/main/scala/ConfiguredContainerArgs.scala b/besom-cfg/k8s/src/main/scala/ConfiguredContainerArgs.scala new file mode 100644 index 00000000..a99f7863 --- /dev/null +++ b/besom-cfg/k8s/src/main/scala/ConfiguredContainerArgs.scala @@ -0,0 +1,172 @@ +package besom.cfg.k8s + +import besom.cfg.internal.* +import besom.types.{Input, Context, Output} +import besom.cfg.* +import besom.json.* +import besom.cfg.containers.* +import besom.api.kubernetes.core.v1.inputs.* + +import scala.util.* +import scala.quoted.* +import besom.cfg.k8s.syntax.* + +// this is besom-cfg-kubernetes entrypoint + +object syntax: + extension (s: Struct) + def foldedToEnvVarArgs(using Context): Output[List[EnvVarArgs]] = + s.foldToEnv.map(_.map { case (k, v) => EnvVarArgs(name = k, value = v) }) + +object ConfiguredContainerArgs: + + private val NL = System.lineSeparator() + + inline def apply[C <: Struct]( + name: String, + image: String, + configuration: C, + args: Input.Optional[List[Input[String]]] = None, + command: Input.Optional[List[Input[String]]] = None, + env: Input.Optional[List[Input[EnvVarArgs]]] = None, + envFrom: Input.Optional[List[Input[EnvFromSourceArgs]]] = None, + imagePullPolicy: Input.Optional[String] = None, + lifecycle: Input.Optional[LifecycleArgs] = None, + livenessProbe: Input.Optional[ProbeArgs] = None, + ports: Input.Optional[List[Input[ContainerPortArgs]]] = None, + readinessProbe: Input.Optional[ProbeArgs] = None, + resizePolicy: Input.Optional[List[Input[ContainerResizePolicyArgs]]] = None, + resources: Input.Optional[ResourceRequirementsArgs] = None, + restartPolicy: Input.Optional[String] = None, + securityContext: Input.Optional[SecurityContextArgs] = None, + startupProbe: Input.Optional[ProbeArgs] = None, + stdin: Input.Optional[Boolean] = None, + stdinOnce: Input.Optional[Boolean] = None, + terminationMessagePath: Input.Optional[String] = None, + terminationMessagePolicy: Input.Optional[String] = None, + tty: Input.Optional[Boolean] = None, + volumeDevices: Input.Optional[List[Input[VolumeDeviceArgs]]] = None, + volumeMounts: Input.Optional[List[Input[VolumeMountArgs]]] = None, + workingDir: Input.Optional[String] = None + )(using ctx: Context) = ${ + applyImpl( + 'name, + 'image, + 'configuration, + 'args, + 'command, + 'env, + 'envFrom, + 'imagePullPolicy, + 'lifecycle, + 'livenessProbe, + 'ports, + 'readinessProbe, + 'resizePolicy, + 'resources, + 'restartPolicy, + 'securityContext, + 'startupProbe, + 'stdin, + 'stdinOnce, + 'terminationMessagePath, + 'terminationMessagePolicy, + 'tty, + 'volumeDevices, + 'volumeMounts, + 'workingDir, + 'ctx + ) + } + + def applyImpl[C <: Struct: Type]( + name: Expr[String], + image: Expr[String], + configuration: Expr[C], + args: Expr[Input.Optional[List[Input[String]]]], + command: Expr[Input.Optional[List[Input[String]]]], + env: Expr[Input.Optional[List[Input[EnvVarArgs]]]], + envFrom: Expr[Input.Optional[List[Input[EnvFromSourceArgs]]]], + imagePullPolicy: Expr[Input.Optional[String]], + lifecycle: Expr[Input.Optional[LifecycleArgs]], + livenessProbe: Expr[Input.Optional[ProbeArgs]], + ports: Expr[Input.Optional[List[Input[ContainerPortArgs]]]], + readinessProbe: Expr[Input.Optional[ProbeArgs]], + resizePolicy: Expr[Input.Optional[List[Input[ContainerResizePolicyArgs]]]], + resources: Expr[Input.Optional[ResourceRequirementsArgs]], + restartPolicy: Expr[Input.Optional[String]], + securityContext: Expr[Input.Optional[SecurityContextArgs]], + startupProbe: Expr[Input.Optional[ProbeArgs]], + stdin: Expr[Input.Optional[Boolean]], + stdinOnce: Expr[Input.Optional[Boolean]], + terminationMessagePath: Expr[Input.Optional[String]], + terminationMessagePolicy: Expr[Input.Optional[String]], + tty: Expr[Input.Optional[Boolean]], + volumeDevices: Expr[Input.Optional[List[Input[VolumeDeviceArgs]]]], + volumeMounts: Expr[Input.Optional[List[Input[VolumeMountArgs]]]], + workingDir: Expr[Input.Optional[String]], + context: Expr[Context] + )(using Quotes): Expr[ContainerArgs] = + import quotes.reflect.* + + val contName = name.value match + case None => report.errorAndAbort("Container name has to be a literal!", name) + case Some(value) => value + + val dockerImage = image.value match + case None => report.errorAndAbort("Image name has to be a literal!", image) + case Some(value) => value + + val schema = getDockerImageMetadata(dockerImage) match + case Left(throwable) => report.errorAndAbort(s"Failed to get metadata for image $dockerImage:$NL${pprint(throwable)}", image) + case Right(schema) => schema + + Diff.performDiff(schema, configuration) match + case Left(prettyDiff) => // TODO maybe strip all the ansi codes if in CI? + report.errorAndAbort( + s"Configuration provided for container $contName ($dockerImage) is invalid:$NL$NL$prettyDiff", + configuration + ) + + case Right(()) => + val envExpr = '{ + val envOutput = ${ env }.asOptionOutput()(using ${ context }) + val conf = ${ configuration } + val configurationAsEnvVarArgs = conf.foldedToEnvVarArgs(using $context) + envOutput.zip(configurationAsEnvVarArgs).map { + case (Some(envVarArgsList), envVarArgsListFromConf) => envVarArgsList ++ envVarArgsListFromConf + case (None, envVarArgsListFromConf) => envVarArgsListFromConf + } + } + + '{ + ContainerArgs( + args = $args, + command = $command, + env = $envExpr, + envFrom = $envFrom, + image = $image, + imagePullPolicy = $imagePullPolicy, + lifecycle = $lifecycle, + livenessProbe = $livenessProbe, + name = ${ Expr(contName) }, + ports = $ports, + readinessProbe = $readinessProbe, + resizePolicy = $resizePolicy, + resources = $resources, + restartPolicy = $restartPolicy, + securityContext = $securityContext, + startupProbe = $startupProbe, + stdin = $stdin, + stdinOnce = $stdinOnce, + terminationMessagePath = $terminationMessagePath, + terminationMessagePolicy = $terminationMessagePolicy, + tty = $tty, + volumeDevices = $volumeDevices, + volumeMounts = $volumeMounts, + workingDir = $workingDir + )(using $context) + } + end match + end applyImpl +end ConfiguredContainerArgs diff --git a/besom-cfg/k8s/src/main/scala/containers.scala b/besom-cfg/k8s/src/main/scala/containers.scala new file mode 100644 index 00000000..57d5da68 --- /dev/null +++ b/besom-cfg/k8s/src/main/scala/containers.scala @@ -0,0 +1,63 @@ +package besom.cfg.containers + +// this should be a separate package, base for all container integrations + +import besom.cfg.internal.Schema +import besom.json.* +import scala.util.Try + +val cacheDir = sys.props.get("java.io.tmpdir").getOrElse("/tmp") + +def sanitizeImageName(image: String): String = + image + .replace("/", "_") + .replace(":", "_") + +def fetchFromCache(image: String): Option[String] = + if image.endsWith(":latest") then None + else + val sanitized = sanitizeImageName(image) + os.makeDir.all(os.Path(s"$cacheDir/besom-cfg")) + Try(os.read(os.Path(s"$cacheDir/besom-cfg/$sanitized"))).toOption + +def saveToCache(image: String, content: String): Unit = + if !image.endsWith(":latest") then + val sanitized = sanitizeImageName(image) + os.makeDir.all(os.Path(s"$cacheDir/besom-cfg")) + os.write.over(os.Path(s"$cacheDir/besom-cfg/$sanitized"), content) + +def resolveMetadataFromImage(image: String): String = + lazy val sbtNativePackagerFormatCall = + os + .proc("docker", "run", "--rm", "--entrypoint", "java", image, "-cp", "/opt/docker/lib/*", "besom.cfg.SummonConfiguration") + .call(check = false) + + lazy val customDockerFormatCall = + os + .proc("docker", "run", "--rm", "--entrypoint", "java", image, "-cp", "/app/main", "besom.cfg.SummonConfiguration") + .call(check = false) + + if sbtNativePackagerFormatCall.exitCode == 0 then sbtNativePackagerFormatCall.out.text().trim() + else if customDockerFormatCall.exitCode == 0 then customDockerFormatCall.out.text().trim() + else throw RuntimeException(s"Failed to get configuration from $image") + +def getDockerImageMetadata(image: String): Either[Throwable, Schema] = + Try { + // 1. cache result per image in /tmp DONE + // 2. verify the version of the library used, fail macro if we are older than it + // 3. parse the json to correct structure DONE + // next: + // - support different image setups, autodetect which one is used somehow? somewhat DONE + // - cp argument should be configurable + val json = fetchFromCache(image) match { + case Some(cachedJson) => cachedJson + case None => + val json = resolveMetadataFromImage(image) + + saveToCache(image, json) + + json + } + + summon[JsonFormat[Schema]].read(json.parseJson) + }.toEither diff --git a/besom-cfg/k8s/src/main/scala/diffs.scala b/besom-cfg/k8s/src/main/scala/diffs.scala new file mode 100644 index 00000000..8583c483 --- /dev/null +++ b/besom-cfg/k8s/src/main/scala/diffs.scala @@ -0,0 +1,341 @@ +package besom.cfg + +import scala.collection.immutable.{ListMap, Set} +import besom.cfg.internal.* +import scala.quoted.* +import besom.types.Output + +enum Val: + case Str(value: String) + case Map(value: ListMap[String, Val]) + case List(value: Val.Map) + +type ValMap = ListMap[String, Val] + +object ValMap: + inline def empty: ValMap = ListMap.empty + +private val NL = System.lineSeparator() + +// TODO this is to be deprecated and replaced completely with Tpe.parseType +// TODO however, diff was written based on ValMap and Tpe is too precise (allows unions, Outputs) +// TODO we want to diff without outputs so current setup where we strip outputs from Tpe and then +// TODO convert to ValMap kinda works, but it's not ideal +def parseType(tpe: String): ValMap = + val lines = tpe.split(NL).toVector.drop(1).dropRight(1) // drop the first and last line: { } + def loop(lines: Vector[String], parent: ValMap): (Vector[String], ValMap) = + lines match + case Vector() => (Vector.empty, parent) + case Vector(line, rest @ _*) => + val (key, value) = line.split(":").map(_.trim).toList match + case key :: value :: Nil => (key, value) + case "}" :: Nil => ("", "}") + case "}]" :: Nil => ("", "}]") + case _ => throw Exception(s"Invalid line: $line") + + value match + case "List[{" => + val (rest2, nested) = loop(rest.toVector, ValMap.empty) + loop(rest2, parent + (key -> Val.List(Val.Map(nested)))) + case "{" => + val (rest2, nested) = loop(rest.toVector, ValMap.empty) + loop(rest2, parent + (key -> Val.Map(nested))) + case "}" => + (rest.toVector, parent) + case "}]" => + (rest.toVector, parent) + case _ => + loop(rest.toVector, parent + (key -> Val.Str(value))) + + val (rest, valmap) = loop(lines, ValMap.empty) + assert(rest.isEmpty) + valmap + +def prettifyTypeString(tpe: String): String = + tpe + .replace("Predef.", "") + .replace("scala.collection.immutable.", "") + .replace("besom.internal.", "") + .replace("besom.cfg.Struct ", "") + .replace("besom.cfg.Struct", "{}") // empty Structs handled here + .replace("scala.", "") + .replace("java.lang.", "") + .replace("val ", "") + +def applyColorToTextOnly(str: fansi.Str, f: fansi.Str => fansi.Str): fansi.Str = + val indent = str.toString.takeWhile(_.isWhitespace) + val text = str.toString.dropWhile(_.isWhitespace) + val colored = f(fansi.Str(text)) + fansi.Str(s"$indent$colored") + +// rebuild the type string but mark actual differences with red, green and yellow colors +def diff(obtained: ValMap, expected: ValMap): fansi.Str = + import fansi.Str + import fansi.Color.{Green, Yellow, Red} + + def diffInternal(obtained: ValMap, expected: ValMap, indent: String = " "): Vector[fansi.Str] = + val keys = (expected.keys ++ obtained.keys).toVector.distinct + keys.map { key => + val obtainedValue = obtained.get(key) + val expectedValue = expected.get(key) + + (obtainedValue, expectedValue) match + // same key and type on both sides, plain string + case (Some(Val.Str(obtained)), Some(Val.Str(expected))) if obtained == expected => + Str(s"$indent$key: $obtained") + + // same key, different type (simple type) + case (Some(Val.Str(obtained)), Some(Val.Str(expected))) => + val indentedKeyWithoutColor = Str(s"$indent$key: ") + val redObtained = Red(s"got $obtained") + val yelloExpected = Yellow(s", expected $expected") + + indentedKeyWithoutColor ++ redObtained ++ yelloExpected + + case (Some(Val.List(Val.Map(obtained))), Some(Val.List(Val.Map(expected)))) => + val nestedListDiff = diffInternal(obtained, expected, indent + " ") + val nestedListWrappedInBraces = nestedListDiff.mkString(s"List[{$NL", NL, s"$NL$indent}]") + + Str(s"$indent$key: ") ++ nestedListWrappedInBraces + + // same key, difference in a nested struct + case (Some(Val.Map(obtained)), Some(Val.Map(expected))) => + val nestedStructDiff = diffInternal(obtained, expected, indent + " ") + val nestedStructWrappedInBraces = nestedStructDiff.mkString(s"{$NL", NL, s"$NL$indent}") + + Str(s"$indent$key: $nestedStructWrappedInBraces") + + // present in infra type, not present in application type, unnecessary addition (struct) + case (Some(Val.Map(obtained)), None) => + val nestedStructDiff = diffInternal(obtained, ValMap.empty, indent + " ") + // inject Green in newlines because compiler strips it :( + val nestedStructWrappedInBraces = + nestedStructDiff + .map(applyColorToTextOnly(_, Green.apply)) + .mkString(s"${Green("{")}$NL", NL, s"$NL$indent${Green("}")}") + + Green(s"$indent$key: ") ++ nestedStructWrappedInBraces + + // present in infra type, missing in application type, unnecessary addition (simple type) + case (Some(Val.Str(obtained)), None) => + Green(s"$indent$key: $obtained") + + // present in infra type, missing in application type, unnecessary addition (list of structs) + case (Some(Val.List(Val.Map(obtained))), None) => + val nestedListDiff = diffInternal(obtained, ValMap.empty, indent + " ") + val nestedListWrappedInBraces = nestedListDiff.mkString(s"${Green("List[{")}$NL", NL, s"$NL$indent${Green("}]")}") + + Green(s"$indent$key: ") ++ nestedListWrappedInBraces + + // present in application type, missing in infra type (simple type) + case (None, Some(Val.Str(expected))) => + Red(s"$indent$key: $expected") + + // present in application type, missing in infra type (list of structs) + case (None, Some(Val.List(Val.Map(expected)))) => + val nestedStructDiff = diffInternal(ValMap.empty, expected, indent + " ") + // inject Red in newlines because compiler strips it :( + val nestedStructWrappedInBraces = + nestedStructDiff + .map(applyColorToTextOnly(_, Red.apply)) + .mkString(s"${Red("List[{")}$NL", NL, s"$NL$indent${Red("}]")}") + + Red(s"$indent$key: ") ++ nestedStructWrappedInBraces + + // present in application type, missing in infra type (struct) + case (None, Some(Val.Map(expected))) => + val nestedStructDiff = diffInternal(ValMap.empty, expected, indent + " ") + // inject Red in newlines because compiler strips it :( + val nestedStructWrappedInBraces = + nestedStructDiff + .map(applyColorToTextOnly(_, Red.apply)) + .mkString(s"${Red("{")}$NL", NL, s"$NL$indent${Red("}")}") + + Red(s"$indent$key: ") ++ nestedStructWrappedInBraces + + // obtained simple type, expected struct + case (Some(Val.Str(obtained)), Some(Val.Map(expected))) => + val indentedKeyWithoutColor = Str(s"$indent$key: ") + val redObtained = Red(s"got $obtained") + val nestedStructDiff = diffInternal(ValMap.empty, expected, indent + " ") + // inject Yellow in newlines because compiler strips it :( + val nestedStructWrappedInBraces = + nestedStructDiff + .map(applyColorToTextOnly(_, Yellow.apply)) + .mkString(s"${Yellow("{")}$NL", NL, s"$NL$indent${Yellow("}")}") + + val yelloExpected = Yellow(s", expected ") ++ nestedStructWrappedInBraces + + indentedKeyWithoutColor ++ redObtained ++ yelloExpected + + // obtained struct, expected list of structs + case (Some(Val.Map(obtained)), Some(Val.List(Val.Map(expected)))) => + val indentedKeyWithoutColor = Str(s"$indent$key: ") + val nestedObtainedStructDiff = diffInternal(obtained, ValMap.empty, indent + " ") + val nestedObtainedStructWrappedInBraces = + nestedObtainedStructDiff + .map(applyColorToTextOnly(_, Red.apply)) + .mkString(s"${Red("got {")}$NL", NL, s"$NL$indent${Red("}")}") + + val nestedExpectedListOfStructsDiff = diffInternal(ValMap.empty, expected, indent + " ") + val nestedExpectedListOfStructsWrappedInBraces = + nestedExpectedListOfStructsDiff + .map(applyColorToTextOnly(_, Yellow.apply)) + .mkString(s"${Yellow(", expected List[{")}$NL", NL, s"$NL$indent${Yellow("}]")}") + + indentedKeyWithoutColor ++ nestedObtainedStructWrappedInBraces ++ nestedExpectedListOfStructsWrappedInBraces + + // obtained simple type, expected list of structs + case (Some(Val.Str(obtained)), Some(Val.List(Val.Map(expected)))) => + val indentedKeyWithoutColor = Str(s"$indent$key: ") + val redObtained = Red(s"got $obtained") + val nestedStructDiff = diffInternal(ValMap.empty, expected, indent + " ") + val nestedStructWrappedInBraces = + nestedStructDiff + .map(applyColorToTextOnly(_, Yellow.apply)) + .mkString(s"${Yellow("{")}$NL", NL, s"$NL$indent${Yellow("}]")}") + + val yelloExpected = Yellow(s", expected List[") ++ nestedStructWrappedInBraces + + indentedKeyWithoutColor ++ redObtained ++ yelloExpected + + // obtained list of structs, expected simple type + case (Some(Val.List(Val.Map(obtained))), Some(Val.Str(expected))) => + val nestedListDiff = diffInternal(ValMap.empty, obtained, indent + " ") + val nestedListWrappedInBraces = nestedListDiff.mkString(s"${Red("got List[{")}$NL", NL, s"$NL$indent${Red("}]")}") + + val yelloExpected = Yellow(s", expected $expected") + + Str(s"$indent$key: ") ++ nestedListWrappedInBraces ++ yelloExpected + + // obtained list of structs, expected struct + case (Some(Val.List(Val.Map(obtained))), Some(Val.Map(expected))) => + val indentedKeyWithoutColor = Str(s"$indent$key: ") + val nestedObtainedStructDiff = diffInternal(obtained, ValMap.empty, indent + " ") + val nestedObtainedStructWrappedInBraces = + nestedObtainedStructDiff + .map(applyColorToTextOnly(_, Red.apply)) + .mkString(s"${Red("got List[{")}$NL", NL, s"$NL$indent${Red("}]")}") + + val nestedExpectedListOfStructsDiff = diffInternal(ValMap.empty, expected, indent + " ") + val nestedExpectedListOfStructsWrappedInBraces = + nestedExpectedListOfStructsDiff + .map(applyColorToTextOnly(_, Yellow.apply)) + .mkString(s"${Yellow(", expected {")}$NL", NL, s"$NL$indent${Yellow("}")}") + + indentedKeyWithoutColor ++ nestedObtainedStructWrappedInBraces ++ nestedExpectedListOfStructsWrappedInBraces + + // obtained struct, expected simple type + case (Some(Val.Map(obtained)), Some(Val.Str(expected))) => + val indentedKeyWithoutColor = Str(s"$indent$key: ") + val nestedStructDiff = diffInternal(obtained, ValMap.empty, indent + " ") + val nestedStructWrappedInBraces = + nestedStructDiff + .map(applyColorToTextOnly(_, Red.apply)) + .mkString(s"${Red("got {")}$NL", NL, s"$NL$indent${Red("}")}") + + val yelloExpected = Yellow(s", expected $expected") + + indentedKeyWithoutColor ++ nestedStructWrappedInBraces ++ yelloExpected + // impossible state + case (None, None) => throw Exception(s"Invalid state: $key is missing on both sides") + end match + } + end diffInternal + + s"{$NL" + diffInternal(obtained, expected).mkString(NL) + s"$NL}" +end diff + +object Diff: + def performDiff[C <: Struct: Type](schema: Schema, configuration: Expr[C])(using Quotes): Either[fansi.Str, Unit] = + import quotes.reflect.* + + // TODO this generates really f****d up types like: + // shouldBeListOfStructsButItsAStruct: List[{ + // x: Int | Output[Int] + // y: Double | Output[Double] + // } | Output[{ + // x: Int | Output[Int] + // y: Double | Output[Double] + // }]] | List[Output[{ + // x: Int | Output[Int] + // y: Double | Output[Double] + // } | Output[{ + // x: Int | Output[Int] + // y: Double | Output[Double] + // }]]] + def fieldTypeToTypeRepr(fieldType: FieldType): TypeRepr = + fieldType match + case FieldType.Int => TypeRepr.of[scala.Int | Output[scala.Int]] + case FieldType.Long => TypeRepr.of[scala.Long | Output[scala.Long]] + case FieldType.String => TypeRepr.of[String | Output[String]] + case FieldType.Boolean => TypeRepr.of[scala.Boolean | Output[scala.Boolean]] + case FieldType.Float => TypeRepr.of[scala.Float | Output[scala.Float]] + case FieldType.Double => TypeRepr.of[scala.Double | Output[scala.Double]] + case FieldType.Optional(inner) => // TODO this is borked + fieldTypeToTypeRepr(inner).asType match + case '[t] => TypeRepr.of[t | Null] + case FieldType.Array(inner) => + fieldTypeToTypeRepr(inner).asType match + case '[t] => TypeRepr.of[List[t] | List[Output[t]]] + case FieldType.Struct(fields: _*) => + val refinements = fields.map { (name, fieldType) => + val typeRepr = fieldTypeToTypeRepr(fieldType) + name -> typeRepr + }.toList + + MetaUtils.refineType(TypeRepr.of[Struct], refinements).asType match + case '[t] => TypeRepr.of[t | Output[t]] + + def dealiasAll(tpe: TypeRepr): TypeRepr = + tpe match + case AppliedType(tycon, args) => AppliedType(dealiasAll(tycon), args.map(dealiasAll(_))) + case _ => tpe.dealias + + def schemaToTypeRepr(schema: Schema): TypeRepr = + val refinements = schema.fields.map { case Field(name, fieldType) => + val typeRepr = fieldTypeToTypeRepr(fieldType) + name -> typeRepr + }.toList + + MetaUtils.refineType(TypeRepr.of[Struct], refinements) + + val expectedConfigTypeRepr = schemaToTypeRepr(schema) + val obtainedTypeRepr = TypeRepr.of[C] + + val dealiasedExpectedConfigTypeRepr = dealiasAll(expectedConfigTypeRepr) + val dealiasedObtainedTypeRepr = dealiasAll(obtainedTypeRepr) + + val expectedTypeString = dealiasedExpectedConfigTypeRepr.show + val obtainedTypeString = dealiasedObtainedTypeRepr.show + + val expectedConfigType = expectedConfigTypeRepr.asType + + expectedConfigType match + case '[t] => + type Expected = t + + configuration match + case '{ $c: Expected } => + Right(()) + case '{ $c: cType } => + val prettyExpected = prettifyTypeString(expectedTypeString) + val expected = Tpe.parseType(prettyExpected).map(_.stripOutputs) match + case Left(ex) => throw ex + case Right(st @ Tpe.Struct(_)) => st.toValMap + case Right(_) => ??? // TODO should not happen, top levels are always structs + + val prettyObtained = prettifyTypeString(obtainedTypeString) + val obtained = Tpe.parseType(prettyObtained).map(_.stripOutputs) match + case Left(ex) => throw ex + case Right(st @ Tpe.Struct(_)) => st.toValMap + case Right(_) => ??? // TODO should not happen, top levels are always structs + + val prettyDiff = diff( + obtained = obtained, + expected = expected + ) + + Left(prettyDiff) + end performDiff +end Diff diff --git a/besom-cfg/k8s/src/main/scala/typeparser.scala b/besom-cfg/k8s/src/main/scala/typeparser.scala new file mode 100644 index 00000000..2711662b --- /dev/null +++ b/besom-cfg/k8s/src/main/scala/typeparser.scala @@ -0,0 +1,60 @@ +package besom.cfg + +sealed trait Tpe: + def stripOutputs: Tpe = this match + case Tpe.Output(inner) => inner.stripOutputs + case Tpe.Struct(fields) => Tpe.Struct(fields.map((k, v) => (k, v.stripOutputs))) + case Tpe.Lst(inner) => Tpe.Lst(inner.stripOutputs) + case Tpe.Union(types) => + val unionTypes = types.map(_.stripOutputs).distinct + if unionTypes.length == 1 then unionTypes.head + else Tpe.Union(unionTypes) + case Tpe.Simple(name) => Tpe.Simple(name) + +object Tpe: + case class Simple(name: String) extends Tpe + case class Lst(inner: Tpe) extends Tpe + case class Union(types: List[Tpe]) extends Tpe + case class Output(inner: Tpe) extends Tpe + case class Struct(fields: List[(String, Tpe)]) extends Tpe: + def keys: List[String] = fields.map(_._1) + def get(key: String): Option[Tpe] = fields.find(_._1 == key).map(_._2) + + // any list that isn't list of structs is a Val.Str with internal type interpolated + // any struct is a Val.Map + // any list of structs is a Val.List of Val.Map + + // we assume this is after stripping outputs + def toValMap: ValMap = + fields.foldLeft(ValMap.empty) { case (acc, (k, v)) => + acc.updated( + k, + v match + case Tpe.Simple(name) => Val.Str(name) + case Tpe.Lst(inner: Tpe.Struct) => Val.List(Val.Map(inner.toValMap)) + case Tpe.Lst(inner: Tpe.Simple) => Val.Str(s"List[${inner.name}]") + case Tpe.Union(inner :: Tpe.Simple("Null") :: Nil) => throw Exception("Options are not supported yet") + case Tpe.Lst(_) => ??? // should not happen + case Tpe.Union(types) => ??? // should not happen, there are no instances of ConfiguredType for unions + case Tpe.Output(inner) => ??? // should not happen + case s: Tpe.Struct => Val.Map(s.toValMap) + ) + } + + import fastparse._, MultiLineWhitespace._ + + def ident[$: P]: P[String] = P(CharIn("a-zA-Z_") ~ CharsWhileIn("a-zA-Z0-9_", 0)).! + def simpleType[$: P]: P[Tpe] = P((ident ~ !("[" | ".")).map(Tpe.Simple.apply)) + def structType[$: P]: P[Tpe] = P("{" ~ field.rep(0) ~ "}").map(_.toList).map(Tpe.Struct.apply) + def field[$: P]: P[(String, Tpe)] = P(ident ~ ":" ~ anyType) + def anyType[$: P]: P[Tpe] = P(unionType | outputType | structType | lstType | simpleType) + def nonUnionAnyType[$: P]: P[Tpe] = P(outputType | structType | lstType | simpleType) + def unionType[$: P]: P[Tpe] = P(nonUnionAnyType.rep(2, "|")).map(_.toList).map(Tpe.Union.apply) + def lstType[$: P]: P[Tpe] = P("List[" ~ anyType ~ "]").map(Tpe.Lst.apply) + def outputType[$: P]: P[Tpe] = P("Output[" ~ anyType ~ "]").map(Tpe.Output.apply) + + def parseType(input: String): Either[Exception, Tpe] = + parse(input, anyType(_)) match + case Parsed.Success(value, _) => Right(value) + case f: Parsed.Failure => Left(Exception(f.trace().longMsg)) +end Tpe diff --git a/besom-cfg/k8s/src/test/resources/expected-diff.txt b/besom-cfg/k8s/src/test/resources/expected-diff.txt new file mode 100644 index 00000000..7399f4f4 --- /dev/null +++ b/besom-cfg/k8s/src/test/resources/expected-diff.txt @@ -0,0 +1,55 @@ +{ + shouldBeIntAndItsOK: Int + shouldBeStringButItsNot: got Double, expected String + shouldBeBoolButItsStruct: got { + x: String + }, expected Boolean + shouldBeStructButItsNot: got String, expected { + a: Int + b: String + } + oneFieldInsideIsWrongAndOneIsUnnecessary: { + x: Int + y: got Int, expected Double + z: Int + } + wholeStructMissing: { + q: Int + w: String + } + shouldBeListOfInts: got List[Double], expected List[Int] + shouldBeListOfStructs: got String, expected List[{ + a: Int + b: String + }] + shouldBeListOfStructsButItsAStruct: got { + a: Int + b: Int + }, expected List[{ + x: Int + y: Double + }] + shouldBeAStructButItsAListOfStructs: got List[{ + one: String + }], expected { + x: Int + y: Double + } + shouldBeAStringButItsAListOfStructs: got List[{ + one: Int + }], expected String + shouldBeAListOfStructsButItsAString: got String, expected List[{ + a: Int + b: String + }] + thisOneIsUnnecessary: String + unnecessaryListOfStructs: List[{ + a: Int + b: Int + }] + unnecessaryStruct: { + one: String + two: String + three: String + } +} \ No newline at end of file diff --git a/besom-cfg/k8s/src/test/scala/DummyContext.scala b/besom-cfg/k8s/src/test/scala/DummyContext.scala new file mode 100644 index 00000000..ef12aaff --- /dev/null +++ b/besom-cfg/k8s/src/test/scala/DummyContext.scala @@ -0,0 +1,63 @@ +package besom.internal + +import pulumirpc.resource.{Result => _, *} +import pulumirpc.provider.CallRequest +import pulumirpc.provider.CallResponse +import pulumirpc.provider.InvokeResponse +import pulumirpc.engine.* +import besom.NonEmptyString +import besom.internal.logging.BesomLogger +import pulumirpc.callback.Callback + +object DummyContext: + val dummyRunInfo = RunInfo(Some("test-organization"), "test-project", "test-stack", true, 4, false, "dummy", "dummy") + val dummyFeatureSupport = FeatureSupport(true, true, true, true, true) + val dummyMonitor = new Monitor: + def registerStackTransform(callback: Callback): Result[Unit] = + Result.fail(Exception("Not implemented")) + def call(callRequest: ResourceCallRequest): Result[CallResponse] = + Result.fail(Exception("Not implemented")) + def call(callRequest: CallRequest): Result[CallResponse] = + Result.fail(Exception("Not implemented")) + def invoke(invokeRequest: ResourceInvokeRequest): Result[InvokeResponse] = + Result.fail(Exception("Not implemented")) + def readResource(readResourceRequest: ReadResourceRequest): Result[ReadResourceResponse] = + Result.fail(Exception("Not implemented")) + def registerResource(registerResourceRequest: RegisterResourceRequest): Result[RegisterResourceResponse] = + Result.fail(Exception(s"Not implemented\n${pprint.apply(registerResourceRequest)}")) + def registerResourceOutputs(registerResourceOutputsRequest: RegisterResourceOutputsRequest): Result[Unit] = + Result.fail(Exception("Not implemented")) + def supportsFeature(supportsFeatureRequest: SupportsFeatureRequest): Result[SupportsFeatureResponse] = + Result.fail(Exception("Not implemented")) + def close(): Result[Unit] = Result.fail(Exception("Not implemented")) + + val dummyEngine = new Engine: + def getRootResource(getRootResource: GetRootResourceRequest): Result[GetRootResourceResponse] = + Result.fail(Exception("Not implemented")) + def setRootResource(setRootResource: SetRootResourceRequest): Result[SetRootResourceResponse] = + Result.fail(Exception("Not implemented")) + def log(logRequest: LogRequest): Result[Unit] = + Result.fail(Exception("Not implemented")) + def close(): Result[Unit] = + Result.fail(Exception("Not implemented")) + + def apply( + runInfo: RunInfo = dummyRunInfo, + featureSupport: FeatureSupport = dummyFeatureSupport, + monitor: Monitor = dummyMonitor, + engine: Engine = dummyEngine, + configMap: Map[NonEmptyString, String] = Map.empty, + configSecretKeys: Set[NonEmptyString] = Set.empty + ): Result[Context] = + for + taskTracker <- TaskTracker() + stackPromise <- Promise[StackResource]() + logger <- BesomLogger.local() + memo <- Memo() + config <- Config(runInfo.project, isProjectName = true, configMap = configMap, configSecretKeys = configSecretKeys) + resources <- Resources() + given Context = Context.create(runInfo, featureSupport, config, logger, monitor, engine, taskTracker, resources, memo, stackPromise) + _ <- stackPromise.fulfill(StackResource()(using ComponentBase(Output(besom.types.URN.empty)))) + yield summon[Context] + +end DummyContext diff --git a/besom-cfg/k8s/src/test/scala/ErrorsSupport.scala b/besom-cfg/k8s/src/test/scala/ErrorsSupport.scala new file mode 100644 index 00000000..c7bcf30d --- /dev/null +++ b/besom-cfg/k8s/src/test/scala/ErrorsSupport.scala @@ -0,0 +1,26 @@ +package besom.cfg + +import besom.json.* +import besom.cfg.internal.* +import scala.quoted.* + +object ErrorsSupport: + inline def apply[C <: Struct](schemaStr: String, configuration: C): Either[fansi.Str, Unit] = ${ + callPerformDiff('schemaStr, 'configuration) + } + + def callPerformDiff[C <: Struct: Type](schemaStr: Expr[String], configuration: Expr[C])(using Quotes): Expr[Either[fansi.Str, Unit]] = + import quotes.reflect.* + + given ToExpr[fansi.Str] with + def apply(str: fansi.Str)(using Quotes): Expr[fansi.Str] = '{ fansi.Str(${ Expr(str.toString) }) } + + val schema = schemaStr.value match + case None => report.errorAndAbort("Schema has to be a literal!", schemaStr) + case Some(schemaJson) => summon[JsonFormat[Schema]].read(schemaJson.parseJson) + + val eitherDiffOrUnit = Diff.performDiff(schema, configuration) + + eitherDiffOrUnit match + case Left(diff) => '{ Left(${ Expr(diff) }) } + case Right(()) => '{ Right(()) } diff --git a/besom-cfg/k8s/src/test/scala/ErrorsTest.scala b/besom-cfg/k8s/src/test/scala/ErrorsTest.scala new file mode 100644 index 00000000..3e053908 --- /dev/null +++ b/besom-cfg/k8s/src/test/scala/ErrorsTest.scala @@ -0,0 +1,219 @@ +package besom.cfg + +import besom.json.* +import besom.cfg.internal.* +import besom.types.{Context, Output} +import besom.internal.DummyContext +import besom.internal.RunOutput.* + +class ErrorsTest extends munit.FunSuite: + + given Context = DummyContext().unsafeRunSync() + + test("should fail on wrong type") { + val struct = Struct( + shouldBeIntAndItsOK = 1, + shouldBeStringButItsNot = 23.0, + shouldBeBoolButItsStruct = Struct( + x = "y" + ), + thisOneIsUnnecessary = "not needed", + shouldBeStructButItsNot = "it's a string", + shouldBeListOfInts = List(1.23, 2, 3), // but it's a list of doubles + oneFieldInsideIsWrongAndOneIsUnnecessary = Struct( + x = 10, + y = 10, + z = 10 + ), + shouldBeListOfStructs = "but it isn't", + shouldBeListOfStructsButItsAStruct = Struct( + a = 1, + b = 2 + ), + shouldBeAStructButItsAListOfStructs = List( + Struct( + one = "no" + ) + ), + shouldBeAStringButItsAListOfStructs = List( + Struct( + one = 1 + ) + ), + shouldBeAListOfStructsButItsAString = "oops", + unnecessaryListOfStructs = List( + Struct( + a = 1, + b = 2 + ) + ), + unnecessaryStruct = Struct( + one = "no", + two = "not", + three = "needed" + ) + ) + + ErrorsSupport( + """{ + "schema": [ + { + "details": { + "type": "int" + }, + "name": "shouldBeIntAndItsOK" + }, + { + "details": { + "type": "string" + }, + "name": "shouldBeStringButItsNot" + }, + { + "details": { + "type": "boolean" + }, + "name": "shouldBeBoolButItsStruct" + }, + { + "details": { + "fields": { + "a": { + "type": "int" + }, + "b": { + "type": "string" + } + }, + "type": "struct" + }, + "name": "shouldBeStructButItsNot" + }, + { + "details": { + "fields": { + "x": { + "type": "int" + }, + "y": { + "type": "double" + } + }, + "type": "struct" + }, + "name": "oneFieldInsideIsWrongAndOneIsUnnecessary" + }, + { + "details": { + "fields": { + "q": { + "type": "int" + }, + "w": { + "type": "string" + } + }, + "type": "struct" + }, + "name": "wholeStructMissing" + }, + { + "details": { + "inner": { + "type": "int" + }, + "type": "array" + }, + "name": "shouldBeListOfInts" + }, + { + "details": { + "inner": { + "fields": { + "a": { + "type": "int" + }, + "b": { + "type": "string" + } + }, + "type": "struct" + }, + "type": "array" + }, + "name": "shouldBeListOfStructs" + }, + { + "details": { + "inner": { + "fields": { + "x": { + "type": "int" + }, + "y": { + "type": "double" + } + }, + "type": "struct" + }, + "type": "array" + }, + "name": "shouldBeListOfStructsButItsAStruct" + }, + { + "details": { + "fields": { + "x": { + "type": "int" + }, + "y": { + "type": "double" + } + }, + "type": "struct" + }, + "name": "shouldBeAStructButItsAListOfStructs" + }, + { + "details": { + "type": "string" + }, + "name": "shouldBeAStringButItsAListOfStructs" + }, + { + "details": { + "inner": { + "fields": { + "a": { + "type": "int" + }, + "b": { + "type": "string" + } + }, + "type": "struct" + }, + "type": "array" + }, + "name": "shouldBeAListOfStructsButItsAString" + } + ], + "version": "0.1.0" +}""", + struct + ) match + case Left(diff) => + val renderedDiff = diff.toString + + assertEquals(renderedDiff, expected) + case Right(()) => fail("should fail") + end match + + } + + private val expected: String = + val src = scala.io.Source.fromResource("expected-diff.txt") + try src.mkString + finally src.close() + +end ErrorsTest diff --git a/besom-cfg/k8s/src/test/scala/RunOutput.scala b/besom-cfg/k8s/src/test/scala/RunOutput.scala new file mode 100644 index 00000000..372de734 --- /dev/null +++ b/besom-cfg/k8s/src/test/scala/RunOutput.scala @@ -0,0 +1,13 @@ +package besom.internal + +import scala.concurrent.Future + +trait RunOutput[F[+_]]: + def run[A](output: Output[A]): Option[A] + +object RunOutput: + given runOutputForFuture(using RunResult[Future]): RunOutput[Future] = new RunOutput[Future]: + def run[A](output: Output[A]): Option[A] = RunResult.unsafeRunSync(output.getData)().getValue + + extension [F[+_], A](output: Output[A])(using ro: RunOutput[F]) def unsafeRunSync(): Option[A] = ro.run(output) + extension [F[+_], A](result: Result[A])(using rr: RunResult[F]) def unsafeRunSync(): A = rr.run(result) diff --git a/besom-cfg/k8s/src/test/scala/RunResult.scala b/besom-cfg/k8s/src/test/scala/RunResult.scala new file mode 100644 index 00000000..e2776687 --- /dev/null +++ b/besom-cfg/k8s/src/test/scala/RunResult.scala @@ -0,0 +1,21 @@ +package besom.internal + +import scala.concurrent._, duration._ + +trait RunResult[F[+_]]: + def run[A](result: Result[A]): A + +object RunResult: + given RunResult[Future] = new RunResult[Future]: + given ExecutionContext = ExecutionContext.fromExecutorService( + null, // FJP does seem to swallow fatals + (t: Throwable) => + // TODO this has to contain a link to github issue tracker to allow user to easily create a bug report, this is EXTREMELY IMPORTANT + scribe.error("Uncaught fatal error in Future Runtime", t) + t.printStackTrace() + sys.exit(1) + ) + given Runtime[Future] = FutureRuntime() + def run[A](result: Result[A]): A = Await.result(result.run, Duration.Inf) + + extension [F[+_], A](result: Result[A])(using rr: RunResult[F]) def unsafeRunSync(): A = rr.run(result) diff --git a/besom-cfg/k8s/src/test/scala/StructSerdeTest.scala b/besom-cfg/k8s/src/test/scala/StructSerdeTest.scala new file mode 100644 index 00000000..b4ab580a --- /dev/null +++ b/besom-cfg/k8s/src/test/scala/StructSerdeTest.scala @@ -0,0 +1,127 @@ +package besom.cfg + +import besom.cfg.k8s.* +import besom.cfg.* +import besom.internal.DummyContext +import besom.internal.RunOutput.* + +import besom.types.{Context, Output} +import besom.api.kubernetes.core.v1.inputs.EnvVarArgs + +class StructSerdeTest extends munit.FunSuite: + // ConfiguredContainerArgs( + // name = "my-app", + // image = "my-app:0.1", + // Struct( + // shouldBeIntAndItsOK = 1, + // shouldBeStringButItsNot = 23.0, + // shouldBeBoolButItsStruct = Struct( + // x = "y" + // ), + // thisOneIsUnnecessary = "not needed", + // shouldBeStructButItsNot = "it's a string", + // shouldBeListOfInts = List(1.23, 2, 3), // but it's a list of doubles + // oneFieldInsideIsWrongAndOneIsUnnecessary = Struct( + // x = 10, + // y = 10, + // z = 10 + // ), + // shouldBeListOfStructs = "but it isn't", + // shouldBeListOfStructsButItsAStruct = Struct( + // a = 1, + // b = 2 + // ), + // shouldBeAStructButItsAListOfStructs = List( + // Struct( + // one = "no" + // ) + // ), + // shouldBeAStringButItsAListOfStructs = List( + // Struct( + // one = 1 + // ) + // ), + // shouldBeAListOfStructsButItsAString = "oops", + // unnecessaryListOfStructs = List( + // Struct( + // a = 1, + // b = 2 + // ) + // ), + // unnecessaryStruct = Struct( + // one = "no", + // two = "not", + // three = "needed" + // ) + // ) + // ) + + given Context = DummyContext().unsafeRunSync() + + test("serialization of Structs to kubernetes EnvVarArgs") { + + // values can be: simple types, Output, Struct, List and their combinations without Lists of Lists + val s = Struct( + name = "test", // simple type + int = Output(23), // Output[simple] + s = Struct( // Struct + d = 23, + e = "test" + ), + l = List(1.2, 2.3, 3.4), // List[simple] + ls = List( // List[Struct] + Struct( + f1 = Output(List(Struct(deep = "q"))), // List[Struct->Output[List[Struct]]] + f2 = "w" + ) + ), + lo = List(Output("a"), Output("b"), Output("c")), // List[Output[simple]] + ol = Output(List("x", "y", "z")), // Output[List[simple]] + os = Output( // Output[Struct] + Struct( + oh = "yeah", + it = "works!" + ) + ) + ) + + val expected = List( + "name" -> "test", + "int" -> "23", + "s.d" -> "23", + "s.e" -> "test", + "l.0" -> "1.2", + "l.1" -> "2.3", + "l.2" -> "3.4", + "ls.0.f1.0.deep" -> "q", + "ls.0.f2" -> "w", + "lo.0" -> "a", + "lo.1" -> "b", + "lo.2" -> "c", + "ol.0" -> "x", + "ol.1" -> "y", + "ol.2" -> "z", + "os.oh" -> "yeah", + "os.it" -> "works!" + ) + + val asEnv = s.foldToEnv + + asEnv.unsafeRunSync().get.zip(expected).foreach((a, b) => assertEquals(a, b)) + + import besom.cfg.k8s.syntax.* + val asEnvVarArgs = s.foldedToEnvVarArgs + + asEnvVarArgs + .unsafeRunSync() + .get + .map { case EnvVarArgs(name, value, _) => + val k = name.unsafeRunSync().get + val v = value.unsafeRunSync().get.get + + k -> v + } + .zip(expected) + .foreach((a, b) => assertEquals(a, b)) + } +end StructSerdeTest diff --git a/besom-cfg/k8s/src/test/scala/TypeParserTest.scala b/besom-cfg/k8s/src/test/scala/TypeParserTest.scala new file mode 100644 index 00000000..8dea5c6e --- /dev/null +++ b/besom-cfg/k8s/src/test/scala/TypeParserTest.scala @@ -0,0 +1,239 @@ +package besom.cfg + +import fastparse._, MultiLineWhitespace._ + +class TypeParserTest extends munit.FunSuite: + + import Tpe.* + + test("should parse simple type") { + parse("a: Int", field(_)) match + case Parsed.Success(value, _) => assertEquals(value, ("a", Tpe.Simple("Int"))) + case f: Parsed.Failure => fail(f.trace().longMsg) + } + + test("should parse union of simple types") { + parse("Int | String", anyType(_)) match + case Parsed.Success(value, _) => assertEquals(value, Tpe.Union(List(Tpe.Simple("Int"), Tpe.Simple("String")))) + case f: Parsed.Failure => fail(f.trace().longMsg) + } + + test("should parse union of simple type and Output type") { + parse("Int | Output[Int]", anyType(_)) match + case Parsed.Success(value, _) => assertEquals(value, Tpe.Union(List(Tpe.Simple("Int"), Tpe.Output(Tpe.Simple("Int"))))) + case f: Parsed.Failure => fail(f.trace().longMsg) + } + + test("should parse list of simple type") { + parse("List[Int]", anyType(_)) match + case Parsed.Success(value, _) => assertEquals(value, Tpe.Lst(Tpe.Simple("Int"))) + case f: Parsed.Failure => fail(f.trace().longMsg) + } + + test("should parse an empty struct") { + parse("{}", structType(_)) match + case Parsed.Success(value, _) => assertEquals(value, Tpe.Struct(List.empty)) + case f: Parsed.Failure => fail(f.trace().longMsg) + } + + test("should parse a simple struct type") { + parse( + """{ + | a: Int + |}""".stripMargin, + structType(_) + ) match + case Parsed.Success(value, _) => + assertEquals(value, Tpe.Struct(List(("a", Tpe.Simple("Int"))))) + case f: Parsed.Failure => fail(f.trace().longMsg) + } + + test("should parse a struct type with union") { + parse( + """{ + | a: Int | String + |}""".stripMargin, + structType(_) + ) match + case Parsed.Success(value, _) => + assertEquals(value, Tpe.Struct(List(("a", Tpe.Union(List(Tpe.Simple("Int"), Tpe.Simple("String"))))))) + case f: Parsed.Failure => fail(f.trace().longMsg) + } + + test("should parse an output type of struct") { + parse( + """Output[{ + | a: Int + |}]""".stripMargin, + outputType(_) + ) match + case Parsed.Success(value, _) => + assertEquals(value, Tpe.Output(Tpe.Struct(List(("a", Tpe.Simple("Int")))))) + case f: Parsed.Failure => fail(f.trace().longMsg) + } + + test("should parse an union of simple type and output of simple type") { + parse( + """List[Int | Output[Int]] | List[Output[Int | Output[Int]]]""", + anyType(_) + ) match + case Parsed.Success(value, _) => + assertEquals( + value, + Tpe.Union( + List( + Tpe.Lst(Tpe.Union(List(Tpe.Simple("Int"), Tpe.Output(Tpe.Simple("Int"))))), + Tpe.Lst(Tpe.Output(Tpe.Union(List(Tpe.Simple("Int"), Tpe.Output(Tpe.Simple("Int")))))) + ) + ) + ) + case f: Parsed.Failure => fail(f.trace().longMsg) + } + + test("should parse an union of struct and output of struct") { + parse( + """shouldBeStructButItsNot: { + | a: Int | Output[Int] + | b: String | Output[String] + |} | Output[{ + | a: Int | Output[Int] + | b: String | Output[String] + |}]""".stripMargin, + field(_) + ) match + case Parsed.Success(value, _) => + assertEquals( + value, + ( + "shouldBeStructButItsNot", + Tpe.Union( + List( + Tpe.Struct( + List( + ("a", Tpe.Union(List(Tpe.Simple("Int"), Tpe.Output(Tpe.Simple("Int"))))), + ("b", Tpe.Union(List(Tpe.Simple("String"), Tpe.Output(Tpe.Simple("String"))))) + ) + ), + Tpe.Output( + Tpe.Struct( + List( + ("a", Tpe.Union(List(Tpe.Simple("Int"), Tpe.Output(Tpe.Simple("Int"))))), + ("b", Tpe.Union(List(Tpe.Simple("String"), Tpe.Output(Tpe.Simple("String"))))) + ) + ) + ) + ) + ) + ) + ) + case f: Parsed.Failure => fail(f.trace().longAggregateMsg) + } + + test("should parse simple field") { + parse("shouldBeIntAndItsOK: Int | Output[Int]", field(_)) match + case Parsed.Success(value, _) => + assertEquals(value, ("shouldBeIntAndItsOK", Tpe.Union(List(Tpe.Simple("Int"), Tpe.Output(Tpe.Simple("Int")))))) + case f: Parsed.Failure => fail(f.trace().longMsg) + } + + test("should parse union field") { + parse("shouldBeStringButItsNot: String | Output[String]", field(_)) match + case Parsed.Success(value, _) => + assertEquals(value, ("shouldBeStringButItsNot", Tpe.Union(List(Tpe.Simple("String"), Tpe.Output(Tpe.Simple("String")))))) + case f: Parsed.Failure => fail(f.trace().longMsg) + } + + test("should parse very complex unions") { + val union = """shouldBeListOfStructs: List[{ + a: Int | Output[Int] + b: String | Output[String] + } | Output[{ + a: Int | Output[Int] + b: String | Output[String] + }]] | List[Output[{ + a: Int | Output[Int] + b: String | Output[String] + } | Output[{ + a: Int | Output[Int] + b: String | Output[String] + }]]]""" + parse(union, field(_)) match + case Parsed.Success(value, _) => + assertEquals( + value, + ( + "shouldBeListOfStructs", + Tpe.Union( + List( + Tpe.Lst( + Tpe.Union( + List( + Tpe.Struct( + List( + ("a", Tpe.Union(List(Tpe.Simple("Int"), Tpe.Output(Tpe.Simple("Int"))))), + ("b", Tpe.Union(List(Tpe.Simple("String"), Tpe.Output(Tpe.Simple("String"))))) + ) + ), + Tpe.Output( + Tpe.Struct( + List( + ("a", Tpe.Union(List(Tpe.Simple("Int"), Tpe.Output(Tpe.Simple("Int"))))), + ("b", Tpe.Union(List(Tpe.Simple("String"), Tpe.Output(Tpe.Simple("String"))))) + ) + ) + ) + ) + ) + ), + Tpe.Lst( + Tpe.Output( + Tpe.Union( + List( + Tpe.Struct( + List( + ("a", Tpe.Union(List(Tpe.Simple("Int"), Tpe.Output(Tpe.Simple("Int"))))), + ("b", Tpe.Union(List(Tpe.Simple("String"), Tpe.Output(Tpe.Simple("String"))))) + ) + ), + Tpe.Output( + Tpe.Struct( + List( + ("a", Tpe.Union(List(Tpe.Simple("Int"), Tpe.Output(Tpe.Simple("Int"))))), + ("b", Tpe.Union(List(Tpe.Simple("String"), Tpe.Output(Tpe.Simple("String"))))) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + case f: Parsed.Failure => fail(f.trace().longMsg) + end match + } + + test("should strip outputs from types correctly") { + val union = """shouldBeListOfStructs: List[{ + a: Int | Output[Int] + b: String | Output[String] + } | Output[{ + a: Int | Output[Int] + b: String | Output[String] + }]] | List[Output[{ + a: Int | Output[Int] + b: String | Output[String] + } | Output[{ + a: Int | Output[Int] + b: String | Output[String] + }]]]""" + + parse(union, field(_)) match + case Parsed.Success((_, tpe), _) => + assertEquals(tpe.stripOutputs, Tpe.Lst(Tpe.Struct(List("a" -> Tpe.Simple("Int"), "b" -> Tpe.Simple("String"))))) + + case f: Parsed.Failure => fail(f.trace().longMsg) + } +end TypeParserTest diff --git a/besom-cfg/lib/.scalafmt.conf b/besom-cfg/lib/.scalafmt.conf new file mode 100644 index 00000000..f4d4b655 --- /dev/null +++ b/besom-cfg/lib/.scalafmt.conf @@ -0,0 +1,11 @@ +version = 3.5.2 +runner.dialect = scala3 +project.git = true +align = most +align.openParenCallSite = false +align.openParenDefnSite = false +align.tokens = [{code = "=>", owner = "Case"}, "<-", "%", "%%", "="] +indent.defnSite = 2 +maxColumn = 140 + +rewrite.scala3.insertEndMarkerMinLines = 40 \ No newline at end of file diff --git a/besom-cfg/lib/project.scala b/besom-cfg/lib/project.scala new file mode 100644 index 00000000..88f7f3be --- /dev/null +++ b/besom-cfg/lib/project.scala @@ -0,0 +1,19 @@ +//> using scala 3.3.3 + +//> using dep org.virtuslab::besom-core:0.3.2 +//> using dep org.virtuslab::besom-json:0.3.2 +//> using dep io.github.classgraph:classgraph:4.8.172 + +//> using test.dep org.scalameta::munit::1.0.0-M11 + +//> using publish.name "besom-cfg" +//> using publish.organization "org.virtuslab" +//> using publish.url "https://github.com/VirtusLab/besom" +//> using publish.vcs "github:VirtusLab/besom" +//> using publish.license "Apache-2.0" +//> using publish.repository "central" +//> using publish.developer "lbialy|Łukasz Biały|https://github.com/lbialy" +//> using publish.developer "prolativ|Michał Pałka|https://github.com/prolativ" +//> using publish.developer "KacperFKorban|Kacper Korban|https://github.com/KacperFKorban" +//> using publish.developer "pawelprazak|Paweł Prażak|https://github.com/pawelprazak" +//> using repository sonatype:snapshots \ No newline at end of file diff --git a/besom-cfg/lib/src/main/scala/Configured.scala b/besom-cfg/lib/src/main/scala/Configured.scala new file mode 100644 index 00000000..196662e2 --- /dev/null +++ b/besom-cfg/lib/src/main/scala/Configured.scala @@ -0,0 +1,100 @@ +package besom.cfg + +import scala.quoted.* +import besom.json.* +import besom.cfg.internal.* + +// trait Constraint[A]: +// def validate(a: A): Boolean +// def &(other: Constraint[A]): Constraint[A] = +// (a: A) => validate(a) && other.validate(a) +// def |(other: Constraint[A]): Constraint[A] = +// (a: A) => validate(a) || other.validate(a) + +// object Positive extends Constraint[Int]: +// def validate(a: Int): Boolean = a > 0 + +// object Negative extends Constraint[Int]: +// def validate(a: Int): Boolean = a < 0 + +// object NonZero extends Constraint[Int]: +// def validate(a: Int): Boolean = a != 0 + +// object NonEmpty extends Constraint[String]: +// def validate(a: String): Boolean = a.nonEmpty + +// object NonBlank extends Constraint[String]: +// def validate(a: String): Boolean = a.trim.nonEmpty + +// trait FromEnv[A]: +// def fromEnv(parentKey: String, selected: Map[String, String]): A + +// object StringFromEnv extends FromEnv[String]: +// def fromEnv(parentKey: String, selected: Map[String, String]): String = +// selected.getOrElse(parentKey, throw new Exception(s"Key $parentKey not found in env")) + +// given ListFromEnv[A](using FromEnv[A]): FromEnv[List[A]] with +// def fromEnv(parentKey: String, selected: Map[String, String]): List[A] = +// val prefix = s"$parentKey." +// val subselected = selected.filter(_._1.startsWith(prefix)) +// subselected.keys +// .map { k => +// val index = k.stripPrefix(prefix) +// val value = summon[FromEnv[A]].fromEnv(k, selected) +// index.toInt -> value +// } +// .toList +// .sortBy(_._1) +// .map(_._2) + +trait Configured[A]: + def schema: Schema + def newInstanceFromEnv(env: Map[String, String] = sys.env): A + +object Configured: + val Version = "0.1.0" + + inline def derived[A <: Product]: Configured[A] = ${ derivedImpl[A] } + + def derivedImpl[A <: Product: Type](using ctx: Quotes): Expr[Configured[A]] = + import ctx.reflect.* + + val tpe = TypeRepr.of[A] + val fields = tpe.typeSymbol.caseFields.map { case sym => + val name = Expr(sym.name) + val ftpe: Expr[ConfiguredType[_]] = + tpe.memberType(sym).dealias.asType match + case '[t] => + Expr.summon[ConfiguredType[t]].getOrElse { + report.error( + s"Cannot find ConfiguredType for type ${tpe.memberType(sym).dealias.show}" + ) + throw new Exception("Cannot find ConfiguredType") + } + case _ => + report.error("Unsupported type") + throw new Exception("Unsupported type") + + '{ Field(${ name }, ${ ftpe }.toFieldType) } + } + + val fromEnvExpr = Expr.summon[FromEnv[A]].getOrElse { + report.error(s"Cannot find FromEnv for type ${tpe.show}") + throw new Exception("Cannot find FromEnv") + } + + val schemaExpr = '{ Schema(${ Expr.ofList(fields) }.toList, ${ Expr(Version) }) } + + '{ + new Configured[A] { + def schema = $schemaExpr + def newInstanceFromEnv(env: Map[String, String] = sys.env): A = + $fromEnvExpr.decode(env, "").getOrElse { + throw new Exception("Failed to decode") + } + } + } +end Configured + +def resolveConfiguration[A](using c: Configured[A]): A = + c.newInstanceFromEnv() diff --git a/besom-cfg/lib/src/main/scala/FromEnv.scala b/besom-cfg/lib/src/main/scala/FromEnv.scala new file mode 100644 index 00000000..b43a87d4 --- /dev/null +++ b/besom-cfg/lib/src/main/scala/FromEnv.scala @@ -0,0 +1,87 @@ +package besom.cfg + +// TODO do not use Option[T], use something with a proper error channel and missing value channel +// TODO rationale: if a value is provided but it's not valid (e.g. empty string for an Int), we want to know +// TODO if a value is missing, but the type is optional in configuration, that's fine +trait FromEnv[A]: + def decode(env: Map[String, String], path: String): Option[A] + +object FromEnv: + + import scala.deriving.* + import scala.compiletime.{erasedValue, summonInline} + + inline def summonAllInstances[T <: Tuple]: List[FromEnv[?]] = + inline erasedValue[T] match + case _: (t *: ts) => summonInline[FromEnv[t]] :: summonAllInstances[ts] + case _: EmptyTuple => Nil + + inline def summonLabels[T <: Tuple]: List[String] = + inline erasedValue[T] match + case _: EmptyTuple => Nil + case _: (t *: ts) => + summonInline[ValueOf[t]].value.asInstanceOf[String] :: summonLabels[ts] + + given [A: FromEnv]: FromEnv[Option[A]] with + def decode(env: Map[String, String], path: String): Option[Option[A]] = + Some(summon[FromEnv[A]].decode(env, path)) + + given FromEnv[Int] with + def decode(env: Map[String, String], path: String): Option[Int] = + env.get(path).flatMap(s => scala.util.Try(s.toInt).toOption) + + given FromEnv[Long] with + def decode(env: Map[String, String], path: String): Option[Long] = + env.get(path).flatMap(s => scala.util.Try(s.toLong).toOption) + + given FromEnv[String] with + def decode(env: Map[String, String], path: String): Option[String] = + env.get(path) + + given FromEnv[Double] with + def decode(env: Map[String, String], path: String): Option[Double] = + env.get(path).flatMap(s => scala.util.Try(s.toDouble).toOption) + + given FromEnv[Float] with + def decode(env: Map[String, String], path: String): Option[Float] = + env.get(path).flatMap(s => scala.util.Try(s.toFloat).toOption) + + given FromEnv[Boolean] with + def decode(env: Map[String, String], path: String): Option[Boolean] = + env.get(path).flatMap(s => scala.util.Try(s.toBoolean).toOption) + + given [A: FromEnv]: FromEnv[List[A]] with + def decode(env: Map[String, String], path: String): Option[List[A]] = + Iterator.from(0).map(i => summon[FromEnv[A]].decode(env, s"$path.$i")).takeWhile(_.isDefined).toList.sequence + + given [A: FromEnv]: FromEnv[Vector[A]] with + def decode(env: Map[String, String], path: String): Option[Vector[A]] = + Iterator.from(0).map(i => summon[FromEnv[A]].decode(env, s"$path.$i")).takeWhile(_.isDefined).toVector.sequence + + inline given derived[A](using m: Mirror.ProductOf[A]): FromEnv[A] = new FromEnv[A]: + def decode(env: Map[String, String], path: String): Option[A] = + val elemDecoders = summonAllInstances[m.MirroredElemTypes] + val labels = summonLabels[m.MirroredElemLabels] + + val elemValues = elemDecoders.zip(labels).map { case (decoder, label) => + // handle top-level gracefully (empty path) + decoder.asInstanceOf[FromEnv[Any]].decode(env, if path.isBlank() then label else s"$path.$label") + } + + if elemValues.forall(_.isDefined) then Some(m.fromProduct(Tuple.fromArray(elemValues.flatten.toArray))) + else None + + // Helper to sequence a List[Option[A]] into Option[List[A]] + extension [A](xs: List[Option[A]]) + def sequence: Option[List[A]] = xs.foldRight(Option(List.empty[A])) { + case (Some(a), Some(acc)) => Some(a :: acc) + case _ => None + } + + // Helper to sequence a Vector[Option[A]] into Option[Vector[A]] + extension [A](xs: Vector[Option[A]]) + def sequence: Option[Vector[A]] = xs.foldLeft(Option(Vector.empty[A])) { + case (Some(acc), Some(a)) => Some(acc :+ a) + case _ => None + } +end FromEnv diff --git a/besom-cfg/lib/src/main/scala/Struct.scala b/besom-cfg/lib/src/main/scala/Struct.scala new file mode 100644 index 00000000..0a24cb5e --- /dev/null +++ b/besom-cfg/lib/src/main/scala/Struct.scala @@ -0,0 +1,119 @@ +package besom.cfg + +import scala.language.dynamics +import scala.quoted.* +import scala.collection.immutable.ListMap +import besom.cfg.internal.MetaUtils +import besom.types.{Output, Context} +import scala.util.chaining.* + +// possible types under `Any`: +// simple types: Int, Long, Float, Double, String, Boolean +// complex types: List[A], Struct +// any of the above can be wrapped in Output +class Struct private (val _values: ListMap[String, Any]) extends Selectable: + def selectDynamic(name: String) = _values(name) + + private[cfg] def fold[B]( + onStruct: Map[String, Output[B]] => Output[B], + onList: List[B] => Output[B], + onValue: Any => Output[B] + )(using Context): Output[B] = + val onOutput: Output[_] => Output[B] = _.flatMap { + case s: Struct => s.fold(onStruct, onList, onValue) + case a => onValue(a) + } + + val transformList: List[_] => Output[B] = l => { // v may be simple | Struct | Output, we don't support nested lists + val outputOfVec = l.foldLeft(Output(Vector.empty[B])) { case (acc, v) => + acc.flatMap { accVec => + val transformedV = v match + case s: Struct => s.fold(onStruct, onList, onValue) + case o: Output[_] => onOutput(o) + case a => onValue(a) + + transformedV.map(accVec :+ _) + } + } + + outputOfVec.map(_.toList).flatMap(onList) + } + + _values.view + .mapValues { + case s: Struct => s.fold[B](onStruct, onList, onValue) + case i: List[_] => transformList(i) + case o: Output[_] => // handle String -> Output[simple | Struct | List] + o.flatMap { + case s: Struct => s.fold[B](onStruct, onList, onValue) + case l: List[_] => transformList(l) + case a => onValue(a) + } + case a => onValue(a) + } + .to(ListMap) + .pipe(onStruct) + end fold +end Struct + +object Struct extends Dynamic: + def make(values: ListMap[String, Any]) = new Struct(values) + + inline def applyDynamic(apply: "apply")(): Struct = make(ListMap.empty) + + transparent inline def applyDynamicNamed(apply: "apply")(inline args: (String, Any)*): Struct = + ${ applyDynamicImpl('args) } + + def applyDynamicImpl(args: Expr[Seq[(String, Any)]])(using Quotes): Expr[Struct] = + import quotes.reflect.* + + type StructSubtype[T <: Struct] = T + + args match + case Varargs(argExprs) => + val refinementTypes = argExprs.toList.map { case '{ ($key: String, $value: v) } => + (key.valueOrAbort, TypeRepr.of[v]) + } + val exprs = argExprs.map { case '{ ($key: String, $value: v) } => + '{ ($key, $value) } + } + val argsExpr = Expr.ofSeq(exprs) + + MetaUtils.refineType(TypeRepr.of[Struct], refinementTypes).asType match + case '[StructSubtype[t]] => + '{ Struct.make(${ argsExpr }.to(ListMap)).asInstanceOf[t] } + + case _ => + report.errorAndAbort( + "Expected explicit varargs sequence. " + + "Notation `args*` is not supported.", + args + ) + + extension (s: Struct) + def foldToEnv(using Context): Output[List[(String, String)]] = s.fold[List[(String, String)]]( + onStruct = { mapB => + mapB.foldLeft(Output(List.empty[(String, String)])) { case (acc, (k, v)) => + acc.flatMap { accList => + v.map { vList => + accList ++ vList.map { case (k2, v2) => + // println(s"struct, serializing '$k' '$k2' to ${if k2.isBlank() then s"$k -> $v2" else s"$k.$k2 -> $v2"}") + if k2.isBlank then k -> v2 else s"$k.$k2" -> v2 + } + } + } + } + }, + onList = { list => + Output(list.zipWithIndex.flatMap { (lst, idx) => + lst.map { case (k, v) => + // println(s"list: serializing $k, $v to $k$idx -> $v") + if k.isBlank() then s"$k$idx" -> v else s"$idx.$k" -> v + } + }) + }, + onValue = a => + // println(s"serializing $a to List(\"\" -> $a)") + Output(List("" -> a.toString)) + ) +end Struct diff --git a/besom-cfg/lib/src/main/scala/SummonConfiguration.scala b/besom-cfg/lib/src/main/scala/SummonConfiguration.scala new file mode 100644 index 00000000..c4474d11 --- /dev/null +++ b/besom-cfg/lib/src/main/scala/SummonConfiguration.scala @@ -0,0 +1,78 @@ +package besom.cfg + +import io.github.classgraph.ClassGraph +import scala.util.Using +import scala.jdk.CollectionConverters.* +import besom.json.JsonWriter +import besom.cfg.internal.* + +object SummonConfiguration: + + private val toSkip = Set( + "org.scala-lang", + "io.github.classgraph", + "org.virtuslab.besom-cfg", // self + "org.virtuslab.besom-json" + ) + + def main(args: Array[String]): Unit = + def classPath = new ClassGraph() + .filterClasspathElements(path => toSkip.forall(segment => !path.contains(segment))) + .enableClassInfo() + .scan() + + Using(classPath) { scanResult => + val classes = scanResult + .getClassesImplementing(classOf[Configured[_]]) + .loadClasses() + .asScala + .toSet + + if classes.size > 1 then + throw Exception( + "Multiple Configured instances found! Only one per application is allowed." + ) + + if classes.isEmpty then + throw Exception( + "No Configured instances found! Exactly one is required." + ) + + val clazz = classes.head + + val maybeNoArgConst = clazz + .getDeclaredConstructors() + .filter(_.getParameterCount() == 0) + .headOption + + val maybeSingleArgConst = clazz + .getDeclaredConstructors() + .filter(_.getParameterCount() == 1) + .headOption + + val instance = maybeNoArgConst + .map(_.newInstance().asInstanceOf[Configured[_]]) + .getOrElse { + // this works with the assumption that user used `derives` to create the instance + // and therefore the class is placed in the companion object + maybeSingleArgConst + .map { ctor => + val moduleClass = ctor.getParameterTypes().head + val moduleField = + moduleClass.getDeclaredFields().find(_.getName == "MODULE$").get + + val outer = moduleField.get(null) + + ctor.newInstance(outer).asInstanceOf[Configured[_]] + } + .getOrElse { + throw Exception( + "No compatible constructor found for Configured instance!" + ) + } + } + + println(summon[JsonWriter[Schema]].write(instance.schema)) + }.get + end main +end SummonConfiguration diff --git a/besom-cfg/lib/src/main/scala/internal/ConfiguredType.scala b/besom-cfg/lib/src/main/scala/internal/ConfiguredType.scala new file mode 100644 index 00000000..b410d6bb --- /dev/null +++ b/besom-cfg/lib/src/main/scala/internal/ConfiguredType.scala @@ -0,0 +1,55 @@ +package besom.cfg.internal + +import scala.deriving.* +import scala.compiletime.* + +trait ConfiguredType[A]: + def toFieldType: FieldType + +object ConfiguredType: + inline def summonLabels[T <: Tuple]: List[String] = + inline erasedValue[T] match + case _: EmptyTuple => Nil + case _: (t *: ts) => + summonInline[ValueOf[t]].value.asInstanceOf[String] :: summonLabels[ts] + + inline def summonAllInstances[A <: Tuple]: List[ConfiguredType[_]] = + inline erasedValue[A] match + case _: EmptyTuple => Nil + case _: (t *: ts) => summonInline[ConfiguredType[t]] :: summonAllInstances[ts] + + given ConfiguredType[Int] with + def toFieldType = FieldType.Int + + given ConfiguredType[Long] with + def toFieldType = FieldType.Long + + given ConfiguredType[Float] with + def toFieldType = FieldType.Float + + given ConfiguredType[Double] with + def toFieldType = FieldType.Double + + given ConfiguredType[String] with + def toFieldType = FieldType.String + + given ConfiguredType[Boolean] with + def toFieldType = FieldType.Boolean + + given [A: ConfiguredType]: ConfiguredType[List[A]] with + def toFieldType = FieldType.Array(summon[ConfiguredType[A]].toFieldType) + + // support for Option is not yet implemented completely + // given [A: ConfiguredType]: ConfiguredType[Option[A]] with + // def toFieldType = FieldType.Optional(summon[ConfiguredType[A]].toFieldType) + + def buildConfiguredTypeFor[A](instances: => List[ConfiguredType[_]], labels: => List[String]): ConfiguredType[A] = + new ConfiguredType[A]: + def toFieldType = FieldType.Struct(labels.zip(instances.map(_.toFieldType)): _*) + + inline given derived[A <: Product](using m: Mirror.ProductOf[A]): ConfiguredType[A] = + lazy val elemInstances = summonAllInstances[m.MirroredElemTypes] + lazy val elemLabels = summonLabels[m.MirroredElemLabels] + buildConfiguredTypeFor[A](elemInstances, elemLabels) + +end ConfiguredType diff --git a/besom-cfg/lib/src/main/scala/internal/MetaUtils.scala b/besom-cfg/lib/src/main/scala/internal/MetaUtils.scala new file mode 100644 index 00000000..63fe7169 --- /dev/null +++ b/besom-cfg/lib/src/main/scala/internal/MetaUtils.scala @@ -0,0 +1,14 @@ +package besom.cfg.internal + +import scala.quoted.* + +object MetaUtils: + def refineType(using + Quotes + )(base: quotes.reflect.TypeRepr, refinements: List[(String, quotes.reflect.TypeRepr)]): quotes.reflect.TypeRepr = + import quotes.reflect.* + refinements match + case Nil => base + case (name, info) :: refinementsTail => + val newBase = Refinement(base, name, info) + refineType(newBase, refinementsTail) diff --git a/besom-cfg/lib/src/main/scala/internal/Schema.scala b/besom-cfg/lib/src/main/scala/internal/Schema.scala new file mode 100644 index 00000000..1256e34d --- /dev/null +++ b/besom-cfg/lib/src/main/scala/internal/Schema.scala @@ -0,0 +1,149 @@ +package besom.cfg.internal + +import scala.quoted.* +import besom.json.* + +enum FieldType: + case Int, Long, Float, Double, String, Boolean + case Array(inner: FieldType) + case Struct(fields: (String, FieldType)*) + case Optional(inner: FieldType) + +object FieldType: + given ToExpr[FieldType] with + def apply(fieldType: FieldType)(using Quotes): Expr[FieldType] = + import quotes.reflect.* + fieldType match + case FieldType.Int => '{ FieldType.Int } + case FieldType.Long => '{ FieldType.Long } + case FieldType.Float => '{ FieldType.Float } + case FieldType.Double => '{ FieldType.Double } + case FieldType.String => '{ FieldType.String } + case FieldType.Boolean => '{ FieldType.Boolean } + case FieldType.Array(inner) => '{ FieldType.Array(${ Expr(inner) }) } + case FieldType.Struct(fields: _*) => '{ FieldType.Struct(${ Expr(fields) }: _*) } + case FieldType.Optional(inner) => '{ FieldType.Optional(${ Expr(inner) }) } + + given FromExpr[FieldType] with + def unapply(expr: Expr[FieldType])(using Quotes): Option[FieldType] = + import quotes.reflect.* + expr match + case '{ FieldType.Int } => Some(FieldType.Int) + case '{ FieldType.Long } => Some(FieldType.Long) + case '{ FieldType.Float } => Some(FieldType.Float) + case '{ FieldType.Double } => Some(FieldType.Double) + case '{ FieldType.String } => Some(FieldType.String) + case '{ FieldType.Boolean } => Some(FieldType.Boolean) + case '{ FieldType.Array($inner) } => Some(FieldType.Array(inner.valueOrAbort)) + case '{ FieldType.Struct($fields: _*) } => Some(FieldType.Struct(fields.valueOrAbort: _*)) + case '{ FieldType.Optional($inner) } => Some(FieldType.Optional(inner.valueOrAbort)) + case _ => println("didn't match in FieldType"); None + + given JsonFormat[FieldType] with + def write(fieldType: FieldType): JsValue = fieldType match + case FieldType.Int => JsObject("type" -> JsString("int")) + case FieldType.Long => JsObject("type" -> JsString("long")) + case FieldType.Float => JsObject("type" -> JsString("float")) + case FieldType.Double => JsObject("type" -> JsString("double")) + case FieldType.String => JsObject("type" -> JsString("string")) + case FieldType.Boolean => JsObject("type" -> JsString("boolean")) + case FieldType.Array(inner) => JsObject("type" -> JsString("array"), "inner" -> write(inner)) + case FieldType.Struct(fields: _*) => + JsObject( + "type" -> JsString("struct"), + "fields" -> JsObject(fields.map { case (k, v) => k -> write(v) }.toMap) + ) + case FieldType.Optional(inner) => JsObject("type" -> JsString("optional"), "inner" -> write(inner)) + + def read(json: JsValue): FieldType = json match + case JsObject(fields) => + fields.get("type") match + case Some(JsString("int")) => FieldType.Int + case Some(JsString("long")) => FieldType.Long + case Some(JsString("float")) => FieldType.Float + case Some(JsString("double")) => FieldType.Double + case Some(JsString("string")) => FieldType.String + case Some(JsString("boolean")) => FieldType.Boolean + case Some(JsString("array")) => + fields.get("inner") match + case Some(inner) => FieldType.Array(read(inner)) + case _ => throw new Exception("Invalid JSON: array.inner must be present") + case Some(JsString("struct")) => + fields.get("fields") match + case Some(JsObject(innerFields)) => + val structFields = innerFields.map { case (k, v) => k -> read(v) } + FieldType.Struct(structFields.toVector: _*) + case None => throw new Exception("Invalid JSON: struct.fields must be present") + case _ => throw new Exception("Invalid JSON: struct.fields must be an object") + case Some(JsString("optional")) => + fields.get("inner") match + case Some(inner) => FieldType.Optional(read(inner)) + case _ => throw new Exception("Invalid JSON: optional.inner must be present") + case Some(what) => + throw new Exception(s"Invalid JSON: unknown type $what") + case None => throw new Exception("Invalid JSON: type must present") + case _ => throw new Exception("Invalid JSON: expected object") + end given +end FieldType + +case class Field(name: String, `type`: FieldType) +object Field: + given ToExpr[Field] with + def apply(field: Field)(using Quotes): Expr[Field] = + import quotes.reflect.* + '{ Field(${ Expr(field.name) }, ${ Expr(field.`type`) }) } + + given FromExpr[Field] with + def unapply(expr: Expr[Field])(using Quotes): Option[Field] = + import quotes.reflect.* + expr match + case '{ Field($name, $fieldType) } => Some(Field(name.valueOrAbort, fieldType.valueOrAbort)) + case _ => println("didn't match in Field"); None + + given fieldGiven(using fieldTypeWriter: JsonFormat[FieldType]): JsonFormat[Field] with + def write(field: Field): JsValue = + JsObject("name" -> JsString(field.name), "details" -> fieldTypeWriter.write(field.`type`)) + def read(json: JsValue): Field = + json match + case JsObject(fields) => + val name = fields.get("name") match + case Some(JsString(name)) => name + case _ => throw new Exception("Invalid JSON: field.name must be present") + val details = fields.get("details") match + case Some(details) => fieldTypeWriter.read(details) + case _ => throw new Exception("Invalid JSON: field.details must be present") + Field(name, details) + case _ => throw new Exception("Invalid JSON: expected object") + +case class Schema(fields: List[Field], version: String) +object Schema: + given ToExpr[Schema] with + def apply(schema: Schema)(using Quotes): Expr[Schema] = + import quotes.reflect.* + '{ Schema(${ Expr(schema.fields) }, ${ Expr(schema.version) }) } + + given FromExpr[Schema] with + def unapply(expr: Expr[Schema])(using Quotes): Option[Schema] = + import quotes.reflect.* + expr match + case '{ Schema($fields, $version) } => Some(Schema(fields.valueOrAbort, version.valueOrAbort)) + case _ => println("didn't match in Schema"); None + + given schemaGiven(using fieldWriter: JsonFormat[Field]): JsonFormat[Schema] with + def write(schema: Schema): JsValue = + JsObject( + "version" -> JsString(schema.version), + "schema" -> JsArray(schema.fields.map(field => fieldWriter.write(field)): _*) + ) + + def read(json: JsValue): Schema = + json match + case JsObject(fields) => + val version = fields.get("version") match + case Some(JsString(version)) => version + case _ => throw new Exception("Invalid JSON: schema.version must be present") + val schema = fields.get("schema") match + case Some(JsArray(fields)) => fields.map(fieldWriter.read).toList + case _ => throw new Exception("Invalid JSON: schema.schema must be present") + Schema(schema, version) + case _ => throw new Exception("Invalid JSON: expected object") diff --git a/besom-cfg/lib/src/test/scala/ConfiguredTest.scala b/besom-cfg/lib/src/test/scala/ConfiguredTest.scala new file mode 100644 index 00000000..d39b084f --- /dev/null +++ b/besom-cfg/lib/src/test/scala/ConfiguredTest.scala @@ -0,0 +1,83 @@ +package besom.cfg + +case class Test1(los: List[String]) derives Configured + +case class Test2(name: String, int: Int, struct: First, list: List[Double]) derives Configured +case class First(d: Int, e: String) + +case class Test3( + name: String, + int: Int, + s: First, + l: List[Double], + ls: List[Second], + lo: List[String], + ol: List[String], + os: Third +) derives Configured +case class Second(f1: List[Fourth], f2: String) +case class Third(oh: String, it: String) +case class Fourth(deep: String) + +class ConfiguredTest extends munit.FunSuite: + + test("very simple case class") { + val env = Map("los.0" -> "test", "los.1" -> "test2") + + summon[Configured[Test1]].newInstanceFromEnv(env) match + case Test1(los) => + assertEquals(los, List("test", "test2")) + } + + test("can read a simple case class from environment variables") { + val env = Map( + "name" -> "test", + "int" -> "23", + "struct.d" -> "23", + "struct.e" -> "test", + "list.0" -> "1.2", + "list.1" -> "2.3", + "list.2" -> "3.4" + ) + + summon[Configured[Test2]].newInstanceFromEnv(env) match + case Test2(name, int, s, l) => + assertEquals(name, "test") + assertEquals(int, 23) + assertEquals(s, First(23, "test")) + assertEquals(l, List(1.2, 2.3, 3.4)) + } + + test("can read a complex case class from environment variables") { + val env = Map( + "name" -> "test", + "int" -> "23", + "s.d" -> "23", + "s.e" -> "test", + "l.0" -> "1.2", + "l.1" -> "2.3", + "l.2" -> "3.4", + "ls.0.f1.0.deep" -> "q", + "ls.0.f2" -> "w", + "lo.0" -> "a", + "lo.1" -> "b", + "lo.2" -> "c", + "ol.0" -> "x", + "ol.1" -> "y", + "ol.2" -> "z", + "os.oh" -> "yeah", + "os.it" -> "works!" + ) + + summon[Configured[Test3]].newInstanceFromEnv(env) match + case Test3(name, int, s, l, ls, lo, ol, os) => + assertEquals(name, "test") + assertEquals(int, 23) + assertEquals(s, First(23, "test")) + assertEquals(l, List(1.2, 2.3, 3.4)) + assertEquals(ls, List(Second(List(Fourth("q")), "w"))) + assertEquals(lo, List("a", "b", "c")) + assertEquals(ol, List("x", "y", "z")) + assertEquals(os, Third("yeah", "works!")) + } +end ConfiguredTest diff --git a/besom-cfg/version.txt b/besom-cfg/version.txt new file mode 100644 index 00000000..9b17816c --- /dev/null +++ b/besom-cfg/version.txt @@ -0,0 +1 @@ +0.2.0-SNAPSHOT \ No newline at end of file diff --git a/besom-json/src/main/scala/besom/json/JsonFormat.scala b/besom-json/src/main/scala/besom/json/JsonFormat.scala index f64a5fca..83777690 100644 --- a/besom-json/src/main/scala/besom/json/JsonFormat.scala +++ b/besom-json/src/main/scala/besom/json/JsonFormat.scala @@ -19,6 +19,7 @@ package besom.json import scala.annotation.implicitNotFound import scala.language.implicitConversions +import scala.util.Try /** Provides the JSON deserialization for type T. */ @@ -40,6 +41,13 @@ object JsonReader { @implicitNotFound(msg = "Cannot find JsonWriter or JsonFormat type class for ${T}") trait JsonWriter[T] { def write(obj: T): JsValue + def either(obj: T): Either[Exception, JsValue] = + Try { + write(obj) + }.toEither.left.map { + case e: SerializationException => e + case t: Throwable => DeserializationException(t.getMessage, t) + } } object JsonWriter { diff --git a/besom-json/src/main/scala/besom/json/package.scala b/besom-json/src/main/scala/besom/json/package.scala index 8c81f660..8b3bd166 100644 --- a/besom-json/src/main/scala/besom/json/package.scala +++ b/besom-json/src/main/scala/besom/json/package.scala @@ -16,6 +16,8 @@ package besom.json +import scala.util.Try + import scala.language.implicitConversions def deserializationError(msg: String, cause: Throwable = null, fieldNames: List[String] = Nil) = @@ -28,10 +30,17 @@ case class DeserializationException(msg: String, cause: Throwable = null, fieldN class SerializationException(msg: String) extends RuntimeException(msg) private[json] class RichAny[T](any: T) { - def toJson(implicit writer: JsonWriter[T]): JsValue = writer.write(any) + def toJson(implicit writer: JsonWriter[T]): JsValue = writer.write(any) + def asJson(implicit writer: JsonWriter[T]): Either[Exception, JsValue] = writer.either(any) } private[json] class RichString(string: String) { + def parseJson[T: JsonReader]: Either[Exception, T] = Try { + JsonParser(string).convertTo[T] + }.toEither.left.map { + case e: DeserializationException => e + case e => DeserializationException(e.getMessage, e) + } def parseJson: JsValue = JsonParser(string) def parseJson(settings: JsonParserSettings): JsValue = JsonParser(string, settings) } diff --git a/besom-zio/project.scala b/besom-zio/project.scala index 09a763fd..bc388d69 100644 --- a/besom-zio/project.scala +++ b/besom-zio/project.scala @@ -2,7 +2,7 @@ //> using options "-java-output-version:11", "-Ykind-projector:underscores" //> using options "-deprecation", "-feature" -//> using dep "org.virtuslab::besom-core:0.3.1" +//> using dep "org.virtuslab::besom-core:0.3.2" //> using dep "dev.zio::zio:2.0.17" //> using test.dep "org.scalameta::munit:1.0.0-M10" diff --git a/codegen/src/CodeGen.test.scala b/codegen/src/CodeGen.test.scala index ce6e3b7e..4f98b97d 100644 --- a/codegen/src/CodeGen.test.scala +++ b/codegen/src/CodeGen.test.scala @@ -847,6 +847,93 @@ class CodeGenTest extends munit.FunSuite { tags = Set( munit.Ignore ) // FIXME: un-ignore when this is fixed: https://github.com/pulumi/pulumi-kubernetes/issues/2683 + ), + Data( + name = "Error on urn property", + json = """|{ + | "name": "mangled-provider", + | "version": "0.0.1", + | "resources": { + | "mangled-provider:index:mangled": { + | "properties": { + | "asString": { + | "type": "string" + | }, + | "toString": { + | "type": "string" + | }, + | "scala": { + | "type": "string" + | } + | }, + | "type": "object" + | } + | } + |} + |""".stripMargin, + ignored = List( + "src/index/Provider.scala", + "src/index/ProviderArgs.scala", + "src/index/MangledArgs.scala" + ), + expected = Map( + "src/index/Mangled.scala" -> + """|package besom.api.mangledprovider + | + |final case class Mangled private( + | urn: besom.types.Output[besom.types.URN], + | id: besom.types.Output[besom.types.ResourceId], + | asString_ : besom.types.Output[scala.Option[String]], + | scala_ : besom.types.Output[scala.Option[String]], + | toString_ : besom.types.Output[scala.Option[String]] + |) extends besom.CustomResource + | + |object Mangled extends besom.ResourceCompanion[Mangled]: + | /** Resource constructor for Mangled. + | * + | * @param name [[besom.util.NonEmptyString]] The unique (stack-wise) name of the resource in Pulumi state (not on provider's side). + | * NonEmptyString is inferred automatically from non-empty string literals, even when interpolated. If you encounter any + | * issues with this, please try using `: NonEmptyString` type annotation. If you need to convert a dynamically generated + | * string to NonEmptyString, use `NonEmptyString.apply` method - `NonEmptyString(str): Option[NonEmptyString]`. + | * + | * @param args [[MangledArgs]] The configuration to use to create this resource. This resource has a default configuration. + | * + | * @param opts [[besom.CustomResourceOptions]] Resource options to use for this resource. + | * Defaults to empty options. If you need to set some options, use [[besom.opts]] function to create them, for example: + | * + | * {{{ + | * val res = Mangled( + | * "my-resource", + | * MangledArgs(...), // your args + | * opts(provider = myProvider) + | * ) + | * }}} + | */ + | def apply(using ctx: besom.types.Context)( + | name: besom.util.NonEmptyString, + | args: MangledArgs = MangledArgs(), + | opts: besom.ResourceOptsVariant.Custom ?=> besom.CustomResourceOptions = besom.CustomResourceOptions() + | ): besom.types.Output[Mangled] = + | ctx.readOrRegisterResource[Mangled, MangledArgs]("mangled-provider:index:mangled", name, args, opts(using besom.ResourceOptsVariant.Custom)) + | + | private[besom] def typeToken: besom.types.ResourceType = "mangled-provider:index:mangled" + | + | given resourceDecoder(using besom.types.Context): besom.types.ResourceDecoder[Mangled] = + | besom.internal.ResourceDecoder.derived[Mangled] + | + | given decoder(using besom.types.Context): besom.types.Decoder[Mangled] = + | besom.internal.Decoder.customResourceDecoder[Mangled] + | + | + | given outputOps: {} with + | extension(output: besom.types.Output[Mangled]) + | def urn : besom.types.Output[besom.types.URN] = output.flatMap(_.urn) + | def id : besom.types.Output[besom.types.ResourceId] = output.flatMap(_.id) + | def asString_ : besom.types.Output[scala.Option[String]] = output.flatMap(_.asString_) + | def scala_ : besom.types.Output[scala.Option[String]] = output.flatMap(_.scala_) + | def toString_ : besom.types.Output[scala.Option[String]] = output.flatMap(_.toString_) + |""".stripMargin + ) ) ).foreach(data => test(data.name.withTags(data.tags)) { diff --git a/codegen/src/Config.scala b/codegen/src/Config.scala index c695f5c6..b2a58fac 100644 --- a/codegen/src/Config.scala +++ b/codegen/src/Config.scala @@ -29,7 +29,7 @@ object Config { val DefaultBesomVersion: String = { try { - os.read(os.pwd / "version.txt").trim + os.read(besomDir / "version.txt").trim } catch { case ex: java.nio.file.NoSuchFileException => throw GeneralCodegenException( @@ -38,9 +38,15 @@ object Config { ) } } - val DefaultSchemasDir: os.Path = os.pwd / ".out" / "schemas" - val DefaultCodegenDir: os.Path = os.pwd / ".out" / "codegen" - val DefaultOverlaysDir: os.Path = os.pwd / "codegen" / "resources" / "overlays" + val DefaultSchemasDir: os.Path = besomDir / ".out" / "schemas" + val DefaultCodegenDir: os.Path = besomDir / ".out" / "codegen" + val DefaultOverlaysDir: os.Path = besomDir / "codegen" / "resources" / "overlays" + + def besomDir: os.Path = + if os.pwd.last != "besom" then + println("You have to run this command from besom project root directory") + sys.exit(1) + os.pwd case class Provider( nonCompiledModules: Seq[String] = Seq.empty, diff --git a/codegen/src/PropertyInfo.scala b/codegen/src/PropertyInfo.scala index a938bec3..c679fdd2 100644 --- a/codegen/src/PropertyInfo.scala +++ b/codegen/src/PropertyInfo.scala @@ -87,7 +87,13 @@ object PropertyInfo: "getClass", "hashCode", "isInstanceOf", - "toString" + "toString", + "finalize" + ) + + private val reservedMethods = Set( + "pulumiResourceName", + "asString" ) private val reservedPackages = Set( @@ -97,10 +103,12 @@ object PropertyInfo: "besom" ) + private val reserved = anyRefMethodNames ++ reservedMethods ++ reservedPackages + // This logic must be undone the same way in codecs // Keep in sync with `unmanglePropertyName` in codecs.scala private def manglePropertyName(name: String)(implicit logger: Logger): String = - if (anyRefMethodNames ++ reservedPackages).contains(name) then + if reserved.contains(name) then val mangledName = name + "_" logger.debug(s"Mangled property name '$name' as '$mangledName'") mangledName diff --git a/codegen/src/model/SemanticVersion.scala b/codegen/src/model/SemanticVersion.scala index 2bc344e7..5eb61bf7 100644 --- a/codegen/src/model/SemanticVersion.scala +++ b/codegen/src/model/SemanticVersion.scala @@ -1,6 +1,7 @@ package besom.model // TODO: move to separate module +// NOTICE: keep in sync with auto/src/main/scala/besom/model/SemanticVersion.scala /** A semantic version as defined by https://semver.org/ * diff --git a/core/project.scala b/core/project.scala index b5de6d99..61e2c5c1 100644 --- a/core/project.scala +++ b/core/project.scala @@ -1,21 +1,21 @@ //> using scala "3.3.1" //> using options "-java-output-version:11", "-Ysafe-init", "-Xmax-inlines:64" -//> using options "-Werror", "-Wunused:all", "-deprecation", "-feature" +//> using options "-Werror", "-Wunused:all", "-deprecation", "-feature", "-Wconf:cat=deprecation:i" // -language:noAutoTupling // after https://github.com/VirtusLab/scala-cli/issues/2708 -//> using dep "org.virtuslab::besom-json:0.3.1" -//> using dep "com.lihaoyi::sourcecode:0.3.1" -//> using dep "com.google.protobuf:protobuf-java-util:3.24.4" -//> using dep "io.grpc:grpc-netty:1.57.2" +//> using dep "org.virtuslab::besom-json:0.3.2" +//> using dep "com.google.protobuf:protobuf-java-util:3.25.1" +//> using dep "io.grpc:grpc-netty:1.64.0" //> using dep "io.netty:netty-transport-native-kqueue:4.1.100.Final" //> using dep "io.netty:netty-transport-native-epoll:4.1.100.Final" -//> using dep "com.thesamet.scalapb::scalapb-runtime:0.11.14" -//> using dep "com.thesamet.scalapb::scalapb-runtime-grpc:0.11.14" +//> using dep "com.thesamet.scalapb::scalapb-runtime:0.11.15" +//> using dep "com.thesamet.scalapb::scalapb-runtime-grpc:0.11.15" //> using dep "com.google.guava:guava:32.1.2-jre" -//> using dep "com.outr::scribe:3.11.3" -//> using dep "com.outr::scribe-file:3.11.3" -//> using dep "com.lihaoyi::pprint:0.6.6" -//> using test.dep "org.scalameta::munit:1.0.0-M10" +//> using dep "com.outr::scribe:3.13.5" +//> using dep "com.outr::scribe-file:3.13.5" +//> using dep "com.lihaoyi::sourcecode:0.4.1" +//> using dep "com.lihaoyi::pprint:0.9.0" +//> using test.dep "org.scalameta::munit:1.0.0" //> using publish.name "besom-core" //> using publish.organization "org.virtuslab" diff --git a/core/src/main/scala/besom/aliases.scala b/core/src/main/scala/besom/aliases.scala index b6440982..c97741ea 100644 --- a/core/src/main/scala/besom/aliases.scala +++ b/core/src/main/scala/besom/aliases.scala @@ -49,6 +49,7 @@ object aliases: object Custom extends besom.internal.ResourceOptsVariant.Custom object Component extends besom.internal.ResourceOptsVariant.Component type CustomTimeouts = besom.internal.CustomTimeouts + object CustomTimeouts extends besom.internal.CustomTimeoutsFactory export besom.internal.InvokeOptions end aliases diff --git a/core/src/main/scala/besom/internal/BesomSyntax.scala b/core/src/main/scala/besom/internal/BesomSyntax.scala index 05a8338b..83462510 100644 --- a/core/src/main/scala/besom/internal/BesomSyntax.scala +++ b/core/src/main/scala/besom/internal/BesomSyntax.scala @@ -119,6 +119,26 @@ trait BesomSyntax: } end component + extension [A <: ProviderResource](pr: A) + def provider(using Context): Output[Option[ProviderResource]] = Output { + Context().resources.getStateFor(pr).map(_.custom.provider) + } + + extension [A <: CustomResource](cr: A) + def provider(using Context): Output[Option[ProviderResource]] = Output { + Context().resources.getStateFor(cr).map(_.provider) + } + + extension [A <: ComponentResource](cmpr: A) + def providers(using Context): Output[Map[String, ProviderResource]] = Output { + Context().resources.getStateFor(cmpr).map(_.providers) + } + + extension [A <: RemoteComponentResource](cb: A) + def providers(using Context): Output[Map[String, ProviderResource]] = Output { + Context().resources.getStateFor(cb).map(_.providers) + } + extension [A <: Resource: ResourceDecoder](companion: ResourceCompanion[A]) def get(name: Input[NonEmptyString], id: Input[ResourceId])(using ctx: Context): Output[A] = for diff --git a/core/src/main/scala/besom/internal/CustomTimeouts.scala b/core/src/main/scala/besom/internal/CustomTimeouts.scala index e10c3bcc..4c5a9c7c 100644 --- a/core/src/main/scala/besom/internal/CustomTimeouts.scala +++ b/core/src/main/scala/besom/internal/CustomTimeouts.scala @@ -25,13 +25,20 @@ import besom.util.* */ case class CustomTimeouts(create: Option[Duration], update: Option[Duration], delete: Option[Duration]) -/** Companion object for [[CustomTimeouts]] */ object CustomTimeouts: + // noinspection ScalaUnusedSymbol + private[besom] def toGoDurationString(duration: Duration): String = s"${duration.toNanos}ns" + def apply( - create: Duration | NotProvided = NotProvided, - update: Duration | NotProvided = NotProvided, - delete: Duration | NotProvided = NotProvided + create: NotProvidedOr[Duration] = NotProvided, + update: NotProvidedOr[Duration] = NotProvided, + delete: NotProvidedOr[Duration] = NotProvided ): CustomTimeouts = new CustomTimeouts(create.asOption, update.asOption, delete.asOption) - // noinspection ScalaUnusedSymbol - private[besom] def toGoDurationString(duration: Duration): String = s"${duration.toNanos}ns" +/** Companion object for [[CustomTimeouts]] */ +trait CustomTimeoutsFactory: + def apply( + create: NotProvidedOr[Duration] = NotProvided, + update: NotProvidedOr[Duration] = NotProvided, + delete: NotProvidedOr[Duration] = NotProvided + ): CustomTimeouts = new CustomTimeouts(create.asOption, update.asOption, delete.asOption) diff --git a/core/src/main/scala/besom/internal/Env.scala b/core/src/main/scala/besom/internal/Env.scala index a4896700..f6a78419 100644 --- a/core/src/main/scala/besom/internal/Env.scala +++ b/core/src/main/scala/besom/internal/Env.scala @@ -1,6 +1,6 @@ package besom.internal -import besom.util.NonEmptyString +import besom.util.* import scala.util.Try @@ -56,11 +56,6 @@ object Env: private[internal] def getConfigSecretKeys(key: String): Try[Set[NonEmptyString]] = Try { sys.env.get(key).map(_.parseJson.convertTo[Set[NonEmptyString]]).getOrElse(Set.empty) } - private[internal] def isTruthy(s: String): Boolean = - s == "1" || s.equalsIgnoreCase("true") - - private[internal] def isNotTruthy(s: String): Boolean = !isTruthy(s) - lazy val logLevel = getMaybe(EnvLogLevel).flatMap(scribe.Level.get(_)).getOrElse(scribe.Level.Warn) lazy val traceRunToFile = getMaybe(EnvEnableTraceLoggingToFile).map(isTruthy).getOrElse(false) lazy val project = getOrFail(EnvProject) diff --git a/core/src/main/scala/besom/internal/FeatureSupport.scala b/core/src/main/scala/besom/internal/FeatureSupport.scala index 424c6c4d..0db1ea0f 100644 --- a/core/src/main/scala/besom/internal/FeatureSupport.scala +++ b/core/src/main/scala/besom/internal/FeatureSupport.scala @@ -2,7 +2,13 @@ package besom.internal import pulumirpc.resource.SupportsFeatureRequest -case class FeatureSupport(keepResources: Boolean, keepOutputValues: Boolean, deletedWith: Boolean, aliasSpecs: Boolean) +case class FeatureSupport( + keepResources: Boolean, + keepOutputValues: Boolean, + deletedWith: Boolean, + aliasSpecs: Boolean, + transforms: Boolean +) object FeatureSupport: def apply(monitor: Monitor): Result[FeatureSupport] = @@ -11,4 +17,5 @@ object FeatureSupport: keepOutputValues <- monitor.supportsFeature(SupportsFeatureRequest("outputValues")).map(_.hasSupport) deletedWith <- monitor.supportsFeature(SupportsFeatureRequest("deletedWith")).map(_.hasSupport) aliasSpecs <- monitor.supportsFeature(SupportsFeatureRequest("aliasSpecs")).map(_.hasSupport) - yield FeatureSupport(keepResources, keepOutputValues, deletedWith, aliasSpecs) + transforms <- monitor.supportsFeature(SupportsFeatureRequest("transforms")).map(_.hasSupport) + yield FeatureSupport(keepResources, keepOutputValues, deletedWith, aliasSpecs, transforms) diff --git a/core/src/main/scala/besom/internal/Language.scala b/core/src/main/scala/besom/internal/Language.scala new file mode 100644 index 00000000..3761a67a --- /dev/null +++ b/core/src/main/scala/besom/internal/Language.scala @@ -0,0 +1,114 @@ +package besom.internal + +import com.google.protobuf.* +import io.grpc.netty.NettyServerBuilder +import io.grpc.stub.StreamObserver +import io.grpc.{InsecureServerCredentials, MethodDescriptor, Server, Status} +import pulumirpc.language.* +import pulumirpc.language.LanguageRuntimeGrpc.LanguageRuntime +import pulumirpc.plugin.* + +import java.util.concurrent.TimeUnit +import scala.concurrent.{ExecutionContext, Future} + +trait LanguageRuntimeService extends LanguageRuntime: + def run(request: RunRequest): Future[RunResponse] = + request.getInfo + Future.successful(RunResponse()) + + // Unimplemented on purpose + def getRequiredPlugins(request: GetRequiredPluginsRequest): Future[GetRequiredPluginsResponse] = + unimplementedUnaryCall(LanguageRuntimeGrpc.METHOD_GET_REQUIRED_PLUGINS) + + def getPluginInfo(request: empty.Empty): Future[PluginInfo] = + unimplementedUnaryCall(LanguageRuntimeGrpc.METHOD_GET_PLUGIN_INFO) + + def installDependencies(request: InstallDependenciesRequest, responseObserver: StreamObserver[InstallDependenciesResponse]): Unit = + unimplementedUnaryCall(LanguageRuntimeGrpc.METHOD_INSTALL_DEPENDENCIES, responseObserver) + + def about(request: empty.Empty): Future[AboutResponse] = + unimplementedUnaryCall(LanguageRuntimeGrpc.METHOD_ABOUT) + + def getProgramDependencies(request: GetProgramDependenciesRequest): Future[GetProgramDependenciesResponse] = + unimplementedUnaryCall(LanguageRuntimeGrpc.METHOD_GET_PROGRAM_DEPENDENCIES) + + def runPlugin(request: RunPluginRequest, responseObserver: StreamObserver[RunPluginResponse]): Unit = + unimplementedUnaryCall(LanguageRuntimeGrpc.METHOD_RUN_PLUGIN, responseObserver) + + def generateProgram(request: GenerateProgramRequest): Future[GenerateProgramResponse] = + unimplementedUnaryCall(LanguageRuntimeGrpc.METHOD_GENERATE_PROGRAM) + + def generateProject(request: GenerateProjectRequest): Future[GenerateProjectResponse] = + unimplementedUnaryCall(LanguageRuntimeGrpc.METHOD_GENERATE_PROJECT) + + def generatePackage(request: GeneratePackageRequest): Future[GeneratePackageResponse] = + unimplementedUnaryCall(LanguageRuntimeGrpc.METHOD_GENERATE_PACKAGE) + + def pack(request: PackRequest): Future[PackResponse] = + unimplementedUnaryCall(LanguageRuntimeGrpc.METHOD_PACK) + + private def unimplementedUnaryCall[A, B](methodDescriptor: MethodDescriptor[A, B]): Future[B] = + Future.failed( + Status.UNIMPLEMENTED.withDescription(s"Method ${methodDescriptor.getFullMethodName} is unimplemented").asRuntimeException() + ) + + private def unimplementedUnaryCall[A, B](methodDescriptor: MethodDescriptor[A, B], responseObserver: StreamObserver[B]): Unit = + responseObserver.onError( + Status.UNIMPLEMENTED.withDescription(s"Method ${methodDescriptor.getFullMethodName} is unimplemented").asRuntimeException() + ) + +end LanguageRuntimeService + +object LanguageRuntimeService extends LanguageRuntimeService + +object LanguageRuntimeServer: + case class Address(host: String, port: Int): + override def toString: String = s"$host:$port" + + def apply(service: LanguageRuntimeService)(using ec: ExecutionContext): LanguageRuntimeServer = + // TODO: detect that nested stack operations are not supported https://github.com/pulumi/pulumi/issues/5058 + val server = NettyServerBuilder + .forPort(0 /* random port */, InsecureServerCredentials.create()) + .addService( + LanguageRuntimeGrpc.bindService(service, ec) + ) + .build + new LanguageRuntimeServer(server) + +end LanguageRuntimeServer + +class LanguageRuntimeServer private (server: Server): + self => + + import LanguageRuntimeServer.* + + private val ShutdownTimeoutInSeconds = 30 + + def start(): Address = + try server.start() + catch + case e: java.io.IOException => + throw new RuntimeException("Failed to start LanguageRuntimeServer", e) + end try + + val _ = sys.addShutdownHook { + // Use stderr here since the logger may have been reset by its JVM shutdown hook. + System.err.println("Shutting down LanguageRuntimeServer gRPC server since JVM is shutting down") + self.stop() + } + + val address = Address("127.0.0.1", server.getPort) + println(s"LanguageRuntimeServer started, listening on $address") + address + end start + + def stop(): Unit = + try server.shutdown().awaitTermination(ShutdownTimeoutInSeconds, TimeUnit.SECONDS) + catch + case e: InterruptedException => + throw new RuntimeException("Error while awaiting for termination of LanguageRuntimeServer", e) + end try + println("LanguageRuntimeServer shut down"); + end stop + +end LanguageRuntimeServer diff --git a/core/src/main/scala/besom/internal/Monitor.scala b/core/src/main/scala/besom/internal/Monitor.scala index ac60209e..1671a807 100644 --- a/core/src/main/scala/besom/internal/Monitor.scala +++ b/core/src/main/scala/besom/internal/Monitor.scala @@ -1,24 +1,35 @@ package besom.internal import besom.util.NonEmptyString +import pulumirpc.callback.Callback import pulumirpc.resource.ResourceMonitorGrpc.ResourceMonitorStub -import pulumirpc.resource.* -import pulumirpc.provider.CallRequest +import pulumirpc.resource.{ + ReadResourceRequest, + ReadResourceResponse, + RegisterResourceOutputsRequest, + RegisterResourceRequest, + RegisterResourceResponse, + ResourceCallRequest, + ResourceInvokeRequest, + SupportsFeatureRequest, + SupportsFeatureResponse +} import pulumirpc.provider.CallResponse import pulumirpc.provider.InvokeResponse trait Monitor: - def call(callRequest: CallRequest): Result[CallResponse] + def call(callRequest: ResourceCallRequest): Result[CallResponse] def invoke(invokeRequest: ResourceInvokeRequest): Result[InvokeResponse] def readResource(readResourceRequest: ReadResourceRequest): Result[ReadResourceResponse] def registerResource(registerResourceRequest: RegisterResourceRequest): Result[RegisterResourceResponse] def registerResourceOutputs(registerResourceOutputsRequest: RegisterResourceOutputsRequest): Result[Unit] def supportsFeature(supportsFeatureRequest: SupportsFeatureRequest): Result[SupportsFeatureResponse] + def registerStackTransform(callback: Callback): Result[Unit] def close(): Result[Unit] class MonitorImpl(private val stub: ResourceMonitorStub, private val closeFn: () => Result[Unit]) extends Monitor: - def call(callRequest: CallRequest): Result[CallResponse] = Result.deferFuture(stub.call(callRequest)) + def call(callRequest: ResourceCallRequest): Result[CallResponse] = Result.deferFuture(stub.call(callRequest)) def invoke(invokeRequest: ResourceInvokeRequest): Result[InvokeResponse] = Result.deferFuture(stub.invoke(invokeRequest)) @@ -35,6 +46,9 @@ class MonitorImpl(private val stub: ResourceMonitorStub, private val closeFn: () def supportsFeature(supportsFeatureRequest: SupportsFeatureRequest): Result[SupportsFeatureResponse] = Result.deferFuture(stub.supportsFeature(supportsFeatureRequest)) + override def registerStackTransform(request: Callback): Result[Unit] = + Result.deferFuture(stub.registerStackTransform(request)).void + def close(): Result[Unit] = closeFn() object Monitor: diff --git a/core/src/main/scala/besom/internal/Resource.scala b/core/src/main/scala/besom/internal/Resource.scala index d76cd97f..a35a9ecd 100644 --- a/core/src/main/scala/besom/internal/Resource.scala +++ b/core/src/main/scala/besom/internal/Resource.scala @@ -24,6 +24,8 @@ sealed trait Resource: case _: CustomResource => true case _ => false + // this method can lead to deadlocks as it waits for URN to be resolved, use carefully + // resources can be visually compared by references using toString() if URN is not strictly required private[internal] def asString: Result[Option[String]] = urn.getValue.map(_.map(v => s"${this.getClass.getSimpleName}($v)")) trait CustomResource extends Resource: @@ -45,6 +47,8 @@ trait ComponentResource(using */ override def urn: Output[URN] = base.urn + private[besom] def componentBase: ComponentBase = base + trait ProviderResource extends CustomResource: private[internal] def registrationId: Result[String] = for diff --git a/core/src/main/scala/besom/internal/ResourceOps.scala b/core/src/main/scala/besom/internal/ResourceOps.scala index ecc43bb1..3cb813b2 100644 --- a/core/src/main/scala/besom/internal/ResourceOps.scala +++ b/core/src/main/scala/besom/internal/ResourceOps.scala @@ -1,12 +1,12 @@ package besom.internal import com.google.protobuf.struct.* -import pulumirpc.resource.* import pulumirpc.resource.RegisterResourceRequest.PropertyDependencies -import besom.util.* -import besom.types.* +import besom.util.{printer, Validated, NonEmptyString} +import besom.types.{URN, ResourceId, ResourceType, Label, FunctionToken} import besom.internal.logging.* import pulumirpc.provider.InvokeResponse +import pulumirpc.resource.{ReadResourceRequest, RegisterResourceOutputsRequest, RegisterResourceRequest, ResourceInvokeRequest} // TODO remove import scala.annotation.unused @@ -112,7 +112,7 @@ class ResourceOps(using ctx: Context, mdc: BesomMDC[Label]): resource: Resource, opts: InvokeOptions ): Output[R] = - ??? + ??? // TODO: https://github.com/VirtusLab/besom/issues/367 private[internal] def executeInvoke(tok: FunctionToken, invokeArgs: SerializationResult, opts: InvokeOptions): Result[Value] = def buildInvokeRequest(args: Struct, provider: Option[String], version: Option[String]): Result[ResourceInvokeRequest] = @@ -438,33 +438,6 @@ class ResourceOps(using ctx: Context, mdc: BesomMDC[Label]): remote: Boolean ): Result[Either[Throwable, RawResourceResult]] = ctx.registerTask { - // X `type`: _root_.scala.Predef.String = "", - // X name: _root_.scala.Predef.String = "", - // X parent: _root_.scala.Predef.String = "", - // X custom: _root_.scala.Boolean = false, - // X `object`: _root_.scala.Option[com.google.protobuf.struct.Struct] = _root_.scala.None, - // X protect: _root_.scala.Boolean = false, - // X dependencies: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, - // X provider: _root_.scala.Predef.String = "", - // X propertyDependencies: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.resource.RegisterResourceRequest.PropertyDependencies] = _root_.scala.collection.immutable.Map.empty, - // X deleteBeforeReplace: _root_.scala.Boolean = false, - // X version: _root_.scala.Predef.String = "", - // X ignoreChanges: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, - // X acceptSecrets: _root_.scala.Boolean = false, - // X additionalSecretOutputs: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, - // N @scala.deprecated(message="Marked as deprecated in proto file", "") urnAliases: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, - // X importId: _root_.scala.Predef.String = "", - // X customTimeouts: _root_.scala.Option[pulumirpc.resource.RegisterResourceRequest.CustomTimeouts] = _root_.scala.None, - // X deleteBeforeReplaceDefined: _root_.scala.Boolean = false, - // X supportsPartialValues: _root_.scala.Boolean = false, - // X remote: _root_.scala.Boolean = false, - // X acceptResources: _root_.scala.Boolean = false, - // X providers: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String] = _root_.scala.collection.immutable.Map.empty, - // X replaceOnChanges: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, - // X pluginDownloadURL: _root_.scala.Predef.String = "", - // X retainOnDelete: _root_.scala.Boolean = false, - // X aliases: _root_.scala.Seq[pulumirpc.resource.Alias] = _root_.scala.Seq.empty, - // unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty Result .defer { RegisterResourceRequest( @@ -479,7 +452,7 @@ class ResourceOps(using ctx: Context, mdc: BesomMDC[Label]): providers = inputs.providerRefs, propertyDependencies = inputs.depUrns.allDepsByProperty.map { case (key, value) => key -> PropertyDependencies(value.toList.map(_.asString)) - }.toMap, + }, deleteBeforeReplaceDefined = true, deleteBeforeReplace = inputs.options match case CustomResolvedResourceOptions(_, _, deleteBeforeReplace, _, _) => deleteBeforeReplace @@ -488,7 +461,7 @@ class ResourceOps(using ctx: Context, mdc: BesomMDC[Label]): version = inputs.options.version.getOrElse(""), // protobuf expects empty string and not null ignoreChanges = inputs.options.ignoreChanges, acceptSecrets = true, // our implementation supports secrets from day one - acceptResources = ctx.runInfo.acceptResources, + acceptResources = ctx.runInfo.acceptResources, // our implementation supports resources from day one additionalSecretOutputs = inputs.options match case CustomResolvedResourceOptions(_, _, _, additionalSecretOutputs, _) => additionalSecretOutputs case _ => Vector.empty @@ -500,7 +473,7 @@ class ResourceOps(using ctx: Context, mdc: BesomMDC[Label]): , aliases = inputs.aliases.map { alias => pulumirpc.alias.Alias(pulumirpc.alias.Alias.Alias.Urn(alias)) - }.toList, + }, remote = remote, customTimeouts = Some( RegisterResourceRequest.CustomTimeouts( @@ -511,8 +484,10 @@ class ResourceOps(using ctx: Context, mdc: BesomMDC[Label]): ), pluginDownloadURL = inputs.options.pluginDownloadUrl.getOrElse(""), retainOnDelete = inputs.options.retainOnDelete, - supportsPartialValues = false, // TODO partial values - deletedWith = inputs.deletedWithUrn.getOrElse(URN.empty).asString + supportsPartialValues = false, // TODO: https://github.com/VirtusLab/besom/issues/480 + supportsResultReporting = false, // TODO: https://github.com/VirtusLab/besom/issues/481 + deletedWith = inputs.deletedWithUrn.getOrElse(URN.empty).asString, + transforms = Seq.empty // TODO: https://github.com/VirtusLab/besom/issues/413 ) } .flatMap { req => @@ -556,16 +531,16 @@ class ResourceOps(using ctx: Context, mdc: BesomMDC[Label]): @unused typ: ResourceType, @unused resourceOptions: ResolvedResourceOptions ): Result[List[Unit]] = - Result.pure(List.empty) // TODO parent transformations + Result.pure(List.empty) // TODO parent transformations: https://github.com/VirtusLab/besom/issues/42 private[internal] def applyTransformations( resourceOptions: ResolvedResourceOptions, @unused parentTransformations: List[Unit] // TODO this needs transformations from ResourceState, not Resource ): Result[ResolvedResourceOptions] = - Result.pure(resourceOptions) // TODO resource transformations + Result.pure(resourceOptions) // TODO resource transformations: https://github.com/VirtusLab/besom/issues/42 private[internal] def collapseAliases(@unused opts: ResolvedResourceOptions): Result[List[Output[String]]] = - Result.pure(List.empty) // TODO aliases + Result.pure(List.empty) // TODO aliases: https://github.com/VirtusLab/besom/issues/44 private[internal] def mergeProviders(typ: String, opts: ResolvedResourceOptions, resources: Resources): Result[Providers] = def getParentProviders = opts.parent match diff --git a/core/src/main/scala/besom/internal/ResourceState.scala b/core/src/main/scala/besom/internal/ResourceState.scala index 51417398..a67c9bf1 100644 --- a/core/src/main/scala/besom/internal/ResourceState.scala +++ b/core/src/main/scala/besom/internal/ResourceState.scala @@ -36,21 +36,25 @@ case class CommonResourceState( typ: ResourceType, // transformations: List[ResourceTransformation], keepDependency: Boolean -) +): + override def toString(): String = "CommonResourceState" case class CustomResourceState( common: CommonResourceState, id: Output[ResourceId] ) extends ResourceState: export common.* + override def toString(): String = "CustomResourceState" case class ProviderResourceState( custom: CustomResourceState, pkg: String ) extends ResourceState: export custom.* + override def toString(): String = "ProviderResourceState" case class ComponentResourceState( common: CommonResourceState ) extends ResourceState: export common.* + override def toString(): String = "ComponentResourceState" diff --git a/core/src/main/scala/besom/internal/codecs.scala b/core/src/main/scala/besom/internal/codecs.scala index f562a1e0..024ab343 100644 --- a/core/src/main/scala/besom/internal/codecs.scala +++ b/core/src/main/scala/besom/internal/codecs.scala @@ -153,7 +153,7 @@ trait Decoder[A]: end Decoder object NameUnmangler: - private val mangledAnyRefMethodNames = Set( + private val anyRefMethodNames = Set( "eq", "ne", "notify", @@ -166,14 +166,29 @@ object NameUnmangler: "getClass", "hashCode", "isInstanceOf", - "toString" - ).map(_ + "_") + "toString", + "finalize" + ) + + private val reservedMethods = Set( + "pulumiResourceName", + "asString" + ) + + private val reservedPackages = Set( + "java", + "javax", + "scala", + "besom" + ) + + private val reserved = (anyRefMethodNames ++ reservedMethods ++ reservedPackages).map(_ + "_") - /** Keep in sync with `manglePropertyName` in CodeGen.scala */ + // This logic must be undone the same way in codegen + // Keep in sync with `manglePropertyName` in CodeGen.scala def unmanglePropertyName(name: String): String = - if (mangledAnyRefMethodNames.contains(name)) { - name.dropRight(1) - } else name + if reserved.contains(name) then name.dropRight(1) // drop the underscore + else name object Decoder extends DecoderInstancesLowPrio1: import besom.json.* diff --git a/core/src/main/scala/besom/internal/logging.scala b/core/src/main/scala/besom/internal/logging.scala index 36d29d01..67449b68 100644 --- a/core/src/main/scala/besom/internal/logging.scala +++ b/core/src/main/scala/besom/internal/logging.scala @@ -2,7 +2,7 @@ package besom.internal import scribe.*, LoggerSupport.{apply => makeLogRecord} import scribe.message.LoggableMessage -import scribe.data.{MDC => ScribeMDC} +import scribe.mdc.{MDC => ScribeMDC} import sourcecode.{FileName, Line, Name, Pkg} import scala.util.{NotGiven => Not} @@ -262,7 +262,6 @@ object logging: private val queue: Queue[LogRequest | Queue.Stop], private val fib: Fiber[Unit] ) extends BesomLogger: - def close(): Result[Unit] = queue.offer(Queue.Stop) *> fib.join override def log(record: LogRecord): Result[Unit] = Result(Logger(record.className).log(record)) @@ -270,7 +269,8 @@ object logging: override def log(record: LogRecord, urn: URN, streamId: Int, ephemeral: Boolean): Result[Unit] = for _ <- log(record) // direct logging - _ <- queue.offer(makeLogRequest(record, urn, streamId, ephemeral)) // logging via RPC (async via queue) + // logging via RPC (async via queue) + _ <- queue.offer(makeLogRequest(record, urn, streamId, ephemeral)) // this unfortunately evaluates all lazy log messages yield () object BesomLogger: diff --git a/core/src/main/scala/besom/internal/resources.scala b/core/src/main/scala/besom/internal/resources.scala index 4aac591a..b1d2b197 100644 --- a/core/src/main/scala/besom/internal/resources.scala +++ b/core/src/main/scala/besom/internal/resources.scala @@ -1,5 +1,23 @@ package besom.internal +class ResourceStateMismatchException(msg: String) extends Exception(msg) +object ResourceStateMismatchException: + def fail(r: Resource, state: ResourceState, expected: String)(using dbg: Debug): Result[Nothing] = + (for + rstr <- r.asString + msg = s"state for resource $r / ${rstr.getOrElse("???")} is $state, expected $expected, caller: $dbg" + yield new ResourceStateMismatchException(msg)).flatMap(e => Result.fail(e)) + +class ResourceStateMissingException(msg: String) extends Exception(msg) +object ResourceStateMissingException: + inline private def nl = System.lineSeparator + def fail(r: Resource, rs: Map[Resource, ResourceState])(using dbg: Debug): Result[Nothing] = + (for + rstr <- r.asString + msg = s"state for resource $r / ${rstr.getOrElse("???")} not found$nl - caller: $dbg$nl - state available for resources:$nl${rs.keys + .mkString(" * ", nl + " * ", "")}" + yield new ResourceStateMissingException(msg)).flatMap(e => Result.fail(e)) + class Resources private (private val resources: Ref[Map[Resource, ResourceState]]): def add(resource: ProviderResource, state: ProviderResourceState): Result[Unit] = resources.update(_ + (resource -> state)) @@ -25,56 +43,53 @@ class Resources private (private val resources: Ref[Map[Resource, ResourceState] case _ => resource.asString.flatMap(s => Result.fail(Exception(s"resource ${s} and state ${state} don't match"))) - def getStateFor(resource: ProviderResource): Result[ProviderResourceState] = - resources.get.flatMap { - _.get(resource) match + def getStateFor(resource: ProviderResource)(using Debug): Result[ProviderResourceState] = + resources.get.flatMap { rs => + rs.get(resource) match case Some(state) => state match - case _: CustomResourceState => - resource.asString.flatMap(s => Result.fail(Exception(s"state for ProviderResource ${s} is a CustomResourceState!"))) case prs: ProviderResourceState => Result.pure(prs) - case _: ComponentResourceState => - resource.asString.flatMap(s => Result.fail(Exception(s"state for ProviderResource ${s} is a ComponentResourceState!"))) + case _ => ResourceStateMismatchException.fail(resource, state, "ProviderResourceState") case None => - resource.asString.flatMap(s => Result.fail(Exception(s"state for resource ${s} not found"))) + ResourceStateMissingException.fail(resource, rs) } - def getStateFor(resource: CustomResource): Result[CustomResourceState] = - resources.get.flatMap { - _.get(resource) match + def getStateFor(resource: CustomResource)(using Debug): Result[CustomResourceState] = + resources.get.flatMap { rs => + rs.get(resource) match case Some(state) => state match case crs: CustomResourceState => Result.pure(crs) - case _: ProviderResourceState => - resource.asString.flatMap(s => Result.fail(Exception(s"state for CustomResource ${s} is a ProviderResourceState!"))) - case _: ComponentResourceState => - resource.asString.flatMap(s => Result.fail(Exception(s"state for CustomResource ${s} is a ComponentResourceState!"))) + case _ => ResourceStateMismatchException.fail(resource, state, "CustomResourceState") case None => - resource.asString.flatMap(s => Result.fail(Exception(s"state for resource ${s} not found"))) + ResourceStateMissingException.fail(resource, rs) } - def getStateFor(resource: ComponentResource): Result[ComponentResourceState] = - resources.get.flatMap { - _.get(resource) match + def getStateFor(resource: ComponentResource)(using Debug): Result[ComponentResourceState] = + resources.get.flatMap { rs => + rs.get(resource.componentBase) match case Some(state) => state match - case _: CustomResourceState => - resource.asString.flatMap(s => Result.fail(Exception(s"state for ComponentResource ${s} is a CustomResourceState!"))) - case _: ProviderResourceState => - resource.asString.flatMap(s => Result.fail(Exception(s"state for ComponentResource ${s} is a ProviderResourceState!"))) case comprs: ComponentResourceState => Result.pure(comprs) + case _ => ResourceStateMismatchException.fail(resource, state, "ComponentResourceState") case None => - resource.asString.flatMap(s => Result.fail(Exception(s"state for resource ${s} not found"))) + ResourceStateMissingException.fail(resource, rs) } - def getStateFor(resource: Resource): Result[ResourceState] = - resources.get.flatMap { - _.get(resource) match - case Some(state) => Result.pure(state) - case None => resource.asString.flatMap(s => Result.fail(Exception(s"state for resource ${s} not found"))) + def getStateFor(resource: Resource)(using dbg: Debug): Result[ResourceState] = + resources.get.flatMap { rs => + resource match + case compr: ComponentResource => + rs.get(compr.componentBase) match + case Some(state) => Result.pure(state) + case None => ResourceStateMissingException.fail(resource, rs) + case _ => + rs.get(resource) match + case Some(state) => Result.pure(state) + case None => ResourceStateMissingException.fail(resource, rs) } def updateStateFor(resource: Resource)(f: ResourceState => ResourceState): Result[Unit] = diff --git a/core/src/main/scala/besom/rpc/pulumirpc/callback/Callback.scala b/core/src/main/scala/besom/rpc/pulumirpc/callback/Callback.scala new file mode 100644 index 00000000..3eacb74c --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/callback/Callback.scala @@ -0,0 +1,152 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.callback + +/** @param target + * the gRPC target of the callback service. + * @param token + * the service specific unique token for this callback. + */ +@SerialVersionUID(0L) +final case class Callback( + target: _root_.scala.Predef.String = "", + token: _root_.scala.Predef.String = "", + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Callback] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = target + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = token + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = target + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = token + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withTarget(__v: _root_.scala.Predef.String): Callback = copy(target = __v) + def withToken(__v: _root_.scala.Predef.String): Callback = copy(token = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = target + if (__t != "") __t else null + } + case 2 => { + val __t = token + if (__t != "") __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(target) + case 2 => _root_.scalapb.descriptors.PString(token) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.callback.Callback.type = pulumirpc.callback.Callback + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.Callback]) +} + +object Callback extends scalapb.GeneratedMessageCompanion[pulumirpc.callback.Callback] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.callback.Callback] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.callback.Callback = { + var __target: _root_.scala.Predef.String = "" + var __token: _root_.scala.Predef.String = "" + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __target = _input__.readStringRequireUtf8() + case 18 => + __token = _input__.readStringRequireUtf8() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.callback.Callback( + target = __target, + token = __token, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.callback.Callback] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.callback.Callback( + target = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + token = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse("") + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = CallbackProto.javaDescriptor.getMessageTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = CallbackProto.scalaDescriptor.messages(0) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.callback.Callback( + target = "", + token = "" + ) + implicit class CallbackLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.callback.Callback]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.callback.Callback](_l) { + def target: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.target)((c_, f_) => c_.copy(target = f_)) + def token: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.token)((c_, f_) => c_.copy(token = f_)) + } + final val TARGET_FIELD_NUMBER = 1 + final val TOKEN_FIELD_NUMBER = 2 + def of( + target: _root_.scala.Predef.String, + token: _root_.scala.Predef.String + ): _root_.pulumirpc.callback.Callback = _root_.pulumirpc.callback.Callback( + target, + token + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.Callback]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/callback/CallbackInvokeRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/callback/CallbackInvokeRequest.scala new file mode 100644 index 00000000..3b60bf88 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/callback/CallbackInvokeRequest.scala @@ -0,0 +1,152 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.callback + +/** @param token + * the token for the callback. + * @param request + * the serialized protobuf message of the arguments for this callback. + */ +@SerialVersionUID(0L) +final case class CallbackInvokeRequest( + token: _root_.scala.Predef.String = "", + request: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[CallbackInvokeRequest] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = token + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = request + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = token + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = request + if (!__v.isEmpty) { + _output__.writeBytes(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withToken(__v: _root_.scala.Predef.String): CallbackInvokeRequest = copy(token = __v) + def withRequest(__v: _root_.com.google.protobuf.ByteString): CallbackInvokeRequest = copy(request = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = token + if (__t != "") __t else null + } + case 2 => { + val __t = request + if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(token) + case 2 => _root_.scalapb.descriptors.PByteString(request) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.callback.CallbackInvokeRequest.type = pulumirpc.callback.CallbackInvokeRequest + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.CallbackInvokeRequest]) +} + +object CallbackInvokeRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.callback.CallbackInvokeRequest] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.callback.CallbackInvokeRequest] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.callback.CallbackInvokeRequest = { + var __token: _root_.scala.Predef.String = "" + var __request: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __token = _input__.readStringRequireUtf8() + case 18 => + __request = _input__.readBytes() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.callback.CallbackInvokeRequest( + token = __token, + request = __request, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.callback.CallbackInvokeRequest] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.callback.CallbackInvokeRequest( + token = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + request = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = CallbackProto.javaDescriptor.getMessageTypes().get(1) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = CallbackProto.scalaDescriptor.messages(1) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.callback.CallbackInvokeRequest( + token = "", + request = _root_.com.google.protobuf.ByteString.EMPTY + ) + implicit class CallbackInvokeRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.callback.CallbackInvokeRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.callback.CallbackInvokeRequest](_l) { + def token: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.token)((c_, f_) => c_.copy(token = f_)) + def request: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.request)((c_, f_) => c_.copy(request = f_)) + } + final val TOKEN_FIELD_NUMBER = 1 + final val REQUEST_FIELD_NUMBER = 2 + def of( + token: _root_.scala.Predef.String, + request: _root_.com.google.protobuf.ByteString + ): _root_.pulumirpc.callback.CallbackInvokeRequest = _root_.pulumirpc.callback.CallbackInvokeRequest( + token, + request + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.CallbackInvokeRequest]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/callback/CallbackInvokeResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/callback/CallbackInvokeResponse.scala new file mode 100644 index 00000000..0c85d4c8 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/callback/CallbackInvokeResponse.scala @@ -0,0 +1,120 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.callback + +/** @param response + * the serialized protobuf message of the response for this callback. + */ +@SerialVersionUID(0L) +final case class CallbackInvokeResponse( + response: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[CallbackInvokeResponse] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = response + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(1, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = response + if (!__v.isEmpty) { + _output__.writeBytes(1, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withResponse(__v: _root_.com.google.protobuf.ByteString): CallbackInvokeResponse = copy(response = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = response + if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PByteString(response) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.callback.CallbackInvokeResponse.type = pulumirpc.callback.CallbackInvokeResponse + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.CallbackInvokeResponse]) +} + +object CallbackInvokeResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.callback.CallbackInvokeResponse] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.callback.CallbackInvokeResponse] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.callback.CallbackInvokeResponse = { + var __response: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __response = _input__.readBytes() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.callback.CallbackInvokeResponse( + response = __response, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.callback.CallbackInvokeResponse] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.callback.CallbackInvokeResponse( + response = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = CallbackProto.javaDescriptor.getMessageTypes().get(2) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = CallbackProto.scalaDescriptor.messages(2) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.callback.CallbackInvokeResponse( + response = _root_.com.google.protobuf.ByteString.EMPTY + ) + implicit class CallbackInvokeResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.callback.CallbackInvokeResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.callback.CallbackInvokeResponse](_l) { + def response: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.response)((c_, f_) => c_.copy(response = f_)) + } + final val RESPONSE_FIELD_NUMBER = 1 + def of( + response: _root_.com.google.protobuf.ByteString + ): _root_.pulumirpc.callback.CallbackInvokeResponse = _root_.pulumirpc.callback.CallbackInvokeResponse( + response + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.CallbackInvokeResponse]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/callback/CallbackProto.scala b/core/src/main/scala/besom/rpc/pulumirpc/callback/CallbackProto.scala new file mode 100644 index 00000000..1de3bb9f --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/callback/CallbackProto.scala @@ -0,0 +1,36 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.callback + +object CallbackProto extends _root_.scalapb.GeneratedFileObject { + lazy val dependencies: Seq[_root_.scalapb.GeneratedFileObject] = Seq.empty + lazy val messagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( + pulumirpc.callback.Callback, + pulumirpc.callback.CallbackInvokeRequest, + pulumirpc.callback.CallbackInvokeResponse + ) + private lazy val ProtoBytes: _root_.scala.Array[Byte] = + scalapb.Encoding.fromBase64(scala.collection.immutable.Seq( + """ChVwdWx1bWkvY2FsbGJhY2sucHJvdG8SCXB1bHVtaXJwYyJRCghDYWxsYmFjaxIjCgZ0YXJnZXQYASABKAlCC+I/CBIGdGFyZ + 2V0UgZ0YXJnZXQSIAoFdG9rZW4YAiABKAlCCuI/BxIFdG9rZW5SBXRva2VuImEKFUNhbGxiYWNrSW52b2tlUmVxdWVzdBIgCgV0b + 2tlbhgBIAEoCUIK4j8HEgV0b2tlblIFdG9rZW4SJgoHcmVxdWVzdBgCIAEoDEIM4j8JEgdyZXF1ZXN0UgdyZXF1ZXN0IkMKFkNhb + GxiYWNrSW52b2tlUmVzcG9uc2USKQoIcmVzcG9uc2UYASABKAxCDeI/ChIIcmVzcG9uc2VSCHJlc3BvbnNlMlwKCUNhbGxiYWNrc + xJPCgZJbnZva2USIC5wdWx1bWlycGMuQ2FsbGJhY2tJbnZva2VSZXF1ZXN0GiEucHVsdW1pcnBjLkNhbGxiYWNrSW52b2tlUmVzc + G9uc2UiAEI0WjJnaXRodWIuY29tL3B1bHVtaS9wdWx1bWkvc2RrL3YzL3Byb3RvL2dvO3B1bHVtaXJwY2IGcHJvdG8z""" + ).mkString) + lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { + val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) + _root_.scalapb.descriptors.FileDescriptor.buildFrom(scalaProto, dependencies.map(_.scalaDescriptor)) + } + lazy val javaDescriptor: com.google.protobuf.Descriptors.FileDescriptor = { + val javaProto = com.google.protobuf.DescriptorProtos.FileDescriptorProto.parseFrom(ProtoBytes) + com.google.protobuf.Descriptors.FileDescriptor.buildFrom(javaProto, _root_.scala.Array( + )) + } + @deprecated("Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.", "ScalaPB 0.5.47") + def descriptor: com.google.protobuf.Descriptors.FileDescriptor = javaDescriptor +} \ No newline at end of file diff --git a/core/src/main/scala/besom/rpc/pulumirpc/callback/CallbacksGrpc.scala b/core/src/main/scala/besom/rpc/pulumirpc/callback/CallbacksGrpc.scala new file mode 100644 index 00000000..2cc0d5c1 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/callback/CallbacksGrpc.scala @@ -0,0 +1,93 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.callback + + +object CallbacksGrpc { + val METHOD_INVOKE: _root_.io.grpc.MethodDescriptor[pulumirpc.callback.CallbackInvokeRequest, pulumirpc.callback.CallbackInvokeResponse] = + _root_.io.grpc.MethodDescriptor.newBuilder() + .setType(_root_.io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(_root_.io.grpc.MethodDescriptor.generateFullMethodName("pulumirpc.Callbacks", "Invoke")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.callback.CallbackInvokeRequest]) + .setResponseMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.callback.CallbackInvokeResponse]) + .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.callback.CallbackProto.javaDescriptor.getServices().get(0).getMethods().get(0))) + .build() + + val SERVICE: _root_.io.grpc.ServiceDescriptor = + _root_.io.grpc.ServiceDescriptor.newBuilder("pulumirpc.Callbacks") + .setSchemaDescriptor(new _root_.scalapb.grpc.ConcreteProtoFileDescriptorSupplier(pulumirpc.callback.CallbackProto.javaDescriptor)) + .addMethod(METHOD_INVOKE) + .build() + + /** Callbacks is a service for invoking functions in one runtime from other processes. + */ + trait Callbacks extends _root_.scalapb.grpc.AbstractService { + override def serviceCompanion: _root_.scalapb.grpc.ServiceCompanion[Callbacks] = Callbacks + /** Invoke invokes a given callback, identified by its token. + */ + def invoke(request: pulumirpc.callback.CallbackInvokeRequest): scala.concurrent.Future[pulumirpc.callback.CallbackInvokeResponse] + } + + object Callbacks extends _root_.scalapb.grpc.ServiceCompanion[Callbacks] { + implicit def serviceCompanion: _root_.scalapb.grpc.ServiceCompanion[Callbacks] = this + def javaDescriptor: _root_.com.google.protobuf.Descriptors.ServiceDescriptor = pulumirpc.callback.CallbackProto.javaDescriptor.getServices().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.ServiceDescriptor = pulumirpc.callback.CallbackProto.scalaDescriptor.services(0) + def bindService(serviceImpl: Callbacks, executionContext: scala.concurrent.ExecutionContext): _root_.io.grpc.ServerServiceDefinition = + _root_.io.grpc.ServerServiceDefinition.builder(SERVICE) + .addMethod( + METHOD_INVOKE, + _root_.io.grpc.stub.ServerCalls.asyncUnaryCall((request: pulumirpc.callback.CallbackInvokeRequest, observer: _root_.io.grpc.stub.StreamObserver[pulumirpc.callback.CallbackInvokeResponse]) => { + serviceImpl.invoke(request).onComplete(scalapb.grpc.Grpc.completeObserver(observer))( + executionContext) + })) + .build() + } + + /** Callbacks is a service for invoking functions in one runtime from other processes. + */ + trait CallbacksBlockingClient { + def serviceCompanion: _root_.scalapb.grpc.ServiceCompanion[Callbacks] = Callbacks + /** Invoke invokes a given callback, identified by its token. + */ + def invoke(request: pulumirpc.callback.CallbackInvokeRequest): pulumirpc.callback.CallbackInvokeResponse + } + + class CallbacksBlockingStub(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions = _root_.io.grpc.CallOptions.DEFAULT) extends _root_.io.grpc.stub.AbstractStub[CallbacksBlockingStub](channel, options) with CallbacksBlockingClient { + /** Invoke invokes a given callback, identified by its token. + */ + override def invoke(request: pulumirpc.callback.CallbackInvokeRequest): pulumirpc.callback.CallbackInvokeResponse = { + _root_.scalapb.grpc.ClientCalls.blockingUnaryCall(channel, METHOD_INVOKE, options, request) + } + + override def build(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions): CallbacksBlockingStub = new CallbacksBlockingStub(channel, options) + } + + class CallbacksStub(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions = _root_.io.grpc.CallOptions.DEFAULT) extends _root_.io.grpc.stub.AbstractStub[CallbacksStub](channel, options) with Callbacks { + /** Invoke invokes a given callback, identified by its token. + */ + override def invoke(request: pulumirpc.callback.CallbackInvokeRequest): scala.concurrent.Future[pulumirpc.callback.CallbackInvokeResponse] = { + _root_.scalapb.grpc.ClientCalls.asyncUnaryCall(channel, METHOD_INVOKE, options, request) + } + + override def build(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions): CallbacksStub = new CallbacksStub(channel, options) + } + + object CallbacksStub extends _root_.io.grpc.stub.AbstractStub.StubFactory[CallbacksStub] { + override def newStub(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions): CallbacksStub = new CallbacksStub(channel, options) + + implicit val stubFactory: _root_.io.grpc.stub.AbstractStub.StubFactory[CallbacksStub] = this + } + + def bindService(serviceImpl: Callbacks, executionContext: scala.concurrent.ExecutionContext): _root_.io.grpc.ServerServiceDefinition = Callbacks.bindService(serviceImpl, executionContext) + + def blockingStub(channel: _root_.io.grpc.Channel): CallbacksBlockingStub = new CallbacksBlockingStub(channel) + + def stub(channel: _root_.io.grpc.Channel): CallbacksStub = new CallbacksStub(channel) + + def javaDescriptor: _root_.com.google.protobuf.Descriptors.ServiceDescriptor = pulumirpc.callback.CallbackProto.javaDescriptor.getServices().get(0) + +} \ No newline at end of file diff --git a/core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/Diagnostic.scala b/core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/Diagnostic.scala new file mode 100644 index 00000000..1b263fc8 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/Diagnostic.scala @@ -0,0 +1,261 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.codegen.hcl + +/** Diagnostic represents information to be presented to a user about an error or anomaly in parsing or evaluating configuration. + * + * @param summary + * Summary and Detail contain the English-language description of the + * problem. Summary is a terse description of the general problem and + * detail is a more elaborate, often-multi-sentence description of + * the problem and what might be done to solve it. + * @param subject + * Subject and Context are both source ranges relating to the diagnostic. + * + * Subject is a tight range referring to exactly the construct that + * is problematic, while Context is an optional broader range (which should + * fully contain Subject) that ought to be shown around Subject when + * generating isolated source-code snippets in diagnostic messages. + * If Context is nil, the Subject is also the Context. + * + * Some diagnostics have no source ranges at all. If Context is set then + * Subject should always also be set. + */ +@SerialVersionUID(0L) +final case class Diagnostic( + severity: pulumirpc.codegen.hcl.DiagnosticSeverity = pulumirpc.codegen.hcl.DiagnosticSeverity.DIAG_INVALID, + summary: _root_.scala.Predef.String = "", + detail: _root_.scala.Predef.String = "", + subject: _root_.scala.Option[pulumirpc.codegen.hcl.Range] = _root_.scala.None, + context: _root_.scala.Option[pulumirpc.codegen.hcl.Range] = _root_.scala.None, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Diagnostic] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = severity.value + if (__value != 0) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(1, __value) + } + }; + + { + val __value = summary + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + + { + val __value = detail + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value) + } + }; + if (subject.isDefined) { + val __value = subject.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + if (context.isDefined) { + val __value = context.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = severity.value + if (__v != 0) { + _output__.writeEnum(1, __v) + } + }; + { + val __v = summary + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + { + val __v = detail + if (!__v.isEmpty) { + _output__.writeString(3, __v) + } + }; + subject.foreach { __v => + val __m = __v + _output__.writeTag(4, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + context.foreach { __v => + val __m = __v + _output__.writeTag(5, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def withSeverity(__v: pulumirpc.codegen.hcl.DiagnosticSeverity): Diagnostic = copy(severity = __v) + def withSummary(__v: _root_.scala.Predef.String): Diagnostic = copy(summary = __v) + def withDetail(__v: _root_.scala.Predef.String): Diagnostic = copy(detail = __v) + def getSubject: pulumirpc.codegen.hcl.Range = subject.getOrElse(pulumirpc.codegen.hcl.Range.defaultInstance) + def clearSubject: Diagnostic = copy(subject = _root_.scala.None) + def withSubject(__v: pulumirpc.codegen.hcl.Range): Diagnostic = copy(subject = Option(__v)) + def getContext: pulumirpc.codegen.hcl.Range = context.getOrElse(pulumirpc.codegen.hcl.Range.defaultInstance) + def clearContext: Diagnostic = copy(context = _root_.scala.None) + def withContext(__v: pulumirpc.codegen.hcl.Range): Diagnostic = copy(context = Option(__v)) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = severity.javaValueDescriptor + if (__t.getNumber() != 0) __t else null + } + case 2 => { + val __t = summary + if (__t != "") __t else null + } + case 3 => { + val __t = detail + if (__t != "") __t else null + } + case 4 => subject.orNull + case 5 => context.orNull + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PEnum(severity.scalaValueDescriptor) + case 2 => _root_.scalapb.descriptors.PString(summary) + case 3 => _root_.scalapb.descriptors.PString(detail) + case 4 => subject.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 5 => context.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.codegen.hcl.Diagnostic.type = pulumirpc.codegen.hcl.Diagnostic + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.codegen.Diagnostic]) +} + +object Diagnostic extends scalapb.GeneratedMessageCompanion[pulumirpc.codegen.hcl.Diagnostic] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.codegen.hcl.Diagnostic] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.codegen.hcl.Diagnostic = { + var __severity: pulumirpc.codegen.hcl.DiagnosticSeverity = pulumirpc.codegen.hcl.DiagnosticSeverity.DIAG_INVALID + var __summary: _root_.scala.Predef.String = "" + var __detail: _root_.scala.Predef.String = "" + var __subject: _root_.scala.Option[pulumirpc.codegen.hcl.Range] = _root_.scala.None + var __context: _root_.scala.Option[pulumirpc.codegen.hcl.Range] = _root_.scala.None + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 8 => + __severity = pulumirpc.codegen.hcl.DiagnosticSeverity.fromValue(_input__.readEnum()) + case 18 => + __summary = _input__.readStringRequireUtf8() + case 26 => + __detail = _input__.readStringRequireUtf8() + case 34 => + __subject = _root_.scala.Option(__subject.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.codegen.hcl.Range](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case 42 => + __context = _root_.scala.Option(__context.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.codegen.hcl.Range](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.codegen.hcl.Diagnostic( + severity = __severity, + summary = __summary, + detail = __detail, + subject = __subject, + context = __context, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.codegen.hcl.Diagnostic] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.codegen.hcl.Diagnostic( + severity = pulumirpc.codegen.hcl.DiagnosticSeverity.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(pulumirpc.codegen.hcl.DiagnosticSeverity.DIAG_INVALID.scalaValueDescriptor).number), + summary = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + detail = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + subject = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[pulumirpc.codegen.hcl.Range]]), + context = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).flatMap(_.as[_root_.scala.Option[pulumirpc.codegen.hcl.Range]]) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = HclProto.javaDescriptor.getMessageTypes().get(2) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = HclProto.scalaDescriptor.messages(2) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 4 => __out = pulumirpc.codegen.hcl.Range + case 5 => __out = pulumirpc.codegen.hcl.Range + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => pulumirpc.codegen.hcl.DiagnosticSeverity + } + } + lazy val defaultInstance = pulumirpc.codegen.hcl.Diagnostic( + severity = pulumirpc.codegen.hcl.DiagnosticSeverity.DIAG_INVALID, + summary = "", + detail = "", + subject = _root_.scala.None, + context = _root_.scala.None + ) + implicit class DiagnosticLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.codegen.hcl.Diagnostic]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.codegen.hcl.Diagnostic](_l) { + def severity: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.codegen.hcl.DiagnosticSeverity] = field(_.severity)((c_, f_) => c_.copy(severity = f_)) + def summary: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.summary)((c_, f_) => c_.copy(summary = f_)) + def detail: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.detail)((c_, f_) => c_.copy(detail = f_)) + def subject: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.codegen.hcl.Range] = field(_.getSubject)((c_, f_) => c_.copy(subject = _root_.scala.Option(f_))) + def optionalSubject: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.codegen.hcl.Range]] = field(_.subject)((c_, f_) => c_.copy(subject = f_)) + def context: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.codegen.hcl.Range] = field(_.getContext)((c_, f_) => c_.copy(context = _root_.scala.Option(f_))) + def optionalContext: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.codegen.hcl.Range]] = field(_.context)((c_, f_) => c_.copy(context = f_)) + } + final val SEVERITY_FIELD_NUMBER = 1 + final val SUMMARY_FIELD_NUMBER = 2 + final val DETAIL_FIELD_NUMBER = 3 + final val SUBJECT_FIELD_NUMBER = 4 + final val CONTEXT_FIELD_NUMBER = 5 + def of( + severity: pulumirpc.codegen.hcl.DiagnosticSeverity, + summary: _root_.scala.Predef.String, + detail: _root_.scala.Predef.String, + subject: _root_.scala.Option[pulumirpc.codegen.hcl.Range], + context: _root_.scala.Option[pulumirpc.codegen.hcl.Range] + ): _root_.pulumirpc.codegen.hcl.Diagnostic = _root_.pulumirpc.codegen.hcl.Diagnostic( + severity, + summary, + detail, + subject, + context + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.codegen.Diagnostic]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/DiagnosticSeverity.scala b/core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/DiagnosticSeverity.scala new file mode 100644 index 00000000..e993be77 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/DiagnosticSeverity.scala @@ -0,0 +1,65 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.codegen.hcl + +/** DiagnosticSeverity is the severity level of a diagnostic message. + */ +sealed abstract class DiagnosticSeverity(val value: _root_.scala.Int) extends _root_.scalapb.GeneratedEnum { + type EnumType = pulumirpc.codegen.hcl.DiagnosticSeverity + type RecognizedType = pulumirpc.codegen.hcl.DiagnosticSeverity.Recognized + def isDiagInvalid: _root_.scala.Boolean = false + def isDiagError: _root_.scala.Boolean = false + def isDiagWarning: _root_.scala.Boolean = false + def companion: _root_.scalapb.GeneratedEnumCompanion[DiagnosticSeverity] = pulumirpc.codegen.hcl.DiagnosticSeverity + final def asRecognized: _root_.scala.Option[pulumirpc.codegen.hcl.DiagnosticSeverity.Recognized] = if (isUnrecognized) _root_.scala.None else _root_.scala.Some(this.asInstanceOf[pulumirpc.codegen.hcl.DiagnosticSeverity.Recognized]) +} + +object DiagnosticSeverity extends _root_.scalapb.GeneratedEnumCompanion[DiagnosticSeverity] { + sealed trait Recognized extends DiagnosticSeverity + implicit def enumCompanion: _root_.scalapb.GeneratedEnumCompanion[DiagnosticSeverity] = this + + /** DIAG_INVALID is the invalid zero value of DiagnosticSeverity + */ + @SerialVersionUID(0L) + case object DIAG_INVALID extends DiagnosticSeverity(0) with DiagnosticSeverity.Recognized { + val index = 0 + val name = "DIAG_INVALID" + override def isDiagInvalid: _root_.scala.Boolean = true + } + + /** DIAG_ERROR indicates that the problem reported by a diagnostic prevents + * further progress in parsing and/or evaluating the subject. + */ + @SerialVersionUID(0L) + case object DIAG_ERROR extends DiagnosticSeverity(1) with DiagnosticSeverity.Recognized { + val index = 1 + val name = "DIAG_ERROR" + override def isDiagError: _root_.scala.Boolean = true + } + + /** DIAG_WARNING indicates that the problem reported by a diagnostic warrants + * user attention but does not prevent further progress. It is most + * commonly used for showing deprecation notices. + */ + @SerialVersionUID(0L) + case object DIAG_WARNING extends DiagnosticSeverity(2) with DiagnosticSeverity.Recognized { + val index = 2 + val name = "DIAG_WARNING" + override def isDiagWarning: _root_.scala.Boolean = true + } + + @SerialVersionUID(0L) + final case class Unrecognized(unrecognizedValue: _root_.scala.Int) extends DiagnosticSeverity(unrecognizedValue) with _root_.scalapb.UnrecognizedEnum + lazy val values: scala.collection.immutable.Seq[ValueType] = scala.collection.immutable.Seq(DIAG_INVALID, DIAG_ERROR, DIAG_WARNING) + def fromValue(__value: _root_.scala.Int): DiagnosticSeverity = __value match { + case 0 => DIAG_INVALID + case 1 => DIAG_ERROR + case 2 => DIAG_WARNING + case __other => Unrecognized(__other) + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.EnumDescriptor = HclProto.javaDescriptor.getEnumTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.EnumDescriptor = HclProto.scalaDescriptor.enums(0) +} \ No newline at end of file diff --git a/core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/HclProto.scala b/core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/HclProto.scala new file mode 100644 index 00000000..3fee8491 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/HclProto.scala @@ -0,0 +1,41 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.codegen.hcl + +object HclProto extends _root_.scalapb.GeneratedFileObject { + lazy val dependencies: Seq[_root_.scalapb.GeneratedFileObject] = Seq.empty + lazy val messagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( + pulumirpc.codegen.hcl.Pos, + pulumirpc.codegen.hcl.Range, + pulumirpc.codegen.hcl.Diagnostic + ) + private lazy val ProtoBytes: _root_.scala.Array[Byte] = + scalapb.Encoding.fromBase64(scala.collection.immutable.Seq( + """ChhwdWx1bWkvY29kZWdlbi9oY2wucHJvdG8SEXB1bHVtaXJwYy5jb2RlZ2VuImgKA1BvcxIdCgRsaW5lGAEgASgDQgniPwYSB + GxpbmVSBGxpbmUSIwoGY29sdW1uGAIgASgDQgviPwgSBmNvbHVtblIGY29sdW1uEh0KBGJ5dGUYAyABKANCCeI/BhIEYnl0ZVIEY + nl0ZSKgAQoFUmFuZ2USKQoIZmlsZW5hbWUYASABKAlCDeI/ChIIZmlsZW5hbWVSCGZpbGVuYW1lEjgKBXN0YXJ0GAIgASgLMhYuc + HVsdW1pcnBjLmNvZGVnZW4uUG9zQgriPwcSBXN0YXJ0UgVzdGFydBIyCgNlbmQYAyABKAsyFi5wdWx1bWlycGMuY29kZWdlbi5Qb + 3NCCOI/BRIDZW5kUgNlbmQirwIKCkRpYWdub3N0aWMSUAoIc2V2ZXJpdHkYASABKA4yJS5wdWx1bWlycGMuY29kZWdlbi5EaWFnb + m9zdGljU2V2ZXJpdHlCDeI/ChIIc2V2ZXJpdHlSCHNldmVyaXR5EiYKB3N1bW1hcnkYAiABKAlCDOI/CRIHc3VtbWFyeVIHc3Vtb + WFyeRIjCgZkZXRhaWwYAyABKAlCC+I/CBIGZGV0YWlsUgZkZXRhaWwSQAoHc3ViamVjdBgEIAEoCzIYLnB1bHVtaXJwYy5jb2RlZ + 2VuLlJhbmdlQgziPwkSB3N1YmplY3RSB3N1YmplY3QSQAoHY29udGV4dBgFIAEoCzIYLnB1bHVtaXJwYy5jb2RlZ2VuLlJhbmdlQ + gziPwkSB2NvbnRleHRSB2NvbnRleHQqfwoSRGlhZ25vc3RpY1NldmVyaXR5EiMKDERJQUdfSU5WQUxJRBAAGhHiPw4SDERJQUdfS + U5WQUxJRBIfCgpESUFHX0VSUk9SEAEaD+I/DBIKRElBR19FUlJPUhIjCgxESUFHX1dBUk5JTkcQAhoR4j8OEgxESUFHX1dBUk5JT + kdCMlowZ2l0aHViLmNvbS9wdWx1bWkvcHVsdW1pL3Nkay92My9wcm90by9nby9jb2RlZ2VuYgZwcm90bzM=""" + ).mkString) + lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { + val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) + _root_.scalapb.descriptors.FileDescriptor.buildFrom(scalaProto, dependencies.map(_.scalaDescriptor)) + } + lazy val javaDescriptor: com.google.protobuf.Descriptors.FileDescriptor = { + val javaProto = com.google.protobuf.DescriptorProtos.FileDescriptorProto.parseFrom(ProtoBytes) + com.google.protobuf.Descriptors.FileDescriptor.buildFrom(javaProto, _root_.scala.Array( + )) + } + @deprecated("Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.", "ScalaPB 0.5.47") + def descriptor: com.google.protobuf.Descriptors.FileDescriptor = javaDescriptor +} \ No newline at end of file diff --git a/core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/Pos.scala b/core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/Pos.scala new file mode 100644 index 00000000..2a6fcc0e --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/Pos.scala @@ -0,0 +1,196 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.codegen.hcl + +/** Pos represents a single position in a source file, by addressing the start byte of a unicode character + * encoded in UTF-8. + * + * @param line + * Line is the source code line where this position points. Lines are counted starting at 1 and + * incremented for each newline character encountered. + * @param column + * Column is the source code column where this position points, in unicode characters, with counting + * starting at 1. + * + * Column counts characters as they appear visually, so for example a latin letter with a combining + * diacritic mark counts as one character. This is intended for rendering visual markers against source + * code in contexts where these diacritics would be rendered in a single character cell. Technically + * speaking, Column is counting grapheme clusters as used in unicode normalization. + * @param byte + * Byte is the byte offset into the file where the indicated character begins. This is a zero-based offset + * to the first byte of the first UTF-8 codepoint sequence in the character, and thus gives a position + * that can be resolved _without_ awareness of Unicode characters. + */ +@SerialVersionUID(0L) +final case class Pos( + line: _root_.scala.Long = 0L, + column: _root_.scala.Long = 0L, + byte: _root_.scala.Long = 0L, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Pos] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = line + if (__value != 0L) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(1, __value) + } + }; + + { + val __value = column + if (__value != 0L) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(2, __value) + } + }; + + { + val __value = byte + if (__value != 0L) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(3, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = line + if (__v != 0L) { + _output__.writeInt64(1, __v) + } + }; + { + val __v = column + if (__v != 0L) { + _output__.writeInt64(2, __v) + } + }; + { + val __v = byte + if (__v != 0L) { + _output__.writeInt64(3, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withLine(__v: _root_.scala.Long): Pos = copy(line = __v) + def withColumn(__v: _root_.scala.Long): Pos = copy(column = __v) + def withByte(__v: _root_.scala.Long): Pos = copy(byte = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = line + if (__t != 0L) __t else null + } + case 2 => { + val __t = column + if (__t != 0L) __t else null + } + case 3 => { + val __t = byte + if (__t != 0L) __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PLong(line) + case 2 => _root_.scalapb.descriptors.PLong(column) + case 3 => _root_.scalapb.descriptors.PLong(byte) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.codegen.hcl.Pos.type = pulumirpc.codegen.hcl.Pos + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.codegen.Pos]) +} + +object Pos extends scalapb.GeneratedMessageCompanion[pulumirpc.codegen.hcl.Pos] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.codegen.hcl.Pos] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.codegen.hcl.Pos = { + var __line: _root_.scala.Long = 0L + var __column: _root_.scala.Long = 0L + var __byte: _root_.scala.Long = 0L + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 8 => + __line = _input__.readInt64() + case 16 => + __column = _input__.readInt64() + case 24 => + __byte = _input__.readInt64() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.codegen.hcl.Pos( + line = __line, + column = __column, + byte = __byte, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.codegen.hcl.Pos] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.codegen.hcl.Pos( + line = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Long]).getOrElse(0L), + column = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Long]).getOrElse(0L), + byte = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Long]).getOrElse(0L) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = HclProto.javaDescriptor.getMessageTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = HclProto.scalaDescriptor.messages(0) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.codegen.hcl.Pos( + line = 0L, + column = 0L, + byte = 0L + ) + implicit class PosLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.codegen.hcl.Pos]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.codegen.hcl.Pos](_l) { + def line: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.line)((c_, f_) => c_.copy(line = f_)) + def column: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.column)((c_, f_) => c_.copy(column = f_)) + def byte: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.byte)((c_, f_) => c_.copy(byte = f_)) + } + final val LINE_FIELD_NUMBER = 1 + final val COLUMN_FIELD_NUMBER = 2 + final val BYTE_FIELD_NUMBER = 3 + def of( + line: _root_.scala.Long, + column: _root_.scala.Long, + byte: _root_.scala.Long + ): _root_.pulumirpc.codegen.hcl.Pos = _root_.pulumirpc.codegen.hcl.Pos( + line, + column, + byte + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.codegen.Pos]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/Range.scala b/core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/Range.scala new file mode 100644 index 00000000..0e8be286 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/Range.scala @@ -0,0 +1,185 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.codegen.hcl + +/** Range represents a span of characters between two positions in a source file. + * + * @param filename + * Filename is the name of the file into which this range's positions point. + * @param start + * Start and End represent the bounds of this range. Start is inclusive and End is exclusive. + */ +@SerialVersionUID(0L) +final case class Range( + filename: _root_.scala.Predef.String = "", + start: _root_.scala.Option[pulumirpc.codegen.hcl.Pos] = _root_.scala.None, + end: _root_.scala.Option[pulumirpc.codegen.hcl.Pos] = _root_.scala.None, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Range] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = filename + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + if (start.isDefined) { + val __value = start.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + if (end.isDefined) { + val __value = end.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = filename + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + start.foreach { __v => + val __m = __v + _output__.writeTag(2, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + end.foreach { __v => + val __m = __v + _output__.writeTag(3, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def withFilename(__v: _root_.scala.Predef.String): Range = copy(filename = __v) + def getStart: pulumirpc.codegen.hcl.Pos = start.getOrElse(pulumirpc.codegen.hcl.Pos.defaultInstance) + def clearStart: Range = copy(start = _root_.scala.None) + def withStart(__v: pulumirpc.codegen.hcl.Pos): Range = copy(start = Option(__v)) + def getEnd: pulumirpc.codegen.hcl.Pos = end.getOrElse(pulumirpc.codegen.hcl.Pos.defaultInstance) + def clearEnd: Range = copy(end = _root_.scala.None) + def withEnd(__v: pulumirpc.codegen.hcl.Pos): Range = copy(end = Option(__v)) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = filename + if (__t != "") __t else null + } + case 2 => start.orNull + case 3 => end.orNull + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(filename) + case 2 => start.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 3 => end.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.codegen.hcl.Range.type = pulumirpc.codegen.hcl.Range + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.codegen.Range]) +} + +object Range extends scalapb.GeneratedMessageCompanion[pulumirpc.codegen.hcl.Range] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.codegen.hcl.Range] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.codegen.hcl.Range = { + var __filename: _root_.scala.Predef.String = "" + var __start: _root_.scala.Option[pulumirpc.codegen.hcl.Pos] = _root_.scala.None + var __end: _root_.scala.Option[pulumirpc.codegen.hcl.Pos] = _root_.scala.None + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __filename = _input__.readStringRequireUtf8() + case 18 => + __start = _root_.scala.Option(__start.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.codegen.hcl.Pos](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case 26 => + __end = _root_.scala.Option(__end.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.codegen.hcl.Pos](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.codegen.hcl.Range( + filename = __filename, + start = __start, + end = __end, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.codegen.hcl.Range] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.codegen.hcl.Range( + filename = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + start = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[pulumirpc.codegen.hcl.Pos]]), + end = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[pulumirpc.codegen.hcl.Pos]]) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = HclProto.javaDescriptor.getMessageTypes().get(1) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = HclProto.scalaDescriptor.messages(1) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 2 => __out = pulumirpc.codegen.hcl.Pos + case 3 => __out = pulumirpc.codegen.hcl.Pos + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.codegen.hcl.Range( + filename = "", + start = _root_.scala.None, + end = _root_.scala.None + ) + implicit class RangeLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.codegen.hcl.Range]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.codegen.hcl.Range](_l) { + def filename: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.filename)((c_, f_) => c_.copy(filename = f_)) + def start: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.codegen.hcl.Pos] = field(_.getStart)((c_, f_) => c_.copy(start = _root_.scala.Option(f_))) + def optionalStart: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.codegen.hcl.Pos]] = field(_.start)((c_, f_) => c_.copy(start = f_)) + def end: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.codegen.hcl.Pos] = field(_.getEnd)((c_, f_) => c_.copy(end = _root_.scala.Option(f_))) + def optionalEnd: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.codegen.hcl.Pos]] = field(_.end)((c_, f_) => c_.copy(end = f_)) + } + final val FILENAME_FIELD_NUMBER = 1 + final val START_FIELD_NUMBER = 2 + final val END_FIELD_NUMBER = 3 + def of( + filename: _root_.scala.Predef.String, + start: _root_.scala.Option[pulumirpc.codegen.hcl.Pos], + end: _root_.scala.Option[pulumirpc.codegen.hcl.Pos] + ): _root_.pulumirpc.codegen.hcl.Range = _root_.pulumirpc.codegen.hcl.Range( + filename, + start, + end + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.codegen.Range]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/AboutResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/AboutResponse.scala new file mode 100644 index 00000000..7f521561 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/AboutResponse.scala @@ -0,0 +1,338 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** AboutResponse returns runtime information about the language. + * + * @param executable + * the primary executable for the runtime of this language. + * @param version + * the version of the runtime for this language. + * @param metadata + * other information about this language. + */ +@SerialVersionUID(0L) +final case class AboutResponse( + executable: _root_.scala.Predef.String = "", + version: _root_.scala.Predef.String = "", + metadata: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String] = _root_.scala.collection.immutable.Map.empty, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[AboutResponse] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = executable + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = version + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + metadata.foreach { __item => + val __value = pulumirpc.language.AboutResponse._typemapper_metadata.toBase(__item) + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = executable + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = version + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + metadata.foreach { __v => + val __m = pulumirpc.language.AboutResponse._typemapper_metadata.toBase(__v) + _output__.writeTag(3, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def withExecutable(__v: _root_.scala.Predef.String): AboutResponse = copy(executable = __v) + def withVersion(__v: _root_.scala.Predef.String): AboutResponse = copy(version = __v) + def clearMetadata = copy(metadata = _root_.scala.collection.immutable.Map.empty) + def addMetadata(__vs: (_root_.scala.Predef.String, _root_.scala.Predef.String) *): AboutResponse = addAllMetadata(__vs) + def addAllMetadata(__vs: Iterable[(_root_.scala.Predef.String, _root_.scala.Predef.String)]): AboutResponse = copy(metadata = metadata ++ __vs) + def withMetadata(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]): AboutResponse = copy(metadata = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = executable + if (__t != "") __t else null + } + case 2 => { + val __t = version + if (__t != "") __t else null + } + case 3 => metadata.iterator.map(pulumirpc.language.AboutResponse._typemapper_metadata.toBase(_)).toSeq + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(executable) + case 2 => _root_.scalapb.descriptors.PString(version) + case 3 => _root_.scalapb.descriptors.PRepeated(metadata.iterator.map(pulumirpc.language.AboutResponse._typemapper_metadata.toBase(_).toPMessage).toVector) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.AboutResponse.type = pulumirpc.language.AboutResponse + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.AboutResponse]) +} + +object AboutResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.language.AboutResponse] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.AboutResponse] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.AboutResponse = { + var __executable: _root_.scala.Predef.String = "" + var __version: _root_.scala.Predef.String = "" + val __metadata: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, _root_.scala.Predef.String), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, _root_.scala.Predef.String] + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __executable = _input__.readStringRequireUtf8() + case 18 => + __version = _input__.readStringRequireUtf8() + case 26 => + __metadata += pulumirpc.language.AboutResponse._typemapper_metadata.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.language.AboutResponse.MetadataEntry](_input__)) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.AboutResponse( + executable = __executable, + version = __version, + metadata = __metadata.result(), + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.AboutResponse] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.AboutResponse( + executable = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + version = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + metadata = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Seq[pulumirpc.language.AboutResponse.MetadataEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.language.AboutResponse._typemapper_metadata.toCustom(_)).toMap + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(1) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(1) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 3 => __out = pulumirpc.language.AboutResponse.MetadataEntry + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( + _root_.pulumirpc.language.AboutResponse.MetadataEntry + ) + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.AboutResponse( + executable = "", + version = "", + metadata = _root_.scala.collection.immutable.Map.empty + ) + @SerialVersionUID(0L) + final case class MetadataEntry( + key: _root_.scala.Predef.String = "", + value: _root_.scala.Predef.String = "", + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[MetadataEntry] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = key + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = value + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = key + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = value + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withKey(__v: _root_.scala.Predef.String): MetadataEntry = copy(key = __v) + def withValue(__v: _root_.scala.Predef.String): MetadataEntry = copy(value = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = key + if (__t != "") __t else null + } + case 2 => { + val __t = value + if (__t != "") __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(key) + case 2 => _root_.scalapb.descriptors.PString(value) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.AboutResponse.MetadataEntry.type = pulumirpc.language.AboutResponse.MetadataEntry + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.AboutResponse.MetadataEntry]) + } + + object MetadataEntry extends scalapb.GeneratedMessageCompanion[pulumirpc.language.AboutResponse.MetadataEntry] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.AboutResponse.MetadataEntry] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.AboutResponse.MetadataEntry = { + var __key: _root_.scala.Predef.String = "" + var __value: _root_.scala.Predef.String = "" + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __key = _input__.readStringRequireUtf8() + case 18 => + __value = _input__.readStringRequireUtf8() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.AboutResponse.MetadataEntry( + key = __key, + value = __value, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.AboutResponse.MetadataEntry] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.AboutResponse.MetadataEntry( + key = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse("") + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = pulumirpc.language.AboutResponse.javaDescriptor.getNestedTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = pulumirpc.language.AboutResponse.scalaDescriptor.nestedMessages(0) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.AboutResponse.MetadataEntry( + key = "", + value = "" + ) + implicit class MetadataEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.AboutResponse.MetadataEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.AboutResponse.MetadataEntry](_l) { + def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) + def value: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.value)((c_, f_) => c_.copy(value = f_)) + } + final val KEY_FIELD_NUMBER = 1 + final val VALUE_FIELD_NUMBER = 2 + @transient + implicit val keyValueMapper: _root_.scalapb.TypeMapper[pulumirpc.language.AboutResponse.MetadataEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)] = + _root_.scalapb.TypeMapper[pulumirpc.language.AboutResponse.MetadataEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)](__m => (__m.key, __m.value))(__p => pulumirpc.language.AboutResponse.MetadataEntry(__p._1, __p._2)) + def of( + key: _root_.scala.Predef.String, + value: _root_.scala.Predef.String + ): _root_.pulumirpc.language.AboutResponse.MetadataEntry = _root_.pulumirpc.language.AboutResponse.MetadataEntry( + key, + value + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.AboutResponse.MetadataEntry]) + } + + implicit class AboutResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.AboutResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.AboutResponse](_l) { + def executable: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.executable)((c_, f_) => c_.copy(executable = f_)) + def version: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.version)((c_, f_) => c_.copy(version = f_)) + def metadata: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = field(_.metadata)((c_, f_) => c_.copy(metadata = f_)) + } + final val EXECUTABLE_FIELD_NUMBER = 1 + final val VERSION_FIELD_NUMBER = 2 + final val METADATA_FIELD_NUMBER = 3 + @transient + private[language] val _typemapper_metadata: _root_.scalapb.TypeMapper[pulumirpc.language.AboutResponse.MetadataEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.language.AboutResponse.MetadataEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)]] + def of( + executable: _root_.scala.Predef.String, + version: _root_.scala.Predef.String, + metadata: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String] + ): _root_.pulumirpc.language.AboutResponse = _root_.pulumirpc.language.AboutResponse( + executable, + version, + metadata + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.AboutResponse]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/DependencyInfo.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/DependencyInfo.scala new file mode 100644 index 00000000..76f554d0 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/DependencyInfo.scala @@ -0,0 +1,152 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param name + * The name of the dependency. + * @param version + * The version of the dependency. + */ +@SerialVersionUID(0L) +final case class DependencyInfo( + name: _root_.scala.Predef.String = "", + version: _root_.scala.Predef.String = "", + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[DependencyInfo] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = name + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = version + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = name + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = version + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withName(__v: _root_.scala.Predef.String): DependencyInfo = copy(name = __v) + def withVersion(__v: _root_.scala.Predef.String): DependencyInfo = copy(version = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = name + if (__t != "") __t else null + } + case 2 => { + val __t = version + if (__t != "") __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(name) + case 2 => _root_.scalapb.descriptors.PString(version) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.DependencyInfo.type = pulumirpc.language.DependencyInfo + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.DependencyInfo]) +} + +object DependencyInfo extends scalapb.GeneratedMessageCompanion[pulumirpc.language.DependencyInfo] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.DependencyInfo] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.DependencyInfo = { + var __name: _root_.scala.Predef.String = "" + var __version: _root_.scala.Predef.String = "" + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __name = _input__.readStringRequireUtf8() + case 18 => + __version = _input__.readStringRequireUtf8() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.DependencyInfo( + name = __name, + version = __version, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.DependencyInfo] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.DependencyInfo( + name = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + version = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse("") + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(3) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(3) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.DependencyInfo( + name = "", + version = "" + ) + implicit class DependencyInfoLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.DependencyInfo]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.DependencyInfo](_l) { + def name: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.name)((c_, f_) => c_.copy(name = f_)) + def version: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.version)((c_, f_) => c_.copy(version = f_)) + } + final val NAME_FIELD_NUMBER = 1 + final val VERSION_FIELD_NUMBER = 2 + def of( + name: _root_.scala.Predef.String, + version: _root_.scala.Predef.String + ): _root_.pulumirpc.language.DependencyInfo = _root_.pulumirpc.language.DependencyInfo( + name, + version + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.DependencyInfo]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/GeneratePackageRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/GeneratePackageRequest.scala new file mode 100644 index 00000000..ec509821 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/GeneratePackageRequest.scala @@ -0,0 +1,546 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param directory + * the directory to generate the package in. + * @param schema + * the JSON-encoded schema. + * @param extraFiles + * extra files to copy to the package output. + * @param loaderTarget + * The target of a codegen.LoaderServer to use for loading schemas. + * @param localDependencies + * local dependencies to use instead of using the package system. This is a map of package name to a local + * path of a language specific artifact to use for the SDK for that package. + */ +@SerialVersionUID(0L) +final case class GeneratePackageRequest( + directory: _root_.scala.Predef.String = "", + schema: _root_.scala.Predef.String = "", + extraFiles: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString] = _root_.scala.collection.immutable.Map.empty, + loaderTarget: _root_.scala.Predef.String = "", + localDependencies: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String] = _root_.scala.collection.immutable.Map.empty, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[GeneratePackageRequest] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = directory + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = schema + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + extraFiles.foreach { __item => + val __value = pulumirpc.language.GeneratePackageRequest._typemapper_extraFiles.toBase(__item) + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + + { + val __value = loaderTarget + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(4, __value) + } + }; + localDependencies.foreach { __item => + val __value = pulumirpc.language.GeneratePackageRequest._typemapper_localDependencies.toBase(__item) + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = directory + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = schema + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + extraFiles.foreach { __v => + val __m = pulumirpc.language.GeneratePackageRequest._typemapper_extraFiles.toBase(__v) + _output__.writeTag(3, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + { + val __v = loaderTarget + if (!__v.isEmpty) { + _output__.writeString(4, __v) + } + }; + localDependencies.foreach { __v => + val __m = pulumirpc.language.GeneratePackageRequest._typemapper_localDependencies.toBase(__v) + _output__.writeTag(5, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def withDirectory(__v: _root_.scala.Predef.String): GeneratePackageRequest = copy(directory = __v) + def withSchema(__v: _root_.scala.Predef.String): GeneratePackageRequest = copy(schema = __v) + def clearExtraFiles = copy(extraFiles = _root_.scala.collection.immutable.Map.empty) + def addExtraFiles(__vs: (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString) *): GeneratePackageRequest = addAllExtraFiles(__vs) + def addAllExtraFiles(__vs: Iterable[(_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)]): GeneratePackageRequest = copy(extraFiles = extraFiles ++ __vs) + def withExtraFiles(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]): GeneratePackageRequest = copy(extraFiles = __v) + def withLoaderTarget(__v: _root_.scala.Predef.String): GeneratePackageRequest = copy(loaderTarget = __v) + def clearLocalDependencies = copy(localDependencies = _root_.scala.collection.immutable.Map.empty) + def addLocalDependencies(__vs: (_root_.scala.Predef.String, _root_.scala.Predef.String) *): GeneratePackageRequest = addAllLocalDependencies(__vs) + def addAllLocalDependencies(__vs: Iterable[(_root_.scala.Predef.String, _root_.scala.Predef.String)]): GeneratePackageRequest = copy(localDependencies = localDependencies ++ __vs) + def withLocalDependencies(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]): GeneratePackageRequest = copy(localDependencies = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = directory + if (__t != "") __t else null + } + case 2 => { + val __t = schema + if (__t != "") __t else null + } + case 3 => extraFiles.iterator.map(pulumirpc.language.GeneratePackageRequest._typemapper_extraFiles.toBase(_)).toSeq + case 4 => { + val __t = loaderTarget + if (__t != "") __t else null + } + case 5 => localDependencies.iterator.map(pulumirpc.language.GeneratePackageRequest._typemapper_localDependencies.toBase(_)).toSeq + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(directory) + case 2 => _root_.scalapb.descriptors.PString(schema) + case 3 => _root_.scalapb.descriptors.PRepeated(extraFiles.iterator.map(pulumirpc.language.GeneratePackageRequest._typemapper_extraFiles.toBase(_).toPMessage).toVector) + case 4 => _root_.scalapb.descriptors.PString(loaderTarget) + case 5 => _root_.scalapb.descriptors.PRepeated(localDependencies.iterator.map(pulumirpc.language.GeneratePackageRequest._typemapper_localDependencies.toBase(_).toPMessage).toVector) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.GeneratePackageRequest.type = pulumirpc.language.GeneratePackageRequest + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.GeneratePackageRequest]) +} + +object GeneratePackageRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.language.GeneratePackageRequest] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.GeneratePackageRequest] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.GeneratePackageRequest = { + var __directory: _root_.scala.Predef.String = "" + var __schema: _root_.scala.Predef.String = "" + val __extraFiles: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString] + var __loaderTarget: _root_.scala.Predef.String = "" + val __localDependencies: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, _root_.scala.Predef.String), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, _root_.scala.Predef.String] + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __directory = _input__.readStringRequireUtf8() + case 18 => + __schema = _input__.readStringRequireUtf8() + case 26 => + __extraFiles += pulumirpc.language.GeneratePackageRequest._typemapper_extraFiles.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry](_input__)) + case 34 => + __loaderTarget = _input__.readStringRequireUtf8() + case 42 => + __localDependencies += pulumirpc.language.GeneratePackageRequest._typemapper_localDependencies.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry](_input__)) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.GeneratePackageRequest( + directory = __directory, + schema = __schema, + extraFiles = __extraFiles.result(), + loaderTarget = __loaderTarget, + localDependencies = __localDependencies.result(), + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.GeneratePackageRequest] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.GeneratePackageRequest( + directory = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + schema = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + extraFiles = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Seq[pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.language.GeneratePackageRequest._typemapper_extraFiles.toCustom(_)).toMap, + loaderTarget = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + localDependencies = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Seq[pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.language.GeneratePackageRequest._typemapper_localDependencies.toCustom(_)).toMap + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(17) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(17) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 3 => __out = pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry + case 5 => __out = pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( + _root_.pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry, + _root_.pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry + ) + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.GeneratePackageRequest( + directory = "", + schema = "", + extraFiles = _root_.scala.collection.immutable.Map.empty, + loaderTarget = "", + localDependencies = _root_.scala.collection.immutable.Map.empty + ) + @SerialVersionUID(0L) + final case class ExtraFilesEntry( + key: _root_.scala.Predef.String = "", + value: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ExtraFilesEntry] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = key + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = value + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = key + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = value + if (!__v.isEmpty) { + _output__.writeBytes(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withKey(__v: _root_.scala.Predef.String): ExtraFilesEntry = copy(key = __v) + def withValue(__v: _root_.com.google.protobuf.ByteString): ExtraFilesEntry = copy(value = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = key + if (__t != "") __t else null + } + case 2 => { + val __t = value + if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(key) + case 2 => _root_.scalapb.descriptors.PByteString(value) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry.type = pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.GeneratePackageRequest.ExtraFilesEntry]) + } + + object ExtraFilesEntry extends scalapb.GeneratedMessageCompanion[pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry = { + var __key: _root_.scala.Predef.String = "" + var __value: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __key = _input__.readStringRequireUtf8() + case 18 => + __value = _input__.readBytes() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry( + key = __key, + value = __value, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry( + key = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = pulumirpc.language.GeneratePackageRequest.javaDescriptor.getNestedTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = pulumirpc.language.GeneratePackageRequest.scalaDescriptor.nestedMessages(0) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry( + key = "", + value = _root_.com.google.protobuf.ByteString.EMPTY + ) + implicit class ExtraFilesEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry](_l) { + def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) + def value: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.value)((c_, f_) => c_.copy(value = f_)) + } + final val KEY_FIELD_NUMBER = 1 + final val VALUE_FIELD_NUMBER = 2 + @transient + implicit val keyValueMapper: _root_.scalapb.TypeMapper[pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)] = + _root_.scalapb.TypeMapper[pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)](__m => (__m.key, __m.value))(__p => pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry(__p._1, __p._2)) + def of( + key: _root_.scala.Predef.String, + value: _root_.com.google.protobuf.ByteString + ): _root_.pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry = _root_.pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry( + key, + value + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.GeneratePackageRequest.ExtraFilesEntry]) + } + + @SerialVersionUID(0L) + final case class LocalDependenciesEntry( + key: _root_.scala.Predef.String = "", + value: _root_.scala.Predef.String = "", + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[LocalDependenciesEntry] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = key + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = value + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = key + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = value + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withKey(__v: _root_.scala.Predef.String): LocalDependenciesEntry = copy(key = __v) + def withValue(__v: _root_.scala.Predef.String): LocalDependenciesEntry = copy(value = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = key + if (__t != "") __t else null + } + case 2 => { + val __t = value + if (__t != "") __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(key) + case 2 => _root_.scalapb.descriptors.PString(value) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry.type = pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.GeneratePackageRequest.LocalDependenciesEntry]) + } + + object LocalDependenciesEntry extends scalapb.GeneratedMessageCompanion[pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry = { + var __key: _root_.scala.Predef.String = "" + var __value: _root_.scala.Predef.String = "" + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __key = _input__.readStringRequireUtf8() + case 18 => + __value = _input__.readStringRequireUtf8() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry( + key = __key, + value = __value, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry( + key = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse("") + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = pulumirpc.language.GeneratePackageRequest.javaDescriptor.getNestedTypes().get(1) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = pulumirpc.language.GeneratePackageRequest.scalaDescriptor.nestedMessages(1) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry( + key = "", + value = "" + ) + implicit class LocalDependenciesEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry](_l) { + def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) + def value: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.value)((c_, f_) => c_.copy(value = f_)) + } + final val KEY_FIELD_NUMBER = 1 + final val VALUE_FIELD_NUMBER = 2 + @transient + implicit val keyValueMapper: _root_.scalapb.TypeMapper[pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)] = + _root_.scalapb.TypeMapper[pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)](__m => (__m.key, __m.value))(__p => pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry(__p._1, __p._2)) + def of( + key: _root_.scala.Predef.String, + value: _root_.scala.Predef.String + ): _root_.pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry = _root_.pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry( + key, + value + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.GeneratePackageRequest.LocalDependenciesEntry]) + } + + implicit class GeneratePackageRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.GeneratePackageRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.GeneratePackageRequest](_l) { + def directory: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.directory)((c_, f_) => c_.copy(directory = f_)) + def schema: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.schema)((c_, f_) => c_.copy(schema = f_)) + def extraFiles: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]] = field(_.extraFiles)((c_, f_) => c_.copy(extraFiles = f_)) + def loaderTarget: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.loaderTarget)((c_, f_) => c_.copy(loaderTarget = f_)) + def localDependencies: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = field(_.localDependencies)((c_, f_) => c_.copy(localDependencies = f_)) + } + final val DIRECTORY_FIELD_NUMBER = 1 + final val SCHEMA_FIELD_NUMBER = 2 + final val EXTRA_FILES_FIELD_NUMBER = 3 + final val LOADER_TARGET_FIELD_NUMBER = 4 + final val LOCAL_DEPENDENCIES_FIELD_NUMBER = 5 + @transient + private[language] val _typemapper_extraFiles: _root_.scalapb.TypeMapper[pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.language.GeneratePackageRequest.ExtraFilesEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)]] + @transient + private[language] val _typemapper_localDependencies: _root_.scalapb.TypeMapper[pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.language.GeneratePackageRequest.LocalDependenciesEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)]] + def of( + directory: _root_.scala.Predef.String, + schema: _root_.scala.Predef.String, + extraFiles: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString], + loaderTarget: _root_.scala.Predef.String, + localDependencies: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String] + ): _root_.pulumirpc.language.GeneratePackageRequest = _root_.pulumirpc.language.GeneratePackageRequest( + directory, + schema, + extraFiles, + loaderTarget, + localDependencies + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.GeneratePackageRequest]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/GeneratePackageResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/GeneratePackageResponse.scala new file mode 100644 index 00000000..edf5ce9c --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/GeneratePackageResponse.scala @@ -0,0 +1,123 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param diagnostics + * any diagnostics from code generation. + */ +@SerialVersionUID(0L) +final case class GeneratePackageResponse( + diagnostics: _root_.scala.Seq[pulumirpc.codegen.hcl.Diagnostic] = _root_.scala.Seq.empty, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[GeneratePackageResponse] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + diagnostics.foreach { __item => + val __value = __item + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + diagnostics.foreach { __v => + val __m = __v + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def clearDiagnostics = copy(diagnostics = _root_.scala.Seq.empty) + def addDiagnostics(__vs: pulumirpc.codegen.hcl.Diagnostic *): GeneratePackageResponse = addAllDiagnostics(__vs) + def addAllDiagnostics(__vs: Iterable[pulumirpc.codegen.hcl.Diagnostic]): GeneratePackageResponse = copy(diagnostics = diagnostics ++ __vs) + def withDiagnostics(__v: _root_.scala.Seq[pulumirpc.codegen.hcl.Diagnostic]): GeneratePackageResponse = copy(diagnostics = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => diagnostics + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PRepeated(diagnostics.iterator.map(_.toPMessage).toVector) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.GeneratePackageResponse.type = pulumirpc.language.GeneratePackageResponse + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.GeneratePackageResponse]) +} + +object GeneratePackageResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.language.GeneratePackageResponse] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.GeneratePackageResponse] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.GeneratePackageResponse = { + val __diagnostics: _root_.scala.collection.immutable.VectorBuilder[pulumirpc.codegen.hcl.Diagnostic] = new _root_.scala.collection.immutable.VectorBuilder[pulumirpc.codegen.hcl.Diagnostic] + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __diagnostics += _root_.scalapb.LiteParser.readMessage[pulumirpc.codegen.hcl.Diagnostic](_input__) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.GeneratePackageResponse( + diagnostics = __diagnostics.result(), + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.GeneratePackageResponse] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.GeneratePackageResponse( + diagnostics = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[pulumirpc.codegen.hcl.Diagnostic]]).getOrElse(_root_.scala.Seq.empty) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(18) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(18) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 1 => __out = pulumirpc.codegen.hcl.Diagnostic + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.GeneratePackageResponse( + diagnostics = _root_.scala.Seq.empty + ) + implicit class GeneratePackageResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.GeneratePackageResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.GeneratePackageResponse](_l) { + def diagnostics: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[pulumirpc.codegen.hcl.Diagnostic]] = field(_.diagnostics)((c_, f_) => c_.copy(diagnostics = f_)) + } + final val DIAGNOSTICS_FIELD_NUMBER = 1 + def of( + diagnostics: _root_.scala.Seq[pulumirpc.codegen.hcl.Diagnostic] + ): _root_.pulumirpc.language.GeneratePackageResponse = _root_.pulumirpc.language.GeneratePackageResponse( + diagnostics + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.GeneratePackageResponse]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/GenerateProgramRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/GenerateProgramRequest.scala new file mode 100644 index 00000000..f7f5ee8c --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/GenerateProgramRequest.scala @@ -0,0 +1,304 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param source + * the PCL source of the project. + * @param loaderTarget + * The target of a codegen.LoaderServer to use for loading schemas. + */ +@SerialVersionUID(0L) +final case class GenerateProgramRequest( + source: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String] = _root_.scala.collection.immutable.Map.empty, + loaderTarget: _root_.scala.Predef.String = "", + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[GenerateProgramRequest] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + source.foreach { __item => + val __value = pulumirpc.language.GenerateProgramRequest._typemapper_source.toBase(__item) + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + + { + val __value = loaderTarget + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + source.foreach { __v => + val __m = pulumirpc.language.GenerateProgramRequest._typemapper_source.toBase(__v) + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + { + val __v = loaderTarget + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def clearSource = copy(source = _root_.scala.collection.immutable.Map.empty) + def addSource(__vs: (_root_.scala.Predef.String, _root_.scala.Predef.String) *): GenerateProgramRequest = addAllSource(__vs) + def addAllSource(__vs: Iterable[(_root_.scala.Predef.String, _root_.scala.Predef.String)]): GenerateProgramRequest = copy(source = source ++ __vs) + def withSource(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]): GenerateProgramRequest = copy(source = __v) + def withLoaderTarget(__v: _root_.scala.Predef.String): GenerateProgramRequest = copy(loaderTarget = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => source.iterator.map(pulumirpc.language.GenerateProgramRequest._typemapper_source.toBase(_)).toSeq + case 2 => { + val __t = loaderTarget + if (__t != "") __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PRepeated(source.iterator.map(pulumirpc.language.GenerateProgramRequest._typemapper_source.toBase(_).toPMessage).toVector) + case 2 => _root_.scalapb.descriptors.PString(loaderTarget) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.GenerateProgramRequest.type = pulumirpc.language.GenerateProgramRequest + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.GenerateProgramRequest]) +} + +object GenerateProgramRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.language.GenerateProgramRequest] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.GenerateProgramRequest] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.GenerateProgramRequest = { + val __source: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, _root_.scala.Predef.String), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, _root_.scala.Predef.String] + var __loaderTarget: _root_.scala.Predef.String = "" + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __source += pulumirpc.language.GenerateProgramRequest._typemapper_source.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.language.GenerateProgramRequest.SourceEntry](_input__)) + case 18 => + __loaderTarget = _input__.readStringRequireUtf8() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.GenerateProgramRequest( + source = __source.result(), + loaderTarget = __loaderTarget, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.GenerateProgramRequest] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.GenerateProgramRequest( + source = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[pulumirpc.language.GenerateProgramRequest.SourceEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.language.GenerateProgramRequest._typemapper_source.toCustom(_)).toMap, + loaderTarget = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse("") + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(13) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(13) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 1 => __out = pulumirpc.language.GenerateProgramRequest.SourceEntry + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( + _root_.pulumirpc.language.GenerateProgramRequest.SourceEntry + ) + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.GenerateProgramRequest( + source = _root_.scala.collection.immutable.Map.empty, + loaderTarget = "" + ) + @SerialVersionUID(0L) + final case class SourceEntry( + key: _root_.scala.Predef.String = "", + value: _root_.scala.Predef.String = "", + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[SourceEntry] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = key + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = value + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = key + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = value + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withKey(__v: _root_.scala.Predef.String): SourceEntry = copy(key = __v) + def withValue(__v: _root_.scala.Predef.String): SourceEntry = copy(value = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = key + if (__t != "") __t else null + } + case 2 => { + val __t = value + if (__t != "") __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(key) + case 2 => _root_.scalapb.descriptors.PString(value) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.GenerateProgramRequest.SourceEntry.type = pulumirpc.language.GenerateProgramRequest.SourceEntry + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.GenerateProgramRequest.SourceEntry]) + } + + object SourceEntry extends scalapb.GeneratedMessageCompanion[pulumirpc.language.GenerateProgramRequest.SourceEntry] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.GenerateProgramRequest.SourceEntry] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.GenerateProgramRequest.SourceEntry = { + var __key: _root_.scala.Predef.String = "" + var __value: _root_.scala.Predef.String = "" + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __key = _input__.readStringRequireUtf8() + case 18 => + __value = _input__.readStringRequireUtf8() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.GenerateProgramRequest.SourceEntry( + key = __key, + value = __value, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.GenerateProgramRequest.SourceEntry] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.GenerateProgramRequest.SourceEntry( + key = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse("") + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = pulumirpc.language.GenerateProgramRequest.javaDescriptor.getNestedTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = pulumirpc.language.GenerateProgramRequest.scalaDescriptor.nestedMessages(0) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.GenerateProgramRequest.SourceEntry( + key = "", + value = "" + ) + implicit class SourceEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.GenerateProgramRequest.SourceEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.GenerateProgramRequest.SourceEntry](_l) { + def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) + def value: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.value)((c_, f_) => c_.copy(value = f_)) + } + final val KEY_FIELD_NUMBER = 1 + final val VALUE_FIELD_NUMBER = 2 + @transient + implicit val keyValueMapper: _root_.scalapb.TypeMapper[pulumirpc.language.GenerateProgramRequest.SourceEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)] = + _root_.scalapb.TypeMapper[pulumirpc.language.GenerateProgramRequest.SourceEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)](__m => (__m.key, __m.value))(__p => pulumirpc.language.GenerateProgramRequest.SourceEntry(__p._1, __p._2)) + def of( + key: _root_.scala.Predef.String, + value: _root_.scala.Predef.String + ): _root_.pulumirpc.language.GenerateProgramRequest.SourceEntry = _root_.pulumirpc.language.GenerateProgramRequest.SourceEntry( + key, + value + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.GenerateProgramRequest.SourceEntry]) + } + + implicit class GenerateProgramRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.GenerateProgramRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.GenerateProgramRequest](_l) { + def source: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = field(_.source)((c_, f_) => c_.copy(source = f_)) + def loaderTarget: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.loaderTarget)((c_, f_) => c_.copy(loaderTarget = f_)) + } + final val SOURCE_FIELD_NUMBER = 1 + final val LOADER_TARGET_FIELD_NUMBER = 2 + @transient + private[language] val _typemapper_source: _root_.scalapb.TypeMapper[pulumirpc.language.GenerateProgramRequest.SourceEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.language.GenerateProgramRequest.SourceEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)]] + def of( + source: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String], + loaderTarget: _root_.scala.Predef.String + ): _root_.pulumirpc.language.GenerateProgramRequest = _root_.pulumirpc.language.GenerateProgramRequest( + source, + loaderTarget + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.GenerateProgramRequest]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/GenerateProgramResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/GenerateProgramResponse.scala new file mode 100644 index 00000000..f32fa233 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/GenerateProgramResponse.scala @@ -0,0 +1,302 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param diagnostics + * any diagnostics from code generation. + * @param source + * the generated program source code. + */ +@SerialVersionUID(0L) +final case class GenerateProgramResponse( + diagnostics: _root_.scala.Seq[pulumirpc.codegen.hcl.Diagnostic] = _root_.scala.Seq.empty, + source: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString] = _root_.scala.collection.immutable.Map.empty, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[GenerateProgramResponse] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + diagnostics.foreach { __item => + val __value = __item + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + source.foreach { __item => + val __value = pulumirpc.language.GenerateProgramResponse._typemapper_source.toBase(__item) + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + diagnostics.foreach { __v => + val __m = __v + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + source.foreach { __v => + val __m = pulumirpc.language.GenerateProgramResponse._typemapper_source.toBase(__v) + _output__.writeTag(2, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def clearDiagnostics = copy(diagnostics = _root_.scala.Seq.empty) + def addDiagnostics(__vs: pulumirpc.codegen.hcl.Diagnostic *): GenerateProgramResponse = addAllDiagnostics(__vs) + def addAllDiagnostics(__vs: Iterable[pulumirpc.codegen.hcl.Diagnostic]): GenerateProgramResponse = copy(diagnostics = diagnostics ++ __vs) + def withDiagnostics(__v: _root_.scala.Seq[pulumirpc.codegen.hcl.Diagnostic]): GenerateProgramResponse = copy(diagnostics = __v) + def clearSource = copy(source = _root_.scala.collection.immutable.Map.empty) + def addSource(__vs: (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString) *): GenerateProgramResponse = addAllSource(__vs) + def addAllSource(__vs: Iterable[(_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)]): GenerateProgramResponse = copy(source = source ++ __vs) + def withSource(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]): GenerateProgramResponse = copy(source = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => diagnostics + case 2 => source.iterator.map(pulumirpc.language.GenerateProgramResponse._typemapper_source.toBase(_)).toSeq + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PRepeated(diagnostics.iterator.map(_.toPMessage).toVector) + case 2 => _root_.scalapb.descriptors.PRepeated(source.iterator.map(pulumirpc.language.GenerateProgramResponse._typemapper_source.toBase(_).toPMessage).toVector) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.GenerateProgramResponse.type = pulumirpc.language.GenerateProgramResponse + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.GenerateProgramResponse]) +} + +object GenerateProgramResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.language.GenerateProgramResponse] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.GenerateProgramResponse] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.GenerateProgramResponse = { + val __diagnostics: _root_.scala.collection.immutable.VectorBuilder[pulumirpc.codegen.hcl.Diagnostic] = new _root_.scala.collection.immutable.VectorBuilder[pulumirpc.codegen.hcl.Diagnostic] + val __source: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString] + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __diagnostics += _root_.scalapb.LiteParser.readMessage[pulumirpc.codegen.hcl.Diagnostic](_input__) + case 18 => + __source += pulumirpc.language.GenerateProgramResponse._typemapper_source.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.language.GenerateProgramResponse.SourceEntry](_input__)) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.GenerateProgramResponse( + diagnostics = __diagnostics.result(), + source = __source.result(), + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.GenerateProgramResponse] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.GenerateProgramResponse( + diagnostics = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[pulumirpc.codegen.hcl.Diagnostic]]).getOrElse(_root_.scala.Seq.empty), + source = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Seq[pulumirpc.language.GenerateProgramResponse.SourceEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.language.GenerateProgramResponse._typemapper_source.toCustom(_)).toMap + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(14) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(14) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 1 => __out = pulumirpc.codegen.hcl.Diagnostic + case 2 => __out = pulumirpc.language.GenerateProgramResponse.SourceEntry + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( + _root_.pulumirpc.language.GenerateProgramResponse.SourceEntry + ) + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.GenerateProgramResponse( + diagnostics = _root_.scala.Seq.empty, + source = _root_.scala.collection.immutable.Map.empty + ) + @SerialVersionUID(0L) + final case class SourceEntry( + key: _root_.scala.Predef.String = "", + value: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[SourceEntry] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = key + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = value + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = key + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = value + if (!__v.isEmpty) { + _output__.writeBytes(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withKey(__v: _root_.scala.Predef.String): SourceEntry = copy(key = __v) + def withValue(__v: _root_.com.google.protobuf.ByteString): SourceEntry = copy(value = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = key + if (__t != "") __t else null + } + case 2 => { + val __t = value + if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(key) + case 2 => _root_.scalapb.descriptors.PByteString(value) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.GenerateProgramResponse.SourceEntry.type = pulumirpc.language.GenerateProgramResponse.SourceEntry + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.GenerateProgramResponse.SourceEntry]) + } + + object SourceEntry extends scalapb.GeneratedMessageCompanion[pulumirpc.language.GenerateProgramResponse.SourceEntry] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.GenerateProgramResponse.SourceEntry] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.GenerateProgramResponse.SourceEntry = { + var __key: _root_.scala.Predef.String = "" + var __value: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __key = _input__.readStringRequireUtf8() + case 18 => + __value = _input__.readBytes() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.GenerateProgramResponse.SourceEntry( + key = __key, + value = __value, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.GenerateProgramResponse.SourceEntry] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.GenerateProgramResponse.SourceEntry( + key = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = pulumirpc.language.GenerateProgramResponse.javaDescriptor.getNestedTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = pulumirpc.language.GenerateProgramResponse.scalaDescriptor.nestedMessages(0) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.GenerateProgramResponse.SourceEntry( + key = "", + value = _root_.com.google.protobuf.ByteString.EMPTY + ) + implicit class SourceEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.GenerateProgramResponse.SourceEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.GenerateProgramResponse.SourceEntry](_l) { + def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) + def value: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.value)((c_, f_) => c_.copy(value = f_)) + } + final val KEY_FIELD_NUMBER = 1 + final val VALUE_FIELD_NUMBER = 2 + @transient + implicit val keyValueMapper: _root_.scalapb.TypeMapper[pulumirpc.language.GenerateProgramResponse.SourceEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)] = + _root_.scalapb.TypeMapper[pulumirpc.language.GenerateProgramResponse.SourceEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)](__m => (__m.key, __m.value))(__p => pulumirpc.language.GenerateProgramResponse.SourceEntry(__p._1, __p._2)) + def of( + key: _root_.scala.Predef.String, + value: _root_.com.google.protobuf.ByteString + ): _root_.pulumirpc.language.GenerateProgramResponse.SourceEntry = _root_.pulumirpc.language.GenerateProgramResponse.SourceEntry( + key, + value + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.GenerateProgramResponse.SourceEntry]) + } + + implicit class GenerateProgramResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.GenerateProgramResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.GenerateProgramResponse](_l) { + def diagnostics: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[pulumirpc.codegen.hcl.Diagnostic]] = field(_.diagnostics)((c_, f_) => c_.copy(diagnostics = f_)) + def source: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]] = field(_.source)((c_, f_) => c_.copy(source = f_)) + } + final val DIAGNOSTICS_FIELD_NUMBER = 1 + final val SOURCE_FIELD_NUMBER = 2 + @transient + private[language] val _typemapper_source: _root_.scalapb.TypeMapper[pulumirpc.language.GenerateProgramResponse.SourceEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.language.GenerateProgramResponse.SourceEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)]] + def of( + diagnostics: _root_.scala.Seq[pulumirpc.codegen.hcl.Diagnostic], + source: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString] + ): _root_.pulumirpc.language.GenerateProgramResponse = _root_.pulumirpc.language.GenerateProgramResponse( + diagnostics, + source + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.GenerateProgramResponse]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/GenerateProjectRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/GenerateProjectRequest.scala new file mode 100644 index 00000000..f75bbb2e --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/GenerateProjectRequest.scala @@ -0,0 +1,433 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param sourceDirectory + * the directory to generate the project from. + * @param targetDirectory + * the directory to generate the project in. + * @param project + * the JSON-encoded pulumi project file. + * @param strict + * if PCL binding should be strict or not. + * @param loaderTarget + * The target of a codegen.LoaderServer to use for loading schemas. + * @param localDependencies + * local dependencies to use instead of using the package system. This is a map of package name to a local + * path of a language specific artifact to use for the SDK for that package. + */ +@SerialVersionUID(0L) +final case class GenerateProjectRequest( + sourceDirectory: _root_.scala.Predef.String = "", + targetDirectory: _root_.scala.Predef.String = "", + project: _root_.scala.Predef.String = "", + strict: _root_.scala.Boolean = false, + loaderTarget: _root_.scala.Predef.String = "", + localDependencies: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String] = _root_.scala.collection.immutable.Map.empty, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[GenerateProjectRequest] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = sourceDirectory + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = targetDirectory + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + + { + val __value = project + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value) + } + }; + + { + val __value = strict + if (__value != false) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(4, __value) + } + }; + + { + val __value = loaderTarget + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(5, __value) + } + }; + localDependencies.foreach { __item => + val __value = pulumirpc.language.GenerateProjectRequest._typemapper_localDependencies.toBase(__item) + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = sourceDirectory + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = targetDirectory + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + { + val __v = project + if (!__v.isEmpty) { + _output__.writeString(3, __v) + } + }; + { + val __v = strict + if (__v != false) { + _output__.writeBool(4, __v) + } + }; + { + val __v = loaderTarget + if (!__v.isEmpty) { + _output__.writeString(5, __v) + } + }; + localDependencies.foreach { __v => + val __m = pulumirpc.language.GenerateProjectRequest._typemapper_localDependencies.toBase(__v) + _output__.writeTag(6, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def withSourceDirectory(__v: _root_.scala.Predef.String): GenerateProjectRequest = copy(sourceDirectory = __v) + def withTargetDirectory(__v: _root_.scala.Predef.String): GenerateProjectRequest = copy(targetDirectory = __v) + def withProject(__v: _root_.scala.Predef.String): GenerateProjectRequest = copy(project = __v) + def withStrict(__v: _root_.scala.Boolean): GenerateProjectRequest = copy(strict = __v) + def withLoaderTarget(__v: _root_.scala.Predef.String): GenerateProjectRequest = copy(loaderTarget = __v) + def clearLocalDependencies = copy(localDependencies = _root_.scala.collection.immutable.Map.empty) + def addLocalDependencies(__vs: (_root_.scala.Predef.String, _root_.scala.Predef.String) *): GenerateProjectRequest = addAllLocalDependencies(__vs) + def addAllLocalDependencies(__vs: Iterable[(_root_.scala.Predef.String, _root_.scala.Predef.String)]): GenerateProjectRequest = copy(localDependencies = localDependencies ++ __vs) + def withLocalDependencies(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]): GenerateProjectRequest = copy(localDependencies = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = sourceDirectory + if (__t != "") __t else null + } + case 2 => { + val __t = targetDirectory + if (__t != "") __t else null + } + case 3 => { + val __t = project + if (__t != "") __t else null + } + case 4 => { + val __t = strict + if (__t != false) __t else null + } + case 5 => { + val __t = loaderTarget + if (__t != "") __t else null + } + case 6 => localDependencies.iterator.map(pulumirpc.language.GenerateProjectRequest._typemapper_localDependencies.toBase(_)).toSeq + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(sourceDirectory) + case 2 => _root_.scalapb.descriptors.PString(targetDirectory) + case 3 => _root_.scalapb.descriptors.PString(project) + case 4 => _root_.scalapb.descriptors.PBoolean(strict) + case 5 => _root_.scalapb.descriptors.PString(loaderTarget) + case 6 => _root_.scalapb.descriptors.PRepeated(localDependencies.iterator.map(pulumirpc.language.GenerateProjectRequest._typemapper_localDependencies.toBase(_).toPMessage).toVector) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.GenerateProjectRequest.type = pulumirpc.language.GenerateProjectRequest + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.GenerateProjectRequest]) +} + +object GenerateProjectRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.language.GenerateProjectRequest] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.GenerateProjectRequest] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.GenerateProjectRequest = { + var __sourceDirectory: _root_.scala.Predef.String = "" + var __targetDirectory: _root_.scala.Predef.String = "" + var __project: _root_.scala.Predef.String = "" + var __strict: _root_.scala.Boolean = false + var __loaderTarget: _root_.scala.Predef.String = "" + val __localDependencies: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, _root_.scala.Predef.String), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, _root_.scala.Predef.String] + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __sourceDirectory = _input__.readStringRequireUtf8() + case 18 => + __targetDirectory = _input__.readStringRequireUtf8() + case 26 => + __project = _input__.readStringRequireUtf8() + case 32 => + __strict = _input__.readBool() + case 42 => + __loaderTarget = _input__.readStringRequireUtf8() + case 50 => + __localDependencies += pulumirpc.language.GenerateProjectRequest._typemapper_localDependencies.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry](_input__)) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.GenerateProjectRequest( + sourceDirectory = __sourceDirectory, + targetDirectory = __targetDirectory, + project = __project, + strict = __strict, + loaderTarget = __loaderTarget, + localDependencies = __localDependencies.result(), + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.GenerateProjectRequest] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.GenerateProjectRequest( + sourceDirectory = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + targetDirectory = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + project = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + strict = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Boolean]).getOrElse(false), + loaderTarget = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + localDependencies = __fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scala.Seq[pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.language.GenerateProjectRequest._typemapper_localDependencies.toCustom(_)).toMap + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(15) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(15) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 6 => __out = pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( + _root_.pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry + ) + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.GenerateProjectRequest( + sourceDirectory = "", + targetDirectory = "", + project = "", + strict = false, + loaderTarget = "", + localDependencies = _root_.scala.collection.immutable.Map.empty + ) + @SerialVersionUID(0L) + final case class LocalDependenciesEntry( + key: _root_.scala.Predef.String = "", + value: _root_.scala.Predef.String = "", + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[LocalDependenciesEntry] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = key + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = value + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = key + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = value + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withKey(__v: _root_.scala.Predef.String): LocalDependenciesEntry = copy(key = __v) + def withValue(__v: _root_.scala.Predef.String): LocalDependenciesEntry = copy(value = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = key + if (__t != "") __t else null + } + case 2 => { + val __t = value + if (__t != "") __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(key) + case 2 => _root_.scalapb.descriptors.PString(value) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry.type = pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.GenerateProjectRequest.LocalDependenciesEntry]) + } + + object LocalDependenciesEntry extends scalapb.GeneratedMessageCompanion[pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry = { + var __key: _root_.scala.Predef.String = "" + var __value: _root_.scala.Predef.String = "" + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __key = _input__.readStringRequireUtf8() + case 18 => + __value = _input__.readStringRequireUtf8() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry( + key = __key, + value = __value, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry( + key = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse("") + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = pulumirpc.language.GenerateProjectRequest.javaDescriptor.getNestedTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = pulumirpc.language.GenerateProjectRequest.scalaDescriptor.nestedMessages(0) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry( + key = "", + value = "" + ) + implicit class LocalDependenciesEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry](_l) { + def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) + def value: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.value)((c_, f_) => c_.copy(value = f_)) + } + final val KEY_FIELD_NUMBER = 1 + final val VALUE_FIELD_NUMBER = 2 + @transient + implicit val keyValueMapper: _root_.scalapb.TypeMapper[pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)] = + _root_.scalapb.TypeMapper[pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)](__m => (__m.key, __m.value))(__p => pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry(__p._1, __p._2)) + def of( + key: _root_.scala.Predef.String, + value: _root_.scala.Predef.String + ): _root_.pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry = _root_.pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry( + key, + value + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.GenerateProjectRequest.LocalDependenciesEntry]) + } + + implicit class GenerateProjectRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.GenerateProjectRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.GenerateProjectRequest](_l) { + def sourceDirectory: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.sourceDirectory)((c_, f_) => c_.copy(sourceDirectory = f_)) + def targetDirectory: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.targetDirectory)((c_, f_) => c_.copy(targetDirectory = f_)) + def project: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.project)((c_, f_) => c_.copy(project = f_)) + def strict: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.strict)((c_, f_) => c_.copy(strict = f_)) + def loaderTarget: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.loaderTarget)((c_, f_) => c_.copy(loaderTarget = f_)) + def localDependencies: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = field(_.localDependencies)((c_, f_) => c_.copy(localDependencies = f_)) + } + final val SOURCE_DIRECTORY_FIELD_NUMBER = 1 + final val TARGET_DIRECTORY_FIELD_NUMBER = 2 + final val PROJECT_FIELD_NUMBER = 3 + final val STRICT_FIELD_NUMBER = 4 + final val LOADER_TARGET_FIELD_NUMBER = 5 + final val LOCAL_DEPENDENCIES_FIELD_NUMBER = 6 + @transient + private[language] val _typemapper_localDependencies: _root_.scalapb.TypeMapper[pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.language.GenerateProjectRequest.LocalDependenciesEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)]] + def of( + sourceDirectory: _root_.scala.Predef.String, + targetDirectory: _root_.scala.Predef.String, + project: _root_.scala.Predef.String, + strict: _root_.scala.Boolean, + loaderTarget: _root_.scala.Predef.String, + localDependencies: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String] + ): _root_.pulumirpc.language.GenerateProjectRequest = _root_.pulumirpc.language.GenerateProjectRequest( + sourceDirectory, + targetDirectory, + project, + strict, + loaderTarget, + localDependencies + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.GenerateProjectRequest]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/GenerateProjectResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/GenerateProjectResponse.scala new file mode 100644 index 00000000..18f3379a --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/GenerateProjectResponse.scala @@ -0,0 +1,123 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param diagnostics + * any diagnostics from code generation. + */ +@SerialVersionUID(0L) +final case class GenerateProjectResponse( + diagnostics: _root_.scala.Seq[pulumirpc.codegen.hcl.Diagnostic] = _root_.scala.Seq.empty, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[GenerateProjectResponse] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + diagnostics.foreach { __item => + val __value = __item + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + diagnostics.foreach { __v => + val __m = __v + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def clearDiagnostics = copy(diagnostics = _root_.scala.Seq.empty) + def addDiagnostics(__vs: pulumirpc.codegen.hcl.Diagnostic *): GenerateProjectResponse = addAllDiagnostics(__vs) + def addAllDiagnostics(__vs: Iterable[pulumirpc.codegen.hcl.Diagnostic]): GenerateProjectResponse = copy(diagnostics = diagnostics ++ __vs) + def withDiagnostics(__v: _root_.scala.Seq[pulumirpc.codegen.hcl.Diagnostic]): GenerateProjectResponse = copy(diagnostics = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => diagnostics + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PRepeated(diagnostics.iterator.map(_.toPMessage).toVector) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.GenerateProjectResponse.type = pulumirpc.language.GenerateProjectResponse + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.GenerateProjectResponse]) +} + +object GenerateProjectResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.language.GenerateProjectResponse] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.GenerateProjectResponse] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.GenerateProjectResponse = { + val __diagnostics: _root_.scala.collection.immutable.VectorBuilder[pulumirpc.codegen.hcl.Diagnostic] = new _root_.scala.collection.immutable.VectorBuilder[pulumirpc.codegen.hcl.Diagnostic] + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __diagnostics += _root_.scalapb.LiteParser.readMessage[pulumirpc.codegen.hcl.Diagnostic](_input__) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.GenerateProjectResponse( + diagnostics = __diagnostics.result(), + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.GenerateProjectResponse] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.GenerateProjectResponse( + diagnostics = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[pulumirpc.codegen.hcl.Diagnostic]]).getOrElse(_root_.scala.Seq.empty) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(16) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(16) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 1 => __out = pulumirpc.codegen.hcl.Diagnostic + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.GenerateProjectResponse( + diagnostics = _root_.scala.Seq.empty + ) + implicit class GenerateProjectResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.GenerateProjectResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.GenerateProjectResponse](_l) { + def diagnostics: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[pulumirpc.codegen.hcl.Diagnostic]] = field(_.diagnostics)((c_, f_) => c_.copy(diagnostics = f_)) + } + final val DIAGNOSTICS_FIELD_NUMBER = 1 + def of( + diagnostics: _root_.scala.Seq[pulumirpc.codegen.hcl.Diagnostic] + ): _root_.pulumirpc.language.GenerateProjectResponse = _root_.pulumirpc.language.GenerateProjectResponse( + diagnostics + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.GenerateProjectResponse]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/GetProgramDependenciesRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/GetProgramDependenciesRequest.scala new file mode 100644 index 00000000..2b993bca --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/GetProgramDependenciesRequest.scala @@ -0,0 +1,251 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param project + * the project name, the engine always sets this to "deprecated" now. + * @param pwd + * the program's working directory. + * @param program + * the path to the program. + * @param transitiveDependencies + * if transitive dependencies should be included in the result. + * @param info + * the program info to use to calculate dependencies. + */ +@SerialVersionUID(0L) +final case class GetProgramDependenciesRequest( + @scala.deprecated(message="Marked as deprecated in proto file", "") project: _root_.scala.Predef.String = "", + @scala.deprecated(message="Marked as deprecated in proto file", "") pwd: _root_.scala.Predef.String = "", + @scala.deprecated(message="Marked as deprecated in proto file", "") program: _root_.scala.Predef.String = "", + transitiveDependencies: _root_.scala.Boolean = false, + info: _root_.scala.Option[pulumirpc.language.ProgramInfo] = _root_.scala.None, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[GetProgramDependenciesRequest] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = project + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = pwd + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + + { + val __value = program + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value) + } + }; + + { + val __value = transitiveDependencies + if (__value != false) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(4, __value) + } + }; + if (info.isDefined) { + val __value = info.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = project + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = pwd + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + { + val __v = program + if (!__v.isEmpty) { + _output__.writeString(3, __v) + } + }; + { + val __v = transitiveDependencies + if (__v != false) { + _output__.writeBool(4, __v) + } + }; + info.foreach { __v => + val __m = __v + _output__.writeTag(5, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def withProject(__v: _root_.scala.Predef.String): GetProgramDependenciesRequest = copy(project = __v) + def withPwd(__v: _root_.scala.Predef.String): GetProgramDependenciesRequest = copy(pwd = __v) + def withProgram(__v: _root_.scala.Predef.String): GetProgramDependenciesRequest = copy(program = __v) + def withTransitiveDependencies(__v: _root_.scala.Boolean): GetProgramDependenciesRequest = copy(transitiveDependencies = __v) + def getInfo: pulumirpc.language.ProgramInfo = info.getOrElse(pulumirpc.language.ProgramInfo.defaultInstance) + def clearInfo: GetProgramDependenciesRequest = copy(info = _root_.scala.None) + def withInfo(__v: pulumirpc.language.ProgramInfo): GetProgramDependenciesRequest = copy(info = Option(__v)) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = project + if (__t != "") __t else null + } + case 2 => { + val __t = pwd + if (__t != "") __t else null + } + case 3 => { + val __t = program + if (__t != "") __t else null + } + case 4 => { + val __t = transitiveDependencies + if (__t != false) __t else null + } + case 5 => info.orNull + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(project) + case 2 => _root_.scalapb.descriptors.PString(pwd) + case 3 => _root_.scalapb.descriptors.PString(program) + case 4 => _root_.scalapb.descriptors.PBoolean(transitiveDependencies) + case 5 => info.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.GetProgramDependenciesRequest.type = pulumirpc.language.GetProgramDependenciesRequest + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.GetProgramDependenciesRequest]) +} + +object GetProgramDependenciesRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.language.GetProgramDependenciesRequest] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.GetProgramDependenciesRequest] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.GetProgramDependenciesRequest = { + var __project: _root_.scala.Predef.String = "" + var __pwd: _root_.scala.Predef.String = "" + var __program: _root_.scala.Predef.String = "" + var __transitiveDependencies: _root_.scala.Boolean = false + var __info: _root_.scala.Option[pulumirpc.language.ProgramInfo] = _root_.scala.None + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __project = _input__.readStringRequireUtf8() + case 18 => + __pwd = _input__.readStringRequireUtf8() + case 26 => + __program = _input__.readStringRequireUtf8() + case 32 => + __transitiveDependencies = _input__.readBool() + case 42 => + __info = _root_.scala.Option(__info.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.language.ProgramInfo](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.GetProgramDependenciesRequest( + project = __project, + pwd = __pwd, + program = __program, + transitiveDependencies = __transitiveDependencies, + info = __info, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.GetProgramDependenciesRequest] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.GetProgramDependenciesRequest( + project = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + pwd = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + program = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + transitiveDependencies = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Boolean]).getOrElse(false), + info = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).flatMap(_.as[_root_.scala.Option[pulumirpc.language.ProgramInfo]]) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(2) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(2) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 5 => __out = pulumirpc.language.ProgramInfo + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.GetProgramDependenciesRequest( + project = "", + pwd = "", + program = "", + transitiveDependencies = false, + info = _root_.scala.None + ) + implicit class GetProgramDependenciesRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.GetProgramDependenciesRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.GetProgramDependenciesRequest](_l) { + def project: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.project)((c_, f_) => c_.copy(project = f_)) + def pwd: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.pwd)((c_, f_) => c_.copy(pwd = f_)) + def program: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.program)((c_, f_) => c_.copy(program = f_)) + def transitiveDependencies: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.transitiveDependencies)((c_, f_) => c_.copy(transitiveDependencies = f_)) + def info: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.ProgramInfo] = field(_.getInfo)((c_, f_) => c_.copy(info = _root_.scala.Option(f_))) + def optionalInfo: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.language.ProgramInfo]] = field(_.info)((c_, f_) => c_.copy(info = f_)) + } + final val PROJECT_FIELD_NUMBER = 1 + final val PWD_FIELD_NUMBER = 2 + final val PROGRAM_FIELD_NUMBER = 3 + final val TRANSITIVEDEPENDENCIES_FIELD_NUMBER = 4 + final val INFO_FIELD_NUMBER = 5 + def of( + project: _root_.scala.Predef.String, + pwd: _root_.scala.Predef.String, + program: _root_.scala.Predef.String, + transitiveDependencies: _root_.scala.Boolean, + info: _root_.scala.Option[pulumirpc.language.ProgramInfo] + ): _root_.pulumirpc.language.GetProgramDependenciesRequest = _root_.pulumirpc.language.GetProgramDependenciesRequest( + project, + pwd, + program, + transitiveDependencies, + info + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.GetProgramDependenciesRequest]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/GetProgramDependenciesResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/GetProgramDependenciesResponse.scala new file mode 100644 index 00000000..bd64391e --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/GetProgramDependenciesResponse.scala @@ -0,0 +1,123 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param dependencies + * the dependencies of this program + */ +@SerialVersionUID(0L) +final case class GetProgramDependenciesResponse( + dependencies: _root_.scala.Seq[pulumirpc.language.DependencyInfo] = _root_.scala.Seq.empty, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[GetProgramDependenciesResponse] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + dependencies.foreach { __item => + val __value = __item + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + dependencies.foreach { __v => + val __m = __v + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def clearDependencies = copy(dependencies = _root_.scala.Seq.empty) + def addDependencies(__vs: pulumirpc.language.DependencyInfo *): GetProgramDependenciesResponse = addAllDependencies(__vs) + def addAllDependencies(__vs: Iterable[pulumirpc.language.DependencyInfo]): GetProgramDependenciesResponse = copy(dependencies = dependencies ++ __vs) + def withDependencies(__v: _root_.scala.Seq[pulumirpc.language.DependencyInfo]): GetProgramDependenciesResponse = copy(dependencies = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => dependencies + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PRepeated(dependencies.iterator.map(_.toPMessage).toVector) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.GetProgramDependenciesResponse.type = pulumirpc.language.GetProgramDependenciesResponse + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.GetProgramDependenciesResponse]) +} + +object GetProgramDependenciesResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.language.GetProgramDependenciesResponse] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.GetProgramDependenciesResponse] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.GetProgramDependenciesResponse = { + val __dependencies: _root_.scala.collection.immutable.VectorBuilder[pulumirpc.language.DependencyInfo] = new _root_.scala.collection.immutable.VectorBuilder[pulumirpc.language.DependencyInfo] + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __dependencies += _root_.scalapb.LiteParser.readMessage[pulumirpc.language.DependencyInfo](_input__) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.GetProgramDependenciesResponse( + dependencies = __dependencies.result(), + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.GetProgramDependenciesResponse] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.GetProgramDependenciesResponse( + dependencies = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[pulumirpc.language.DependencyInfo]]).getOrElse(_root_.scala.Seq.empty) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(4) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(4) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 1 => __out = pulumirpc.language.DependencyInfo + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.GetProgramDependenciesResponse( + dependencies = _root_.scala.Seq.empty + ) + implicit class GetProgramDependenciesResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.GetProgramDependenciesResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.GetProgramDependenciesResponse](_l) { + def dependencies: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[pulumirpc.language.DependencyInfo]] = field(_.dependencies)((c_, f_) => c_.copy(dependencies = f_)) + } + final val DEPENDENCIES_FIELD_NUMBER = 1 + def of( + dependencies: _root_.scala.Seq[pulumirpc.language.DependencyInfo] + ): _root_.pulumirpc.language.GetProgramDependenciesResponse = _root_.pulumirpc.language.GetProgramDependenciesResponse( + dependencies + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.GetProgramDependenciesResponse]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/GetRequiredPluginsRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/GetRequiredPluginsRequest.scala new file mode 100644 index 00000000..da6aa4b0 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/GetRequiredPluginsRequest.scala @@ -0,0 +1,219 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param project + * the project name, the engine always sets this to "deprecated" now. + * @param pwd + * the program's working directory. + * @param program + * the path to the program. + * @param info + * the program info to use to calculate plugins. + */ +@SerialVersionUID(0L) +final case class GetRequiredPluginsRequest( + @scala.deprecated(message="Marked as deprecated in proto file", "") project: _root_.scala.Predef.String = "", + @scala.deprecated(message="Marked as deprecated in proto file", "") pwd: _root_.scala.Predef.String = "", + @scala.deprecated(message="Marked as deprecated in proto file", "") program: _root_.scala.Predef.String = "", + info: _root_.scala.Option[pulumirpc.language.ProgramInfo] = _root_.scala.None, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[GetRequiredPluginsRequest] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = project + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = pwd + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + + { + val __value = program + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value) + } + }; + if (info.isDefined) { + val __value = info.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = project + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = pwd + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + { + val __v = program + if (!__v.isEmpty) { + _output__.writeString(3, __v) + } + }; + info.foreach { __v => + val __m = __v + _output__.writeTag(4, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def withProject(__v: _root_.scala.Predef.String): GetRequiredPluginsRequest = copy(project = __v) + def withPwd(__v: _root_.scala.Predef.String): GetRequiredPluginsRequest = copy(pwd = __v) + def withProgram(__v: _root_.scala.Predef.String): GetRequiredPluginsRequest = copy(program = __v) + def getInfo: pulumirpc.language.ProgramInfo = info.getOrElse(pulumirpc.language.ProgramInfo.defaultInstance) + def clearInfo: GetRequiredPluginsRequest = copy(info = _root_.scala.None) + def withInfo(__v: pulumirpc.language.ProgramInfo): GetRequiredPluginsRequest = copy(info = Option(__v)) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = project + if (__t != "") __t else null + } + case 2 => { + val __t = pwd + if (__t != "") __t else null + } + case 3 => { + val __t = program + if (__t != "") __t else null + } + case 4 => info.orNull + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(project) + case 2 => _root_.scalapb.descriptors.PString(pwd) + case 3 => _root_.scalapb.descriptors.PString(program) + case 4 => info.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.GetRequiredPluginsRequest.type = pulumirpc.language.GetRequiredPluginsRequest + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.GetRequiredPluginsRequest]) +} + +object GetRequiredPluginsRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.language.GetRequiredPluginsRequest] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.GetRequiredPluginsRequest] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.GetRequiredPluginsRequest = { + var __project: _root_.scala.Predef.String = "" + var __pwd: _root_.scala.Predef.String = "" + var __program: _root_.scala.Predef.String = "" + var __info: _root_.scala.Option[pulumirpc.language.ProgramInfo] = _root_.scala.None + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __project = _input__.readStringRequireUtf8() + case 18 => + __pwd = _input__.readStringRequireUtf8() + case 26 => + __program = _input__.readStringRequireUtf8() + case 34 => + __info = _root_.scala.Option(__info.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.language.ProgramInfo](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.GetRequiredPluginsRequest( + project = __project, + pwd = __pwd, + program = __program, + info = __info, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.GetRequiredPluginsRequest] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.GetRequiredPluginsRequest( + project = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + pwd = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + program = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + info = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[pulumirpc.language.ProgramInfo]]) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(5) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(5) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 4 => __out = pulumirpc.language.ProgramInfo + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.GetRequiredPluginsRequest( + project = "", + pwd = "", + program = "", + info = _root_.scala.None + ) + implicit class GetRequiredPluginsRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.GetRequiredPluginsRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.GetRequiredPluginsRequest](_l) { + def project: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.project)((c_, f_) => c_.copy(project = f_)) + def pwd: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.pwd)((c_, f_) => c_.copy(pwd = f_)) + def program: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.program)((c_, f_) => c_.copy(program = f_)) + def info: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.ProgramInfo] = field(_.getInfo)((c_, f_) => c_.copy(info = _root_.scala.Option(f_))) + def optionalInfo: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.language.ProgramInfo]] = field(_.info)((c_, f_) => c_.copy(info = f_)) + } + final val PROJECT_FIELD_NUMBER = 1 + final val PWD_FIELD_NUMBER = 2 + final val PROGRAM_FIELD_NUMBER = 3 + final val INFO_FIELD_NUMBER = 4 + def of( + project: _root_.scala.Predef.String, + pwd: _root_.scala.Predef.String, + program: _root_.scala.Predef.String, + info: _root_.scala.Option[pulumirpc.language.ProgramInfo] + ): _root_.pulumirpc.language.GetRequiredPluginsRequest = _root_.pulumirpc.language.GetRequiredPluginsRequest( + project, + pwd, + program, + info + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.GetRequiredPluginsRequest]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/GetRequiredPluginsResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/GetRequiredPluginsResponse.scala new file mode 100644 index 00000000..6b40506f --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/GetRequiredPluginsResponse.scala @@ -0,0 +1,123 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param plugins + * a list of plugins required by this program. + */ +@SerialVersionUID(0L) +final case class GetRequiredPluginsResponse( + plugins: _root_.scala.Seq[pulumirpc.plugin.PluginDependency] = _root_.scala.Seq.empty, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[GetRequiredPluginsResponse] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + plugins.foreach { __item => + val __value = __item + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + plugins.foreach { __v => + val __m = __v + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def clearPlugins = copy(plugins = _root_.scala.Seq.empty) + def addPlugins(__vs: pulumirpc.plugin.PluginDependency *): GetRequiredPluginsResponse = addAllPlugins(__vs) + def addAllPlugins(__vs: Iterable[pulumirpc.plugin.PluginDependency]): GetRequiredPluginsResponse = copy(plugins = plugins ++ __vs) + def withPlugins(__v: _root_.scala.Seq[pulumirpc.plugin.PluginDependency]): GetRequiredPluginsResponse = copy(plugins = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => plugins + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PRepeated(plugins.iterator.map(_.toPMessage).toVector) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.GetRequiredPluginsResponse.type = pulumirpc.language.GetRequiredPluginsResponse + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.GetRequiredPluginsResponse]) +} + +object GetRequiredPluginsResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.language.GetRequiredPluginsResponse] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.GetRequiredPluginsResponse] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.GetRequiredPluginsResponse = { + val __plugins: _root_.scala.collection.immutable.VectorBuilder[pulumirpc.plugin.PluginDependency] = new _root_.scala.collection.immutable.VectorBuilder[pulumirpc.plugin.PluginDependency] + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __plugins += _root_.scalapb.LiteParser.readMessage[pulumirpc.plugin.PluginDependency](_input__) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.GetRequiredPluginsResponse( + plugins = __plugins.result(), + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.GetRequiredPluginsResponse] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.GetRequiredPluginsResponse( + plugins = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[pulumirpc.plugin.PluginDependency]]).getOrElse(_root_.scala.Seq.empty) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(6) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(6) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 1 => __out = pulumirpc.plugin.PluginDependency + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.GetRequiredPluginsResponse( + plugins = _root_.scala.Seq.empty + ) + implicit class GetRequiredPluginsResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.GetRequiredPluginsResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.GetRequiredPluginsResponse](_l) { + def plugins: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[pulumirpc.plugin.PluginDependency]] = field(_.plugins)((c_, f_) => c_.copy(plugins = f_)) + } + final val PLUGINS_FIELD_NUMBER = 1 + def of( + plugins: _root_.scala.Seq[pulumirpc.plugin.PluginDependency] + ): _root_.pulumirpc.language.GetRequiredPluginsResponse = _root_.pulumirpc.language.GetRequiredPluginsResponse( + plugins + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.GetRequiredPluginsResponse]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/InstallDependenciesRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/InstallDependenciesRequest.scala new file mode 100644 index 00000000..f3e064ee --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/InstallDependenciesRequest.scala @@ -0,0 +1,187 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param directory + * the program's working directory. + * @param isTerminal + * if we are running in a terminal and should use ANSI codes + * @param info + * the program info to use to execute the plugin. + */ +@SerialVersionUID(0L) +final case class InstallDependenciesRequest( + @scala.deprecated(message="Marked as deprecated in proto file", "") directory: _root_.scala.Predef.String = "", + isTerminal: _root_.scala.Boolean = false, + info: _root_.scala.Option[pulumirpc.language.ProgramInfo] = _root_.scala.None, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[InstallDependenciesRequest] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = directory + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = isTerminal + if (__value != false) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(2, __value) + } + }; + if (info.isDefined) { + val __value = info.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = directory + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = isTerminal + if (__v != false) { + _output__.writeBool(2, __v) + } + }; + info.foreach { __v => + val __m = __v + _output__.writeTag(3, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def withDirectory(__v: _root_.scala.Predef.String): InstallDependenciesRequest = copy(directory = __v) + def withIsTerminal(__v: _root_.scala.Boolean): InstallDependenciesRequest = copy(isTerminal = __v) + def getInfo: pulumirpc.language.ProgramInfo = info.getOrElse(pulumirpc.language.ProgramInfo.defaultInstance) + def clearInfo: InstallDependenciesRequest = copy(info = _root_.scala.None) + def withInfo(__v: pulumirpc.language.ProgramInfo): InstallDependenciesRequest = copy(info = Option(__v)) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = directory + if (__t != "") __t else null + } + case 2 => { + val __t = isTerminal + if (__t != false) __t else null + } + case 3 => info.orNull + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(directory) + case 2 => _root_.scalapb.descriptors.PBoolean(isTerminal) + case 3 => info.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.InstallDependenciesRequest.type = pulumirpc.language.InstallDependenciesRequest + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.InstallDependenciesRequest]) +} + +object InstallDependenciesRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.language.InstallDependenciesRequest] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.InstallDependenciesRequest] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.InstallDependenciesRequest = { + var __directory: _root_.scala.Predef.String = "" + var __isTerminal: _root_.scala.Boolean = false + var __info: _root_.scala.Option[pulumirpc.language.ProgramInfo] = _root_.scala.None + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __directory = _input__.readStringRequireUtf8() + case 16 => + __isTerminal = _input__.readBool() + case 26 => + __info = _root_.scala.Option(__info.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.language.ProgramInfo](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.InstallDependenciesRequest( + directory = __directory, + isTerminal = __isTerminal, + info = __info, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.InstallDependenciesRequest] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.InstallDependenciesRequest( + directory = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + isTerminal = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Boolean]).getOrElse(false), + info = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[pulumirpc.language.ProgramInfo]]) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(9) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(9) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 3 => __out = pulumirpc.language.ProgramInfo + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.InstallDependenciesRequest( + directory = "", + isTerminal = false, + info = _root_.scala.None + ) + implicit class InstallDependenciesRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.InstallDependenciesRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.InstallDependenciesRequest](_l) { + def directory: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.directory)((c_, f_) => c_.copy(directory = f_)) + def isTerminal: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.isTerminal)((c_, f_) => c_.copy(isTerminal = f_)) + def info: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.ProgramInfo] = field(_.getInfo)((c_, f_) => c_.copy(info = _root_.scala.Option(f_))) + def optionalInfo: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.language.ProgramInfo]] = field(_.info)((c_, f_) => c_.copy(info = f_)) + } + final val DIRECTORY_FIELD_NUMBER = 1 + final val IS_TERMINAL_FIELD_NUMBER = 2 + final val INFO_FIELD_NUMBER = 3 + def of( + directory: _root_.scala.Predef.String, + isTerminal: _root_.scala.Boolean, + info: _root_.scala.Option[pulumirpc.language.ProgramInfo] + ): _root_.pulumirpc.language.InstallDependenciesRequest = _root_.pulumirpc.language.InstallDependenciesRequest( + directory, + isTerminal, + info + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.InstallDependenciesRequest]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/InstallDependenciesResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/InstallDependenciesResponse.scala new file mode 100644 index 00000000..8e5fae91 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/InstallDependenciesResponse.scala @@ -0,0 +1,152 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param stdout + * a line of stdout text. + * @param stderr + * a line of stderr text. + */ +@SerialVersionUID(0L) +final case class InstallDependenciesResponse( + stdout: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY, + stderr: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[InstallDependenciesResponse] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = stdout + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(1, __value) + } + }; + + { + val __value = stderr + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = stdout + if (!__v.isEmpty) { + _output__.writeBytes(1, __v) + } + }; + { + val __v = stderr + if (!__v.isEmpty) { + _output__.writeBytes(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withStdout(__v: _root_.com.google.protobuf.ByteString): InstallDependenciesResponse = copy(stdout = __v) + def withStderr(__v: _root_.com.google.protobuf.ByteString): InstallDependenciesResponse = copy(stderr = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = stdout + if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null + } + case 2 => { + val __t = stderr + if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PByteString(stdout) + case 2 => _root_.scalapb.descriptors.PByteString(stderr) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.InstallDependenciesResponse.type = pulumirpc.language.InstallDependenciesResponse + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.InstallDependenciesResponse]) +} + +object InstallDependenciesResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.language.InstallDependenciesResponse] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.InstallDependenciesResponse] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.InstallDependenciesResponse = { + var __stdout: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY + var __stderr: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __stdout = _input__.readBytes() + case 18 => + __stderr = _input__.readBytes() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.InstallDependenciesResponse( + stdout = __stdout, + stderr = __stderr, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.InstallDependenciesResponse] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.InstallDependenciesResponse( + stdout = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY), + stderr = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(10) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(10) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.InstallDependenciesResponse( + stdout = _root_.com.google.protobuf.ByteString.EMPTY, + stderr = _root_.com.google.protobuf.ByteString.EMPTY + ) + implicit class InstallDependenciesResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.InstallDependenciesResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.InstallDependenciesResponse](_l) { + def stdout: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.stdout)((c_, f_) => c_.copy(stdout = f_)) + def stderr: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.stderr)((c_, f_) => c_.copy(stderr = f_)) + } + final val STDOUT_FIELD_NUMBER = 1 + final val STDERR_FIELD_NUMBER = 2 + def of( + stdout: _root_.com.google.protobuf.ByteString, + stderr: _root_.com.google.protobuf.ByteString + ): _root_.pulumirpc.language.InstallDependenciesResponse = _root_.pulumirpc.language.InstallDependenciesResponse( + stdout, + stderr + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.InstallDependenciesResponse]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/LanguageProto.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/LanguageProto.scala new file mode 100644 index 00000000..5d681798 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/LanguageProto.scala @@ -0,0 +1,138 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +object LanguageProto extends _root_.scalapb.GeneratedFileObject { + lazy val dependencies: Seq[_root_.scalapb.GeneratedFileObject] = Seq( + pulumirpc.codegen.hcl.HclProto, + pulumirpc.plugin.PluginProto, + com.google.protobuf.empty.EmptyProto, + com.google.protobuf.struct.StructProto + ) + lazy val messagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( + pulumirpc.language.ProgramInfo, + pulumirpc.language.AboutResponse, + pulumirpc.language.GetProgramDependenciesRequest, + pulumirpc.language.DependencyInfo, + pulumirpc.language.GetProgramDependenciesResponse, + pulumirpc.language.GetRequiredPluginsRequest, + pulumirpc.language.GetRequiredPluginsResponse, + pulumirpc.language.RunRequest, + pulumirpc.language.RunResponse, + pulumirpc.language.InstallDependenciesRequest, + pulumirpc.language.InstallDependenciesResponse, + pulumirpc.language.RunPluginRequest, + pulumirpc.language.RunPluginResponse, + pulumirpc.language.GenerateProgramRequest, + pulumirpc.language.GenerateProgramResponse, + pulumirpc.language.GenerateProjectRequest, + pulumirpc.language.GenerateProjectResponse, + pulumirpc.language.GeneratePackageRequest, + pulumirpc.language.GeneratePackageResponse, + pulumirpc.language.PackRequest, + pulumirpc.language.PackResponse + ) + private lazy val ProtoBytes: _root_.scala.Array[Byte] = + scalapb.Encoding.fromBase64(scala.collection.immutable.Seq( + """ChVwdWx1bWkvbGFuZ3VhZ2UucHJvdG8SCXB1bHVtaXJwYxoYcHVsdW1pL2NvZGVnZW4vaGNsLnByb3RvGhNwdWx1bWkvcGx1Z + 2luLnByb3RvGhtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8aHGdvb2dsZS9wcm90b2J1Zi9zdHJ1Y3QucHJvdG8i/wEKC1Byb + 2dyYW1JbmZvEjkKDnJvb3RfZGlyZWN0b3J5GAEgASgJQhLiPw8SDXJvb3REaXJlY3RvcnlSDXJvb3REaXJlY3RvcnkSQgoRcHJvZ + 3JhbV9kaXJlY3RvcnkYAiABKAlCFeI/EhIQcHJvZ3JhbURpcmVjdG9yeVIQcHJvZ3JhbURpcmVjdG9yeRIwCgtlbnRyeV9wb2lud + BgDIAEoCUIP4j8MEgplbnRyeVBvaW50UgplbnRyeVBvaW50Ej8KB29wdGlvbnMYBCABKAsyFy5nb29nbGUucHJvdG9idWYuU3Ryd + WN0QgziPwkSB29wdGlvbnNSB29wdGlvbnMijgIKDUFib3V0UmVzcG9uc2USLwoKZXhlY3V0YWJsZRgBIAEoCUIP4j8MEgpleGVjd + XRhYmxlUgpleGVjdXRhYmxlEiYKB3ZlcnNpb24YAiABKAlCDOI/CRIHdmVyc2lvblIHdmVyc2lvbhJRCghtZXRhZGF0YRgDIAMoC + zImLnB1bHVtaXJwYy5BYm91dFJlc3BvbnNlLk1ldGFkYXRhRW50cnlCDeI/ChIIbWV0YWRhdGFSCG1ldGFkYXRhGlEKDU1ldGFkY + XRhRW50cnkSGgoDa2V5GAEgASgJQgjiPwUSA2tleVIDa2V5EiAKBXZhbHVlGAIgASgJQgriPwcSBXZhbHVlUgV2YWx1ZToCOAEin + QIKHUdldFByb2dyYW1EZXBlbmRlbmNpZXNSZXF1ZXN0EigKB3Byb2plY3QYASABKAlCDhgB4j8JEgdwcm9qZWN0Ugdwcm9qZWN0E + hwKA3B3ZBgCIAEoCUIKGAHiPwUSA3B3ZFIDcHdkEigKB3Byb2dyYW0YAyABKAlCDhgB4j8JEgdwcm9ncmFtUgdwcm9ncmFtElMKF + nRyYW5zaXRpdmVEZXBlbmRlbmNpZXMYBCABKAhCG+I/GBIWdHJhbnNpdGl2ZURlcGVuZGVuY2llc1IWdHJhbnNpdGl2ZURlcGVuZ + GVuY2llcxI1CgRpbmZvGAUgASgLMhYucHVsdW1pcnBjLlByb2dyYW1JbmZvQgniPwYSBGluZm9SBGluZm8iVwoORGVwZW5kZW5je + UluZm8SHQoEbmFtZRgBIAEoCUIJ4j8GEgRuYW1lUgRuYW1lEiYKB3ZlcnNpb24YAiABKAlCDOI/CRIHdmVyc2lvblIHdmVyc2lvb + iJyCh5HZXRQcm9ncmFtRGVwZW5kZW5jaWVzUmVzcG9uc2USUAoMZGVwZW5kZW5jaWVzGAEgAygLMhkucHVsdW1pcnBjLkRlcGVuZ + GVuY3lJbmZvQhHiPw4SDGRlcGVuZGVuY2llc1IMZGVwZW5kZW5jaWVzIsQBChlHZXRSZXF1aXJlZFBsdWdpbnNSZXF1ZXN0EigKB + 3Byb2plY3QYASABKAlCDhgB4j8JEgdwcm9qZWN0Ugdwcm9qZWN0EhwKA3B3ZBgCIAEoCUIKGAHiPwUSA3B3ZFIDcHdkEigKB3Byb + 2dyYW0YAyABKAlCDhgB4j8JEgdwcm9ncmFtUgdwcm9ncmFtEjUKBGluZm8YBCABKAsyFi5wdWx1bWlycGMuUHJvZ3JhbUluZm9CC + eI/BhIEaW5mb1IEaW5mbyJhChpHZXRSZXF1aXJlZFBsdWdpbnNSZXNwb25zZRJDCgdwbHVnaW5zGAEgAygLMhsucHVsdW1pcnBjL + lBsdWdpbkRlcGVuZGVuY3lCDOI/CRIHcGx1Z2luc1IHcGx1Z2lucyKgBgoKUnVuUmVxdWVzdBImCgdwcm9qZWN0GAEgASgJQgziP + wkSB3Byb2plY3RSB3Byb2plY3QSIAoFc3RhY2sYAiABKAlCCuI/BxIFc3RhY2tSBXN0YWNrEhoKA3B3ZBgDIAEoCUII4j8FEgNwd + 2RSA3B3ZBIoCgdwcm9ncmFtGAQgASgJQg4YAeI/CRIHcHJvZ3JhbVIHcHJvZ3JhbRIdCgRhcmdzGAUgAygJQgniPwYSBGFyZ3NSB + GFyZ3MSRgoGY29uZmlnGAYgAygLMiEucHVsdW1pcnBjLlJ1blJlcXVlc3QuQ29uZmlnRW50cnlCC+I/CBIGY29uZmlnUgZjb25ma + WcSIwoGZHJ5UnVuGAcgASgIQgviPwgSBmRyeVJ1blIGZHJ5UnVuEikKCHBhcmFsbGVsGAggASgFQg3iPwoSCHBhcmFsbGVsUghwY + XJhbGxlbBI8Cg9tb25pdG9yX2FkZHJlc3MYCSABKAlCE+I/EBIObW9uaXRvckFkZHJlc3NSDm1vbml0b3JBZGRyZXNzEiwKCXF1Z + XJ5TW9kZRgKIAEoCEIO4j8LEglxdWVyeU1vZGVSCXF1ZXJ5TW9kZRJBChBjb25maWdTZWNyZXRLZXlzGAsgAygJQhXiPxISEGNvb + mZpZ1NlY3JldEtleXNSEGNvbmZpZ1NlY3JldEtleXMSNQoMb3JnYW5pemF0aW9uGAwgASgJQhHiPw4SDG9yZ2FuaXphdGlvblIMb + 3JnYW5pemF0aW9uEl0KEWNvbmZpZ1Byb3BlcnR5TWFwGA0gASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEIW4j8TEhFjb25ma + WdQcm9wZXJ0eU1hcFIRY29uZmlnUHJvcGVydHlNYXASNQoEaW5mbxgOIAEoCzIWLnB1bHVtaXJwYy5Qcm9ncmFtSW5mb0IJ4j8GE + gRpbmZvUgRpbmZvGk8KC0NvbmZpZ0VudHJ5EhoKA2tleRgBIAEoCUII4j8FEgNrZXlSA2tleRIgCgV2YWx1ZRgCIAEoCUIK4j8HE + gV2YWx1ZVIFdmFsdWU6AjgBIk4KC1J1blJlc3BvbnNlEiAKBWVycm9yGAEgASgJQgriPwcSBWVycm9yUgVlcnJvchIdCgRiYWlsG + AIgASgIQgniPwYSBGJhaWxSBGJhaWwitQEKGkluc3RhbGxEZXBlbmRlbmNpZXNSZXF1ZXN0Ei4KCWRpcmVjdG9yeRgBIAEoCUIQG + AHiPwsSCWRpcmVjdG9yeVIJZGlyZWN0b3J5EjAKC2lzX3Rlcm1pbmFsGAIgASgIQg/iPwwSCmlzVGVybWluYWxSCmlzVGVybWluY + WwSNQoEaW5mbxgDIAEoCzIWLnB1bHVtaXJwYy5Qcm9ncmFtSW5mb0IJ4j8GEgRpbmZvUgRpbmZvImcKG0luc3RhbGxEZXBlbmRlb + mNpZXNSZXNwb25zZRIjCgZzdGRvdXQYASABKAxCC+I/CBIGc3Rkb3V0UgZzdGRvdXQSIwoGc3RkZXJyGAIgASgMQgviPwgSBnN0Z + GVyclIGc3RkZXJyIsoBChBSdW5QbHVnaW5SZXF1ZXN0EhoKA3B3ZBgBIAEoCUII4j8FEgNwd2RSA3B3ZBIoCgdwcm9ncmFtGAIgA + SgJQg4YAeI/CRIHcHJvZ3JhbVIHcHJvZ3JhbRIdCgRhcmdzGAMgAygJQgniPwYSBGFyZ3NSBGFyZ3MSGgoDZW52GAQgAygJQgjiP + wUSA2VudlIDZW52EjUKBGluZm8YBSABKAsyFi5wdWx1bWlycGMuUHJvZ3JhbUluZm9CCeI/BhIEaW5mb1IEaW5mbyKYAQoRUnVuU + Gx1Z2luUmVzcG9uc2USJQoGc3Rkb3V0GAEgASgMQgviPwgSBnN0ZG91dEgAUgZzdGRvdXQSJQoGc3RkZXJyGAIgASgMQgviPwgSB + nN0ZGVyckgAUgZzdGRlcnISKwoIZXhpdGNvZGUYAyABKAVCDeI/ChIIZXhpdGNvZGVIAFIIZXhpdGNvZGVCCAoGb3V0cHV0IvUBC + hZHZW5lcmF0ZVByb2dyYW1SZXF1ZXN0ElIKBnNvdXJjZRgBIAMoCzItLnB1bHVtaXJwYy5HZW5lcmF0ZVByb2dyYW1SZXF1ZXN0L + lNvdXJjZUVudHJ5QgviPwgSBnNvdXJjZVIGc291cmNlEjYKDWxvYWRlcl90YXJnZXQYAiABKAlCEeI/DhIMbG9hZGVyVGFyZ2V0U + gxsb2FkZXJUYXJnZXQaTwoLU291cmNlRW50cnkSGgoDa2V5GAEgASgJQgjiPwUSA2tleVIDa2V5EiAKBXZhbHVlGAIgASgJQgriP + wcSBXZhbHVlUgV2YWx1ZToCOAEikgIKF0dlbmVyYXRlUHJvZ3JhbVJlc3BvbnNlElEKC2RpYWdub3N0aWNzGAEgAygLMh0ucHVsd + W1pcnBjLmNvZGVnZW4uRGlhZ25vc3RpY0IQ4j8NEgtkaWFnbm9zdGljc1ILZGlhZ25vc3RpY3MSUwoGc291cmNlGAIgAygLMi4uc + HVsdW1pcnBjLkdlbmVyYXRlUHJvZ3JhbVJlc3BvbnNlLlNvdXJjZUVudHJ5QgviPwgSBnNvdXJjZVIGc291cmNlGk8KC1NvdXJjZ + UVudHJ5EhoKA2tleRgBIAEoCUII4j8FEgNrZXlSA2tleRIgCgV2YWx1ZRgCIAEoDEIK4j8HEgV2YWx1ZVIFdmFsdWU6AjgBIvwDC + hZHZW5lcmF0ZVByb2plY3RSZXF1ZXN0Ej8KEHNvdXJjZV9kaXJlY3RvcnkYASABKAlCFOI/ERIPc291cmNlRGlyZWN0b3J5Ug9zb + 3VyY2VEaXJlY3RvcnkSPwoQdGFyZ2V0X2RpcmVjdG9yeRgCIAEoCUIU4j8REg90YXJnZXREaXJlY3RvcnlSD3RhcmdldERpcmVjd + G9yeRImCgdwcm9qZWN0GAMgASgJQgziPwkSB3Byb2plY3RSB3Byb2plY3QSIwoGc3RyaWN0GAQgASgIQgviPwgSBnN0cmljdFIGc + 3RyaWN0EjYKDWxvYWRlcl90YXJnZXQYBSABKAlCEeI/DhIMbG9hZGVyVGFyZ2V0Ugxsb2FkZXJUYXJnZXQSfwoSbG9jYWxfZGVwZ + W5kZW5jaWVzGAYgAygLMjgucHVsdW1pcnBjLkdlbmVyYXRlUHJvamVjdFJlcXVlc3QuTG9jYWxEZXBlbmRlbmNpZXNFbnRyeUIW4 + j8TEhFsb2NhbERlcGVuZGVuY2llc1IRbG9jYWxEZXBlbmRlbmNpZXMaWgoWTG9jYWxEZXBlbmRlbmNpZXNFbnRyeRIaCgNrZXkYA + SABKAlCCOI/BRIDa2V5UgNrZXkSIAoFdmFsdWUYAiABKAlCCuI/BxIFdmFsdWVSBXZhbHVlOgI4ASJsChdHZW5lcmF0ZVByb2plY + 3RSZXNwb25zZRJRCgtkaWFnbm9zdGljcxgBIAMoCzIdLnB1bHVtaXJwYy5jb2RlZ2VuLkRpYWdub3N0aWNCEOI/DRILZGlhZ25vc + 3RpY3NSC2RpYWdub3N0aWNzIroEChZHZW5lcmF0ZVBhY2thZ2VSZXF1ZXN0EiwKCWRpcmVjdG9yeRgBIAEoCUIO4j8LEglkaXJlY + 3RvcnlSCWRpcmVjdG9yeRIjCgZzY2hlbWEYAiABKAlCC+I/CBIGc2NoZW1hUgZzY2hlbWESYwoLZXh0cmFfZmlsZXMYAyADKAsyM + S5wdWx1bWlycGMuR2VuZXJhdGVQYWNrYWdlUmVxdWVzdC5FeHRyYUZpbGVzRW50cnlCD+I/DBIKZXh0cmFGaWxlc1IKZXh0cmFGa + WxlcxI2Cg1sb2FkZXJfdGFyZ2V0GAQgASgJQhHiPw4SDGxvYWRlclRhcmdldFIMbG9hZGVyVGFyZ2V0En8KEmxvY2FsX2RlcGVuZ + GVuY2llcxgFIAMoCzI4LnB1bHVtaXJwYy5HZW5lcmF0ZVBhY2thZ2VSZXF1ZXN0LkxvY2FsRGVwZW5kZW5jaWVzRW50cnlCFuI/E + xIRbG9jYWxEZXBlbmRlbmNpZXNSEWxvY2FsRGVwZW5kZW5jaWVzGlMKD0V4dHJhRmlsZXNFbnRyeRIaCgNrZXkYASABKAlCCOI/B + RIDa2V5UgNrZXkSIAoFdmFsdWUYAiABKAxCCuI/BxIFdmFsdWVSBXZhbHVlOgI4ARpaChZMb2NhbERlcGVuZGVuY2llc0VudHJ5E + hoKA2tleRgBIAEoCUII4j8FEgNrZXlSA2tleRIgCgV2YWx1ZRgCIAEoCUIK4j8HEgV2YWx1ZVIFdmFsdWU6AjgBImwKF0dlbmVyY + XRlUGFja2FnZVJlc3BvbnNlElEKC2RpYWdub3N0aWNzGAEgAygLMh0ucHVsdW1pcnBjLmNvZGVnZW4uRGlhZ25vc3RpY0IQ4j8NE + gtkaWFnbm9zdGljc1ILZGlhZ25vc3RpY3MioQEKC1BhY2tSZXF1ZXN0EkIKEXBhY2thZ2VfZGlyZWN0b3J5GAEgASgJQhXiPxISE + HBhY2thZ2VEaXJlY3RvcnlSEHBhY2thZ2VEaXJlY3RvcnkSTgoVZGVzdGluYXRpb25fZGlyZWN0b3J5GAIgASgJQhniPxYSFGRlc + 3RpbmF0aW9uRGlyZWN0b3J5UhRkZXN0aW5hdGlvbkRpcmVjdG9yeSJGCgxQYWNrUmVzcG9uc2USNgoNYXJ0aWZhY3RfcGF0aBgBI + AEoCUIR4j8OEgxhcnRpZmFjdFBhdGhSDGFydGlmYWN0UGF0aDKjBwoPTGFuZ3VhZ2VSdW50aW1lEmMKEkdldFJlcXVpcmVkUGx1Z + 2lucxIkLnB1bHVtaXJwYy5HZXRSZXF1aXJlZFBsdWdpbnNSZXF1ZXN0GiUucHVsdW1pcnBjLkdldFJlcXVpcmVkUGx1Z2luc1Jlc + 3BvbnNlIgASNgoDUnVuEhUucHVsdW1pcnBjLlJ1blJlcXVlc3QaFi5wdWx1bWlycGMuUnVuUmVzcG9uc2UiABJACg1HZXRQbHVna + W5JbmZvEhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5GhUucHVsdW1pcnBjLlBsdWdpbkluZm8iABJoChNJbnN0YWxsRGVwZW5kZW5ja + WVzEiUucHVsdW1pcnBjLkluc3RhbGxEZXBlbmRlbmNpZXNSZXF1ZXN0GiYucHVsdW1pcnBjLkluc3RhbGxEZXBlbmRlbmNpZXNSZ + XNwb25zZSIAMAESOwoFQWJvdXQSFi5nb29nbGUucHJvdG9idWYuRW1wdHkaGC5wdWx1bWlycGMuQWJvdXRSZXNwb25zZSIAEm8KF + kdldFByb2dyYW1EZXBlbmRlbmNpZXMSKC5wdWx1bWlycGMuR2V0UHJvZ3JhbURlcGVuZGVuY2llc1JlcXVlc3QaKS5wdWx1bWlyc + GMuR2V0UHJvZ3JhbURlcGVuZGVuY2llc1Jlc3BvbnNlIgASSgoJUnVuUGx1Z2luEhsucHVsdW1pcnBjLlJ1blBsdWdpblJlcXVlc + 3QaHC5wdWx1bWlycGMuUnVuUGx1Z2luUmVzcG9uc2UiADABEloKD0dlbmVyYXRlUHJvZ3JhbRIhLnB1bHVtaXJwYy5HZW5lcmF0Z + VByb2dyYW1SZXF1ZXN0GiIucHVsdW1pcnBjLkdlbmVyYXRlUHJvZ3JhbVJlc3BvbnNlIgASWgoPR2VuZXJhdGVQcm9qZWN0EiEuc + HVsdW1pcnBjLkdlbmVyYXRlUHJvamVjdFJlcXVlc3QaIi5wdWx1bWlycGMuR2VuZXJhdGVQcm9qZWN0UmVzcG9uc2UiABJaCg9HZ + W5lcmF0ZVBhY2thZ2USIS5wdWx1bWlycGMuR2VuZXJhdGVQYWNrYWdlUmVxdWVzdBoiLnB1bHVtaXJwYy5HZW5lcmF0ZVBhY2thZ + 2VSZXNwb25zZSIAEjkKBFBhY2sSFi5wdWx1bWlycGMuUGFja1JlcXVlc3QaFy5wdWx1bWlycGMuUGFja1Jlc3BvbnNlIgBCNFoyZ + 2l0aHViLmNvbS9wdWx1bWkvcHVsdW1pL3Nkay92My9wcm90by9nbztwdWx1bWlycGNiBnByb3RvMw==""" + ).mkString) + lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { + val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) + _root_.scalapb.descriptors.FileDescriptor.buildFrom(scalaProto, dependencies.map(_.scalaDescriptor)) + } + lazy val javaDescriptor: com.google.protobuf.Descriptors.FileDescriptor = { + val javaProto = com.google.protobuf.DescriptorProtos.FileDescriptorProto.parseFrom(ProtoBytes) + com.google.protobuf.Descriptors.FileDescriptor.buildFrom(javaProto, _root_.scala.Array( + pulumirpc.codegen.hcl.HclProto.javaDescriptor, + pulumirpc.plugin.PluginProto.javaDescriptor, + com.google.protobuf.empty.EmptyProto.javaDescriptor, + com.google.protobuf.struct.StructProto.javaDescriptor + )) + } + @deprecated("Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.", "ScalaPB 0.5.47") + def descriptor: com.google.protobuf.Descriptors.FileDescriptor = javaDescriptor +} \ No newline at end of file diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/LanguageRuntimeGrpc.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/LanguageRuntimeGrpc.scala new file mode 100644 index 00000000..680a14a0 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/LanguageRuntimeGrpc.scala @@ -0,0 +1,443 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + + +object LanguageRuntimeGrpc { + val METHOD_GET_REQUIRED_PLUGINS: _root_.io.grpc.MethodDescriptor[pulumirpc.language.GetRequiredPluginsRequest, pulumirpc.language.GetRequiredPluginsResponse] = + _root_.io.grpc.MethodDescriptor.newBuilder() + .setType(_root_.io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(_root_.io.grpc.MethodDescriptor.generateFullMethodName("pulumirpc.LanguageRuntime", "GetRequiredPlugins")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.GetRequiredPluginsRequest]) + .setResponseMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.GetRequiredPluginsResponse]) + .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.language.LanguageProto.javaDescriptor.getServices().get(0).getMethods().get(0))) + .build() + + val METHOD_RUN: _root_.io.grpc.MethodDescriptor[pulumirpc.language.RunRequest, pulumirpc.language.RunResponse] = + _root_.io.grpc.MethodDescriptor.newBuilder() + .setType(_root_.io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(_root_.io.grpc.MethodDescriptor.generateFullMethodName("pulumirpc.LanguageRuntime", "Run")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.RunRequest]) + .setResponseMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.RunResponse]) + .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.language.LanguageProto.javaDescriptor.getServices().get(0).getMethods().get(1))) + .build() + + val METHOD_GET_PLUGIN_INFO: _root_.io.grpc.MethodDescriptor[com.google.protobuf.empty.Empty, pulumirpc.plugin.PluginInfo] = + _root_.io.grpc.MethodDescriptor.newBuilder() + .setType(_root_.io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(_root_.io.grpc.MethodDescriptor.generateFullMethodName("pulumirpc.LanguageRuntime", "GetPluginInfo")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[com.google.protobuf.empty.Empty]) + .setResponseMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.plugin.PluginInfo]) + .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.language.LanguageProto.javaDescriptor.getServices().get(0).getMethods().get(2))) + .build() + + val METHOD_INSTALL_DEPENDENCIES: _root_.io.grpc.MethodDescriptor[pulumirpc.language.InstallDependenciesRequest, pulumirpc.language.InstallDependenciesResponse] = + _root_.io.grpc.MethodDescriptor.newBuilder() + .setType(_root_.io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName(_root_.io.grpc.MethodDescriptor.generateFullMethodName("pulumirpc.LanguageRuntime", "InstallDependencies")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.InstallDependenciesRequest]) + .setResponseMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.InstallDependenciesResponse]) + .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.language.LanguageProto.javaDescriptor.getServices().get(0).getMethods().get(3))) + .build() + + val METHOD_ABOUT: _root_.io.grpc.MethodDescriptor[com.google.protobuf.empty.Empty, pulumirpc.language.AboutResponse] = + _root_.io.grpc.MethodDescriptor.newBuilder() + .setType(_root_.io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(_root_.io.grpc.MethodDescriptor.generateFullMethodName("pulumirpc.LanguageRuntime", "About")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[com.google.protobuf.empty.Empty]) + .setResponseMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.AboutResponse]) + .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.language.LanguageProto.javaDescriptor.getServices().get(0).getMethods().get(4))) + .build() + + val METHOD_GET_PROGRAM_DEPENDENCIES: _root_.io.grpc.MethodDescriptor[pulumirpc.language.GetProgramDependenciesRequest, pulumirpc.language.GetProgramDependenciesResponse] = + _root_.io.grpc.MethodDescriptor.newBuilder() + .setType(_root_.io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(_root_.io.grpc.MethodDescriptor.generateFullMethodName("pulumirpc.LanguageRuntime", "GetProgramDependencies")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.GetProgramDependenciesRequest]) + .setResponseMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.GetProgramDependenciesResponse]) + .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.language.LanguageProto.javaDescriptor.getServices().get(0).getMethods().get(5))) + .build() + + val METHOD_RUN_PLUGIN: _root_.io.grpc.MethodDescriptor[pulumirpc.language.RunPluginRequest, pulumirpc.language.RunPluginResponse] = + _root_.io.grpc.MethodDescriptor.newBuilder() + .setType(_root_.io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName(_root_.io.grpc.MethodDescriptor.generateFullMethodName("pulumirpc.LanguageRuntime", "RunPlugin")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.RunPluginRequest]) + .setResponseMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.RunPluginResponse]) + .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.language.LanguageProto.javaDescriptor.getServices().get(0).getMethods().get(6))) + .build() + + val METHOD_GENERATE_PROGRAM: _root_.io.grpc.MethodDescriptor[pulumirpc.language.GenerateProgramRequest, pulumirpc.language.GenerateProgramResponse] = + _root_.io.grpc.MethodDescriptor.newBuilder() + .setType(_root_.io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(_root_.io.grpc.MethodDescriptor.generateFullMethodName("pulumirpc.LanguageRuntime", "GenerateProgram")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.GenerateProgramRequest]) + .setResponseMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.GenerateProgramResponse]) + .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.language.LanguageProto.javaDescriptor.getServices().get(0).getMethods().get(7))) + .build() + + val METHOD_GENERATE_PROJECT: _root_.io.grpc.MethodDescriptor[pulumirpc.language.GenerateProjectRequest, pulumirpc.language.GenerateProjectResponse] = + _root_.io.grpc.MethodDescriptor.newBuilder() + .setType(_root_.io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(_root_.io.grpc.MethodDescriptor.generateFullMethodName("pulumirpc.LanguageRuntime", "GenerateProject")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.GenerateProjectRequest]) + .setResponseMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.GenerateProjectResponse]) + .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.language.LanguageProto.javaDescriptor.getServices().get(0).getMethods().get(8))) + .build() + + val METHOD_GENERATE_PACKAGE: _root_.io.grpc.MethodDescriptor[pulumirpc.language.GeneratePackageRequest, pulumirpc.language.GeneratePackageResponse] = + _root_.io.grpc.MethodDescriptor.newBuilder() + .setType(_root_.io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(_root_.io.grpc.MethodDescriptor.generateFullMethodName("pulumirpc.LanguageRuntime", "GeneratePackage")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.GeneratePackageRequest]) + .setResponseMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.GeneratePackageResponse]) + .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.language.LanguageProto.javaDescriptor.getServices().get(0).getMethods().get(9))) + .build() + + val METHOD_PACK: _root_.io.grpc.MethodDescriptor[pulumirpc.language.PackRequest, pulumirpc.language.PackResponse] = + _root_.io.grpc.MethodDescriptor.newBuilder() + .setType(_root_.io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(_root_.io.grpc.MethodDescriptor.generateFullMethodName("pulumirpc.LanguageRuntime", "Pack")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.PackRequest]) + .setResponseMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.language.PackResponse]) + .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.language.LanguageProto.javaDescriptor.getServices().get(0).getMethods().get(10))) + .build() + + val SERVICE: _root_.io.grpc.ServiceDescriptor = + _root_.io.grpc.ServiceDescriptor.newBuilder("pulumirpc.LanguageRuntime") + .setSchemaDescriptor(new _root_.scalapb.grpc.ConcreteProtoFileDescriptorSupplier(pulumirpc.language.LanguageProto.javaDescriptor)) + .addMethod(METHOD_GET_REQUIRED_PLUGINS) + .addMethod(METHOD_RUN) + .addMethod(METHOD_GET_PLUGIN_INFO) + .addMethod(METHOD_INSTALL_DEPENDENCIES) + .addMethod(METHOD_ABOUT) + .addMethod(METHOD_GET_PROGRAM_DEPENDENCIES) + .addMethod(METHOD_RUN_PLUGIN) + .addMethod(METHOD_GENERATE_PROGRAM) + .addMethod(METHOD_GENERATE_PROJECT) + .addMethod(METHOD_GENERATE_PACKAGE) + .addMethod(METHOD_PACK) + .build() + + /** LanguageRuntime is the interface that the planning monitor uses to drive execution of an interpreter responsible + * for confguring and creating resource objects. + */ + trait LanguageRuntime extends _root_.scalapb.grpc.AbstractService { + override def serviceCompanion: _root_.scalapb.grpc.ServiceCompanion[LanguageRuntime] = LanguageRuntime + /** GetRequiredPlugins computes the complete set of anticipated plugins required by a program. + */ + def getRequiredPlugins(request: pulumirpc.language.GetRequiredPluginsRequest): scala.concurrent.Future[pulumirpc.language.GetRequiredPluginsResponse] + /** Run executes a program and returns its result. + */ + def run(request: pulumirpc.language.RunRequest): scala.concurrent.Future[pulumirpc.language.RunResponse] + /** GetPluginInfo returns generic information about this plugin, like its version. + */ + def getPluginInfo(request: com.google.protobuf.empty.Empty): scala.concurrent.Future[pulumirpc.plugin.PluginInfo] + /** InstallDependencies will install dependencies for the project, e.g. by running `npm install` for nodejs projects. + */ + def installDependencies(request: pulumirpc.language.InstallDependenciesRequest, responseObserver: _root_.io.grpc.stub.StreamObserver[pulumirpc.language.InstallDependenciesResponse]): _root_.scala.Unit + /** About returns information about the runtime for this language. + */ + def about(request: com.google.protobuf.empty.Empty): scala.concurrent.Future[pulumirpc.language.AboutResponse] + /** GetProgramDependencies returns the set of dependencies required by the program. + */ + def getProgramDependencies(request: pulumirpc.language.GetProgramDependenciesRequest): scala.concurrent.Future[pulumirpc.language.GetProgramDependenciesResponse] + /** RunPlugin executes a plugin program and returns its result asynchronously. + */ + def runPlugin(request: pulumirpc.language.RunPluginRequest, responseObserver: _root_.io.grpc.stub.StreamObserver[pulumirpc.language.RunPluginResponse]): _root_.scala.Unit + /** GenerateProgram generates a given PCL program into a program for this language. + */ + def generateProgram(request: pulumirpc.language.GenerateProgramRequest): scala.concurrent.Future[pulumirpc.language.GenerateProgramResponse] + /** GenerateProject generates a given PCL program into a project for this language. + */ + def generateProject(request: pulumirpc.language.GenerateProjectRequest): scala.concurrent.Future[pulumirpc.language.GenerateProjectResponse] + /** GeneratePackage generates a given pulumi package into a package for this language. + */ + def generatePackage(request: pulumirpc.language.GeneratePackageRequest): scala.concurrent.Future[pulumirpc.language.GeneratePackageResponse] + /** Pack packs a package into a language specific artifact. + */ + def pack(request: pulumirpc.language.PackRequest): scala.concurrent.Future[pulumirpc.language.PackResponse] + } + + object LanguageRuntime extends _root_.scalapb.grpc.ServiceCompanion[LanguageRuntime] { + implicit def serviceCompanion: _root_.scalapb.grpc.ServiceCompanion[LanguageRuntime] = this + def javaDescriptor: _root_.com.google.protobuf.Descriptors.ServiceDescriptor = pulumirpc.language.LanguageProto.javaDescriptor.getServices().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.ServiceDescriptor = pulumirpc.language.LanguageProto.scalaDescriptor.services(0) + def bindService(serviceImpl: LanguageRuntime, executionContext: scala.concurrent.ExecutionContext): _root_.io.grpc.ServerServiceDefinition = + _root_.io.grpc.ServerServiceDefinition.builder(SERVICE) + .addMethod( + METHOD_GET_REQUIRED_PLUGINS, + _root_.io.grpc.stub.ServerCalls.asyncUnaryCall((request: pulumirpc.language.GetRequiredPluginsRequest, observer: _root_.io.grpc.stub.StreamObserver[pulumirpc.language.GetRequiredPluginsResponse]) => { + serviceImpl.getRequiredPlugins(request).onComplete(scalapb.grpc.Grpc.completeObserver(observer))( + executionContext) + })) + .addMethod( + METHOD_RUN, + _root_.io.grpc.stub.ServerCalls.asyncUnaryCall((request: pulumirpc.language.RunRequest, observer: _root_.io.grpc.stub.StreamObserver[pulumirpc.language.RunResponse]) => { + serviceImpl.run(request).onComplete(scalapb.grpc.Grpc.completeObserver(observer))( + executionContext) + })) + .addMethod( + METHOD_GET_PLUGIN_INFO, + _root_.io.grpc.stub.ServerCalls.asyncUnaryCall((request: com.google.protobuf.empty.Empty, observer: _root_.io.grpc.stub.StreamObserver[pulumirpc.plugin.PluginInfo]) => { + serviceImpl.getPluginInfo(request).onComplete(scalapb.grpc.Grpc.completeObserver(observer))( + executionContext) + })) + .addMethod( + METHOD_INSTALL_DEPENDENCIES, + _root_.io.grpc.stub.ServerCalls.asyncServerStreamingCall((request: pulumirpc.language.InstallDependenciesRequest, observer: _root_.io.grpc.stub.StreamObserver[pulumirpc.language.InstallDependenciesResponse]) => { + serviceImpl.installDependencies(request, observer) + })) + .addMethod( + METHOD_ABOUT, + _root_.io.grpc.stub.ServerCalls.asyncUnaryCall((request: com.google.protobuf.empty.Empty, observer: _root_.io.grpc.stub.StreamObserver[pulumirpc.language.AboutResponse]) => { + serviceImpl.about(request).onComplete(scalapb.grpc.Grpc.completeObserver(observer))( + executionContext) + })) + .addMethod( + METHOD_GET_PROGRAM_DEPENDENCIES, + _root_.io.grpc.stub.ServerCalls.asyncUnaryCall((request: pulumirpc.language.GetProgramDependenciesRequest, observer: _root_.io.grpc.stub.StreamObserver[pulumirpc.language.GetProgramDependenciesResponse]) => { + serviceImpl.getProgramDependencies(request).onComplete(scalapb.grpc.Grpc.completeObserver(observer))( + executionContext) + })) + .addMethod( + METHOD_RUN_PLUGIN, + _root_.io.grpc.stub.ServerCalls.asyncServerStreamingCall((request: pulumirpc.language.RunPluginRequest, observer: _root_.io.grpc.stub.StreamObserver[pulumirpc.language.RunPluginResponse]) => { + serviceImpl.runPlugin(request, observer) + })) + .addMethod( + METHOD_GENERATE_PROGRAM, + _root_.io.grpc.stub.ServerCalls.asyncUnaryCall((request: pulumirpc.language.GenerateProgramRequest, observer: _root_.io.grpc.stub.StreamObserver[pulumirpc.language.GenerateProgramResponse]) => { + serviceImpl.generateProgram(request).onComplete(scalapb.grpc.Grpc.completeObserver(observer))( + executionContext) + })) + .addMethod( + METHOD_GENERATE_PROJECT, + _root_.io.grpc.stub.ServerCalls.asyncUnaryCall((request: pulumirpc.language.GenerateProjectRequest, observer: _root_.io.grpc.stub.StreamObserver[pulumirpc.language.GenerateProjectResponse]) => { + serviceImpl.generateProject(request).onComplete(scalapb.grpc.Grpc.completeObserver(observer))( + executionContext) + })) + .addMethod( + METHOD_GENERATE_PACKAGE, + _root_.io.grpc.stub.ServerCalls.asyncUnaryCall((request: pulumirpc.language.GeneratePackageRequest, observer: _root_.io.grpc.stub.StreamObserver[pulumirpc.language.GeneratePackageResponse]) => { + serviceImpl.generatePackage(request).onComplete(scalapb.grpc.Grpc.completeObserver(observer))( + executionContext) + })) + .addMethod( + METHOD_PACK, + _root_.io.grpc.stub.ServerCalls.asyncUnaryCall((request: pulumirpc.language.PackRequest, observer: _root_.io.grpc.stub.StreamObserver[pulumirpc.language.PackResponse]) => { + serviceImpl.pack(request).onComplete(scalapb.grpc.Grpc.completeObserver(observer))( + executionContext) + })) + .build() + } + + /** LanguageRuntime is the interface that the planning monitor uses to drive execution of an interpreter responsible + * for confguring and creating resource objects. + */ + trait LanguageRuntimeBlockingClient { + def serviceCompanion: _root_.scalapb.grpc.ServiceCompanion[LanguageRuntime] = LanguageRuntime + /** GetRequiredPlugins computes the complete set of anticipated plugins required by a program. + */ + def getRequiredPlugins(request: pulumirpc.language.GetRequiredPluginsRequest): pulumirpc.language.GetRequiredPluginsResponse + /** Run executes a program and returns its result. + */ + def run(request: pulumirpc.language.RunRequest): pulumirpc.language.RunResponse + /** GetPluginInfo returns generic information about this plugin, like its version. + */ + def getPluginInfo(request: com.google.protobuf.empty.Empty): pulumirpc.plugin.PluginInfo + /** InstallDependencies will install dependencies for the project, e.g. by running `npm install` for nodejs projects. + */ + def installDependencies(request: pulumirpc.language.InstallDependenciesRequest): scala.collection.Iterator[pulumirpc.language.InstallDependenciesResponse] + /** About returns information about the runtime for this language. + */ + def about(request: com.google.protobuf.empty.Empty): pulumirpc.language.AboutResponse + /** GetProgramDependencies returns the set of dependencies required by the program. + */ + def getProgramDependencies(request: pulumirpc.language.GetProgramDependenciesRequest): pulumirpc.language.GetProgramDependenciesResponse + /** RunPlugin executes a plugin program and returns its result asynchronously. + */ + def runPlugin(request: pulumirpc.language.RunPluginRequest): scala.collection.Iterator[pulumirpc.language.RunPluginResponse] + /** GenerateProgram generates a given PCL program into a program for this language. + */ + def generateProgram(request: pulumirpc.language.GenerateProgramRequest): pulumirpc.language.GenerateProgramResponse + /** GenerateProject generates a given PCL program into a project for this language. + */ + def generateProject(request: pulumirpc.language.GenerateProjectRequest): pulumirpc.language.GenerateProjectResponse + /** GeneratePackage generates a given pulumi package into a package for this language. + */ + def generatePackage(request: pulumirpc.language.GeneratePackageRequest): pulumirpc.language.GeneratePackageResponse + /** Pack packs a package into a language specific artifact. + */ + def pack(request: pulumirpc.language.PackRequest): pulumirpc.language.PackResponse + } + + class LanguageRuntimeBlockingStub(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions = _root_.io.grpc.CallOptions.DEFAULT) extends _root_.io.grpc.stub.AbstractStub[LanguageRuntimeBlockingStub](channel, options) with LanguageRuntimeBlockingClient { + /** GetRequiredPlugins computes the complete set of anticipated plugins required by a program. + */ + override def getRequiredPlugins(request: pulumirpc.language.GetRequiredPluginsRequest): pulumirpc.language.GetRequiredPluginsResponse = { + _root_.scalapb.grpc.ClientCalls.blockingUnaryCall(channel, METHOD_GET_REQUIRED_PLUGINS, options, request) + } + + /** Run executes a program and returns its result. + */ + override def run(request: pulumirpc.language.RunRequest): pulumirpc.language.RunResponse = { + _root_.scalapb.grpc.ClientCalls.blockingUnaryCall(channel, METHOD_RUN, options, request) + } + + /** GetPluginInfo returns generic information about this plugin, like its version. + */ + override def getPluginInfo(request: com.google.protobuf.empty.Empty): pulumirpc.plugin.PluginInfo = { + _root_.scalapb.grpc.ClientCalls.blockingUnaryCall(channel, METHOD_GET_PLUGIN_INFO, options, request) + } + + /** InstallDependencies will install dependencies for the project, e.g. by running `npm install` for nodejs projects. + */ + override def installDependencies(request: pulumirpc.language.InstallDependenciesRequest): scala.collection.Iterator[pulumirpc.language.InstallDependenciesResponse] = { + _root_.scalapb.grpc.ClientCalls.blockingServerStreamingCall(channel, METHOD_INSTALL_DEPENDENCIES, options, request) + } + + /** About returns information about the runtime for this language. + */ + override def about(request: com.google.protobuf.empty.Empty): pulumirpc.language.AboutResponse = { + _root_.scalapb.grpc.ClientCalls.blockingUnaryCall(channel, METHOD_ABOUT, options, request) + } + + /** GetProgramDependencies returns the set of dependencies required by the program. + */ + override def getProgramDependencies(request: pulumirpc.language.GetProgramDependenciesRequest): pulumirpc.language.GetProgramDependenciesResponse = { + _root_.scalapb.grpc.ClientCalls.blockingUnaryCall(channel, METHOD_GET_PROGRAM_DEPENDENCIES, options, request) + } + + /** RunPlugin executes a plugin program and returns its result asynchronously. + */ + override def runPlugin(request: pulumirpc.language.RunPluginRequest): scala.collection.Iterator[pulumirpc.language.RunPluginResponse] = { + _root_.scalapb.grpc.ClientCalls.blockingServerStreamingCall(channel, METHOD_RUN_PLUGIN, options, request) + } + + /** GenerateProgram generates a given PCL program into a program for this language. + */ + override def generateProgram(request: pulumirpc.language.GenerateProgramRequest): pulumirpc.language.GenerateProgramResponse = { + _root_.scalapb.grpc.ClientCalls.blockingUnaryCall(channel, METHOD_GENERATE_PROGRAM, options, request) + } + + /** GenerateProject generates a given PCL program into a project for this language. + */ + override def generateProject(request: pulumirpc.language.GenerateProjectRequest): pulumirpc.language.GenerateProjectResponse = { + _root_.scalapb.grpc.ClientCalls.blockingUnaryCall(channel, METHOD_GENERATE_PROJECT, options, request) + } + + /** GeneratePackage generates a given pulumi package into a package for this language. + */ + override def generatePackage(request: pulumirpc.language.GeneratePackageRequest): pulumirpc.language.GeneratePackageResponse = { + _root_.scalapb.grpc.ClientCalls.blockingUnaryCall(channel, METHOD_GENERATE_PACKAGE, options, request) + } + + /** Pack packs a package into a language specific artifact. + */ + override def pack(request: pulumirpc.language.PackRequest): pulumirpc.language.PackResponse = { + _root_.scalapb.grpc.ClientCalls.blockingUnaryCall(channel, METHOD_PACK, options, request) + } + + override def build(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions): LanguageRuntimeBlockingStub = new LanguageRuntimeBlockingStub(channel, options) + } + + class LanguageRuntimeStub(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions = _root_.io.grpc.CallOptions.DEFAULT) extends _root_.io.grpc.stub.AbstractStub[LanguageRuntimeStub](channel, options) with LanguageRuntime { + /** GetRequiredPlugins computes the complete set of anticipated plugins required by a program. + */ + override def getRequiredPlugins(request: pulumirpc.language.GetRequiredPluginsRequest): scala.concurrent.Future[pulumirpc.language.GetRequiredPluginsResponse] = { + _root_.scalapb.grpc.ClientCalls.asyncUnaryCall(channel, METHOD_GET_REQUIRED_PLUGINS, options, request) + } + + /** Run executes a program and returns its result. + */ + override def run(request: pulumirpc.language.RunRequest): scala.concurrent.Future[pulumirpc.language.RunResponse] = { + _root_.scalapb.grpc.ClientCalls.asyncUnaryCall(channel, METHOD_RUN, options, request) + } + + /** GetPluginInfo returns generic information about this plugin, like its version. + */ + override def getPluginInfo(request: com.google.protobuf.empty.Empty): scala.concurrent.Future[pulumirpc.plugin.PluginInfo] = { + _root_.scalapb.grpc.ClientCalls.asyncUnaryCall(channel, METHOD_GET_PLUGIN_INFO, options, request) + } + + /** InstallDependencies will install dependencies for the project, e.g. by running `npm install` for nodejs projects. + */ + override def installDependencies(request: pulumirpc.language.InstallDependenciesRequest, responseObserver: _root_.io.grpc.stub.StreamObserver[pulumirpc.language.InstallDependenciesResponse]): _root_.scala.Unit = { + _root_.scalapb.grpc.ClientCalls.asyncServerStreamingCall(channel, METHOD_INSTALL_DEPENDENCIES, options, request, responseObserver) + } + + /** About returns information about the runtime for this language. + */ + override def about(request: com.google.protobuf.empty.Empty): scala.concurrent.Future[pulumirpc.language.AboutResponse] = { + _root_.scalapb.grpc.ClientCalls.asyncUnaryCall(channel, METHOD_ABOUT, options, request) + } + + /** GetProgramDependencies returns the set of dependencies required by the program. + */ + override def getProgramDependencies(request: pulumirpc.language.GetProgramDependenciesRequest): scala.concurrent.Future[pulumirpc.language.GetProgramDependenciesResponse] = { + _root_.scalapb.grpc.ClientCalls.asyncUnaryCall(channel, METHOD_GET_PROGRAM_DEPENDENCIES, options, request) + } + + /** RunPlugin executes a plugin program and returns its result asynchronously. + */ + override def runPlugin(request: pulumirpc.language.RunPluginRequest, responseObserver: _root_.io.grpc.stub.StreamObserver[pulumirpc.language.RunPluginResponse]): _root_.scala.Unit = { + _root_.scalapb.grpc.ClientCalls.asyncServerStreamingCall(channel, METHOD_RUN_PLUGIN, options, request, responseObserver) + } + + /** GenerateProgram generates a given PCL program into a program for this language. + */ + override def generateProgram(request: pulumirpc.language.GenerateProgramRequest): scala.concurrent.Future[pulumirpc.language.GenerateProgramResponse] = { + _root_.scalapb.grpc.ClientCalls.asyncUnaryCall(channel, METHOD_GENERATE_PROGRAM, options, request) + } + + /** GenerateProject generates a given PCL program into a project for this language. + */ + override def generateProject(request: pulumirpc.language.GenerateProjectRequest): scala.concurrent.Future[pulumirpc.language.GenerateProjectResponse] = { + _root_.scalapb.grpc.ClientCalls.asyncUnaryCall(channel, METHOD_GENERATE_PROJECT, options, request) + } + + /** GeneratePackage generates a given pulumi package into a package for this language. + */ + override def generatePackage(request: pulumirpc.language.GeneratePackageRequest): scala.concurrent.Future[pulumirpc.language.GeneratePackageResponse] = { + _root_.scalapb.grpc.ClientCalls.asyncUnaryCall(channel, METHOD_GENERATE_PACKAGE, options, request) + } + + /** Pack packs a package into a language specific artifact. + */ + override def pack(request: pulumirpc.language.PackRequest): scala.concurrent.Future[pulumirpc.language.PackResponse] = { + _root_.scalapb.grpc.ClientCalls.asyncUnaryCall(channel, METHOD_PACK, options, request) + } + + override def build(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions): LanguageRuntimeStub = new LanguageRuntimeStub(channel, options) + } + + object LanguageRuntimeStub extends _root_.io.grpc.stub.AbstractStub.StubFactory[LanguageRuntimeStub] { + override def newStub(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions): LanguageRuntimeStub = new LanguageRuntimeStub(channel, options) + + implicit val stubFactory: _root_.io.grpc.stub.AbstractStub.StubFactory[LanguageRuntimeStub] = this + } + + def bindService(serviceImpl: LanguageRuntime, executionContext: scala.concurrent.ExecutionContext): _root_.io.grpc.ServerServiceDefinition = LanguageRuntime.bindService(serviceImpl, executionContext) + + def blockingStub(channel: _root_.io.grpc.Channel): LanguageRuntimeBlockingStub = new LanguageRuntimeBlockingStub(channel) + + def stub(channel: _root_.io.grpc.Channel): LanguageRuntimeStub = new LanguageRuntimeStub(channel) + + def javaDescriptor: _root_.com.google.protobuf.Descriptors.ServiceDescriptor = pulumirpc.language.LanguageProto.javaDescriptor.getServices().get(0) + +} \ No newline at end of file diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/PackRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/PackRequest.scala new file mode 100644 index 00000000..60aaf839 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/PackRequest.scala @@ -0,0 +1,152 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param packageDirectory + * the directory of a package to pack. + * @param destinationDirectory + * the directory to write the packed artifact to. + */ +@SerialVersionUID(0L) +final case class PackRequest( + packageDirectory: _root_.scala.Predef.String = "", + destinationDirectory: _root_.scala.Predef.String = "", + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[PackRequest] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = packageDirectory + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = destinationDirectory + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = packageDirectory + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = destinationDirectory + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withPackageDirectory(__v: _root_.scala.Predef.String): PackRequest = copy(packageDirectory = __v) + def withDestinationDirectory(__v: _root_.scala.Predef.String): PackRequest = copy(destinationDirectory = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = packageDirectory + if (__t != "") __t else null + } + case 2 => { + val __t = destinationDirectory + if (__t != "") __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(packageDirectory) + case 2 => _root_.scalapb.descriptors.PString(destinationDirectory) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.PackRequest.type = pulumirpc.language.PackRequest + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.PackRequest]) +} + +object PackRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.language.PackRequest] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.PackRequest] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.PackRequest = { + var __packageDirectory: _root_.scala.Predef.String = "" + var __destinationDirectory: _root_.scala.Predef.String = "" + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __packageDirectory = _input__.readStringRequireUtf8() + case 18 => + __destinationDirectory = _input__.readStringRequireUtf8() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.PackRequest( + packageDirectory = __packageDirectory, + destinationDirectory = __destinationDirectory, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.PackRequest] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.PackRequest( + packageDirectory = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + destinationDirectory = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse("") + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(19) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(19) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.PackRequest( + packageDirectory = "", + destinationDirectory = "" + ) + implicit class PackRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.PackRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.PackRequest](_l) { + def packageDirectory: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.packageDirectory)((c_, f_) => c_.copy(packageDirectory = f_)) + def destinationDirectory: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.destinationDirectory)((c_, f_) => c_.copy(destinationDirectory = f_)) + } + final val PACKAGE_DIRECTORY_FIELD_NUMBER = 1 + final val DESTINATION_DIRECTORY_FIELD_NUMBER = 2 + def of( + packageDirectory: _root_.scala.Predef.String, + destinationDirectory: _root_.scala.Predef.String + ): _root_.pulumirpc.language.PackRequest = _root_.pulumirpc.language.PackRequest( + packageDirectory, + destinationDirectory + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.PackRequest]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/PackResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/PackResponse.scala new file mode 100644 index 00000000..48d47ec1 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/PackResponse.scala @@ -0,0 +1,120 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param artifactPath + * the full path of the packed artifact. + */ +@SerialVersionUID(0L) +final case class PackResponse( + artifactPath: _root_.scala.Predef.String = "", + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[PackResponse] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = artifactPath + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = artifactPath + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withArtifactPath(__v: _root_.scala.Predef.String): PackResponse = copy(artifactPath = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = artifactPath + if (__t != "") __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(artifactPath) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.PackResponse.type = pulumirpc.language.PackResponse + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.PackResponse]) +} + +object PackResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.language.PackResponse] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.PackResponse] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.PackResponse = { + var __artifactPath: _root_.scala.Predef.String = "" + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __artifactPath = _input__.readStringRequireUtf8() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.PackResponse( + artifactPath = __artifactPath, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.PackResponse] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.PackResponse( + artifactPath = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse("") + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(20) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(20) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.PackResponse( + artifactPath = "" + ) + implicit class PackResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.PackResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.PackResponse](_l) { + def artifactPath: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.artifactPath)((c_, f_) => c_.copy(artifactPath = f_)) + } + final val ARTIFACT_PATH_FIELD_NUMBER = 1 + def of( + artifactPath: _root_.scala.Predef.String + ): _root_.pulumirpc.language.PackResponse = _root_.pulumirpc.language.PackResponse( + artifactPath + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.PackResponse]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/ProgramInfo.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/ProgramInfo.scala new file mode 100644 index 00000000..ae0bf047 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/ProgramInfo.scala @@ -0,0 +1,226 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** ProgramInfo are the common set of options that a language runtime needs to execute or query a program. This + * is filled in by the engine based on where the `Pulumi.yaml` file was, the `runtime.options` property, and + * the `main` property. + * + * @param rootDirectory + * the root of the project, where the `Pulumi.yaml` file is located. + * @param programDirectory + * the absolute path to the directory of the program to execute. Generally, but not required to be, + * underneath the root directory. + * @param entryPoint + * the entry point of the program, normally '.' meaning to just use the program directory, but can also be + * a filename inside the program directory. How that filename is interpreted, if at all, is language + * specific. + * @param options + * JSON style options from the `Pulumi.yaml` runtime options section. + */ +@SerialVersionUID(0L) +final case class ProgramInfo( + rootDirectory: _root_.scala.Predef.String = "", + programDirectory: _root_.scala.Predef.String = "", + entryPoint: _root_.scala.Predef.String = "", + options: _root_.scala.Option[com.google.protobuf.struct.Struct] = _root_.scala.None, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ProgramInfo] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = rootDirectory + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = programDirectory + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + + { + val __value = entryPoint + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value) + } + }; + if (options.isDefined) { + val __value = options.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = rootDirectory + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = programDirectory + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + { + val __v = entryPoint + if (!__v.isEmpty) { + _output__.writeString(3, __v) + } + }; + options.foreach { __v => + val __m = __v + _output__.writeTag(4, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def withRootDirectory(__v: _root_.scala.Predef.String): ProgramInfo = copy(rootDirectory = __v) + def withProgramDirectory(__v: _root_.scala.Predef.String): ProgramInfo = copy(programDirectory = __v) + def withEntryPoint(__v: _root_.scala.Predef.String): ProgramInfo = copy(entryPoint = __v) + def getOptions: com.google.protobuf.struct.Struct = options.getOrElse(com.google.protobuf.struct.Struct.defaultInstance) + def clearOptions: ProgramInfo = copy(options = _root_.scala.None) + def withOptions(__v: com.google.protobuf.struct.Struct): ProgramInfo = copy(options = Option(__v)) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = rootDirectory + if (__t != "") __t else null + } + case 2 => { + val __t = programDirectory + if (__t != "") __t else null + } + case 3 => { + val __t = entryPoint + if (__t != "") __t else null + } + case 4 => options.orNull + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(rootDirectory) + case 2 => _root_.scalapb.descriptors.PString(programDirectory) + case 3 => _root_.scalapb.descriptors.PString(entryPoint) + case 4 => options.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.ProgramInfo.type = pulumirpc.language.ProgramInfo + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.ProgramInfo]) +} + +object ProgramInfo extends scalapb.GeneratedMessageCompanion[pulumirpc.language.ProgramInfo] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.ProgramInfo] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.ProgramInfo = { + var __rootDirectory: _root_.scala.Predef.String = "" + var __programDirectory: _root_.scala.Predef.String = "" + var __entryPoint: _root_.scala.Predef.String = "" + var __options: _root_.scala.Option[com.google.protobuf.struct.Struct] = _root_.scala.None + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __rootDirectory = _input__.readStringRequireUtf8() + case 18 => + __programDirectory = _input__.readStringRequireUtf8() + case 26 => + __entryPoint = _input__.readStringRequireUtf8() + case 34 => + __options = _root_.scala.Option(__options.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.ProgramInfo( + rootDirectory = __rootDirectory, + programDirectory = __programDirectory, + entryPoint = __entryPoint, + options = __options, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.ProgramInfo] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.ProgramInfo( + rootDirectory = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + programDirectory = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + entryPoint = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + options = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.struct.Struct]]) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(0) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 4 => __out = com.google.protobuf.struct.Struct + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.ProgramInfo( + rootDirectory = "", + programDirectory = "", + entryPoint = "", + options = _root_.scala.None + ) + implicit class ProgramInfoLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.ProgramInfo]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.ProgramInfo](_l) { + def rootDirectory: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.rootDirectory)((c_, f_) => c_.copy(rootDirectory = f_)) + def programDirectory: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.programDirectory)((c_, f_) => c_.copy(programDirectory = f_)) + def entryPoint: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.entryPoint)((c_, f_) => c_.copy(entryPoint = f_)) + def options: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getOptions)((c_, f_) => c_.copy(options = _root_.scala.Option(f_))) + def optionalOptions: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.options)((c_, f_) => c_.copy(options = f_)) + } + final val ROOT_DIRECTORY_FIELD_NUMBER = 1 + final val PROGRAM_DIRECTORY_FIELD_NUMBER = 2 + final val ENTRY_POINT_FIELD_NUMBER = 3 + final val OPTIONS_FIELD_NUMBER = 4 + def of( + rootDirectory: _root_.scala.Predef.String, + programDirectory: _root_.scala.Predef.String, + entryPoint: _root_.scala.Predef.String, + options: _root_.scala.Option[com.google.protobuf.struct.Struct] + ): _root_.pulumirpc.language.ProgramInfo = _root_.pulumirpc.language.ProgramInfo( + rootDirectory, + programDirectory, + entryPoint, + options + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.ProgramInfo]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/RunPluginRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/RunPluginRequest.scala new file mode 100644 index 00000000..7a8b24e4 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/RunPluginRequest.scala @@ -0,0 +1,241 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** @param pwd + * the program's working directory. + * @param program + * the path to the program to execute. + * @param args + * any arguments to pass to the program. + * @param env + * any environment variables to set as part of the program. + * @param info + * the program info to use to execute the plugin. + */ +@SerialVersionUID(0L) +final case class RunPluginRequest( + pwd: _root_.scala.Predef.String = "", + @scala.deprecated(message="Marked as deprecated in proto file", "") program: _root_.scala.Predef.String = "", + args: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, + env: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, + info: _root_.scala.Option[pulumirpc.language.ProgramInfo] = _root_.scala.None, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[RunPluginRequest] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = pwd + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = program + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + args.foreach { __item => + val __value = __item + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value) + } + env.foreach { __item => + val __value = __item + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(4, __value) + } + if (info.isDefined) { + val __value = info.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = pwd + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = program + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + args.foreach { __v => + val __m = __v + _output__.writeString(3, __m) + }; + env.foreach { __v => + val __m = __v + _output__.writeString(4, __m) + }; + info.foreach { __v => + val __m = __v + _output__.writeTag(5, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def withPwd(__v: _root_.scala.Predef.String): RunPluginRequest = copy(pwd = __v) + def withProgram(__v: _root_.scala.Predef.String): RunPluginRequest = copy(program = __v) + def clearArgs = copy(args = _root_.scala.Seq.empty) + def addArgs(__vs: _root_.scala.Predef.String *): RunPluginRequest = addAllArgs(__vs) + def addAllArgs(__vs: Iterable[_root_.scala.Predef.String]): RunPluginRequest = copy(args = args ++ __vs) + def withArgs(__v: _root_.scala.Seq[_root_.scala.Predef.String]): RunPluginRequest = copy(args = __v) + def clearEnv = copy(env = _root_.scala.Seq.empty) + def addEnv(__vs: _root_.scala.Predef.String *): RunPluginRequest = addAllEnv(__vs) + def addAllEnv(__vs: Iterable[_root_.scala.Predef.String]): RunPluginRequest = copy(env = env ++ __vs) + def withEnv(__v: _root_.scala.Seq[_root_.scala.Predef.String]): RunPluginRequest = copy(env = __v) + def getInfo: pulumirpc.language.ProgramInfo = info.getOrElse(pulumirpc.language.ProgramInfo.defaultInstance) + def clearInfo: RunPluginRequest = copy(info = _root_.scala.None) + def withInfo(__v: pulumirpc.language.ProgramInfo): RunPluginRequest = copy(info = Option(__v)) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = pwd + if (__t != "") __t else null + } + case 2 => { + val __t = program + if (__t != "") __t else null + } + case 3 => args + case 4 => env + case 5 => info.orNull + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(pwd) + case 2 => _root_.scalapb.descriptors.PString(program) + case 3 => _root_.scalapb.descriptors.PRepeated(args.iterator.map(_root_.scalapb.descriptors.PString(_)).toVector) + case 4 => _root_.scalapb.descriptors.PRepeated(env.iterator.map(_root_.scalapb.descriptors.PString(_)).toVector) + case 5 => info.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.RunPluginRequest.type = pulumirpc.language.RunPluginRequest + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.RunPluginRequest]) +} + +object RunPluginRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.language.RunPluginRequest] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.RunPluginRequest] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.RunPluginRequest = { + var __pwd: _root_.scala.Predef.String = "" + var __program: _root_.scala.Predef.String = "" + val __args: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] + val __env: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] + var __info: _root_.scala.Option[pulumirpc.language.ProgramInfo] = _root_.scala.None + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __pwd = _input__.readStringRequireUtf8() + case 18 => + __program = _input__.readStringRequireUtf8() + case 26 => + __args += _input__.readStringRequireUtf8() + case 34 => + __env += _input__.readStringRequireUtf8() + case 42 => + __info = _root_.scala.Option(__info.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.language.ProgramInfo](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.RunPluginRequest( + pwd = __pwd, + program = __program, + args = __args.result(), + env = __env.result(), + info = __info, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.RunPluginRequest] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.RunPluginRequest( + pwd = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + program = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + args = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Seq[_root_.scala.Predef.String]]).getOrElse(_root_.scala.Seq.empty), + env = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Seq[_root_.scala.Predef.String]]).getOrElse(_root_.scala.Seq.empty), + info = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).flatMap(_.as[_root_.scala.Option[pulumirpc.language.ProgramInfo]]) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(11) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(11) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 5 => __out = pulumirpc.language.ProgramInfo + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.RunPluginRequest( + pwd = "", + program = "", + args = _root_.scala.Seq.empty, + env = _root_.scala.Seq.empty, + info = _root_.scala.None + ) + implicit class RunPluginRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.RunPluginRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.RunPluginRequest](_l) { + def pwd: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.pwd)((c_, f_) => c_.copy(pwd = f_)) + def program: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.program)((c_, f_) => c_.copy(program = f_)) + def args: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.args)((c_, f_) => c_.copy(args = f_)) + def env: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.env)((c_, f_) => c_.copy(env = f_)) + def info: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.ProgramInfo] = field(_.getInfo)((c_, f_) => c_.copy(info = _root_.scala.Option(f_))) + def optionalInfo: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.language.ProgramInfo]] = field(_.info)((c_, f_) => c_.copy(info = f_)) + } + final val PWD_FIELD_NUMBER = 1 + final val PROGRAM_FIELD_NUMBER = 2 + final val ARGS_FIELD_NUMBER = 3 + final val ENV_FIELD_NUMBER = 4 + final val INFO_FIELD_NUMBER = 5 + def of( + pwd: _root_.scala.Predef.String, + program: _root_.scala.Predef.String, + args: _root_.scala.Seq[_root_.scala.Predef.String], + env: _root_.scala.Seq[_root_.scala.Predef.String], + info: _root_.scala.Option[pulumirpc.language.ProgramInfo] + ): _root_.pulumirpc.language.RunPluginRequest = _root_.pulumirpc.language.RunPluginRequest( + pwd, + program, + args, + env, + info + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.RunPluginRequest]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/RunPluginResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/RunPluginResponse.scala new file mode 100644 index 00000000..e2b08705 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/RunPluginResponse.scala @@ -0,0 +1,190 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +@SerialVersionUID(0L) +final case class RunPluginResponse( + output: pulumirpc.language.RunPluginResponse.Output = pulumirpc.language.RunPluginResponse.Output.Empty, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[RunPluginResponse] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + if (output.stdout.isDefined) { + val __value = output.stdout.get + __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(1, __value) + }; + if (output.stderr.isDefined) { + val __value = output.stderr.get + __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(2, __value) + }; + if (output.exitcode.isDefined) { + val __value = output.exitcode.get + __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(3, __value) + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + output.stdout.foreach { __v => + val __m = __v + _output__.writeBytes(1, __m) + }; + output.stderr.foreach { __v => + val __m = __v + _output__.writeBytes(2, __m) + }; + output.exitcode.foreach { __v => + val __m = __v + _output__.writeInt32(3, __m) + }; + unknownFields.writeTo(_output__) + } + def getStdout: _root_.com.google.protobuf.ByteString = output.stdout.getOrElse(_root_.com.google.protobuf.ByteString.EMPTY) + def withStdout(__v: _root_.com.google.protobuf.ByteString): RunPluginResponse = copy(output = pulumirpc.language.RunPluginResponse.Output.Stdout(__v)) + def getStderr: _root_.com.google.protobuf.ByteString = output.stderr.getOrElse(_root_.com.google.protobuf.ByteString.EMPTY) + def withStderr(__v: _root_.com.google.protobuf.ByteString): RunPluginResponse = copy(output = pulumirpc.language.RunPluginResponse.Output.Stderr(__v)) + def getExitcode: _root_.scala.Int = output.exitcode.getOrElse(0) + def withExitcode(__v: _root_.scala.Int): RunPluginResponse = copy(output = pulumirpc.language.RunPluginResponse.Output.Exitcode(__v)) + def clearOutput: RunPluginResponse = copy(output = pulumirpc.language.RunPluginResponse.Output.Empty) + def withOutput(__v: pulumirpc.language.RunPluginResponse.Output): RunPluginResponse = copy(output = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => output.stdout.orNull + case 2 => output.stderr.orNull + case 3 => output.exitcode.orNull + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => output.stdout.map(_root_.scalapb.descriptors.PByteString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 2 => output.stderr.map(_root_.scalapb.descriptors.PByteString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 3 => output.exitcode.map(_root_.scalapb.descriptors.PInt(_)).getOrElse(_root_.scalapb.descriptors.PEmpty) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.RunPluginResponse.type = pulumirpc.language.RunPluginResponse + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.RunPluginResponse]) +} + +object RunPluginResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.language.RunPluginResponse] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.RunPluginResponse] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.RunPluginResponse = { + var __output: pulumirpc.language.RunPluginResponse.Output = pulumirpc.language.RunPluginResponse.Output.Empty + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __output = pulumirpc.language.RunPluginResponse.Output.Stdout(_input__.readBytes()) + case 18 => + __output = pulumirpc.language.RunPluginResponse.Output.Stderr(_input__.readBytes()) + case 24 => + __output = pulumirpc.language.RunPluginResponse.Output.Exitcode(_input__.readInt32()) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.RunPluginResponse( + output = __output, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.RunPluginResponse] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.RunPluginResponse( + output = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[_root_.com.google.protobuf.ByteString]]).map(pulumirpc.language.RunPluginResponse.Output.Stdout(_)) + .orElse[pulumirpc.language.RunPluginResponse.Output](__fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[_root_.com.google.protobuf.ByteString]]).map(pulumirpc.language.RunPluginResponse.Output.Stderr(_))) + .orElse[pulumirpc.language.RunPluginResponse.Output](__fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Int]]).map(pulumirpc.language.RunPluginResponse.Output.Exitcode(_))) + .getOrElse(pulumirpc.language.RunPluginResponse.Output.Empty) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(12) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(12) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.RunPluginResponse( + output = pulumirpc.language.RunPluginResponse.Output.Empty + ) + sealed trait Output extends _root_.scalapb.GeneratedOneof { + def isEmpty: _root_.scala.Boolean = false + def isDefined: _root_.scala.Boolean = true + def isStdout: _root_.scala.Boolean = false + def isStderr: _root_.scala.Boolean = false + def isExitcode: _root_.scala.Boolean = false + def stdout: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = _root_.scala.None + def stderr: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = _root_.scala.None + def exitcode: _root_.scala.Option[_root_.scala.Int] = _root_.scala.None + } + object Output { + @SerialVersionUID(0L) + case object Empty extends pulumirpc.language.RunPluginResponse.Output { + type ValueType = _root_.scala.Nothing + override def isEmpty: _root_.scala.Boolean = true + override def isDefined: _root_.scala.Boolean = false + override def number: _root_.scala.Int = 0 + override def value: _root_.scala.Nothing = throw new java.util.NoSuchElementException("Empty.value") + } + + @SerialVersionUID(0L) + final case class Stdout(value: _root_.com.google.protobuf.ByteString) extends pulumirpc.language.RunPluginResponse.Output { + type ValueType = _root_.com.google.protobuf.ByteString + override def isStdout: _root_.scala.Boolean = true + override def stdout: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = Some(value) + override def number: _root_.scala.Int = 1 + } + @SerialVersionUID(0L) + final case class Stderr(value: _root_.com.google.protobuf.ByteString) extends pulumirpc.language.RunPluginResponse.Output { + type ValueType = _root_.com.google.protobuf.ByteString + override def isStderr: _root_.scala.Boolean = true + override def stderr: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = Some(value) + override def number: _root_.scala.Int = 2 + } + @SerialVersionUID(0L) + final case class Exitcode(value: _root_.scala.Int) extends pulumirpc.language.RunPluginResponse.Output { + type ValueType = _root_.scala.Int + override def isExitcode: _root_.scala.Boolean = true + override def exitcode: _root_.scala.Option[_root_.scala.Int] = Some(value) + override def number: _root_.scala.Int = 3 + } + } + implicit class RunPluginResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.RunPluginResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.RunPluginResponse](_l) { + def stdout: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.getStdout)((c_, f_) => c_.copy(output = pulumirpc.language.RunPluginResponse.Output.Stdout(f_))) + def stderr: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.getStderr)((c_, f_) => c_.copy(output = pulumirpc.language.RunPluginResponse.Output.Stderr(f_))) + def exitcode: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.getExitcode)((c_, f_) => c_.copy(output = pulumirpc.language.RunPluginResponse.Output.Exitcode(f_))) + def output: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.RunPluginResponse.Output] = field(_.output)((c_, f_) => c_.copy(output = f_)) + } + final val STDOUT_FIELD_NUMBER = 1 + final val STDERR_FIELD_NUMBER = 2 + final val EXITCODE_FIELD_NUMBER = 3 + def of( + output: pulumirpc.language.RunPluginResponse.Output + ): _root_.pulumirpc.language.RunPluginResponse = _root_.pulumirpc.language.RunPluginResponse( + output + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.RunPluginResponse]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/RunRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/RunRequest.scala new file mode 100644 index 00000000..911e7a35 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/RunRequest.scala @@ -0,0 +1,676 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** RunRequest asks the interpreter to execute a program. + * + * @param project + * the project name. + * @param stack + * the name of the stack being deployed into. + * @param pwd + * the program's working directory. + * @param program + * the path to the program to execute. + * @param args + * any arguments to pass to the program. + * @param config + * the configuration variables to apply before running. + * @param dryRun + * true if we're only doing a dryrun (preview). + * @param parallel + * the degree of parallelism for resource operations (<=1 for serial). + * @param monitorAddress + * the address for communicating back to the resource monitor. + * @param queryMode + * true if we're only doing a query. + * @param configSecretKeys + * the configuration keys that have secret values. + * @param organization + * the organization of the stack being deployed into. + * @param configPropertyMap + * the configuration variables to apply before running. + * @param info + * the program info to use to execute the program. + */ +@SerialVersionUID(0L) +final case class RunRequest( + project: _root_.scala.Predef.String = "", + stack: _root_.scala.Predef.String = "", + pwd: _root_.scala.Predef.String = "", + @scala.deprecated(message="Marked as deprecated in proto file", "") program: _root_.scala.Predef.String = "", + args: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, + config: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String] = _root_.scala.collection.immutable.Map.empty, + dryRun: _root_.scala.Boolean = false, + parallel: _root_.scala.Int = 0, + monitorAddress: _root_.scala.Predef.String = "", + queryMode: _root_.scala.Boolean = false, + configSecretKeys: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, + organization: _root_.scala.Predef.String = "", + configPropertyMap: _root_.scala.Option[com.google.protobuf.struct.Struct] = _root_.scala.None, + info: _root_.scala.Option[pulumirpc.language.ProgramInfo] = _root_.scala.None, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[RunRequest] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = project + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = stack + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + + { + val __value = pwd + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value) + } + }; + + { + val __value = program + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(4, __value) + } + }; + args.foreach { __item => + val __value = __item + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(5, __value) + } + config.foreach { __item => + val __value = pulumirpc.language.RunRequest._typemapper_config.toBase(__item) + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + + { + val __value = dryRun + if (__value != false) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(7, __value) + } + }; + + { + val __value = parallel + if (__value != 0) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(8, __value) + } + }; + + { + val __value = monitorAddress + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(9, __value) + } + }; + + { + val __value = queryMode + if (__value != false) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(10, __value) + } + }; + configSecretKeys.foreach { __item => + val __value = __item + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(11, __value) + } + + { + val __value = organization + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(12, __value) + } + }; + if (configPropertyMap.isDefined) { + val __value = configPropertyMap.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + if (info.isDefined) { + val __value = info.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = project + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = stack + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + { + val __v = pwd + if (!__v.isEmpty) { + _output__.writeString(3, __v) + } + }; + { + val __v = program + if (!__v.isEmpty) { + _output__.writeString(4, __v) + } + }; + args.foreach { __v => + val __m = __v + _output__.writeString(5, __m) + }; + config.foreach { __v => + val __m = pulumirpc.language.RunRequest._typemapper_config.toBase(__v) + _output__.writeTag(6, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + { + val __v = dryRun + if (__v != false) { + _output__.writeBool(7, __v) + } + }; + { + val __v = parallel + if (__v != 0) { + _output__.writeInt32(8, __v) + } + }; + { + val __v = monitorAddress + if (!__v.isEmpty) { + _output__.writeString(9, __v) + } + }; + { + val __v = queryMode + if (__v != false) { + _output__.writeBool(10, __v) + } + }; + configSecretKeys.foreach { __v => + val __m = __v + _output__.writeString(11, __m) + }; + { + val __v = organization + if (!__v.isEmpty) { + _output__.writeString(12, __v) + } + }; + configPropertyMap.foreach { __v => + val __m = __v + _output__.writeTag(13, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + info.foreach { __v => + val __m = __v + _output__.writeTag(14, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def withProject(__v: _root_.scala.Predef.String): RunRequest = copy(project = __v) + def withStack(__v: _root_.scala.Predef.String): RunRequest = copy(stack = __v) + def withPwd(__v: _root_.scala.Predef.String): RunRequest = copy(pwd = __v) + def withProgram(__v: _root_.scala.Predef.String): RunRequest = copy(program = __v) + def clearArgs = copy(args = _root_.scala.Seq.empty) + def addArgs(__vs: _root_.scala.Predef.String *): RunRequest = addAllArgs(__vs) + def addAllArgs(__vs: Iterable[_root_.scala.Predef.String]): RunRequest = copy(args = args ++ __vs) + def withArgs(__v: _root_.scala.Seq[_root_.scala.Predef.String]): RunRequest = copy(args = __v) + def clearConfig = copy(config = _root_.scala.collection.immutable.Map.empty) + def addConfig(__vs: (_root_.scala.Predef.String, _root_.scala.Predef.String) *): RunRequest = addAllConfig(__vs) + def addAllConfig(__vs: Iterable[(_root_.scala.Predef.String, _root_.scala.Predef.String)]): RunRequest = copy(config = config ++ __vs) + def withConfig(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]): RunRequest = copy(config = __v) + def withDryRun(__v: _root_.scala.Boolean): RunRequest = copy(dryRun = __v) + def withParallel(__v: _root_.scala.Int): RunRequest = copy(parallel = __v) + def withMonitorAddress(__v: _root_.scala.Predef.String): RunRequest = copy(monitorAddress = __v) + def withQueryMode(__v: _root_.scala.Boolean): RunRequest = copy(queryMode = __v) + def clearConfigSecretKeys = copy(configSecretKeys = _root_.scala.Seq.empty) + def addConfigSecretKeys(__vs: _root_.scala.Predef.String *): RunRequest = addAllConfigSecretKeys(__vs) + def addAllConfigSecretKeys(__vs: Iterable[_root_.scala.Predef.String]): RunRequest = copy(configSecretKeys = configSecretKeys ++ __vs) + def withConfigSecretKeys(__v: _root_.scala.Seq[_root_.scala.Predef.String]): RunRequest = copy(configSecretKeys = __v) + def withOrganization(__v: _root_.scala.Predef.String): RunRequest = copy(organization = __v) + def getConfigPropertyMap: com.google.protobuf.struct.Struct = configPropertyMap.getOrElse(com.google.protobuf.struct.Struct.defaultInstance) + def clearConfigPropertyMap: RunRequest = copy(configPropertyMap = _root_.scala.None) + def withConfigPropertyMap(__v: com.google.protobuf.struct.Struct): RunRequest = copy(configPropertyMap = Option(__v)) + def getInfo: pulumirpc.language.ProgramInfo = info.getOrElse(pulumirpc.language.ProgramInfo.defaultInstance) + def clearInfo: RunRequest = copy(info = _root_.scala.None) + def withInfo(__v: pulumirpc.language.ProgramInfo): RunRequest = copy(info = Option(__v)) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = project + if (__t != "") __t else null + } + case 2 => { + val __t = stack + if (__t != "") __t else null + } + case 3 => { + val __t = pwd + if (__t != "") __t else null + } + case 4 => { + val __t = program + if (__t != "") __t else null + } + case 5 => args + case 6 => config.iterator.map(pulumirpc.language.RunRequest._typemapper_config.toBase(_)).toSeq + case 7 => { + val __t = dryRun + if (__t != false) __t else null + } + case 8 => { + val __t = parallel + if (__t != 0) __t else null + } + case 9 => { + val __t = monitorAddress + if (__t != "") __t else null + } + case 10 => { + val __t = queryMode + if (__t != false) __t else null + } + case 11 => configSecretKeys + case 12 => { + val __t = organization + if (__t != "") __t else null + } + case 13 => configPropertyMap.orNull + case 14 => info.orNull + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(project) + case 2 => _root_.scalapb.descriptors.PString(stack) + case 3 => _root_.scalapb.descriptors.PString(pwd) + case 4 => _root_.scalapb.descriptors.PString(program) + case 5 => _root_.scalapb.descriptors.PRepeated(args.iterator.map(_root_.scalapb.descriptors.PString(_)).toVector) + case 6 => _root_.scalapb.descriptors.PRepeated(config.iterator.map(pulumirpc.language.RunRequest._typemapper_config.toBase(_).toPMessage).toVector) + case 7 => _root_.scalapb.descriptors.PBoolean(dryRun) + case 8 => _root_.scalapb.descriptors.PInt(parallel) + case 9 => _root_.scalapb.descriptors.PString(monitorAddress) + case 10 => _root_.scalapb.descriptors.PBoolean(queryMode) + case 11 => _root_.scalapb.descriptors.PRepeated(configSecretKeys.iterator.map(_root_.scalapb.descriptors.PString(_)).toVector) + case 12 => _root_.scalapb.descriptors.PString(organization) + case 13 => configPropertyMap.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 14 => info.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.RunRequest.type = pulumirpc.language.RunRequest + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.RunRequest]) +} + +object RunRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.language.RunRequest] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.RunRequest] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.RunRequest = { + var __project: _root_.scala.Predef.String = "" + var __stack: _root_.scala.Predef.String = "" + var __pwd: _root_.scala.Predef.String = "" + var __program: _root_.scala.Predef.String = "" + val __args: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] + val __config: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, _root_.scala.Predef.String), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, _root_.scala.Predef.String] + var __dryRun: _root_.scala.Boolean = false + var __parallel: _root_.scala.Int = 0 + var __monitorAddress: _root_.scala.Predef.String = "" + var __queryMode: _root_.scala.Boolean = false + val __configSecretKeys: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] + var __organization: _root_.scala.Predef.String = "" + var __configPropertyMap: _root_.scala.Option[com.google.protobuf.struct.Struct] = _root_.scala.None + var __info: _root_.scala.Option[pulumirpc.language.ProgramInfo] = _root_.scala.None + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __project = _input__.readStringRequireUtf8() + case 18 => + __stack = _input__.readStringRequireUtf8() + case 26 => + __pwd = _input__.readStringRequireUtf8() + case 34 => + __program = _input__.readStringRequireUtf8() + case 42 => + __args += _input__.readStringRequireUtf8() + case 50 => + __config += pulumirpc.language.RunRequest._typemapper_config.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.language.RunRequest.ConfigEntry](_input__)) + case 56 => + __dryRun = _input__.readBool() + case 64 => + __parallel = _input__.readInt32() + case 74 => + __monitorAddress = _input__.readStringRequireUtf8() + case 80 => + __queryMode = _input__.readBool() + case 90 => + __configSecretKeys += _input__.readStringRequireUtf8() + case 98 => + __organization = _input__.readStringRequireUtf8() + case 106 => + __configPropertyMap = _root_.scala.Option(__configPropertyMap.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case 114 => + __info = _root_.scala.Option(__info.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.language.ProgramInfo](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.RunRequest( + project = __project, + stack = __stack, + pwd = __pwd, + program = __program, + args = __args.result(), + config = __config.result(), + dryRun = __dryRun, + parallel = __parallel, + monitorAddress = __monitorAddress, + queryMode = __queryMode, + configSecretKeys = __configSecretKeys.result(), + organization = __organization, + configPropertyMap = __configPropertyMap, + info = __info, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.RunRequest] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.RunRequest( + project = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + stack = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + pwd = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + program = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + args = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Seq[_root_.scala.Predef.String]]).getOrElse(_root_.scala.Seq.empty), + config = __fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scala.Seq[pulumirpc.language.RunRequest.ConfigEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.language.RunRequest._typemapper_config.toCustom(_)).toMap, + dryRun = __fieldsMap.get(scalaDescriptor.findFieldByNumber(7).get).map(_.as[_root_.scala.Boolean]).getOrElse(false), + parallel = __fieldsMap.get(scalaDescriptor.findFieldByNumber(8).get).map(_.as[_root_.scala.Int]).getOrElse(0), + monitorAddress = __fieldsMap.get(scalaDescriptor.findFieldByNumber(9).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + queryMode = __fieldsMap.get(scalaDescriptor.findFieldByNumber(10).get).map(_.as[_root_.scala.Boolean]).getOrElse(false), + configSecretKeys = __fieldsMap.get(scalaDescriptor.findFieldByNumber(11).get).map(_.as[_root_.scala.Seq[_root_.scala.Predef.String]]).getOrElse(_root_.scala.Seq.empty), + organization = __fieldsMap.get(scalaDescriptor.findFieldByNumber(12).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + configPropertyMap = __fieldsMap.get(scalaDescriptor.findFieldByNumber(13).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.struct.Struct]]), + info = __fieldsMap.get(scalaDescriptor.findFieldByNumber(14).get).flatMap(_.as[_root_.scala.Option[pulumirpc.language.ProgramInfo]]) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(7) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(7) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 6 => __out = pulumirpc.language.RunRequest.ConfigEntry + case 13 => __out = com.google.protobuf.struct.Struct + case 14 => __out = pulumirpc.language.ProgramInfo + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( + _root_.pulumirpc.language.RunRequest.ConfigEntry + ) + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.RunRequest( + project = "", + stack = "", + pwd = "", + program = "", + args = _root_.scala.Seq.empty, + config = _root_.scala.collection.immutable.Map.empty, + dryRun = false, + parallel = 0, + monitorAddress = "", + queryMode = false, + configSecretKeys = _root_.scala.Seq.empty, + organization = "", + configPropertyMap = _root_.scala.None, + info = _root_.scala.None + ) + @SerialVersionUID(0L) + final case class ConfigEntry( + key: _root_.scala.Predef.String = "", + value: _root_.scala.Predef.String = "", + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ConfigEntry] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = key + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = value + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = key + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = value + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withKey(__v: _root_.scala.Predef.String): ConfigEntry = copy(key = __v) + def withValue(__v: _root_.scala.Predef.String): ConfigEntry = copy(value = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = key + if (__t != "") __t else null + } + case 2 => { + val __t = value + if (__t != "") __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(key) + case 2 => _root_.scalapb.descriptors.PString(value) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.RunRequest.ConfigEntry.type = pulumirpc.language.RunRequest.ConfigEntry + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.RunRequest.ConfigEntry]) + } + + object ConfigEntry extends scalapb.GeneratedMessageCompanion[pulumirpc.language.RunRequest.ConfigEntry] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.RunRequest.ConfigEntry] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.RunRequest.ConfigEntry = { + var __key: _root_.scala.Predef.String = "" + var __value: _root_.scala.Predef.String = "" + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __key = _input__.readStringRequireUtf8() + case 18 => + __value = _input__.readStringRequireUtf8() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.RunRequest.ConfigEntry( + key = __key, + value = __value, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.RunRequest.ConfigEntry] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.RunRequest.ConfigEntry( + key = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse("") + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = pulumirpc.language.RunRequest.javaDescriptor.getNestedTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = pulumirpc.language.RunRequest.scalaDescriptor.nestedMessages(0) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.RunRequest.ConfigEntry( + key = "", + value = "" + ) + implicit class ConfigEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.RunRequest.ConfigEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.RunRequest.ConfigEntry](_l) { + def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) + def value: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.value)((c_, f_) => c_.copy(value = f_)) + } + final val KEY_FIELD_NUMBER = 1 + final val VALUE_FIELD_NUMBER = 2 + @transient + implicit val keyValueMapper: _root_.scalapb.TypeMapper[pulumirpc.language.RunRequest.ConfigEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)] = + _root_.scalapb.TypeMapper[pulumirpc.language.RunRequest.ConfigEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)](__m => (__m.key, __m.value))(__p => pulumirpc.language.RunRequest.ConfigEntry(__p._1, __p._2)) + def of( + key: _root_.scala.Predef.String, + value: _root_.scala.Predef.String + ): _root_.pulumirpc.language.RunRequest.ConfigEntry = _root_.pulumirpc.language.RunRequest.ConfigEntry( + key, + value + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.RunRequest.ConfigEntry]) + } + + implicit class RunRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.RunRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.RunRequest](_l) { + def project: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.project)((c_, f_) => c_.copy(project = f_)) + def stack: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.stack)((c_, f_) => c_.copy(stack = f_)) + def pwd: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.pwd)((c_, f_) => c_.copy(pwd = f_)) + def program: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.program)((c_, f_) => c_.copy(program = f_)) + def args: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.args)((c_, f_) => c_.copy(args = f_)) + def config: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = field(_.config)((c_, f_) => c_.copy(config = f_)) + def dryRun: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.dryRun)((c_, f_) => c_.copy(dryRun = f_)) + def parallel: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.parallel)((c_, f_) => c_.copy(parallel = f_)) + def monitorAddress: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.monitorAddress)((c_, f_) => c_.copy(monitorAddress = f_)) + def queryMode: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.queryMode)((c_, f_) => c_.copy(queryMode = f_)) + def configSecretKeys: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.configSecretKeys)((c_, f_) => c_.copy(configSecretKeys = f_)) + def organization: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.organization)((c_, f_) => c_.copy(organization = f_)) + def configPropertyMap: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getConfigPropertyMap)((c_, f_) => c_.copy(configPropertyMap = _root_.scala.Option(f_))) + def optionalConfigPropertyMap: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.configPropertyMap)((c_, f_) => c_.copy(configPropertyMap = f_)) + def info: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.ProgramInfo] = field(_.getInfo)((c_, f_) => c_.copy(info = _root_.scala.Option(f_))) + def optionalInfo: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.language.ProgramInfo]] = field(_.info)((c_, f_) => c_.copy(info = f_)) + } + final val PROJECT_FIELD_NUMBER = 1 + final val STACK_FIELD_NUMBER = 2 + final val PWD_FIELD_NUMBER = 3 + final val PROGRAM_FIELD_NUMBER = 4 + final val ARGS_FIELD_NUMBER = 5 + final val CONFIG_FIELD_NUMBER = 6 + final val DRYRUN_FIELD_NUMBER = 7 + final val PARALLEL_FIELD_NUMBER = 8 + final val MONITOR_ADDRESS_FIELD_NUMBER = 9 + final val QUERYMODE_FIELD_NUMBER = 10 + final val CONFIGSECRETKEYS_FIELD_NUMBER = 11 + final val ORGANIZATION_FIELD_NUMBER = 12 + final val CONFIGPROPERTYMAP_FIELD_NUMBER = 13 + final val INFO_FIELD_NUMBER = 14 + @transient + private[language] val _typemapper_config: _root_.scalapb.TypeMapper[pulumirpc.language.RunRequest.ConfigEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.language.RunRequest.ConfigEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)]] + def of( + project: _root_.scala.Predef.String, + stack: _root_.scala.Predef.String, + pwd: _root_.scala.Predef.String, + program: _root_.scala.Predef.String, + args: _root_.scala.Seq[_root_.scala.Predef.String], + config: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String], + dryRun: _root_.scala.Boolean, + parallel: _root_.scala.Int, + monitorAddress: _root_.scala.Predef.String, + queryMode: _root_.scala.Boolean, + configSecretKeys: _root_.scala.Seq[_root_.scala.Predef.String], + organization: _root_.scala.Predef.String, + configPropertyMap: _root_.scala.Option[com.google.protobuf.struct.Struct], + info: _root_.scala.Option[pulumirpc.language.ProgramInfo] + ): _root_.pulumirpc.language.RunRequest = _root_.pulumirpc.language.RunRequest( + project, + stack, + pwd, + program, + args, + config, + dryRun, + parallel, + monitorAddress, + queryMode, + configSecretKeys, + organization, + configPropertyMap, + info + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.RunRequest]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/language/RunResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/language/RunResponse.scala new file mode 100644 index 00000000..aef6fbed --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/language/RunResponse.scala @@ -0,0 +1,156 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.language + +/** RunResponse is the response back from the interpreter/source back to the monitor. + * + * @param error + * An unhandled error if any occurred. + * @param bail + * An error happened. And it was reported to the user. Work should stop immediately + * with nothing further to print to the user. This corresponds to a "result.Bail()" + * value in the 'go' layer. + */ +@SerialVersionUID(0L) +final case class RunResponse( + error: _root_.scala.Predef.String = "", + bail: _root_.scala.Boolean = false, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[RunResponse] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = error + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = bail + if (__value != false) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = error + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = bail + if (__v != false) { + _output__.writeBool(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withError(__v: _root_.scala.Predef.String): RunResponse = copy(error = __v) + def withBail(__v: _root_.scala.Boolean): RunResponse = copy(bail = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = error + if (__t != "") __t else null + } + case 2 => { + val __t = bail + if (__t != false) __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(error) + case 2 => _root_.scalapb.descriptors.PBoolean(bail) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.language.RunResponse.type = pulumirpc.language.RunResponse + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.RunResponse]) +} + +object RunResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.language.RunResponse] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.language.RunResponse] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.language.RunResponse = { + var __error: _root_.scala.Predef.String = "" + var __bail: _root_.scala.Boolean = false + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __error = _input__.readStringRequireUtf8() + case 16 => + __bail = _input__.readBool() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.language.RunResponse( + error = __error, + bail = __bail, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.language.RunResponse] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.language.RunResponse( + error = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + bail = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Boolean]).getOrElse(false) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LanguageProto.javaDescriptor.getMessageTypes().get(8) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LanguageProto.scalaDescriptor.messages(8) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.language.RunResponse( + error = "", + bail = false + ) + implicit class RunResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.language.RunResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.language.RunResponse](_l) { + def error: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.error)((c_, f_) => c_.copy(error = f_)) + def bail: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.bail)((c_, f_) => c_.copy(bail = f_)) + } + final val ERROR_FIELD_NUMBER = 1 + final val BAIL_FIELD_NUMBER = 2 + def of( + error: _root_.scala.Predef.String, + bail: _root_.scala.Boolean + ): _root_.pulumirpc.language.RunResponse = _root_.pulumirpc.language.RunResponse( + error, + bail + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.RunResponse]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/CallRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/CallRequest.scala index de2b3f64..63cc99e8 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/CallRequest.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/CallRequest.scala @@ -11,14 +11,6 @@ package pulumirpc.provider * the arguments for the function invocation. * @param argDependencies * a map from argument keys to the dependencies of the argument. - * @param provider - * an optional reference to the provider to use for this invoke. - * @param version - * the version of the provider to use when servicing this request. - * @param pluginDownloadURL - * the pluginDownloadURL of the provider to use when servicing this request. - * @param pluginChecksums - * a map of checksums of the provider to use when servicing this request. * @param project * the project name. * @param stack @@ -35,18 +27,14 @@ package pulumirpc.provider * the address for communicating back to the resource monitor. * @param organization * the organization of the stack being deployed into. - * @param sourcePosition - * the optional source position of the user code that initiated the call. + * @param acceptsOutputValues + * the engine can be passed output values back, returnDependencies can be left blank if returning output values. */ @SerialVersionUID(0L) final case class CallRequest( tok: _root_.scala.Predef.String = "", args: _root_.scala.Option[com.google.protobuf.struct.Struct] = _root_.scala.None, argDependencies: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.provider.CallRequest.ArgumentDependencies] = _root_.scala.collection.immutable.Map.empty, - provider: _root_.scala.Predef.String = "", - version: _root_.scala.Predef.String = "", - pluginDownloadURL: _root_.scala.Predef.String = "", - pluginChecksums: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString] = _root_.scala.collection.immutable.Map.empty, project: _root_.scala.Predef.String = "", stack: _root_.scala.Predef.String = "", config: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String] = _root_.scala.collection.immutable.Map.empty, @@ -55,7 +43,7 @@ final case class CallRequest( parallel: _root_.scala.Int = 0, monitorEndpoint: _root_.scala.Predef.String = "", organization: _root_.scala.Predef.String = "", - sourcePosition: _root_.scala.Option[pulumirpc.source.SourcePosition] = _root_.scala.None, + acceptsOutputValues: _root_.scala.Boolean = false, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[CallRequest] { @transient @@ -78,31 +66,6 @@ final case class CallRequest( __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize } - { - val __value = provider - if (!__value.isEmpty) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(4, __value) - } - }; - - { - val __value = version - if (!__value.isEmpty) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(5, __value) - } - }; - - { - val __value = pluginDownloadURL - if (!__value.isEmpty) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(13, __value) - } - }; - pluginChecksums.foreach { __item => - val __value = pulumirpc.provider.CallRequest._typemapper_pluginChecksums.toBase(__item) - __size += 2 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize - } - { val __value = project if (!__value.isEmpty) { @@ -152,9 +115,12 @@ final case class CallRequest( __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(14, __value) } }; - if (sourcePosition.isDefined) { - val __value = sourcePosition.get - __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + + { + val __value = acceptsOutputValues + if (__value != false) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(17, __value) + } }; __size += unknownFields.serializedSize __size @@ -187,18 +153,6 @@ final case class CallRequest( _output__.writeUInt32NoTag(__m.serializedSize) __m.writeTo(_output__) }; - { - val __v = provider - if (!__v.isEmpty) { - _output__.writeString(4, __v) - } - }; - { - val __v = version - if (!__v.isEmpty) { - _output__.writeString(5, __v) - } - }; { val __v = project if (!__v.isEmpty) { @@ -239,29 +193,17 @@ final case class CallRequest( _output__.writeString(12, __v) } }; - { - val __v = pluginDownloadURL - if (!__v.isEmpty) { - _output__.writeString(13, __v) - } - }; { val __v = organization if (!__v.isEmpty) { _output__.writeString(14, __v) } }; - sourcePosition.foreach { __v => - val __m = __v - _output__.writeTag(15, 2) - _output__.writeUInt32NoTag(__m.serializedSize) - __m.writeTo(_output__) - }; - pluginChecksums.foreach { __v => - val __m = pulumirpc.provider.CallRequest._typemapper_pluginChecksums.toBase(__v) - _output__.writeTag(16, 2) - _output__.writeUInt32NoTag(__m.serializedSize) - __m.writeTo(_output__) + { + val __v = acceptsOutputValues + if (__v != false) { + _output__.writeBool(17, __v) + } }; unknownFields.writeTo(_output__) } @@ -273,13 +215,6 @@ final case class CallRequest( def addArgDependencies(__vs: (_root_.scala.Predef.String, pulumirpc.provider.CallRequest.ArgumentDependencies) *): CallRequest = addAllArgDependencies(__vs) def addAllArgDependencies(__vs: Iterable[(_root_.scala.Predef.String, pulumirpc.provider.CallRequest.ArgumentDependencies)]): CallRequest = copy(argDependencies = argDependencies ++ __vs) def withArgDependencies(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.provider.CallRequest.ArgumentDependencies]): CallRequest = copy(argDependencies = __v) - def withProvider(__v: _root_.scala.Predef.String): CallRequest = copy(provider = __v) - def withVersion(__v: _root_.scala.Predef.String): CallRequest = copy(version = __v) - def withPluginDownloadURL(__v: _root_.scala.Predef.String): CallRequest = copy(pluginDownloadURL = __v) - def clearPluginChecksums = copy(pluginChecksums = _root_.scala.collection.immutable.Map.empty) - def addPluginChecksums(__vs: (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString) *): CallRequest = addAllPluginChecksums(__vs) - def addAllPluginChecksums(__vs: Iterable[(_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)]): CallRequest = copy(pluginChecksums = pluginChecksums ++ __vs) - def withPluginChecksums(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]): CallRequest = copy(pluginChecksums = __v) def withProject(__v: _root_.scala.Predef.String): CallRequest = copy(project = __v) def withStack(__v: _root_.scala.Predef.String): CallRequest = copy(stack = __v) def clearConfig = copy(config = _root_.scala.collection.immutable.Map.empty) @@ -294,9 +229,7 @@ final case class CallRequest( def withParallel(__v: _root_.scala.Int): CallRequest = copy(parallel = __v) def withMonitorEndpoint(__v: _root_.scala.Predef.String): CallRequest = copy(monitorEndpoint = __v) def withOrganization(__v: _root_.scala.Predef.String): CallRequest = copy(organization = __v) - def getSourcePosition: pulumirpc.source.SourcePosition = sourcePosition.getOrElse(pulumirpc.source.SourcePosition.defaultInstance) - def clearSourcePosition: CallRequest = copy(sourcePosition = _root_.scala.None) - def withSourcePosition(__v: pulumirpc.source.SourcePosition): CallRequest = copy(sourcePosition = Option(__v)) + def withAcceptsOutputValues(__v: _root_.scala.Boolean): CallRequest = copy(acceptsOutputValues = __v) def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { @@ -307,19 +240,6 @@ final case class CallRequest( } case 2 => args.orNull case 3 => argDependencies.iterator.map(pulumirpc.provider.CallRequest._typemapper_argDependencies.toBase(_)).toSeq - case 4 => { - val __t = provider - if (__t != "") __t else null - } - case 5 => { - val __t = version - if (__t != "") __t else null - } - case 13 => { - val __t = pluginDownloadURL - if (__t != "") __t else null - } - case 16 => pluginChecksums.iterator.map(pulumirpc.provider.CallRequest._typemapper_pluginChecksums.toBase(_)).toSeq case 6 => { val __t = project if (__t != "") __t else null @@ -346,7 +266,10 @@ final case class CallRequest( val __t = organization if (__t != "") __t else null } - case 15 => sourcePosition.orNull + case 17 => { + val __t = acceptsOutputValues + if (__t != false) __t else null + } } } def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { @@ -355,10 +278,6 @@ final case class CallRequest( case 1 => _root_.scalapb.descriptors.PString(tok) case 2 => args.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) case 3 => _root_.scalapb.descriptors.PRepeated(argDependencies.iterator.map(pulumirpc.provider.CallRequest._typemapper_argDependencies.toBase(_).toPMessage).toVector) - case 4 => _root_.scalapb.descriptors.PString(provider) - case 5 => _root_.scalapb.descriptors.PString(version) - case 13 => _root_.scalapb.descriptors.PString(pluginDownloadURL) - case 16 => _root_.scalapb.descriptors.PRepeated(pluginChecksums.iterator.map(pulumirpc.provider.CallRequest._typemapper_pluginChecksums.toBase(_).toPMessage).toVector) case 6 => _root_.scalapb.descriptors.PString(project) case 7 => _root_.scalapb.descriptors.PString(stack) case 8 => _root_.scalapb.descriptors.PRepeated(config.iterator.map(pulumirpc.provider.CallRequest._typemapper_config.toBase(_).toPMessage).toVector) @@ -367,7 +286,7 @@ final case class CallRequest( case 11 => _root_.scalapb.descriptors.PInt(parallel) case 12 => _root_.scalapb.descriptors.PString(monitorEndpoint) case 14 => _root_.scalapb.descriptors.PString(organization) - case 15 => sourcePosition.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 17 => _root_.scalapb.descriptors.PBoolean(acceptsOutputValues) } } def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) @@ -381,10 +300,6 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. var __tok: _root_.scala.Predef.String = "" var __args: _root_.scala.Option[com.google.protobuf.struct.Struct] = _root_.scala.None val __argDependencies: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, pulumirpc.provider.CallRequest.ArgumentDependencies), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.provider.CallRequest.ArgumentDependencies]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, pulumirpc.provider.CallRequest.ArgumentDependencies] - var __provider: _root_.scala.Predef.String = "" - var __version: _root_.scala.Predef.String = "" - var __pluginDownloadURL: _root_.scala.Predef.String = "" - val __pluginChecksums: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString] var __project: _root_.scala.Predef.String = "" var __stack: _root_.scala.Predef.String = "" val __config: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, _root_.scala.Predef.String), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, _root_.scala.Predef.String] @@ -393,7 +308,7 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. var __parallel: _root_.scala.Int = 0 var __monitorEndpoint: _root_.scala.Predef.String = "" var __organization: _root_.scala.Predef.String = "" - var __sourcePosition: _root_.scala.Option[pulumirpc.source.SourcePosition] = _root_.scala.None + var __acceptsOutputValues: _root_.scala.Boolean = false var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null var _done__ = false while (!_done__) { @@ -403,17 +318,9 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. case 10 => __tok = _input__.readStringRequireUtf8() case 18 => - __args = Option(__args.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __args = _root_.scala.Option(__args.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 26 => __argDependencies += pulumirpc.provider.CallRequest._typemapper_argDependencies.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.CallRequest.ArgDependenciesEntry](_input__)) - case 34 => - __provider = _input__.readStringRequireUtf8() - case 42 => - __version = _input__.readStringRequireUtf8() - case 106 => - __pluginDownloadURL = _input__.readStringRequireUtf8() - case 130 => - __pluginChecksums += pulumirpc.provider.CallRequest._typemapper_pluginChecksums.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.CallRequest.PluginChecksumsEntry](_input__)) case 50 => __project = _input__.readStringRequireUtf8() case 58 => @@ -430,8 +337,8 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. __monitorEndpoint = _input__.readStringRequireUtf8() case 114 => __organization = _input__.readStringRequireUtf8() - case 122 => - __sourcePosition = Option(__sourcePosition.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.source.SourcePosition](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case 136 => + __acceptsOutputValues = _input__.readBool() case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -443,10 +350,6 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. tok = __tok, args = __args, argDependencies = __argDependencies.result(), - provider = __provider, - version = __version, - pluginDownloadURL = __pluginDownloadURL, - pluginChecksums = __pluginChecksums.result(), project = __project, stack = __stack, config = __config.result(), @@ -455,7 +358,7 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. parallel = __parallel, monitorEndpoint = __monitorEndpoint, organization = __organization, - sourcePosition = __sourcePosition, + acceptsOutputValues = __acceptsOutputValues, unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() ) } @@ -466,10 +369,6 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. tok = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), args = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.struct.Struct]]), argDependencies = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Seq[pulumirpc.provider.CallRequest.ArgDependenciesEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.provider.CallRequest._typemapper_argDependencies.toCustom(_)).toMap, - provider = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), - version = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), - pluginDownloadURL = __fieldsMap.get(scalaDescriptor.findFieldByNumber(13).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), - pluginChecksums = __fieldsMap.get(scalaDescriptor.findFieldByNumber(16).get).map(_.as[_root_.scala.Seq[pulumirpc.provider.CallRequest.PluginChecksumsEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.provider.CallRequest._typemapper_pluginChecksums.toCustom(_)).toMap, project = __fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), stack = __fieldsMap.get(scalaDescriptor.findFieldByNumber(7).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), config = __fieldsMap.get(scalaDescriptor.findFieldByNumber(8).get).map(_.as[_root_.scala.Seq[pulumirpc.provider.CallRequest.ConfigEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.provider.CallRequest._typemapper_config.toCustom(_)).toMap, @@ -478,7 +377,7 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. parallel = __fieldsMap.get(scalaDescriptor.findFieldByNumber(11).get).map(_.as[_root_.scala.Int]).getOrElse(0), monitorEndpoint = __fieldsMap.get(scalaDescriptor.findFieldByNumber(12).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), organization = __fieldsMap.get(scalaDescriptor.findFieldByNumber(14).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), - sourcePosition = __fieldsMap.get(scalaDescriptor.findFieldByNumber(15).get).flatMap(_.as[_root_.scala.Option[pulumirpc.source.SourcePosition]]) + acceptsOutputValues = __fieldsMap.get(scalaDescriptor.findFieldByNumber(17).get).map(_.as[_root_.scala.Boolean]).getOrElse(false) ) case _ => throw new RuntimeException("Expected PMessage") } @@ -489,9 +388,7 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. (__number: @_root_.scala.unchecked) match { case 2 => __out = com.google.protobuf.struct.Struct case 3 => __out = pulumirpc.provider.CallRequest.ArgDependenciesEntry - case 16 => __out = pulumirpc.provider.CallRequest.PluginChecksumsEntry case 8 => __out = pulumirpc.provider.CallRequest.ConfigEntry - case 15 => __out = pulumirpc.source.SourcePosition } __out } @@ -499,7 +396,6 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( _root_.pulumirpc.provider.CallRequest.ArgumentDependencies, _root_.pulumirpc.provider.CallRequest.ArgDependenciesEntry, - _root_.pulumirpc.provider.CallRequest.PluginChecksumsEntry, _root_.pulumirpc.provider.CallRequest.ConfigEntry ) def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) @@ -507,10 +403,6 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. tok = "", args = _root_.scala.None, argDependencies = _root_.scala.collection.immutable.Map.empty, - provider = "", - version = "", - pluginDownloadURL = "", - pluginChecksums = _root_.scala.collection.immutable.Map.empty, project = "", stack = "", config = _root_.scala.collection.immutable.Map.empty, @@ -519,7 +411,7 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. parallel = 0, monitorEndpoint = "", organization = "", - sourcePosition = _root_.scala.None + acceptsOutputValues = false ) /** ArgumentDependencies describes the resources that a particular argument depends on. * @@ -721,7 +613,7 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. case 10 => __key = _input__.readStringRequireUtf8() case 18 => - __value = Option(__value.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.CallRequest.ArgumentDependencies](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __value = _root_.scala.Option(__value.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.CallRequest.ArgumentDependencies](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -761,7 +653,7 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. ) implicit class ArgDependenciesEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.CallRequest.ArgDependenciesEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.CallRequest.ArgDependenciesEntry](_l) { def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) - def value: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.CallRequest.ArgumentDependencies] = field(_.getValue)((c_, f_) => c_.copy(value = Option(f_))) + def value: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.CallRequest.ArgumentDependencies] = field(_.getValue)((c_, f_) => c_.copy(value = _root_.scala.Option(f_))) def optionalValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.provider.CallRequest.ArgumentDependencies]] = field(_.value)((c_, f_) => c_.copy(value = f_)) } final val KEY_FIELD_NUMBER = 1 @@ -779,150 +671,6 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.CallRequest.ArgDependenciesEntry]) } - @SerialVersionUID(0L) - final case class PluginChecksumsEntry( - key: _root_.scala.Predef.String = "", - value: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY, - unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty - ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[PluginChecksumsEntry] { - @transient - private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 - private[this] def __computeSerializedSize(): _root_.scala.Int = { - var __size = 0 - - { - val __value = key - if (!__value.isEmpty) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) - } - }; - - { - val __value = value - if (!__value.isEmpty) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(2, __value) - } - }; - __size += unknownFields.serializedSize - __size - } - override def serializedSize: _root_.scala.Int = { - var __size = __serializedSizeMemoized - if (__size == 0) { - __size = __computeSerializedSize() + 1 - __serializedSizeMemoized = __size - } - __size - 1 - - } - def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { - { - val __v = key - if (!__v.isEmpty) { - _output__.writeString(1, __v) - } - }; - { - val __v = value - if (!__v.isEmpty) { - _output__.writeBytes(2, __v) - } - }; - unknownFields.writeTo(_output__) - } - def withKey(__v: _root_.scala.Predef.String): PluginChecksumsEntry = copy(key = __v) - def withValue(__v: _root_.com.google.protobuf.ByteString): PluginChecksumsEntry = copy(value = __v) - def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) - def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) - def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { - (__fieldNumber: @_root_.scala.unchecked) match { - case 1 => { - val __t = key - if (__t != "") __t else null - } - case 2 => { - val __t = value - if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null - } - } - } - def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { - _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) - (__field.number: @_root_.scala.unchecked) match { - case 1 => _root_.scalapb.descriptors.PString(key) - case 2 => _root_.scalapb.descriptors.PByteString(value) - } - } - def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) - def companion: pulumirpc.provider.CallRequest.PluginChecksumsEntry.type = pulumirpc.provider.CallRequest.PluginChecksumsEntry - // @@protoc_insertion_point(GeneratedMessage[pulumirpc.CallRequest.PluginChecksumsEntry]) - } - - object PluginChecksumsEntry extends scalapb.GeneratedMessageCompanion[pulumirpc.provider.CallRequest.PluginChecksumsEntry] { - implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.provider.CallRequest.PluginChecksumsEntry] = this - def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.provider.CallRequest.PluginChecksumsEntry = { - var __key: _root_.scala.Predef.String = "" - var __value: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY - var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null - var _done__ = false - while (!_done__) { - val _tag__ = _input__.readTag() - _tag__ match { - case 0 => _done__ = true - case 10 => - __key = _input__.readStringRequireUtf8() - case 18 => - __value = _input__.readBytes() - case tag => - if (_unknownFields__ == null) { - _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() - } - _unknownFields__.parseField(tag, _input__) - } - } - pulumirpc.provider.CallRequest.PluginChecksumsEntry( - key = __key, - value = __value, - unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() - ) - } - implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.provider.CallRequest.PluginChecksumsEntry] = _root_.scalapb.descriptors.Reads{ - case _root_.scalapb.descriptors.PMessage(__fieldsMap) => - _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") - pulumirpc.provider.CallRequest.PluginChecksumsEntry( - key = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), - value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY) - ) - case _ => throw new RuntimeException("Expected PMessage") - } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = pulumirpc.provider.CallRequest.javaDescriptor.getNestedTypes().get(2) - def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = pulumirpc.provider.CallRequest.scalaDescriptor.nestedMessages(2) - def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) - lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty - def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) - lazy val defaultInstance = pulumirpc.provider.CallRequest.PluginChecksumsEntry( - key = "", - value = _root_.com.google.protobuf.ByteString.EMPTY - ) - implicit class PluginChecksumsEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.CallRequest.PluginChecksumsEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.CallRequest.PluginChecksumsEntry](_l) { - def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) - def value: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.value)((c_, f_) => c_.copy(value = f_)) - } - final val KEY_FIELD_NUMBER = 1 - final val VALUE_FIELD_NUMBER = 2 - @transient - implicit val keyValueMapper: _root_.scalapb.TypeMapper[pulumirpc.provider.CallRequest.PluginChecksumsEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)] = - _root_.scalapb.TypeMapper[pulumirpc.provider.CallRequest.PluginChecksumsEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)](__m => (__m.key, __m.value))(__p => pulumirpc.provider.CallRequest.PluginChecksumsEntry(__p._1, __p._2)) - def of( - key: _root_.scala.Predef.String, - value: _root_.com.google.protobuf.ByteString - ): _root_.pulumirpc.provider.CallRequest.PluginChecksumsEntry = _root_.pulumirpc.provider.CallRequest.PluginChecksumsEntry( - key, - value - ) - // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.CallRequest.PluginChecksumsEntry]) - } - @SerialVersionUID(0L) final case class ConfigEntry( key: _root_.scala.Predef.String = "", @@ -1039,8 +787,8 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. ) case _ => throw new RuntimeException("Expected PMessage") } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = pulumirpc.provider.CallRequest.javaDescriptor.getNestedTypes().get(3) - def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = pulumirpc.provider.CallRequest.scalaDescriptor.nestedMessages(3) + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = pulumirpc.provider.CallRequest.javaDescriptor.getNestedTypes().get(2) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = pulumirpc.provider.CallRequest.scalaDescriptor.nestedMessages(2) def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) @@ -1069,13 +817,9 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. implicit class CallRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.CallRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.CallRequest](_l) { def tok: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.tok)((c_, f_) => c_.copy(tok = f_)) - def args: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getArgs)((c_, f_) => c_.copy(args = Option(f_))) + def args: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getArgs)((c_, f_) => c_.copy(args = _root_.scala.Option(f_))) def optionalArgs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.args)((c_, f_) => c_.copy(args = f_)) def argDependencies: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.provider.CallRequest.ArgumentDependencies]] = field(_.argDependencies)((c_, f_) => c_.copy(argDependencies = f_)) - def provider: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.provider)((c_, f_) => c_.copy(provider = f_)) - def version: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.version)((c_, f_) => c_.copy(version = f_)) - def pluginDownloadURL: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.pluginDownloadURL)((c_, f_) => c_.copy(pluginDownloadURL = f_)) - def pluginChecksums: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]] = field(_.pluginChecksums)((c_, f_) => c_.copy(pluginChecksums = f_)) def project: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.project)((c_, f_) => c_.copy(project = f_)) def stack: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.stack)((c_, f_) => c_.copy(stack = f_)) def config: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = field(_.config)((c_, f_) => c_.copy(config = f_)) @@ -1084,16 +828,11 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. def parallel: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.parallel)((c_, f_) => c_.copy(parallel = f_)) def monitorEndpoint: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.monitorEndpoint)((c_, f_) => c_.copy(monitorEndpoint = f_)) def organization: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.organization)((c_, f_) => c_.copy(organization = f_)) - def sourcePosition: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.source.SourcePosition] = field(_.getSourcePosition)((c_, f_) => c_.copy(sourcePosition = Option(f_))) - def optionalSourcePosition: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.source.SourcePosition]] = field(_.sourcePosition)((c_, f_) => c_.copy(sourcePosition = f_)) + def acceptsOutputValues: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.acceptsOutputValues)((c_, f_) => c_.copy(acceptsOutputValues = f_)) } final val TOK_FIELD_NUMBER = 1 final val ARGS_FIELD_NUMBER = 2 final val ARGDEPENDENCIES_FIELD_NUMBER = 3 - final val PROVIDER_FIELD_NUMBER = 4 - final val VERSION_FIELD_NUMBER = 5 - final val PLUGINDOWNLOADURL_FIELD_NUMBER = 13 - final val PLUGINCHECKSUMS_FIELD_NUMBER = 16 final val PROJECT_FIELD_NUMBER = 6 final val STACK_FIELD_NUMBER = 7 final val CONFIG_FIELD_NUMBER = 8 @@ -1102,21 +841,15 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. final val PARALLEL_FIELD_NUMBER = 11 final val MONITORENDPOINT_FIELD_NUMBER = 12 final val ORGANIZATION_FIELD_NUMBER = 14 - final val SOURCEPOSITION_FIELD_NUMBER = 15 + final val ACCEPTS_OUTPUT_VALUES_FIELD_NUMBER = 17 @transient private[provider] val _typemapper_argDependencies: _root_.scalapb.TypeMapper[pulumirpc.provider.CallRequest.ArgDependenciesEntry, (_root_.scala.Predef.String, pulumirpc.provider.CallRequest.ArgumentDependencies)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.provider.CallRequest.ArgDependenciesEntry, (_root_.scala.Predef.String, pulumirpc.provider.CallRequest.ArgumentDependencies)]] @transient - private[provider] val _typemapper_pluginChecksums: _root_.scalapb.TypeMapper[pulumirpc.provider.CallRequest.PluginChecksumsEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.provider.CallRequest.PluginChecksumsEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)]] - @transient private[provider] val _typemapper_config: _root_.scalapb.TypeMapper[pulumirpc.provider.CallRequest.ConfigEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.provider.CallRequest.ConfigEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)]] def of( tok: _root_.scala.Predef.String, args: _root_.scala.Option[com.google.protobuf.struct.Struct], argDependencies: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.provider.CallRequest.ArgumentDependencies], - provider: _root_.scala.Predef.String, - version: _root_.scala.Predef.String, - pluginDownloadURL: _root_.scala.Predef.String, - pluginChecksums: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString], project: _root_.scala.Predef.String, stack: _root_.scala.Predef.String, config: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String], @@ -1125,15 +858,11 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. parallel: _root_.scala.Int, monitorEndpoint: _root_.scala.Predef.String, organization: _root_.scala.Predef.String, - sourcePosition: _root_.scala.Option[pulumirpc.source.SourcePosition] + acceptsOutputValues: _root_.scala.Boolean ): _root_.pulumirpc.provider.CallRequest = _root_.pulumirpc.provider.CallRequest( tok, args, argDependencies, - provider, - version, - pluginDownloadURL, - pluginChecksums, project, stack, config, @@ -1142,7 +871,7 @@ object CallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. parallel, monitorEndpoint, organization, - sourcePosition + acceptsOutputValues ) // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.CallRequest]) } diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/CallResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/CallResponse.scala index aea2f7e1..4e9b1f14 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/CallResponse.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/CallResponse.scala @@ -114,7 +114,7 @@ object CallResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provider _tag__ match { case 0 => _done__ = true case 10 => - __return = Option(__return.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __return = _root_.scala.Option(__return.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 18 => __returnDependencies += pulumirpc.provider.CallResponse._typemapper_returnDependencies.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.CallResponse.ReturnDependenciesEntry](_input__)) case 26 => @@ -365,7 +365,7 @@ object CallResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provider case 10 => __key = _input__.readStringRequireUtf8() case 18 => - __value = Option(__value.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.CallResponse.ReturnDependencies](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __value = _root_.scala.Option(__value.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.CallResponse.ReturnDependencies](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -405,7 +405,7 @@ object CallResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provider ) implicit class ReturnDependenciesEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.CallResponse.ReturnDependenciesEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.CallResponse.ReturnDependenciesEntry](_l) { def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) - def value: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.CallResponse.ReturnDependencies] = field(_.getValue)((c_, f_) => c_.copy(value = Option(f_))) + def value: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.CallResponse.ReturnDependencies] = field(_.getValue)((c_, f_) => c_.copy(value = _root_.scala.Option(f_))) def optionalValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.provider.CallResponse.ReturnDependencies]] = field(_.value)((c_, f_) => c_.copy(value = f_)) } final val KEY_FIELD_NUMBER = 1 @@ -424,7 +424,7 @@ object CallResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provider } implicit class CallResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.CallResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.CallResponse](_l) { - def `return`: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getReturn)((c_, f_) => c_.copy(`return` = Option(f_))) + def `return`: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getReturn)((c_, f_) => c_.copy(`return` = _root_.scala.Option(f_))) def optionalReturn: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.`return`)((c_, f_) => c_.copy(`return` = f_)) def returnDependencies: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.provider.CallResponse.ReturnDependencies]] = field(_.returnDependencies)((c_, f_) => c_.copy(returnDependencies = f_)) def failures: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[pulumirpc.provider.CheckFailure]] = field(_.failures)((c_, f_) => c_.copy(failures = f_)) diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/CheckRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/CheckRequest.scala index 34e312a1..c6d44782 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/CheckRequest.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/CheckRequest.scala @@ -141,9 +141,9 @@ object CheckRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider case 10 => __urn = _input__.readStringRequireUtf8() case 18 => - __olds = Option(__olds.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __olds = _root_.scala.Option(__olds.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 26 => - __news = Option(__news.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __news = _root_.scala.Option(__news.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 42 => __randomSeed = _input__.readBytes() case tag => @@ -192,9 +192,9 @@ object CheckRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider ) implicit class CheckRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.CheckRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.CheckRequest](_l) { def urn: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.urn)((c_, f_) => c_.copy(urn = f_)) - def olds: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getOlds)((c_, f_) => c_.copy(olds = Option(f_))) + def olds: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getOlds)((c_, f_) => c_.copy(olds = _root_.scala.Option(f_))) def optionalOlds: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.olds)((c_, f_) => c_.copy(olds = f_)) - def news: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getNews)((c_, f_) => c_.copy(news = Option(f_))) + def news: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getNews)((c_, f_) => c_.copy(news = _root_.scala.Option(f_))) def optionalNews: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.news)((c_, f_) => c_.copy(news = f_)) def randomSeed: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.randomSeed)((c_, f_) => c_.copy(randomSeed = f_)) } diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/CheckResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/CheckResponse.scala index 82ced66f..0dfa1b9f 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/CheckResponse.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/CheckResponse.scala @@ -94,7 +94,7 @@ object CheckResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provide _tag__ match { case 0 => _done__ = true case 10 => - __inputs = Option(__inputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __inputs = _root_.scala.Option(__inputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 18 => __failures += _root_.scalapb.LiteParser.readMessage[pulumirpc.provider.CheckFailure](_input__) case tag => @@ -136,7 +136,7 @@ object CheckResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provide failures = _root_.scala.Seq.empty ) implicit class CheckResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.CheckResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.CheckResponse](_l) { - def inputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getInputs)((c_, f_) => c_.copy(inputs = Option(f_))) + def inputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getInputs)((c_, f_) => c_.copy(inputs = _root_.scala.Option(f_))) def optionalInputs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.inputs)((c_, f_) => c_.copy(inputs = f_)) def failures: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[pulumirpc.provider.CheckFailure]] = field(_.failures)((c_, f_) => c_.copy(failures = f_)) } diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/ConfigureRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/ConfigureRequest.scala index ab7ff18a..a54de93b 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/ConfigureRequest.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/ConfigureRequest.scala @@ -188,7 +188,7 @@ object ConfigureRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov case 10 => __variables += pulumirpc.provider.ConfigureRequest._typemapper_variables.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.ConfigureRequest.VariablesEntry](_input__)) case 18 => - __args = Option(__args.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __args = _root_.scala.Option(__args.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 24 => __acceptSecrets = _input__.readBool() case 32 => @@ -396,7 +396,7 @@ object ConfigureRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov implicit class ConfigureRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.ConfigureRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.ConfigureRequest](_l) { def variables: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = field(_.variables)((c_, f_) => c_.copy(variables = f_)) - def args: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getArgs)((c_, f_) => c_.copy(args = Option(f_))) + def args: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getArgs)((c_, f_) => c_.copy(args = _root_.scala.Option(f_))) def optionalArgs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.args)((c_, f_) => c_.copy(args = f_)) def acceptSecrets: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.acceptSecrets)((c_, f_) => c_.copy(acceptSecrets = f_)) def acceptResources: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.acceptResources)((c_, f_) => c_.copy(acceptResources = f_)) diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/ConstructRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/ConstructRequest.scala index b4065897..8fa2ec0d 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/ConstructRequest.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/ConstructRequest.scala @@ -55,6 +55,8 @@ package pulumirpc.provider * properties that, when changed, trigger a replacement * @param retainOnDelete * whether to retain the resource in the cloud provider when it is deleted + * @param acceptsOutputValues + * the engine can be passed output values back, stateDependencies can be left blank if returning output values. */ @SerialVersionUID(0L) final case class ConstructRequest( @@ -82,6 +84,7 @@ final case class ConstructRequest( ignoreChanges: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, replaceOnChanges: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, retainOnDelete: _root_.scala.Boolean = false, + acceptsOutputValues: _root_.scala.Boolean = false, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ConstructRequest] { @transient @@ -223,6 +226,13 @@ final case class ConstructRequest( __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(24, __value) } }; + + { + val __value = acceptsOutputValues + if (__value != false) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(25, __value) + } + }; __size += unknownFields.serializedSize __size } @@ -368,6 +378,12 @@ final case class ConstructRequest( _output__.writeBool(24, __v) } }; + { + val __v = acceptsOutputValues + if (__v != false) { + _output__.writeBool(25, __v) + } + }; unknownFields.writeTo(_output__) } def withProject(__v: _root_.scala.Predef.String): ConstructRequest = copy(project = __v) @@ -425,6 +441,7 @@ final case class ConstructRequest( def addAllReplaceOnChanges(__vs: Iterable[_root_.scala.Predef.String]): ConstructRequest = copy(replaceOnChanges = replaceOnChanges ++ __vs) def withReplaceOnChanges(__v: _root_.scala.Seq[_root_.scala.Predef.String]): ConstructRequest = copy(replaceOnChanges = __v) def withRetainOnDelete(__v: _root_.scala.Boolean): ConstructRequest = copy(retainOnDelete = __v) + def withAcceptsOutputValues(__v: _root_.scala.Boolean): ConstructRequest = copy(acceptsOutputValues = __v) def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { @@ -492,6 +509,10 @@ final case class ConstructRequest( val __t = retainOnDelete if (__t != false) __t else null } + case 25 => { + val __t = acceptsOutputValues + if (__t != false) __t else null + } } } def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { @@ -521,6 +542,7 @@ final case class ConstructRequest( case 22 => _root_.scalapb.descriptors.PRepeated(ignoreChanges.iterator.map(_root_.scalapb.descriptors.PString(_)).toVector) case 23 => _root_.scalapb.descriptors.PRepeated(replaceOnChanges.iterator.map(_root_.scalapb.descriptors.PString(_)).toVector) case 24 => _root_.scalapb.descriptors.PBoolean(retainOnDelete) + case 25 => _root_.scalapb.descriptors.PBoolean(acceptsOutputValues) } } def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) @@ -555,6 +577,7 @@ object ConstructRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov val __ignoreChanges: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] val __replaceOnChanges: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] var __retainOnDelete: _root_.scala.Boolean = false + var __acceptsOutputValues: _root_.scala.Boolean = false var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null var _done__ = false while (!_done__) { @@ -580,7 +603,7 @@ object ConstructRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov case 74 => __parent = _input__.readStringRequireUtf8() case 82 => - __inputs = Option(__inputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __inputs = _root_.scala.Option(__inputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 90 => __inputDependencies += pulumirpc.provider.ConstructRequest._typemapper_inputDependencies.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.ConstructRequest.InputDependenciesEntry](_input__)) case 106 => @@ -598,7 +621,7 @@ object ConstructRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov case 146 => __additionalSecretOutputs += _input__.readStringRequireUtf8() case 154 => - __customTimeouts = Option(__customTimeouts.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.ConstructRequest.CustomTimeouts](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __customTimeouts = _root_.scala.Option(__customTimeouts.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.ConstructRequest.CustomTimeouts](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 162 => __deletedWith = _input__.readStringRequireUtf8() case 168 => @@ -609,6 +632,8 @@ object ConstructRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov __replaceOnChanges += _input__.readStringRequireUtf8() case 192 => __retainOnDelete = _input__.readBool() + case 200 => + __acceptsOutputValues = _input__.readBool() case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -641,6 +666,7 @@ object ConstructRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov ignoreChanges = __ignoreChanges.result(), replaceOnChanges = __replaceOnChanges.result(), retainOnDelete = __retainOnDelete, + acceptsOutputValues = __acceptsOutputValues, unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() ) } @@ -671,7 +697,8 @@ object ConstructRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov deleteBeforeReplace = __fieldsMap.get(scalaDescriptor.findFieldByNumber(21).get).map(_.as[_root_.scala.Boolean]).getOrElse(false), ignoreChanges = __fieldsMap.get(scalaDescriptor.findFieldByNumber(22).get).map(_.as[_root_.scala.Seq[_root_.scala.Predef.String]]).getOrElse(_root_.scala.Seq.empty), replaceOnChanges = __fieldsMap.get(scalaDescriptor.findFieldByNumber(23).get).map(_.as[_root_.scala.Seq[_root_.scala.Predef.String]]).getOrElse(_root_.scala.Seq.empty), - retainOnDelete = __fieldsMap.get(scalaDescriptor.findFieldByNumber(24).get).map(_.as[_root_.scala.Boolean]).getOrElse(false) + retainOnDelete = __fieldsMap.get(scalaDescriptor.findFieldByNumber(24).get).map(_.as[_root_.scala.Boolean]).getOrElse(false), + acceptsOutputValues = __fieldsMap.get(scalaDescriptor.findFieldByNumber(25).get).map(_.as[_root_.scala.Boolean]).getOrElse(false) ) case _ => throw new RuntimeException("Expected PMessage") } @@ -721,7 +748,8 @@ object ConstructRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov deleteBeforeReplace = false, ignoreChanges = _root_.scala.Seq.empty, replaceOnChanges = _root_.scala.Seq.empty, - retainOnDelete = false + retainOnDelete = false, + acceptsOutputValues = false ) /** PropertyDependencies describes the resources that a particular property depends on. * @@ -1256,7 +1284,7 @@ object ConstructRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov case 10 => __key = _input__.readStringRequireUtf8() case 18 => - __value = Option(__value.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.ConstructRequest.PropertyDependencies](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __value = _root_.scala.Option(__value.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.ConstructRequest.PropertyDependencies](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -1296,7 +1324,7 @@ object ConstructRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov ) implicit class InputDependenciesEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.ConstructRequest.InputDependenciesEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.ConstructRequest.InputDependenciesEntry](_l) { def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) - def value: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.ConstructRequest.PropertyDependencies] = field(_.getValue)((c_, f_) => c_.copy(value = Option(f_))) + def value: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.ConstructRequest.PropertyDependencies] = field(_.getValue)((c_, f_) => c_.copy(value = _root_.scala.Option(f_))) def optionalValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.provider.ConstructRequest.PropertyDependencies]] = field(_.value)((c_, f_) => c_.copy(value = f_)) } final val KEY_FIELD_NUMBER = 1 @@ -1468,7 +1496,7 @@ object ConstructRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov def `type`: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.`type`)((c_, f_) => c_.copy(`type` = f_)) def name: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.name)((c_, f_) => c_.copy(name = f_)) def parent: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.parent)((c_, f_) => c_.copy(parent = f_)) - def inputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getInputs)((c_, f_) => c_.copy(inputs = Option(f_))) + def inputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getInputs)((c_, f_) => c_.copy(inputs = _root_.scala.Option(f_))) def optionalInputs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.inputs)((c_, f_) => c_.copy(inputs = f_)) def inputDependencies: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.provider.ConstructRequest.PropertyDependencies]] = field(_.inputDependencies)((c_, f_) => c_.copy(inputDependencies = f_)) def providers: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = field(_.providers)((c_, f_) => c_.copy(providers = f_)) @@ -1478,13 +1506,14 @@ object ConstructRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov def protect: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.protect)((c_, f_) => c_.copy(protect = f_)) def aliases: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.aliases)((c_, f_) => c_.copy(aliases = f_)) def additionalSecretOutputs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.additionalSecretOutputs)((c_, f_) => c_.copy(additionalSecretOutputs = f_)) - def customTimeouts: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.ConstructRequest.CustomTimeouts] = field(_.getCustomTimeouts)((c_, f_) => c_.copy(customTimeouts = Option(f_))) + def customTimeouts: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.ConstructRequest.CustomTimeouts] = field(_.getCustomTimeouts)((c_, f_) => c_.copy(customTimeouts = _root_.scala.Option(f_))) def optionalCustomTimeouts: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.provider.ConstructRequest.CustomTimeouts]] = field(_.customTimeouts)((c_, f_) => c_.copy(customTimeouts = f_)) def deletedWith: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.deletedWith)((c_, f_) => c_.copy(deletedWith = f_)) def deleteBeforeReplace: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.deleteBeforeReplace)((c_, f_) => c_.copy(deleteBeforeReplace = f_)) def ignoreChanges: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.ignoreChanges)((c_, f_) => c_.copy(ignoreChanges = f_)) def replaceOnChanges: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.replaceOnChanges)((c_, f_) => c_.copy(replaceOnChanges = f_)) def retainOnDelete: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.retainOnDelete)((c_, f_) => c_.copy(retainOnDelete = f_)) + def acceptsOutputValues: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.acceptsOutputValues)((c_, f_) => c_.copy(acceptsOutputValues = f_)) } final val PROJECT_FIELD_NUMBER = 1 final val STACK_FIELD_NUMBER = 2 @@ -1510,6 +1539,7 @@ object ConstructRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov final val IGNORECHANGES_FIELD_NUMBER = 22 final val REPLACEONCHANGES_FIELD_NUMBER = 23 final val RETAINONDELETE_FIELD_NUMBER = 24 + final val ACCEPTS_OUTPUT_VALUES_FIELD_NUMBER = 25 @transient private[provider] val _typemapper_config: _root_.scalapb.TypeMapper[pulumirpc.provider.ConstructRequest.ConfigEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.provider.ConstructRequest.ConfigEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)]] @transient @@ -1540,7 +1570,8 @@ object ConstructRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov deleteBeforeReplace: _root_.scala.Boolean, ignoreChanges: _root_.scala.Seq[_root_.scala.Predef.String], replaceOnChanges: _root_.scala.Seq[_root_.scala.Predef.String], - retainOnDelete: _root_.scala.Boolean + retainOnDelete: _root_.scala.Boolean, + acceptsOutputValues: _root_.scala.Boolean ): _root_.pulumirpc.provider.ConstructRequest = _root_.pulumirpc.provider.ConstructRequest( project, stack, @@ -1565,7 +1596,8 @@ object ConstructRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.prov deleteBeforeReplace, ignoreChanges, replaceOnChanges, - retainOnDelete + retainOnDelete, + acceptsOutputValues ) // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.ConstructRequest]) } diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/ConstructResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/ConstructResponse.scala index d92ccb77..fdd5a136 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/ConstructResponse.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/ConstructResponse.scala @@ -119,7 +119,7 @@ object ConstructResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.pro case 10 => __urn = _input__.readStringRequireUtf8() case 18 => - __state = Option(__state.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __state = _root_.scala.Option(__state.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 26 => __stateDependencies += pulumirpc.provider.ConstructResponse._typemapper_stateDependencies.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.ConstructResponse.StateDependenciesEntry](_input__)) case tag => @@ -367,7 +367,7 @@ object ConstructResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.pro case 10 => __key = _input__.readStringRequireUtf8() case 18 => - __value = Option(__value.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.ConstructResponse.PropertyDependencies](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __value = _root_.scala.Option(__value.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.ConstructResponse.PropertyDependencies](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -407,7 +407,7 @@ object ConstructResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.pro ) implicit class StateDependenciesEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.ConstructResponse.StateDependenciesEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.ConstructResponse.StateDependenciesEntry](_l) { def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) - def value: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.ConstructResponse.PropertyDependencies] = field(_.getValue)((c_, f_) => c_.copy(value = Option(f_))) + def value: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.ConstructResponse.PropertyDependencies] = field(_.getValue)((c_, f_) => c_.copy(value = _root_.scala.Option(f_))) def optionalValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.provider.ConstructResponse.PropertyDependencies]] = field(_.value)((c_, f_) => c_.copy(value = f_)) } final val KEY_FIELD_NUMBER = 1 @@ -427,7 +427,7 @@ object ConstructResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.pro implicit class ConstructResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.ConstructResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.ConstructResponse](_l) { def urn: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.urn)((c_, f_) => c_.copy(urn = f_)) - def state: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getState)((c_, f_) => c_.copy(state = Option(f_))) + def state: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getState)((c_, f_) => c_.copy(state = _root_.scala.Option(f_))) def optionalState: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.state)((c_, f_) => c_.copy(state = f_)) def stateDependencies: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.provider.ConstructResponse.PropertyDependencies]] = field(_.stateDependencies)((c_, f_) => c_.copy(stateDependencies = f_)) } diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/CreateRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/CreateRequest.scala index a0a9a7da..2e566e86 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/CreateRequest.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/CreateRequest.scala @@ -145,7 +145,7 @@ object CreateRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provide case 10 => __urn = _input__.readStringRequireUtf8() case 18 => - __properties = Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __properties = _root_.scala.Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 25 => __timeout = _input__.readDouble() case 32 => @@ -195,7 +195,7 @@ object CreateRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provide ) implicit class CreateRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.CreateRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.CreateRequest](_l) { def urn: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.urn)((c_, f_) => c_.copy(urn = f_)) - def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = Option(f_))) + def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = _root_.scala.Option(f_))) def optionalProperties: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.properties)((c_, f_) => c_.copy(properties = f_)) def timeout: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Double] = field(_.timeout)((c_, f_) => c_.copy(timeout = f_)) def preview: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.preview)((c_, f_) => c_.copy(preview = f_)) diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/CreateResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/CreateResponse.scala index db70631a..c06eb019 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/CreateResponse.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/CreateResponse.scala @@ -101,7 +101,7 @@ object CreateResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provid case 10 => __id = _input__.readStringRequireUtf8() case 18 => - __properties = Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __properties = _root_.scala.Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -141,7 +141,7 @@ object CreateResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provid ) implicit class CreateResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.CreateResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.CreateResponse](_l) { def id: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.id)((c_, f_) => c_.copy(id = f_)) - def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = Option(f_))) + def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = _root_.scala.Option(f_))) def optionalProperties: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.properties)((c_, f_) => c_.copy(properties = f_)) } final val ID_FIELD_NUMBER = 1 diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/DeleteRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/DeleteRequest.scala index 88364002..3a298536 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/DeleteRequest.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/DeleteRequest.scala @@ -166,11 +166,11 @@ object DeleteRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provide case 18 => __urn = _input__.readStringRequireUtf8() case 26 => - __properties = Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __properties = _root_.scala.Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 33 => __timeout = _input__.readDouble() case 42 => - __oldInputs = Option(__oldInputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __oldInputs = _root_.scala.Option(__oldInputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -221,10 +221,10 @@ object DeleteRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provide implicit class DeleteRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.DeleteRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.DeleteRequest](_l) { def id: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.id)((c_, f_) => c_.copy(id = f_)) def urn: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.urn)((c_, f_) => c_.copy(urn = f_)) - def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = Option(f_))) + def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = _root_.scala.Option(f_))) def optionalProperties: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.properties)((c_, f_) => c_.copy(properties = f_)) def timeout: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Double] = field(_.timeout)((c_, f_) => c_.copy(timeout = f_)) - def oldInputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getOldInputs)((c_, f_) => c_.copy(oldInputs = Option(f_))) + def oldInputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getOldInputs)((c_, f_) => c_.copy(oldInputs = _root_.scala.Option(f_))) def optionalOldInputs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.oldInputs)((c_, f_) => c_.copy(oldInputs = f_)) } final val ID_FIELD_NUMBER = 1 diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/DiffRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/DiffRequest.scala index a9686b52..49494f79 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/DiffRequest.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/DiffRequest.scala @@ -180,13 +180,13 @@ object DiffRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. case 18 => __urn = _input__.readStringRequireUtf8() case 26 => - __olds = Option(__olds.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __olds = _root_.scala.Option(__olds.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 34 => - __news = Option(__news.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __news = _root_.scala.Option(__news.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 42 => __ignoreChanges += _input__.readStringRequireUtf8() case 50 => - __oldInputs = Option(__oldInputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __oldInputs = _root_.scala.Option(__oldInputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -241,12 +241,12 @@ object DiffRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. implicit class DiffRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.DiffRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.DiffRequest](_l) { def id: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.id)((c_, f_) => c_.copy(id = f_)) def urn: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.urn)((c_, f_) => c_.copy(urn = f_)) - def olds: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getOlds)((c_, f_) => c_.copy(olds = Option(f_))) + def olds: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getOlds)((c_, f_) => c_.copy(olds = _root_.scala.Option(f_))) def optionalOlds: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.olds)((c_, f_) => c_.copy(olds = f_)) - def news: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getNews)((c_, f_) => c_.copy(news = Option(f_))) + def news: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getNews)((c_, f_) => c_.copy(news = _root_.scala.Option(f_))) def optionalNews: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.news)((c_, f_) => c_.copy(news = f_)) def ignoreChanges: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.ignoreChanges)((c_, f_) => c_.copy(ignoreChanges = f_)) - def oldInputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getOldInputs)((c_, f_) => c_.copy(oldInputs = Option(f_))) + def oldInputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getOldInputs)((c_, f_) => c_.copy(oldInputs = _root_.scala.Option(f_))) def optionalOldInputs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.oldInputs)((c_, f_) => c_.copy(oldInputs = f_)) } final val ID_FIELD_NUMBER = 1 diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/DiffResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/DiffResponse.scala index 820e6241..f102d904 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/DiffResponse.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/DiffResponse.scala @@ -442,7 +442,7 @@ object DiffResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provider case 10 => __key = _input__.readStringRequireUtf8() case 18 => - __value = Option(__value.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.PropertyDiff](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __value = _root_.scala.Option(__value.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.provider.PropertyDiff](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -482,7 +482,7 @@ object DiffResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provider ) implicit class DetailedDiffEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.DiffResponse.DetailedDiffEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.DiffResponse.DetailedDiffEntry](_l) { def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) - def value: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.PropertyDiff] = field(_.getValue)((c_, f_) => c_.copy(value = Option(f_))) + def value: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.PropertyDiff] = field(_.getValue)((c_, f_) => c_.copy(value = _root_.scala.Option(f_))) def optionalValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.provider.PropertyDiff]] = field(_.value)((c_, f_) => c_.copy(value = f_)) } final val KEY_FIELD_NUMBER = 1 diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/ErrorResourceInitFailed.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/ErrorResourceInitFailed.scala index bffb66bb..88806179 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/ErrorResourceInitFailed.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/ErrorResourceInitFailed.scala @@ -139,11 +139,11 @@ object ErrorResourceInitFailed extends scalapb.GeneratedMessageCompanion[pulumir case 10 => __id = _input__.readStringRequireUtf8() case 18 => - __properties = Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __properties = _root_.scala.Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 26 => __reasons += _input__.readStringRequireUtf8() case 34 => - __inputs = Option(__inputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __inputs = _root_.scala.Option(__inputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -190,10 +190,10 @@ object ErrorResourceInitFailed extends scalapb.GeneratedMessageCompanion[pulumir ) implicit class ErrorResourceInitFailedLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.ErrorResourceInitFailed]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.ErrorResourceInitFailed](_l) { def id: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.id)((c_, f_) => c_.copy(id = f_)) - def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = Option(f_))) + def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = _root_.scala.Option(f_))) def optionalProperties: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.properties)((c_, f_) => c_.copy(properties = f_)) def reasons: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.reasons)((c_, f_) => c_.copy(reasons = f_)) - def inputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getInputs)((c_, f_) => c_.copy(inputs = Option(f_))) + def inputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getInputs)((c_, f_) => c_.copy(inputs = _root_.scala.Option(f_))) def optionalInputs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.inputs)((c_, f_) => c_.copy(inputs = f_)) } final val ID_FIELD_NUMBER = 1 diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/InvokeRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/InvokeRequest.scala index 51703b15..486b8da8 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/InvokeRequest.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/InvokeRequest.scala @@ -99,7 +99,7 @@ object InvokeRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provide case 10 => __tok = _input__.readStringRequireUtf8() case 18 => - __args = Option(__args.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __args = _root_.scala.Option(__args.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -139,7 +139,7 @@ object InvokeRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provide ) implicit class InvokeRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.InvokeRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.InvokeRequest](_l) { def tok: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.tok)((c_, f_) => c_.copy(tok = f_)) - def args: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getArgs)((c_, f_) => c_.copy(args = Option(f_))) + def args: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getArgs)((c_, f_) => c_.copy(args = _root_.scala.Option(f_))) def optionalArgs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.args)((c_, f_) => c_.copy(args = f_)) } final val TOK_FIELD_NUMBER = 1 diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/InvokeResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/InvokeResponse.scala index 5104d4f5..f9b9403e 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/InvokeResponse.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/InvokeResponse.scala @@ -94,7 +94,7 @@ object InvokeResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provid _tag__ match { case 0 => _done__ = true case 10 => - __return = Option(__return.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __return = _root_.scala.Option(__return.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 18 => __failures += _root_.scalapb.LiteParser.readMessage[pulumirpc.provider.CheckFailure](_input__) case tag => @@ -136,7 +136,7 @@ object InvokeResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provid failures = _root_.scala.Seq.empty ) implicit class InvokeResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.InvokeResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.InvokeResponse](_l) { - def `return`: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getReturn)((c_, f_) => c_.copy(`return` = Option(f_))) + def `return`: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getReturn)((c_, f_) => c_.copy(`return` = _root_.scala.Option(f_))) def optionalReturn: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.`return`)((c_, f_) => c_.copy(`return` = f_)) def failures: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[pulumirpc.provider.CheckFailure]] = field(_.failures)((c_, f_) => c_.copy(failures = f_)) } diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/ProviderProto.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/ProviderProto.scala index 3f7f5add..4bccf8e3 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/ProviderProto.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/ProviderProto.scala @@ -9,8 +9,7 @@ object ProviderProto extends _root_.scalapb.GeneratedFileObject { lazy val dependencies: Seq[_root_.scalapb.GeneratedFileObject] = Seq( pulumirpc.plugin.PluginProto, com.google.protobuf.empty.EmptyProto, - com.google.protobuf.struct.StructProto, - pulumirpc.source.SourceProto + com.google.protobuf.struct.StructProto ) lazy val messagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( @@ -47,150 +46,148 @@ object ProviderProto extends _root_.scalapb.GeneratedFileObject { private lazy val ProtoBytes: _root_.scala.Array[Byte] = scalapb.Encoding.fromBase64(scala.collection.immutable.Seq( """ChVwdWx1bWkvcHJvdmlkZXIucHJvdG8SCXB1bHVtaXJwYxoTcHVsdW1pL3BsdWdpbi5wcm90bxobZ29vZ2xlL3Byb3RvYnVmL - 2VtcHR5LnByb3RvGhxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvGhNwdWx1bWkvc291cmNlLnByb3RvIjoKEEdldFNjaGVtY - VJlcXVlc3QSJgoHdmVyc2lvbhgBIAEoBUIM4j8JEgd2ZXJzaW9uUgd2ZXJzaW9uIjgKEUdldFNjaGVtYVJlc3BvbnNlEiMKBnNja - GVtYRgBIAEoCUIL4j8IEgZzY2hlbWFSBnNjaGVtYSKKBAoQQ29uZmlndXJlUmVxdWVzdBJYCgl2YXJpYWJsZXMYASADKAsyKi5wd - Wx1bWlycGMuQ29uZmlndXJlUmVxdWVzdC5WYXJpYWJsZXNFbnRyeUIO4j8LEgl2YXJpYWJsZXNSCXZhcmlhYmxlcxI2CgRhcmdzG - AIgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEIJ4j8GEgRhcmdzUgRhcmdzEjgKDWFjY2VwdFNlY3JldHMYAyABKAhCEuI/D - xINYWNjZXB0U2VjcmV0c1INYWNjZXB0U2VjcmV0cxI+Cg9hY2NlcHRSZXNvdXJjZXMYBCABKAhCFOI/ERIPYWNjZXB0UmVzb3VyY - 2VzUg9hY2NlcHRSZXNvdXJjZXMSPQoQc2VuZHNfb2xkX2lucHV0cxgFIAEoCEIT4j8QEg5zZW5kc09sZElucHV0c1IOc2VuZHNPb - GRJbnB1dHMSVwoac2VuZHNfb2xkX2lucHV0c190b19kZWxldGUYBiABKAhCG+I/GBIWc2VuZHNPbGRJbnB1dHNUb0RlbGV0ZVIWc - 2VuZHNPbGRJbnB1dHNUb0RlbGV0ZRpSCg5WYXJpYWJsZXNFbnRyeRIaCgNrZXkYASABKAlCCOI/BRIDa2V5UgNrZXkSIAoFdmFsd - WUYAiABKAlCCuI/BxIFdmFsdWVSBXZhbHVlOgI4ASKHAgoRQ29uZmlndXJlUmVzcG9uc2USOAoNYWNjZXB0U2VjcmV0cxgBIAEoC - EIS4j8PEg1hY2NlcHRTZWNyZXRzUg1hY2NlcHRTZWNyZXRzEj4KD3N1cHBvcnRzUHJldmlldxgCIAEoCEIU4j8REg9zdXBwb3J0c - 1ByZXZpZXdSD3N1cHBvcnRzUHJldmlldxI+Cg9hY2NlcHRSZXNvdXJjZXMYAyABKAhCFOI/ERIPYWNjZXB0UmVzb3VyY2VzUg9hY - 2NlcHRSZXNvdXJjZXMSOAoNYWNjZXB0T3V0cHV0cxgEIAEoCEIS4j8PEg1hY2NlcHRPdXRwdXRzUg1hY2NlcHRPdXRwdXRzIuEBC - hlDb25maWd1cmVFcnJvck1pc3NpbmdLZXlzEmMKC21pc3NpbmdLZXlzGAEgAygLMi8ucHVsdW1pcnBjLkNvbmZpZ3VyZUVycm9yT - Wlzc2luZ0tleXMuTWlzc2luZ0tleUIQ4j8NEgttaXNzaW5nS2V5c1ILbWlzc2luZ0tleXMaXwoKTWlzc2luZ0tleRIdCgRuYW1lG - AEgASgJQgniPwYSBG5hbWVSBG5hbWUSMgoLZGVzY3JpcHRpb24YAiABKAlCEOI/DRILZGVzY3JpcHRpb25SC2Rlc2NyaXB0aW9uI - qABCg1JbnZva2VSZXF1ZXN0EhoKA3RvaxgBIAEoCUII4j8FEgN0b2tSA3RvaxI2CgRhcmdzGAIgASgLMhcuZ29vZ2xlLnByb3RvY - nVmLlN0cnVjdEIJ4j8GEgRhcmdzUgRhcmdzSgQIAxAHUghwcm92aWRlclIHdmVyc2lvblIPYWNjZXB0UmVzb3VyY2VzUhFwbHVna - W5Eb3dubG9hZFVSTCKSAQoOSW52b2tlUmVzcG9uc2USPAoGcmV0dXJuGAEgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEIL4 - j8IEgZyZXR1cm5SBnJldHVybhJCCghmYWlsdXJlcxgCIAMoCzIXLnB1bHVtaXJwYy5DaGVja0ZhaWx1cmVCDeI/ChIIZmFpbHVyZ - XNSCGZhaWx1cmVzIrMKCgtDYWxsUmVxdWVzdBIaCgN0b2sYASABKAlCCOI/BRIDdG9rUgN0b2sSNgoEYXJncxgCIAEoCzIXLmdvb - 2dsZS5wcm90b2J1Zi5TdHJ1Y3RCCeI/BhIEYXJnc1IEYXJncxJrCg9hcmdEZXBlbmRlbmNpZXMYAyADKAsyKy5wdWx1bWlycGMuQ - 2FsbFJlcXVlc3QuQXJnRGVwZW5kZW5jaWVzRW50cnlCFOI/ERIPYXJnRGVwZW5kZW5jaWVzUg9hcmdEZXBlbmRlbmNpZXMSKQoIc - HJvdmlkZXIYBCABKAlCDeI/ChIIcHJvdmlkZXJSCHByb3ZpZGVyEiYKB3ZlcnNpb24YBSABKAlCDOI/CRIHdmVyc2lvblIHdmVyc - 2lvbhJEChFwbHVnaW5Eb3dubG9hZFVSTBgNIAEoCUIW4j8TEhFwbHVnaW5Eb3dubG9hZFVSTFIRcGx1Z2luRG93bmxvYWRVUkwSa - woPcGx1Z2luQ2hlY2tzdW1zGBAgAygLMisucHVsdW1pcnBjLkNhbGxSZXF1ZXN0LlBsdWdpbkNoZWNrc3Vtc0VudHJ5QhTiPxESD - 3BsdWdpbkNoZWNrc3Vtc1IPcGx1Z2luQ2hlY2tzdW1zEiYKB3Byb2plY3QYBiABKAlCDOI/CRIHcHJvamVjdFIHcHJvamVjdBIgC - gVzdGFjaxgHIAEoCUIK4j8HEgVzdGFja1IFc3RhY2sSRwoGY29uZmlnGAggAygLMiIucHVsdW1pcnBjLkNhbGxSZXF1ZXN0LkNvb - mZpZ0VudHJ5QgviPwgSBmNvbmZpZ1IGY29uZmlnEkEKEGNvbmZpZ1NlY3JldEtleXMYCSADKAlCFeI/EhIQY29uZmlnU2VjcmV0S - 2V5c1IQY29uZmlnU2VjcmV0S2V5cxIjCgZkcnlSdW4YCiABKAhCC+I/CBIGZHJ5UnVuUgZkcnlSdW4SKQoIcGFyYWxsZWwYCyABK - AVCDeI/ChIIcGFyYWxsZWxSCHBhcmFsbGVsEj4KD21vbml0b3JFbmRwb2ludBgMIAEoCUIU4j8REg9tb25pdG9yRW5kcG9pbnRSD - 21vbml0b3JFbmRwb2ludBI1Cgxvcmdhbml6YXRpb24YDiABKAlCEeI/DhIMb3JnYW5pemF0aW9uUgxvcmdhbml6YXRpb24SVgoOc - 291cmNlUG9zaXRpb24YDyABKAsyGS5wdWx1bWlycGMuU291cmNlUG9zaXRpb25CE+I/EBIOc291cmNlUG9zaXRpb25SDnNvdXJjZ - VBvc2l0aW9uGjUKFEFyZ3VtZW50RGVwZW5kZW5jaWVzEh0KBHVybnMYASADKAlCCeI/BhIEdXJuc1IEdXJucxqFAQoUQXJnRGVwZ - W5kZW5jaWVzRW50cnkSGgoDa2V5GAEgASgJQgjiPwUSA2tleVIDa2V5Ek0KBXZhbHVlGAIgASgLMisucHVsdW1pcnBjLkNhbGxSZ - XF1ZXN0LkFyZ3VtZW50RGVwZW5kZW5jaWVzQgriPwcSBXZhbHVlUgV2YWx1ZToCOAEaWAoUUGx1Z2luQ2hlY2tzdW1zRW50cnkSG - goDa2V5GAEgASgJQgjiPwUSA2tleVIDa2V5EiAKBXZhbHVlGAIgASgMQgriPwcSBXZhbHVlUgV2YWx1ZToCOAEaTwoLQ29uZmlnR - W50cnkSGgoDa2V5GAEgASgJQgjiPwUSA2tleVIDa2V5EiAKBXZhbHVlGAIgASgJQgriPwcSBXZhbHVlUgV2YWx1ZToCOAEiyQMKD - ENhbGxSZXNwb25zZRI8CgZyZXR1cm4YASABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0QgviPwgSBnJldHVyblIGcmV0dXJuE - ngKEnJldHVybkRlcGVuZGVuY2llcxgCIAMoCzIvLnB1bHVtaXJwYy5DYWxsUmVzcG9uc2UuUmV0dXJuRGVwZW5kZW5jaWVzRW50c - nlCF+I/FBIScmV0dXJuRGVwZW5kZW5jaWVzUhJyZXR1cm5EZXBlbmRlbmNpZXMSQgoIZmFpbHVyZXMYAyADKAsyFy5wdWx1bWlyc - GMuQ2hlY2tGYWlsdXJlQg3iPwoSCGZhaWx1cmVzUghmYWlsdXJlcxozChJSZXR1cm5EZXBlbmRlbmNpZXMSHQoEdXJucxgBIAMoC - UIJ4j8GEgR1cm5zUgR1cm5zGocBChdSZXR1cm5EZXBlbmRlbmNpZXNFbnRyeRIaCgNrZXkYASABKAlCCOI/BRIDa2V5UgNrZXkST - AoFdmFsdWUYAiABKAsyKi5wdWx1bWlycGMuQ2FsbFJlc3BvbnNlLlJldHVybkRlcGVuZGVuY2llc0IK4j8HEgV2YWx1ZVIFdmFsd - WU6AjgBIuEBCgxDaGVja1JlcXVlc3QSGgoDdXJuGAEgASgJQgjiPwUSA3VyblIDdXJuEjYKBG9sZHMYAiABKAsyFy5nb29nbGUuc - HJvdG9idWYuU3RydWN0QgniPwYSBG9sZHNSBG9sZHMSNgoEbmV3cxgDIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCCeI/B - hIEbmV3c1IEbmV3cxIvCgpyYW5kb21TZWVkGAUgASgMQg/iPwwSCnJhbmRvbVNlZWRSCnJhbmRvbVNlZWRKBAgEEAVSDnNlcXVlb - mNlTnVtYmVyIpEBCg1DaGVja1Jlc3BvbnNlEjwKBmlucHV0cxgBIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCC+I/CBIGa - W5wdXRzUgZpbnB1dHMSQgoIZmFpbHVyZXMYAiADKAsyFy5wdWx1bWlycGMuQ2hlY2tGYWlsdXJlQg3iPwoSCGZhaWx1cmVzUghmY - WlsdXJlcyJeCgxDaGVja0ZhaWx1cmUSKQoIcHJvcGVydHkYASABKAlCDeI/ChIIcHJvcGVydHlSCHByb3BlcnR5EiMKBnJlYXNvb - hgCIAEoCUIL4j8IEgZyZWFzb25SBnJlYXNvbiK0AgoLRGlmZlJlcXVlc3QSFwoCaWQYASABKAlCB+I/BBICaWRSAmlkEhoKA3Vyb + 2VtcHR5LnByb3RvGhxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvIjoKEEdldFNjaGVtYVJlcXVlc3QSJgoHdmVyc2lvbhgBI + AEoBUIM4j8JEgd2ZXJzaW9uUgd2ZXJzaW9uIjgKEUdldFNjaGVtYVJlc3BvbnNlEiMKBnNjaGVtYRgBIAEoCUIL4j8IEgZzY2hlb + WFSBnNjaGVtYSKKBAoQQ29uZmlndXJlUmVxdWVzdBJYCgl2YXJpYWJsZXMYASADKAsyKi5wdWx1bWlycGMuQ29uZmlndXJlUmVxd + WVzdC5WYXJpYWJsZXNFbnRyeUIO4j8LEgl2YXJpYWJsZXNSCXZhcmlhYmxlcxI2CgRhcmdzGAIgASgLMhcuZ29vZ2xlLnByb3RvY + nVmLlN0cnVjdEIJ4j8GEgRhcmdzUgRhcmdzEjgKDWFjY2VwdFNlY3JldHMYAyABKAhCEuI/DxINYWNjZXB0U2VjcmV0c1INYWNjZ + XB0U2VjcmV0cxI+Cg9hY2NlcHRSZXNvdXJjZXMYBCABKAhCFOI/ERIPYWNjZXB0UmVzb3VyY2VzUg9hY2NlcHRSZXNvdXJjZXMSP + QoQc2VuZHNfb2xkX2lucHV0cxgFIAEoCEIT4j8QEg5zZW5kc09sZElucHV0c1IOc2VuZHNPbGRJbnB1dHMSVwoac2VuZHNfb2xkX + 2lucHV0c190b19kZWxldGUYBiABKAhCG+I/GBIWc2VuZHNPbGRJbnB1dHNUb0RlbGV0ZVIWc2VuZHNPbGRJbnB1dHNUb0RlbGV0Z + RpSCg5WYXJpYWJsZXNFbnRyeRIaCgNrZXkYASABKAlCCOI/BRIDa2V5UgNrZXkSIAoFdmFsdWUYAiABKAlCCuI/BxIFdmFsdWVSB + XZhbHVlOgI4ASKHAgoRQ29uZmlndXJlUmVzcG9uc2USOAoNYWNjZXB0U2VjcmV0cxgBIAEoCEIS4j8PEg1hY2NlcHRTZWNyZXRzU + g1hY2NlcHRTZWNyZXRzEj4KD3N1cHBvcnRzUHJldmlldxgCIAEoCEIU4j8REg9zdXBwb3J0c1ByZXZpZXdSD3N1cHBvcnRzUHJld + mlldxI+Cg9hY2NlcHRSZXNvdXJjZXMYAyABKAhCFOI/ERIPYWNjZXB0UmVzb3VyY2VzUg9hY2NlcHRSZXNvdXJjZXMSOAoNYWNjZ + XB0T3V0cHV0cxgEIAEoCEIS4j8PEg1hY2NlcHRPdXRwdXRzUg1hY2NlcHRPdXRwdXRzIuEBChlDb25maWd1cmVFcnJvck1pc3Npb + mdLZXlzEmMKC21pc3NpbmdLZXlzGAEgAygLMi8ucHVsdW1pcnBjLkNvbmZpZ3VyZUVycm9yTWlzc2luZ0tleXMuTWlzc2luZ0tle + UIQ4j8NEgttaXNzaW5nS2V5c1ILbWlzc2luZ0tleXMaXwoKTWlzc2luZ0tleRIdCgRuYW1lGAEgASgJQgniPwYSBG5hbWVSBG5hb + WUSMgoLZGVzY3JpcHRpb24YAiABKAlCEOI/DRILZGVzY3JpcHRpb25SC2Rlc2NyaXB0aW9uIqABCg1JbnZva2VSZXF1ZXN0EhoKA + 3RvaxgBIAEoCUII4j8FEgN0b2tSA3RvaxI2CgRhcmdzGAIgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEIJ4j8GEgRhcmdzU + gRhcmdzSgQIAxAHUghwcm92aWRlclIHdmVyc2lvblIPYWNjZXB0UmVzb3VyY2VzUhFwbHVnaW5Eb3dubG9hZFVSTCKSAQoOSW52b + 2tlUmVzcG9uc2USPAoGcmV0dXJuGAEgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEIL4j8IEgZyZXR1cm5SBnJldHVybhJCC + ghmYWlsdXJlcxgCIAMoCzIXLnB1bHVtaXJwYy5DaGVja0ZhaWx1cmVCDeI/ChIIZmFpbHVyZXNSCGZhaWx1cmVzIq4ICgtDYWxsU + mVxdWVzdBIaCgN0b2sYASABKAlCCOI/BRIDdG9rUgN0b2sSNgoEYXJncxgCIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCC + eI/BhIEYXJnc1IEYXJncxJrCg9hcmdEZXBlbmRlbmNpZXMYAyADKAsyKy5wdWx1bWlycGMuQ2FsbFJlcXVlc3QuQXJnRGVwZW5kZ + W5jaWVzRW50cnlCFOI/ERIPYXJnRGVwZW5kZW5jaWVzUg9hcmdEZXBlbmRlbmNpZXMSJgoHcHJvamVjdBgGIAEoCUIM4j8JEgdwc + m9qZWN0Ugdwcm9qZWN0EiAKBXN0YWNrGAcgASgJQgriPwcSBXN0YWNrUgVzdGFjaxJHCgZjb25maWcYCCADKAsyIi5wdWx1bWlyc + GMuQ2FsbFJlcXVlc3QuQ29uZmlnRW50cnlCC+I/CBIGY29uZmlnUgZjb25maWcSQQoQY29uZmlnU2VjcmV0S2V5cxgJIAMoCUIV4 + j8SEhBjb25maWdTZWNyZXRLZXlzUhBjb25maWdTZWNyZXRLZXlzEiMKBmRyeVJ1bhgKIAEoCEIL4j8IEgZkcnlSdW5SBmRyeVJ1b + hIpCghwYXJhbGxlbBgLIAEoBUIN4j8KEghwYXJhbGxlbFIIcGFyYWxsZWwSPgoPbW9uaXRvckVuZHBvaW50GAwgASgJQhTiPxESD + 21vbml0b3JFbmRwb2ludFIPbW9uaXRvckVuZHBvaW50EjUKDG9yZ2FuaXphdGlvbhgOIAEoCUIR4j8OEgxvcmdhbml6YXRpb25SD + G9yZ2FuaXphdGlvbhJMChVhY2NlcHRzX291dHB1dF92YWx1ZXMYESABKAhCGOI/FRITYWNjZXB0c091dHB1dFZhbHVlc1ITYWNjZ + XB0c091dHB1dFZhbHVlcxo1ChRBcmd1bWVudERlcGVuZGVuY2llcxIdCgR1cm5zGAEgAygJQgniPwYSBHVybnNSBHVybnMahQEKF + EFyZ0RlcGVuZGVuY2llc0VudHJ5EhoKA2tleRgBIAEoCUII4j8FEgNrZXlSA2tleRJNCgV2YWx1ZRgCIAEoCzIrLnB1bHVtaXJwY + y5DYWxsUmVxdWVzdC5Bcmd1bWVudERlcGVuZGVuY2llc0IK4j8HEgV2YWx1ZVIFdmFsdWU6AjgBGk8KC0NvbmZpZ0VudHJ5EhoKA + 2tleRgBIAEoCUII4j8FEgNrZXlSA2tleRIgCgV2YWx1ZRgCIAEoCUIK4j8HEgV2YWx1ZVIFdmFsdWU6AjgBSgQIBBAFSgQIBRAGS + gQIDRAOSgQIEBARSgQIDxAQUghwcm92aWRlclIHdmVyc2lvblIRcGx1Z2luRG93bmxvYWRVUkxSD3BsdWdpbkNoZWNrc3Vtc1IOc + 291cmNlUG9zaXRpb24iyQMKDENhbGxSZXNwb25zZRI8CgZyZXR1cm4YASABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0QgviP + wgSBnJldHVyblIGcmV0dXJuEngKEnJldHVybkRlcGVuZGVuY2llcxgCIAMoCzIvLnB1bHVtaXJwYy5DYWxsUmVzcG9uc2UuUmV0d + XJuRGVwZW5kZW5jaWVzRW50cnlCF+I/FBIScmV0dXJuRGVwZW5kZW5jaWVzUhJyZXR1cm5EZXBlbmRlbmNpZXMSQgoIZmFpbHVyZ + XMYAyADKAsyFy5wdWx1bWlycGMuQ2hlY2tGYWlsdXJlQg3iPwoSCGZhaWx1cmVzUghmYWlsdXJlcxozChJSZXR1cm5EZXBlbmRlb + mNpZXMSHQoEdXJucxgBIAMoCUIJ4j8GEgR1cm5zUgR1cm5zGocBChdSZXR1cm5EZXBlbmRlbmNpZXNFbnRyeRIaCgNrZXkYASABK + AlCCOI/BRIDa2V5UgNrZXkSTAoFdmFsdWUYAiABKAsyKi5wdWx1bWlycGMuQ2FsbFJlc3BvbnNlLlJldHVybkRlcGVuZGVuY2llc + 0IK4j8HEgV2YWx1ZVIFdmFsdWU6AjgBIuEBCgxDaGVja1JlcXVlc3QSGgoDdXJuGAEgASgJQgjiPwUSA3VyblIDdXJuEjYKBG9sZ + HMYAiABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0QgniPwYSBG9sZHNSBG9sZHMSNgoEbmV3cxgDIAEoCzIXLmdvb2dsZS5wc + m90b2J1Zi5TdHJ1Y3RCCeI/BhIEbmV3c1IEbmV3cxIvCgpyYW5kb21TZWVkGAUgASgMQg/iPwwSCnJhbmRvbVNlZWRSCnJhbmRvb + VNlZWRKBAgEEAVSDnNlcXVlbmNlTnVtYmVyIpEBCg1DaGVja1Jlc3BvbnNlEjwKBmlucHV0cxgBIAEoCzIXLmdvb2dsZS5wcm90b + 2J1Zi5TdHJ1Y3RCC+I/CBIGaW5wdXRzUgZpbnB1dHMSQgoIZmFpbHVyZXMYAiADKAsyFy5wdWx1bWlycGMuQ2hlY2tGYWlsdXJlQ + g3iPwoSCGZhaWx1cmVzUghmYWlsdXJlcyJeCgxDaGVja0ZhaWx1cmUSKQoIcHJvcGVydHkYASABKAlCDeI/ChIIcHJvcGVydHlSC + HByb3BlcnR5EiMKBnJlYXNvbhgCIAEoCUIL4j8IEgZyZWFzb25SBnJlYXNvbiK0AgoLRGlmZlJlcXVlc3QSFwoCaWQYASABKAlCB + +I/BBICaWRSAmlkEhoKA3VybhgCIAEoCUII4j8FEgN1cm5SA3VybhI2CgRvbGRzGAMgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0c + nVjdEIJ4j8GEgRvbGRzUgRvbGRzEjYKBG5ld3MYBCABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0QgniPwYSBG5ld3NSBG5ld + 3MSOAoNaWdub3JlQ2hhbmdlcxgFIAMoCUIS4j8PEg1pZ25vcmVDaGFuZ2VzUg1pZ25vcmVDaGFuZ2VzEkYKCm9sZF9pbnB1dHMYB + iABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0Qg7iPwsSCW9sZElucHV0c1IJb2xkSW5wdXRzIrwCCgxQcm9wZXJ0eURpZmYSO + woEa2luZBgBIAEoDjIcLnB1bHVtaXJwYy5Qcm9wZXJ0eURpZmYuS2luZEIJ4j8GEgRraW5kUgRraW5kEiwKCWlucHV0RGlmZhgCI + AEoCEIO4j8LEglpbnB1dERpZmZSCWlucHV0RGlmZiLAAQoES2luZBIRCgNBREQQABoI4j8FEgNBREQSIQoLQUREX1JFUExBQ0UQA + RoQ4j8NEgtBRERfUkVQTEFDRRIXCgZERUxFVEUQAhoL4j8IEgZERUxFVEUSJwoOREVMRVRFX1JFUExBQ0UQAxoT4j8QEg5ERUxFV + EVfUkVQTEFDRRIXCgZVUERBVEUQBBoL4j8IEgZVUERBVEUSJwoOVVBEQVRFX1JFUExBQ0UQBRoT4j8QEg5VUERBVEVfUkVQTEFDR + SKgBQoMRGlmZlJlc3BvbnNlEikKCHJlcGxhY2VzGAEgAygJQg3iPwoSCHJlcGxhY2VzUghyZXBsYWNlcxImCgdzdGFibGVzGAIgA + ygJQgziPwkSB3N0YWJsZXNSB3N0YWJsZXMSSgoTZGVsZXRlQmVmb3JlUmVwbGFjZRgDIAEoCEIY4j8VEhNkZWxldGVCZWZvcmVSZ + XBsYWNlUhNkZWxldGVCZWZvcmVSZXBsYWNlEksKB2NoYW5nZXMYBCABKA4yIy5wdWx1bWlycGMuRGlmZlJlc3BvbnNlLkRpZmZDa + GFuZ2VzQgziPwkSB2NoYW5nZXNSB2NoYW5nZXMSIAoFZGlmZnMYBSADKAlCCuI/BxIFZGlmZnNSBWRpZmZzEmAKDGRldGFpbGVkR + GlmZhgGIAMoCzIpLnB1bHVtaXJwYy5EaWZmUmVzcG9uc2UuRGV0YWlsZWREaWZmRW50cnlCEeI/DhIMZGV0YWlsZWREaWZmUgxkZ + XRhaWxlZERpZmYSPgoPaGFzRGV0YWlsZWREaWZmGAcgASgIQhTiPxESD2hhc0RldGFpbGVkRGlmZlIPaGFzRGV0YWlsZWREaWZmG + m4KEURldGFpbGVkRGlmZkVudHJ5EhoKA2tleRgBIAEoCUII4j8FEgNrZXlSA2tleRI5CgV2YWx1ZRgCIAEoCzIXLnB1bHVtaXJwY + y5Qcm9wZXJ0eURpZmZCCuI/BxIFdmFsdWVSBXZhbHVlOgI4ASJwCgtEaWZmQ2hhbmdlcxIjCgxESUZGX1VOS05PV04QABoR4j8OE + gxESUZGX1VOS05PV04SHQoJRElGRl9OT05FEAEaDuI/CxIJRElGRl9OT05FEh0KCURJRkZfU09NRRACGg7iPwsSCURJRkZfU09NR + SLFAQoNQ3JlYXRlUmVxdWVzdBIaCgN1cm4YASABKAlCCOI/BRIDdXJuUgN1cm4SSAoKcHJvcGVydGllcxgCIAEoCzIXLmdvb2dsZ + S5wcm90b2J1Zi5TdHJ1Y3RCD+I/DBIKcHJvcGVydGllc1IKcHJvcGVydGllcxImCgd0aW1lb3V0GAMgASgBQgziPwkSB3RpbWVvd + XRSB3RpbWVvdXQSJgoHcHJldmlldxgEIAEoCEIM4j8JEgdwcmV2aWV3UgdwcmV2aWV3InMKDkNyZWF0ZVJlc3BvbnNlEhcKAmlkG + AEgASgJQgfiPwQSAmlkUgJpZBJICgpwcm9wZXJ0aWVzGAIgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEIP4j8MEgpwcm9wZ + XJ0aWVzUgpwcm9wZXJ0aWVzIsoBCgtSZWFkUmVxdWVzdBIXCgJpZBgBIAEoCUIH4j8EEgJpZFICaWQSGgoDdXJuGAIgASgJQgjiP + wUSA3VyblIDdXJuEkgKCnByb3BlcnRpZXMYAyABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0Qg/iPwwSCnByb3BlcnRpZXNSC + nByb3BlcnRpZXMSPAoGaW5wdXRzGAQgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEIL4j8IEgZpbnB1dHNSBmlucHV0cyKvA + QoMUmVhZFJlc3BvbnNlEhcKAmlkGAEgASgJQgfiPwQSAmlkUgJpZBJICgpwcm9wZXJ0aWVzGAIgASgLMhcuZ29vZ2xlLnByb3RvY + nVmLlN0cnVjdEIP4j8MEgpwcm9wZXJ0aWVzUgpwcm9wZXJ0aWVzEjwKBmlucHV0cxgDIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5Td + HJ1Y3RCC+I/CBIGaW5wdXRzUgZpbnB1dHMihgMKDVVwZGF0ZVJlcXVlc3QSFwoCaWQYASABKAlCB+I/BBICaWRSAmlkEhoKA3Vyb hgCIAEoCUII4j8FEgN1cm5SA3VybhI2CgRvbGRzGAMgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEIJ4j8GEgRvbGRzUgRvb - GRzEjYKBG5ld3MYBCABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0QgniPwYSBG5ld3NSBG5ld3MSOAoNaWdub3JlQ2hhbmdlc - xgFIAMoCUIS4j8PEg1pZ25vcmVDaGFuZ2VzUg1pZ25vcmVDaGFuZ2VzEkYKCm9sZF9pbnB1dHMYBiABKAsyFy5nb29nbGUucHJvd - G9idWYuU3RydWN0Qg7iPwsSCW9sZElucHV0c1IJb2xkSW5wdXRzIrwCCgxQcm9wZXJ0eURpZmYSOwoEa2luZBgBIAEoDjIcLnB1b - HVtaXJwYy5Qcm9wZXJ0eURpZmYuS2luZEIJ4j8GEgRraW5kUgRraW5kEiwKCWlucHV0RGlmZhgCIAEoCEIO4j8LEglpbnB1dERpZ - mZSCWlucHV0RGlmZiLAAQoES2luZBIRCgNBREQQABoI4j8FEgNBREQSIQoLQUREX1JFUExBQ0UQARoQ4j8NEgtBRERfUkVQTEFDR - RIXCgZERUxFVEUQAhoL4j8IEgZERUxFVEUSJwoOREVMRVRFX1JFUExBQ0UQAxoT4j8QEg5ERUxFVEVfUkVQTEFDRRIXCgZVUERBV - EUQBBoL4j8IEgZVUERBVEUSJwoOVVBEQVRFX1JFUExBQ0UQBRoT4j8QEg5VUERBVEVfUkVQTEFDRSKgBQoMRGlmZlJlc3BvbnNlE - ikKCHJlcGxhY2VzGAEgAygJQg3iPwoSCHJlcGxhY2VzUghyZXBsYWNlcxImCgdzdGFibGVzGAIgAygJQgziPwkSB3N0YWJsZXNSB - 3N0YWJsZXMSSgoTZGVsZXRlQmVmb3JlUmVwbGFjZRgDIAEoCEIY4j8VEhNkZWxldGVCZWZvcmVSZXBsYWNlUhNkZWxldGVCZWZvc - mVSZXBsYWNlEksKB2NoYW5nZXMYBCABKA4yIy5wdWx1bWlycGMuRGlmZlJlc3BvbnNlLkRpZmZDaGFuZ2VzQgziPwkSB2NoYW5nZ - XNSB2NoYW5nZXMSIAoFZGlmZnMYBSADKAlCCuI/BxIFZGlmZnNSBWRpZmZzEmAKDGRldGFpbGVkRGlmZhgGIAMoCzIpLnB1bHVta - XJwYy5EaWZmUmVzcG9uc2UuRGV0YWlsZWREaWZmRW50cnlCEeI/DhIMZGV0YWlsZWREaWZmUgxkZXRhaWxlZERpZmYSPgoPaGFzR - GV0YWlsZWREaWZmGAcgASgIQhTiPxESD2hhc0RldGFpbGVkRGlmZlIPaGFzRGV0YWlsZWREaWZmGm4KEURldGFpbGVkRGlmZkVud - HJ5EhoKA2tleRgBIAEoCUII4j8FEgNrZXlSA2tleRI5CgV2YWx1ZRgCIAEoCzIXLnB1bHVtaXJwYy5Qcm9wZXJ0eURpZmZCCuI/B - xIFdmFsdWVSBXZhbHVlOgI4ASJwCgtEaWZmQ2hhbmdlcxIjCgxESUZGX1VOS05PV04QABoR4j8OEgxESUZGX1VOS05PV04SHQoJR - ElGRl9OT05FEAEaDuI/CxIJRElGRl9OT05FEh0KCURJRkZfU09NRRACGg7iPwsSCURJRkZfU09NRSLFAQoNQ3JlYXRlUmVxdWVzd - BIaCgN1cm4YASABKAlCCOI/BRIDdXJuUgN1cm4SSAoKcHJvcGVydGllcxgCIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCD - +I/DBIKcHJvcGVydGllc1IKcHJvcGVydGllcxImCgd0aW1lb3V0GAMgASgBQgziPwkSB3RpbWVvdXRSB3RpbWVvdXQSJgoHcHJld - mlldxgEIAEoCEIM4j8JEgdwcmV2aWV3UgdwcmV2aWV3InMKDkNyZWF0ZVJlc3BvbnNlEhcKAmlkGAEgASgJQgfiPwQSAmlkUgJpZ - BJICgpwcm9wZXJ0aWVzGAIgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEIP4j8MEgpwcm9wZXJ0aWVzUgpwcm9wZXJ0aWVzI - soBCgtSZWFkUmVxdWVzdBIXCgJpZBgBIAEoCUIH4j8EEgJpZFICaWQSGgoDdXJuGAIgASgJQgjiPwUSA3VyblIDdXJuEkgKCnByb - 3BlcnRpZXMYAyABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0Qg/iPwwSCnByb3BlcnRpZXNSCnByb3BlcnRpZXMSPAoGaW5wd - XRzGAQgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEIL4j8IEgZpbnB1dHNSBmlucHV0cyKvAQoMUmVhZFJlc3BvbnNlEhcKA - mlkGAEgASgJQgfiPwQSAmlkUgJpZBJICgpwcm9wZXJ0aWVzGAIgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEIP4j8MEgpwc - m9wZXJ0aWVzUgpwcm9wZXJ0aWVzEjwKBmlucHV0cxgDIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCC+I/CBIGaW5wdXRzU - gZpbnB1dHMihgMKDVVwZGF0ZVJlcXVlc3QSFwoCaWQYASABKAlCB+I/BBICaWRSAmlkEhoKA3VybhgCIAEoCUII4j8FEgN1cm5SA - 3VybhI2CgRvbGRzGAMgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEIJ4j8GEgRvbGRzUgRvbGRzEjYKBG5ld3MYBCABKAsyF - y5nb29nbGUucHJvdG9idWYuU3RydWN0QgniPwYSBG5ld3NSBG5ld3MSJgoHdGltZW91dBgFIAEoAUIM4j8JEgd0aW1lb3V0Ugd0a - W1lb3V0EjgKDWlnbm9yZUNoYW5nZXMYBiADKAlCEuI/DxINaWdub3JlQ2hhbmdlc1INaWdub3JlQ2hhbmdlcxImCgdwcmV2aWV3G - AcgASgIQgziPwkSB3ByZXZpZXdSB3ByZXZpZXcSRgoKb2xkX2lucHV0cxgIIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCD - uI/CxIJb2xkSW5wdXRzUglvbGRJbnB1dHMiWgoOVXBkYXRlUmVzcG9uc2USSAoKcHJvcGVydGllcxgBIAEoCzIXLmdvb2dsZS5wc - m90b2J1Zi5TdHJ1Y3RCD+I/DBIKcHJvcGVydGllc1IKcHJvcGVydGllcyL+AQoNRGVsZXRlUmVxdWVzdBIXCgJpZBgBIAEoCUIH4 - j8EEgJpZFICaWQSGgoDdXJuGAIgASgJQgjiPwUSA3VyblIDdXJuEkgKCnByb3BlcnRpZXMYAyABKAsyFy5nb29nbGUucHJvdG9id - WYuU3RydWN0Qg/iPwwSCnByb3BlcnRpZXNSCnByb3BlcnRpZXMSJgoHdGltZW91dBgEIAEoAUIM4j8JEgd0aW1lb3V0Ugd0aW1lb - 3V0EkYKCm9sZF9pbnB1dHMYBSABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0Qg7iPwsSCW9sZElucHV0c1IJb2xkSW5wdXRzI - pcPChBDb25zdHJ1Y3RSZXF1ZXN0EiYKB3Byb2plY3QYASABKAlCDOI/CRIHcHJvamVjdFIHcHJvamVjdBIgCgVzdGFjaxgCIAEoC - UIK4j8HEgVzdGFja1IFc3RhY2sSTAoGY29uZmlnGAMgAygLMicucHVsdW1pcnBjLkNvbnN0cnVjdFJlcXVlc3QuQ29uZmlnRW50c - nlCC+I/CBIGY29uZmlnUgZjb25maWcSIwoGZHJ5UnVuGAQgASgIQgviPwgSBmRyeVJ1blIGZHJ5UnVuEikKCHBhcmFsbGVsGAUgA - SgFQg3iPwoSCHBhcmFsbGVsUghwYXJhbGxlbBI+Cg9tb25pdG9yRW5kcG9pbnQYBiABKAlCFOI/ERIPbW9uaXRvckVuZHBvaW50U - g9tb25pdG9yRW5kcG9pbnQSHQoEdHlwZRgHIAEoCUIJ4j8GEgR0eXBlUgR0eXBlEh0KBG5hbWUYCCABKAlCCeI/BhIEbmFtZVIEb - mFtZRIjCgZwYXJlbnQYCSABKAlCC+I/CBIGcGFyZW50UgZwYXJlbnQSPAoGaW5wdXRzGAogASgLMhcuZ29vZ2xlLnByb3RvYnVmL - lN0cnVjdEIL4j8IEgZpbnB1dHNSBmlucHV0cxJ4ChFpbnB1dERlcGVuZGVuY2llcxgLIAMoCzIyLnB1bHVtaXJwYy5Db25zdHJ1Y - 3RSZXF1ZXN0LklucHV0RGVwZW5kZW5jaWVzRW50cnlCFuI/ExIRaW5wdXREZXBlbmRlbmNpZXNSEWlucHV0RGVwZW5kZW5jaWVzE - lgKCXByb3ZpZGVycxgNIAMoCzIqLnB1bHVtaXJwYy5Db25zdHJ1Y3RSZXF1ZXN0LlByb3ZpZGVyc0VudHJ5Qg7iPwsSCXByb3ZpZ - GVyc1IJcHJvdmlkZXJzEjUKDGRlcGVuZGVuY2llcxgPIAMoCUIR4j8OEgxkZXBlbmRlbmNpZXNSDGRlcGVuZGVuY2llcxJBChBjb - 25maWdTZWNyZXRLZXlzGBAgAygJQhXiPxISEGNvbmZpZ1NlY3JldEtleXNSEGNvbmZpZ1NlY3JldEtleXMSNQoMb3JnYW5pemF0a - W9uGBEgASgJQhHiPw4SDG9yZ2FuaXphdGlvblIMb3JnYW5pemF0aW9uEiYKB3Byb3RlY3QYDCABKAhCDOI/CRIHcHJvdGVjdFIHc - HJvdGVjdBImCgdhbGlhc2VzGA4gAygJQgziPwkSB2FsaWFzZXNSB2FsaWFzZXMSVgoXYWRkaXRpb25hbFNlY3JldE91dHB1dHMYE - iADKAlCHOI/GRIXYWRkaXRpb25hbFNlY3JldE91dHB1dHNSF2FkZGl0aW9uYWxTZWNyZXRPdXRwdXRzEmcKDmN1c3RvbVRpbWVvd - XRzGBMgASgLMioucHVsdW1pcnBjLkNvbnN0cnVjdFJlcXVlc3QuQ3VzdG9tVGltZW91dHNCE+I/EBIOY3VzdG9tVGltZW91dHNSD - mN1c3RvbVRpbWVvdXRzEjIKC2RlbGV0ZWRXaXRoGBQgASgJQhDiPw0SC2RlbGV0ZWRXaXRoUgtkZWxldGVkV2l0aBJKChNkZWxld - GVCZWZvcmVSZXBsYWNlGBUgASgIQhjiPxUSE2RlbGV0ZUJlZm9yZVJlcGxhY2VSE2RlbGV0ZUJlZm9yZVJlcGxhY2USOAoNaWdub - 3JlQ2hhbmdlcxgWIAMoCUIS4j8PEg1pZ25vcmVDaGFuZ2VzUg1pZ25vcmVDaGFuZ2VzEkEKEHJlcGxhY2VPbkNoYW5nZXMYFyADK - AlCFeI/EhIQcmVwbGFjZU9uQ2hhbmdlc1IQcmVwbGFjZU9uQ2hhbmdlcxI7Cg5yZXRhaW5PbkRlbGV0ZRgYIAEoCEIT4j8QEg5yZ - XRhaW5PbkRlbGV0ZVIOcmV0YWluT25EZWxldGUaNQoUUHJvcGVydHlEZXBlbmRlbmNpZXMSHQoEdXJucxgBIAMoCUIJ4j8GEgR1c - m5zUgR1cm5zGn8KDkN1c3RvbVRpbWVvdXRzEiMKBmNyZWF0ZRgBIAEoCUIL4j8IEgZjcmVhdGVSBmNyZWF0ZRIjCgZ1cGRhdGUYA - iABKAlCC+I/CBIGdXBkYXRlUgZ1cGRhdGUSIwoGZGVsZXRlGAMgASgJQgviPwgSBmRlbGV0ZVIGZGVsZXRlGk8KC0NvbmZpZ0Vud - HJ5EhoKA2tleRgBIAEoCUII4j8FEgNrZXlSA2tleRIgCgV2YWx1ZRgCIAEoCUIK4j8HEgV2YWx1ZVIFdmFsdWU6AjgBGowBChZJb - nB1dERlcGVuZGVuY2llc0VudHJ5EhoKA2tleRgBIAEoCUII4j8FEgNrZXlSA2tleRJSCgV2YWx1ZRgCIAEoCzIwLnB1bHVtaXJwY - y5Db25zdHJ1Y3RSZXF1ZXN0LlByb3BlcnR5RGVwZW5kZW5jaWVzQgriPwcSBXZhbHVlUgV2YWx1ZToCOAEaUgoOUHJvdmlkZXJzR - W50cnkSGgoDa2V5GAEgASgJQgjiPwUSA2tleVIDa2V5EiAKBXZhbHVlGAIgASgJQgriPwcSBXZhbHVlUgV2YWx1ZToCOAEirAMKE - UNvbnN0cnVjdFJlc3BvbnNlEhoKA3VybhgBIAEoCUII4j8FEgN1cm5SA3VybhI5CgVzdGF0ZRgCIAEoCzIXLmdvb2dsZS5wcm90b - 2J1Zi5TdHJ1Y3RCCuI/BxIFc3RhdGVSBXN0YXRlEnkKEXN0YXRlRGVwZW5kZW5jaWVzGAMgAygLMjMucHVsdW1pcnBjLkNvbnN0c - nVjdFJlc3BvbnNlLlN0YXRlRGVwZW5kZW5jaWVzRW50cnlCFuI/ExIRc3RhdGVEZXBlbmRlbmNpZXNSEXN0YXRlRGVwZW5kZW5ja - WVzGjUKFFByb3BlcnR5RGVwZW5kZW5jaWVzEh0KBHVybnMYASADKAlCCeI/BhIEdXJuc1IEdXJucxqNAQoWU3RhdGVEZXBlbmRlb - mNpZXNFbnRyeRIaCgNrZXkYASABKAlCCOI/BRIDa2V5UgNrZXkSUwoFdmFsdWUYAiABKAsyMS5wdWx1bWlycGMuQ29uc3RydWN0U - mVzcG9uc2UuUHJvcGVydHlEZXBlbmRlbmNpZXNCCuI/BxIFdmFsdWVSBXZhbHVlOgI4ASLiAQoXRXJyb3JSZXNvdXJjZUluaXRGY - WlsZWQSFwoCaWQYASABKAlCB+I/BBICaWRSAmlkEkgKCnByb3BlcnRpZXMYAiABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0Q - g/iPwwSCnByb3BlcnRpZXNSCnByb3BlcnRpZXMSJgoHcmVhc29ucxgDIAMoCUIM4j8JEgdyZWFzb25zUgdyZWFzb25zEjwKBmluc - HV0cxgEIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCC+I/CBIGaW5wdXRzUgZpbnB1dHMiWgoRR2V0TWFwcGluZ1JlcXVlc - 3QSGgoDa2V5GAEgASgJQgjiPwUSA2tleVIDa2V5EikKCHByb3ZpZGVyGAIgASgJQg3iPwoSCHByb3ZpZGVyUghwcm92aWRlciJeC - hJHZXRNYXBwaW5nUmVzcG9uc2USKQoIcHJvdmlkZXIYASABKAlCDeI/ChIIcHJvdmlkZXJSCHByb3ZpZGVyEh0KBGRhdGEYAiABK - AxCCeI/BhIEZGF0YVIEZGF0YSIwChJHZXRNYXBwaW5nc1JlcXVlc3QSGgoDa2V5GAEgASgJQgjiPwUSA2tleVIDa2V5IkMKE0dld - E1hcHBpbmdzUmVzcG9uc2USLAoJcHJvdmlkZXJzGAEgAygJQg7iPwsSCXByb3ZpZGVyc1IJcHJvdmlkZXJzMoYKChBSZXNvdXJjZ - VByb3ZpZGVyEkgKCUdldFNjaGVtYRIbLnB1bHVtaXJwYy5HZXRTY2hlbWFSZXF1ZXN0GhwucHVsdW1pcnBjLkdldFNjaGVtYVJlc - 3BvbnNlIgASQgoLQ2hlY2tDb25maWcSFy5wdWx1bWlycGMuQ2hlY2tSZXF1ZXN0GhgucHVsdW1pcnBjLkNoZWNrUmVzcG9uc2UiA - BI/CgpEaWZmQ29uZmlnEhYucHVsdW1pcnBjLkRpZmZSZXF1ZXN0GhcucHVsdW1pcnBjLkRpZmZSZXNwb25zZSIAEkgKCUNvbmZpZ - 3VyZRIbLnB1bHVtaXJwYy5Db25maWd1cmVSZXF1ZXN0GhwucHVsdW1pcnBjLkNvbmZpZ3VyZVJlc3BvbnNlIgASPwoGSW52b2tlE - hgucHVsdW1pcnBjLkludm9rZVJlcXVlc3QaGS5wdWx1bWlycGMuSW52b2tlUmVzcG9uc2UiABJHCgxTdHJlYW1JbnZva2USGC5wd - Wx1bWlycGMuSW52b2tlUmVxdWVzdBoZLnB1bHVtaXJwYy5JbnZva2VSZXNwb25zZSIAMAESOQoEQ2FsbBIWLnB1bHVtaXJwYy5DY - WxsUmVxdWVzdBoXLnB1bHVtaXJwYy5DYWxsUmVzcG9uc2UiABI8CgVDaGVjaxIXLnB1bHVtaXJwYy5DaGVja1JlcXVlc3QaGC5wd - Wx1bWlycGMuQ2hlY2tSZXNwb25zZSIAEjkKBERpZmYSFi5wdWx1bWlycGMuRGlmZlJlcXVlc3QaFy5wdWx1bWlycGMuRGlmZlJlc - 3BvbnNlIgASPwoGQ3JlYXRlEhgucHVsdW1pcnBjLkNyZWF0ZVJlcXVlc3QaGS5wdWx1bWlycGMuQ3JlYXRlUmVzcG9uc2UiABI5C - gRSZWFkEhYucHVsdW1pcnBjLlJlYWRSZXF1ZXN0GhcucHVsdW1pcnBjLlJlYWRSZXNwb25zZSIAEj8KBlVwZGF0ZRIYLnB1bHVta - XJwYy5VcGRhdGVSZXF1ZXN0GhkucHVsdW1pcnBjLlVwZGF0ZVJlc3BvbnNlIgASPAoGRGVsZXRlEhgucHVsdW1pcnBjLkRlbGV0Z - VJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABJICglDb25zdHJ1Y3QSGy5wdWx1bWlycGMuQ29uc3RydWN0UmVxdWVzd - BocLnB1bHVtaXJwYy5Db25zdHJ1Y3RSZXNwb25zZSIAEjoKBkNhbmNlbBIWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRoWLmdvb2dsZ - S5wcm90b2J1Zi5FbXB0eSIAEkAKDUdldFBsdWdpbkluZm8SFi5nb29nbGUucHJvdG9idWYuRW1wdHkaFS5wdWx1bWlycGMuUGx1Z - 2luSW5mbyIAEjsKBkF0dGFjaBIXLnB1bHVtaXJwYy5QbHVnaW5BdHRhY2gaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABJLCgpHZ - XRNYXBwaW5nEhwucHVsdW1pcnBjLkdldE1hcHBpbmdSZXF1ZXN0Gh0ucHVsdW1pcnBjLkdldE1hcHBpbmdSZXNwb25zZSIAEk4KC - 0dldE1hcHBpbmdzEh0ucHVsdW1pcnBjLkdldE1hcHBpbmdzUmVxdWVzdBoeLnB1bHVtaXJwYy5HZXRNYXBwaW5nc1Jlc3BvbnNlI - gBCNFoyZ2l0aHViLmNvbS9wdWx1bWkvcHVsdW1pL3Nkay92My9wcm90by9nbztwdWx1bWlycGNiBnByb3RvMw==""" + GRzEjYKBG5ld3MYBCABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0QgniPwYSBG5ld3NSBG5ld3MSJgoHdGltZW91dBgFIAEoA + UIM4j8JEgd0aW1lb3V0Ugd0aW1lb3V0EjgKDWlnbm9yZUNoYW5nZXMYBiADKAlCEuI/DxINaWdub3JlQ2hhbmdlc1INaWdub3JlQ + 2hhbmdlcxImCgdwcmV2aWV3GAcgASgIQgziPwkSB3ByZXZpZXdSB3ByZXZpZXcSRgoKb2xkX2lucHV0cxgIIAEoCzIXLmdvb2dsZ + S5wcm90b2J1Zi5TdHJ1Y3RCDuI/CxIJb2xkSW5wdXRzUglvbGRJbnB1dHMiWgoOVXBkYXRlUmVzcG9uc2USSAoKcHJvcGVydGllc + xgBIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCD+I/DBIKcHJvcGVydGllc1IKcHJvcGVydGllcyL+AQoNRGVsZXRlUmVxd + WVzdBIXCgJpZBgBIAEoCUIH4j8EEgJpZFICaWQSGgoDdXJuGAIgASgJQgjiPwUSA3VyblIDdXJuEkgKCnByb3BlcnRpZXMYAyABK + AsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0Qg/iPwwSCnByb3BlcnRpZXNSCnByb3BlcnRpZXMSJgoHdGltZW91dBgEIAEoAUIM4 + j8JEgd0aW1lb3V0Ugd0aW1lb3V0EkYKCm9sZF9pbnB1dHMYBSABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0Qg7iPwsSCW9sZ + ElucHV0c1IJb2xkSW5wdXRzIuUPChBDb25zdHJ1Y3RSZXF1ZXN0EiYKB3Byb2plY3QYASABKAlCDOI/CRIHcHJvamVjdFIHcHJva + mVjdBIgCgVzdGFjaxgCIAEoCUIK4j8HEgVzdGFja1IFc3RhY2sSTAoGY29uZmlnGAMgAygLMicucHVsdW1pcnBjLkNvbnN0cnVjd + FJlcXVlc3QuQ29uZmlnRW50cnlCC+I/CBIGY29uZmlnUgZjb25maWcSIwoGZHJ5UnVuGAQgASgIQgviPwgSBmRyeVJ1blIGZHJ5U + nVuEikKCHBhcmFsbGVsGAUgASgFQg3iPwoSCHBhcmFsbGVsUghwYXJhbGxlbBI+Cg9tb25pdG9yRW5kcG9pbnQYBiABKAlCFOI/E + RIPbW9uaXRvckVuZHBvaW50Ug9tb25pdG9yRW5kcG9pbnQSHQoEdHlwZRgHIAEoCUIJ4j8GEgR0eXBlUgR0eXBlEh0KBG5hbWUYC + CABKAlCCeI/BhIEbmFtZVIEbmFtZRIjCgZwYXJlbnQYCSABKAlCC+I/CBIGcGFyZW50UgZwYXJlbnQSPAoGaW5wdXRzGAogASgLM + hcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEIL4j8IEgZpbnB1dHNSBmlucHV0cxJ4ChFpbnB1dERlcGVuZGVuY2llcxgLIAMoCzIyL + nB1bHVtaXJwYy5Db25zdHJ1Y3RSZXF1ZXN0LklucHV0RGVwZW5kZW5jaWVzRW50cnlCFuI/ExIRaW5wdXREZXBlbmRlbmNpZXNSE + WlucHV0RGVwZW5kZW5jaWVzElgKCXByb3ZpZGVycxgNIAMoCzIqLnB1bHVtaXJwYy5Db25zdHJ1Y3RSZXF1ZXN0LlByb3ZpZGVyc + 0VudHJ5Qg7iPwsSCXByb3ZpZGVyc1IJcHJvdmlkZXJzEjUKDGRlcGVuZGVuY2llcxgPIAMoCUIR4j8OEgxkZXBlbmRlbmNpZXNSD + GRlcGVuZGVuY2llcxJBChBjb25maWdTZWNyZXRLZXlzGBAgAygJQhXiPxISEGNvbmZpZ1NlY3JldEtleXNSEGNvbmZpZ1NlY3Jld + EtleXMSNQoMb3JnYW5pemF0aW9uGBEgASgJQhHiPw4SDG9yZ2FuaXphdGlvblIMb3JnYW5pemF0aW9uEiYKB3Byb3RlY3QYDCABK + AhCDOI/CRIHcHJvdGVjdFIHcHJvdGVjdBImCgdhbGlhc2VzGA4gAygJQgziPwkSB2FsaWFzZXNSB2FsaWFzZXMSVgoXYWRkaXRpb + 25hbFNlY3JldE91dHB1dHMYEiADKAlCHOI/GRIXYWRkaXRpb25hbFNlY3JldE91dHB1dHNSF2FkZGl0aW9uYWxTZWNyZXRPdXRwd + XRzEmcKDmN1c3RvbVRpbWVvdXRzGBMgASgLMioucHVsdW1pcnBjLkNvbnN0cnVjdFJlcXVlc3QuQ3VzdG9tVGltZW91dHNCE+I/E + BIOY3VzdG9tVGltZW91dHNSDmN1c3RvbVRpbWVvdXRzEjIKC2RlbGV0ZWRXaXRoGBQgASgJQhDiPw0SC2RlbGV0ZWRXaXRoUgtkZ + WxldGVkV2l0aBJKChNkZWxldGVCZWZvcmVSZXBsYWNlGBUgASgIQhjiPxUSE2RlbGV0ZUJlZm9yZVJlcGxhY2VSE2RlbGV0ZUJlZ + m9yZVJlcGxhY2USOAoNaWdub3JlQ2hhbmdlcxgWIAMoCUIS4j8PEg1pZ25vcmVDaGFuZ2VzUg1pZ25vcmVDaGFuZ2VzEkEKEHJlc + GxhY2VPbkNoYW5nZXMYFyADKAlCFeI/EhIQcmVwbGFjZU9uQ2hhbmdlc1IQcmVwbGFjZU9uQ2hhbmdlcxI7Cg5yZXRhaW5PbkRlb + GV0ZRgYIAEoCEIT4j8QEg5yZXRhaW5PbkRlbGV0ZVIOcmV0YWluT25EZWxldGUSTAoVYWNjZXB0c19vdXRwdXRfdmFsdWVzGBkgA + SgIQhjiPxUSE2FjY2VwdHNPdXRwdXRWYWx1ZXNSE2FjY2VwdHNPdXRwdXRWYWx1ZXMaNQoUUHJvcGVydHlEZXBlbmRlbmNpZXMSH + QoEdXJucxgBIAMoCUIJ4j8GEgR1cm5zUgR1cm5zGn8KDkN1c3RvbVRpbWVvdXRzEiMKBmNyZWF0ZRgBIAEoCUIL4j8IEgZjcmVhd + GVSBmNyZWF0ZRIjCgZ1cGRhdGUYAiABKAlCC+I/CBIGdXBkYXRlUgZ1cGRhdGUSIwoGZGVsZXRlGAMgASgJQgviPwgSBmRlbGV0Z + VIGZGVsZXRlGk8KC0NvbmZpZ0VudHJ5EhoKA2tleRgBIAEoCUII4j8FEgNrZXlSA2tleRIgCgV2YWx1ZRgCIAEoCUIK4j8HEgV2Y + Wx1ZVIFdmFsdWU6AjgBGowBChZJbnB1dERlcGVuZGVuY2llc0VudHJ5EhoKA2tleRgBIAEoCUII4j8FEgNrZXlSA2tleRJSCgV2Y + Wx1ZRgCIAEoCzIwLnB1bHVtaXJwYy5Db25zdHJ1Y3RSZXF1ZXN0LlByb3BlcnR5RGVwZW5kZW5jaWVzQgriPwcSBXZhbHVlUgV2Y + Wx1ZToCOAEaUgoOUHJvdmlkZXJzRW50cnkSGgoDa2V5GAEgASgJQgjiPwUSA2tleVIDa2V5EiAKBXZhbHVlGAIgASgJQgriPwcSB + XZhbHVlUgV2YWx1ZToCOAEirAMKEUNvbnN0cnVjdFJlc3BvbnNlEhoKA3VybhgBIAEoCUII4j8FEgN1cm5SA3VybhI5CgVzdGF0Z + RgCIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCCuI/BxIFc3RhdGVSBXN0YXRlEnkKEXN0YXRlRGVwZW5kZW5jaWVzGAMgA + ygLMjMucHVsdW1pcnBjLkNvbnN0cnVjdFJlc3BvbnNlLlN0YXRlRGVwZW5kZW5jaWVzRW50cnlCFuI/ExIRc3RhdGVEZXBlbmRlb + mNpZXNSEXN0YXRlRGVwZW5kZW5jaWVzGjUKFFByb3BlcnR5RGVwZW5kZW5jaWVzEh0KBHVybnMYASADKAlCCeI/BhIEdXJuc1IEd + XJucxqNAQoWU3RhdGVEZXBlbmRlbmNpZXNFbnRyeRIaCgNrZXkYASABKAlCCOI/BRIDa2V5UgNrZXkSUwoFdmFsdWUYAiABKAsyM + S5wdWx1bWlycGMuQ29uc3RydWN0UmVzcG9uc2UuUHJvcGVydHlEZXBlbmRlbmNpZXNCCuI/BxIFdmFsdWVSBXZhbHVlOgI4ASLiA + QoXRXJyb3JSZXNvdXJjZUluaXRGYWlsZWQSFwoCaWQYASABKAlCB+I/BBICaWRSAmlkEkgKCnByb3BlcnRpZXMYAiABKAsyFy5nb + 29nbGUucHJvdG9idWYuU3RydWN0Qg/iPwwSCnByb3BlcnRpZXNSCnByb3BlcnRpZXMSJgoHcmVhc29ucxgDIAMoCUIM4j8JEgdyZ + WFzb25zUgdyZWFzb25zEjwKBmlucHV0cxgEIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCC+I/CBIGaW5wdXRzUgZpbnB1d + HMiWgoRR2V0TWFwcGluZ1JlcXVlc3QSGgoDa2V5GAEgASgJQgjiPwUSA2tleVIDa2V5EikKCHByb3ZpZGVyGAIgASgJQg3iPwoSC + HByb3ZpZGVyUghwcm92aWRlciJeChJHZXRNYXBwaW5nUmVzcG9uc2USKQoIcHJvdmlkZXIYASABKAlCDeI/ChIIcHJvdmlkZXJSC + HByb3ZpZGVyEh0KBGRhdGEYAiABKAxCCeI/BhIEZGF0YVIEZGF0YSIwChJHZXRNYXBwaW5nc1JlcXVlc3QSGgoDa2V5GAEgASgJQ + gjiPwUSA2tleVIDa2V5IkMKE0dldE1hcHBpbmdzUmVzcG9uc2USLAoJcHJvdmlkZXJzGAEgAygJQg7iPwsSCXByb3ZpZGVyc1IJc + HJvdmlkZXJzMoYKChBSZXNvdXJjZVByb3ZpZGVyEkgKCUdldFNjaGVtYRIbLnB1bHVtaXJwYy5HZXRTY2hlbWFSZXF1ZXN0Ghwuc + HVsdW1pcnBjLkdldFNjaGVtYVJlc3BvbnNlIgASQgoLQ2hlY2tDb25maWcSFy5wdWx1bWlycGMuQ2hlY2tSZXF1ZXN0GhgucHVsd + W1pcnBjLkNoZWNrUmVzcG9uc2UiABI/CgpEaWZmQ29uZmlnEhYucHVsdW1pcnBjLkRpZmZSZXF1ZXN0GhcucHVsdW1pcnBjLkRpZ + mZSZXNwb25zZSIAEkgKCUNvbmZpZ3VyZRIbLnB1bHVtaXJwYy5Db25maWd1cmVSZXF1ZXN0GhwucHVsdW1pcnBjLkNvbmZpZ3VyZ + VJlc3BvbnNlIgASPwoGSW52b2tlEhgucHVsdW1pcnBjLkludm9rZVJlcXVlc3QaGS5wdWx1bWlycGMuSW52b2tlUmVzcG9uc2UiA + BJHCgxTdHJlYW1JbnZva2USGC5wdWx1bWlycGMuSW52b2tlUmVxdWVzdBoZLnB1bHVtaXJwYy5JbnZva2VSZXNwb25zZSIAMAESO + QoEQ2FsbBIWLnB1bHVtaXJwYy5DYWxsUmVxdWVzdBoXLnB1bHVtaXJwYy5DYWxsUmVzcG9uc2UiABI8CgVDaGVjaxIXLnB1bHVta + XJwYy5DaGVja1JlcXVlc3QaGC5wdWx1bWlycGMuQ2hlY2tSZXNwb25zZSIAEjkKBERpZmYSFi5wdWx1bWlycGMuRGlmZlJlcXVlc + 3QaFy5wdWx1bWlycGMuRGlmZlJlc3BvbnNlIgASPwoGQ3JlYXRlEhgucHVsdW1pcnBjLkNyZWF0ZVJlcXVlc3QaGS5wdWx1bWlyc + GMuQ3JlYXRlUmVzcG9uc2UiABI5CgRSZWFkEhYucHVsdW1pcnBjLlJlYWRSZXF1ZXN0GhcucHVsdW1pcnBjLlJlYWRSZXNwb25zZ + SIAEj8KBlVwZGF0ZRIYLnB1bHVtaXJwYy5VcGRhdGVSZXF1ZXN0GhkucHVsdW1pcnBjLlVwZGF0ZVJlc3BvbnNlIgASPAoGRGVsZ + XRlEhgucHVsdW1pcnBjLkRlbGV0ZVJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABJICglDb25zdHJ1Y3QSGy5wdWx1b + WlycGMuQ29uc3RydWN0UmVxdWVzdBocLnB1bHVtaXJwYy5Db25zdHJ1Y3RSZXNwb25zZSIAEjoKBkNhbmNlbBIWLmdvb2dsZS5wc + m90b2J1Zi5FbXB0eRoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIAEkAKDUdldFBsdWdpbkluZm8SFi5nb29nbGUucHJvdG9idWYuR + W1wdHkaFS5wdWx1bWlycGMuUGx1Z2luSW5mbyIAEjsKBkF0dGFjaBIXLnB1bHVtaXJwYy5QbHVnaW5BdHRhY2gaFi5nb29nbGUuc + HJvdG9idWYuRW1wdHkiABJLCgpHZXRNYXBwaW5nEhwucHVsdW1pcnBjLkdldE1hcHBpbmdSZXF1ZXN0Gh0ucHVsdW1pcnBjLkdld + E1hcHBpbmdSZXNwb25zZSIAEk4KC0dldE1hcHBpbmdzEh0ucHVsdW1pcnBjLkdldE1hcHBpbmdzUmVxdWVzdBoeLnB1bHVtaXJwY + y5HZXRNYXBwaW5nc1Jlc3BvbnNlIgBCNFoyZ2l0aHViLmNvbS9wdWx1bWkvcHVsdW1pL3Nkay92My9wcm90by9nbztwdWx1bWlyc + GNiBnByb3RvMw==""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) @@ -201,8 +198,7 @@ object ProviderProto extends _root_.scalapb.GeneratedFileObject { com.google.protobuf.Descriptors.FileDescriptor.buildFrom(javaProto, _root_.scala.Array( pulumirpc.plugin.PluginProto.javaDescriptor, com.google.protobuf.empty.EmptyProto.javaDescriptor, - com.google.protobuf.struct.StructProto.javaDescriptor, - pulumirpc.source.SourceProto.javaDescriptor + com.google.protobuf.struct.StructProto.javaDescriptor )) } @deprecated("Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.", "ScalaPB 0.5.47") diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/ReadRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/ReadRequest.scala index af40f1a6..ead7f9b9 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/ReadRequest.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/ReadRequest.scala @@ -143,9 +143,9 @@ object ReadRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. case 18 => __urn = _input__.readStringRequireUtf8() case 26 => - __properties = Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __properties = _root_.scala.Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 34 => - __inputs = Option(__inputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __inputs = _root_.scala.Option(__inputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -193,9 +193,9 @@ object ReadRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provider. implicit class ReadRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.ReadRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.ReadRequest](_l) { def id: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.id)((c_, f_) => c_.copy(id = f_)) def urn: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.urn)((c_, f_) => c_.copy(urn = f_)) - def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = Option(f_))) + def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = _root_.scala.Option(f_))) def optionalProperties: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.properties)((c_, f_) => c_.copy(properties = f_)) - def inputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getInputs)((c_, f_) => c_.copy(inputs = Option(f_))) + def inputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getInputs)((c_, f_) => c_.copy(inputs = _root_.scala.Option(f_))) def optionalInputs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.inputs)((c_, f_) => c_.copy(inputs = f_)) } final val ID_FIELD_NUMBER = 1 diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/ReadResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/ReadResponse.scala index d0556f28..15e22af8 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/ReadResponse.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/ReadResponse.scala @@ -118,9 +118,9 @@ object ReadResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provider case 10 => __id = _input__.readStringRequireUtf8() case 18 => - __properties = Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __properties = _root_.scala.Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 26 => - __inputs = Option(__inputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __inputs = _root_.scala.Option(__inputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -164,9 +164,9 @@ object ReadResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provider ) implicit class ReadResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.ReadResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.ReadResponse](_l) { def id: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.id)((c_, f_) => c_.copy(id = f_)) - def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = Option(f_))) + def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = _root_.scala.Option(f_))) def optionalProperties: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.properties)((c_, f_) => c_.copy(properties = f_)) - def inputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getInputs)((c_, f_) => c_.copy(inputs = Option(f_))) + def inputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getInputs)((c_, f_) => c_.copy(inputs = _root_.scala.Option(f_))) def optionalInputs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.inputs)((c_, f_) => c_.copy(inputs = f_)) } final val ID_FIELD_NUMBER = 1 diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/UpdateRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/UpdateRequest.scala index 6589f266..8940a14c 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/UpdateRequest.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/UpdateRequest.scala @@ -228,9 +228,9 @@ object UpdateRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provide case 18 => __urn = _input__.readStringRequireUtf8() case 26 => - __olds = Option(__olds.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __olds = _root_.scala.Option(__olds.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 34 => - __news = Option(__news.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __news = _root_.scala.Option(__news.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 41 => __timeout = _input__.readDouble() case 50 => @@ -238,7 +238,7 @@ object UpdateRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provide case 56 => __preview = _input__.readBool() case 66 => - __oldInputs = Option(__oldInputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __oldInputs = _root_.scala.Option(__oldInputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -299,14 +299,14 @@ object UpdateRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.provide implicit class UpdateRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.UpdateRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.UpdateRequest](_l) { def id: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.id)((c_, f_) => c_.copy(id = f_)) def urn: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.urn)((c_, f_) => c_.copy(urn = f_)) - def olds: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getOlds)((c_, f_) => c_.copy(olds = Option(f_))) + def olds: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getOlds)((c_, f_) => c_.copy(olds = _root_.scala.Option(f_))) def optionalOlds: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.olds)((c_, f_) => c_.copy(olds = f_)) - def news: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getNews)((c_, f_) => c_.copy(news = Option(f_))) + def news: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getNews)((c_, f_) => c_.copy(news = _root_.scala.Option(f_))) def optionalNews: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.news)((c_, f_) => c_.copy(news = f_)) def timeout: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Double] = field(_.timeout)((c_, f_) => c_.copy(timeout = f_)) def ignoreChanges: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.ignoreChanges)((c_, f_) => c_.copy(ignoreChanges = f_)) def preview: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.preview)((c_, f_) => c_.copy(preview = f_)) - def oldInputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getOldInputs)((c_, f_) => c_.copy(oldInputs = Option(f_))) + def oldInputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getOldInputs)((c_, f_) => c_.copy(oldInputs = _root_.scala.Option(f_))) def optionalOldInputs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.oldInputs)((c_, f_) => c_.copy(oldInputs = f_)) } final val ID_FIELD_NUMBER = 1 diff --git a/core/src/main/scala/besom/rpc/pulumirpc/provider/UpdateResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/provider/UpdateResponse.scala index 45c0439d..247355cf 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/provider/UpdateResponse.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/provider/UpdateResponse.scala @@ -74,7 +74,7 @@ object UpdateResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provid _tag__ match { case 0 => _done__ = true case 10 => - __properties = Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __properties = _root_.scala.Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -110,7 +110,7 @@ object UpdateResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.provid properties = _root_.scala.None ) implicit class UpdateResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.provider.UpdateResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.provider.UpdateResponse](_l) { - def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = Option(f_))) + def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = _root_.scala.Option(f_))) def optionalProperties: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.properties)((c_, f_) => c_.copy(properties = f_)) } final val PROPERTIES_FIELD_NUMBER = 1 diff --git a/core/src/main/scala/besom/rpc/pulumirpc/resource/ReadResourceRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/resource/ReadResourceRequest.scala index 06d17cc8..77c93c41 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/resource/ReadResourceRequest.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/resource/ReadResourceRequest.scala @@ -366,7 +366,7 @@ object ReadResourceRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.r case 34 => __parent = _input__.readStringRequireUtf8() case 42 => - __properties = Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __properties = _root_.scala.Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 50 => __dependencies += _input__.readStringRequireUtf8() case 58 => @@ -384,7 +384,7 @@ object ReadResourceRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.r case 122 => __pluginChecksums += pulumirpc.resource.ReadResourceRequest._typemapper_pluginChecksums.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.ReadResourceRequest.PluginChecksumsEntry](_input__)) case 114 => - __sourcePosition = Option(__sourcePosition.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.source.SourcePosition](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __sourcePosition = _root_.scala.Option(__sourcePosition.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.source.SourcePosition](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -612,7 +612,7 @@ object ReadResourceRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.r def `type`: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.`type`)((c_, f_) => c_.copy(`type` = f_)) def name: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.name)((c_, f_) => c_.copy(name = f_)) def parent: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.parent)((c_, f_) => c_.copy(parent = f_)) - def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = Option(f_))) + def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = _root_.scala.Option(f_))) def optionalProperties: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.properties)((c_, f_) => c_.copy(properties = f_)) def dependencies: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.dependencies)((c_, f_) => c_.copy(dependencies = f_)) def provider: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.provider)((c_, f_) => c_.copy(provider = f_)) @@ -622,7 +622,7 @@ object ReadResourceRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.r def acceptResources: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.acceptResources)((c_, f_) => c_.copy(acceptResources = f_)) def pluginDownloadURL: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.pluginDownloadURL)((c_, f_) => c_.copy(pluginDownloadURL = f_)) def pluginChecksums: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]] = field(_.pluginChecksums)((c_, f_) => c_.copy(pluginChecksums = f_)) - def sourcePosition: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.source.SourcePosition] = field(_.getSourcePosition)((c_, f_) => c_.copy(sourcePosition = Option(f_))) + def sourcePosition: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.source.SourcePosition] = field(_.getSourcePosition)((c_, f_) => c_.copy(sourcePosition = _root_.scala.Option(f_))) def optionalSourcePosition: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.source.SourcePosition]] = field(_.sourcePosition)((c_, f_) => c_.copy(sourcePosition = f_)) } final val ID_FIELD_NUMBER = 1 diff --git a/core/src/main/scala/besom/rpc/pulumirpc/resource/ReadResourceResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/resource/ReadResourceResponse.scala index 7d31b78f..64dba87d 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/resource/ReadResourceResponse.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/resource/ReadResourceResponse.scala @@ -101,7 +101,7 @@ object ReadResourceResponse extends scalapb.GeneratedMessageCompanion[pulumirpc. case 10 => __urn = _input__.readStringRequireUtf8() case 18 => - __properties = Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __properties = _root_.scala.Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -141,7 +141,7 @@ object ReadResourceResponse extends scalapb.GeneratedMessageCompanion[pulumirpc. ) implicit class ReadResourceResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.ReadResourceResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.resource.ReadResourceResponse](_l) { def urn: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.urn)((c_, f_) => c_.copy(urn = f_)) - def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = Option(f_))) + def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = _root_.scala.Option(f_))) def optionalProperties: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.properties)((c_, f_) => c_.copy(properties = f_)) } final val URN_FIELD_NUMBER = 1 diff --git a/core/src/main/scala/besom/rpc/pulumirpc/resource/RegisterResourceOutputsRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/resource/RegisterResourceOutputsRequest.scala index 8cd6f994..7b24ad0a 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/resource/RegisterResourceOutputsRequest.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/resource/RegisterResourceOutputsRequest.scala @@ -101,7 +101,7 @@ object RegisterResourceOutputsRequest extends scalapb.GeneratedMessageCompanion[ case 10 => __urn = _input__.readStringRequireUtf8() case 18 => - __outputs = Option(__outputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __outputs = _root_.scala.Option(__outputs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -141,7 +141,7 @@ object RegisterResourceOutputsRequest extends scalapb.GeneratedMessageCompanion[ ) implicit class RegisterResourceOutputsRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.RegisterResourceOutputsRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.resource.RegisterResourceOutputsRequest](_l) { def urn: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.urn)((c_, f_) => c_.copy(urn = f_)) - def outputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getOutputs)((c_, f_) => c_.copy(outputs = Option(f_))) + def outputs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getOutputs)((c_, f_) => c_.copy(outputs = _root_.scala.Option(f_))) def optionalOutputs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.outputs)((c_, f_) => c_.copy(outputs = f_)) } final val URN_FIELD_NUMBER = 1 diff --git a/core/src/main/scala/besom/rpc/pulumirpc/resource/RegisterResourceRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/resource/RegisterResourceRequest.scala index 38fd406d..68a70aa9 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/resource/RegisterResourceRequest.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/resource/RegisterResourceRequest.scala @@ -73,6 +73,10 @@ package pulumirpc.resource * true, but it's not necessary. * @param sourcePosition * the optional source position of the user code that initiated the register. + * @param transforms + * a list of transforms to apply to the resource before registering it. + * @param supportsResultReporting + * true if the request is from an SDK that supports the result field in the response. */ @SerialVersionUID(0L) final case class RegisterResourceRequest( @@ -106,6 +110,8 @@ final case class RegisterResourceRequest( deletedWith: _root_.scala.Predef.String = "", aliasSpecs: _root_.scala.Boolean = false, sourcePosition: _root_.scala.Option[pulumirpc.source.SourcePosition] = _root_.scala.None, + transforms: _root_.scala.Seq[pulumirpc.callback.Callback] = _root_.scala.Seq.empty, + supportsResultReporting: _root_.scala.Boolean = false, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[RegisterResourceRequest] { @transient @@ -286,6 +292,17 @@ final case class RegisterResourceRequest( val __value = sourcePosition.get __size += 2 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize }; + transforms.foreach { __item => + val __value = __item + __size += 2 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + + { + val __value = supportsResultReporting + if (__value != false) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(32, __value) + } + }; __size += unknownFields.serializedSize __size } @@ -469,6 +486,18 @@ final case class RegisterResourceRequest( _output__.writeUInt32NoTag(__m.serializedSize) __m.writeTo(_output__) }; + transforms.foreach { __v => + val __m = __v + _output__.writeTag(31, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + { + val __v = supportsResultReporting + if (__v != false) { + _output__.writeBool(32, __v) + } + }; unknownFields.writeTo(_output__) } def withType(__v: _root_.scala.Predef.String): RegisterResourceRequest = copy(`type` = __v) @@ -534,6 +563,11 @@ final case class RegisterResourceRequest( def getSourcePosition: pulumirpc.source.SourcePosition = sourcePosition.getOrElse(pulumirpc.source.SourcePosition.defaultInstance) def clearSourcePosition: RegisterResourceRequest = copy(sourcePosition = _root_.scala.None) def withSourcePosition(__v: pulumirpc.source.SourcePosition): RegisterResourceRequest = copy(sourcePosition = Option(__v)) + def clearTransforms = copy(transforms = _root_.scala.Seq.empty) + def addTransforms(__vs: pulumirpc.callback.Callback *): RegisterResourceRequest = addAllTransforms(__vs) + def addAllTransforms(__vs: Iterable[pulumirpc.callback.Callback]): RegisterResourceRequest = copy(transforms = transforms ++ __vs) + def withTransforms(__v: _root_.scala.Seq[pulumirpc.callback.Callback]): RegisterResourceRequest = copy(transforms = __v) + def withSupportsResultReporting(__v: _root_.scala.Boolean): RegisterResourceRequest = copy(supportsResultReporting = __v) def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { @@ -622,6 +656,11 @@ final case class RegisterResourceRequest( if (__t != false) __t else null } case 29 => sourcePosition.orNull + case 31 => transforms + case 32 => { + val __t = supportsResultReporting + if (__t != false) __t else null + } } } def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { @@ -657,6 +696,8 @@ final case class RegisterResourceRequest( case 27 => _root_.scalapb.descriptors.PString(deletedWith) case 28 => _root_.scalapb.descriptors.PBoolean(aliasSpecs) case 29 => sourcePosition.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 31 => _root_.scalapb.descriptors.PRepeated(transforms.iterator.map(_.toPMessage).toVector) + case 32 => _root_.scalapb.descriptors.PBoolean(supportsResultReporting) } } def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) @@ -697,6 +738,8 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir var __deletedWith: _root_.scala.Predef.String = "" var __aliasSpecs: _root_.scala.Boolean = false var __sourcePosition: _root_.scala.Option[pulumirpc.source.SourcePosition] = _root_.scala.None + val __transforms: _root_.scala.collection.immutable.VectorBuilder[pulumirpc.callback.Callback] = new _root_.scala.collection.immutable.VectorBuilder[pulumirpc.callback.Callback] + var __supportsResultReporting: _root_.scala.Boolean = false var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null var _done__ = false while (!_done__) { @@ -712,7 +755,7 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir case 32 => __custom = _input__.readBool() case 42 => - __object = Option(__object.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __object = _root_.scala.Option(__object.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 48 => __protect = _input__.readBool() case 58 => @@ -736,7 +779,7 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir case 130 => __importId = _input__.readStringRequireUtf8() case 138 => - __customTimeouts = Option(__customTimeouts.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.RegisterResourceRequest.CustomTimeouts](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __customTimeouts = _root_.scala.Option(__customTimeouts.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.RegisterResourceRequest.CustomTimeouts](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 144 => __deleteBeforeReplaceDefined = _input__.readBool() case 152 => @@ -762,7 +805,11 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir case 224 => __aliasSpecs = _input__.readBool() case 234 => - __sourcePosition = Option(__sourcePosition.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.source.SourcePosition](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __sourcePosition = _root_.scala.Option(__sourcePosition.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.source.SourcePosition](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case 250 => + __transforms += _root_.scalapb.LiteParser.readMessage[pulumirpc.callback.Callback](_input__) + case 256 => + __supportsResultReporting = _input__.readBool() case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -801,6 +848,8 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir deletedWith = __deletedWith, aliasSpecs = __aliasSpecs, sourcePosition = __sourcePosition, + transforms = __transforms.result(), + supportsResultReporting = __supportsResultReporting, unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() ) } @@ -837,7 +886,9 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir aliases = __fieldsMap.get(scalaDescriptor.findFieldByNumber(26).get).map(_.as[_root_.scala.Seq[pulumirpc.alias.Alias]]).getOrElse(_root_.scala.Seq.empty), deletedWith = __fieldsMap.get(scalaDescriptor.findFieldByNumber(27).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), aliasSpecs = __fieldsMap.get(scalaDescriptor.findFieldByNumber(28).get).map(_.as[_root_.scala.Boolean]).getOrElse(false), - sourcePosition = __fieldsMap.get(scalaDescriptor.findFieldByNumber(29).get).flatMap(_.as[_root_.scala.Option[pulumirpc.source.SourcePosition]]) + sourcePosition = __fieldsMap.get(scalaDescriptor.findFieldByNumber(29).get).flatMap(_.as[_root_.scala.Option[pulumirpc.source.SourcePosition]]), + transforms = __fieldsMap.get(scalaDescriptor.findFieldByNumber(31).get).map(_.as[_root_.scala.Seq[pulumirpc.callback.Callback]]).getOrElse(_root_.scala.Seq.empty), + supportsResultReporting = __fieldsMap.get(scalaDescriptor.findFieldByNumber(32).get).map(_.as[_root_.scala.Boolean]).getOrElse(false) ) case _ => throw new RuntimeException("Expected PMessage") } @@ -853,6 +904,7 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir case 30 => __out = pulumirpc.resource.RegisterResourceRequest.PluginChecksumsEntry case 26 => __out = pulumirpc.alias.Alias case 29 => __out = pulumirpc.source.SourcePosition + case 31 => __out = pulumirpc.callback.Callback } __out } @@ -895,7 +947,9 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir aliases = _root_.scala.Seq.empty, deletedWith = "", aliasSpecs = false, - sourcePosition = _root_.scala.None + sourcePosition = _root_.scala.None, + transforms = _root_.scala.Seq.empty, + supportsResultReporting = false ) /** PropertyDependencies describes the resources that a particular property depends on. * @@ -1277,7 +1331,7 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir case 10 => __key = _input__.readStringRequireUtf8() case 18 => - __value = Option(__value.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.RegisterResourceRequest.PropertyDependencies](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __value = _root_.scala.Option(__value.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.RegisterResourceRequest.PropertyDependencies](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -1317,7 +1371,7 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir ) implicit class PropertyDependenciesEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.RegisterResourceRequest.PropertyDependenciesEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.resource.RegisterResourceRequest.PropertyDependenciesEntry](_l) { def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) - def value: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.RegisterResourceRequest.PropertyDependencies] = field(_.getValue)((c_, f_) => c_.copy(value = Option(f_))) + def value: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.RegisterResourceRequest.PropertyDependencies] = field(_.getValue)((c_, f_) => c_.copy(value = _root_.scala.Option(f_))) def optionalValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.resource.RegisterResourceRequest.PropertyDependencies]] = field(_.value)((c_, f_) => c_.copy(value = f_)) } final val KEY_FIELD_NUMBER = 1 @@ -1628,7 +1682,7 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir def name: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.name)((c_, f_) => c_.copy(name = f_)) def parent: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.parent)((c_, f_) => c_.copy(parent = f_)) def custom: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.custom)((c_, f_) => c_.copy(custom = f_)) - def `object`: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getObject)((c_, f_) => c_.copy(`object` = Option(f_))) + def `object`: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getObject)((c_, f_) => c_.copy(`object` = _root_.scala.Option(f_))) def optionalObject: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.`object`)((c_, f_) => c_.copy(`object` = f_)) def protect: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.protect)((c_, f_) => c_.copy(protect = f_)) def dependencies: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.dependencies)((c_, f_) => c_.copy(dependencies = f_)) @@ -1641,7 +1695,7 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir def additionalSecretOutputs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.additionalSecretOutputs)((c_, f_) => c_.copy(additionalSecretOutputs = f_)) def aliasURNs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.aliasURNs)((c_, f_) => c_.copy(aliasURNs = f_)) def importId: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.importId)((c_, f_) => c_.copy(importId = f_)) - def customTimeouts: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.RegisterResourceRequest.CustomTimeouts] = field(_.getCustomTimeouts)((c_, f_) => c_.copy(customTimeouts = Option(f_))) + def customTimeouts: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.RegisterResourceRequest.CustomTimeouts] = field(_.getCustomTimeouts)((c_, f_) => c_.copy(customTimeouts = _root_.scala.Option(f_))) def optionalCustomTimeouts: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.resource.RegisterResourceRequest.CustomTimeouts]] = field(_.customTimeouts)((c_, f_) => c_.copy(customTimeouts = f_)) def deleteBeforeReplaceDefined: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.deleteBeforeReplaceDefined)((c_, f_) => c_.copy(deleteBeforeReplaceDefined = f_)) def supportsPartialValues: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.supportsPartialValues)((c_, f_) => c_.copy(supportsPartialValues = f_)) @@ -1655,8 +1709,10 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir def aliases: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[pulumirpc.alias.Alias]] = field(_.aliases)((c_, f_) => c_.copy(aliases = f_)) def deletedWith: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.deletedWith)((c_, f_) => c_.copy(deletedWith = f_)) def aliasSpecs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.aliasSpecs)((c_, f_) => c_.copy(aliasSpecs = f_)) - def sourcePosition: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.source.SourcePosition] = field(_.getSourcePosition)((c_, f_) => c_.copy(sourcePosition = Option(f_))) + def sourcePosition: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.source.SourcePosition] = field(_.getSourcePosition)((c_, f_) => c_.copy(sourcePosition = _root_.scala.Option(f_))) def optionalSourcePosition: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.source.SourcePosition]] = field(_.sourcePosition)((c_, f_) => c_.copy(sourcePosition = f_)) + def transforms: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[pulumirpc.callback.Callback]] = field(_.transforms)((c_, f_) => c_.copy(transforms = f_)) + def supportsResultReporting: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.supportsResultReporting)((c_, f_) => c_.copy(supportsResultReporting = f_)) } final val TYPE_FIELD_NUMBER = 1 final val NAME_FIELD_NUMBER = 2 @@ -1688,6 +1744,8 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir final val DELETEDWITH_FIELD_NUMBER = 27 final val ALIASSPECS_FIELD_NUMBER = 28 final val SOURCEPOSITION_FIELD_NUMBER = 29 + final val TRANSFORMS_FIELD_NUMBER = 31 + final val SUPPORTSRESULTREPORTING_FIELD_NUMBER = 32 @transient private[resource] val _typemapper_propertyDependencies: _root_.scalapb.TypeMapper[pulumirpc.resource.RegisterResourceRequest.PropertyDependenciesEntry, (_root_.scala.Predef.String, pulumirpc.resource.RegisterResourceRequest.PropertyDependencies)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.resource.RegisterResourceRequest.PropertyDependenciesEntry, (_root_.scala.Predef.String, pulumirpc.resource.RegisterResourceRequest.PropertyDependencies)]] @transient @@ -1724,7 +1782,9 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir aliases: _root_.scala.Seq[pulumirpc.alias.Alias], deletedWith: _root_.scala.Predef.String, aliasSpecs: _root_.scala.Boolean, - sourcePosition: _root_.scala.Option[pulumirpc.source.SourcePosition] + sourcePosition: _root_.scala.Option[pulumirpc.source.SourcePosition], + transforms: _root_.scala.Seq[pulumirpc.callback.Callback], + supportsResultReporting: _root_.scala.Boolean ): _root_.pulumirpc.resource.RegisterResourceRequest = _root_.pulumirpc.resource.RegisterResourceRequest( `type`, name, @@ -1755,7 +1815,9 @@ object RegisterResourceRequest extends scalapb.GeneratedMessageCompanion[pulumir aliases, deletedWith, aliasSpecs, - sourcePosition + sourcePosition, + transforms, + supportsResultReporting ) // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.RegisterResourceRequest]) } diff --git a/core/src/main/scala/besom/rpc/pulumirpc/resource/RegisterResourceResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/resource/RegisterResourceResponse.scala index e81ab16d..3c8b164c 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/resource/RegisterResourceResponse.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/resource/RegisterResourceResponse.scala @@ -20,6 +20,8 @@ package pulumirpc.resource * an optional list of guaranteed-stable properties. * @param propertyDependencies * a map from property keys to the dependencies of the property. + * @param result + * the reason, whether the resource registration was successful, failed, or skipped. */ @SerialVersionUID(0L) final case class RegisterResourceResponse( @@ -29,6 +31,7 @@ final case class RegisterResourceResponse( stable: _root_.scala.Boolean = false, stables: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, propertyDependencies: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.resource.RegisterResourceResponse.PropertyDependencies] = _root_.scala.collection.immutable.Map.empty, + result: pulumirpc.resource.Result = pulumirpc.resource.Result.SUCCESS, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[RegisterResourceResponse] { @transient @@ -68,6 +71,13 @@ final case class RegisterResourceResponse( val __value = pulumirpc.resource.RegisterResourceResponse._typemapper_propertyDependencies.toBase(__item) __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize } + + { + val __value = result.value + if (__value != 0) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(7, __value) + } + }; __size += unknownFields.serializedSize __size } @@ -115,6 +125,12 @@ final case class RegisterResourceResponse( _output__.writeUInt32NoTag(__m.serializedSize) __m.writeTo(_output__) }; + { + val __v = result.value + if (__v != 0) { + _output__.writeEnum(7, __v) + } + }; unknownFields.writeTo(_output__) } def withUrn(__v: _root_.scala.Predef.String): RegisterResourceResponse = copy(urn = __v) @@ -131,6 +147,7 @@ final case class RegisterResourceResponse( def addPropertyDependencies(__vs: (_root_.scala.Predef.String, pulumirpc.resource.RegisterResourceResponse.PropertyDependencies) *): RegisterResourceResponse = addAllPropertyDependencies(__vs) def addAllPropertyDependencies(__vs: Iterable[(_root_.scala.Predef.String, pulumirpc.resource.RegisterResourceResponse.PropertyDependencies)]): RegisterResourceResponse = copy(propertyDependencies = propertyDependencies ++ __vs) def withPropertyDependencies(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.resource.RegisterResourceResponse.PropertyDependencies]): RegisterResourceResponse = copy(propertyDependencies = __v) + def withResult(__v: pulumirpc.resource.Result): RegisterResourceResponse = copy(result = __v) def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { @@ -150,6 +167,10 @@ final case class RegisterResourceResponse( } case 5 => stables case 6 => propertyDependencies.iterator.map(pulumirpc.resource.RegisterResourceResponse._typemapper_propertyDependencies.toBase(_)).toSeq + case 7 => { + val __t = result.javaValueDescriptor + if (__t.getNumber() != 0) __t else null + } } } def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { @@ -161,6 +182,7 @@ final case class RegisterResourceResponse( case 4 => _root_.scalapb.descriptors.PBoolean(stable) case 5 => _root_.scalapb.descriptors.PRepeated(stables.iterator.map(_root_.scalapb.descriptors.PString(_)).toVector) case 6 => _root_.scalapb.descriptors.PRepeated(propertyDependencies.iterator.map(pulumirpc.resource.RegisterResourceResponse._typemapper_propertyDependencies.toBase(_).toPMessage).toVector) + case 7 => _root_.scalapb.descriptors.PEnum(result.scalaValueDescriptor) } } def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) @@ -177,6 +199,7 @@ object RegisterResourceResponse extends scalapb.GeneratedMessageCompanion[pulumi var __stable: _root_.scala.Boolean = false val __stables: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] val __propertyDependencies: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, pulumirpc.resource.RegisterResourceResponse.PropertyDependencies), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.resource.RegisterResourceResponse.PropertyDependencies]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, pulumirpc.resource.RegisterResourceResponse.PropertyDependencies] + var __result: pulumirpc.resource.Result = pulumirpc.resource.Result.SUCCESS var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null var _done__ = false while (!_done__) { @@ -188,13 +211,15 @@ object RegisterResourceResponse extends scalapb.GeneratedMessageCompanion[pulumi case 18 => __id = _input__.readStringRequireUtf8() case 26 => - __object = Option(__object.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __object = _root_.scala.Option(__object.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 32 => __stable = _input__.readBool() case 42 => __stables += _input__.readStringRequireUtf8() case 50 => __propertyDependencies += pulumirpc.resource.RegisterResourceResponse._typemapper_propertyDependencies.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.RegisterResourceResponse.PropertyDependenciesEntry](_input__)) + case 56 => + __result = pulumirpc.resource.Result.fromValue(_input__.readEnum()) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -209,6 +234,7 @@ object RegisterResourceResponse extends scalapb.GeneratedMessageCompanion[pulumi stable = __stable, stables = __stables.result(), propertyDependencies = __propertyDependencies.result(), + result = __result, unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() ) } @@ -221,7 +247,8 @@ object RegisterResourceResponse extends scalapb.GeneratedMessageCompanion[pulumi `object` = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.struct.Struct]]), stable = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Boolean]).getOrElse(false), stables = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Seq[_root_.scala.Predef.String]]).getOrElse(_root_.scala.Seq.empty), - propertyDependencies = __fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scala.Seq[pulumirpc.resource.RegisterResourceResponse.PropertyDependenciesEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.resource.RegisterResourceResponse._typemapper_propertyDependencies.toCustom(_)).toMap + propertyDependencies = __fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scala.Seq[pulumirpc.resource.RegisterResourceResponse.PropertyDependenciesEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.resource.RegisterResourceResponse._typemapper_propertyDependencies.toCustom(_)).toMap, + result = pulumirpc.resource.Result.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(7).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(pulumirpc.resource.Result.SUCCESS.scalaValueDescriptor).number) ) case _ => throw new RuntimeException("Expected PMessage") } @@ -240,14 +267,19 @@ object RegisterResourceResponse extends scalapb.GeneratedMessageCompanion[pulumi _root_.pulumirpc.resource.RegisterResourceResponse.PropertyDependencies, _root_.pulumirpc.resource.RegisterResourceResponse.PropertyDependenciesEntry ) - def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 7 => pulumirpc.resource.Result + } + } lazy val defaultInstance = pulumirpc.resource.RegisterResourceResponse( urn = "", id = "", `object` = _root_.scala.None, stable = false, stables = _root_.scala.Seq.empty, - propertyDependencies = _root_.scala.collection.immutable.Map.empty + propertyDependencies = _root_.scala.collection.immutable.Map.empty, + result = pulumirpc.resource.Result.SUCCESS ) /** PropertyDependencies describes the resources that a particular property depends on. * @@ -449,7 +481,7 @@ object RegisterResourceResponse extends scalapb.GeneratedMessageCompanion[pulumi case 10 => __key = _input__.readStringRequireUtf8() case 18 => - __value = Option(__value.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.RegisterResourceResponse.PropertyDependencies](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __value = _root_.scala.Option(__value.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.RegisterResourceResponse.PropertyDependencies](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -489,7 +521,7 @@ object RegisterResourceResponse extends scalapb.GeneratedMessageCompanion[pulumi ) implicit class PropertyDependenciesEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.RegisterResourceResponse.PropertyDependenciesEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.resource.RegisterResourceResponse.PropertyDependenciesEntry](_l) { def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) - def value: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.RegisterResourceResponse.PropertyDependencies] = field(_.getValue)((c_, f_) => c_.copy(value = Option(f_))) + def value: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.RegisterResourceResponse.PropertyDependencies] = field(_.getValue)((c_, f_) => c_.copy(value = _root_.scala.Option(f_))) def optionalValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.resource.RegisterResourceResponse.PropertyDependencies]] = field(_.value)((c_, f_) => c_.copy(value = f_)) } final val KEY_FIELD_NUMBER = 1 @@ -510,11 +542,12 @@ object RegisterResourceResponse extends scalapb.GeneratedMessageCompanion[pulumi implicit class RegisterResourceResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.RegisterResourceResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.resource.RegisterResourceResponse](_l) { def urn: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.urn)((c_, f_) => c_.copy(urn = f_)) def id: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.id)((c_, f_) => c_.copy(id = f_)) - def `object`: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getObject)((c_, f_) => c_.copy(`object` = Option(f_))) + def `object`: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getObject)((c_, f_) => c_.copy(`object` = _root_.scala.Option(f_))) def optionalObject: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.`object`)((c_, f_) => c_.copy(`object` = f_)) def stable: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.stable)((c_, f_) => c_.copy(stable = f_)) def stables: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.stables)((c_, f_) => c_.copy(stables = f_)) def propertyDependencies: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.resource.RegisterResourceResponse.PropertyDependencies]] = field(_.propertyDependencies)((c_, f_) => c_.copy(propertyDependencies = f_)) + def result: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.Result] = field(_.result)((c_, f_) => c_.copy(result = f_)) } final val URN_FIELD_NUMBER = 1 final val ID_FIELD_NUMBER = 2 @@ -522,6 +555,7 @@ object RegisterResourceResponse extends scalapb.GeneratedMessageCompanion[pulumi final val STABLE_FIELD_NUMBER = 4 final val STABLES_FIELD_NUMBER = 5 final val PROPERTYDEPENDENCIES_FIELD_NUMBER = 6 + final val RESULT_FIELD_NUMBER = 7 @transient private[resource] val _typemapper_propertyDependencies: _root_.scalapb.TypeMapper[pulumirpc.resource.RegisterResourceResponse.PropertyDependenciesEntry, (_root_.scala.Predef.String, pulumirpc.resource.RegisterResourceResponse.PropertyDependencies)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.resource.RegisterResourceResponse.PropertyDependenciesEntry, (_root_.scala.Predef.String, pulumirpc.resource.RegisterResourceResponse.PropertyDependencies)]] def of( @@ -530,14 +564,16 @@ object RegisterResourceResponse extends scalapb.GeneratedMessageCompanion[pulumi `object`: _root_.scala.Option[com.google.protobuf.struct.Struct], stable: _root_.scala.Boolean, stables: _root_.scala.Seq[_root_.scala.Predef.String], - propertyDependencies: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.resource.RegisterResourceResponse.PropertyDependencies] + propertyDependencies: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.resource.RegisterResourceResponse.PropertyDependencies], + result: pulumirpc.resource.Result ): _root_.pulumirpc.resource.RegisterResourceResponse = _root_.pulumirpc.resource.RegisterResourceResponse( urn, id, `object`, stable, stables, - propertyDependencies + propertyDependencies, + result ) // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.RegisterResourceResponse]) } diff --git a/core/src/main/scala/besom/rpc/pulumirpc/resource/ResourceCallRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/resource/ResourceCallRequest.scala new file mode 100644 index 00000000..6f077756 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/resource/ResourceCallRequest.scala @@ -0,0 +1,752 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.resource + +/** @param tok + * the function token to invoke. + * @param args + * the arguments for the function invocation. + * @param argDependencies + * a map from argument keys to the dependencies of the argument. + * @param provider + * an optional reference to the provider to use for this invoke. + * @param version + * the version of the provider to use when servicing this request. + * @param pluginDownloadURL + * the pluginDownloadURL of the provider to use when servicing this request. + * @param pluginChecksums + * a map of checksums of the provider to use when servicing this request. + * @param sourcePosition + * the optional source position of the user code that initiated the call. + */ +@SerialVersionUID(0L) +final case class ResourceCallRequest( + tok: _root_.scala.Predef.String = "", + args: _root_.scala.Option[com.google.protobuf.struct.Struct] = _root_.scala.None, + argDependencies: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies] = _root_.scala.collection.immutable.Map.empty, + provider: _root_.scala.Predef.String = "", + version: _root_.scala.Predef.String = "", + pluginDownloadURL: _root_.scala.Predef.String = "", + pluginChecksums: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString] = _root_.scala.collection.immutable.Map.empty, + sourcePosition: _root_.scala.Option[pulumirpc.source.SourcePosition] = _root_.scala.None, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ResourceCallRequest] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = tok + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + if (args.isDefined) { + val __value = args.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + argDependencies.foreach { __item => + val __value = pulumirpc.resource.ResourceCallRequest._typemapper_argDependencies.toBase(__item) + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + + { + val __value = provider + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(4, __value) + } + }; + + { + val __value = version + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(5, __value) + } + }; + + { + val __value = pluginDownloadURL + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(13, __value) + } + }; + pluginChecksums.foreach { __item => + val __value = pulumirpc.resource.ResourceCallRequest._typemapper_pluginChecksums.toBase(__item) + __size += 2 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + if (sourcePosition.isDefined) { + val __value = sourcePosition.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = tok + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + args.foreach { __v => + val __m = __v + _output__.writeTag(2, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + argDependencies.foreach { __v => + val __m = pulumirpc.resource.ResourceCallRequest._typemapper_argDependencies.toBase(__v) + _output__.writeTag(3, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + { + val __v = provider + if (!__v.isEmpty) { + _output__.writeString(4, __v) + } + }; + { + val __v = version + if (!__v.isEmpty) { + _output__.writeString(5, __v) + } + }; + { + val __v = pluginDownloadURL + if (!__v.isEmpty) { + _output__.writeString(13, __v) + } + }; + sourcePosition.foreach { __v => + val __m = __v + _output__.writeTag(15, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + pluginChecksums.foreach { __v => + val __m = pulumirpc.resource.ResourceCallRequest._typemapper_pluginChecksums.toBase(__v) + _output__.writeTag(16, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def withTok(__v: _root_.scala.Predef.String): ResourceCallRequest = copy(tok = __v) + def getArgs: com.google.protobuf.struct.Struct = args.getOrElse(com.google.protobuf.struct.Struct.defaultInstance) + def clearArgs: ResourceCallRequest = copy(args = _root_.scala.None) + def withArgs(__v: com.google.protobuf.struct.Struct): ResourceCallRequest = copy(args = Option(__v)) + def clearArgDependencies = copy(argDependencies = _root_.scala.collection.immutable.Map.empty) + def addArgDependencies(__vs: (_root_.scala.Predef.String, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies) *): ResourceCallRequest = addAllArgDependencies(__vs) + def addAllArgDependencies(__vs: Iterable[(_root_.scala.Predef.String, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies)]): ResourceCallRequest = copy(argDependencies = argDependencies ++ __vs) + def withArgDependencies(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies]): ResourceCallRequest = copy(argDependencies = __v) + def withProvider(__v: _root_.scala.Predef.String): ResourceCallRequest = copy(provider = __v) + def withVersion(__v: _root_.scala.Predef.String): ResourceCallRequest = copy(version = __v) + def withPluginDownloadURL(__v: _root_.scala.Predef.String): ResourceCallRequest = copy(pluginDownloadURL = __v) + def clearPluginChecksums = copy(pluginChecksums = _root_.scala.collection.immutable.Map.empty) + def addPluginChecksums(__vs: (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString) *): ResourceCallRequest = addAllPluginChecksums(__vs) + def addAllPluginChecksums(__vs: Iterable[(_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)]): ResourceCallRequest = copy(pluginChecksums = pluginChecksums ++ __vs) + def withPluginChecksums(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]): ResourceCallRequest = copy(pluginChecksums = __v) + def getSourcePosition: pulumirpc.source.SourcePosition = sourcePosition.getOrElse(pulumirpc.source.SourcePosition.defaultInstance) + def clearSourcePosition: ResourceCallRequest = copy(sourcePosition = _root_.scala.None) + def withSourcePosition(__v: pulumirpc.source.SourcePosition): ResourceCallRequest = copy(sourcePosition = Option(__v)) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = tok + if (__t != "") __t else null + } + case 2 => args.orNull + case 3 => argDependencies.iterator.map(pulumirpc.resource.ResourceCallRequest._typemapper_argDependencies.toBase(_)).toSeq + case 4 => { + val __t = provider + if (__t != "") __t else null + } + case 5 => { + val __t = version + if (__t != "") __t else null + } + case 13 => { + val __t = pluginDownloadURL + if (__t != "") __t else null + } + case 16 => pluginChecksums.iterator.map(pulumirpc.resource.ResourceCallRequest._typemapper_pluginChecksums.toBase(_)).toSeq + case 15 => sourcePosition.orNull + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(tok) + case 2 => args.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 3 => _root_.scalapb.descriptors.PRepeated(argDependencies.iterator.map(pulumirpc.resource.ResourceCallRequest._typemapper_argDependencies.toBase(_).toPMessage).toVector) + case 4 => _root_.scalapb.descriptors.PString(provider) + case 5 => _root_.scalapb.descriptors.PString(version) + case 13 => _root_.scalapb.descriptors.PString(pluginDownloadURL) + case 16 => _root_.scalapb.descriptors.PRepeated(pluginChecksums.iterator.map(pulumirpc.resource.ResourceCallRequest._typemapper_pluginChecksums.toBase(_).toPMessage).toVector) + case 15 => sourcePosition.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.resource.ResourceCallRequest.type = pulumirpc.resource.ResourceCallRequest + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.ResourceCallRequest]) +} + +object ResourceCallRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.resource.ResourceCallRequest] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.resource.ResourceCallRequest] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.resource.ResourceCallRequest = { + var __tok: _root_.scala.Predef.String = "" + var __args: _root_.scala.Option[com.google.protobuf.struct.Struct] = _root_.scala.None + val __argDependencies: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies] + var __provider: _root_.scala.Predef.String = "" + var __version: _root_.scala.Predef.String = "" + var __pluginDownloadURL: _root_.scala.Predef.String = "" + val __pluginChecksums: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString] + var __sourcePosition: _root_.scala.Option[pulumirpc.source.SourcePosition] = _root_.scala.None + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __tok = _input__.readStringRequireUtf8() + case 18 => + __args = _root_.scala.Option(__args.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case 26 => + __argDependencies += pulumirpc.resource.ResourceCallRequest._typemapper_argDependencies.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry](_input__)) + case 34 => + __provider = _input__.readStringRequireUtf8() + case 42 => + __version = _input__.readStringRequireUtf8() + case 106 => + __pluginDownloadURL = _input__.readStringRequireUtf8() + case 130 => + __pluginChecksums += pulumirpc.resource.ResourceCallRequest._typemapper_pluginChecksums.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry](_input__)) + case 122 => + __sourcePosition = _root_.scala.Option(__sourcePosition.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.source.SourcePosition](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.resource.ResourceCallRequest( + tok = __tok, + args = __args, + argDependencies = __argDependencies.result(), + provider = __provider, + version = __version, + pluginDownloadURL = __pluginDownloadURL, + pluginChecksums = __pluginChecksums.result(), + sourcePosition = __sourcePosition, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.resource.ResourceCallRequest] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.resource.ResourceCallRequest( + tok = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + args = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.struct.Struct]]), + argDependencies = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Seq[pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.resource.ResourceCallRequest._typemapper_argDependencies.toCustom(_)).toMap, + provider = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + version = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + pluginDownloadURL = __fieldsMap.get(scalaDescriptor.findFieldByNumber(13).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + pluginChecksums = __fieldsMap.get(scalaDescriptor.findFieldByNumber(16).get).map(_.as[_root_.scala.Seq[pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.resource.ResourceCallRequest._typemapper_pluginChecksums.toCustom(_)).toMap, + sourcePosition = __fieldsMap.get(scalaDescriptor.findFieldByNumber(15).get).flatMap(_.as[_root_.scala.Option[pulumirpc.source.SourcePosition]]) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ResourceProto.javaDescriptor.getMessageTypes().get(8) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ResourceProto.scalaDescriptor.messages(8) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 2 => __out = com.google.protobuf.struct.Struct + case 3 => __out = pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry + case 16 => __out = pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry + case 15 => __out = pulumirpc.source.SourcePosition + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( + _root_.pulumirpc.resource.ResourceCallRequest.ArgumentDependencies, + _root_.pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry, + _root_.pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry + ) + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.resource.ResourceCallRequest( + tok = "", + args = _root_.scala.None, + argDependencies = _root_.scala.collection.immutable.Map.empty, + provider = "", + version = "", + pluginDownloadURL = "", + pluginChecksums = _root_.scala.collection.immutable.Map.empty, + sourcePosition = _root_.scala.None + ) + /** ArgumentDependencies describes the resources that a particular argument depends on. + * + * @param urns + * A list of URNs this argument depends on. + */ + @SerialVersionUID(0L) + final case class ArgumentDependencies( + urns: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ArgumentDependencies] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + urns.foreach { __item => + val __value = __item + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + urns.foreach { __v => + val __m = __v + _output__.writeString(1, __m) + }; + unknownFields.writeTo(_output__) + } + def clearUrns = copy(urns = _root_.scala.Seq.empty) + def addUrns(__vs: _root_.scala.Predef.String *): ArgumentDependencies = addAllUrns(__vs) + def addAllUrns(__vs: Iterable[_root_.scala.Predef.String]): ArgumentDependencies = copy(urns = urns ++ __vs) + def withUrns(__v: _root_.scala.Seq[_root_.scala.Predef.String]): ArgumentDependencies = copy(urns = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => urns + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PRepeated(urns.iterator.map(_root_.scalapb.descriptors.PString(_)).toVector) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.resource.ResourceCallRequest.ArgumentDependencies.type = pulumirpc.resource.ResourceCallRequest.ArgumentDependencies + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.ResourceCallRequest.ArgumentDependencies]) + } + + object ArgumentDependencies extends scalapb.GeneratedMessageCompanion[pulumirpc.resource.ResourceCallRequest.ArgumentDependencies] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.resource.ResourceCallRequest.ArgumentDependencies] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.resource.ResourceCallRequest.ArgumentDependencies = { + val __urns: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __urns += _input__.readStringRequireUtf8() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.resource.ResourceCallRequest.ArgumentDependencies( + urns = __urns.result(), + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.resource.ResourceCallRequest.ArgumentDependencies] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.resource.ResourceCallRequest.ArgumentDependencies( + urns = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[_root_.scala.Predef.String]]).getOrElse(_root_.scala.Seq.empty) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = pulumirpc.resource.ResourceCallRequest.javaDescriptor.getNestedTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = pulumirpc.resource.ResourceCallRequest.scalaDescriptor.nestedMessages(0) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.resource.ResourceCallRequest.ArgumentDependencies( + urns = _root_.scala.Seq.empty + ) + implicit class ArgumentDependenciesLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies](_l) { + def urns: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.urns)((c_, f_) => c_.copy(urns = f_)) + } + final val URNS_FIELD_NUMBER = 1 + def of( + urns: _root_.scala.Seq[_root_.scala.Predef.String] + ): _root_.pulumirpc.resource.ResourceCallRequest.ArgumentDependencies = _root_.pulumirpc.resource.ResourceCallRequest.ArgumentDependencies( + urns + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.ResourceCallRequest.ArgumentDependencies]) + } + + @SerialVersionUID(0L) + final case class ArgDependenciesEntry( + key: _root_.scala.Predef.String = "", + value: _root_.scala.Option[pulumirpc.resource.ResourceCallRequest.ArgumentDependencies] = _root_.scala.None, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ArgDependenciesEntry] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = key + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + if (value.isDefined) { + val __value = value.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = key + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + value.foreach { __v => + val __m = __v + _output__.writeTag(2, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def withKey(__v: _root_.scala.Predef.String): ArgDependenciesEntry = copy(key = __v) + def getValue: pulumirpc.resource.ResourceCallRequest.ArgumentDependencies = value.getOrElse(pulumirpc.resource.ResourceCallRequest.ArgumentDependencies.defaultInstance) + def clearValue: ArgDependenciesEntry = copy(value = _root_.scala.None) + def withValue(__v: pulumirpc.resource.ResourceCallRequest.ArgumentDependencies): ArgDependenciesEntry = copy(value = Option(__v)) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = key + if (__t != "") __t else null + } + case 2 => value.orNull + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(key) + case 2 => value.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry.type = pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.ResourceCallRequest.ArgDependenciesEntry]) + } + + object ArgDependenciesEntry extends scalapb.GeneratedMessageCompanion[pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry = { + var __key: _root_.scala.Predef.String = "" + var __value: _root_.scala.Option[pulumirpc.resource.ResourceCallRequest.ArgumentDependencies] = _root_.scala.None + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __key = _input__.readStringRequireUtf8() + case 18 => + __value = _root_.scala.Option(__value.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.ResourceCallRequest.ArgumentDependencies](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry( + key = __key, + value = __value, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry( + key = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[pulumirpc.resource.ResourceCallRequest.ArgumentDependencies]]) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = pulumirpc.resource.ResourceCallRequest.javaDescriptor.getNestedTypes().get(1) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = pulumirpc.resource.ResourceCallRequest.scalaDescriptor.nestedMessages(1) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 2 => __out = pulumirpc.resource.ResourceCallRequest.ArgumentDependencies + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry( + key = "", + value = _root_.scala.None + ) + implicit class ArgDependenciesEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry](_l) { + def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) + def value: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies] = field(_.getValue)((c_, f_) => c_.copy(value = _root_.scala.Option(f_))) + def optionalValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.resource.ResourceCallRequest.ArgumentDependencies]] = field(_.value)((c_, f_) => c_.copy(value = f_)) + } + final val KEY_FIELD_NUMBER = 1 + final val VALUE_FIELD_NUMBER = 2 + @transient + implicit val keyValueMapper: _root_.scalapb.TypeMapper[pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry, (_root_.scala.Predef.String, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies)] = + _root_.scalapb.TypeMapper[pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry, (_root_.scala.Predef.String, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies)](__m => (__m.key, __m.getValue))(__p => pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry(__p._1, Some(__p._2))) + def of( + key: _root_.scala.Predef.String, + value: _root_.scala.Option[pulumirpc.resource.ResourceCallRequest.ArgumentDependencies] + ): _root_.pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry = _root_.pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry( + key, + value + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.ResourceCallRequest.ArgDependenciesEntry]) + } + + @SerialVersionUID(0L) + final case class PluginChecksumsEntry( + key: _root_.scala.Predef.String = "", + value: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[PluginChecksumsEntry] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = key + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = value + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = key + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = value + if (!__v.isEmpty) { + _output__.writeBytes(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withKey(__v: _root_.scala.Predef.String): PluginChecksumsEntry = copy(key = __v) + def withValue(__v: _root_.com.google.protobuf.ByteString): PluginChecksumsEntry = copy(value = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = key + if (__t != "") __t else null + } + case 2 => { + val __t = value + if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(key) + case 2 => _root_.scalapb.descriptors.PByteString(value) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry.type = pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.ResourceCallRequest.PluginChecksumsEntry]) + } + + object PluginChecksumsEntry extends scalapb.GeneratedMessageCompanion[pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry = { + var __key: _root_.scala.Predef.String = "" + var __value: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __key = _input__.readStringRequireUtf8() + case 18 => + __value = _input__.readBytes() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry( + key = __key, + value = __value, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry( + key = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = pulumirpc.resource.ResourceCallRequest.javaDescriptor.getNestedTypes().get(2) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = pulumirpc.resource.ResourceCallRequest.scalaDescriptor.nestedMessages(2) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry( + key = "", + value = _root_.com.google.protobuf.ByteString.EMPTY + ) + implicit class PluginChecksumsEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry](_l) { + def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) + def value: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.value)((c_, f_) => c_.copy(value = f_)) + } + final val KEY_FIELD_NUMBER = 1 + final val VALUE_FIELD_NUMBER = 2 + @transient + implicit val keyValueMapper: _root_.scalapb.TypeMapper[pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)] = + _root_.scalapb.TypeMapper[pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)](__m => (__m.key, __m.value))(__p => pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry(__p._1, __p._2)) + def of( + key: _root_.scala.Predef.String, + value: _root_.com.google.protobuf.ByteString + ): _root_.pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry = _root_.pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry( + key, + value + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.ResourceCallRequest.PluginChecksumsEntry]) + } + + implicit class ResourceCallRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.ResourceCallRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.resource.ResourceCallRequest](_l) { + def tok: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.tok)((c_, f_) => c_.copy(tok = f_)) + def args: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getArgs)((c_, f_) => c_.copy(args = _root_.scala.Option(f_))) + def optionalArgs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.args)((c_, f_) => c_.copy(args = f_)) + def argDependencies: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies]] = field(_.argDependencies)((c_, f_) => c_.copy(argDependencies = f_)) + def provider: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.provider)((c_, f_) => c_.copy(provider = f_)) + def version: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.version)((c_, f_) => c_.copy(version = f_)) + def pluginDownloadURL: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.pluginDownloadURL)((c_, f_) => c_.copy(pluginDownloadURL = f_)) + def pluginChecksums: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]] = field(_.pluginChecksums)((c_, f_) => c_.copy(pluginChecksums = f_)) + def sourcePosition: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.source.SourcePosition] = field(_.getSourcePosition)((c_, f_) => c_.copy(sourcePosition = _root_.scala.Option(f_))) + def optionalSourcePosition: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.source.SourcePosition]] = field(_.sourcePosition)((c_, f_) => c_.copy(sourcePosition = f_)) + } + final val TOK_FIELD_NUMBER = 1 + final val ARGS_FIELD_NUMBER = 2 + final val ARGDEPENDENCIES_FIELD_NUMBER = 3 + final val PROVIDER_FIELD_NUMBER = 4 + final val VERSION_FIELD_NUMBER = 5 + final val PLUGINDOWNLOADURL_FIELD_NUMBER = 13 + final val PLUGINCHECKSUMS_FIELD_NUMBER = 16 + final val SOURCEPOSITION_FIELD_NUMBER = 15 + @transient + private[resource] val _typemapper_argDependencies: _root_.scalapb.TypeMapper[pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry, (_root_.scala.Predef.String, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.resource.ResourceCallRequest.ArgDependenciesEntry, (_root_.scala.Predef.String, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies)]] + @transient + private[resource] val _typemapper_pluginChecksums: _root_.scalapb.TypeMapper[pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.resource.ResourceCallRequest.PluginChecksumsEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)]] + def of( + tok: _root_.scala.Predef.String, + args: _root_.scala.Option[com.google.protobuf.struct.Struct], + argDependencies: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, pulumirpc.resource.ResourceCallRequest.ArgumentDependencies], + provider: _root_.scala.Predef.String, + version: _root_.scala.Predef.String, + pluginDownloadURL: _root_.scala.Predef.String, + pluginChecksums: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString], + sourcePosition: _root_.scala.Option[pulumirpc.source.SourcePosition] + ): _root_.pulumirpc.resource.ResourceCallRequest = _root_.pulumirpc.resource.ResourceCallRequest( + tok, + args, + argDependencies, + provider, + version, + pluginDownloadURL, + pluginChecksums, + sourcePosition + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.ResourceCallRequest]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/resource/ResourceInvokeRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/resource/ResourceInvokeRequest.scala index dfb44a47..65690e30 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/resource/ResourceInvokeRequest.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/resource/ResourceInvokeRequest.scala @@ -230,7 +230,7 @@ object ResourceInvokeRequest extends scalapb.GeneratedMessageCompanion[pulumirpc case 10 => __tok = _input__.readStringRequireUtf8() case 18 => - __args = Option(__args.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __args = _root_.scala.Option(__args.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case 26 => __provider = _input__.readStringRequireUtf8() case 34 => @@ -242,7 +242,7 @@ object ResourceInvokeRequest extends scalapb.GeneratedMessageCompanion[pulumirpc case 66 => __pluginChecksums += pulumirpc.resource.ResourceInvokeRequest._typemapper_pluginChecksums.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.ResourceInvokeRequest.PluginChecksumsEntry](_input__)) case 58 => - __sourcePosition = Option(__sourcePosition.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.source.SourcePosition](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __sourcePosition = _root_.scala.Option(__sourcePosition.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.source.SourcePosition](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -449,14 +449,14 @@ object ResourceInvokeRequest extends scalapb.GeneratedMessageCompanion[pulumirpc implicit class ResourceInvokeRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.ResourceInvokeRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.resource.ResourceInvokeRequest](_l) { def tok: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.tok)((c_, f_) => c_.copy(tok = f_)) - def args: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getArgs)((c_, f_) => c_.copy(args = Option(f_))) + def args: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getArgs)((c_, f_) => c_.copy(args = _root_.scala.Option(f_))) def optionalArgs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.args)((c_, f_) => c_.copy(args = f_)) def provider: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.provider)((c_, f_) => c_.copy(provider = f_)) def version: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.version)((c_, f_) => c_.copy(version = f_)) def acceptResources: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.acceptResources)((c_, f_) => c_.copy(acceptResources = f_)) def pluginDownloadURL: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.pluginDownloadURL)((c_, f_) => c_.copy(pluginDownloadURL = f_)) def pluginChecksums: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]] = field(_.pluginChecksums)((c_, f_) => c_.copy(pluginChecksums = f_)) - def sourcePosition: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.source.SourcePosition] = field(_.getSourcePosition)((c_, f_) => c_.copy(sourcePosition = Option(f_))) + def sourcePosition: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.source.SourcePosition] = field(_.getSourcePosition)((c_, f_) => c_.copy(sourcePosition = _root_.scala.Option(f_))) def optionalSourcePosition: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.source.SourcePosition]] = field(_.sourcePosition)((c_, f_) => c_.copy(sourcePosition = f_)) } final val TOK_FIELD_NUMBER = 1 diff --git a/core/src/main/scala/besom/rpc/pulumirpc/resource/ResourceMonitorGrpc.scala b/core/src/main/scala/besom/rpc/pulumirpc/resource/ResourceMonitorGrpc.scala index 9b7639f3..e808be3e 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/resource/ResourceMonitorGrpc.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/resource/ResourceMonitorGrpc.scala @@ -37,12 +37,12 @@ object ResourceMonitorGrpc { .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.resource.ResourceProto.javaDescriptor.getServices().get(0).getMethods().get(2))) .build() - val METHOD_CALL: _root_.io.grpc.MethodDescriptor[pulumirpc.provider.CallRequest, pulumirpc.provider.CallResponse] = + val METHOD_CALL: _root_.io.grpc.MethodDescriptor[pulumirpc.resource.ResourceCallRequest, pulumirpc.provider.CallResponse] = _root_.io.grpc.MethodDescriptor.newBuilder() .setType(_root_.io.grpc.MethodDescriptor.MethodType.UNARY) .setFullMethodName(_root_.io.grpc.MethodDescriptor.generateFullMethodName("pulumirpc.ResourceMonitor", "Call")) .setSampledToLocalTracing(true) - .setRequestMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.provider.CallRequest]) + .setRequestMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.resource.ResourceCallRequest]) .setResponseMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.provider.CallResponse]) .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.resource.ResourceProto.javaDescriptor.getServices().get(0).getMethods().get(3))) .build() @@ -77,6 +77,16 @@ object ResourceMonitorGrpc { .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.resource.ResourceProto.javaDescriptor.getServices().get(0).getMethods().get(6))) .build() + val METHOD_REGISTER_STACK_TRANSFORM: _root_.io.grpc.MethodDescriptor[pulumirpc.callback.Callback, com.google.protobuf.empty.Empty] = + _root_.io.grpc.MethodDescriptor.newBuilder() + .setType(_root_.io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(_root_.io.grpc.MethodDescriptor.generateFullMethodName("pulumirpc.ResourceMonitor", "RegisterStackTransform")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[pulumirpc.callback.Callback]) + .setResponseMarshaller(_root_.scalapb.grpc.Marshaller.forMessage[com.google.protobuf.empty.Empty]) + .setSchemaDescriptor(_root_.scalapb.grpc.ConcreteProtoMethodDescriptorSupplier.fromMethodDescriptor(pulumirpc.resource.ResourceProto.javaDescriptor.getServices().get(0).getMethods().get(7))) + .build() + val SERVICE: _root_.io.grpc.ServiceDescriptor = _root_.io.grpc.ServiceDescriptor.newBuilder("pulumirpc.ResourceMonitor") .setSchemaDescriptor(new _root_.scalapb.grpc.ConcreteProtoFileDescriptorSupplier(pulumirpc.resource.ResourceProto.javaDescriptor)) @@ -87,6 +97,7 @@ object ResourceMonitorGrpc { .addMethod(METHOD_READ_RESOURCE) .addMethod(METHOD_REGISTER_RESOURCE) .addMethod(METHOD_REGISTER_RESOURCE_OUTPUTS) + .addMethod(METHOD_REGISTER_STACK_TRANSFORM) .build() /** ResourceMonitor is the interface a source uses to talk back to the planning monitor orchestrating the execution. @@ -96,10 +107,11 @@ object ResourceMonitorGrpc { def supportsFeature(request: pulumirpc.resource.SupportsFeatureRequest): scala.concurrent.Future[pulumirpc.resource.SupportsFeatureResponse] def invoke(request: pulumirpc.resource.ResourceInvokeRequest): scala.concurrent.Future[pulumirpc.provider.InvokeResponse] def streamInvoke(request: pulumirpc.resource.ResourceInvokeRequest, responseObserver: _root_.io.grpc.stub.StreamObserver[pulumirpc.provider.InvokeResponse]): _root_.scala.Unit - def call(request: pulumirpc.provider.CallRequest): scala.concurrent.Future[pulumirpc.provider.CallResponse] + def call(request: pulumirpc.resource.ResourceCallRequest): scala.concurrent.Future[pulumirpc.provider.CallResponse] def readResource(request: pulumirpc.resource.ReadResourceRequest): scala.concurrent.Future[pulumirpc.resource.ReadResourceResponse] def registerResource(request: pulumirpc.resource.RegisterResourceRequest): scala.concurrent.Future[pulumirpc.resource.RegisterResourceResponse] def registerResourceOutputs(request: pulumirpc.resource.RegisterResourceOutputsRequest): scala.concurrent.Future[com.google.protobuf.empty.Empty] + def registerStackTransform(request: pulumirpc.callback.Callback): scala.concurrent.Future[com.google.protobuf.empty.Empty] } object ResourceMonitor extends _root_.scalapb.grpc.ServiceCompanion[ResourceMonitor] { @@ -127,7 +139,7 @@ object ResourceMonitorGrpc { })) .addMethod( METHOD_CALL, - _root_.io.grpc.stub.ServerCalls.asyncUnaryCall((request: pulumirpc.provider.CallRequest, observer: _root_.io.grpc.stub.StreamObserver[pulumirpc.provider.CallResponse]) => { + _root_.io.grpc.stub.ServerCalls.asyncUnaryCall((request: pulumirpc.resource.ResourceCallRequest, observer: _root_.io.grpc.stub.StreamObserver[pulumirpc.provider.CallResponse]) => { serviceImpl.call(request).onComplete(scalapb.grpc.Grpc.completeObserver(observer))( executionContext) })) @@ -149,6 +161,12 @@ object ResourceMonitorGrpc { serviceImpl.registerResourceOutputs(request).onComplete(scalapb.grpc.Grpc.completeObserver(observer))( executionContext) })) + .addMethod( + METHOD_REGISTER_STACK_TRANSFORM, + _root_.io.grpc.stub.ServerCalls.asyncUnaryCall((request: pulumirpc.callback.Callback, observer: _root_.io.grpc.stub.StreamObserver[com.google.protobuf.empty.Empty]) => { + serviceImpl.registerStackTransform(request).onComplete(scalapb.grpc.Grpc.completeObserver(observer))( + executionContext) + })) .build() } @@ -159,10 +177,11 @@ object ResourceMonitorGrpc { def supportsFeature(request: pulumirpc.resource.SupportsFeatureRequest): pulumirpc.resource.SupportsFeatureResponse def invoke(request: pulumirpc.resource.ResourceInvokeRequest): pulumirpc.provider.InvokeResponse def streamInvoke(request: pulumirpc.resource.ResourceInvokeRequest): scala.collection.Iterator[pulumirpc.provider.InvokeResponse] - def call(request: pulumirpc.provider.CallRequest): pulumirpc.provider.CallResponse + def call(request: pulumirpc.resource.ResourceCallRequest): pulumirpc.provider.CallResponse def readResource(request: pulumirpc.resource.ReadResourceRequest): pulumirpc.resource.ReadResourceResponse def registerResource(request: pulumirpc.resource.RegisterResourceRequest): pulumirpc.resource.RegisterResourceResponse def registerResourceOutputs(request: pulumirpc.resource.RegisterResourceOutputsRequest): com.google.protobuf.empty.Empty + def registerStackTransform(request: pulumirpc.callback.Callback): com.google.protobuf.empty.Empty } class ResourceMonitorBlockingStub(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions = _root_.io.grpc.CallOptions.DEFAULT) extends _root_.io.grpc.stub.AbstractStub[ResourceMonitorBlockingStub](channel, options) with ResourceMonitorBlockingClient { @@ -178,7 +197,7 @@ object ResourceMonitorGrpc { _root_.scalapb.grpc.ClientCalls.blockingServerStreamingCall(channel, METHOD_STREAM_INVOKE, options, request) } - override def call(request: pulumirpc.provider.CallRequest): pulumirpc.provider.CallResponse = { + override def call(request: pulumirpc.resource.ResourceCallRequest): pulumirpc.provider.CallResponse = { _root_.scalapb.grpc.ClientCalls.blockingUnaryCall(channel, METHOD_CALL, options, request) } @@ -194,6 +213,10 @@ object ResourceMonitorGrpc { _root_.scalapb.grpc.ClientCalls.blockingUnaryCall(channel, METHOD_REGISTER_RESOURCE_OUTPUTS, options, request) } + override def registerStackTransform(request: pulumirpc.callback.Callback): com.google.protobuf.empty.Empty = { + _root_.scalapb.grpc.ClientCalls.blockingUnaryCall(channel, METHOD_REGISTER_STACK_TRANSFORM, options, request) + } + override def build(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions): ResourceMonitorBlockingStub = new ResourceMonitorBlockingStub(channel, options) } @@ -210,7 +233,7 @@ object ResourceMonitorGrpc { _root_.scalapb.grpc.ClientCalls.asyncServerStreamingCall(channel, METHOD_STREAM_INVOKE, options, request, responseObserver) } - override def call(request: pulumirpc.provider.CallRequest): scala.concurrent.Future[pulumirpc.provider.CallResponse] = { + override def call(request: pulumirpc.resource.ResourceCallRequest): scala.concurrent.Future[pulumirpc.provider.CallResponse] = { _root_.scalapb.grpc.ClientCalls.asyncUnaryCall(channel, METHOD_CALL, options, request) } @@ -226,6 +249,10 @@ object ResourceMonitorGrpc { _root_.scalapb.grpc.ClientCalls.asyncUnaryCall(channel, METHOD_REGISTER_RESOURCE_OUTPUTS, options, request) } + override def registerStackTransform(request: pulumirpc.callback.Callback): scala.concurrent.Future[com.google.protobuf.empty.Empty] = { + _root_.scalapb.grpc.ClientCalls.asyncUnaryCall(channel, METHOD_REGISTER_STACK_TRANSFORM, options, request) + } + override def build(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions): ResourceMonitorStub = new ResourceMonitorStub(channel, options) } diff --git a/core/src/main/scala/besom/rpc/pulumirpc/resource/ResourceProto.scala b/core/src/main/scala/besom/rpc/pulumirpc/resource/ResourceProto.scala index 390e534a..77fd326d 100644 --- a/core/src/main/scala/besom/rpc/pulumirpc/resource/ResourceProto.scala +++ b/core/src/main/scala/besom/rpc/pulumirpc/resource/ResourceProto.scala @@ -11,7 +11,8 @@ object ResourceProto extends _root_.scalapb.GeneratedFileObject { com.google.protobuf.struct.StructProto, pulumirpc.provider.ProviderProto, pulumirpc.alias.AliasProto, - pulumirpc.source.SourceProto + pulumirpc.source.SourceProto, + pulumirpc.callback.CallbackProto ) lazy val messagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( @@ -22,88 +23,134 @@ object ResourceProto extends _root_.scalapb.GeneratedFileObject { pulumirpc.resource.RegisterResourceRequest, pulumirpc.resource.RegisterResourceResponse, pulumirpc.resource.RegisterResourceOutputsRequest, - pulumirpc.resource.ResourceInvokeRequest + pulumirpc.resource.ResourceInvokeRequest, + pulumirpc.resource.ResourceCallRequest, + pulumirpc.resource.TransformResourceOptions, + pulumirpc.resource.TransformRequest, + pulumirpc.resource.TransformResponse ) private lazy val ProtoBytes: _root_.scala.Array[Byte] = scalapb.Encoding.fromBase64(scala.collection.immutable.Seq( """ChVwdWx1bWkvcmVzb3VyY2UucHJvdG8SCXB1bHVtaXJwYxobZ29vZ2xlL3Byb3RvYnVmL2VtcHR5LnByb3RvGhxnb29nbGUvc HJvdG9idWYvc3RydWN0LnByb3RvGhVwdWx1bWkvcHJvdmlkZXIucHJvdG8aEnB1bHVtaS9hbGlhcy5wcm90bxoTcHVsdW1pL3Nvd - XJjZS5wcm90byIxChZTdXBwb3J0c0ZlYXR1cmVSZXF1ZXN0EhcKAmlkGAEgASgJQgfiPwQSAmlkUgJpZCJKChdTdXBwb3J0c0ZlY - XR1cmVSZXNwb25zZRIvCgpoYXNTdXBwb3J0GAEgASgIQg/iPwwSCmhhc1N1cHBvcnRSCmhhc1N1cHBvcnQiswcKE1JlYWRSZXNvd - XJjZVJlcXVlc3QSFwoCaWQYASABKAlCB+I/BBICaWRSAmlkEh0KBHR5cGUYAiABKAlCCeI/BhIEdHlwZVIEdHlwZRIdCgRuYW1lG - AMgASgJQgniPwYSBG5hbWVSBG5hbWUSIwoGcGFyZW50GAQgASgJQgviPwgSBnBhcmVudFIGcGFyZW50EkgKCnByb3BlcnRpZXMYB - SABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0Qg/iPwwSCnByb3BlcnRpZXNSCnByb3BlcnRpZXMSNQoMZGVwZW5kZW5jaWVzG - AYgAygJQhHiPw4SDGRlcGVuZGVuY2llc1IMZGVwZW5kZW5jaWVzEikKCHByb3ZpZGVyGAcgASgJQg3iPwoSCHByb3ZpZGVyUghwc - m92aWRlchImCgd2ZXJzaW9uGAggASgJQgziPwkSB3ZlcnNpb25SB3ZlcnNpb24SOAoNYWNjZXB0U2VjcmV0cxgJIAEoCEIS4j8PE - g1hY2NlcHRTZWNyZXRzUg1hY2NlcHRTZWNyZXRzElYKF2FkZGl0aW9uYWxTZWNyZXRPdXRwdXRzGAogAygJQhziPxkSF2FkZGl0a - W9uYWxTZWNyZXRPdXRwdXRzUhdhZGRpdGlvbmFsU2VjcmV0T3V0cHV0cxI+Cg9hY2NlcHRSZXNvdXJjZXMYDCABKAhCFOI/ERIPY - WNjZXB0UmVzb3VyY2VzUg9hY2NlcHRSZXNvdXJjZXMSRAoRcGx1Z2luRG93bmxvYWRVUkwYDSABKAlCFuI/ExIRcGx1Z2luRG93b - mxvYWRVUkxSEXBsdWdpbkRvd25sb2FkVVJMEnMKD3BsdWdpbkNoZWNrc3VtcxgPIAMoCzIzLnB1bHVtaXJwYy5SZWFkUmVzb3VyY - 2VSZXF1ZXN0LlBsdWdpbkNoZWNrc3Vtc0VudHJ5QhTiPxESD3BsdWdpbkNoZWNrc3Vtc1IPcGx1Z2luQ2hlY2tzdW1zElYKDnNvd - XJjZVBvc2l0aW9uGA4gASgLMhkucHVsdW1pcnBjLlNvdXJjZVBvc2l0aW9uQhPiPxASDnNvdXJjZVBvc2l0aW9uUg5zb3VyY2VQb - 3NpdGlvbhpYChRQbHVnaW5DaGVja3N1bXNFbnRyeRIaCgNrZXkYASABKAlCCOI/BRIDa2V5UgNrZXkSIAoFdmFsdWUYAiABKAxCC - uI/BxIFdmFsdWVSBXZhbHVlOgI4AUoECAsQDFIHYWxpYXNlcyJ8ChRSZWFkUmVzb3VyY2VSZXNwb25zZRIaCgN1cm4YASABKAlCC - OI/BRIDdXJuUgN1cm4SSAoKcHJvcGVydGllcxgCIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCD+I/DBIKcHJvcGVydGllc - 1IKcHJvcGVydGllcyKuEwoXUmVnaXN0ZXJSZXNvdXJjZVJlcXVlc3QSHQoEdHlwZRgBIAEoCUIJ4j8GEgR0eXBlUgR0eXBlEh0KB - G5hbWUYAiABKAlCCeI/BhIEbmFtZVIEbmFtZRIjCgZwYXJlbnQYAyABKAlCC+I/CBIGcGFyZW50UgZwYXJlbnQSIwoGY3VzdG9tG - AQgASgIQgviPwgSBmN1c3RvbVIGY3VzdG9tEjwKBm9iamVjdBgFIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCC+I/CBIGb - 2JqZWN0UgZvYmplY3QSJgoHcHJvdGVjdBgGIAEoCEIM4j8JEgdwcm90ZWN0Ugdwcm90ZWN0EjUKDGRlcGVuZGVuY2llcxgHIAMoC - UIR4j8OEgxkZXBlbmRlbmNpZXNSDGRlcGVuZGVuY2llcxIpCghwcm92aWRlchgIIAEoCUIN4j8KEghwcm92aWRlclIIcHJvdmlkZ - XISiwEKFHByb3BlcnR5RGVwZW5kZW5jaWVzGAkgAygLMjwucHVsdW1pcnBjLlJlZ2lzdGVyUmVzb3VyY2VSZXF1ZXN0LlByb3Blc - nR5RGVwZW5kZW5jaWVzRW50cnlCGeI/FhIUcHJvcGVydHlEZXBlbmRlbmNpZXNSFHByb3BlcnR5RGVwZW5kZW5jaWVzEkoKE2Rlb - GV0ZUJlZm9yZVJlcGxhY2UYCiABKAhCGOI/FRITZGVsZXRlQmVmb3JlUmVwbGFjZVITZGVsZXRlQmVmb3JlUmVwbGFjZRImCgd2Z - XJzaW9uGAsgASgJQgziPwkSB3ZlcnNpb25SB3ZlcnNpb24SOAoNaWdub3JlQ2hhbmdlcxgMIAMoCUIS4j8PEg1pZ25vcmVDaGFuZ - 2VzUg1pZ25vcmVDaGFuZ2VzEjgKDWFjY2VwdFNlY3JldHMYDSABKAhCEuI/DxINYWNjZXB0U2VjcmV0c1INYWNjZXB0U2VjcmV0c - xJWChdhZGRpdGlvbmFsU2VjcmV0T3V0cHV0cxgOIAMoCUIc4j8ZEhdhZGRpdGlvbmFsU2VjcmV0T3V0cHV0c1IXYWRkaXRpb25hb - FNlY3JldE91dHB1dHMSLAoJYWxpYXNVUk5zGA8gAygJQg7iPwsSCWFsaWFzVVJOc1IJYWxpYXNVUk5zEikKCGltcG9ydElkGBAgA - SgJQg3iPwoSCGltcG9ydElkUghpbXBvcnRJZBJuCg5jdXN0b21UaW1lb3V0cxgRIAEoCzIxLnB1bHVtaXJwYy5SZWdpc3RlclJlc - 291cmNlUmVxdWVzdC5DdXN0b21UaW1lb3V0c0IT4j8QEg5jdXN0b21UaW1lb3V0c1IOY3VzdG9tVGltZW91dHMSXwoaZGVsZXRlQ - mVmb3JlUmVwbGFjZURlZmluZWQYEiABKAhCH+I/HBIaZGVsZXRlQmVmb3JlUmVwbGFjZURlZmluZWRSGmRlbGV0ZUJlZm9yZVJlc - GxhY2VEZWZpbmVkElAKFXN1cHBvcnRzUGFydGlhbFZhbHVlcxgTIAEoCEIa4j8XEhVzdXBwb3J0c1BhcnRpYWxWYWx1ZXNSFXN1c - HBvcnRzUGFydGlhbFZhbHVlcxIjCgZyZW1vdGUYFCABKAhCC+I/CBIGcmVtb3RlUgZyZW1vdGUSPgoPYWNjZXB0UmVzb3VyY2VzG - BUgASgIQhTiPxESD2FjY2VwdFJlc291cmNlc1IPYWNjZXB0UmVzb3VyY2VzEl8KCXByb3ZpZGVycxgWIAMoCzIxLnB1bHVtaXJwY - y5SZWdpc3RlclJlc291cmNlUmVxdWVzdC5Qcm92aWRlcnNFbnRyeUIO4j8LEglwcm92aWRlcnNSCXByb3ZpZGVycxJBChByZXBsY - WNlT25DaGFuZ2VzGBcgAygJQhXiPxISEHJlcGxhY2VPbkNoYW5nZXNSEHJlcGxhY2VPbkNoYW5nZXMSRAoRcGx1Z2luRG93bmxvY - WRVUkwYGCABKAlCFuI/ExIRcGx1Z2luRG93bmxvYWRVUkxSEXBsdWdpbkRvd25sb2FkVVJMEncKD3BsdWdpbkNoZWNrc3VtcxgeI - AMoCzI3LnB1bHVtaXJwYy5SZWdpc3RlclJlc291cmNlUmVxdWVzdC5QbHVnaW5DaGVja3N1bXNFbnRyeUIU4j8REg9wbHVnaW5Da - GVja3N1bXNSD3BsdWdpbkNoZWNrc3VtcxI7Cg5yZXRhaW5PbkRlbGV0ZRgZIAEoCEIT4j8QEg5yZXRhaW5PbkRlbGV0ZVIOcmV0Y - WluT25EZWxldGUSOAoHYWxpYXNlcxgaIAMoCzIQLnB1bHVtaXJwYy5BbGlhc0IM4j8JEgdhbGlhc2VzUgdhbGlhc2VzEjIKC2Rlb - GV0ZWRXaXRoGBsgASgJQhDiPw0SC2RlbGV0ZWRXaXRoUgtkZWxldGVkV2l0aBIvCgphbGlhc1NwZWNzGBwgASgIQg/iPwwSCmFsa - WFzU3BlY3NSCmFsaWFzU3BlY3MSVgoOc291cmNlUG9zaXRpb24YHSABKAsyGS5wdWx1bWlycGMuU291cmNlUG9zaXRpb25CE+I/E - BIOc291cmNlUG9zaXRpb25SDnNvdXJjZVBvc2l0aW9uGjUKFFByb3BlcnR5RGVwZW5kZW5jaWVzEh0KBHVybnMYASADKAlCCeI/B - hIEdXJuc1IEdXJucxp/Cg5DdXN0b21UaW1lb3V0cxIjCgZjcmVhdGUYASABKAlCC+I/CBIGY3JlYXRlUgZjcmVhdGUSIwoGdXBkY - XRlGAIgASgJQgviPwgSBnVwZGF0ZVIGdXBkYXRlEiMKBmRlbGV0ZRgDIAEoCUIL4j8IEgZkZWxldGVSBmRlbGV0ZRqWAQoZUHJvc - GVydHlEZXBlbmRlbmNpZXNFbnRyeRIaCgNrZXkYASABKAlCCOI/BRIDa2V5UgNrZXkSWQoFdmFsdWUYAiABKAsyNy5wdWx1bWlyc - GMuUmVnaXN0ZXJSZXNvdXJjZVJlcXVlc3QuUHJvcGVydHlEZXBlbmRlbmNpZXNCCuI/BxIFdmFsdWVSBXZhbHVlOgI4ARpSCg5Qc - m92aWRlcnNFbnRyeRIaCgNrZXkYASABKAlCCOI/BRIDa2V5UgNrZXkSIAoFdmFsdWUYAiABKAlCCuI/BxIFdmFsdWVSBXZhbHVlO - gI4ARpYChRQbHVnaW5DaGVja3N1bXNFbnRyeRIaCgNrZXkYASABKAlCCOI/BRIDa2V5UgNrZXkSIAoFdmFsdWUYAiABKAxCCuI/B - xIFdmFsdWVSBXZhbHVlOgI4ASK6BAoYUmVnaXN0ZXJSZXNvdXJjZVJlc3BvbnNlEhoKA3VybhgBIAEoCUII4j8FEgN1cm5SA3Vyb - hIXCgJpZBgCIAEoCUIH4j8EEgJpZFICaWQSPAoGb2JqZWN0GAMgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEIL4j8IEgZvY - mplY3RSBm9iamVjdBIjCgZzdGFibGUYBCABKAhCC+I/CBIGc3RhYmxlUgZzdGFibGUSJgoHc3RhYmxlcxgFIAMoCUIM4j8JEgdzd - GFibGVzUgdzdGFibGVzEowBChRwcm9wZXJ0eURlcGVuZGVuY2llcxgGIAMoCzI9LnB1bHVtaXJwYy5SZWdpc3RlclJlc291cmNlU - mVzcG9uc2UuUHJvcGVydHlEZXBlbmRlbmNpZXNFbnRyeUIZ4j8WEhRwcm9wZXJ0eURlcGVuZGVuY2llc1IUcHJvcGVydHlEZXBlb - mRlbmNpZXMaNQoUUHJvcGVydHlEZXBlbmRlbmNpZXMSHQoEdXJucxgBIAMoCUIJ4j8GEgR1cm5zUgR1cm5zGpcBChlQcm9wZXJ0e - URlcGVuZGVuY2llc0VudHJ5EhoKA2tleRgBIAEoCUII4j8FEgNrZXlSA2tleRJaCgV2YWx1ZRgCIAEoCzI4LnB1bHVtaXJwYy5SZ - Wdpc3RlclJlc291cmNlUmVzcG9uc2UuUHJvcGVydHlEZXBlbmRlbmNpZXNCCuI/BxIFdmFsdWVSBXZhbHVlOgI4ASJ9Ch5SZWdpc - 3RlclJlc291cmNlT3V0cHV0c1JlcXVlc3QSGgoDdXJuGAEgASgJQgjiPwUSA3VyblIDdXJuEj8KB291dHB1dHMYAiABKAsyFy5nb - 29nbGUucHJvdG9idWYuU3RydWN0QgziPwkSB291dHB1dHNSB291dHB1dHMi7QQKFVJlc291cmNlSW52b2tlUmVxdWVzdBIaCgN0b - 2sYASABKAlCCOI/BRIDdG9rUgN0b2sSNgoEYXJncxgCIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCCeI/BhIEYXJnc1IEY - XJncxIpCghwcm92aWRlchgDIAEoCUIN4j8KEghwcm92aWRlclIIcHJvdmlkZXISJgoHdmVyc2lvbhgEIAEoCUIM4j8JEgd2ZXJza - W9uUgd2ZXJzaW9uEj4KD2FjY2VwdFJlc291cmNlcxgFIAEoCEIU4j8REg9hY2NlcHRSZXNvdXJjZXNSD2FjY2VwdFJlc291cmNlc - xJEChFwbHVnaW5Eb3dubG9hZFVSTBgGIAEoCUIW4j8TEhFwbHVnaW5Eb3dubG9hZFVSTFIRcGx1Z2luRG93bmxvYWRVUkwSdQoPc - Gx1Z2luQ2hlY2tzdW1zGAggAygLMjUucHVsdW1pcnBjLlJlc291cmNlSW52b2tlUmVxdWVzdC5QbHVnaW5DaGVja3N1bXNFbnRye - UIU4j8REg9wbHVnaW5DaGVja3N1bXNSD3BsdWdpbkNoZWNrc3VtcxJWCg5zb3VyY2VQb3NpdGlvbhgHIAEoCzIZLnB1bHVtaXJwY - y5Tb3VyY2VQb3NpdGlvbkIT4j8QEg5zb3VyY2VQb3NpdGlvblIOc291cmNlUG9zaXRpb24aWAoUUGx1Z2luQ2hlY2tzdW1zRW50c - nkSGgoDa2V5GAEgASgJQgjiPwUSA2tleVIDa2V5EiAKBXZhbHVlGAIgASgMQgriPwcSBXZhbHVlUgV2YWx1ZToCOAEy1AQKD1Jlc - 291cmNlTW9uaXRvchJaCg9TdXBwb3J0c0ZlYXR1cmUSIS5wdWx1bWlycGMuU3VwcG9ydHNGZWF0dXJlUmVxdWVzdBoiLnB1bHVta - XJwYy5TdXBwb3J0c0ZlYXR1cmVSZXNwb25zZSIAEkcKBkludm9rZRIgLnB1bHVtaXJwYy5SZXNvdXJjZUludm9rZVJlcXVlc3QaG - S5wdWx1bWlycGMuSW52b2tlUmVzcG9uc2UiABJPCgxTdHJlYW1JbnZva2USIC5wdWx1bWlycGMuUmVzb3VyY2VJbnZva2VSZXF1Z - XN0GhkucHVsdW1pcnBjLkludm9rZVJlc3BvbnNlIgAwARI5CgRDYWxsEhYucHVsdW1pcnBjLkNhbGxSZXF1ZXN0GhcucHVsdW1pc - nBjLkNhbGxSZXNwb25zZSIAElEKDFJlYWRSZXNvdXJjZRIeLnB1bHVtaXJwYy5SZWFkUmVzb3VyY2VSZXF1ZXN0Gh8ucHVsdW1pc - nBjLlJlYWRSZXNvdXJjZVJlc3BvbnNlIgASXQoQUmVnaXN0ZXJSZXNvdXJjZRIiLnB1bHVtaXJwYy5SZWdpc3RlclJlc291cmNlU - mVxdWVzdBojLnB1bHVtaXJwYy5SZWdpc3RlclJlc291cmNlUmVzcG9uc2UiABJeChdSZWdpc3RlclJlc291cmNlT3V0cHV0cxIpL - nB1bHVtaXJwYy5SZWdpc3RlclJlc291cmNlT3V0cHV0c1JlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiAEI0WjJnaXRod - WIuY29tL3B1bHVtaS9wdWx1bWkvc2RrL3YzL3Byb3RvL2dvO3B1bHVtaXJwY2IGcHJvdG8z""" + XJjZS5wcm90bxoVcHVsdW1pL2NhbGxiYWNrLnByb3RvIjEKFlN1cHBvcnRzRmVhdHVyZVJlcXVlc3QSFwoCaWQYASABKAlCB+I/B + BICaWRSAmlkIkoKF1N1cHBvcnRzRmVhdHVyZVJlc3BvbnNlEi8KCmhhc1N1cHBvcnQYASABKAhCD+I/DBIKaGFzU3VwcG9ydFIKa + GFzU3VwcG9ydCKzBwoTUmVhZFJlc291cmNlUmVxdWVzdBIXCgJpZBgBIAEoCUIH4j8EEgJpZFICaWQSHQoEdHlwZRgCIAEoCUIJ4 + j8GEgR0eXBlUgR0eXBlEh0KBG5hbWUYAyABKAlCCeI/BhIEbmFtZVIEbmFtZRIjCgZwYXJlbnQYBCABKAlCC+I/CBIGcGFyZW50U + gZwYXJlbnQSSAoKcHJvcGVydGllcxgFIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCD+I/DBIKcHJvcGVydGllc1IKcHJvc + GVydGllcxI1CgxkZXBlbmRlbmNpZXMYBiADKAlCEeI/DhIMZGVwZW5kZW5jaWVzUgxkZXBlbmRlbmNpZXMSKQoIcHJvdmlkZXIYB + yABKAlCDeI/ChIIcHJvdmlkZXJSCHByb3ZpZGVyEiYKB3ZlcnNpb24YCCABKAlCDOI/CRIHdmVyc2lvblIHdmVyc2lvbhI4Cg1hY + 2NlcHRTZWNyZXRzGAkgASgIQhLiPw8SDWFjY2VwdFNlY3JldHNSDWFjY2VwdFNlY3JldHMSVgoXYWRkaXRpb25hbFNlY3JldE91d + HB1dHMYCiADKAlCHOI/GRIXYWRkaXRpb25hbFNlY3JldE91dHB1dHNSF2FkZGl0aW9uYWxTZWNyZXRPdXRwdXRzEj4KD2FjY2Vwd + FJlc291cmNlcxgMIAEoCEIU4j8REg9hY2NlcHRSZXNvdXJjZXNSD2FjY2VwdFJlc291cmNlcxJEChFwbHVnaW5Eb3dubG9hZFVST + BgNIAEoCUIW4j8TEhFwbHVnaW5Eb3dubG9hZFVSTFIRcGx1Z2luRG93bmxvYWRVUkwScwoPcGx1Z2luQ2hlY2tzdW1zGA8gAygLM + jMucHVsdW1pcnBjLlJlYWRSZXNvdXJjZVJlcXVlc3QuUGx1Z2luQ2hlY2tzdW1zRW50cnlCFOI/ERIPcGx1Z2luQ2hlY2tzdW1zU + g9wbHVnaW5DaGVja3N1bXMSVgoOc291cmNlUG9zaXRpb24YDiABKAsyGS5wdWx1bWlycGMuU291cmNlUG9zaXRpb25CE+I/EBIOc + 291cmNlUG9zaXRpb25SDnNvdXJjZVBvc2l0aW9uGlgKFFBsdWdpbkNoZWNrc3Vtc0VudHJ5EhoKA2tleRgBIAEoCUII4j8FEgNrZ + XlSA2tleRIgCgV2YWx1ZRgCIAEoDEIK4j8HEgV2YWx1ZVIFdmFsdWU6AjgBSgQICxAMUgdhbGlhc2VzInwKFFJlYWRSZXNvdXJjZ + VJlc3BvbnNlEhoKA3VybhgBIAEoCUII4j8FEgN1cm5SA3VybhJICgpwcm9wZXJ0aWVzGAIgASgLMhcuZ29vZ2xlLnByb3RvYnVmL + lN0cnVjdEIP4j8MEgpwcm9wZXJ0aWVzUgpwcm9wZXJ0aWVzIswUChdSZWdpc3RlclJlc291cmNlUmVxdWVzdBIdCgR0eXBlGAEgA + SgJQgniPwYSBHR5cGVSBHR5cGUSHQoEbmFtZRgCIAEoCUIJ4j8GEgRuYW1lUgRuYW1lEiMKBnBhcmVudBgDIAEoCUIL4j8IEgZwY + XJlbnRSBnBhcmVudBIjCgZjdXN0b20YBCABKAhCC+I/CBIGY3VzdG9tUgZjdXN0b20SPAoGb2JqZWN0GAUgASgLMhcuZ29vZ2xlL + nByb3RvYnVmLlN0cnVjdEIL4j8IEgZvYmplY3RSBm9iamVjdBImCgdwcm90ZWN0GAYgASgIQgziPwkSB3Byb3RlY3RSB3Byb3RlY + 3QSNQoMZGVwZW5kZW5jaWVzGAcgAygJQhHiPw4SDGRlcGVuZGVuY2llc1IMZGVwZW5kZW5jaWVzEikKCHByb3ZpZGVyGAggASgJQ + g3iPwoSCHByb3ZpZGVyUghwcm92aWRlchKLAQoUcHJvcGVydHlEZXBlbmRlbmNpZXMYCSADKAsyPC5wdWx1bWlycGMuUmVnaXN0Z + XJSZXNvdXJjZVJlcXVlc3QuUHJvcGVydHlEZXBlbmRlbmNpZXNFbnRyeUIZ4j8WEhRwcm9wZXJ0eURlcGVuZGVuY2llc1IUcHJvc + GVydHlEZXBlbmRlbmNpZXMSSgoTZGVsZXRlQmVmb3JlUmVwbGFjZRgKIAEoCEIY4j8VEhNkZWxldGVCZWZvcmVSZXBsYWNlUhNkZ + WxldGVCZWZvcmVSZXBsYWNlEiYKB3ZlcnNpb24YCyABKAlCDOI/CRIHdmVyc2lvblIHdmVyc2lvbhI4Cg1pZ25vcmVDaGFuZ2VzG + AwgAygJQhLiPw8SDWlnbm9yZUNoYW5nZXNSDWlnbm9yZUNoYW5nZXMSOAoNYWNjZXB0U2VjcmV0cxgNIAEoCEIS4j8PEg1hY2Nlc + HRTZWNyZXRzUg1hY2NlcHRTZWNyZXRzElYKF2FkZGl0aW9uYWxTZWNyZXRPdXRwdXRzGA4gAygJQhziPxkSF2FkZGl0aW9uYWxTZ + WNyZXRPdXRwdXRzUhdhZGRpdGlvbmFsU2VjcmV0T3V0cHV0cxIsCglhbGlhc1VSTnMYDyADKAlCDuI/CxIJYWxpYXNVUk5zUglhb + Glhc1VSTnMSKQoIaW1wb3J0SWQYECABKAlCDeI/ChIIaW1wb3J0SWRSCGltcG9ydElkEm4KDmN1c3RvbVRpbWVvdXRzGBEgASgLM + jEucHVsdW1pcnBjLlJlZ2lzdGVyUmVzb3VyY2VSZXF1ZXN0LkN1c3RvbVRpbWVvdXRzQhPiPxASDmN1c3RvbVRpbWVvdXRzUg5jd + XN0b21UaW1lb3V0cxJfChpkZWxldGVCZWZvcmVSZXBsYWNlRGVmaW5lZBgSIAEoCEIf4j8cEhpkZWxldGVCZWZvcmVSZXBsYWNlR + GVmaW5lZFIaZGVsZXRlQmVmb3JlUmVwbGFjZURlZmluZWQSUAoVc3VwcG9ydHNQYXJ0aWFsVmFsdWVzGBMgASgIQhriPxcSFXN1c + HBvcnRzUGFydGlhbFZhbHVlc1IVc3VwcG9ydHNQYXJ0aWFsVmFsdWVzEiMKBnJlbW90ZRgUIAEoCEIL4j8IEgZyZW1vdGVSBnJlb + W90ZRI+Cg9hY2NlcHRSZXNvdXJjZXMYFSABKAhCFOI/ERIPYWNjZXB0UmVzb3VyY2VzUg9hY2NlcHRSZXNvdXJjZXMSXwoJcHJvd + mlkZXJzGBYgAygLMjEucHVsdW1pcnBjLlJlZ2lzdGVyUmVzb3VyY2VSZXF1ZXN0LlByb3ZpZGVyc0VudHJ5Qg7iPwsSCXByb3ZpZ + GVyc1IJcHJvdmlkZXJzEkEKEHJlcGxhY2VPbkNoYW5nZXMYFyADKAlCFeI/EhIQcmVwbGFjZU9uQ2hhbmdlc1IQcmVwbGFjZU9uQ + 2hhbmdlcxJEChFwbHVnaW5Eb3dubG9hZFVSTBgYIAEoCUIW4j8TEhFwbHVnaW5Eb3dubG9hZFVSTFIRcGx1Z2luRG93bmxvYWRVU + kwSdwoPcGx1Z2luQ2hlY2tzdW1zGB4gAygLMjcucHVsdW1pcnBjLlJlZ2lzdGVyUmVzb3VyY2VSZXF1ZXN0LlBsdWdpbkNoZWNrc + 3Vtc0VudHJ5QhTiPxESD3BsdWdpbkNoZWNrc3Vtc1IPcGx1Z2luQ2hlY2tzdW1zEjsKDnJldGFpbk9uRGVsZXRlGBkgASgIQhPiP + xASDnJldGFpbk9uRGVsZXRlUg5yZXRhaW5PbkRlbGV0ZRI4CgdhbGlhc2VzGBogAygLMhAucHVsdW1pcnBjLkFsaWFzQgziPwkSB + 2FsaWFzZXNSB2FsaWFzZXMSMgoLZGVsZXRlZFdpdGgYGyABKAlCEOI/DRILZGVsZXRlZFdpdGhSC2RlbGV0ZWRXaXRoEi8KCmFsa + WFzU3BlY3MYHCABKAhCD+I/DBIKYWxpYXNTcGVjc1IKYWxpYXNTcGVjcxJWCg5zb3VyY2VQb3NpdGlvbhgdIAEoCzIZLnB1bHVta + XJwYy5Tb3VyY2VQb3NpdGlvbkIT4j8QEg5zb3VyY2VQb3NpdGlvblIOc291cmNlUG9zaXRpb24SRAoKdHJhbnNmb3JtcxgfIAMoC + zITLnB1bHVtaXJwYy5DYWxsYmFja0IP4j8MEgp0cmFuc2Zvcm1zUgp0cmFuc2Zvcm1zElYKF3N1cHBvcnRzUmVzdWx0UmVwb3J0a + W5nGCAgASgIQhziPxkSF3N1cHBvcnRzUmVzdWx0UmVwb3J0aW5nUhdzdXBwb3J0c1Jlc3VsdFJlcG9ydGluZxo1ChRQcm9wZXJ0e + URlcGVuZGVuY2llcxIdCgR1cm5zGAEgAygJQgniPwYSBHVybnNSBHVybnMafwoOQ3VzdG9tVGltZW91dHMSIwoGY3JlYXRlGAEgA + SgJQgviPwgSBmNyZWF0ZVIGY3JlYXRlEiMKBnVwZGF0ZRgCIAEoCUIL4j8IEgZ1cGRhdGVSBnVwZGF0ZRIjCgZkZWxldGUYAyABK + AlCC+I/CBIGZGVsZXRlUgZkZWxldGUalgEKGVByb3BlcnR5RGVwZW5kZW5jaWVzRW50cnkSGgoDa2V5GAEgASgJQgjiPwUSA2tle + VIDa2V5ElkKBXZhbHVlGAIgASgLMjcucHVsdW1pcnBjLlJlZ2lzdGVyUmVzb3VyY2VSZXF1ZXN0LlByb3BlcnR5RGVwZW5kZW5ja + WVzQgriPwcSBXZhbHVlUgV2YWx1ZToCOAEaUgoOUHJvdmlkZXJzRW50cnkSGgoDa2V5GAEgASgJQgjiPwUSA2tleVIDa2V5EiAKB + XZhbHVlGAIgASgJQgriPwcSBXZhbHVlUgV2YWx1ZToCOAEaWAoUUGx1Z2luQ2hlY2tzdW1zRW50cnkSGgoDa2V5GAEgASgJQgjiP + wUSA2tleVIDa2V5EiAKBXZhbHVlGAIgASgMQgriPwcSBXZhbHVlUgV2YWx1ZToCOAEi8gQKGFJlZ2lzdGVyUmVzb3VyY2VSZXNwb + 25zZRIaCgN1cm4YASABKAlCCOI/BRIDdXJuUgN1cm4SFwoCaWQYAiABKAlCB+I/BBICaWRSAmlkEjwKBm9iamVjdBgDIAEoCzIXL + mdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCC+I/CBIGb2JqZWN0UgZvYmplY3QSIwoGc3RhYmxlGAQgASgIQgviPwgSBnN0YWJsZVIGc + 3RhYmxlEiYKB3N0YWJsZXMYBSADKAlCDOI/CRIHc3RhYmxlc1IHc3RhYmxlcxKMAQoUcHJvcGVydHlEZXBlbmRlbmNpZXMYBiADK + AsyPS5wdWx1bWlycGMuUmVnaXN0ZXJSZXNvdXJjZVJlc3BvbnNlLlByb3BlcnR5RGVwZW5kZW5jaWVzRW50cnlCGeI/FhIUcHJvc + GVydHlEZXBlbmRlbmNpZXNSFHByb3BlcnR5RGVwZW5kZW5jaWVzEjYKBnJlc3VsdBgHIAEoDjIRLnB1bHVtaXJwYy5SZXN1bHRCC + +I/CBIGcmVzdWx0UgZyZXN1bHQaNQoUUHJvcGVydHlEZXBlbmRlbmNpZXMSHQoEdXJucxgBIAMoCUIJ4j8GEgR1cm5zUgR1cm5zG + pcBChlQcm9wZXJ0eURlcGVuZGVuY2llc0VudHJ5EhoKA2tleRgBIAEoCUII4j8FEgNrZXlSA2tleRJaCgV2YWx1ZRgCIAEoCzI4L + nB1bHVtaXJwYy5SZWdpc3RlclJlc291cmNlUmVzcG9uc2UuUHJvcGVydHlEZXBlbmRlbmNpZXNCCuI/BxIFdmFsdWVSBXZhbHVlO + gI4ASJ9Ch5SZWdpc3RlclJlc291cmNlT3V0cHV0c1JlcXVlc3QSGgoDdXJuGAEgASgJQgjiPwUSA3VyblIDdXJuEj8KB291dHB1d + HMYAiABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0QgziPwkSB291dHB1dHNSB291dHB1dHMi7QQKFVJlc291cmNlSW52b2tlU + mVxdWVzdBIaCgN0b2sYASABKAlCCOI/BRIDdG9rUgN0b2sSNgoEYXJncxgCIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCC + eI/BhIEYXJnc1IEYXJncxIpCghwcm92aWRlchgDIAEoCUIN4j8KEghwcm92aWRlclIIcHJvdmlkZXISJgoHdmVyc2lvbhgEIAEoC + UIM4j8JEgd2ZXJzaW9uUgd2ZXJzaW9uEj4KD2FjY2VwdFJlc291cmNlcxgFIAEoCEIU4j8REg9hY2NlcHRSZXNvdXJjZXNSD2FjY + 2VwdFJlc291cmNlcxJEChFwbHVnaW5Eb3dubG9hZFVSTBgGIAEoCUIW4j8TEhFwbHVnaW5Eb3dubG9hZFVSTFIRcGx1Z2luRG93b + mxvYWRVUkwSdQoPcGx1Z2luQ2hlY2tzdW1zGAggAygLMjUucHVsdW1pcnBjLlJlc291cmNlSW52b2tlUmVxdWVzdC5QbHVnaW5Da + GVja3N1bXNFbnRyeUIU4j8REg9wbHVnaW5DaGVja3N1bXNSD3BsdWdpbkNoZWNrc3VtcxJWCg5zb3VyY2VQb3NpdGlvbhgHIAEoC + zIZLnB1bHVtaXJwYy5Tb3VyY2VQb3NpdGlvbkIT4j8QEg5zb3VyY2VQb3NpdGlvblIOc291cmNlUG9zaXRpb24aWAoUUGx1Z2luQ + 2hlY2tzdW1zRW50cnkSGgoDa2V5GAEgASgJQgjiPwUSA2tleVIDa2V5EiAKBXZhbHVlGAIgASgMQgriPwcSBXZhbHVlUgV2YWx1Z + ToCOAEi8AcKE1Jlc291cmNlQ2FsbFJlcXVlc3QSGgoDdG9rGAEgASgJQgjiPwUSA3Rva1IDdG9rEjYKBGFyZ3MYAiABKAsyFy5nb + 29nbGUucHJvdG9idWYuU3RydWN0QgniPwYSBGFyZ3NSBGFyZ3MScwoPYXJnRGVwZW5kZW5jaWVzGAMgAygLMjMucHVsdW1pcnBjL + lJlc291cmNlQ2FsbFJlcXVlc3QuQXJnRGVwZW5kZW5jaWVzRW50cnlCFOI/ERIPYXJnRGVwZW5kZW5jaWVzUg9hcmdEZXBlbmRlb + mNpZXMSKQoIcHJvdmlkZXIYBCABKAlCDeI/ChIIcHJvdmlkZXJSCHByb3ZpZGVyEiYKB3ZlcnNpb24YBSABKAlCDOI/CRIHdmVyc + 2lvblIHdmVyc2lvbhJEChFwbHVnaW5Eb3dubG9hZFVSTBgNIAEoCUIW4j8TEhFwbHVnaW5Eb3dubG9hZFVSTFIRcGx1Z2luRG93b + mxvYWRVUkwScwoPcGx1Z2luQ2hlY2tzdW1zGBAgAygLMjMucHVsdW1pcnBjLlJlc291cmNlQ2FsbFJlcXVlc3QuUGx1Z2luQ2hlY + 2tzdW1zRW50cnlCFOI/ERIPcGx1Z2luQ2hlY2tzdW1zUg9wbHVnaW5DaGVja3N1bXMSVgoOc291cmNlUG9zaXRpb24YDyABKAsyG + S5wdWx1bWlycGMuU291cmNlUG9zaXRpb25CE+I/EBIOc291cmNlUG9zaXRpb25SDnNvdXJjZVBvc2l0aW9uGjUKFEFyZ3VtZW50R + GVwZW5kZW5jaWVzEh0KBHVybnMYASADKAlCCeI/BhIEdXJuc1IEdXJucxqNAQoUQXJnRGVwZW5kZW5jaWVzRW50cnkSGgoDa2V5G + AEgASgJQgjiPwUSA2tleVIDa2V5ElUKBXZhbHVlGAIgASgLMjMucHVsdW1pcnBjLlJlc291cmNlQ2FsbFJlcXVlc3QuQXJndW1lb + nREZXBlbmRlbmNpZXNCCuI/BxIFdmFsdWVSBXZhbHVlOgI4ARpYChRQbHVnaW5DaGVja3N1bXNFbnRyeRIaCgNrZXkYASABKAlCC + OI/BRIDa2V5UgNrZXkSIAoFdmFsdWUYAiABKAxCCuI/BxIFdmFsdWVSBXZhbHVlOgI4AUoECAYQB0oECAcQCEoECAgQCUoECAkQC + koECAoQC0oECAsQDEoECAwQDUoECA4QD1IHcHJvamVjdFIFc3RhY2tSBmNvbmZpZ1IQY29uZmlnU2VjcmV0S2V5c1IGZHJ5UnVuU + ghwYXJhbGxlbFIPbW9uaXRvckVuZHBvaW50Ugxvcmdhbml6YXRpb24i/QkKGFRyYW5zZm9ybVJlc291cmNlT3B0aW9ucxItCgpkZ + XBlbmRzX29uGAEgAygJQg7iPwsSCWRlcGVuZHNPblIJZGVwZW5kc09uEiYKB3Byb3RlY3QYAiABKAhCDOI/CRIHcHJvdGVjdFIHc + HJvdGVjdBI5Cg5pZ25vcmVfY2hhbmdlcxgDIAMoCUIS4j8PEg1pZ25vcmVDaGFuZ2VzUg1pZ25vcmVDaGFuZ2VzEkMKEnJlcGxhY + 2Vfb25fY2hhbmdlcxgEIAMoCUIV4j8SEhByZXBsYWNlT25DaGFuZ2VzUhByZXBsYWNlT25DaGFuZ2VzEiYKB3ZlcnNpb24YBSABK + AlCDOI/CRIHdmVyc2lvblIHdmVyc2lvbhI4CgdhbGlhc2VzGAYgAygLMhAucHVsdW1pcnBjLkFsaWFzQgziPwkSB2FsaWFzZXNSB + 2FsaWFzZXMSKQoIcHJvdmlkZXIYByABKAlCDeI/ChIIcHJvdmlkZXJSCHByb3ZpZGVyEm8KD2N1c3RvbV90aW1lb3V0cxgIIAEoC + zIxLnB1bHVtaXJwYy5SZWdpc3RlclJlc291cmNlUmVxdWVzdC5DdXN0b21UaW1lb3V0c0IT4j8QEg5jdXN0b21UaW1lb3V0c1IOY + 3VzdG9tVGltZW91dHMSRgoTcGx1Z2luX2Rvd25sb2FkX3VybBgJIAEoCUIW4j8TEhFwbHVnaW5Eb3dubG9hZFVybFIRcGx1Z2luR + G93bmxvYWRVcmwSPQoQcmV0YWluX29uX2RlbGV0ZRgKIAEoCEIT4j8QEg5yZXRhaW5PbkRlbGV0ZVIOcmV0YWluT25EZWxldGUSM + woMZGVsZXRlZF93aXRoGAsgASgJQhDiPw0SC2RlbGV0ZWRXaXRoUgtkZWxldGVkV2l0aBJRChVkZWxldGVfYmVmb3JlX3JlcGxhY + 2UYDCABKAhCGOI/FRITZGVsZXRlQmVmb3JlUmVwbGFjZUgAUhNkZWxldGVCZWZvcmVSZXBsYWNliAEBElgKGWFkZGl0aW9uYWxfc + 2VjcmV0X291dHB1dHMYDSADKAlCHOI/GRIXYWRkaXRpb25hbFNlY3JldE91dHB1dHNSF2FkZGl0aW9uYWxTZWNyZXRPdXRwdXRzE + mAKCXByb3ZpZGVycxgOIAMoCzIyLnB1bHVtaXJwYy5UcmFuc2Zvcm1SZXNvdXJjZU9wdGlvbnMuUHJvdmlkZXJzRW50cnlCDuI/C + xIJcHJvdmlkZXJzUglwcm92aWRlcnMSeQoQcGx1Z2luX2NoZWNrc3VtcxgPIAMoCzI4LnB1bHVtaXJwYy5UcmFuc2Zvcm1SZXNvd + XJjZU9wdGlvbnMuUGx1Z2luQ2hlY2tzdW1zRW50cnlCFOI/ERIPcGx1Z2luQ2hlY2tzdW1zUg9wbHVnaW5DaGVja3N1bXMaUgoOU + HJvdmlkZXJzRW50cnkSGgoDa2V5GAEgASgJQgjiPwUSA2tleVIDa2V5EiAKBXZhbHVlGAIgASgJQgriPwcSBXZhbHVlUgV2YWx1Z + ToCOAEaWAoUUGx1Z2luQ2hlY2tzdW1zRW50cnkSGgoDa2V5GAEgASgJQgjiPwUSA2tleVIDa2V5EiAKBXZhbHVlGAIgASgMQgriP + wcSBXZhbHVlUgV2YWx1ZToCOAFCGAoWX2RlbGV0ZV9iZWZvcmVfcmVwbGFjZSKxAgoQVHJhbnNmb3JtUmVxdWVzdBIdCgR0eXBlG + AEgASgJQgniPwYSBHR5cGVSBHR5cGUSHQoEbmFtZRgCIAEoCUIJ4j8GEgRuYW1lUgRuYW1lEiMKBmN1c3RvbRgDIAEoCEIL4j8IE + gZjdXN0b21SBmN1c3RvbRIjCgZwYXJlbnQYBCABKAlCC+I/CBIGcGFyZW50UgZwYXJlbnQSSAoKcHJvcGVydGllcxgFIAEoCzIXL + mdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RCD+I/DBIKcHJvcGVydGllc1IKcHJvcGVydGllcxJLCgdvcHRpb25zGAYgASgLMiMucHVsd + W1pcnBjLlRyYW5zZm9ybVJlc291cmNlT3B0aW9uc0IM4j8JEgdvcHRpb25zUgdvcHRpb25zIqoBChFUcmFuc2Zvcm1SZXNwb25zZ + RJICgpwcm9wZXJ0aWVzGAEgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdEIP4j8MEgpwcm9wZXJ0aWVzUgpwcm9wZXJ0aWVzE + ksKB29wdGlvbnMYAiABKAsyIy5wdWx1bWlycGMuVHJhbnNmb3JtUmVzb3VyY2VPcHRpb25zQgziPwkSB29wdGlvbnNSB29wdGlvb + nMqTQoGUmVzdWx0EhkKB1NVQ0NFU1MQABoM4j8JEgdTVUNDRVNTEhMKBEZBSUwQARoJ4j8GEgRGQUlMEhMKBFNLSVAQAhoJ4j8GE + gRTS0lQMqUFCg9SZXNvdXJjZU1vbml0b3ISWgoPU3VwcG9ydHNGZWF0dXJlEiEucHVsdW1pcnBjLlN1cHBvcnRzRmVhdHVyZVJlc + XVlc3QaIi5wdWx1bWlycGMuU3VwcG9ydHNGZWF0dXJlUmVzcG9uc2UiABJHCgZJbnZva2USIC5wdWx1bWlycGMuUmVzb3VyY2VJb + nZva2VSZXF1ZXN0GhkucHVsdW1pcnBjLkludm9rZVJlc3BvbnNlIgASTwoMU3RyZWFtSW52b2tlEiAucHVsdW1pcnBjLlJlc291c + mNlSW52b2tlUmVxdWVzdBoZLnB1bHVtaXJwYy5JbnZva2VSZXNwb25zZSIAMAESQQoEQ2FsbBIeLnB1bHVtaXJwYy5SZXNvdXJjZ + UNhbGxSZXF1ZXN0GhcucHVsdW1pcnBjLkNhbGxSZXNwb25zZSIAElEKDFJlYWRSZXNvdXJjZRIeLnB1bHVtaXJwYy5SZWFkUmVzb + 3VyY2VSZXF1ZXN0Gh8ucHVsdW1pcnBjLlJlYWRSZXNvdXJjZVJlc3BvbnNlIgASXQoQUmVnaXN0ZXJSZXNvdXJjZRIiLnB1bHVta + XJwYy5SZWdpc3RlclJlc291cmNlUmVxdWVzdBojLnB1bHVtaXJwYy5SZWdpc3RlclJlc291cmNlUmVzcG9uc2UiABJeChdSZWdpc + 3RlclJlc291cmNlT3V0cHV0cxIpLnB1bHVtaXJwYy5SZWdpc3RlclJlc291cmNlT3V0cHV0c1JlcXVlc3QaFi5nb29nbGUucHJvd + G9idWYuRW1wdHkiABJHChZSZWdpc3RlclN0YWNrVHJhbnNmb3JtEhMucHVsdW1pcnBjLkNhbGxiYWNrGhYuZ29vZ2xlLnByb3RvY + nVmLkVtcHR5IgBCNFoyZ2l0aHViLmNvbS9wdWx1bWkvcHVsdW1pL3Nkay92My9wcm90by9nbztwdWx1bWlycGNiBnByb3RvMw==""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) @@ -116,7 +163,8 @@ object ResourceProto extends _root_.scalapb.GeneratedFileObject { com.google.protobuf.struct.StructProto.javaDescriptor, pulumirpc.provider.ProviderProto.javaDescriptor, pulumirpc.alias.AliasProto.javaDescriptor, - pulumirpc.source.SourceProto.javaDescriptor + pulumirpc.source.SourceProto.javaDescriptor, + pulumirpc.callback.CallbackProto.javaDescriptor )) } @deprecated("Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.", "ScalaPB 0.5.47") diff --git a/core/src/main/scala/besom/rpc/pulumirpc/resource/Result.scala b/core/src/main/scala/besom/rpc/pulumirpc/resource/Result.scala new file mode 100644 index 00000000..027846a2 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/resource/Result.scala @@ -0,0 +1,54 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.resource + +sealed abstract class Result(val value: _root_.scala.Int) extends _root_.scalapb.GeneratedEnum { + type EnumType = pulumirpc.resource.Result + type RecognizedType = pulumirpc.resource.Result.Recognized + def isSuccess: _root_.scala.Boolean = false + def isFail: _root_.scala.Boolean = false + def isSkip: _root_.scala.Boolean = false + def companion: _root_.scalapb.GeneratedEnumCompanion[Result] = pulumirpc.resource.Result + final def asRecognized: _root_.scala.Option[pulumirpc.resource.Result.Recognized] = if (isUnrecognized) _root_.scala.None else _root_.scala.Some(this.asInstanceOf[pulumirpc.resource.Result.Recognized]) +} + +object Result extends _root_.scalapb.GeneratedEnumCompanion[Result] { + sealed trait Recognized extends Result + implicit def enumCompanion: _root_.scalapb.GeneratedEnumCompanion[Result] = this + + @SerialVersionUID(0L) + case object SUCCESS extends Result(0) with Result.Recognized { + val index = 0 + val name = "SUCCESS" + override def isSuccess: _root_.scala.Boolean = true + } + + @SerialVersionUID(0L) + case object FAIL extends Result(1) with Result.Recognized { + val index = 1 + val name = "FAIL" + override def isFail: _root_.scala.Boolean = true + } + + @SerialVersionUID(0L) + case object SKIP extends Result(2) with Result.Recognized { + val index = 2 + val name = "SKIP" + override def isSkip: _root_.scala.Boolean = true + } + + @SerialVersionUID(0L) + final case class Unrecognized(unrecognizedValue: _root_.scala.Int) extends Result(unrecognizedValue) with _root_.scalapb.UnrecognizedEnum + lazy val values: scala.collection.immutable.Seq[ValueType] = scala.collection.immutable.Seq(SUCCESS, FAIL, SKIP) + def fromValue(__value: _root_.scala.Int): Result = __value match { + case 0 => SUCCESS + case 1 => FAIL + case 2 => SKIP + case __other => Unrecognized(__other) + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.EnumDescriptor = ResourceProto.javaDescriptor.getEnumTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.EnumDescriptor = ResourceProto.scalaDescriptor.enums(0) +} \ No newline at end of file diff --git a/core/src/main/scala/besom/rpc/pulumirpc/resource/TransformRequest.scala b/core/src/main/scala/besom/rpc/pulumirpc/resource/TransformRequest.scala new file mode 100644 index 00000000..3cae47c2 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/resource/TransformRequest.scala @@ -0,0 +1,281 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.resource + +/** @param type + * the type of the resource. + * @param name + * the name of the resource. + * @param custom + * true if the resource is a custom resource, else it's a component resource. + * @param parent + * the parent of the resource, this can't be changed by the transform. + * @param properties + * the input properties of the resource. + * @param options + * the options for the resource. + */ +@SerialVersionUID(0L) +final case class TransformRequest( + `type`: _root_.scala.Predef.String = "", + name: _root_.scala.Predef.String = "", + custom: _root_.scala.Boolean = false, + parent: _root_.scala.Predef.String = "", + properties: _root_.scala.Option[com.google.protobuf.struct.Struct] = _root_.scala.None, + options: _root_.scala.Option[pulumirpc.resource.TransformResourceOptions] = _root_.scala.None, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[TransformRequest] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = `type` + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = name + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + + { + val __value = custom + if (__value != false) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(3, __value) + } + }; + + { + val __value = parent + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(4, __value) + } + }; + if (properties.isDefined) { + val __value = properties.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + if (options.isDefined) { + val __value = options.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = `type` + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = name + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + { + val __v = custom + if (__v != false) { + _output__.writeBool(3, __v) + } + }; + { + val __v = parent + if (!__v.isEmpty) { + _output__.writeString(4, __v) + } + }; + properties.foreach { __v => + val __m = __v + _output__.writeTag(5, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + options.foreach { __v => + val __m = __v + _output__.writeTag(6, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def withType(__v: _root_.scala.Predef.String): TransformRequest = copy(`type` = __v) + def withName(__v: _root_.scala.Predef.String): TransformRequest = copy(name = __v) + def withCustom(__v: _root_.scala.Boolean): TransformRequest = copy(custom = __v) + def withParent(__v: _root_.scala.Predef.String): TransformRequest = copy(parent = __v) + def getProperties: com.google.protobuf.struct.Struct = properties.getOrElse(com.google.protobuf.struct.Struct.defaultInstance) + def clearProperties: TransformRequest = copy(properties = _root_.scala.None) + def withProperties(__v: com.google.protobuf.struct.Struct): TransformRequest = copy(properties = Option(__v)) + def getOptions: pulumirpc.resource.TransformResourceOptions = options.getOrElse(pulumirpc.resource.TransformResourceOptions.defaultInstance) + def clearOptions: TransformRequest = copy(options = _root_.scala.None) + def withOptions(__v: pulumirpc.resource.TransformResourceOptions): TransformRequest = copy(options = Option(__v)) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = `type` + if (__t != "") __t else null + } + case 2 => { + val __t = name + if (__t != "") __t else null + } + case 3 => { + val __t = custom + if (__t != false) __t else null + } + case 4 => { + val __t = parent + if (__t != "") __t else null + } + case 5 => properties.orNull + case 6 => options.orNull + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(`type`) + case 2 => _root_.scalapb.descriptors.PString(name) + case 3 => _root_.scalapb.descriptors.PBoolean(custom) + case 4 => _root_.scalapb.descriptors.PString(parent) + case 5 => properties.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 6 => options.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.resource.TransformRequest.type = pulumirpc.resource.TransformRequest + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.TransformRequest]) +} + +object TransformRequest extends scalapb.GeneratedMessageCompanion[pulumirpc.resource.TransformRequest] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.resource.TransformRequest] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.resource.TransformRequest = { + var __type: _root_.scala.Predef.String = "" + var __name: _root_.scala.Predef.String = "" + var __custom: _root_.scala.Boolean = false + var __parent: _root_.scala.Predef.String = "" + var __properties: _root_.scala.Option[com.google.protobuf.struct.Struct] = _root_.scala.None + var __options: _root_.scala.Option[pulumirpc.resource.TransformResourceOptions] = _root_.scala.None + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __type = _input__.readStringRequireUtf8() + case 18 => + __name = _input__.readStringRequireUtf8() + case 24 => + __custom = _input__.readBool() + case 34 => + __parent = _input__.readStringRequireUtf8() + case 42 => + __properties = _root_.scala.Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case 50 => + __options = _root_.scala.Option(__options.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.TransformResourceOptions](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.resource.TransformRequest( + `type` = __type, + name = __name, + custom = __custom, + parent = __parent, + properties = __properties, + options = __options, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.resource.TransformRequest] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.resource.TransformRequest( + `type` = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + name = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + custom = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Boolean]).getOrElse(false), + parent = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + properties = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.struct.Struct]]), + options = __fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).flatMap(_.as[_root_.scala.Option[pulumirpc.resource.TransformResourceOptions]]) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ResourceProto.javaDescriptor.getMessageTypes().get(10) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ResourceProto.scalaDescriptor.messages(10) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 5 => __out = com.google.protobuf.struct.Struct + case 6 => __out = pulumirpc.resource.TransformResourceOptions + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.resource.TransformRequest( + `type` = "", + name = "", + custom = false, + parent = "", + properties = _root_.scala.None, + options = _root_.scala.None + ) + implicit class TransformRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.TransformRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.resource.TransformRequest](_l) { + def `type`: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.`type`)((c_, f_) => c_.copy(`type` = f_)) + def name: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.name)((c_, f_) => c_.copy(name = f_)) + def custom: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.custom)((c_, f_) => c_.copy(custom = f_)) + def parent: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.parent)((c_, f_) => c_.copy(parent = f_)) + def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = _root_.scala.Option(f_))) + def optionalProperties: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.properties)((c_, f_) => c_.copy(properties = f_)) + def options: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.TransformResourceOptions] = field(_.getOptions)((c_, f_) => c_.copy(options = _root_.scala.Option(f_))) + def optionalOptions: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.resource.TransformResourceOptions]] = field(_.options)((c_, f_) => c_.copy(options = f_)) + } + final val TYPE_FIELD_NUMBER = 1 + final val NAME_FIELD_NUMBER = 2 + final val CUSTOM_FIELD_NUMBER = 3 + final val PARENT_FIELD_NUMBER = 4 + final val PROPERTIES_FIELD_NUMBER = 5 + final val OPTIONS_FIELD_NUMBER = 6 + def of( + `type`: _root_.scala.Predef.String, + name: _root_.scala.Predef.String, + custom: _root_.scala.Boolean, + parent: _root_.scala.Predef.String, + properties: _root_.scala.Option[com.google.protobuf.struct.Struct], + options: _root_.scala.Option[pulumirpc.resource.TransformResourceOptions] + ): _root_.pulumirpc.resource.TransformRequest = _root_.pulumirpc.resource.TransformRequest( + `type`, + name, + custom, + parent, + properties, + options + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.TransformRequest]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/resource/TransformResourceOptions.scala b/core/src/main/scala/besom/rpc/pulumirpc/resource/TransformResourceOptions.scala new file mode 100644 index 00000000..43228634 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/resource/TransformResourceOptions.scala @@ -0,0 +1,807 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.resource + +/** TransformResourceOptions is a subset of all resource options that are relevant to transforms. + */ +@SerialVersionUID(0L) +final case class TransformResourceOptions( + dependsOn: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, + protect: _root_.scala.Boolean = false, + ignoreChanges: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, + replaceOnChanges: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, + version: _root_.scala.Predef.String = "", + aliases: _root_.scala.Seq[pulumirpc.alias.Alias] = _root_.scala.Seq.empty, + provider: _root_.scala.Predef.String = "", + customTimeouts: _root_.scala.Option[pulumirpc.resource.RegisterResourceRequest.CustomTimeouts] = _root_.scala.None, + pluginDownloadUrl: _root_.scala.Predef.String = "", + retainOnDelete: _root_.scala.Boolean = false, + deletedWith: _root_.scala.Predef.String = "", + deleteBeforeReplace: _root_.scala.Option[_root_.scala.Boolean] = _root_.scala.None, + additionalSecretOutputs: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty, + providers: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String] = _root_.scala.collection.immutable.Map.empty, + pluginChecksums: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString] = _root_.scala.collection.immutable.Map.empty, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[TransformResourceOptions] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + dependsOn.foreach { __item => + val __value = __item + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + + { + val __value = protect + if (__value != false) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(2, __value) + } + }; + ignoreChanges.foreach { __item => + val __value = __item + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value) + } + replaceOnChanges.foreach { __item => + val __value = __item + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(4, __value) + } + + { + val __value = version + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(5, __value) + } + }; + aliases.foreach { __item => + val __value = __item + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + + { + val __value = provider + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(7, __value) + } + }; + if (customTimeouts.isDefined) { + val __value = customTimeouts.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + + { + val __value = pluginDownloadUrl + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(9, __value) + } + }; + + { + val __value = retainOnDelete + if (__value != false) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(10, __value) + } + }; + + { + val __value = deletedWith + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(11, __value) + } + }; + if (deleteBeforeReplace.isDefined) { + val __value = deleteBeforeReplace.get + __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(12, __value) + }; + additionalSecretOutputs.foreach { __item => + val __value = __item + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(13, __value) + } + providers.foreach { __item => + val __value = pulumirpc.resource.TransformResourceOptions._typemapper_providers.toBase(__item) + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + pluginChecksums.foreach { __item => + val __value = pulumirpc.resource.TransformResourceOptions._typemapper_pluginChecksums.toBase(__item) + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + dependsOn.foreach { __v => + val __m = __v + _output__.writeString(1, __m) + }; + { + val __v = protect + if (__v != false) { + _output__.writeBool(2, __v) + } + }; + ignoreChanges.foreach { __v => + val __m = __v + _output__.writeString(3, __m) + }; + replaceOnChanges.foreach { __v => + val __m = __v + _output__.writeString(4, __m) + }; + { + val __v = version + if (!__v.isEmpty) { + _output__.writeString(5, __v) + } + }; + aliases.foreach { __v => + val __m = __v + _output__.writeTag(6, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + { + val __v = provider + if (!__v.isEmpty) { + _output__.writeString(7, __v) + } + }; + customTimeouts.foreach { __v => + val __m = __v + _output__.writeTag(8, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + { + val __v = pluginDownloadUrl + if (!__v.isEmpty) { + _output__.writeString(9, __v) + } + }; + { + val __v = retainOnDelete + if (__v != false) { + _output__.writeBool(10, __v) + } + }; + { + val __v = deletedWith + if (!__v.isEmpty) { + _output__.writeString(11, __v) + } + }; + deleteBeforeReplace.foreach { __v => + val __m = __v + _output__.writeBool(12, __m) + }; + additionalSecretOutputs.foreach { __v => + val __m = __v + _output__.writeString(13, __m) + }; + providers.foreach { __v => + val __m = pulumirpc.resource.TransformResourceOptions._typemapper_providers.toBase(__v) + _output__.writeTag(14, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + pluginChecksums.foreach { __v => + val __m = pulumirpc.resource.TransformResourceOptions._typemapper_pluginChecksums.toBase(__v) + _output__.writeTag(15, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def clearDependsOn = copy(dependsOn = _root_.scala.Seq.empty) + def addDependsOn(__vs: _root_.scala.Predef.String *): TransformResourceOptions = addAllDependsOn(__vs) + def addAllDependsOn(__vs: Iterable[_root_.scala.Predef.String]): TransformResourceOptions = copy(dependsOn = dependsOn ++ __vs) + def withDependsOn(__v: _root_.scala.Seq[_root_.scala.Predef.String]): TransformResourceOptions = copy(dependsOn = __v) + def withProtect(__v: _root_.scala.Boolean): TransformResourceOptions = copy(protect = __v) + def clearIgnoreChanges = copy(ignoreChanges = _root_.scala.Seq.empty) + def addIgnoreChanges(__vs: _root_.scala.Predef.String *): TransformResourceOptions = addAllIgnoreChanges(__vs) + def addAllIgnoreChanges(__vs: Iterable[_root_.scala.Predef.String]): TransformResourceOptions = copy(ignoreChanges = ignoreChanges ++ __vs) + def withIgnoreChanges(__v: _root_.scala.Seq[_root_.scala.Predef.String]): TransformResourceOptions = copy(ignoreChanges = __v) + def clearReplaceOnChanges = copy(replaceOnChanges = _root_.scala.Seq.empty) + def addReplaceOnChanges(__vs: _root_.scala.Predef.String *): TransformResourceOptions = addAllReplaceOnChanges(__vs) + def addAllReplaceOnChanges(__vs: Iterable[_root_.scala.Predef.String]): TransformResourceOptions = copy(replaceOnChanges = replaceOnChanges ++ __vs) + def withReplaceOnChanges(__v: _root_.scala.Seq[_root_.scala.Predef.String]): TransformResourceOptions = copy(replaceOnChanges = __v) + def withVersion(__v: _root_.scala.Predef.String): TransformResourceOptions = copy(version = __v) + def clearAliases = copy(aliases = _root_.scala.Seq.empty) + def addAliases(__vs: pulumirpc.alias.Alias *): TransformResourceOptions = addAllAliases(__vs) + def addAllAliases(__vs: Iterable[pulumirpc.alias.Alias]): TransformResourceOptions = copy(aliases = aliases ++ __vs) + def withAliases(__v: _root_.scala.Seq[pulumirpc.alias.Alias]): TransformResourceOptions = copy(aliases = __v) + def withProvider(__v: _root_.scala.Predef.String): TransformResourceOptions = copy(provider = __v) + def getCustomTimeouts: pulumirpc.resource.RegisterResourceRequest.CustomTimeouts = customTimeouts.getOrElse(pulumirpc.resource.RegisterResourceRequest.CustomTimeouts.defaultInstance) + def clearCustomTimeouts: TransformResourceOptions = copy(customTimeouts = _root_.scala.None) + def withCustomTimeouts(__v: pulumirpc.resource.RegisterResourceRequest.CustomTimeouts): TransformResourceOptions = copy(customTimeouts = Option(__v)) + def withPluginDownloadUrl(__v: _root_.scala.Predef.String): TransformResourceOptions = copy(pluginDownloadUrl = __v) + def withRetainOnDelete(__v: _root_.scala.Boolean): TransformResourceOptions = copy(retainOnDelete = __v) + def withDeletedWith(__v: _root_.scala.Predef.String): TransformResourceOptions = copy(deletedWith = __v) + def getDeleteBeforeReplace: _root_.scala.Boolean = deleteBeforeReplace.getOrElse(false) + def clearDeleteBeforeReplace: TransformResourceOptions = copy(deleteBeforeReplace = _root_.scala.None) + def withDeleteBeforeReplace(__v: _root_.scala.Boolean): TransformResourceOptions = copy(deleteBeforeReplace = Option(__v)) + def clearAdditionalSecretOutputs = copy(additionalSecretOutputs = _root_.scala.Seq.empty) + def addAdditionalSecretOutputs(__vs: _root_.scala.Predef.String *): TransformResourceOptions = addAllAdditionalSecretOutputs(__vs) + def addAllAdditionalSecretOutputs(__vs: Iterable[_root_.scala.Predef.String]): TransformResourceOptions = copy(additionalSecretOutputs = additionalSecretOutputs ++ __vs) + def withAdditionalSecretOutputs(__v: _root_.scala.Seq[_root_.scala.Predef.String]): TransformResourceOptions = copy(additionalSecretOutputs = __v) + def clearProviders = copy(providers = _root_.scala.collection.immutable.Map.empty) + def addProviders(__vs: (_root_.scala.Predef.String, _root_.scala.Predef.String) *): TransformResourceOptions = addAllProviders(__vs) + def addAllProviders(__vs: Iterable[(_root_.scala.Predef.String, _root_.scala.Predef.String)]): TransformResourceOptions = copy(providers = providers ++ __vs) + def withProviders(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]): TransformResourceOptions = copy(providers = __v) + def clearPluginChecksums = copy(pluginChecksums = _root_.scala.collection.immutable.Map.empty) + def addPluginChecksums(__vs: (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString) *): TransformResourceOptions = addAllPluginChecksums(__vs) + def addAllPluginChecksums(__vs: Iterable[(_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)]): TransformResourceOptions = copy(pluginChecksums = pluginChecksums ++ __vs) + def withPluginChecksums(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]): TransformResourceOptions = copy(pluginChecksums = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => dependsOn + case 2 => { + val __t = protect + if (__t != false) __t else null + } + case 3 => ignoreChanges + case 4 => replaceOnChanges + case 5 => { + val __t = version + if (__t != "") __t else null + } + case 6 => aliases + case 7 => { + val __t = provider + if (__t != "") __t else null + } + case 8 => customTimeouts.orNull + case 9 => { + val __t = pluginDownloadUrl + if (__t != "") __t else null + } + case 10 => { + val __t = retainOnDelete + if (__t != false) __t else null + } + case 11 => { + val __t = deletedWith + if (__t != "") __t else null + } + case 12 => deleteBeforeReplace.orNull + case 13 => additionalSecretOutputs + case 14 => providers.iterator.map(pulumirpc.resource.TransformResourceOptions._typemapper_providers.toBase(_)).toSeq + case 15 => pluginChecksums.iterator.map(pulumirpc.resource.TransformResourceOptions._typemapper_pluginChecksums.toBase(_)).toSeq + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PRepeated(dependsOn.iterator.map(_root_.scalapb.descriptors.PString(_)).toVector) + case 2 => _root_.scalapb.descriptors.PBoolean(protect) + case 3 => _root_.scalapb.descriptors.PRepeated(ignoreChanges.iterator.map(_root_.scalapb.descriptors.PString(_)).toVector) + case 4 => _root_.scalapb.descriptors.PRepeated(replaceOnChanges.iterator.map(_root_.scalapb.descriptors.PString(_)).toVector) + case 5 => _root_.scalapb.descriptors.PString(version) + case 6 => _root_.scalapb.descriptors.PRepeated(aliases.iterator.map(_.toPMessage).toVector) + case 7 => _root_.scalapb.descriptors.PString(provider) + case 8 => customTimeouts.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 9 => _root_.scalapb.descriptors.PString(pluginDownloadUrl) + case 10 => _root_.scalapb.descriptors.PBoolean(retainOnDelete) + case 11 => _root_.scalapb.descriptors.PString(deletedWith) + case 12 => deleteBeforeReplace.map(_root_.scalapb.descriptors.PBoolean(_)).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 13 => _root_.scalapb.descriptors.PRepeated(additionalSecretOutputs.iterator.map(_root_.scalapb.descriptors.PString(_)).toVector) + case 14 => _root_.scalapb.descriptors.PRepeated(providers.iterator.map(pulumirpc.resource.TransformResourceOptions._typemapper_providers.toBase(_).toPMessage).toVector) + case 15 => _root_.scalapb.descriptors.PRepeated(pluginChecksums.iterator.map(pulumirpc.resource.TransformResourceOptions._typemapper_pluginChecksums.toBase(_).toPMessage).toVector) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.resource.TransformResourceOptions.type = pulumirpc.resource.TransformResourceOptions + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.TransformResourceOptions]) +} + +object TransformResourceOptions extends scalapb.GeneratedMessageCompanion[pulumirpc.resource.TransformResourceOptions] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.resource.TransformResourceOptions] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.resource.TransformResourceOptions = { + val __dependsOn: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] + var __protect: _root_.scala.Boolean = false + val __ignoreChanges: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] + val __replaceOnChanges: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] + var __version: _root_.scala.Predef.String = "" + val __aliases: _root_.scala.collection.immutable.VectorBuilder[pulumirpc.alias.Alias] = new _root_.scala.collection.immutable.VectorBuilder[pulumirpc.alias.Alias] + var __provider: _root_.scala.Predef.String = "" + var __customTimeouts: _root_.scala.Option[pulumirpc.resource.RegisterResourceRequest.CustomTimeouts] = _root_.scala.None + var __pluginDownloadUrl: _root_.scala.Predef.String = "" + var __retainOnDelete: _root_.scala.Boolean = false + var __deletedWith: _root_.scala.Predef.String = "" + var __deleteBeforeReplace: _root_.scala.Option[_root_.scala.Boolean] = _root_.scala.None + val __additionalSecretOutputs: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] + val __providers: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, _root_.scala.Predef.String), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, _root_.scala.Predef.String] + val __pluginChecksums: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString] + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __dependsOn += _input__.readStringRequireUtf8() + case 16 => + __protect = _input__.readBool() + case 26 => + __ignoreChanges += _input__.readStringRequireUtf8() + case 34 => + __replaceOnChanges += _input__.readStringRequireUtf8() + case 42 => + __version = _input__.readStringRequireUtf8() + case 50 => + __aliases += _root_.scalapb.LiteParser.readMessage[pulumirpc.alias.Alias](_input__) + case 58 => + __provider = _input__.readStringRequireUtf8() + case 66 => + __customTimeouts = _root_.scala.Option(__customTimeouts.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.RegisterResourceRequest.CustomTimeouts](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case 74 => + __pluginDownloadUrl = _input__.readStringRequireUtf8() + case 80 => + __retainOnDelete = _input__.readBool() + case 90 => + __deletedWith = _input__.readStringRequireUtf8() + case 96 => + __deleteBeforeReplace = _root_.scala.Option(_input__.readBool()) + case 106 => + __additionalSecretOutputs += _input__.readStringRequireUtf8() + case 114 => + __providers += pulumirpc.resource.TransformResourceOptions._typemapper_providers.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.TransformResourceOptions.ProvidersEntry](_input__)) + case 122 => + __pluginChecksums += pulumirpc.resource.TransformResourceOptions._typemapper_pluginChecksums.toCustom(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry](_input__)) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.resource.TransformResourceOptions( + dependsOn = __dependsOn.result(), + protect = __protect, + ignoreChanges = __ignoreChanges.result(), + replaceOnChanges = __replaceOnChanges.result(), + version = __version, + aliases = __aliases.result(), + provider = __provider, + customTimeouts = __customTimeouts, + pluginDownloadUrl = __pluginDownloadUrl, + retainOnDelete = __retainOnDelete, + deletedWith = __deletedWith, + deleteBeforeReplace = __deleteBeforeReplace, + additionalSecretOutputs = __additionalSecretOutputs.result(), + providers = __providers.result(), + pluginChecksums = __pluginChecksums.result(), + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.resource.TransformResourceOptions] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.resource.TransformResourceOptions( + dependsOn = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[_root_.scala.Predef.String]]).getOrElse(_root_.scala.Seq.empty), + protect = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Boolean]).getOrElse(false), + ignoreChanges = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Seq[_root_.scala.Predef.String]]).getOrElse(_root_.scala.Seq.empty), + replaceOnChanges = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Seq[_root_.scala.Predef.String]]).getOrElse(_root_.scala.Seq.empty), + version = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + aliases = __fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scala.Seq[pulumirpc.alias.Alias]]).getOrElse(_root_.scala.Seq.empty), + provider = __fieldsMap.get(scalaDescriptor.findFieldByNumber(7).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + customTimeouts = __fieldsMap.get(scalaDescriptor.findFieldByNumber(8).get).flatMap(_.as[_root_.scala.Option[pulumirpc.resource.RegisterResourceRequest.CustomTimeouts]]), + pluginDownloadUrl = __fieldsMap.get(scalaDescriptor.findFieldByNumber(9).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + retainOnDelete = __fieldsMap.get(scalaDescriptor.findFieldByNumber(10).get).map(_.as[_root_.scala.Boolean]).getOrElse(false), + deletedWith = __fieldsMap.get(scalaDescriptor.findFieldByNumber(11).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + deleteBeforeReplace = __fieldsMap.get(scalaDescriptor.findFieldByNumber(12).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Boolean]]), + additionalSecretOutputs = __fieldsMap.get(scalaDescriptor.findFieldByNumber(13).get).map(_.as[_root_.scala.Seq[_root_.scala.Predef.String]]).getOrElse(_root_.scala.Seq.empty), + providers = __fieldsMap.get(scalaDescriptor.findFieldByNumber(14).get).map(_.as[_root_.scala.Seq[pulumirpc.resource.TransformResourceOptions.ProvidersEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.resource.TransformResourceOptions._typemapper_providers.toCustom(_)).toMap, + pluginChecksums = __fieldsMap.get(scalaDescriptor.findFieldByNumber(15).get).map(_.as[_root_.scala.Seq[pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(pulumirpc.resource.TransformResourceOptions._typemapper_pluginChecksums.toCustom(_)).toMap + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ResourceProto.javaDescriptor.getMessageTypes().get(9) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ResourceProto.scalaDescriptor.messages(9) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 6 => __out = pulumirpc.alias.Alias + case 8 => __out = pulumirpc.resource.RegisterResourceRequest.CustomTimeouts + case 14 => __out = pulumirpc.resource.TransformResourceOptions.ProvidersEntry + case 15 => __out = pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( + _root_.pulumirpc.resource.TransformResourceOptions.ProvidersEntry, + _root_.pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry + ) + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.resource.TransformResourceOptions( + dependsOn = _root_.scala.Seq.empty, + protect = false, + ignoreChanges = _root_.scala.Seq.empty, + replaceOnChanges = _root_.scala.Seq.empty, + version = "", + aliases = _root_.scala.Seq.empty, + provider = "", + customTimeouts = _root_.scala.None, + pluginDownloadUrl = "", + retainOnDelete = false, + deletedWith = "", + deleteBeforeReplace = _root_.scala.None, + additionalSecretOutputs = _root_.scala.Seq.empty, + providers = _root_.scala.collection.immutable.Map.empty, + pluginChecksums = _root_.scala.collection.immutable.Map.empty + ) + @SerialVersionUID(0L) + final case class ProvidersEntry( + key: _root_.scala.Predef.String = "", + value: _root_.scala.Predef.String = "", + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ProvidersEntry] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = key + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = value + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = key + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = value + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withKey(__v: _root_.scala.Predef.String): ProvidersEntry = copy(key = __v) + def withValue(__v: _root_.scala.Predef.String): ProvidersEntry = copy(value = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = key + if (__t != "") __t else null + } + case 2 => { + val __t = value + if (__t != "") __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(key) + case 2 => _root_.scalapb.descriptors.PString(value) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.resource.TransformResourceOptions.ProvidersEntry.type = pulumirpc.resource.TransformResourceOptions.ProvidersEntry + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.TransformResourceOptions.ProvidersEntry]) + } + + object ProvidersEntry extends scalapb.GeneratedMessageCompanion[pulumirpc.resource.TransformResourceOptions.ProvidersEntry] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.resource.TransformResourceOptions.ProvidersEntry] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.resource.TransformResourceOptions.ProvidersEntry = { + var __key: _root_.scala.Predef.String = "" + var __value: _root_.scala.Predef.String = "" + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __key = _input__.readStringRequireUtf8() + case 18 => + __value = _input__.readStringRequireUtf8() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.resource.TransformResourceOptions.ProvidersEntry( + key = __key, + value = __value, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.resource.TransformResourceOptions.ProvidersEntry] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.resource.TransformResourceOptions.ProvidersEntry( + key = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse("") + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = pulumirpc.resource.TransformResourceOptions.javaDescriptor.getNestedTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = pulumirpc.resource.TransformResourceOptions.scalaDescriptor.nestedMessages(0) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.resource.TransformResourceOptions.ProvidersEntry( + key = "", + value = "" + ) + implicit class ProvidersEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.TransformResourceOptions.ProvidersEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.resource.TransformResourceOptions.ProvidersEntry](_l) { + def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) + def value: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.value)((c_, f_) => c_.copy(value = f_)) + } + final val KEY_FIELD_NUMBER = 1 + final val VALUE_FIELD_NUMBER = 2 + @transient + implicit val keyValueMapper: _root_.scalapb.TypeMapper[pulumirpc.resource.TransformResourceOptions.ProvidersEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)] = + _root_.scalapb.TypeMapper[pulumirpc.resource.TransformResourceOptions.ProvidersEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)](__m => (__m.key, __m.value))(__p => pulumirpc.resource.TransformResourceOptions.ProvidersEntry(__p._1, __p._2)) + def of( + key: _root_.scala.Predef.String, + value: _root_.scala.Predef.String + ): _root_.pulumirpc.resource.TransformResourceOptions.ProvidersEntry = _root_.pulumirpc.resource.TransformResourceOptions.ProvidersEntry( + key, + value + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.TransformResourceOptions.ProvidersEntry]) + } + + @SerialVersionUID(0L) + final case class PluginChecksumsEntry( + key: _root_.scala.Predef.String = "", + value: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[PluginChecksumsEntry] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = key + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) + } + }; + + { + val __value = value + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(2, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = key + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = value + if (!__v.isEmpty) { + _output__.writeBytes(2, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withKey(__v: _root_.scala.Predef.String): PluginChecksumsEntry = copy(key = __v) + def withValue(__v: _root_.com.google.protobuf.ByteString): PluginChecksumsEntry = copy(value = __v) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => { + val __t = key + if (__t != "") __t else null + } + case 2 => { + val __t = value + if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null + } + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => _root_.scalapb.descriptors.PString(key) + case 2 => _root_.scalapb.descriptors.PByteString(value) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry.type = pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.TransformResourceOptions.PluginChecksumsEntry]) + } + + object PluginChecksumsEntry extends scalapb.GeneratedMessageCompanion[pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry = { + var __key: _root_.scala.Predef.String = "" + var __value: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __key = _input__.readStringRequireUtf8() + case 18 => + __value = _input__.readBytes() + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry( + key = __key, + value = __value, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry( + key = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), + value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = pulumirpc.resource.TransformResourceOptions.javaDescriptor.getNestedTypes().get(1) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = pulumirpc.resource.TransformResourceOptions.scalaDescriptor.nestedMessages(1) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number) + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry( + key = "", + value = _root_.com.google.protobuf.ByteString.EMPTY + ) + implicit class PluginChecksumsEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry](_l) { + def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_)) + def value: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.value)((c_, f_) => c_.copy(value = f_)) + } + final val KEY_FIELD_NUMBER = 1 + final val VALUE_FIELD_NUMBER = 2 + @transient + implicit val keyValueMapper: _root_.scalapb.TypeMapper[pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)] = + _root_.scalapb.TypeMapper[pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)](__m => (__m.key, __m.value))(__p => pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry(__p._1, __p._2)) + def of( + key: _root_.scala.Predef.String, + value: _root_.com.google.protobuf.ByteString + ): _root_.pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry = _root_.pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry( + key, + value + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.TransformResourceOptions.PluginChecksumsEntry]) + } + + implicit class TransformResourceOptionsLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.TransformResourceOptions]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.resource.TransformResourceOptions](_l) { + def dependsOn: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.dependsOn)((c_, f_) => c_.copy(dependsOn = f_)) + def protect: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.protect)((c_, f_) => c_.copy(protect = f_)) + def ignoreChanges: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.ignoreChanges)((c_, f_) => c_.copy(ignoreChanges = f_)) + def replaceOnChanges: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.replaceOnChanges)((c_, f_) => c_.copy(replaceOnChanges = f_)) + def version: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.version)((c_, f_) => c_.copy(version = f_)) + def aliases: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[pulumirpc.alias.Alias]] = field(_.aliases)((c_, f_) => c_.copy(aliases = f_)) + def provider: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.provider)((c_, f_) => c_.copy(provider = f_)) + def customTimeouts: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.RegisterResourceRequest.CustomTimeouts] = field(_.getCustomTimeouts)((c_, f_) => c_.copy(customTimeouts = _root_.scala.Option(f_))) + def optionalCustomTimeouts: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.resource.RegisterResourceRequest.CustomTimeouts]] = field(_.customTimeouts)((c_, f_) => c_.copy(customTimeouts = f_)) + def pluginDownloadUrl: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.pluginDownloadUrl)((c_, f_) => c_.copy(pluginDownloadUrl = f_)) + def retainOnDelete: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.retainOnDelete)((c_, f_) => c_.copy(retainOnDelete = f_)) + def deletedWith: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.deletedWith)((c_, f_) => c_.copy(deletedWith = f_)) + def deleteBeforeReplace: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.getDeleteBeforeReplace)((c_, f_) => c_.copy(deleteBeforeReplace = _root_.scala.Option(f_))) + def optionalDeleteBeforeReplace: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[_root_.scala.Boolean]] = field(_.deleteBeforeReplace)((c_, f_) => c_.copy(deleteBeforeReplace = f_)) + def additionalSecretOutputs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.additionalSecretOutputs)((c_, f_) => c_.copy(additionalSecretOutputs = f_)) + def providers: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String]] = field(_.providers)((c_, f_) => c_.copy(providers = f_)) + def pluginChecksums: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString]] = field(_.pluginChecksums)((c_, f_) => c_.copy(pluginChecksums = f_)) + } + final val DEPENDS_ON_FIELD_NUMBER = 1 + final val PROTECT_FIELD_NUMBER = 2 + final val IGNORE_CHANGES_FIELD_NUMBER = 3 + final val REPLACE_ON_CHANGES_FIELD_NUMBER = 4 + final val VERSION_FIELD_NUMBER = 5 + final val ALIASES_FIELD_NUMBER = 6 + final val PROVIDER_FIELD_NUMBER = 7 + final val CUSTOM_TIMEOUTS_FIELD_NUMBER = 8 + final val PLUGIN_DOWNLOAD_URL_FIELD_NUMBER = 9 + final val RETAIN_ON_DELETE_FIELD_NUMBER = 10 + final val DELETED_WITH_FIELD_NUMBER = 11 + final val DELETE_BEFORE_REPLACE_FIELD_NUMBER = 12 + final val ADDITIONAL_SECRET_OUTPUTS_FIELD_NUMBER = 13 + final val PROVIDERS_FIELD_NUMBER = 14 + final val PLUGIN_CHECKSUMS_FIELD_NUMBER = 15 + @transient + private[resource] val _typemapper_providers: _root_.scalapb.TypeMapper[pulumirpc.resource.TransformResourceOptions.ProvidersEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.resource.TransformResourceOptions.ProvidersEntry, (_root_.scala.Predef.String, _root_.scala.Predef.String)]] + @transient + private[resource] val _typemapper_pluginChecksums: _root_.scalapb.TypeMapper[pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)] = implicitly[_root_.scalapb.TypeMapper[pulumirpc.resource.TransformResourceOptions.PluginChecksumsEntry, (_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString)]] + def of( + dependsOn: _root_.scala.Seq[_root_.scala.Predef.String], + protect: _root_.scala.Boolean, + ignoreChanges: _root_.scala.Seq[_root_.scala.Predef.String], + replaceOnChanges: _root_.scala.Seq[_root_.scala.Predef.String], + version: _root_.scala.Predef.String, + aliases: _root_.scala.Seq[pulumirpc.alias.Alias], + provider: _root_.scala.Predef.String, + customTimeouts: _root_.scala.Option[pulumirpc.resource.RegisterResourceRequest.CustomTimeouts], + pluginDownloadUrl: _root_.scala.Predef.String, + retainOnDelete: _root_.scala.Boolean, + deletedWith: _root_.scala.Predef.String, + deleteBeforeReplace: _root_.scala.Option[_root_.scala.Boolean], + additionalSecretOutputs: _root_.scala.Seq[_root_.scala.Predef.String], + providers: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Predef.String], + pluginChecksums: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.com.google.protobuf.ByteString] + ): _root_.pulumirpc.resource.TransformResourceOptions = _root_.pulumirpc.resource.TransformResourceOptions( + dependsOn, + protect, + ignoreChanges, + replaceOnChanges, + version, + aliases, + provider, + customTimeouts, + pluginDownloadUrl, + retainOnDelete, + deletedWith, + deleteBeforeReplace, + additionalSecretOutputs, + providers, + pluginChecksums + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.TransformResourceOptions]) +} diff --git a/core/src/main/scala/besom/rpc/pulumirpc/resource/TransformResponse.scala b/core/src/main/scala/besom/rpc/pulumirpc/resource/TransformResponse.scala new file mode 100644 index 00000000..56d8aa57 --- /dev/null +++ b/core/src/main/scala/besom/rpc/pulumirpc/resource/TransformResponse.scala @@ -0,0 +1,153 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO3 + +package pulumirpc.resource + +/** @param properties + * the transformed input properties. + * @param options + * the options for the resource. + */ +@SerialVersionUID(0L) +final case class TransformResponse( + properties: _root_.scala.Option[com.google.protobuf.struct.Struct] = _root_.scala.None, + options: _root_.scala.Option[pulumirpc.resource.TransformResourceOptions] = _root_.scala.None, + unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty + ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[TransformResponse] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + if (properties.isDefined) { + val __value = properties.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + if (options.isDefined) { + val __value = options.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size + } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + properties.foreach { __v => + val __m = __v + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + options.foreach { __v => + val __m = __v + _output__.writeTag(2, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def getProperties: com.google.protobuf.struct.Struct = properties.getOrElse(com.google.protobuf.struct.Struct.defaultInstance) + def clearProperties: TransformResponse = copy(properties = _root_.scala.None) + def withProperties(__v: com.google.protobuf.struct.Struct): TransformResponse = copy(properties = Option(__v)) + def getOptions: pulumirpc.resource.TransformResourceOptions = options.getOrElse(pulumirpc.resource.TransformResourceOptions.defaultInstance) + def clearOptions: TransformResponse = copy(options = _root_.scala.None) + def withOptions(__v: pulumirpc.resource.TransformResourceOptions): TransformResponse = copy(options = Option(__v)) + def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v) + def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty) + def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => properties.orNull + case 2 => options.orNull + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => properties.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 2 => options.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + } + } + def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: pulumirpc.resource.TransformResponse.type = pulumirpc.resource.TransformResponse + // @@protoc_insertion_point(GeneratedMessage[pulumirpc.TransformResponse]) +} + +object TransformResponse extends scalapb.GeneratedMessageCompanion[pulumirpc.resource.TransformResponse] { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.resource.TransformResponse] = this + def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.resource.TransformResponse = { + var __properties: _root_.scala.Option[com.google.protobuf.struct.Struct] = _root_.scala.None + var __options: _root_.scala.Option[pulumirpc.resource.TransformResourceOptions] = _root_.scala.None + var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __properties = _root_.scala.Option(__properties.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.struct.Struct](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case 18 => + __options = _root_.scala.Option(__options.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.resource.TransformResourceOptions](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + case tag => + if (_unknownFields__ == null) { + _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() + } + _unknownFields__.parseField(tag, _input__) + } + } + pulumirpc.resource.TransformResponse( + properties = __properties, + options = __options, + unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.resource.TransformResponse] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.") + pulumirpc.resource.TransformResponse( + properties = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.struct.Struct]]), + options = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[pulumirpc.resource.TransformResourceOptions]]) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ResourceProto.javaDescriptor.getMessageTypes().get(11) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ResourceProto.scalaDescriptor.messages(11) + def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null + (__number: @_root_.scala.unchecked) match { + case 1 => __out = com.google.protobuf.struct.Struct + case 2 => __out = pulumirpc.resource.TransformResourceOptions + } + __out + } + lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty + def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = pulumirpc.resource.TransformResponse( + properties = _root_.scala.None, + options = _root_.scala.None + ) + implicit class TransformResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.TransformResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.resource.TransformResponse](_l) { + def properties: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.struct.Struct] = field(_.getProperties)((c_, f_) => c_.copy(properties = _root_.scala.Option(f_))) + def optionalProperties: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.struct.Struct]] = field(_.properties)((c_, f_) => c_.copy(properties = f_)) + def options: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.resource.TransformResourceOptions] = field(_.getOptions)((c_, f_) => c_.copy(options = _root_.scala.Option(f_))) + def optionalOptions: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.resource.TransformResourceOptions]] = field(_.options)((c_, f_) => c_.copy(options = f_)) + } + final val PROPERTIES_FIELD_NUMBER = 1 + final val OPTIONS_FIELD_NUMBER = 2 + def of( + properties: _root_.scala.Option[com.google.protobuf.struct.Struct], + options: _root_.scala.Option[pulumirpc.resource.TransformResourceOptions] + ): _root_.pulumirpc.resource.TransformResponse = _root_.pulumirpc.resource.TransformResponse( + properties, + options + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.TransformResponse]) +} diff --git a/core/src/main/scala/besom/util/NotProvided.scala b/core/src/main/scala/besom/util/NotProvided.scala index 3d0e8e3b..6ce5a169 100644 --- a/core/src/main/scala/besom/util/NotProvided.scala +++ b/core/src/main/scala/besom/util/NotProvided.scala @@ -3,8 +3,27 @@ package besom.util sealed trait NotProvided case object NotProvided extends NotProvided -extension [A](v: A | NotProvided) - def asOption: Option[A] = - v match - case NotProvided => None - case a: A @unchecked => Some(a) +opaque type NotProvidedOr[A] >: A | NotProvided = A | NotProvided + +// we do not want to infect every type so we need this +object NotProvidedOr: + given notProvidedOrOps: {} with // keep the scope clean, no free function + extension [A](npo: NotProvidedOr[A]) + def asOption: Option[A] = + npo match + case NotProvided => None + case a: A @unchecked => Some(a) + def asEither: Either[NotProvided, A] = + npo match + case NotProvided => Left(NotProvided) + case a: A @unchecked => Right(a) + def asSeq: Seq[A] = + npo match + case NotProvided => Seq.empty + case a: A @unchecked => Seq(a) + + def map[B](f: A => B): Option[B] = asOption.map[B](f) + def flatMap[B](f: A => Option[B]): Option[B] = asOption.flatMap[B](f) + def filter(p: A => Boolean): Option[A] = asOption.filter(p) + def fold[B](ifNotProvided: => B)(f: A => B): B = asOption.fold(ifNotProvided)(f) + def bimap[B](ifNotProvided: => B)(f: A => B): Option[B] = asOption.map(f).orElse(Some(ifNotProvided)) diff --git a/core/src/main/scala/besom/util/Util.scala b/core/src/main/scala/besom/util/Util.scala new file mode 100644 index 00000000..2b2c0c8d --- /dev/null +++ b/core/src/main/scala/besom/util/Util.scala @@ -0,0 +1,11 @@ +package besom.util + +private[besom] def isTruthy(s: String): Boolean = s == "1" || s.equalsIgnoreCase("true") +private[besom] def isNotTruthy(s: String): Boolean = !isTruthy(s) + +given eitherOps: {} with + + extension [E <: Throwable, A](a: Either[E, A]) def get: A = a.fold(e => throw e, identity) + + extension [L, R](a: Either[L, R]) + def bimap[L1, R1](left: L => L1, right: R => R1): Either[L1, R1] = a.fold(l => Left(left(l)), r => Right(right(r))) diff --git a/core/src/main/scala/besom/util/printer.scala b/core/src/main/scala/besom/util/printer.scala index 5fc6d7d0..199d40e6 100644 --- a/core/src/main/scala/besom/util/printer.scala +++ b/core/src/main/scala/besom/util/printer.scala @@ -3,18 +3,31 @@ package besom.util import besom.internal.Output import pprint.* +private def escapeSpecialCharacters(input: String): String = + input.flatMap { + case '\n' => "\\n" + case '\t' => "\\t" + case '\r' => "\\r" + case '\b' => "\\b" + case '\f' => "\\f" + case '\u001B' => "\\x1b" + case ch if ch.isControl => "\\u%04x".format(ch.toInt) // other control characters + case ch => ch.toString + } + object printer extends PPrinter( defaultWidth = 140, defaultHeight = Int.MaxValue, defaultIndent = 2, - additionalHandlers = { case o: Output[?] => - Tree.Literal("Output(?)") + additionalHandlers = { + case o: Output[?] => Tree.Literal("Output(?)") + case s: String if s.nonEmpty => Tree.Literal(s"\"${escapeSpecialCharacters(s)}\"") } ): - override def treeify(x: Any): Tree = - val result = super.treeify(x) + override def treeify(x: Any, escapeUnicode: Boolean, showFieldNames: Boolean): Tree = + val result = super.treeify(x, escapeUnicode, showFieldNames) result match case Tree.Apply(p, body: Iterator[Tree]) => Tree.Apply( @@ -33,6 +46,10 @@ object printer height: Int = defaultHeight, indent: Int = defaultIndent, initialOffset: Int = 0 - ): fansi.Str = this.apply(x, width, height, indent, initialOffset) + ): fansi.Str = + try this.apply(x, width, height, indent, initialOffset) + catch + case e: Exception => + fansi.Color.Red("Error rendering: ") ++ fansi.Str(e.toString) ++ fansi.Str("\n") ++ fansi.Str(e.getStackTrace.mkString("\n")) end printer diff --git a/core/src/test/scala/besom/internal/DummyContext.scala b/core/src/test/scala/besom/internal/DummyContext.scala index 271c7c70..08d00b01 100644 --- a/core/src/test/scala/besom/internal/DummyContext.scala +++ b/core/src/test/scala/besom/internal/DummyContext.scala @@ -1,20 +1,30 @@ package besom.internal -import pulumirpc.resource.* -import pulumirpc.provider.CallRequest import pulumirpc.provider.CallResponse import pulumirpc.provider.InvokeResponse import pulumirpc.engine.* import besom.NonEmptyString import besom.internal.logging.BesomLogger import besom.util.printer +import pulumirpc.callback.Callback +import pulumirpc.resource.{ + ReadResourceRequest, + ReadResourceResponse, + RegisterResourceOutputsRequest, + RegisterResourceRequest, + RegisterResourceResponse, + ResourceCallRequest, + ResourceInvokeRequest, + SupportsFeatureRequest, + SupportsFeatureResponse +} //noinspection TypeAnnotation object DummyContext: val dummyRunInfo = RunInfo(Some("test-organization"), "test-project", "test-stack", true, 4, false, "dummy", "dummy") - val dummyFeatureSupport = FeatureSupport(true, true, true, true) + val dummyFeatureSupport = FeatureSupport(true, true, true, true, true) val dummyMonitor = new Monitor: - def call(callRequest: CallRequest): Result[CallResponse] = + def call(callRequest: ResourceCallRequest): Result[CallResponse] = Result.fail(Exception("Not implemented")) def invoke(invokeRequest: ResourceInvokeRequest): Result[InvokeResponse] = Result.fail(Exception("Not implemented")) @@ -26,6 +36,8 @@ object DummyContext: Result.fail(Exception("Not implemented")) def supportsFeature(supportsFeatureRequest: SupportsFeatureRequest): Result[SupportsFeatureResponse] = Result.fail(Exception("Not implemented")) + def registerStackTransform(request: Callback): Result[Unit] = + Result.fail(Exception("Not implemented")) def close(): Result[Unit] = Result.fail(Exception("Not implemented")) val dummyEngine = new Engine: @@ -44,15 +56,18 @@ object DummyContext: monitor: Monitor = dummyMonitor, engine: Engine = dummyEngine, configMap: Map[NonEmptyString, String] = Map.empty, - configSecretKeys: Set[NonEmptyString] = Set.empty + configSecretKeys: Set[NonEmptyString] = Set.empty, + resources: Resources | Result[Resources] = Resources() ): Result[Context] = for taskTracker <- TaskTracker() stackPromise <- Promise[StackResource]() logger <- BesomLogger.local() config <- Config(runInfo.project, isProjectName = true, configMap = configMap, configSecretKeys = configSecretKeys) - resources <- Resources() - memo <- Memo() + resources <- resources match + case r: Resources => Result.pure(r) + case r: Result[Resources] => r + memo <- Memo() given Context = Context.create(runInfo, featureSupport, config, logger, monitor, engine, taskTracker, resources, memo, stackPromise) _ <- stackPromise.fulfill(StackResource()(using ComponentBase(Output(besom.types.URN.empty)))) yield summon[Context] diff --git a/core/src/test/scala/besom/internal/ResourceDecoderTest.scala b/core/src/test/scala/besom/internal/ResourceDecoderTest.scala index 8792f176..bbc21377 100644 --- a/core/src/test/scala/besom/internal/ResourceDecoderTest.scala +++ b/core/src/test/scala/besom/internal/ResourceDecoderTest.scala @@ -281,4 +281,72 @@ class ResourceDecoderTest extends munit.FunSuite: // assertDecodingError (resource.ipAddress.map(_.map(_.fqdn)) } } + + final case class Mangled( + urn: Output[URN], + id: Output[ResourceId], + asString_ : Output[String], + toString_ : Output[String], + scala_ : Output[String] + ) extends CustomResource + object Mangled: + given resourceDecoder(using Context): ResourceDecoder[Mangled] = ResourceDecoder.derived + given decoder(using Context): Decoder[Mangled] = Decoder.customResourceDecoder + + runWithBothOutputCodecs { + test(s"mangled fields") { + val resourceDecoder = summon[ResourceDecoder[Mangled]] + + val errorOrResourceResult = Right( + RawResourceResult( + urn = URN("urn:pulumi:dev::test::test:test:Mangled::test"), + id = Some( + ResourceId.unsafeOf( + "/test/1234" + ) + ), + data = Struct( + fields = Map( + "asString" -> Value(kind = Value.Kind.StringValue(value = "test1")), + "toString" -> Value(kind = Value.Kind.StringValue(value = "test2")), + "scala" -> Value(kind = Value.Kind.StringValue(value = "test3")) + ) + ), + dependencies = Map.empty + ) + ) + + val (resource: Mangled, resourceResolver) = resourceDecoder.makeResourceAndResolver.unsafeRunSync() + resourceResolver.resolve(errorOrResourceResult).unsafeRunSync() + + checkOutput(resource.urn)( + "urn:pulumi:dev::test::test:test:Mangled::test", + expectedDependencies = Set(resource), + expectedIsSecret = false + ) + + checkOutput(resource.id)( + "/test/1234", + expectedDependencies = Set(resource), + expectedIsSecret = false + ) + + checkOutput(resource.asString_)( + "test1", + expectedDependencies = Set(resource), + expectedIsSecret = false + ) + checkOutput(resource.toString_)( + "test2", + expectedDependencies = Set(resource), + expectedIsSecret = false + ) + checkOutput(resource.scala_)( + "test3", + expectedDependencies = Set(resource), + expectedIsSecret = false + ) + } + } + end ResourceDecoderTest diff --git a/core/src/test/scala/besom/internal/ResourceOpsTest.scala b/core/src/test/scala/besom/internal/ResourceOpsTest.scala index 20a0c965..156cdd81 100644 --- a/core/src/test/scala/besom/internal/ResourceOpsTest.scala +++ b/core/src/test/scala/besom/internal/ResourceOpsTest.scala @@ -6,6 +6,7 @@ import besom.internal.RunResult.given import besom.internal.RunOutput.* import besom.internal.logging.BesomMDC import besom.internal.logging.Key.LabelKey +import besom.aliases.Output class ResourceOpsTest extends munit.FunSuite: import ResourceOpsTest.fixtures.* @@ -300,6 +301,154 @@ class ResourceOpsTest extends munit.FunSuite: assertEquals(transitiveDeps, Set(cust1Urn, cust2Urn, dep1Urn, dep2Urn, remote1Urn)) } + + test("resource provider getters") { + object syntax extends BesomSyntax + val resources = Resources().unsafeRunSync() + given Context = DummyContext(resources = resources).unsafeRunSync() + // given BesomMDC[Label] = BesomMDC[Label](LabelKey, Label.fromNameAndType("test", "pkg:test:test")) + + val providerRes = TestProviderResource( + Output( + URN( + "urn:pulumi:stack::project::provider:resources:TestProviderResource::provider" + ) + ), + Output(ResourceId("provider")), + Output("provider") + ) + + resources + .add( + providerRes, + ProviderResourceState( + CustomResourceState( + CommonResourceState( + children = Set.empty, + provider = None, + providers = Map.empty, + version = "0.0.1", + pluginDownloadUrl = "", + name = "provider", + typ = "pulumi:providers:TestProviderResource", + keepDependency = false // providers never have keepDependency set to true + ), + Output(ResourceId("provider")) + ), + ProviderType.from("pulumi:providers:TestProviderResource").getPackage + ) + ) + .unsafeRunSync() + + val cust1Urn = URN( + "urn:pulumi:stack::project::custom:resources:TestCustomResource::cust1" + ) + val cust1 = TestCustomResource(Output(cust1Urn), Output(ResourceId("cust1")), Output(1)) + + resources + .add( + cust1, + CustomResourceState( + CommonResourceState( + children = Set.empty, + provider = Some(providerRes), + providers = Map.empty, + version = "0.0.1", + pluginDownloadUrl = "", + name = "cust1", + typ = "custom:resources:TestCustomResource", + keepDependency = false // custom resources never have keepDependency set to true + ), + Output(ResourceId("cust1")) + ) + ) + .unsafeRunSync() + + val comp1Urn = URN( + "urn:pulumi:stack::project::component:resources:TestComponentResource::comp1" + ) + val compBase1 = ComponentBase( + Output(comp1Urn) + ) + + val comp1 = TestComponentResource( + Output("comp1") + )(using compBase1) + + resources + .add( + compBase1, + ComponentResourceState( + CommonResourceState( + children = Set.empty, + provider = None, + providers = Map( + "provider" -> providerRes + ), + version = "0.0.1", + pluginDownloadUrl = "", + name = "comp1", + typ = "component:resources:TestComponentResource", + keepDependency = false + ) + ) + ) + .unsafeRunSync() + + val remote1Urn = URN( + "urn:pulumi:stack::project::component:resources:TestRemoteComponentResource::remote1" + ) + + val remote1 = TestRemoteComponentResource( + Output(remote1Urn), + Output("remote1") + ) + + resources + .add( + remote1, + ComponentResourceState( + CommonResourceState( + children = Set.empty, + provider = None, + providers = Map( + "provider" -> providerRes + ), + version = "0.0.1", + pluginDownloadUrl = "", + name = "remote1", + typ = "component:resources:TestRemoteComponentResource", + keepDependency = true + ) + ) + ) + .unsafeRunSync() + + import syntax.{provider, providers} + + providerRes.provider.unsafeRunSync().get match + case Some(_) => fail("providerRes.provider should be None") + case None => + + cust1.provider.unsafeRunSync().get match + case Some(p) => + assert(p == providerRes) + case None => + fail("cust1.provider should be Some(providerRes)") + + comp1.providers.unsafeRunSync().get match + case m if m.isEmpty => + fail("comp1.providers should not be empty") + case m => + assertEquals(m, Map("provider" -> providerRes)) + + remote1.providers.unsafeRunSync().get match + case m if m.isEmpty => + fail("remote1.providers should not be empty") + case m => + assertEquals(m, Map("provider" -> providerRes)) + } + end ResourceOpsTest object ResourceOpsTest: @@ -310,4 +459,6 @@ object ResourceOpsTest: case class TestComponentResource(str: Output[String])(using ComponentBase) extends ComponentResource + case class TestProviderResource(urn: Output[URN], id: Output[ResourceId], str: Output[String]) extends ProviderResource + def prepareTransitiveDependencyResolutionTree(resources: Resources): Result[Unit] = ??? diff --git a/core/src/test/scala/besom/util/NotProvidedTest.scala b/core/src/test/scala/besom/util/NotProvidedTest.scala new file mode 100644 index 00000000..fb992d06 --- /dev/null +++ b/core/src/test/scala/besom/util/NotProvidedTest.scala @@ -0,0 +1,18 @@ +package besom.util + +class NotProvidedTest extends munit.FunSuite with CompileAssertions: + test("asOption works as expected") { + val a: NotProvidedOr[String] = NotProvided + val b: NotProvidedOr[String] = "hello" + + assertEquals(a.asOption, None) + assertEquals(b.asOption, Some("hello")) + } + + test("asOption does not infect every type") { + failsToCompile(""" + import besom.util.* + val x: String = "" + x.asOption + """) + } diff --git a/examples/aws-apigatewayv2-eventbridge/.gitignore b/examples/aws-apigatewayv2-eventbridge/.gitignore new file mode 100644 index 00000000..7da74da6 --- /dev/null +++ b/examples/aws-apigatewayv2-eventbridge/.gitignore @@ -0,0 +1,10 @@ +### Scala an JVM +*.class +*.log +.bsp +.scala-build + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +kubeconfig.json diff --git a/examples/aws-apigatewayv2-eventbridge/Main.scala b/examples/aws-apigatewayv2-eventbridge/Main.scala new file mode 100644 index 00000000..08cce51c --- /dev/null +++ b/examples/aws-apigatewayv2-eventbridge/Main.scala @@ -0,0 +1,148 @@ +import besom.* +import besom.api.aws +import besom.json.* + +@main def main = Pulumi.run { + val eventSource = "my-event-source" + + // Create an HTTP API. + val api = aws.apigatewayv2.Api( + name = "api", + aws.apigatewayv2.ApiArgs(protocolType = "HTTP") + ) + + // Create a stage and set it to deploy automatically. + val stage = aws.apigatewayv2.Stage( + name = "stage", + aws.apigatewayv2.StageArgs( + apiId = api.id, + name = pulumiStack, + autoDeploy = true + ) + ) + + // Create an event bus. + val bus = aws.cloudwatch.EventBus("bus") + + // Create an event rule to watch for events. + val rule = aws.cloudwatch.EventRule( + name = "rule", + aws.cloudwatch.EventRuleArgs( + eventBusName = bus.name, + // Specify the event pattern to watch for. + eventPattern = json"""{ "source": [$eventSource] }""".map(_.prettyPrint) + ) + ) + + // Define a policy granting API Gateway permission to publish to EventBridge. + val apiGatewayRole = aws.iam.Role( + name = "api-gateway-role", + aws.iam.RoleArgs( + assumeRolePolicy = json"""{ + "Version": "2012-10-17", + "Statement": [{ + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + }, + "Action": "sts:AssumeRole" + }] + }""".map(_.prettyPrint), + managedPolicyArns = List(aws.iam.enums.ManagedPolicy.AmazonEventBridgeFullAccess.value) + ) + ) + + // Create an API Gateway integration to forward requests to EventBridge + val integration = aws.apigatewayv2.Integration( + name = "integration", + aws.apigatewayv2.IntegrationArgs( + apiId = api.id, + // The integration type and subtype. + integrationType = "AWS_PROXY", + integrationSubtype = "EventBridge-PutEvents", + credentialsArn = apiGatewayRole.arn, + + // The body of the request to be sent to EventBridge. Note the + // event source matches pattern defined on the EventRule, and the + // Detail expression, which just forwards the body of the original + // API Gateway request (i.e., the uploaded document). + requestParameters = Map( + "EventBusName" -> bus.name, + "Source" -> eventSource, + "DetailType" -> "my-detail-type", + "Detail" -> "$request.body" + ) + ) + ) + + // Finally, define the route. + val route = aws.apigatewayv2.Route( + name = "route", + aws.apigatewayv2.RouteArgs( + apiId = api.id, + routeKey = "POST /uploads", + target = p"integrations/${integration.id}" + ) + ) + + // Create an AWS IAM role for the Lambda function + val lambdaRole = aws.iam.Role( + name = "lambdaRole", + aws.iam.RoleArgs( + assumeRolePolicy = json"""{ + "Version": "2012-10-17", + "Statement": [{ + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + }, + "Action": "sts:AssumeRole" + }] + }""".map(_.prettyPrint), + managedPolicyArns = List(aws.iam.enums.ManagedPolicy.AWSLambdaBasicExecutionRole.value) + ) + ) + + // For now, just log the event, including the uploaded document. + // That'll be enough to verify everything's working. + val lambdaCode = + """exports.handler = async (event) => { + | console.log({ source: event.source, detail: event.detail }); + |};""".stripMargin + + // Create a Lambda function handler with permission to log to CloudWatch. + val lambda = aws.lambda.Function( + name = "lambda", + aws.lambda.FunctionArgs( + role = lambdaRole.arn, + runtime = aws.lambda.enums.Runtime.NodeJS18dX, + handler = "index.handler", + code = Archive.AssetArchive(Map("index.js" -> Asset.StringAsset(lambdaCode))) + ) + ) + + // Create an EventBridge target associating the event rule with the function. + val lambdaTarget = aws.cloudwatch.EventTarget( + name = "lambda-target", + aws.cloudwatch.EventTargetArgs( + arn = lambda.arn, + rule = rule.name, + eventBusName = bus.name + ) + ) + + // Give EventBridge permission to invoke the function. + val lambdaPermission = aws.lambda.Permission( + name = "lambda-permission", + aws.lambda.PermissionArgs( + action = "lambda:InvokeFunction", + principal = "events.amazonaws.com", + function = lambda.arn, + sourceArn = rule.arn + ) + ) + + Stack(lambdaTarget, lambdaPermission, route).exports( + url = p"${api.apiEndpoint}/${stage.name}" + ) +} diff --git a/examples/aws-apigatewayv2-eventbridge/Pulumi.yaml b/examples/aws-apigatewayv2-eventbridge/Pulumi.yaml new file mode 100644 index 00000000..894f2419 --- /dev/null +++ b/examples/aws-apigatewayv2-eventbridge/Pulumi.yaml @@ -0,0 +1,3 @@ +name: aws-apigatewayv2-eventbridge +description: An example that integrates API Gateway, EventBridge, and Lambda. +runtime: scala diff --git a/examples/aws-apigatewayv2-eventbridge/README.md b/examples/aws-apigatewayv2-eventbridge/README.md new file mode 100644 index 00000000..639e2949 --- /dev/null +++ b/examples/aws-apigatewayv2-eventbridge/README.md @@ -0,0 +1,60 @@ +# API Gateway V2 to EventBridge + +This example creates an API Gateway V2 proxy integration with EventBridge and Lambda. It defines a single API Gateway +endpoint that publishes events to an EventBridge event bus, and an accompanying event rule that matches those events and +invokes a Lambda function. + +## Prerequisites + +[Follow the instructions](https://www.pulumi.com/docs/clouds/aws/get-started/begin/) +to get started with Pulumi & AWS. + +### Deploying the App + +1. Create a new stack: + + ```bash + $ pulumi stack init dev + ``` + +2. Specify an AWS region to deploy into: + + ```bash + $ pulumi config set aws:region us-west-2 + ``` + +3. In a few moments, the API Gateway instance service will be up and running and its public URL emitted as a + Pulumi [stack output](https://www.pulumi.com/docs/intro/concepts/stack/#outputs). + + ```bash + ... + Outputs: + url: "https://andchh8hg8.execute-api.us-west-2.amazonaws.com/dev" + ``` + +4. Verify the deployment with `curl` and `pulumi logs`: + + ```bash + $ curl --data '{"some-key": "some-value"}' --header "Content-Type: application/json" "$(pulumi stack output url)/uploads" + + {"Entries":[{"EventId":"cdc44763-6976-286c-9378-7cce674dff81"}],"FailedEntryCount":0} + ``` + + ```bash + $ pulumi logs --follow + + Collecting logs for stack dev since 2022-01-06T16:18:48.000-08:00. + ... + + { + source: 'my-event-source', + detail: { 'some-key': 'some-value' } + } + ``` + +5. When you're ready, destroy your stack and remove it: + + ```bash + pulumi destroy --yes + pulumi stack rm --yes + ``` diff --git a/examples/aws-apigatewayv2-eventbridge/project.scala b/examples/aws-apigatewayv2-eventbridge/project.scala new file mode 100644 index 00000000..adb777a2 --- /dev/null +++ b/examples/aws-apigatewayv2-eventbridge/project.scala @@ -0,0 +1,4 @@ +//> using scala 3.3.1 +//> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement +//> using dep org.virtuslab::besom-core:0.3.2 +//> using dep org.virtuslab::besom-aws:6.39.0-core.0.3 diff --git a/examples/aws-eks/project.scala b/examples/aws-eks/project.scala index 8e7933eb..80609fef 100644 --- a/examples/aws-eks/project.scala +++ b/examples/aws-eks/project.scala @@ -1,7 +1,7 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-awsx:2.7.0-core.0.3" -//> using dep "org.virtuslab::besom-eks:2.3.0-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-awsx:2.11.0-core.0.3" +//> using dep "org.virtuslab::besom-eks:2.6.0-core.0.3" diff --git a/examples/aws-s3-folder/project.scala b/examples/aws-s3-folder/project.scala index bcf36357..a5945a03 100644 --- a/examples/aws-s3-folder/project.scala +++ b/examples/aws-s3-folder/project.scala @@ -1,5 +1,5 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-aws:6.31.1-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-aws:6.39.0-core.0.3" diff --git a/examples/aws-secrets-manager/project.scala b/examples/aws-secrets-manager/project.scala index bcf36357..a5945a03 100644 --- a/examples/aws-secrets-manager/project.scala +++ b/examples/aws-secrets-manager/project.scala @@ -1,5 +1,5 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-aws:6.31.1-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-aws:6.39.0-core.0.3" diff --git a/examples/aws-webserver/project.scala b/examples/aws-webserver/project.scala index b6630a94..e37d784c 100644 --- a/examples/aws-webserver/project.scala +++ b/examples/aws-webserver/project.scala @@ -1,7 +1,7 @@ //> using scala 3.3.1 //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using plugin org.virtuslab::besom-compiler-plugin:0.3.1 -//> using dep org.virtuslab::besom-core:0.3.1 -//> using dep org.virtuslab::besom-aws:6.31.1-core.0.3 -//> using dep org.virtuslab::besom-tls:5.0.2-core.0.3 +//> using plugin org.virtuslab::besom-compiler-plugin:0.3.2 +//> using dep org.virtuslab::besom-core:0.3.2 +//> using dep org.virtuslab::besom-aws:6.39.0-core.0.3 +//> using dep org.virtuslab::besom-tls:5.0.3-core.0.3 diff --git a/examples/aws-wordpress-fargate-rds/Frontent.scala b/examples/aws-wordpress-fargate-rds/Frontent.scala index c8864bfd..b441df6c 100644 --- a/examples/aws-wordpress-fargate-rds/Frontent.scala +++ b/examples/aws-wordpress-fargate-rds/Frontent.scala @@ -91,7 +91,7 @@ object WebService: name = s"$name-task-policy", aws.iam.RolePolicyAttachmentArgs( role = role.name, - policyArn = "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy" + policyArn = aws.iam.enums.ManagedPolicy.AmazonECSTaskExecutionRolePolicy.value ) ) diff --git a/examples/aws-wordpress-fargate-rds/project.scala b/examples/aws-wordpress-fargate-rds/project.scala index a8953911..3826a31b 100644 --- a/examples/aws-wordpress-fargate-rds/project.scala +++ b/examples/aws-wordpress-fargate-rds/project.scala @@ -1,6 +1,6 @@ //> using scala 3.3.1 //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep org.virtuslab::besom-core:0.3.1 -//> using dep org.virtuslab::besom-aws:6.31.0-core.0.3 -//> using dep org.virtuslab::besom-awsx:2.7.0-core.0.3 -//> using dep org.virtuslab::besom-random:4.16.0-core.0.3 +//> using dep org.virtuslab::besom-core:0.3.2 +//> using dep org.virtuslab::besom-aws:6.39.0-core.0.3 +//> using dep org.virtuslab::besom-awsx:2.11.0-core.0.3 +//> using dep org.virtuslab::besom-random:4.16.2-core.0.3 diff --git a/examples/azure-aks-managed-identity/Main.scala b/examples/azure-aks-managed-identity/Main.scala index 618f18fe..8ef12a43 100644 --- a/examples/azure-aks-managed-identity/Main.scala +++ b/examples/azure-aks-managed-identity/Main.scala @@ -26,6 +26,7 @@ import besom.api.tls name = "cluster", azurenative.containerservice.ManagedClusterArgs( resourceGroupName = resourceGroup.name, + // replace "dns-prefix" with your desired DNS prefix dnsPrefix = "dns-prefix", enableRBAC = true, identity = azurenative.containerservice.inputs.ManagedClusterIdentityArgs( diff --git a/examples/azure-aks-managed-identity/project.scala b/examples/azure-aks-managed-identity/project.scala index 2194d379..2e3549ac 100644 --- a/examples/azure-aks-managed-identity/project.scala +++ b/examples/azure-aks-managed-identity/project.scala @@ -1,9 +1,8 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using plugin "org.virtuslab::besom-compiler-plugin:0.3.0-SNAPSHOT" +//> using plugin "org.virtuslab::besom-compiler-plugin:0.3.2" -//> using dep "org.virtuslab::besom-core:0.3.0-SNAPSHOT" -//> using dep "org.virtuslab::besom-azure-native:2.36.0-core.0.3-SNAPSHOT" -//> using dep "org.virtuslab::besom-tls:5.0.2-core.0.3-SNAPSHOT" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-azure-native:2.44.1-core.0.3" +//> using dep "org.virtuslab::besom-tls:5.0.3-core.0.3" -//> using repository sonatype:snapshots diff --git a/examples/azure-static-website/project.scala b/examples/azure-static-website/project.scala index e883cdcf..49819412 100644 --- a/examples/azure-static-website/project.scala +++ b/examples/azure-static-website/project.scala @@ -1,4 +1,4 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-azure-native:2.37.0-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-azure-native:2.44.1-core.0.3" diff --git a/examples/azure-webserver/project.scala b/examples/azure-webserver/project.scala index e883cdcf..49819412 100644 --- a/examples/azure-webserver/project.scala +++ b/examples/azure-webserver/project.scala @@ -1,4 +1,4 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-azure-native:2.37.0-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-azure-native:2.44.1-core.0.3" diff --git a/examples/docker-multi-container-app/infra/project.scala b/examples/docker-multi-container-app/infra/project.scala index 520ade7b..c1249204 100644 --- a/examples/docker-multi-container-app/infra/project.scala +++ b/examples/docker-multi-container-app/infra/project.scala @@ -1,5 +1,5 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-docker:4.5.3-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-docker:4.5.4-core.0.3" diff --git a/examples/gcp-cloudrun/infra/project.scala b/examples/gcp-cloudrun/infra/project.scala index 89aaff8d..11a94fd6 100644 --- a/examples/gcp-cloudrun/infra/project.scala +++ b/examples/gcp-cloudrun/infra/project.scala @@ -1,8 +1,8 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-gcp:7.19.0-core.0.3" -//> using dep "org.virtuslab::besom-docker:4.5.3-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-gcp:7.26.0-core.0.3" +//> using dep "org.virtuslab::besom-docker:4.5.4-core.0.3" //> using exclude "app/*" diff --git a/examples/gcp-gke/project.scala b/examples/gcp-gke/project.scala index bc86fd70..a4ccf3cf 100644 --- a/examples/gcp-gke/project.scala +++ b/examples/gcp-gke/project.scala @@ -1,4 +1,4 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-gcp:7.19.0-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-gcp:7.26.0-core.0.3" diff --git a/examples/gcp-static-page/project.scala b/examples/gcp-static-page/project.scala index 639b105f..63404cf2 100644 --- a/examples/gcp-static-page/project.scala +++ b/examples/gcp-static-page/project.scala @@ -1,5 +1,5 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-gcp:7.19.0-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-gcp:7.26.0-core.0.3" diff --git a/examples/gcp-webserver/project.scala b/examples/gcp-webserver/project.scala index bc86fd70..a4ccf3cf 100644 --- a/examples/gcp-webserver/project.scala +++ b/examples/gcp-webserver/project.scala @@ -1,4 +1,4 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-gcp:7.19.0-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-gcp:7.26.0-core.0.3" diff --git a/examples/kubernetes-guestbook/components/project.scala b/examples/kubernetes-guestbook/components/project.scala index cfe0c5bb..32095433 100644 --- a/examples/kubernetes-guestbook/components/project.scala +++ b/examples/kubernetes-guestbook/components/project.scala @@ -1,5 +1,5 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-kubernetes:4.11.0-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-kubernetes:4.13.1-core.0.3" //> using exclude "simple/*" diff --git a/examples/kubernetes-guestbook/simple/project.scala b/examples/kubernetes-guestbook/simple/project.scala index 723d9626..3c0729fe 100644 --- a/examples/kubernetes-guestbook/simple/project.scala +++ b/examples/kubernetes-guestbook/simple/project.scala @@ -1,5 +1,5 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-kubernetes:4.11.0-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-kubernetes:4.13.1-core.0.3" //> using exclude "components/*" diff --git a/examples/kubernetes-helm-release-wordpress/project.scala b/examples/kubernetes-helm-release-wordpress/project.scala index db556c31..ae38bdd8 100644 --- a/examples/kubernetes-helm-release-wordpress/project.scala +++ b/examples/kubernetes-helm-release-wordpress/project.scala @@ -1,4 +1,4 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-kubernetes:4.11.0-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-kubernetes:4.13.1-core.0.3" diff --git a/examples/kubernetes-nginx/project.scala b/examples/kubernetes-nginx/project.scala index cb83078d..d9d39918 100644 --- a/examples/kubernetes-nginx/project.scala +++ b/examples/kubernetes-nginx/project.scala @@ -1,5 +1,5 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-kubernetes:4.11.0-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-kubernetes:4.13.1-core.0.3" diff --git a/examples/kubernetes-yaml-crd/project.scala b/examples/kubernetes-yaml-crd/project.scala index db556c31..ae38bdd8 100644 --- a/examples/kubernetes-yaml-crd/project.scala +++ b/examples/kubernetes-yaml-crd/project.scala @@ -1,4 +1,4 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-kubernetes:4.11.0-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-kubernetes:4.13.1-core.0.3" diff --git a/examples/kubernetes-yaml/project.scala b/examples/kubernetes-yaml/project.scala index cb83078d..d9d39918 100644 --- a/examples/kubernetes-yaml/project.scala +++ b/examples/kubernetes-yaml/project.scala @@ -1,5 +1,5 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-kubernetes:4.11.0-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-kubernetes:4.13.1-core.0.3" diff --git a/experimental/project.scala b/experimental/project.scala index fe2317f6..71e8bf91 100644 --- a/experimental/project.scala +++ b/experimental/project.scala @@ -1,5 +1,5 @@ //> using scala "3.3.1" -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-kubernetes:4.11.0-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-kubernetes:4.13.1-core.0.3" //> using dep "io.github.iltotore::iron:2.5.0" diff --git a/integration-tests/integration.scala b/integration-tests/integration.scala index 497661ce..59512c5a 100644 --- a/integration-tests/integration.scala +++ b/integration-tests/integration.scala @@ -12,7 +12,7 @@ case object LocalOnly extends munit.Tag("LocalOnly") val javaVersion = Config.DefaultJavaVersion val scalaVersion = Config.DefaultScalaVersion -val coreVersion = Version.besomVersion +val coreVersion = Config.DefaultBesomVersion val scalaPluginVersion = coreVersion val languagePluginDir = os.pwd / ".out" / "language-plugin" diff --git a/integration-tests/project.scala b/integration-tests/project.scala index f505c25d..307f595d 100644 --- a/integration-tests/project.scala +++ b/integration-tests/project.scala @@ -2,7 +2,7 @@ //> using exclude "*/resources/*" -//> using dep org.virtuslab::besom-codegen:0.3.1 -//> using dep org.virtuslab::besom-scripts:0.3.1 +//> using dep org.virtuslab::besom-codegen:0.3.2 +//> using dep org.virtuslab::besom-scripts:0.3.2 //> using dep org.scalameta::munit::1.0.0-M10 diff --git a/integration-tests/resources/cats-purrl-example/project.scala b/integration-tests/resources/cats-purrl-example/project.scala index b164a851..971abd9d 100644 --- a/integration-tests/resources/cats-purrl-example/project.scala +++ b/integration-tests/resources/cats-purrl-example/project.scala @@ -1,7 +1,7 @@ //> using scala 3.3.1 //> using options -java-output-version:11 -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using plugin org.virtuslab::besom-compiler-plugin:0.3.1 -//> using dep org.virtuslab::besom-core:0.3.1 +//> using plugin org.virtuslab::besom-compiler-plugin:0.3.2 +//> using dep org.virtuslab::besom-core:0.3.2 -//> using dep org.virtuslab::besom-cats:0.3.1 +//> using dep org.virtuslab::besom-cats:0.3.2 //> using dep "org.virtuslab::besom-purrl:0.5.0-core.0.3" diff --git a/integration-tests/resources/compiler-plugin/project.scala b/integration-tests/resources/compiler-plugin/project.scala index c67a7652..b5f27eab 100644 --- a/integration-tests/resources/compiler-plugin/project.scala +++ b/integration-tests/resources/compiler-plugin/project.scala @@ -1,5 +1,5 @@ //> using scala 3.3.1 //> using options -java-output-version:11 -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using plugin org.virtuslab::besom-compiler-plugin:0.3.1 -//> using dep org.virtuslab::besom-core:0.3.1 +//> using plugin org.virtuslab::besom-compiler-plugin:0.3.2 +//> using dep org.virtuslab::besom-core:0.3.2 diff --git a/integration-tests/resources/config-example/project.scala b/integration-tests/resources/config-example/project.scala index c67a7652..b5f27eab 100644 --- a/integration-tests/resources/config-example/project.scala +++ b/integration-tests/resources/config-example/project.scala @@ -1,5 +1,5 @@ //> using scala 3.3.1 //> using options -java-output-version:11 -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using plugin org.virtuslab::besom-compiler-plugin:0.3.1 -//> using dep org.virtuslab::besom-core:0.3.1 +//> using plugin org.virtuslab::besom-compiler-plugin:0.3.2 +//> using dep org.virtuslab::besom-core:0.3.2 diff --git a/integration-tests/resources/executors/gradle/build.gradle.kts b/integration-tests/resources/executors/gradle/build.gradle.kts index 6c753e5f..cdbca5ec 100644 --- a/integration-tests/resources/executors/gradle/build.gradle.kts +++ b/integration-tests/resources/executors/gradle/build.gradle.kts @@ -10,7 +10,7 @@ repositories { dependencies { implementation("org.scala-lang:scala3-library_3:3.3.1") - implementation("org.virtuslab:besom-core_3:0.3.1") + implementation("org.virtuslab:besom-core_3:0.3.2") implementation("org.virtuslab:besom-fake-standard-resource_3:1.2.3-TEST") implementation("org.virtuslab:besom-fake-external-resource_3:2.3.4-TEST") if (project.hasProperty("besomBootstrapJar")) runtimeOnly(files(project.property("besomBootstrapJar") as String)) diff --git a/integration-tests/resources/executors/maven/pom.xml b/integration-tests/resources/executors/maven/pom.xml index 3d989164..e3276155 100644 --- a/integration-tests/resources/executors/maven/pom.xml +++ b/integration-tests/resources/executors/maven/pom.xml @@ -26,7 +26,7 @@ org.virtuslab besom-bootstrap_3 - 0.3.1 + 0.3.2 system ${besomBootstrapJar} @@ -38,12 +38,12 @@ org.scala-lang scala3-library_3 - 3.3.1 + 3.3.3 org.virtuslab besom-core_3 - 0.3.1 + 0.3.2 org.virtuslab diff --git a/integration-tests/resources/executors/sbt/build.sbt b/integration-tests/resources/executors/sbt/build.sbt index 68b1b918..b750f37f 100644 --- a/integration-tests/resources/executors/sbt/build.sbt +++ b/integration-tests/resources/executors/sbt/build.sbt @@ -5,7 +5,7 @@ lazy val root = project scalacOptions ++= Seq("-java-output-version", "11"), javacOptions in (Compile, compile) ++= Seq("-source", "11", "-target", "11"), libraryDependencies ++= Seq( - "org.virtuslab" %% "besom-core" % "0.3.1", + "org.virtuslab" %% "besom-core" % "0.3.2", "org.virtuslab" %% "besom-fake-standard-resource" % "1.2.3-TEST", "org.virtuslab" %% "besom-fake-external-resource" % "2.3.4-TEST" ) diff --git a/integration-tests/resources/executors/scala-cli/project.scala b/integration-tests/resources/executors/scala-cli/project.scala index ca23be45..f741e438 100644 --- a/integration-tests/resources/executors/scala-cli/project.scala +++ b/integration-tests/resources/executors/scala-cli/project.scala @@ -1,6 +1,6 @@ //> using scala 3.3.1 //> using options -java-output-version:11 -//> using plugin "org.virtuslab::besom-compiler-plugin:0.3.1" -//> using dep "org.virtuslab::besom-core:0.3.1" +//> using plugin "org.virtuslab::besom-compiler-plugin:0.3.2" +//> using dep "org.virtuslab::besom-core:0.3.2" //> using dep "org.virtuslab::besom-fake-standard-resource:1.2.3-TEST" //> using dep "org.virtuslab::besom-fake-external-resource:2.3.4-TEST" diff --git a/integration-tests/resources/kubernetes-secrets/project.scala b/integration-tests/resources/kubernetes-secrets/project.scala index 4d256345..9c257861 100644 --- a/integration-tests/resources/kubernetes-secrets/project.scala +++ b/integration-tests/resources/kubernetes-secrets/project.scala @@ -1,6 +1,6 @@ //> using scala 3.3.1 //> using options -java-output-version:11 -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using plugin org.virtuslab::besom-compiler-plugin:0.3.1 -//> using dep org.virtuslab::besom-core:0.3.1 +//> using plugin org.virtuslab::besom-compiler-plugin:0.3.2 +//> using dep org.virtuslab::besom-core:0.3.2 -//> using dep "org.virtuslab::besom-kubernetes:4.11.0-core.0.3" +//> using dep "org.virtuslab::besom-kubernetes:4.13.1-core.0.3" diff --git a/integration-tests/resources/logger-example/project.scala b/integration-tests/resources/logger-example/project.scala index c67a7652..b5f27eab 100644 --- a/integration-tests/resources/logger-example/project.scala +++ b/integration-tests/resources/logger-example/project.scala @@ -1,5 +1,5 @@ //> using scala 3.3.1 //> using options -java-output-version:11 -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using plugin org.virtuslab::besom-compiler-plugin:0.3.1 -//> using dep org.virtuslab::besom-core:0.3.1 +//> using plugin org.virtuslab::besom-compiler-plugin:0.3.2 +//> using dep org.virtuslab::besom-core:0.3.2 diff --git a/integration-tests/resources/memoization/source-stack/project.scala b/integration-tests/resources/memoization/source-stack/project.scala index da78e034..b13854f5 100644 --- a/integration-tests/resources/memoization/source-stack/project.scala +++ b/integration-tests/resources/memoization/source-stack/project.scala @@ -1,6 +1,6 @@ //> using scala 3.3.1 //> using options -java-output-version:11 -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using plugin org.virtuslab::besom-compiler-plugin:0.3.1 -//> using dep org.virtuslab::besom-core:0.3.1 +//> using plugin org.virtuslab::besom-compiler-plugin:0.3.2 +//> using dep org.virtuslab::besom-core:0.3.2 -//> using dep "org.virtuslab::besom-tls:5.0.2-core.0.3" +//> using dep "org.virtuslab::besom-tls:5.0.3-core.0.3" diff --git a/integration-tests/resources/memoization/target-stack/project.scala b/integration-tests/resources/memoization/target-stack/project.scala index c67a7652..b5f27eab 100644 --- a/integration-tests/resources/memoization/target-stack/project.scala +++ b/integration-tests/resources/memoization/target-stack/project.scala @@ -1,5 +1,5 @@ //> using scala 3.3.1 //> using options -java-output-version:11 -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using plugin org.virtuslab::besom-compiler-plugin:0.3.1 -//> using dep org.virtuslab::besom-core:0.3.1 +//> using plugin org.virtuslab::besom-compiler-plugin:0.3.2 +//> using dep org.virtuslab::besom-core:0.3.2 diff --git a/integration-tests/resources/random-example/project.scala b/integration-tests/resources/random-example/project.scala index df960214..edecd415 100644 --- a/integration-tests/resources/random-example/project.scala +++ b/integration-tests/resources/random-example/project.scala @@ -1,6 +1,6 @@ //> using scala 3.3.1 //> using options -java-output-version:11 -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using plugin org.virtuslab::besom-compiler-plugin:0.3.1 -//> using dep org.virtuslab::besom-core:0.3.1 +//> using plugin org.virtuslab::besom-compiler-plugin:0.3.2 +//> using dep org.virtuslab::besom-core:0.3.2 -//> using dep "org.virtuslab::besom-random:4.16.1-core.0.3" +//> using dep "org.virtuslab::besom-random:4.16.2-core.0.3" diff --git a/integration-tests/resources/references/source-stack/project.scala b/integration-tests/resources/references/source-stack/project.scala index da78e034..b13854f5 100644 --- a/integration-tests/resources/references/source-stack/project.scala +++ b/integration-tests/resources/references/source-stack/project.scala @@ -1,6 +1,6 @@ //> using scala 3.3.1 //> using options -java-output-version:11 -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using plugin org.virtuslab::besom-compiler-plugin:0.3.1 -//> using dep org.virtuslab::besom-core:0.3.1 +//> using plugin org.virtuslab::besom-compiler-plugin:0.3.2 +//> using dep org.virtuslab::besom-core:0.3.2 -//> using dep "org.virtuslab::besom-tls:5.0.2-core.0.3" +//> using dep "org.virtuslab::besom-tls:5.0.3-core.0.3" diff --git a/integration-tests/resources/references/target-stack/project.scala b/integration-tests/resources/references/target-stack/project.scala index c67a7652..b5f27eab 100644 --- a/integration-tests/resources/references/target-stack/project.scala +++ b/integration-tests/resources/references/target-stack/project.scala @@ -1,5 +1,5 @@ //> using scala 3.3.1 //> using options -java-output-version:11 -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using plugin org.virtuslab::besom-compiler-plugin:0.3.1 -//> using dep org.virtuslab::besom-core:0.3.1 +//> using plugin org.virtuslab::besom-compiler-plugin:0.3.2 +//> using dep org.virtuslab::besom-core:0.3.2 diff --git a/integration-tests/resources/tls-example/project.scala b/integration-tests/resources/tls-example/project.scala index da78e034..b13854f5 100644 --- a/integration-tests/resources/tls-example/project.scala +++ b/integration-tests/resources/tls-example/project.scala @@ -1,6 +1,6 @@ //> using scala 3.3.1 //> using options -java-output-version:11 -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using plugin org.virtuslab::besom-compiler-plugin:0.3.1 -//> using dep org.virtuslab::besom-core:0.3.1 +//> using plugin org.virtuslab::besom-compiler-plugin:0.3.2 +//> using dep org.virtuslab::besom-core:0.3.2 -//> using dep "org.virtuslab::besom-tls:5.0.2-core.0.3" +//> using dep "org.virtuslab::besom-tls:5.0.3-core.0.3" diff --git a/integration-tests/resources/zio-tls-example/project.scala b/integration-tests/resources/zio-tls-example/project.scala index f5984916..2e7ddc12 100644 --- a/integration-tests/resources/zio-tls-example/project.scala +++ b/integration-tests/resources/zio-tls-example/project.scala @@ -1,7 +1,7 @@ //> using scala 3.3.1 //> using options -java-output-version:11 -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using plugin org.virtuslab::besom-compiler-plugin:0.3.1 -//> using dep org.virtuslab::besom-core:0.3.1 +//> using plugin org.virtuslab::besom-compiler-plugin:0.3.2 +//> using dep org.virtuslab::besom-core:0.3.2 -//> using dep org.virtuslab::besom-zio:0.3.1 -//> using dep "org.virtuslab::besom-tls:5.0.2-core.0.3" +//> using dep org.virtuslab::besom-zio:0.3.2 +//> using dep "org.virtuslab::besom-tls:5.0.3-core.0.3" diff --git a/language-plugin/bootstrap/project.scala b/language-plugin/bootstrap/project.scala index 284cdda2..1fca8dd3 100644 --- a/language-plugin/bootstrap/project.scala +++ b/language-plugin/bootstrap/project.scala @@ -1,6 +1,6 @@ //> using scala 3.3.1 //> using options -java-output-version:11 -//> using dep org.virtuslab::besom-json:0.3.1 +//> using dep org.virtuslab::besom-json:0.3.2 //> using dep io.github.classgraph:classgraph:4.8.165 diff --git a/language-plugin/pulumi-language-scala/executors/executor_scala_cli.go b/language-plugin/pulumi-language-scala/executors/executor_scala_cli.go index abb818f2..4a510741 100644 --- a/language-plugin/pulumi-language-scala/executors/executor_scala_cli.go +++ b/language-plugin/pulumi-language-scala/executors/executor_scala_cli.go @@ -3,6 +3,8 @@ package executors import ( + "os" + "github.com/virtuslab/besom/language-host/fsys" ) @@ -23,12 +25,13 @@ func (s scalacli) NewScalaExecutor(opts ScalaExecutorOptions) (*ScalaExecutor, e } func (scalacli) newScalaCliExecutor(cmd string, bootstrapLibJarPath string) (*ScalaExecutor, error) { + scalaCliOpts := os.Getenv("BESOM_LANGHOST_SCALA_CLI_OPTS") return &ScalaExecutor{ Name: "scala-cli", Cmd: cmd, - BuildArgs: []string{"compile", "."}, - RunArgs: []string{"run", "."}, - PluginArgs: []string{"run", ".", "--jar", bootstrapLibJarPath, "--main-class", "besom.bootstrap.PulumiPluginsDiscoverer"}, + BuildArgs: []string{"compile", ".", scalaCliOpts}, + RunArgs: []string{"run", ".", scalaCliOpts}, + PluginArgs: []string{"run", ".", scalaCliOpts, "--jar", bootstrapLibJarPath, "--main-class", "besom.bootstrap.PulumiPluginsDiscoverer"}, VersionArgs: []string{"version", "--cli", "--offline"}, }, nil } diff --git a/proto/pulumi/callback.proto b/proto/pulumi/callback.proto new file mode 100644 index 00000000..76e3d05b --- /dev/null +++ b/proto/pulumi/callback.proto @@ -0,0 +1,44 @@ +// Copyright 2016-2023, Pulumi Corporation. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package pulumirpc; + +option go_package = "github.com/pulumi/pulumi/sdk/v3/proto/go;pulumirpc"; + +// Callbacks is a service for invoking functions in one runtime from other processes. +service Callbacks { + // Invoke invokes a given callback, identified by its token. + rpc Invoke(CallbackInvokeRequest) returns (CallbackInvokeResponse) {} +} + +message Callback { + // the gRPC target of the callback service. + string target = 1; + // the service specific unique token for this callback. + string token = 2; +} + +message CallbackInvokeRequest { + // the token for the callback. + string token = 1; + // the serialized protobuf message of the arguments for this callback. + bytes request = 2; +} + +message CallbackInvokeResponse { + // the serialized protobuf message of the response for this callback. + bytes response = 1; +} diff --git a/proto/pulumi/codegen/hcl.proto b/proto/pulumi/codegen/hcl.proto new file mode 100644 index 00000000..fdeafc4d --- /dev/null +++ b/proto/pulumi/codegen/hcl.proto @@ -0,0 +1,89 @@ +// Copyright 2016-2023, Pulumi Corporation. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package pulumirpc.codegen; + +option go_package = "github.com/pulumi/pulumi/sdk/v3/proto/go/codegen"; + +// Pos represents a single position in a source file, by addressing the start byte of a unicode character +// encoded in UTF-8. +message Pos { + // Line is the source code line where this position points. Lines are counted starting at 1 and + // incremented for each newline character encountered. + int64 line = 1; + + // Column is the source code column where this position points, in unicode characters, with counting + // starting at 1. + // + // Column counts characters as they appear visually, so for example a latin letter with a combining + // diacritic mark counts as one character. This is intended for rendering visual markers against source + // code in contexts where these diacritics would be rendered in a single character cell. Technically + // speaking, Column is counting grapheme clusters as used in unicode normalization. + int64 column = 2; + + // Byte is the byte offset into the file where the indicated character begins. This is a zero-based offset + // to the first byte of the first UTF-8 codepoint sequence in the character, and thus gives a position + // that can be resolved _without_ awareness of Unicode characters. + int64 byte = 3; +} + +// Range represents a span of characters between two positions in a source file. +message Range { + // Filename is the name of the file into which this range's positions point. + string filename = 1; + + // Start and End represent the bounds of this range. Start is inclusive and End is exclusive. + Pos start = 2; + Pos end = 3; +} + +// DiagnosticSeverity is the severity level of a diagnostic message. +enum DiagnosticSeverity { + // DIAG_INVALID is the invalid zero value of DiagnosticSeverity + DIAG_INVALID = 0; + // DIAG_ERROR indicates that the problem reported by a diagnostic prevents + // further progress in parsing and/or evaluating the subject. + DIAG_ERROR = 1; + // DIAG_WARNING indicates that the problem reported by a diagnostic warrants + // user attention but does not prevent further progress. It is most + // commonly used for showing deprecation notices. + DIAG_WARNING = 2; +} + +// Diagnostic represents information to be presented to a user about an error or anomaly in parsing or evaluating configuration. +message Diagnostic { + DiagnosticSeverity severity = 1; + + // Summary and Detail contain the English-language description of the + // problem. Summary is a terse description of the general problem and + // detail is a more elaborate, often-multi-sentence description of + // the problem and what might be done to solve it. + string summary = 2; + string detail = 3; + + // Subject and Context are both source ranges relating to the diagnostic. + // + // Subject is a tight range referring to exactly the construct that + // is problematic, while Context is an optional broader range (which should + // fully contain Subject) that ought to be shown around Subject when + // generating isolated source-code snippets in diagnostic messages. + // If Context is nil, the Subject is also the Context. + // + // Some diagnostics have no source ranges at all. If Context is set then + // Subject should always also be set. + Range subject = 4; + Range context = 5; +} \ No newline at end of file diff --git a/proto/pulumi/language.proto b/proto/pulumi/language.proto new file mode 100644 index 00000000..8116cddb --- /dev/null +++ b/proto/pulumi/language.proto @@ -0,0 +1,233 @@ +// Copyright 2016-2023, Pulumi Corporation. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "pulumi/codegen/hcl.proto"; +import "pulumi/plugin.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/struct.proto"; + +package pulumirpc; + +option go_package = "github.com/pulumi/pulumi/sdk/v3/proto/go;pulumirpc"; + +// LanguageRuntime is the interface that the planning monitor uses to drive execution of an interpreter responsible +// for confguring and creating resource objects. +service LanguageRuntime { + // GetRequiredPlugins computes the complete set of anticipated plugins required by a program. + rpc GetRequiredPlugins(GetRequiredPluginsRequest) returns (GetRequiredPluginsResponse) {} + // Run executes a program and returns its result. + rpc Run(RunRequest) returns (RunResponse) {} + // GetPluginInfo returns generic information about this plugin, like its version. + rpc GetPluginInfo(google.protobuf.Empty) returns (PluginInfo) {} + + // InstallDependencies will install dependencies for the project, e.g. by running `npm install` for nodejs projects. + rpc InstallDependencies(InstallDependenciesRequest) returns (stream InstallDependenciesResponse) {} + + // About returns information about the runtime for this language. + rpc About(google.protobuf.Empty) returns (AboutResponse) {} + + // GetProgramDependencies returns the set of dependencies required by the program. + rpc GetProgramDependencies(GetProgramDependenciesRequest) returns (GetProgramDependenciesResponse) {} + + // RunPlugin executes a plugin program and returns its result asynchronously. + rpc RunPlugin(RunPluginRequest) returns (stream RunPluginResponse) {} + + // GenerateProgram generates a given PCL program into a program for this language. + rpc GenerateProgram(GenerateProgramRequest) returns (GenerateProgramResponse) {} + + // GenerateProject generates a given PCL program into a project for this language. + rpc GenerateProject(GenerateProjectRequest) returns (GenerateProjectResponse) {} + + // GeneratePackage generates a given pulumi package into a package for this language. + rpc GeneratePackage(GeneratePackageRequest) returns (GeneratePackageResponse) {} + + // Pack packs a package into a language specific artifact. + rpc Pack(PackRequest) returns (PackResponse) {} +} + +// ProgramInfo are the common set of options that a language runtime needs to execute or query a program. This +// is filled in by the engine based on where the `Pulumi.yaml` file was, the `runtime.options` property, and +// the `main` property. +message ProgramInfo { + // the root of the project, where the `Pulumi.yaml` file is located. + string root_directory = 1; + // the absolute path to the directory of the program to execute. Generally, but not required to be, + // underneath the root directory. + string program_directory = 2; + // the entry point of the program, normally '.' meaning to just use the program directory, but can also be + // a filename inside the program directory. How that filename is interpreted, if at all, is language + // specific. + string entry_point = 3; + // JSON style options from the `Pulumi.yaml` runtime options section. + google.protobuf.Struct options = 4; +} + +// AboutResponse returns runtime information about the language. +message AboutResponse { + string executable = 1; // the primary executable for the runtime of this language. + string version = 2; // the version of the runtime for this language. + map metadata = 3; // other information about this language. +} + +message GetProgramDependenciesRequest { + string project = 1 [deprecated = true]; // the project name, the engine always sets this to "deprecated" now. + string pwd = 2 [deprecated = true]; // the program's working directory. + string program = 3 [deprecated = true]; // the path to the program. + bool transitiveDependencies = 4; // if transitive dependencies should be included in the result. + ProgramInfo info = 5; // the program info to use to calculate dependencies. +} + +message DependencyInfo { + string name = 1; // The name of the dependency. + string version = 2; // The version of the dependency. +} + +message GetProgramDependenciesResponse { + repeated DependencyInfo dependencies = 1; // the dependencies of this program +} + +message GetRequiredPluginsRequest { + string project = 1 [deprecated = true]; // the project name, the engine always sets this to "deprecated" now. + string pwd = 2 [deprecated = true]; // the program's working directory. + string program = 3 [deprecated = true]; // the path to the program. + ProgramInfo info = 4; // the program info to use to calculate plugins. +} + +message GetRequiredPluginsResponse { + repeated PluginDependency plugins = 1; // a list of plugins required by this program. +} + +// RunRequest asks the interpreter to execute a program. +message RunRequest { + string project = 1; // the project name. + string stack = 2; // the name of the stack being deployed into. + string pwd = 3; // the program's working directory. + string program = 4 [deprecated = true]; // the path to the program to execute. + repeated string args = 5; // any arguments to pass to the program. + map config = 6; // the configuration variables to apply before running. + bool dryRun = 7; // true if we're only doing a dryrun (preview). + int32 parallel = 8; // the degree of parallelism for resource operations (<=1 for serial). + string monitor_address = 9; // the address for communicating back to the resource monitor. + bool queryMode = 10; // true if we're only doing a query. + repeated string configSecretKeys = 11; // the configuration keys that have secret values. + string organization = 12; // the organization of the stack being deployed into. + google.protobuf.Struct configPropertyMap = 13; // the configuration variables to apply before running. + ProgramInfo info = 14; // the program info to use to execute the program. +} + +// RunResponse is the response back from the interpreter/source back to the monitor. +message RunResponse { + // An unhandled error if any occurred. + string error = 1; + + // An error happened. And it was reported to the user. Work should stop immediately + // with nothing further to print to the user. This corresponds to a "result.Bail()" + // value in the 'go' layer. + bool bail = 2; +} + +message InstallDependenciesRequest { + string directory = 1 [deprecated = true]; // the program's working directory. + bool is_terminal = 2; // if we are running in a terminal and should use ANSI codes + ProgramInfo info = 3; // the program info to use to execute the plugin. +} + +message InstallDependenciesResponse { + bytes stdout = 1; // a line of stdout text. + bytes stderr = 2; // a line of stderr text. +} + +message RunPluginRequest{ + string pwd = 1; // the program's working directory. + string program = 2 [deprecated = true]; // the path to the program to execute. + repeated string args = 3; // any arguments to pass to the program. + repeated string env = 4; // any environment variables to set as part of the program. + ProgramInfo info = 5; // the program info to use to execute the plugin. +} + +message RunPluginResponse { + oneof output { + bytes stdout = 1; // a line of stdout text. + bytes stderr = 2; // a line of stderr text. + int32 exitcode = 3; // the exit code of the provider. + } +} + +message GenerateProgramRequest { + // the PCL source of the project. + map source = 1; + // The target of a codegen.LoaderServer to use for loading schemas. + string loader_target = 2; +} + +message GenerateProgramResponse { + // any diagnostics from code generation. + repeated pulumirpc.codegen.Diagnostic diagnostics = 1; + // the generated program source code. + map source = 2; +} + +message GenerateProjectRequest { + // the directory to generate the project from. + string source_directory = 1; + // the directory to generate the project in. + string target_directory = 2; + // the JSON-encoded pulumi project file. + string project = 3; + // if PCL binding should be strict or not. + bool strict = 4; + // The target of a codegen.LoaderServer to use for loading schemas. + string loader_target = 5; + // local dependencies to use instead of using the package system. This is a map of package name to a local + // path of a language specific artifact to use for the SDK for that package. + map local_dependencies = 6; +} + +message GenerateProjectResponse { + // any diagnostics from code generation. + repeated pulumirpc.codegen.Diagnostic diagnostics = 1; +} + +message GeneratePackageRequest { + // the directory to generate the package in. + string directory = 1; + // the JSON-encoded schema. + string schema = 2; + // extra files to copy to the package output. + map extra_files = 3; + // The target of a codegen.LoaderServer to use for loading schemas. + string loader_target = 4; + // local dependencies to use instead of using the package system. This is a map of package name to a local + // path of a language specific artifact to use for the SDK for that package. + map local_dependencies = 5; +} + +message GeneratePackageResponse { + // any diagnostics from code generation. + repeated pulumirpc.codegen.Diagnostic diagnostics = 1; +} + +message PackRequest { + // the directory of a package to pack. + string package_directory = 1; + // the directory to write the packed artifact to. + string destination_directory = 2; +} + +message PackResponse { + // the full path of the packed artifact. + string artifact_path = 1; +} diff --git a/proto/pulumi/provider.proto b/proto/pulumi/provider.proto index a989e5c7..ef82671e 100644 --- a/proto/pulumi/provider.proto +++ b/proto/pulumi/provider.proto @@ -17,7 +17,6 @@ syntax = "proto3"; import "pulumi/plugin.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/struct.proto"; -import "pulumi/source.proto"; package pulumirpc; @@ -146,13 +145,15 @@ message CallRequest { repeated string urns = 1; // A list of URNs this argument depends on. } + // We used to send CallRequest for both provider calls and monitor calls, despite them being different. + // We've now split them but need to make sure we don't confuse any old plugins/monitors making sure those + // fields don't get reused. + reserved 4, 5, 13, 16, 15; + reserved "provider", "version", "pluginDownloadURL", "pluginChecksums", "sourcePosition"; + string tok = 1; // the function token to invoke. google.protobuf.Struct args = 2; // the arguments for the function invocation. map argDependencies = 3; // a map from argument keys to the dependencies of the argument. - string provider = 4; // an optional reference to the provider to use for this invoke. - string version = 5; // the version of the provider to use when servicing this request. - string pluginDownloadURL = 13; // the pluginDownloadURL of the provider to use when servicing this request. - map pluginChecksums = 16; // a map of checksums of the provider to use when servicing this request. string project = 6; // the project name. string stack = 7; // the name of the stack being deployed into. @@ -163,7 +164,7 @@ message CallRequest { string monitorEndpoint = 12; // the address for communicating back to the resource monitor. string organization = 14; // the organization of the stack being deployed into. - SourcePosition sourcePosition = 15; // the optional source position of the user code that initiated the call. + bool accepts_output_values = 17; // the engine can be passed output values back, returnDependencies can be left blank if returning output values. } message CallResponse { @@ -378,6 +379,8 @@ message ConstructRequest { repeated string ignoreChanges = 22; // properties that should be ignored during a diff repeated string replaceOnChanges = 23; // properties that, when changed, trigger a replacement bool retainOnDelete = 24; // whether to retain the resource in the cloud provider when it is deleted + + bool accepts_output_values = 25; // the engine can be passed output values back, stateDependencies can be left blank if returning output values. } message ConstructResponse { diff --git a/proto/pulumi/resource.proto b/proto/pulumi/resource.proto index e6edd14f..6d428e68 100644 --- a/proto/pulumi/resource.proto +++ b/proto/pulumi/resource.proto @@ -19,6 +19,7 @@ import "google/protobuf/struct.proto"; import "pulumi/provider.proto"; import "pulumi/alias.proto"; import "pulumi/source.proto"; +import "pulumi/callback.proto"; package pulumirpc; @@ -29,10 +30,12 @@ service ResourceMonitor { rpc SupportsFeature(SupportsFeatureRequest) returns (SupportsFeatureResponse) {} rpc Invoke(ResourceInvokeRequest) returns (InvokeResponse) {} rpc StreamInvoke(ResourceInvokeRequest) returns (stream InvokeResponse) {} - rpc Call(CallRequest) returns (CallResponse) {} + rpc Call(ResourceCallRequest) returns (CallResponse) {} rpc ReadResource(ReadResourceRequest) returns (ReadResourceResponse) {} rpc RegisterResource(RegisterResourceRequest) returns (RegisterResourceResponse) {} rpc RegisterResourceOutputs(RegisterResourceOutputsRequest) returns (google.protobuf.Empty) {} + + rpc RegisterStackTransform(Callback) returns (google.protobuf.Empty) {} } // SupportsFeatureRequest allows a client to test if the resource monitor supports a certain feature, which it may use @@ -134,6 +137,15 @@ message RegisterResourceRequest { bool aliasSpecs = 28; SourcePosition sourcePosition = 29; // the optional source position of the user code that initiated the register. + + repeated Callback transforms = 31; // a list of transforms to apply to the resource before registering it. + bool supportsResultReporting = 32; // true if the request is from an SDK that supports the result field in the response. +} + +enum Result { + SUCCESS = 0; + FAIL = 1; + SKIP = 2; } // RegisterResourceResponse is returned by the engine after a resource has finished being initialized. It includes the @@ -150,6 +162,7 @@ message RegisterResourceResponse { bool stable = 4; // if true, the object's state is stable and may be trusted not to change. repeated string stables = 5; // an optional list of guaranteed-stable properties. map propertyDependencies = 6; // a map from property keys to the dependencies of the property. + Result result = 7; // the reason, whether the resource registration was successful, failed, or skipped. } // RegisterResourceOutputsRequest adds extra resource outputs created by the program after registration has occurred. @@ -169,3 +182,59 @@ message ResourceInvokeRequest { SourcePosition sourcePosition = 7; // the optional source position of the user code that initiated the invoke. } + +message ResourceCallRequest { + // ArgumentDependencies describes the resources that a particular argument depends on. + message ArgumentDependencies { + repeated string urns = 1; // A list of URNs this argument depends on. + } + + string tok = 1; // the function token to invoke. + google.protobuf.Struct args = 2; // the arguments for the function invocation. + map argDependencies = 3; // a map from argument keys to the dependencies of the argument. + string provider = 4; // an optional reference to the provider to use for this invoke. + string version = 5; // the version of the provider to use when servicing this request. + string pluginDownloadURL = 13; // the pluginDownloadURL of the provider to use when servicing this request. + map pluginChecksums = 16; // a map of checksums of the provider to use when servicing this request. + + // We used to send CallRequest for both provider calls and monitor calls, despite them being different. + // We've now split them but need to make sure we don't confuse any old plugins/monitors making sure those + // fields don't get reused. + reserved 6, 7, 8, 9, 10, 11, 12, 14; + reserved "project", "stack", "config", "configSecretKeys", "dryRun", "parallel", "monitorEndpoint", "organization"; + + SourcePosition sourcePosition = 15; // the optional source position of the user code that initiated the call. +} + +// TransformResourceOptions is a subset of all resource options that are relevant to transforms. +message TransformResourceOptions { + repeated string depends_on = 1; + bool protect = 2; + repeated string ignore_changes = 3; + repeated string replace_on_changes = 4; + string version = 5; + repeated Alias aliases = 6; + string provider = 7; + RegisterResourceRequest.CustomTimeouts custom_timeouts = 8; + string plugin_download_url = 9; + bool retain_on_delete = 10; + string deleted_with = 11; + optional bool delete_before_replace = 12; + repeated string additional_secret_outputs = 13; + map providers = 14; + map plugin_checksums = 15; +} + +message TransformRequest { + string type = 1; // the type of the resource. + string name = 2; // the name of the resource. + bool custom = 3; // true if the resource is a custom resource, else it's a component resource. + string parent = 4; // the parent of the resource, this can't be changed by the transform. + google.protobuf.Struct properties = 5; // the input properties of the resource. + TransformResourceOptions options = 6; // the options for the resource. +} + +message TransformResponse { + google.protobuf.Struct properties = 1; // the transformed input properties. + TransformResourceOptions options = 2; // the options for the resource. +} diff --git a/scripts/Packages.scala b/scripts/Packages.scala index 059e1bff..9c833514 100644 --- a/scripts/Packages.scala +++ b/scripts/Packages.scala @@ -14,33 +14,48 @@ import scala.sys.exit import scala.util.* import scala.util.control.NonFatal +case class Flags( + force: Boolean = false +) + //noinspection ScalaWeakerAccess,TypeAnnotation object Packages: def main(args: String*): Unit = - args match + val (params, flags) = Args.parse(args, monoFlags = Vector("force", "f")) + + given Config = Config() + given Flags = Flags( + force = flags.get("force").orElse(flags.get("f")) match + case Some(v: String) => v.toBoolean + case Some(v: Int) => v > 0 + case None => false + ) + + params.toList match + case "local-all" :: Nil => publishLocalAll(generateAll(packagesDir)) + case "local" :: tail => publishLocalSelected(generateSelected(packagesDir, tail), tail) + case "maven-all" :: Nil => publishMavenAll(generateAll(packagesDir)) + case "maven" :: tail => publishMavenSelected(generateSelected(packagesDir, tail), tail) + case "metadata-all" :: Nil => downloadPackagesMetadataAndSchema(packagesDir, selected = Nil) + case "metadata" :: tail => downloadPackagesMetadataAndSchema(packagesDir, selected = tail) + case "generate-all" :: Nil => generateAll(packagesDir) + case "generate" :: tail => generateSelected(packagesDir, tail) + case "publish-local-all" :: Nil => publishLocalAll(generatedFile) + case "publish-local" :: tail => publishLocalSelected(generatedFile, tail) + case "publish-maven-all" :: Nil => publishMavenAll(generatedFile) + case "publish-maven" :: tail => publishMavenSelected(generatedFile, tail) + // less common use cases case "list" :: Nil => listLatestPackages(packagesDir) - case "list-published-to-maven" :: Nil => listPublishedPackages(publishedMavenFile) - case "local-all" :: Nil => publishLocalAll(generateAll(packagesDir)) - case "local" :: tail => publishLocalSelected(generateSelected(packagesDir, tail), tail) - case "maven-all" :: Nil => publishMavenAll(generateAll(packagesDir)) - case "maven" :: tail => publishMavenSelected(generateSelected(packagesDir, tail), tail) - case "metadata-all" :: Nil => downloadPackagesMetadata(packagesDir) - case "metadata" :: tail => downloadPackagesMetadata(packagesDir, selected = tail) - case "generate-all" :: Nil => generateAll(packagesDir) - case "generate" :: tail => generateSelected(packagesDir, tail) - case "publish-local-all" :: Nil => publishLocalAll(generatedFile) - case "publish-local" :: tail => publishLocalSelected(generatedFile, tail) - case "publish-maven-all" :: Nil => publishMavenAll(generatedFile) - case "publish-maven" :: tail => publishMavenSelected(generatedFile, tail) case "compile" :: tail => compileSelected(generatedFile, tail) - case "publish-maven-no-deps" :: tail => publishMavenSelectedNoDeps(generatedFile, tail) + case "list-published-to-maven" :: Nil => listPublishedPackages(publishedMavenFile) + case "resolve-maven" :: tail => resolveMavenSelected(packagesDir, tail) + case "resolve-maven-all" :: Nil => resolveMavenAll(packagesDir) case cmd => println(s"Unknown command: $cmd\n") println( s"""Usage: packages | |Commands: - | list - list latest packages from Pulumi repository | local-all - generate and publish all packages locally | local ... - generate and publish selected packages locally | maven-all - generate and publish all packages to Maven @@ -53,23 +68,26 @@ object Packages: | publish-local ... - publish selected packages locally | publish-maven-all - publish all packages to Maven | publish-maven ... - publish selected packages to Maven + | | compile ... - compile selected packages - | publish-maven-no-deps ... - publish selected packages to Maven without dependencies + | list - list latest packages from Pulumi repository + | list-published-to-maven - list packages published to Maven (from local cache) + | resolve-maven ... - resolve selected packages from Maven + | resolve-maven-all - resolve all packages from Maven |""".stripMargin ) exit(1) + end match end main - val cwd = besomDir - val schemasDir = cwd / ".out" / "schemas" - val codegenDir = cwd / ".out" / "codegen" + val cwd = Config.besomDir val packagesDir = cwd / ".out" / "packages" val publishLocalDir = cwd / ".out" / "publishLocal" val publishMavenDir = cwd / ".out" / "publishMaven" - val generatedFile = codegenDir / "generated.json" - val publishedLocalFile = publishLocalDir / "published.json" - val publishedMavenFile = publishMavenDir / "published.json" + def generatedFile(using config: Config) = config.codegenDir / "generated.json" + val publishedLocalFile = publishLocalDir / "published.json" + val publishedMavenFile = publishMavenDir / "published.json" def compileOpts(heapMaxGb: Int = 32): Vector[os.Shellable] = println(s"Compiling with max heap size: ${heapMaxGb}G") @@ -119,6 +137,7 @@ object Packages: private val blockedPackages = Vector( "azure-native-v1", // deprecated + "azure-quickstart-acr-geo-replication", // uses deprecated azure-native-v1 "aws-quickstart-aurora-postgres", // archived "aws-quickstart-redshift", // archived "aws-quickstart-vpc" // archived @@ -133,11 +152,12 @@ object Packages: private val compileProblemPackages = blockedPackages ++ Vector( "aws-iam", // id parameter, schema error - https://github.com/pulumi/pulumi-aws-iam/issues/18 "nuage", // id parameter, schema error - https://github.com/nuage-studio/pulumi-nuage/issues/50 + "ovh", // urn parameter, schema error - https://github.com/ovh/pulumi-ovh/issues/139 "fortios" // method collision - https://github.com/VirtusLab/besom/issues/458 ) - def generateAll(targetPath: os.Path): os.Path = { - val metadata = readPackagesMetadata(targetPath) + def generateAll(targetPath: os.Path)(using Config, Flags): os.Path = { + val metadata = readOrFetchPackagesMetadata(targetPath, Nil) .filter { case m if (codegenProblemPackages ++ compileProblemPackages).contains(m.name) => println(s"Skipping problematic package generation: ${m.name}") @@ -147,9 +167,8 @@ object Packages: upsertGeneratedFile(generate(metadata)) } - def publishLocalAll(sourceFile: os.Path): os.Path = { - val generated = PackageMetadata - .fromJsonList(os.read(sourceFile: os.Path)) + def publishLocalAll(sourceFile: os.Path)(using Config, Flags): os.Path = { + val generated = getPackages(sourceFile) .filter { case m if compileProblemPackages.contains(m.name) => println(s"Skipping problematic package publishing: ${m.name}") @@ -160,9 +179,8 @@ object Packages: upsertPublishedFile(publishedLocalFile, published) } - def publishMavenAll(sourceFile: os.Path): os.Path = { - val generated = PackageMetadata - .fromJsonList(os.read(sourceFile: os.Path)) + def publishMavenAll(sourceFile: os.Path)(using Config, Flags): os.Path = { + val generated = getPackages(sourceFile) .filter { case m if compileProblemPackages.contains(m.name) => println(s"Skipping problematic package publishing: ${m.name}") @@ -173,8 +191,8 @@ object Packages: upsertPublishedFile(publishedMavenFile, published) } - def generateSelected(targetPath: os.Path, selected: List[String]): os.Path = { - val readPackages = readPackagesMetadata(targetPath, selected) + def generateSelected(targetPath: os.Path, selected: List[String])(using config: Config, flags: Flags): os.Path = { + val readPackages = readOrFetchPackagesMetadata(targetPath, selected) val packages = selected.map { p => PackageId.parse(p) match { case Right(name, Some(version)) => @@ -193,32 +211,32 @@ object Packages: upsertGeneratedFile(metadata) } - def publishLocalSelected(sourceFile: os.Path, packages: List[String]): os.Path = { + def publishLocalSelected(sourceFile: os.Path, packages: List[String])(using Config, Flags): os.Path = { val selectedPackages = resolvePackageVersions(sourceFile, packages) val published = publishLocal(selectedPackages) upsertPublishedFile(publishedLocalFile, published) } - def publishMavenSelected(sourceFile: os.Path, packages: List[String]): os.Path = { + def publishMavenSelected(sourceFile: os.Path, packages: List[String])(using Config, Flags): os.Path = { val selectedPackages = resolvePackageVersions(sourceFile, packages) val published = publishMaven(selectedPackages) upsertPublishedFile(publishedMavenFile, published) } - def resolvePackageVersions(sourceFile: os.Path, packages: List[String]): Vector[PackageMetadata] = { - lazy val generated = PackageMetadata.fromJsonList(os.read(sourceFile)) + def resolvePackageVersions(sourceFile: os.Path, packages: List[String])(using Config): Vector[PackageMetadata] = + lazy val metadata = getPackages(sourceFile) packages.map { PackageId.parse(_) match case Right((name, Some(version))) => PackageMetadata(name, PackageVersion(version)) case Right((name, None)) => - generated + metadata .find(_.name == name) - .getOrElse(throw Exception(s"Package '$name' not found in the generated packages (${generated.size})")) + .getOrElse(throw Exception(s"Package '$name' not found in the generated packages (${metadata.size})")) case Left(e) => throw e }.toVector - } + end resolvePackageVersions - def compileSelected(sourceFile: os.Path, packages: List[String]) = + def compileSelected(sourceFile: os.Path, packages: List[String])(using config: Config) = val selectedPackages = resolvePackageVersions(sourceFile, packages) withProgress("Compiling packages", selectedPackages.size) { selectedPackages.foreach { m => @@ -229,7 +247,7 @@ object Packages: "scala-cli", "--power", "compile", - codegenDir / m.name / version, + config.codegenDir / m.name / version, "--suppress-experimental-feature-warning", "--suppress-directives-in-multiple-files-warning" ) @@ -245,33 +263,84 @@ object Packages: } end compileSelected - def publishMavenSelectedNoDeps(sourceFile: os.Path, packages: List[String]) = - val selectedPackages = resolvePackageVersions(sourceFile, packages) - withProgress("Publishing packages to Maven without dependencies", selectedPackages.size) { - selectedPackages.foreach { m => - Progress.report(label = s"${m.name}:${m.version.getOrElse("latest")}") - val version = m.version.getOrElse(throw Exception("Package version must be provided for publishing")).asString - try - awaitPublishedToMaven(m) - val args: Seq[os.Shellable] = Seq( - "scala-cli", - "--power", - "publish", - codegenDir / m.name / version, - "--suppress-experimental-feature-warning", - "--suppress-directives-in-multiple-files-warning" + private def parsePackages(packages: List[String]): Vector[PackageMetadata] = + packages.map { + PackageId.parse(_) match + case Right((name, Some(version))) => PackageMetadata(name, PackageVersion(version)) + case Right((name, None)) => PackageMetadata(name, None) + case Left(e) => throw e + }.toVector + + def resolveMavenAll(targetDir: Path)(using config: Config): Unit = + val _ = downloadPackagesMetadata(targetDir, Nil) + val latest = readPackagesMetadata(targetDir).map(_.copy(version = None)) + val resolved = resolveMavenVersions(targetDir, latest) + compareWithLatest(targetDir, resolved, latest) + end resolveMavenAll + + def resolveMavenSelected(targetDir: Path, selected: List[String])(using config: Config): Unit = + val selectedPackages = parsePackages(selected) + val resolved = resolveMavenVersions(targetDir, selectedPackages) + + val _ = downloadPackagesMetadata(targetDir, selected) + val latestPackages = readPackagesMetadata(targetDir) + compareWithLatest(targetDir, resolved, latestPackages) + end resolveMavenSelected + + def resolveMavenVersions(targetDir: os.Path, packages: Vector[PackageMetadata])(using config: Config): Map[String, SemanticVersion] = + withProgress("Resolving packages from Maven", packages.size) { + packages.map { m => + val dep = dependency(m) + val ver = m.version.getOrElse("latest") + Thread.sleep(100) // avoid rate limiting + val res = resolveMavenPackageVersion(dep) + .fold( + e => { + Progress.fail(s"Can't resolve '${m.name}' version '${ver}':\n ${e.getMessage}") + m.name -> None + }, + v => { + SemanticVersion.parseTolerant(v) match + case Left(e) => + Progress.fail(s"Can't parse resolved version '${v}' for '${m.name}':\n ${e.getMessage}") + m.name -> None + case Right(v) => + Progress.report(label = s"${m.name}:${v}") + m.name -> Some(v) + } ) - os.proc(args ++ mavenOpts).call(stdin = envOrExit("PGP_PASSWORD"), stdout = os.Inherit, mergeErrIntoOut = true) - println(s"[${new Date}] Successfully published provider '${m.name}' version '${version}'") - catch - case _: os.SubprocessException => - Progress.fail(s"[${new Date}] Publish failed for provider '${m.name}' version '${version}', error: sub-process failed") - case NonFatal(_) => - Progress.fail(s"[${new Date}] Publish failed for provider '${m.name}' version '${version}'") - finally Progress.end + Progress.end + res + } + }.collect({ case (name, Some(version)) => name -> version }).toMap + end resolveMavenVersions + + def compareWithLatest( + targetDir: os.Path, + resolved: Map[String, SemanticVersion], + latestPackages: Vector[PackageMetadata] + )(using config: Config): Unit = + withProgress("Comparing with Pulumi repository versions", resolved.size) { + resolved.foreach { case (name, l) => + val v = SemanticVersion(l.major, l.minor, l.patch) + val latest = + latestPackages + .find(_.name == name) + .flatMap(_.version) + .map(SemanticVersion.parseTolerant) + (v, latest) match + case (maven: SemanticVersion, Some(Right(upstream: SemanticVersion))) if maven < upstream => + Progress.report(label = s"${name}: ${maven} < ${upstream}") + Progress.end + case (maven: SemanticVersion, Some(Right(upstream: SemanticVersion))) if maven >= upstream => + Progress.report(label = s"${name}: ${maven} >= ${upstream}") + Progress.end + case (m, u) => + Progress.fail(s"${name}: one or both not found: ${m} ${u}") + Progress.end } } - end publishMavenSelectedNoDeps + end compareWithLatest type PackageId = (String, Option[String]) object PackageId: @@ -282,7 +351,7 @@ object Packages: case _ => Left(Exception(s"Invalid package format: '$value'")) end PackageId - def generate(metadata: Vector[PackageMetadata]): Vector[PackageMetadata] = { + def generate(metadata: Vector[PackageMetadata])(using Config): Vector[PackageMetadata] = { val seen = mutable.HashSet.empty[PackageId] val todo = mutable.Queue.empty[PackageMetadata] val done = mutable.ListBuffer.empty[PackageMetadata] @@ -297,10 +366,6 @@ object Packages: val versionOrLatest = m.version.getOrElse("latest") Progress.report(label = s"${m.name}:${versionOrLatest}") try - given Config = Config( - schemasDir = schemasDir, - codegenDir = codegenDir - ) val result = generator.generatePackageSources(metadata = m) val version = result.metadata.version.getOrElse(throw Exception("Package version must be present after generating")).asString @@ -327,7 +392,7 @@ object Packages: done.toVector } - def publishLocal(generated: Vector[PackageMetadata]): Vector[PackageMetadata] = { + def publishLocal(generated: Vector[PackageMetadata])(using config: Config, flags: Flags): Vector[PackageMetadata] = { val seen = mutable.HashSet.empty[PackageId] val todo = mutable.Queue.empty[PackageMetadata] val done = mutable.ListBuffer.empty[PackageMetadata] @@ -335,13 +400,24 @@ object Packages: os.makeDir.all(publishLocalDir) generated.foreach(m => { - todo.enqueueAll(m.dependencies) // dependencies first to avoid missing dependencies during compilation - todo.enqueue(m) + // add dependencies first to avoid missing dependencies during compilation + for d <- m.dependencies do if !todo.contains(d) then todo.enqueue(d) + if !todo.contains(m) then todo.enqueue(m) }) withProgress(s"Publishing ${todo.size} packages locally", todo.size) { while todo.nonEmpty do val m = todo.dequeue() val id: PackageId = (m.name, m.version.map(_.asString)) + lazy val resolved = resolveLocalPackageVersion(dependency(m)) + if !flags.force && !seen.contains(id) && resolved.isRight then + seen.add(id) + val v = resolved.getOrElse(throw Exception("Resolved version must be provided at this point")) + Progress.report(label = s"${m.name}:${v}") + println(s"[${new Date}] Skipping provider '${m.name}' version '${v}' (already published locally)") + done += m + Progress.end + end if + if !seen.contains(id) then seen.add(id) val version = m.version.getOrElse(throw Exception("Package version must be provided for publishing")).asString @@ -353,7 +429,7 @@ object Packages: "--power", "publish", "local", - codegenDir / m.name / version, + config.codegenDir / m.name / version, "--suppress-experimental-feature-warning", "--suppress-directives-in-multiple-files-warning" ) @@ -378,7 +454,7 @@ object Packages: done.toVector } - def publishMaven(generated: Vector[PackageMetadata]): Vector[PackageMetadata] = { + def publishMaven(generated: Vector[PackageMetadata])(using config: Config, flags: Flags): Vector[PackageMetadata] = { val seen = mutable.HashSet.empty[PackageId] val todo = mutable.Queue.empty[PackageMetadata] val done = mutable.ListBuffer.empty[PackageMetadata] @@ -386,25 +462,36 @@ object Packages: os.makeDir.all(publishMavenDir) generated.foreach(m => { - todo.enqueueAll(m.dependencies) // dependencies first to avoid missing dependencies during compilation - todo.enqueue(m) + // add dependencies first to avoid missing dependencies during compilation + for d <- m.dependencies do if !todo.contains(d) then todo.enqueue(d) + if !todo.contains(m) then todo.enqueue(m) }) withProgress(s"Publishing ${todo.size} packages to Maven", todo.size) { while todo.nonEmpty do val m = todo.dequeue() val id: PackageId = (m.name, m.version.map(_.asString)) + lazy val resolved = resolveMavenPackageVersion(dependency(m)) + if !flags.force && !seen.contains(id) && resolved.isRight then + seen.add(id) + val v = resolved.getOrElse(throw Exception("Resolved version must be provided at this point")) + Progress.report(label = s"${m.name}:${v}") + println(s"[${new Date}] Skipping provider '${m.name}' version '${v}' (already published to Maven)") + done += m + Progress.end + end if + if !seen.contains(id) then seen.add(id) val version = m.version.getOrElse(throw Exception("Package version must be provided for publishing")).asString Progress.report(label = s"${m.name}:${version}") val logFile = publishMavenDir / s"${m.name}-${version}.log" try - awaitPublishedToMaven(m) + awaitDependenciesPublishedToMaven(m) val args: Seq[Shellable] = Seq( "scala-cli", "--power", "publish", - codegenDir / m.name / version, + config.codegenDir / m.name / version, "--suppress-experimental-feature-warning", "--suppress-directives-in-multiple-files-warning" ) @@ -415,7 +502,6 @@ object Packages: Progress.total(todo.size) catch case e: CantDownloadModule => - e.printStackTrace() Progress.fail( s"[${new Date}] Publish failed for provider '${m.name}' version '${version}' " + s"error: failed to download dependency, message: ${e.getMessage}" @@ -437,7 +523,13 @@ object Packages: done.toVector } - private def awaitPublishedToMaven(m: PackageMetadata): Unit = { + def dependency(m: PackageMetadata)(using config: Config): String = + val version = m.version + .map(version => s"${version}-core.${config.coreShortVersion}") + .getOrElse("[0.+,999999.+)") + s"org.virtuslab::besom-${m.name}:${version}" + + private def awaitDependenciesPublishedToMaven(m: PackageMetadata)(using config: Config): Unit = { // Check if dependencies are available in Maven Central before publishing if m.dependencies.nonEmpty then val timeout = 15.minutes @@ -445,30 +537,22 @@ object Packages: val deadline = timeout.fromNow println(s"Checking for dependencies with timeout of ${timeout}") - // TODO: clean this up, it's a bit of a mess - val defaultScalaVersion = Config.DefaultBesomVersion val shortCoreVersion = SemanticVersion - .parseTolerant(defaultScalaVersion) + .parseTolerant(config.besomVersion) .fold( - e => Left(Exception(s"Invalid besom version: ${defaultScalaVersion}", e)), + e => Left(Exception(s"Invalid besom version: ${config.besomVersion}", e)), v => Right(v.copy(patch = 0).toShortString /* drop patch version */ ) ) - - def dependency(m: PackageMetadata): String = - s"org.virtuslab::besom-${m.name}:${m.version.get}-core.${shortCoreVersion.toTry.get}" - - val allDependencies = m.dependencies.map(dependency) + val allDependencies = m.dependencies.map(dependency(_)) val found = mutable.Map.empty[String, Boolean] def foundAll = found.values.forall(identity) - allDependencies.foreach { d => - found(d) = false - } + allDependencies.foreach { d => found(d) = false } while (deadline.hasTimeLeft && !foundAll) { allDependencies.foreach { d => - resolveMavenPackage(d, defaultScalaVersion).fold( - _ => println(s"Dependency '${d}' not found"), + resolveMavenPackageVersion(d).fold( + e => println(s"Dependency '${d}' not found: ${e.getMessage}"), _ => found(d) = true ) } @@ -476,31 +560,45 @@ object Packages: println(s"Waiting for ${interval} to allow the publish to propagate") Thread.sleep(interval.toMillis) } + if foundAll then println("All dependencies found in Maven Central") end if } - def readPackagesMetadata(targetPath: os.Path, selected: List[String] = Nil): Vector[PackageMetadata] = { - // download metadata if none found - if !os.exists(targetPath) then downloadPackagesMetadata(targetPath, selected) + private def readPackageMetadataFiles(path: os.Path): Map[String, Path] = ListMap.from( + os + .list(path) + .filter(_.last.endsWith("metadata.json")) + .map(p => p.last.stripSuffix(".metadata.json") -> p) + ) - def read(path: os.Path): ListMap[String, Path] = ListMap.from( - os - .list(path) - .filter(_.last.endsWith("metadata.json")) - .map(p => p.last.stripSuffix(".metadata.json") -> p) - ) + def readPackagesMetadata(targetPath: os.Path): Vector[PackageMetadata] = + readPackageMetadataFiles(targetPath) + .map((_, p) => PackageMetadata.fromJsonFile(p)) + .toVector + + def readOrFetchPackagesMetadata( + targetPath: os.Path, + selected: List[String] + )(using config: Config, flags: Flags): Vector[PackageMetadata] = { + // download metadata if none found + if flags.force || !os.exists(targetPath) then + println(s"No packages metadata found in: '$targetPath', downloading...") + downloadPackagesMetadataAndSchema(targetPath, selected) + else println(s"Reading packages metadata from: '$targetPath'") // read cached metadata - val cached = read(targetPath) + val cached = readPackageMetadataFiles(targetPath) // download all metadata if selected packages are not found val selectedNames = selected.map(_.takeWhile(_ != ':')).toSet val selectedAreSubsetOfCached = selectedNames.subsetOf(cached.keys.toSet) + if selected.nonEmpty then + println(s"Selected: ${selected.mkString(", ")}, cached: ${cached.keys.mkString(", ")}, subset: $selectedAreSubsetOfCached") val downloaded = if !selectedAreSubsetOfCached then - downloadPackagesMetadata(targetPath, selected) - read(targetPath) + downloadPackagesMetadataAndSchema(targetPath, selected) + readPackageMetadataFiles(targetPath) else cached // double check if selected packages are found @@ -528,10 +626,15 @@ object Packages: metadata } + private case class PackageYAML(name: String, repo_url: String, schema_file_path: String, version: String) derives YamlCodec + // downloads latest package metadata and schemas using Pulumi packages repository - def downloadPackagesMetadata(targetPath: os.Path, selected: List[String] = Nil): Unit = { - os.remove.all(targetPath) - os.makeDir.all(targetPath) + def downloadPackagesMetadataAndSchema(targetPath: os.Path, selected: List[String])(using config: Config): Unit = + downloadPackagesSchema(downloadPackagesMetadata(targetPath, selected)) + end downloadPackagesMetadataAndSchema + + private def downloadPackagesMetadata(targetPath: os.Path, selected: List[String])(using config: Config): Vector[PackageYAML] = + println("Downloading packages metadata...") val packagesRepoApi = "https://api.github.com/repos/pulumi/registry/contents/themes/default/data/registry/packages" @@ -562,83 +665,88 @@ object Packages: type Error = String - case class PackageYAML(name: String, repo_url: String, schema_file_path: String, version: String) derives YamlCodec - val selectedNames = selected.map(_.takeWhile(_ != ':')) val size = if selectedNames.isEmpty then packages.size else selectedNames.size - println(selectedNames) + if selectedNames.nonEmpty then println(s"Selected for download: ${selectedNames.mkString(", ")}") // fetch all production schema metadata - val downloaded: Vector[PackageYAML] = - withProgress(s"Downloading $size packages metadata", size) { - packages - .filter { (name, _) => - selectedNames match - case Nil => true - case s => s.contains(name) - } - .filterNot((name, _) => blockedPackages.contains(name)) - .map { (packageName: String, p: PackageSource) => - Progress.report(label = packageName) - try - val metadataFile = p.name - val metadataPath = targetPath / metadataFile - val shaPath = targetPath / s"${p.name}.sha" - - val hasChanged: Boolean = - if os.exists(shaPath) then - val sha = os.read(shaPath).split(" ").head - sha != p.sha - else true // no sha file, assume it has changed - - val metadataRaw: Either[Error, PackageYAML] = { - if hasChanged || !os.exists(metadataPath) then - val schemaResponse = requests.get(p.download_url, headers = authHeader) - schemaResponse.statusCode match - case 200 => - val metadata = schemaResponse.text() - os.write.over(metadataPath, metadata, createFolders = true) - os.write.over(shaPath, s"${p.sha} $metadataFile", createFolders = true) - Right(metadata) - case _ => - Left(s"failed to download metadata for package: '${p.name}'") - else Right(os.read(metadataPath)) - }.flatMap { - _.as[PackageYAML].fold( - error => Left(s"failed to deserialize metadata for package: '${p.name}', error: ${error}"), - p => Right(p) - ) - } - - val metadata: Either[Error, PackageMetadata] = - metadataRaw.map(m => PackageMetadata(m.name, m.version).withUrl(m.repo_url)) - - metadata match - case Left(error) => Progress.fail(error) - case Right(value) => - os.write.over(targetPath / s"${packageName}.metadata.json", value.toJson, createFolders = true) - - metadataRaw - catch - case NonFatal(e) => - val msg = s"Failed to download metadata for package: '${p.name}', error: ${e.getMessage}" - Progress.fail(msg) - Left(msg) - finally Progress.end - end try - } - .map(_.toOption) - .collect { case Some(p) => p } - .toVector - } + val downloaded = withProgress(s"Downloading $size packages metadata", size) { + packages + .filter { (name, _) => + selectedNames match + case Nil => true + case s => s.contains(name) + } + .filterNot((name, _) => { + val block = blockedPackages.contains(name) + if block then Progress.fail(s"Skipping package: '$name', it's known to have problems") + block + }) + .map { (packageName: String, p: PackageSource) => + Progress.report(label = packageName) + try + val metadataFile = p.name + val metadataPath = targetPath / metadataFile + val shaPath = targetPath / s"${p.name}.sha" + + val hasChanged: Boolean = + if os.exists(shaPath) then + val sha = os.read(shaPath).split(" ").head + sha != p.sha + else true // no sha file, assume it has changed + + val metadataRaw: Either[Error, PackageYAML] = { + if hasChanged || !os.exists(metadataPath) then + val schemaResponse = requests.get(p.download_url, headers = authHeader) + schemaResponse.statusCode match + case 200 => + val metadata = schemaResponse.text() + os.write.over(metadataPath, metadata, createFolders = true) + os.write.over(shaPath, s"${p.sha} $metadataFile", createFolders = true) + Right(metadata) + case _ => + Left(s"failed to download metadata for package: '${p.name}'") + else Right(os.read(metadataPath)) + }.flatMap { + _.as[PackageYAML].fold( + error => Left(s"failed to deserialize metadata for package: '${p.name}', error: ${error}"), + p => Right(p) + ) + } + + val metadata: Either[Error, PackageMetadata] = + metadataRaw.map(m => PackageMetadata(m.name, m.version).withUrl(m.repo_url)) + + metadata match + case Left(error) => Progress.fail(error) + case Right(value) => + os.write.over(targetPath / s"${packageName}.metadata.json", value.toJson, createFolders = true) + + metadataRaw + catch + case NonFatal(e) => + val msg = s"Failed to download metadata for package: '${p.name}', error: ${e.getMessage}" + Progress.fail(msg) + Left(msg) + finally Progress.end + end try + } + .map(_.toOption) + .collect { case Some(p) => p } + .toVector + } + println(s"Packages directory: '$targetPath'") + downloaded + end downloadPackagesMetadata + private def downloadPackagesSchema(downloaded: Vector[PackageYAML])(using config: Config): Unit = { // pre-fetch all available production schemas, if any are missing here code generation will use a fallback mechanism - withProgress(s"Downloading $size packages schemas", size) { + withProgress(s"Downloading ${downloaded.size} packages schemas", downloaded.size) { downloaded.foreach(p => { Progress.report(label = p.name) try val ext = if p.schema_file_path.endsWith(".yaml") || p.schema_file_path.endsWith(".yml") then "yaml" else "json" - val schemaPath = schemasDir / p.name / PackageVersion(p.version).get / s"schema.$ext" + val schemaPath = config.schemasDir / p.name / PackageVersion(p.version).get / s"schema.$ext" if !os.exists(schemaPath) then val rawUrlPrefix = p.repo_url.replace("https://github.com/", "https://raw.githubusercontent.com/") val url = s"$rawUrlPrefix/${p.version}/${p.schema_file_path}" @@ -657,12 +765,11 @@ object Packages: }) } - println(s"Packages directory: '$targetPath'") - println(s"Schemas directory: '$schemasDir'") + println(s"Schemas directory: '${config.schemasDir}'") } - def listLatestPackages(targetPath: os.Path): Unit = { - val metadata = readPackagesMetadata(targetPath) + def listLatestPackages(targetPath: os.Path)(using config: Config, flags: Flags): Unit = { + val metadata = readOrFetchPackagesMetadata(targetPath, Nil) val active = metadata .filterNot(m => blockedPackages.contains(m.name)) .filterNot(m => codegenProblemPackages.contains(m.name)) @@ -682,28 +789,30 @@ object Packages: ) } + def getPackages(file: os.Path): Vector[PackageMetadata] = + if os.exists(file) + then PackageMetadata.fromJsonList(os.read(file)) + else + println(s"File not found: $file, returning empty list") + Vector.empty + end getPackages + def listPublishedPackages(file: os.Path): Unit = - val metadata = PackageMetadata.fromJsonList(os.read(file)) + val metadata = getPackages(file) println(s"Found ${metadata.size} packages in logs published to Maven") metadata.foreach(m => println(s"${m.name}:${m.version.getOrElse("unknown")}")) end listPublishedPackages - def upsertGeneratedFile(metadata: Vector[PackageMetadata]): os.Path = { - val generated = - if os.exists(generatedFile) - then PackageMetadata.fromJsonList(os.read(generatedFile)) - else Vector.empty - val all = deduplicate(generated ++ metadata) + def upsertGeneratedFile(metadata: Vector[PackageMetadata])(using Config): os.Path = { + val generated = getPackages(generatedFile) + val all = deduplicate(generated ++ metadata) os.write.over(generatedFile, PackageMetadata.toJson(all), createFolders = true) generatedFile } def upsertPublishedFile(file: os.Path, metadata: Vector[PackageMetadata]): os.Path = { - val published = - if os.exists(file) - then PackageMetadata.fromJsonList(os.read(file)) - else Vector.empty - val all = deduplicate(published ++ metadata) + val published = getPackages(file) + val all = deduplicate(published ++ metadata) os.write.over(file, PackageMetadata.toJson(all), createFolders = true) file } diff --git a/scripts/Proto.scala b/scripts/Proto.scala index ebfaee4e..c9d826d4 100644 --- a/scripts/Proto.scala +++ b/scripts/Proto.scala @@ -1,11 +1,12 @@ package besom.scripts +import besom.codegen.Config import org.apache.commons.lang3.SystemUtils import os.* object Proto: def main(args: String*): Unit = - val cwd = besomDir + val cwd = Config.besomDir val protoPath = cwd / "proto" args match case "fetch" :: Nil => fetchProto(cwd, protoPath) @@ -50,21 +51,31 @@ private def fetchProto(cwd: os.Path, targetPath: os.Path): Unit = private def copyProto(sourcePath: os.Path, targetPath: os.Path): Unit = println(s"copying from $sourcePath to $targetPath") - val allowDirList = List() - val allowFileList = List( - "alias.proto", - "engine.proto", - "plugin.proto", - "provider.proto", - "resource.proto", - "source.proto", - "status.proto" + os.rel / "pulumi" / "alias.proto", + os.rel / "pulumi" / "callback.proto", + os.rel / "pulumi" / "engine.proto", + os.rel / "pulumi" / "language.proto", + os.rel / "pulumi" / "plugin.proto", + os.rel / "pulumi" / "provider.proto", + os.rel / "pulumi" / "resource.proto", + os.rel / "pulumi" / "source.proto", + os.rel / "pulumi" / "codegen" / "hcl.proto", + os.rel / "google" / "protobuf" / "status.proto" ) val allowExtensions = List("proto") - copyFilteredFiles(sourcePath, targetPath, allowDirList, allowFileList, allowExtensions) + os.makeDir.all(targetPath) + os.walk(sourcePath) + .filter(os.isFile(_)) + .filter(f => allowExtensions.contains(f.ext)) + .filter(f => allowFileList.exists(f.endsWith(_))) + .foreach { source => + val target = targetPath / source.relativeTo(sourcePath) + os.copy.over(source, target, createFolders = true, replaceExisting = true) + println(s"copied ${source.relativeTo(sourcePath)} into ${target.relativeTo(targetPath)}") + } private def compileProto(cwd: os.Path, protoPath: os.Path): Unit = if !isProtocInstalled then diff --git a/scripts/Schemas.scala b/scripts/Schemas.scala index 306f91aa..73655865 100644 --- a/scripts/Schemas.scala +++ b/scripts/Schemas.scala @@ -1,9 +1,10 @@ package besom.scripts +import besom.codegen.Config import os.* object Schemas: - val cwd: os.Path = besomDir + val cwd: os.Path = Config.besomDir def main(args: String*): Unit = args match diff --git a/scripts/Version.scala b/scripts/Version.scala index 72aebce8..10c7b2c9 100644 --- a/scripts/Version.scala +++ b/scripts/Version.scala @@ -1,5 +1,6 @@ package besom.scripts +import besom.codegen.Config import besom.model.SemanticVersion import scala.sys.exit @@ -7,49 +8,33 @@ import scala.util.Try import scala.util.matching.Regex object Version: - private val cwd = besomDir - lazy val besomVersion: String = os.read(cwd / "version.txt").trim + /** Matches scala-cli besom dependencies and plugins used for version rewriting. + * + * We have three capturing groups: + * - the dependency prefix for a library or plugin, also test scope is included + * - the name and version that will be processed outside of the regexp + * - the suffix, an optional double-quote + * + * We support and preserve both double-quoted and non double-quoted syntax. + */ + private[scripts] lazy val besomDependencyPattern: Regex = + """^(//> using (?:test\.)?(?:dep|lib|plugin) +"?\S+::besom-)([^"]+)("?)$""".r - private lazy val latestPackageVersions = fetchLatestPackageVersions() + private val cwd = Config.besomDir def main(args: String*): Unit = - - lazy val besomDependencyPattern: Regex = - ("""^(//> using (?:test\.)?(?:dep|lib|plugin) +"?\S+::besom-)([^"]+)("?)$""").r - - val expectedFileNames = Vector("project.scala", "project-test.scala", "run.scala") - - def projectFiles(path: os.Path = cwd): Map[os.Path, String] = - println(s"Searching for project files in $path\n") - os.walk( - path, - skip = (p: os.Path) => p.last == ".git" || p.last == ".out" || p.last == ".bsp" || p.last == ".scala-build" || p.last == ".idea" - ).filter(f => expectedFileNames.contains(f.last)) - .map((f: os.Path) => f -> os.read(f)) - .toMap - - def changeVersion(version: String, newBesomVersion: String, packageVersion: String => Option[String] = _ => None): String = - lazy val coreShortVersion = SemanticVersion - .parseTolerant(besomVersion) - .fold( - e => throw Exception(s"Invalid besom version: ${besomVersion}", e), - _.copy(patch = 0).toShortString - ) - version match - case s"$a:$b-core.$_" => s"$a:${packageVersion(a).getOrElse(b)}-core.$coreShortVersion" - case s"$a:$_" => s"$a:$newBesomVersion" - end changeVersion + given config: Config = Config() args match case "show" :: Nil => - println(s"Besom version: $besomVersion\n") + println(s"Besom version: ${config.besomVersion}\n") println(s"Showing all Besom dependencies...\n") projectFiles() .foreachEntry { case (f, content) => content.linesIterator.zipWithIndex.foreach { case (line, index) => line match case besomDependencyPattern(prefix, version, suffix) => - val changedLine = prefix + changeVersion(version, besomVersion) + suffix + val changedLine = prefix + changeVersion(version, config.besomVersion) + suffix println(s"$f:$index:\n$changedLine\n") case _ => // ignore } @@ -78,7 +63,7 @@ object Version: e => throw Exception(s"Invalid version: $newBesomVersionStr", e), v => (v.toString, v.isSnapshot) ) - println(s"Bumping Besom core version from '$besomVersion' to '$newBesomVersion'") + println(s"Bumping Besom core version from '${config.besomVersion}' to '$newBesomVersion'") os.write.over(cwd / "version.txt", newBesomVersion) println(s"Updated version.txt") val filesWithBesomDeps = projectFiles() @@ -109,6 +94,7 @@ object Version: } case "update" :: Nil => println(s"Bumping Besom packages version to latest") + val latestPackageVersions = fetchLatestPackageVersions projectFiles() .collect { case (path, content) if content.linesIterator.exists(besomDependencyPattern.matches) => path -> content @@ -118,7 +104,7 @@ object Version: .map { case line if line.contains("besom-fake-") => line // ignore case besomDependencyPattern(prefix, version, suffix) => - prefix + changeVersion(version, besomVersion, latestPackageVersions.get) + suffix + prefix + changeVersion(version, config.besomVersion, latestPackageVersions.get) + suffix case line => line // pass through } .mkString("\n") + "\n" @@ -141,15 +127,43 @@ object Version: end match end main - def latestPackageVersion(name: String): String = + private def projectFiles(path: os.Path = cwd): Map[os.Path, String] = + val expectedFileNames = Vector("project.scala", "project-test.scala", "run.scala") + println(s"Searching for project files in $path\n") + os.walk( + path, + skip = (p: os.Path) => p.last == ".git" || p.last == ".out" || p.last == ".bsp" || p.last == ".scala-build" || p.last == ".idea" + ).filter(f => expectedFileNames.contains(f.last)) + .map((f: os.Path) => f -> os.read(f)) + .toMap + + private def changeVersion( + version: String, + newBesomVersion: String, + packageVersion: String => Option[String] = _ => None + )(using config: Config): String = + lazy val coreShortVersion = SemanticVersion + .parseTolerant(config.besomVersion) + .fold( + e => throw Exception(s"Invalid besom version: ${config.besomVersion}", e), + _.copy(patch = 0).toShortString + ) + version match + case s"$a:$b-core.$_" => s"$a:${packageVersion(a).getOrElse(b)}-core.$coreShortVersion" + case s"$a:$_" => s"$a:$newBesomVersion" + end changeVersion + + def latestPackageVersion(name: String)(using Config): String = + val latestPackageVersions = fetchLatestPackageVersions Try(latestPackageVersions(name)).recover { case e: NoSuchElementException => throw Exception(s"package $name not found", e) }.get - private def fetchLatestPackageVersions(): Map[String, String] = + private def fetchLatestPackageVersions(using Config): Map[String, String] = println(s"Searching for latest package versions") + given Flags = Flags() Packages - .readPackagesMetadata(Packages.packagesDir) + .readOrFetchPackagesMetadata(Packages.packagesDir, Nil) .map { metadata => metadata.name -> metadata.version.getOrElse(throw Exception("Package version must be present at this point")).asString } diff --git a/scripts/Version.test.scala b/scripts/Version.test.scala new file mode 100644 index 00000000..63f6f28c --- /dev/null +++ b/scripts/Version.test.scala @@ -0,0 +1,19 @@ +package besom.scripts + +//noinspection ScalaFileName +class VersionTest extends munit.FunSuite: + + Vector( + ("//> using dep org.virtuslab::besom-codegen:0.3.0", ("//> using dep org.virtuslab::besom-", "codegen:0.3.0", "")), + ("//> using dep \"org.virtuslab::besom-codegen:0.3.0\"", ("//> using dep \"org.virtuslab::besom-", "codegen:0.3.0", "\"")), + ( + "//> using dep org.virtuslab::besom-kubernetes:4.11.0-core.0.3-SNAPSHOT", + ("//> using dep org.virtuslab::besom-", "kubernetes:4.11.0-core.0.3-SNAPSHOT", "") + ) + ).foreach { (v, exp) => + test("besom version regexp") { + v match + case Version.besomDependencyPattern(prefix, version, suffix) => assertEquals((prefix, version, suffix), exp) + case _ => fail("unexpected error") + } + } diff --git a/scripts/cli.scala b/scripts/cli.scala index 837af48a..6bd38051 100644 --- a/scripts/cli.scala +++ b/scripts/cli.scala @@ -1,7 +1,9 @@ package besom.scripts +import besom.codegen.Config + @main def main(args: String*): Unit = - val _ = besomDir + val _ = Config.besomDir args.headOption.getOrElse("") match case "schemas" => Schemas.main(args.tail*) diff --git a/scripts/common.scala b/scripts/common.scala index 07fa7613..c3f9fd8c 100644 --- a/scripts/common.scala +++ b/scripts/common.scala @@ -8,11 +8,34 @@ import java.util.concurrent.atomic.AtomicInteger import scala.annotation.tailrec import scala.concurrent.duration.Duration -def besomDir: os.Path = - if os.pwd.last != "besom" then - println("You have to run this command from besom project root directory") - sys.exit(1) - os.pwd +import besom.codegen.Config + +object Args: + def parse(args: Seq[String], monoFlags: Seq[String] = Seq.empty): (Vector[String], Map[String, Int | String]) = + val (rest, flags) = parseInner(args, monoFlags) + val mergedFlags: Map[String, Int | String] = flags.groupMapReduce(_._1)(_._2) { + case (a: Int, b: Int) => a + b + case (a: Int, b: String) => a + Integer.parseInt(b) + case (a: String, b: Int) => Integer.parseInt(a) + b + case (a: String, b: String) => b // last one wins + } + (rest, mergedFlags) + + private def parseInner(args: Seq[String], monoFlags: Seq[String]): (Vector[String], Vector[(String, Int | String)]) = + args match + case Nil => (Vector.empty, Vector.empty) + case v +: tail if monoFlags.contains(s"--$v") || monoFlags.contains(s"-$v") => + val (rest, flags) = parseInner(tail, monoFlags) + (rest, (v, 1) +: flags) + case s"--$name" +: value +: tail => + val (rest, flags) = parseInner(tail, monoFlags) + (rest, (name, value) +: flags) + case s"-$name" +: value +: tail => + val (rest, flags) = parseInner(tail, monoFlags) + (rest, (name, value) +: flags) + case head +: tail => + val (rest, flags) = parseInner(tail, monoFlags) + (head +: rest, flags) def git(command: Shellable*)(wd: os.Path): CommandResult = val cmd = os.proc("git", command) @@ -228,7 +251,26 @@ def withProgress[A](title: String, initialTotal: Int)(f: Progress ?=> A): A = end withProgress -def resolveMavenPackage(name: String, defaultScalaVersion: String): Either[Exception, String] = +import coursier.Repository + +def resolveMavenPackageVersion(name: String)(using config: Config): Either[Exception, String] = + import coursier.Repositories + resolvePackageVersion( + name, + config.scalaVersion, + Vector(Repositories.central, Repositories.sonatype("public"), Repositories.sonatype("snapshots")) + ) +end resolveMavenPackageVersion + +def resolveLocalPackageVersion(name: String)(using config: Config): Either[Exception, String] = + resolvePackageVersion( + name, + config.scalaVersion, + Vector() + ) +end resolveLocalPackageVersion + +private def resolvePackageVersion(name: String, defaultScalaVersion: String, repositories: Vector[Repository]): Either[Exception, String] = import coursier.* import coursier.parse.DependencyParser import scala.concurrent.ExecutionContext.Implicits.global @@ -241,15 +283,11 @@ def resolveMavenPackage(name: String, defaultScalaVersion: String): Either[Excep ) .flatMap { dep => Resolve() - .addRepositories( - Repositories.central, - Repositories.sonatype("public"), - Repositories.sonatype("snapshots") - ) + .addRepositories(repositories*) .addDependencies(dep) .either() .flatMap { _.reconciledVersions.get(dep.module).toRight(Exception(s"Failed to resolve $name")) } } -end resolveMavenPackage +end resolvePackageVersion diff --git a/scripts/project.scala b/scripts/project.scala index c09416ae..f7113076 100644 --- a/scripts/project.scala +++ b/scripts/project.scala @@ -9,7 +9,7 @@ //> using dep org.scoverage::scalac-scoverage-serializer:2.0.11 //> using dep org.virtuslab::scala-yaml:0.0.8 //> using dep io.get-coursier:coursier_2.13:2.1.9 -//> using dep org.virtuslab::besom-codegen:0.3.1 +//> using dep org.virtuslab::besom-codegen:0.3.2 //> using test.dep org.scalameta::munit::1.0.0-M10 diff --git a/templates/aws/project.scala b/templates/aws/project.scala index bcf36357..a5945a03 100644 --- a/templates/aws/project.scala +++ b/templates/aws/project.scala @@ -1,5 +1,5 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-aws:6.31.1-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-aws:6.39.0-core.0.3" diff --git a/templates/default/project.scala b/templates/default/project.scala index 2394bbc8..a5b8c67e 100644 --- a/templates/default/project.scala +++ b/templates/default/project.scala @@ -1,5 +1,5 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-random:4.16.1-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-random:4.16.2-core.0.3" diff --git a/templates/gcp/project.scala b/templates/gcp/project.scala index 639b105f..63404cf2 100644 --- a/templates/gcp/project.scala +++ b/templates/gcp/project.scala @@ -1,5 +1,5 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-gcp:7.19.0-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-gcp:7.26.0-core.0.3" diff --git a/templates/kubernetes/project.scala b/templates/kubernetes/project.scala index cb83078d..d9d39918 100644 --- a/templates/kubernetes/project.scala +++ b/templates/kubernetes/project.scala @@ -1,5 +1,5 @@ //> using scala "3.3.1" //> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement -//> using dep "org.virtuslab::besom-core:0.3.1" -//> using dep "org.virtuslab::besom-kubernetes:4.11.0-core.0.3" +//> using dep "org.virtuslab::besom-core:0.3.2" +//> using dep "org.virtuslab::besom-kubernetes:4.13.1-core.0.3" diff --git a/version.txt b/version.txt index a2268e2d..9fc80f93 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.3.1 \ No newline at end of file +0.3.2 \ No newline at end of file diff --git a/website/docs/changelog.md b/website/docs/changelog.md index fc47d699..4aa9a8ff 100644 --- a/website/docs/changelog.md +++ b/website/docs/changelog.md @@ -2,6 +2,24 @@ title: Changelog --- +0.3.2 (11-06-2024) +--- + +* Added missing `provider` / `providers` field on resources to fix #397 (@lbialy in [505](https://github.com/VirtusLab/besom/pull/505)) +* Exposed `CustomTimeouts` resource option configuration value (@lbialy in [502](https://github.com/VirtusLab/besom/pull/502)) +* Fixed issue 489 where ANSI control chars crashed internal logging (@lbialy in [492](https://github.com/VirtusLab/besom/pull/492)) +* First working draft of Automation API (sync, Either-monad based) (@pawelprazak in [336](https://github.com/VirtusLab/besom/pull/336)) +* Fixed issues with eviction of dependencies of core besom library (@lbialy in [500](https://github.com/VirtusLab/besom/pull/500)) +* Fixed bug that crashed besom when resource options were provided for component resource (@lbialy in [502](https://github.com/VirtusLab/besom/pull/502)) +* First working draft of Besom Configure (besom-cfg) (Kubernetes only) (@lbialy in [494](https://github.com/VirtusLab/besom/pull/494)) +* Allow passing options to scala-cli via language plugin executor (@lbialy in [503](https://github.com/VirtusLab/besom/pull/503)) + +New examples: + +* Add AWS API Gateway V2 with EventBridge example by @polkx in https://github.com/VirtusLab/besom/pull/479 + +**Full Changelog**: https://github.com/VirtusLab/besom/compare/v0.3.1...v0.3.2 + 0.3.1 (19-04-2024) --- diff --git a/website/docs/examples.md b/website/docs/examples.md index 198f3bbc..746dcdb8 100644 --- a/website/docs/examples.md +++ b/website/docs/examples.md @@ -2,4 +2,4 @@ title: Examples --- -All examples are available in [Besom GitHub repository](https://github.com/VirtusLab/besom/tree/v0.3.1/examples). \ No newline at end of file +All examples are available in [Besom GitHub repository](https://github.com/VirtusLab/besom/tree/v0.3.2/examples). \ No newline at end of file diff --git a/website/docs/getting_started.md b/website/docs/getting_started.md index da940c6e..72546c65 100644 --- a/website/docs/getting_started.md +++ b/website/docs/getting_started.md @@ -29,7 +29,7 @@ To start your adventure with infrastructure-as-code with Scala follow these step To install the latest Scala Language Plugin release, run the following: ```bash - pulumi plugin install language scala 0.3.1 --server github://api.github.com/VirtusLab/besom + pulumi plugin install language scala 0.3.2 --server github://api.github.com/VirtusLab/besom ``` 4. **Create a new project**: @@ -43,7 +43,7 @@ To start your adventure with infrastructure-as-code with Scala follow these step mkdir besom-demo && cd besom-demo ``` ```bash - pulumi new https://github.com/VirtusLab/besom/tree/v0.3.1/templates/aws + pulumi new https://github.com/VirtusLab/besom/tree/v0.3.2/templates/aws ``` 5. **Deploy to the Cloud**: diff --git a/website/docs/templates.md b/website/docs/templates.md index 2807670c..b0d59ef7 100644 --- a/website/docs/templates.md +++ b/website/docs/templates.md @@ -2,4 +2,4 @@ title: Templates --- -All templates are available in [Besom GitHub repository](https://github.com/VirtusLab/besom/tree/v0.3.1/templates). \ No newline at end of file +All templates are available in [Besom GitHub repository](https://github.com/VirtusLab/besom/tree/v0.3.2/templates). \ No newline at end of file