From afd8859227fac448f23af95c3f9c5a94b11d892c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=8BAndrzej=20Ressel?= Date: Sat, 10 Aug 2024 21:14:45 +0200 Subject: [PATCH] Reworking generator ids (#302) --- .../pulumi_wasm_provider_docker/wit/world.wit | 574 +++++++++--------- .../wit/world.wit | 574 +++++++++--------- .../pulumi_wasm_provider_random/wit/world.wit | 238 ++++---- .../wit/world.wit | 238 ++++---- pulumi_wasm_generator_lib/src/lib.rs | 1 + pulumi_wasm_generator_lib/src/model.rs | 95 +++ .../src/output/provider/source_code.rs | 36 +- .../src/output/rust/resource.rs.handlebars | 6 +- .../src/output/rust/source_code_librs.rs | 57 +- .../src/output/rust/source_code_resource.rs | 76 +-- .../src/output/rust/source_code_types.rs | 80 +-- .../src/output/wit/mod.rs | 40 +- pulumi_wasm_generator_lib/src/utils.rs | 14 + .../command/lib/wit/world.wit | 120 ++-- .../command/provider/wit/world.wit | 120 ++-- .../pulumi_providers/docker/lib/wit/world.wit | 574 +++++++++--------- .../docker/provider/wit/world.wit | 574 +++++++++--------- .../pulumi_providers/random/lib/wit/world.wit | 238 ++++---- .../random/provider/wit/world.wit | 238 ++++---- .../cyclic-types/lib/wit/world.wit | 6 +- .../cyclic-types/provider/wit/world.wit | 6 +- .../mini-awsnative/lib/wit/world.wit | 6 +- .../mini-awsnative/provider/wit/world.wit | 6 +- 23 files changed, 1891 insertions(+), 2026 deletions(-) create mode 100644 pulumi_wasm_generator_lib/src/utils.rs diff --git a/providers/pulumi_wasm_provider_docker/wit/world.wit b/providers/pulumi_wasm_provider_docker/wit/world.wit index 2bd75dd9a..0fd099234 100644 --- a/providers/pulumi_wasm_provider_docker/wit/world.wit +++ b/providers/pulumi_wasm_provider_docker/wit/world.wit @@ -1,433 +1,433 @@ -package pulumi:%docker@4.5.3-ZERO.ZERO.ZERO-DEV; +package pulumi:docker@4.5.3-ZERO.ZERO.ZERO-DEV; -world %docker-pulumi { +world docker-pulumi { import component:pulumi-wasm/register-interface@0.0.0-DEV; - export %container; - export %image; - export %network; - export %plugin; - export %registry-image; - export %remote-image; - export %secret; - export %service; - export %service-config; - export %tag; - export %volume; + export container; + export image; + export network; + export plugin; + export registry-image; + export remote-image; + export secret; + export service; + export service-config; + export tag; + export volume; } -world %docker-pulumi-client { - import %container; - import %image; - import %network; - import %plugin; - import %registry-image; - import %remote-image; - import %secret; - import %service; - import %service-config; - import %tag; - import %volume; +world docker-pulumi-client { + import container; + import image; + import network; + import plugin; + import registry-image; + import remote-image; + import secret; + import service; + import service-config; + import tag; + import volume; } -interface %container { +interface container { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %attach: borrow, - %capabilities: borrow, - %cgroupns-mode: borrow, - %command: borrow, - %container-read-refresh-timeout-milliseconds: borrow, - %cpu-set: borrow, - %cpu-shares: borrow, - %destroy-grace-seconds: borrow, - %devices: borrow, - %dns: borrow, - %dns-opts: borrow, - %dns-searches: borrow, - %domainname: borrow, - %entrypoints: borrow, - %envs: borrow, - %gpus: borrow, - %group-adds: borrow, - %healthcheck: borrow, - %hostname: borrow, - %hosts: borrow, - %image: borrow, - %init: borrow, - %ipc-mode: borrow, - %labels: borrow, - %log-driver: borrow, - %log-opts: borrow, - %logs: borrow, - %max-retry-count: borrow, - %memory: borrow, - %memory-swap: borrow, - %mounts: borrow, - %must-run: borrow, - %name: borrow, - %network-mode: borrow, - %networks-advanced: borrow, - %pid-mode: borrow, - %ports: borrow, - %privileged: borrow, - %publish-all-ports: borrow, - %read-only: borrow, - %remove-volumes: borrow, - %restart: borrow, - %rm: borrow, - %runtime: borrow, - %security-opts: borrow, - %shm-size: borrow, - %start: borrow, - %stdin-open: borrow, - %stop-signal: borrow, - %stop-timeout: borrow, - %storage-opts: borrow, - %sysctls: borrow, - %tmpfs: borrow, - %tty: borrow, - %ulimits: borrow, - %uploads: borrow, - %user: borrow, - %userns-mode: borrow, - %volumes: borrow, - %wait: borrow, - %wait-timeout: borrow, - %working-dir: borrow, + attach: borrow, + capabilities: borrow, + cgroupns-mode: borrow, + command: borrow, + container-read-refresh-timeout-milliseconds: borrow, + cpu-set: borrow, + cpu-shares: borrow, + destroy-grace-seconds: borrow, + devices: borrow, + dns: borrow, + dns-opts: borrow, + dns-searches: borrow, + domainname: borrow, + entrypoints: borrow, + envs: borrow, + gpus: borrow, + group-adds: borrow, + healthcheck: borrow, + hostname: borrow, + hosts: borrow, + image: borrow, + init: borrow, + ipc-mode: borrow, + labels: borrow, + log-driver: borrow, + log-opts: borrow, + logs: borrow, + max-retry-count: borrow, + memory: borrow, + memory-swap: borrow, + mounts: borrow, + must-run: borrow, + name: borrow, + network-mode: borrow, + networks-advanced: borrow, + pid-mode: borrow, + ports: borrow, + privileged: borrow, + publish-all-ports: borrow, + read-only: borrow, + remove-volumes: borrow, + restart: borrow, + rm: borrow, + runtime: borrow, + security-opts: borrow, + shm-size: borrow, + start: borrow, + stdin-open: borrow, + stop-signal: borrow, + stop-timeout: borrow, + storage-opts: borrow, + sysctls: borrow, + tmpfs: borrow, + tty: borrow, + ulimits: borrow, + uploads: borrow, + user: borrow, + userns-mode: borrow, + volumes: borrow, + wait: borrow, + wait-timeout: borrow, + working-dir: borrow, } record res { - %attach: output, - %bridge: output, - %capabilities: output, - %cgroupns-mode: output, - %command: output, - %container-logs: output, - %container-read-refresh-timeout-milliseconds: output, - %cpu-set: output, - %cpu-shares: output, - %destroy-grace-seconds: output, - %devices: output, - %dns: output, - %dns-opts: output, - %dns-searches: output, - %domainname: output, - %entrypoints: output, - %envs: output, - %exit-code: output, - %gpus: output, - %group-adds: output, - %healthcheck: output, - %hostname: output, - %hosts: output, - %image: output, - %init: output, - %ipc-mode: output, - %labels: output, - %log-driver: output, - %log-opts: output, - %logs: output, - %max-retry-count: output, - %memory: output, - %memory-swap: output, - %mounts: output, - %must-run: output, - %name: output, - %network-datas: output, - %network-mode: output, - %networks-advanced: output, - %pid-mode: output, - %ports: output, - %privileged: output, - %publish-all-ports: output, - %read-only: output, - %remove-volumes: output, - %restart: output, - %rm: output, - %runtime: output, - %security-opts: output, - %shm-size: output, - %start: output, - %stdin-open: output, - %stop-signal: output, - %stop-timeout: output, - %storage-opts: output, - %sysctls: output, - %tmpfs: output, - %tty: output, - %ulimits: output, - %uploads: output, - %user: output, - %userns-mode: output, - %volumes: output, - %wait: output, - %wait-timeout: output, - %working-dir: output, + attach: output, + bridge: output, + capabilities: output, + cgroupns-mode: output, + command: output, + container-logs: output, + container-read-refresh-timeout-milliseconds: output, + cpu-set: output, + cpu-shares: output, + destroy-grace-seconds: output, + devices: output, + dns: output, + dns-opts: output, + dns-searches: output, + domainname: output, + entrypoints: output, + envs: output, + exit-code: output, + gpus: output, + group-adds: output, + healthcheck: output, + hostname: output, + hosts: output, + image: output, + init: output, + ipc-mode: output, + labels: output, + log-driver: output, + log-opts: output, + logs: output, + max-retry-count: output, + memory: output, + memory-swap: output, + mounts: output, + must-run: output, + name: output, + network-datas: output, + network-mode: output, + networks-advanced: output, + pid-mode: output, + ports: output, + privileged: output, + publish-all-ports: output, + read-only: output, + remove-volumes: output, + restart: output, + rm: output, + runtime: output, + security-opts: output, + shm-size: output, + start: output, + stdin-open: output, + stop-signal: output, + stop-timeout: output, + storage-opts: output, + sysctls: output, + tmpfs: output, + tty: output, + ulimits: output, + uploads: output, + user: output, + userns-mode: output, + volumes: output, + wait: output, + wait-timeout: output, + working-dir: output, } invoke: func(name: string, args: args) -> res; } -interface %image { +interface image { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %build: borrow, - %build-on-preview: borrow, - %image-name: borrow, - %registry: borrow, - %skip-push: borrow, + build: borrow, + build-on-preview: borrow, + image-name: borrow, + registry: borrow, + skip-push: borrow, } record res { - %base-image-name: output, - %context: output, - %dockerfile: output, - %image-name: output, - %platform: output, - %registry-server: output, - %repo-digest: output, + base-image-name: output, + context: output, + dockerfile: output, + image-name: output, + platform: output, + registry-server: output, + repo-digest: output, } invoke: func(name: string, args: args) -> res; } -interface %network { +interface network { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %attachable: borrow, - %check-duplicate: borrow, - %driver: borrow, - %ingress: borrow, - %internal: borrow, - %ipam-configs: borrow, - %ipam-driver: borrow, - %ipam-options: borrow, - %ipv6: borrow, - %labels: borrow, - %name: borrow, - %options: borrow, + attachable: borrow, + check-duplicate: borrow, + driver: borrow, + ingress: borrow, + internal: borrow, + ipam-configs: borrow, + ipam-driver: borrow, + ipam-options: borrow, + ipv6: borrow, + labels: borrow, + name: borrow, + options: borrow, } record res { - %attachable: output, - %check-duplicate: output, - %driver: output, - %ingress: output, - %internal: output, - %ipam-configs: output, - %ipam-driver: output, - %ipam-options: output, - %ipv6: output, - %labels: output, - %name: output, - %options: output, - %scope: output, + attachable: output, + check-duplicate: output, + driver: output, + ingress: output, + internal: output, + ipam-configs: output, + ipam-driver: output, + ipam-options: output, + ipv6: output, + labels: output, + name: output, + options: output, + scope: output, } invoke: func(name: string, args: args) -> res; } -interface %plugin { +interface plugin { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %alias: borrow, - %enable-timeout: borrow, - %enabled: borrow, - %envs: borrow, - %force-destroy: borrow, - %force-disable: borrow, - %grant-all-permissions: borrow, - %grant-permissions: borrow, - %name: borrow, + alias: borrow, + enable-timeout: borrow, + enabled: borrow, + envs: borrow, + force-destroy: borrow, + force-disable: borrow, + grant-all-permissions: borrow, + grant-permissions: borrow, + name: borrow, } record res { - %alias: output, - %enable-timeout: output, - %enabled: output, - %envs: output, - %force-destroy: output, - %force-disable: output, - %grant-all-permissions: output, - %grant-permissions: output, - %name: output, - %plugin-reference: output, + alias: output, + enable-timeout: output, + enabled: output, + envs: output, + force-destroy: output, + force-disable: output, + grant-all-permissions: output, + grant-permissions: output, + name: output, + plugin-reference: output, } invoke: func(name: string, args: args) -> res; } -interface %registry-image { +interface registry-image { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %insecure-skip-verify: borrow, - %keep-remotely: borrow, - %name: borrow, - %triggers: borrow, + insecure-skip-verify: borrow, + keep-remotely: borrow, + name: borrow, + triggers: borrow, } record res { - %insecure-skip-verify: output, - %keep-remotely: output, - %name: output, - %sha256-digest: output, - %triggers: output, + insecure-skip-verify: output, + keep-remotely: output, + name: output, + sha256-digest: output, + triggers: output, } invoke: func(name: string, args: args) -> res; } -interface %remote-image { +interface remote-image { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %build: borrow, - %force-remove: borrow, - %keep-locally: borrow, - %name: borrow, - %platform: borrow, - %pull-triggers: borrow, - %triggers: borrow, + build: borrow, + force-remove: borrow, + keep-locally: borrow, + name: borrow, + platform: borrow, + pull-triggers: borrow, + triggers: borrow, } record res { - %build: output, - %force-remove: output, - %image-id: output, - %keep-locally: output, - %name: output, - %platform: output, - %pull-triggers: output, - %repo-digest: output, - %triggers: output, + build: output, + force-remove: output, + image-id: output, + keep-locally: output, + name: output, + platform: output, + pull-triggers: output, + repo-digest: output, + triggers: output, } invoke: func(name: string, args: args) -> res; } -interface %secret { +interface secret { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %data: borrow, - %labels: borrow, - %name: borrow, + data: borrow, + labels: borrow, + name: borrow, } record res { - %data: output, - %labels: output, - %name: output, + data: output, + labels: output, + name: output, } invoke: func(name: string, args: args) -> res; } -interface %service { +interface service { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %auth: borrow, - %converge-config: borrow, - %endpoint-spec: borrow, - %labels: borrow, - %mode: borrow, - %name: borrow, - %rollback-config: borrow, - %task-spec: borrow, - %update-config: borrow, + auth: borrow, + converge-config: borrow, + endpoint-spec: borrow, + labels: borrow, + mode: borrow, + name: borrow, + rollback-config: borrow, + task-spec: borrow, + update-config: borrow, } record res { - %auth: output, - %converge-config: output, - %endpoint-spec: output, - %labels: output, - %mode: output, - %name: output, - %rollback-config: output, - %task-spec: output, - %update-config: output, + auth: output, + converge-config: output, + endpoint-spec: output, + labels: output, + mode: output, + name: output, + rollback-config: output, + task-spec: output, + update-config: output, } invoke: func(name: string, args: args) -> res; } -interface %service-config { +interface service-config { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %data: borrow, - %name: borrow, + data: borrow, + name: borrow, } record res { - %data: output, - %name: output, + data: output, + name: output, } invoke: func(name: string, args: args) -> res; } -interface %tag { +interface tag { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %source-image: borrow, - %target-image: borrow, + source-image: borrow, + target-image: borrow, } record res { - %source-image: output, - %source-image-id: output, - %target-image: output, + source-image: output, + source-image-id: output, + target-image: output, } invoke: func(name: string, args: args) -> res; } -interface %volume { +interface volume { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %driver: borrow, - %driver-opts: borrow, - %labels: borrow, - %name: borrow, + driver: borrow, + driver-opts: borrow, + labels: borrow, + name: borrow, } record res { - %driver: output, - %driver-opts: output, - %labels: output, - %mountpoint: output, - %name: output, + driver: output, + driver-opts: output, + labels: output, + mountpoint: output, + name: output, } invoke: func(name: string, args: args) -> res; diff --git a/providers/pulumi_wasm_provider_docker_rust/wit/world.wit b/providers/pulumi_wasm_provider_docker_rust/wit/world.wit index 2bd75dd9a..0fd099234 100644 --- a/providers/pulumi_wasm_provider_docker_rust/wit/world.wit +++ b/providers/pulumi_wasm_provider_docker_rust/wit/world.wit @@ -1,433 +1,433 @@ -package pulumi:%docker@4.5.3-ZERO.ZERO.ZERO-DEV; +package pulumi:docker@4.5.3-ZERO.ZERO.ZERO-DEV; -world %docker-pulumi { +world docker-pulumi { import component:pulumi-wasm/register-interface@0.0.0-DEV; - export %container; - export %image; - export %network; - export %plugin; - export %registry-image; - export %remote-image; - export %secret; - export %service; - export %service-config; - export %tag; - export %volume; + export container; + export image; + export network; + export plugin; + export registry-image; + export remote-image; + export secret; + export service; + export service-config; + export tag; + export volume; } -world %docker-pulumi-client { - import %container; - import %image; - import %network; - import %plugin; - import %registry-image; - import %remote-image; - import %secret; - import %service; - import %service-config; - import %tag; - import %volume; +world docker-pulumi-client { + import container; + import image; + import network; + import plugin; + import registry-image; + import remote-image; + import secret; + import service; + import service-config; + import tag; + import volume; } -interface %container { +interface container { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %attach: borrow, - %capabilities: borrow, - %cgroupns-mode: borrow, - %command: borrow, - %container-read-refresh-timeout-milliseconds: borrow, - %cpu-set: borrow, - %cpu-shares: borrow, - %destroy-grace-seconds: borrow, - %devices: borrow, - %dns: borrow, - %dns-opts: borrow, - %dns-searches: borrow, - %domainname: borrow, - %entrypoints: borrow, - %envs: borrow, - %gpus: borrow, - %group-adds: borrow, - %healthcheck: borrow, - %hostname: borrow, - %hosts: borrow, - %image: borrow, - %init: borrow, - %ipc-mode: borrow, - %labels: borrow, - %log-driver: borrow, - %log-opts: borrow, - %logs: borrow, - %max-retry-count: borrow, - %memory: borrow, - %memory-swap: borrow, - %mounts: borrow, - %must-run: borrow, - %name: borrow, - %network-mode: borrow, - %networks-advanced: borrow, - %pid-mode: borrow, - %ports: borrow, - %privileged: borrow, - %publish-all-ports: borrow, - %read-only: borrow, - %remove-volumes: borrow, - %restart: borrow, - %rm: borrow, - %runtime: borrow, - %security-opts: borrow, - %shm-size: borrow, - %start: borrow, - %stdin-open: borrow, - %stop-signal: borrow, - %stop-timeout: borrow, - %storage-opts: borrow, - %sysctls: borrow, - %tmpfs: borrow, - %tty: borrow, - %ulimits: borrow, - %uploads: borrow, - %user: borrow, - %userns-mode: borrow, - %volumes: borrow, - %wait: borrow, - %wait-timeout: borrow, - %working-dir: borrow, + attach: borrow, + capabilities: borrow, + cgroupns-mode: borrow, + command: borrow, + container-read-refresh-timeout-milliseconds: borrow, + cpu-set: borrow, + cpu-shares: borrow, + destroy-grace-seconds: borrow, + devices: borrow, + dns: borrow, + dns-opts: borrow, + dns-searches: borrow, + domainname: borrow, + entrypoints: borrow, + envs: borrow, + gpus: borrow, + group-adds: borrow, + healthcheck: borrow, + hostname: borrow, + hosts: borrow, + image: borrow, + init: borrow, + ipc-mode: borrow, + labels: borrow, + log-driver: borrow, + log-opts: borrow, + logs: borrow, + max-retry-count: borrow, + memory: borrow, + memory-swap: borrow, + mounts: borrow, + must-run: borrow, + name: borrow, + network-mode: borrow, + networks-advanced: borrow, + pid-mode: borrow, + ports: borrow, + privileged: borrow, + publish-all-ports: borrow, + read-only: borrow, + remove-volumes: borrow, + restart: borrow, + rm: borrow, + runtime: borrow, + security-opts: borrow, + shm-size: borrow, + start: borrow, + stdin-open: borrow, + stop-signal: borrow, + stop-timeout: borrow, + storage-opts: borrow, + sysctls: borrow, + tmpfs: borrow, + tty: borrow, + ulimits: borrow, + uploads: borrow, + user: borrow, + userns-mode: borrow, + volumes: borrow, + wait: borrow, + wait-timeout: borrow, + working-dir: borrow, } record res { - %attach: output, - %bridge: output, - %capabilities: output, - %cgroupns-mode: output, - %command: output, - %container-logs: output, - %container-read-refresh-timeout-milliseconds: output, - %cpu-set: output, - %cpu-shares: output, - %destroy-grace-seconds: output, - %devices: output, - %dns: output, - %dns-opts: output, - %dns-searches: output, - %domainname: output, - %entrypoints: output, - %envs: output, - %exit-code: output, - %gpus: output, - %group-adds: output, - %healthcheck: output, - %hostname: output, - %hosts: output, - %image: output, - %init: output, - %ipc-mode: output, - %labels: output, - %log-driver: output, - %log-opts: output, - %logs: output, - %max-retry-count: output, - %memory: output, - %memory-swap: output, - %mounts: output, - %must-run: output, - %name: output, - %network-datas: output, - %network-mode: output, - %networks-advanced: output, - %pid-mode: output, - %ports: output, - %privileged: output, - %publish-all-ports: output, - %read-only: output, - %remove-volumes: output, - %restart: output, - %rm: output, - %runtime: output, - %security-opts: output, - %shm-size: output, - %start: output, - %stdin-open: output, - %stop-signal: output, - %stop-timeout: output, - %storage-opts: output, - %sysctls: output, - %tmpfs: output, - %tty: output, - %ulimits: output, - %uploads: output, - %user: output, - %userns-mode: output, - %volumes: output, - %wait: output, - %wait-timeout: output, - %working-dir: output, + attach: output, + bridge: output, + capabilities: output, + cgroupns-mode: output, + command: output, + container-logs: output, + container-read-refresh-timeout-milliseconds: output, + cpu-set: output, + cpu-shares: output, + destroy-grace-seconds: output, + devices: output, + dns: output, + dns-opts: output, + dns-searches: output, + domainname: output, + entrypoints: output, + envs: output, + exit-code: output, + gpus: output, + group-adds: output, + healthcheck: output, + hostname: output, + hosts: output, + image: output, + init: output, + ipc-mode: output, + labels: output, + log-driver: output, + log-opts: output, + logs: output, + max-retry-count: output, + memory: output, + memory-swap: output, + mounts: output, + must-run: output, + name: output, + network-datas: output, + network-mode: output, + networks-advanced: output, + pid-mode: output, + ports: output, + privileged: output, + publish-all-ports: output, + read-only: output, + remove-volumes: output, + restart: output, + rm: output, + runtime: output, + security-opts: output, + shm-size: output, + start: output, + stdin-open: output, + stop-signal: output, + stop-timeout: output, + storage-opts: output, + sysctls: output, + tmpfs: output, + tty: output, + ulimits: output, + uploads: output, + user: output, + userns-mode: output, + volumes: output, + wait: output, + wait-timeout: output, + working-dir: output, } invoke: func(name: string, args: args) -> res; } -interface %image { +interface image { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %build: borrow, - %build-on-preview: borrow, - %image-name: borrow, - %registry: borrow, - %skip-push: borrow, + build: borrow, + build-on-preview: borrow, + image-name: borrow, + registry: borrow, + skip-push: borrow, } record res { - %base-image-name: output, - %context: output, - %dockerfile: output, - %image-name: output, - %platform: output, - %registry-server: output, - %repo-digest: output, + base-image-name: output, + context: output, + dockerfile: output, + image-name: output, + platform: output, + registry-server: output, + repo-digest: output, } invoke: func(name: string, args: args) -> res; } -interface %network { +interface network { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %attachable: borrow, - %check-duplicate: borrow, - %driver: borrow, - %ingress: borrow, - %internal: borrow, - %ipam-configs: borrow, - %ipam-driver: borrow, - %ipam-options: borrow, - %ipv6: borrow, - %labels: borrow, - %name: borrow, - %options: borrow, + attachable: borrow, + check-duplicate: borrow, + driver: borrow, + ingress: borrow, + internal: borrow, + ipam-configs: borrow, + ipam-driver: borrow, + ipam-options: borrow, + ipv6: borrow, + labels: borrow, + name: borrow, + options: borrow, } record res { - %attachable: output, - %check-duplicate: output, - %driver: output, - %ingress: output, - %internal: output, - %ipam-configs: output, - %ipam-driver: output, - %ipam-options: output, - %ipv6: output, - %labels: output, - %name: output, - %options: output, - %scope: output, + attachable: output, + check-duplicate: output, + driver: output, + ingress: output, + internal: output, + ipam-configs: output, + ipam-driver: output, + ipam-options: output, + ipv6: output, + labels: output, + name: output, + options: output, + scope: output, } invoke: func(name: string, args: args) -> res; } -interface %plugin { +interface plugin { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %alias: borrow, - %enable-timeout: borrow, - %enabled: borrow, - %envs: borrow, - %force-destroy: borrow, - %force-disable: borrow, - %grant-all-permissions: borrow, - %grant-permissions: borrow, - %name: borrow, + alias: borrow, + enable-timeout: borrow, + enabled: borrow, + envs: borrow, + force-destroy: borrow, + force-disable: borrow, + grant-all-permissions: borrow, + grant-permissions: borrow, + name: borrow, } record res { - %alias: output, - %enable-timeout: output, - %enabled: output, - %envs: output, - %force-destroy: output, - %force-disable: output, - %grant-all-permissions: output, - %grant-permissions: output, - %name: output, - %plugin-reference: output, + alias: output, + enable-timeout: output, + enabled: output, + envs: output, + force-destroy: output, + force-disable: output, + grant-all-permissions: output, + grant-permissions: output, + name: output, + plugin-reference: output, } invoke: func(name: string, args: args) -> res; } -interface %registry-image { +interface registry-image { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %insecure-skip-verify: borrow, - %keep-remotely: borrow, - %name: borrow, - %triggers: borrow, + insecure-skip-verify: borrow, + keep-remotely: borrow, + name: borrow, + triggers: borrow, } record res { - %insecure-skip-verify: output, - %keep-remotely: output, - %name: output, - %sha256-digest: output, - %triggers: output, + insecure-skip-verify: output, + keep-remotely: output, + name: output, + sha256-digest: output, + triggers: output, } invoke: func(name: string, args: args) -> res; } -interface %remote-image { +interface remote-image { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %build: borrow, - %force-remove: borrow, - %keep-locally: borrow, - %name: borrow, - %platform: borrow, - %pull-triggers: borrow, - %triggers: borrow, + build: borrow, + force-remove: borrow, + keep-locally: borrow, + name: borrow, + platform: borrow, + pull-triggers: borrow, + triggers: borrow, } record res { - %build: output, - %force-remove: output, - %image-id: output, - %keep-locally: output, - %name: output, - %platform: output, - %pull-triggers: output, - %repo-digest: output, - %triggers: output, + build: output, + force-remove: output, + image-id: output, + keep-locally: output, + name: output, + platform: output, + pull-triggers: output, + repo-digest: output, + triggers: output, } invoke: func(name: string, args: args) -> res; } -interface %secret { +interface secret { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %data: borrow, - %labels: borrow, - %name: borrow, + data: borrow, + labels: borrow, + name: borrow, } record res { - %data: output, - %labels: output, - %name: output, + data: output, + labels: output, + name: output, } invoke: func(name: string, args: args) -> res; } -interface %service { +interface service { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %auth: borrow, - %converge-config: borrow, - %endpoint-spec: borrow, - %labels: borrow, - %mode: borrow, - %name: borrow, - %rollback-config: borrow, - %task-spec: borrow, - %update-config: borrow, + auth: borrow, + converge-config: borrow, + endpoint-spec: borrow, + labels: borrow, + mode: borrow, + name: borrow, + rollback-config: borrow, + task-spec: borrow, + update-config: borrow, } record res { - %auth: output, - %converge-config: output, - %endpoint-spec: output, - %labels: output, - %mode: output, - %name: output, - %rollback-config: output, - %task-spec: output, - %update-config: output, + auth: output, + converge-config: output, + endpoint-spec: output, + labels: output, + mode: output, + name: output, + rollback-config: output, + task-spec: output, + update-config: output, } invoke: func(name: string, args: args) -> res; } -interface %service-config { +interface service-config { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %data: borrow, - %name: borrow, + data: borrow, + name: borrow, } record res { - %data: output, - %name: output, + data: output, + name: output, } invoke: func(name: string, args: args) -> res; } -interface %tag { +interface tag { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %source-image: borrow, - %target-image: borrow, + source-image: borrow, + target-image: borrow, } record res { - %source-image: output, - %source-image-id: output, - %target-image: output, + source-image: output, + source-image-id: output, + target-image: output, } invoke: func(name: string, args: args) -> res; } -interface %volume { +interface volume { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %driver: borrow, - %driver-opts: borrow, - %labels: borrow, - %name: borrow, + driver: borrow, + driver-opts: borrow, + labels: borrow, + name: borrow, } record res { - %driver: output, - %driver-opts: output, - %labels: output, - %mountpoint: output, - %name: output, + driver: output, + driver-opts: output, + labels: output, + mountpoint: output, + name: output, } invoke: func(name: string, args: args) -> res; diff --git a/providers/pulumi_wasm_provider_random/wit/world.wit b/providers/pulumi_wasm_provider_random/wit/world.wit index 1a0ac4ff1..cec608df2 100644 --- a/providers/pulumi_wasm_provider_random/wit/world.wit +++ b/providers/pulumi_wasm_provider_random/wit/world.wit @@ -1,229 +1,229 @@ -package pulumi:%random@4.15.0-ZERO.ZERO.ZERO-DEV; +package pulumi:random@4.15.0-ZERO.ZERO.ZERO-DEV; -world %random-pulumi { +world random-pulumi { import component:pulumi-wasm/register-interface@0.0.0-DEV; - export %random-bytes; - export %random-id; - export %random-integer; - export %random-password; - export %random-pet; - export %random-shuffle; - export %random-string; - export %random-uuid; + export random-bytes; + export random-id; + export random-integer; + export random-password; + export random-pet; + export random-shuffle; + export random-string; + export random-uuid; } -world %random-pulumi-client { - import %random-bytes; - import %random-id; - import %random-integer; - import %random-password; - import %random-pet; - import %random-shuffle; - import %random-string; - import %random-uuid; +world random-pulumi-client { + import random-bytes; + import random-id; + import random-integer; + import random-password; + import random-pet; + import random-shuffle; + import random-string; + import random-uuid; } -interface %random-bytes { +interface random-bytes { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, + keepers: borrow, + length: borrow, } record res { - %base64: output, - %hex: output, - %keepers: output, - %length: output, + base64: output, + hex: output, + keepers: output, + length: output, } invoke: func(name: string, args: args) -> res; } -interface %random-id { +interface random-id { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %byte-length: borrow, - %keepers: borrow, - %prefix: borrow, + byte-length: borrow, + keepers: borrow, + prefix: borrow, } record res { - %b64-std: output, - %b64-url: output, - %byte-length: output, - %dec: output, - %hex: output, - %keepers: output, - %prefix: output, + b64-std: output, + b64-url: output, + byte-length: output, + dec: output, + hex: output, + keepers: output, + prefix: output, } invoke: func(name: string, args: args) -> res; } -interface %random-integer { +interface random-integer { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %max: borrow, - %min: borrow, - %seed: borrow, + keepers: borrow, + max: borrow, + min: borrow, + seed: borrow, } record res { - %keepers: output, - %max: output, - %min: output, + keepers: output, + max: output, + min: output, %result: output, - %seed: output, + seed: output, } invoke: func(name: string, args: args) -> res; } -interface %random-password { +interface random-password { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, - %lower: borrow, - %min-lower: borrow, - %min-numeric: borrow, - %min-special: borrow, - %min-upper: borrow, - %number: borrow, - %numeric: borrow, - %override-special: borrow, - %special: borrow, - %upper: borrow, + keepers: borrow, + length: borrow, + lower: borrow, + min-lower: borrow, + min-numeric: borrow, + min-special: borrow, + min-upper: borrow, + number: borrow, + numeric: borrow, + override-special: borrow, + special: borrow, + upper: borrow, } record res { - %bcrypt-hash: output, - %keepers: output, - %length: output, - %lower: output, - %min-lower: output, - %min-numeric: output, - %min-special: output, - %min-upper: output, - %number: output, - %numeric: output, - %override-special: output, + bcrypt-hash: output, + keepers: output, + length: output, + lower: output, + min-lower: output, + min-numeric: output, + min-special: output, + min-upper: output, + number: output, + numeric: output, + override-special: output, %result: output, - %special: output, - %upper: output, + special: output, + upper: output, } invoke: func(name: string, args: args) -> res; } -interface %random-pet { +interface random-pet { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, - %prefix: borrow, - %separator: borrow, + keepers: borrow, + length: borrow, + prefix: borrow, + separator: borrow, } record res { - %keepers: output, - %length: output, - %prefix: output, - %separator: output, + keepers: output, + length: output, + prefix: output, + separator: output, } invoke: func(name: string, args: args) -> res; } -interface %random-shuffle { +interface random-shuffle { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %inputs: borrow, - %keepers: borrow, - %result-count: borrow, - %seed: borrow, + inputs: borrow, + keepers: borrow, + result-count: borrow, + seed: borrow, } record res { - %inputs: output, - %keepers: output, - %result-count: output, - %results: output, - %seed: output, + inputs: output, + keepers: output, + result-count: output, + results: output, + seed: output, } invoke: func(name: string, args: args) -> res; } -interface %random-string { +interface random-string { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, - %lower: borrow, - %min-lower: borrow, - %min-numeric: borrow, - %min-special: borrow, - %min-upper: borrow, - %number: borrow, - %numeric: borrow, - %override-special: borrow, - %special: borrow, - %upper: borrow, + keepers: borrow, + length: borrow, + lower: borrow, + min-lower: borrow, + min-numeric: borrow, + min-special: borrow, + min-upper: borrow, + number: borrow, + numeric: borrow, + override-special: borrow, + special: borrow, + upper: borrow, } record res { - %keepers: output, - %length: output, - %lower: output, - %min-lower: output, - %min-numeric: output, - %min-special: output, - %min-upper: output, - %number: output, - %numeric: output, - %override-special: output, + keepers: output, + length: output, + lower: output, + min-lower: output, + min-numeric: output, + min-special: output, + min-upper: output, + number: output, + numeric: output, + override-special: output, %result: output, - %special: output, - %upper: output, + special: output, + upper: output, } invoke: func(name: string, args: args) -> res; } -interface %random-uuid { +interface random-uuid { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, + keepers: borrow, } record res { - %keepers: output, + keepers: output, %result: output, } diff --git a/providers/pulumi_wasm_provider_random_rust/wit/world.wit b/providers/pulumi_wasm_provider_random_rust/wit/world.wit index 1a0ac4ff1..cec608df2 100644 --- a/providers/pulumi_wasm_provider_random_rust/wit/world.wit +++ b/providers/pulumi_wasm_provider_random_rust/wit/world.wit @@ -1,229 +1,229 @@ -package pulumi:%random@4.15.0-ZERO.ZERO.ZERO-DEV; +package pulumi:random@4.15.0-ZERO.ZERO.ZERO-DEV; -world %random-pulumi { +world random-pulumi { import component:pulumi-wasm/register-interface@0.0.0-DEV; - export %random-bytes; - export %random-id; - export %random-integer; - export %random-password; - export %random-pet; - export %random-shuffle; - export %random-string; - export %random-uuid; + export random-bytes; + export random-id; + export random-integer; + export random-password; + export random-pet; + export random-shuffle; + export random-string; + export random-uuid; } -world %random-pulumi-client { - import %random-bytes; - import %random-id; - import %random-integer; - import %random-password; - import %random-pet; - import %random-shuffle; - import %random-string; - import %random-uuid; +world random-pulumi-client { + import random-bytes; + import random-id; + import random-integer; + import random-password; + import random-pet; + import random-shuffle; + import random-string; + import random-uuid; } -interface %random-bytes { +interface random-bytes { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, + keepers: borrow, + length: borrow, } record res { - %base64: output, - %hex: output, - %keepers: output, - %length: output, + base64: output, + hex: output, + keepers: output, + length: output, } invoke: func(name: string, args: args) -> res; } -interface %random-id { +interface random-id { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %byte-length: borrow, - %keepers: borrow, - %prefix: borrow, + byte-length: borrow, + keepers: borrow, + prefix: borrow, } record res { - %b64-std: output, - %b64-url: output, - %byte-length: output, - %dec: output, - %hex: output, - %keepers: output, - %prefix: output, + b64-std: output, + b64-url: output, + byte-length: output, + dec: output, + hex: output, + keepers: output, + prefix: output, } invoke: func(name: string, args: args) -> res; } -interface %random-integer { +interface random-integer { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %max: borrow, - %min: borrow, - %seed: borrow, + keepers: borrow, + max: borrow, + min: borrow, + seed: borrow, } record res { - %keepers: output, - %max: output, - %min: output, + keepers: output, + max: output, + min: output, %result: output, - %seed: output, + seed: output, } invoke: func(name: string, args: args) -> res; } -interface %random-password { +interface random-password { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, - %lower: borrow, - %min-lower: borrow, - %min-numeric: borrow, - %min-special: borrow, - %min-upper: borrow, - %number: borrow, - %numeric: borrow, - %override-special: borrow, - %special: borrow, - %upper: borrow, + keepers: borrow, + length: borrow, + lower: borrow, + min-lower: borrow, + min-numeric: borrow, + min-special: borrow, + min-upper: borrow, + number: borrow, + numeric: borrow, + override-special: borrow, + special: borrow, + upper: borrow, } record res { - %bcrypt-hash: output, - %keepers: output, - %length: output, - %lower: output, - %min-lower: output, - %min-numeric: output, - %min-special: output, - %min-upper: output, - %number: output, - %numeric: output, - %override-special: output, + bcrypt-hash: output, + keepers: output, + length: output, + lower: output, + min-lower: output, + min-numeric: output, + min-special: output, + min-upper: output, + number: output, + numeric: output, + override-special: output, %result: output, - %special: output, - %upper: output, + special: output, + upper: output, } invoke: func(name: string, args: args) -> res; } -interface %random-pet { +interface random-pet { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, - %prefix: borrow, - %separator: borrow, + keepers: borrow, + length: borrow, + prefix: borrow, + separator: borrow, } record res { - %keepers: output, - %length: output, - %prefix: output, - %separator: output, + keepers: output, + length: output, + prefix: output, + separator: output, } invoke: func(name: string, args: args) -> res; } -interface %random-shuffle { +interface random-shuffle { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %inputs: borrow, - %keepers: borrow, - %result-count: borrow, - %seed: borrow, + inputs: borrow, + keepers: borrow, + result-count: borrow, + seed: borrow, } record res { - %inputs: output, - %keepers: output, - %result-count: output, - %results: output, - %seed: output, + inputs: output, + keepers: output, + result-count: output, + results: output, + seed: output, } invoke: func(name: string, args: args) -> res; } -interface %random-string { +interface random-string { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, - %lower: borrow, - %min-lower: borrow, - %min-numeric: borrow, - %min-special: borrow, - %min-upper: borrow, - %number: borrow, - %numeric: borrow, - %override-special: borrow, - %special: borrow, - %upper: borrow, + keepers: borrow, + length: borrow, + lower: borrow, + min-lower: borrow, + min-numeric: borrow, + min-special: borrow, + min-upper: borrow, + number: borrow, + numeric: borrow, + override-special: borrow, + special: borrow, + upper: borrow, } record res { - %keepers: output, - %length: output, - %lower: output, - %min-lower: output, - %min-numeric: output, - %min-special: output, - %min-upper: output, - %number: output, - %numeric: output, - %override-special: output, + keepers: output, + length: output, + lower: output, + min-lower: output, + min-numeric: output, + min-special: output, + min-upper: output, + number: output, + numeric: output, + override-special: output, %result: output, - %special: output, - %upper: output, + special: output, + upper: output, } invoke: func(name: string, args: args) -> res; } -interface %random-uuid { +interface random-uuid { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, + keepers: borrow, } record res { - %keepers: output, + keepers: output, %result: output, } diff --git a/pulumi_wasm_generator_lib/src/lib.rs b/pulumi_wasm_generator_lib/src/lib.rs index 790508769..71c80f816 100644 --- a/pulumi_wasm_generator_lib/src/lib.rs +++ b/pulumi_wasm_generator_lib/src/lib.rs @@ -9,6 +9,7 @@ use anyhow::{Context, Result}; mod model; mod output; mod schema; +mod utils; pub fn generate_rust_library(schema_json: &Path, result_path: &Path) -> Result<()> { let schema_package: schema::Package = extract_schema_from_file(schema_json)?; diff --git a/pulumi_wasm_generator_lib/src/model.rs b/pulumi_wasm_generator_lib/src/model.rs index 930f457a6..596f4c538 100644 --- a/pulumi_wasm_generator_lib/src/model.rs +++ b/pulumi_wasm_generator_lib/src/model.rs @@ -1,4 +1,7 @@ +use crate::utils::{escape_wit_identifier, replace_multiple_dashes}; use anyhow::{Context, Result}; +use convert_case::Case; +use convert_case::Casing; use std::collections::BTreeMap; #[derive(Clone, Debug, PartialEq, Hash, Ord, PartialOrd, Eq)] @@ -19,12 +22,31 @@ pub(crate) struct InputProperty { pub(crate) r#type: Type, } +impl InputProperty { + pub(crate) fn get_wit_argument_name(&self) -> String { + escape_wit_identifier(ElementId::create_valid_wit_id(self.name.as_str()).as_str()).into() + } + + pub(crate) fn get_rust_argument_name(&self) -> String { + ElementId::create_valid_wit_rust_id(self.name.as_str()) + } +} + #[derive(Debug, PartialEq, Hash, Ord, PartialOrd, Eq)] pub(crate) struct OutputProperty { pub(crate) name: String, pub(crate) r#type: Type, } +impl OutputProperty { + pub(crate) fn get_wit_argument_name(&self) -> String { + escape_wit_identifier(ElementId::create_valid_wit_id(self.name.as_str()).as_str()).into() + } + pub(crate) fn get_rust_argument_name(&self) -> String { + ElementId::create_valid_wit_rust_id(self.name.as_str()) + } +} + #[derive(Debug, PartialEq, Hash, Ord, PartialOrd, Eq)] pub(crate) struct GlobalTypeProperty { pub(crate) name: String, @@ -57,6 +79,12 @@ pub(crate) struct Package { pub(crate) types: BTreeMap, } +impl Package { + pub(crate) fn get_wit_name(&self) -> String { + ElementId::create_valid_wit_id(self.name.as_str()) + } +} + #[derive(Clone, Eq, PartialEq, Hash, Ord, PartialOrd, Debug)] pub(crate) enum Ref { Type(ElementId), @@ -72,6 +100,73 @@ pub(crate) struct ElementId { pub(crate) raw: String, } +impl ElementId { + pub(crate) fn get_rust_function_name(&self) -> String { + self.name + .clone() + .from_case(Case::UpperCamel) + .to_case(Case::Snake) + } + + pub(crate) fn get_rust_namespace_name(&self) -> String { + let mut vec = self.namespace.clone(); + vec.push(self.name.clone()); + Self::create_valid_id(&vec.join("-")) + } + + pub(crate) fn get_wit_argument_name(&self) -> String { + Self::create_valid_wit_id(self.name.as_str()) + } + pub(crate) fn get_wit_interface_name(&self) -> String { + let mut vec = self.namespace.clone(); + vec.push(self.name.clone()); + Self::create_valid_wit_id(&vec.join("-")) + } + + fn create_valid_wit_rust_id(s: &str) -> String { + Self::create_valid_wit_id(s).replace("-", "_") + } + + fn create_valid_wit_id(s: &str) -> String { + let result: String = s + .chars() + .map(|c| { + if c.is_uppercase() { + format!("-{}", c.to_lowercase()) + } else if !c.is_alphanumeric() { + "-".to_string() + } else { + c.to_string() + } + }) + .collect(); + + let result = replace_multiple_dashes(&result); + let result = result.trim_matches('-').to_string(); + result + } + + fn create_valid_id(s: &str) -> String { + let result: String = s + .chars() + .map(|c| { + if c.is_uppercase() { + format!("-{}", c.to_lowercase()) + } else if !c.is_alphanumeric() { + "-".to_string() + } else { + c.to_string() + } + }) + .collect(); + + let result = replace_multiple_dashes(&result); + let result = result.trim_matches('-').to_string(); + + result.replace('-', "_") + } +} + impl Ref { pub(crate) fn new(raw: &str) -> Result { if raw == "pulumi.json#/Archive" { diff --git a/pulumi_wasm_generator_lib/src/output/provider/source_code.rs b/pulumi_wasm_generator_lib/src/output/provider/source_code.rs index cf885f7eb..59358cf8f 100644 --- a/pulumi_wasm_generator_lib/src/output/provider/source_code.rs +++ b/pulumi_wasm_generator_lib/src/output/provider/source_code.rs @@ -1,5 +1,3 @@ -use crate::model::{ElementId, Type}; -use crate::output::replace_multiple_dashes; use handlebars::Handlebars; use serde::Serialize; @@ -17,7 +15,6 @@ struct InputProperty { struct OutputProperty { name: String, arg_name: String, - required: bool, } #[derive(Serialize)] @@ -43,14 +40,14 @@ fn convert_model(package: &crate::model::Package) -> Package { .resources .iter() .map(|(element_id, resource)| Interface { - name: create_valid_element_id(element_id), + name: element_id.get_rust_namespace_name(), r#type: element_id.raw.clone(), input_properties: resource .input_properties .iter() .map(|input_property| InputProperty { name: input_property.name.clone(), - arg_name: create_valid_id(&input_property.name), + arg_name: input_property.get_rust_argument_name(), }) .collect(), output_properties: resource @@ -58,8 +55,7 @@ fn convert_model(package: &crate::model::Package) -> Package { .iter() .map(|output_property| OutputProperty { name: output_property.name.clone(), - arg_name: create_valid_id(&output_property.name), - required: !matches!(output_property.r#type, Type::Option(_)), + arg_name: output_property.get_rust_argument_name(), }) .collect(), }) @@ -67,32 +63,6 @@ fn convert_model(package: &crate::model::Package) -> Package { } } -fn create_valid_element_id(element_id: &ElementId) -> String { - let mut vec = element_id.namespace.clone(); - vec.push(element_id.name.clone()); - create_valid_id(&vec.join("-")) -} - -fn create_valid_id(s: &str) -> String { - let result: String = s - .chars() - .map(|c| { - if c.is_uppercase() { - format!("-{}", c.to_lowercase()) - } else if !c.is_alphanumeric() { - "-".to_string() - } else { - c.to_string() - } - }) - .collect(); - - let result = replace_multiple_dashes(&result); - let result = result.trim_matches('-').to_string(); - - result.replace('-', "_") -} - pub(crate) fn generate_source_code(package: &crate::model::Package) -> String { let handlebars = Handlebars::new(); handlebars diff --git a/pulumi_wasm_generator_lib/src/output/rust/resource.rs.handlebars b/pulumi_wasm_generator_lib/src/output/rust/resource.rs.handlebars index 3d3b82c5c..a67ff569e 100644 --- a/pulumi_wasm_generator_lib/src/output/rust/resource.rs.handlebars +++ b/pulumi_wasm_generator_lib/src/output/rust/resource.rs.handlebars @@ -16,15 +16,15 @@ pub mod {{interface.name}} { pub fn {{interface.function_name}}(name: &str, args: {{interface.struct_name}}Args) -> {{interface.struct_name}}Result { - let result = crate::bindings::pulumi::{{@root.package.name}}::{{interface.wit_name}}::invoke(name, &crate::bindings::pulumi::{{@root.package.name}}::{{interface.wit_name}}::Args { + let result = crate::bindings::pulumi::{{@root.package.name}}::{{interface.name}}::invoke(name, &crate::bindings::pulumi::{{@root.package.name}}::{{interface.name}}::Args { {{#each interface.input_properties}} - {{wit_name}}: &crate::clone::<{{&type_}}>(args.{{arg_name}}), + {{arg_name}}: &crate::clone::<{{&type_}}>(args.{{arg_name}}), {{/each}} }); {{interface.struct_name}}Result { {{#each interface.output_properties}} - {{arg_name}}: crate::random_to_domain_mapper::<{{&type_}}>(result.{{wit_name}}), + {{arg_name}}: crate::random_to_domain_mapper::<{{&type_}}>(result.{{arg_name}}), {{/each}} } } diff --git a/pulumi_wasm_generator_lib/src/output/rust/source_code_librs.rs b/pulumi_wasm_generator_lib/src/output/rust/source_code_librs.rs index f6c7c564a..dcf682ac0 100644 --- a/pulumi_wasm_generator_lib/src/output/rust/source_code_librs.rs +++ b/pulumi_wasm_generator_lib/src/output/rust/source_code_librs.rs @@ -1,5 +1,4 @@ -use crate::model::ElementId; -use crate::output::{get_main_version, replace_multiple_dashes}; +use crate::output::get_main_version; use handlebars::Handlebars; use serde::Serialize; use serde_json::json; @@ -19,12 +18,7 @@ struct OutputProperty { } #[derive(Serialize)] -struct Interface { - name: String, - r#type: String, - input_properties: Vec, - output_properties: Vec, -} +struct Interface {} #[derive(Serialize)] struct Package { @@ -40,56 +34,11 @@ fn convert_model(package: &crate::model::Package) -> Package { interfaces: package .resources .iter() - .map(|(element_id, resource)| Interface { - name: create_valid_element_id(element_id), - r#type: element_id.raw.clone(), - input_properties: resource - .input_properties - .iter() - .map(|input_property| InputProperty { - name: input_property.name.clone(), - arg_name: create_valid_id(&input_property.name), - }) - .collect(), - output_properties: resource - .output_properties - .iter() - .map(|output_property| OutputProperty { - name: output_property.name.clone(), - arg_name: create_valid_id(&output_property.name), - }) - .collect(), - }) + .map(|(element_id, resource)| Interface {}) .collect(), } } -fn create_valid_element_id(element_id: &ElementId) -> String { - let mut vec = element_id.namespace.clone(); - vec.push(element_id.name.clone()); - create_valid_id(&vec.join("-")) -} - -fn create_valid_id(s: &str) -> String { - let result: String = s - .chars() - .map(|c| { - if c.is_uppercase() { - format!("-{}", c.to_lowercase()) - } else if !c.is_alphanumeric() { - "-".to_string() - } else { - c.to_string() - } - }) - .collect(); - - let result = replace_multiple_dashes(&result); - let result = result.trim_matches('-').to_string(); - - result.replace('-', "_") -} - pub(crate) fn generate_source_code(package: &crate::model::Package) -> String { let handlebars = Handlebars::new(); handlebars diff --git a/pulumi_wasm_generator_lib/src/output/rust/source_code_resource.rs b/pulumi_wasm_generator_lib/src/output/rust/source_code_resource.rs index 8d2c3010e..bbbe7ac72 100644 --- a/pulumi_wasm_generator_lib/src/output/rust/source_code_resource.rs +++ b/pulumi_wasm_generator_lib/src/output/rust/source_code_resource.rs @@ -1,7 +1,4 @@ -use crate::model::ElementId; -use crate::output::replace_multiple_dashes; use crate::output::rust::convert_type; -use convert_case::{Case, Casing}; use handlebars::Handlebars; use serde::Serialize; use serde_json::json; @@ -13,7 +10,6 @@ struct InputProperty { name: String, arg_name: String, type_: String, - wit_name: String, } #[derive(Serialize)] @@ -21,7 +17,6 @@ struct OutputProperty { name: String, arg_name: String, type_: String, - wit_name: String, } #[derive(Serialize)] @@ -31,7 +26,6 @@ struct Interface { output_properties: Vec, struct_name: String, function_name: String, - wit_name: String, } #[derive(Serialize)] @@ -47,22 +41,16 @@ fn convert_model(package: &crate::model::Package) -> Package { .resources .iter() .map(|(element_id, resource)| Interface { - name: create_valid_element_id(element_id), + name: element_id.get_rust_namespace_name(), struct_name: element_id.name.clone(), - function_name: element_id - .name - .clone() - .from_case(Case::UpperCamel) - .to_case(Case::Snake), - wit_name: create_valid_wit_element_id(element_id), + function_name: element_id.get_rust_function_name(), input_properties: resource .input_properties .iter() .map(|input_property| InputProperty { name: input_property.name.clone(), - arg_name: create_valid_id(&input_property.name), + arg_name: input_property.get_rust_argument_name(), type_: convert_type(&input_property.r#type), - wit_name: convert_to_wit_name(&create_valid_wit_id(&input_property.name)), }) .collect(), output_properties: resource @@ -70,9 +58,8 @@ fn convert_model(package: &crate::model::Package) -> Package { .iter() .map(|output_property| OutputProperty { name: output_property.name.clone(), - arg_name: create_valid_id(&output_property.name), + arg_name: output_property.get_rust_argument_name(), type_: convert_type(&output_property.r#type), - wit_name: convert_to_wit_name(&create_valid_wit_id(&output_property.name)), }) .collect(), }) @@ -80,61 +67,6 @@ fn convert_model(package: &crate::model::Package) -> Package { } } -fn convert_to_wit_name(s: &str) -> String { - s.replace('-', "_") -} - -fn create_valid_element_id(element_id: &ElementId) -> String { - let mut vec = element_id.namespace.clone(); - vec.push(element_id.name.clone()); - create_valid_id(&vec.join("-")) -} - -fn create_valid_id(s: &str) -> String { - let result: String = s - .chars() - .map(|c| { - if c.is_uppercase() { - format!("-{}", c.to_lowercase()) - } else if !c.is_alphanumeric() { - "-".to_string() - } else { - c.to_string() - } - }) - .collect(); - - let result = replace_multiple_dashes(&result); - let result = result.trim_matches('-').to_string(); - - result.replace('-', "_") -} - -fn create_valid_wit_element_id(element_id: &ElementId) -> String { - let mut vec = element_id.namespace.clone(); - vec.push(element_id.name.clone()); - create_valid_id(&vec.join("-")) -} - -fn create_valid_wit_id(s: &str) -> String { - let result: String = s - .chars() - .map(|c| { - if c.is_uppercase() { - format!("-{}", c.to_lowercase()) - } else if !c.is_alphanumeric() { - "-".to_string() - } else { - c.to_string() - } - }) - .collect(); - - let result = replace_multiple_dashes(&result); - let result = result.trim_matches('-').to_string(); - result -} - pub(crate) fn generate_source_code(package: &crate::model::Package) -> String { let package = convert_model(package); diff --git a/pulumi_wasm_generator_lib/src/output/rust/source_code_types.rs b/pulumi_wasm_generator_lib/src/output/rust/source_code_types.rs index 3c8d6e0e9..5d15e7765 100644 --- a/pulumi_wasm_generator_lib/src/output/rust/source_code_types.rs +++ b/pulumi_wasm_generator_lib/src/output/rust/source_code_types.rs @@ -1,5 +1,4 @@ -use crate::model::{ElementId, GlobalType}; -use crate::output::replace_multiple_dashes; +use crate::model::GlobalType; use crate::output::rust::convert_type; use convert_case::{Case, Casing}; use handlebars::Handlebars; @@ -17,11 +16,9 @@ struct Property { #[derive(Serialize)] struct RefType { - name: String, + // name: String, fields: Vec, struct_name: String, - function_name: String, - wit_name: String, } #[derive(Serialize)] @@ -41,18 +38,13 @@ fn convert_model(package: &crate::model::Package) -> Package { let mut real_types = Vec::new(); let mut aliases = Vec::new(); - package.types.iter().for_each(|(element_id, resource)| { - match resource { + package + .types + .iter() + .for_each(|(element_id, resource)| match resource { GlobalType::Object(properties) => { let ref_type = RefType { - name: create_valid_element_id(element_id), struct_name: element_id.name.clone(), - function_name: element_id - .name - .clone() - .from_case(Case::UpperCamel) - .to_case(Case::Snake), - wit_name: create_valid_wit_element_id(element_id), fields: properties .iter() .map(|global_type_property| Property { @@ -62,9 +54,7 @@ fn convert_model(package: &crate::model::Package) -> Package { .from_case(Case::Camel) .to_case(Case::Snake), original_name: global_type_property.name.clone(), - // arg_name: create_valid_id(&global_type_property.name), type_: convert_type(&global_type_property.r#type), - // wit_name: convert_to_wit_name(&create_valid_wit_id(&global_type_property.name)), }) .collect(), }; @@ -86,8 +76,7 @@ fn convert_model(package: &crate::model::Package) -> Package { name: element_id.name.to_string(), type_: "i32".to_string(), }), - } - }); + }); Package { name: package.name.clone(), @@ -96,61 +85,6 @@ fn convert_model(package: &crate::model::Package) -> Package { } } -fn convert_to_wit_name(s: &str) -> String { - s.replace('-', "_") -} - -fn create_valid_element_id(element_id: &ElementId) -> String { - let mut vec = element_id.namespace.clone(); - vec.push(element_id.name.clone()); - create_valid_id(&vec.join("-")) -} - -fn create_valid_id(s: &str) -> String { - let result: String = s - .chars() - .map(|c| { - if c.is_uppercase() { - format!("-{}", c.to_lowercase()) - } else if !c.is_alphanumeric() { - "-".to_string() - } else { - c.to_string() - } - }) - .collect(); - - let result = replace_multiple_dashes(&result); - let result = result.trim_matches('-').to_string(); - - result.replace('-', "_") -} - -fn create_valid_wit_element_id(element_id: &ElementId) -> String { - let mut vec = element_id.namespace.clone(); - vec.push(element_id.name.clone()); - create_valid_id(&vec.join("-")) -} - -fn create_valid_wit_id(s: &str) -> String { - let result: String = s - .chars() - .map(|c| { - if c.is_uppercase() { - format!("-{}", c.to_lowercase()) - } else if !c.is_alphanumeric() { - "-".to_string() - } else { - c.to_string() - } - }) - .collect(); - - let result = replace_multiple_dashes(&result); - let result = result.trim_matches('-').to_string(); - result -} - pub(crate) fn generate_source_code(package: &crate::model::Package) -> String { let package = convert_model(package); diff --git a/pulumi_wasm_generator_lib/src/output/wit/mod.rs b/pulumi_wasm_generator_lib/src/output/wit/mod.rs index cfb1dafd5..f0d6ebe9f 100644 --- a/pulumi_wasm_generator_lib/src/output/wit/mod.rs +++ b/pulumi_wasm_generator_lib/src/output/wit/mod.rs @@ -1,5 +1,4 @@ -use crate::model::ElementId; -use crate::output::{get_main_version, get_main_version_stringify, replace_multiple_dashes}; +use crate::output::{get_main_version, get_main_version_stringify}; use handlebars::Handlebars; use serde::Serialize; @@ -10,13 +9,11 @@ static DEPENDENCIES: &str = include_str!("dependencies.handlebars"); #[derive(Serialize)] struct Argument { name: String, - // r#type: String, } #[derive(Serialize)] struct Result { name: String, - // r#type: String, } #[derive(Serialize)] @@ -37,7 +34,7 @@ struct Package { fn convert_model(package: &crate::model::Package) -> Package { Package { - name: create_valid_id(&package.name), + name: package.get_wit_name(), version: package.version.clone(), pulumi_wasm_version: get_main_version().to_string(), pulumi_wasm_version_stringify: get_main_version_stringify().to_string(), @@ -45,19 +42,19 @@ fn convert_model(package: &crate::model::Package) -> Package { .resources .iter() .map(|(element_id, resource)| Interface { - name: create_valid_element_id(element_id), + name: element_id.get_wit_interface_name(), arguments: resource .input_properties .iter() .map(|input_property| Argument { - name: create_valid_id(&input_property.name), + name: input_property.get_wit_argument_name(), }) .collect(), results: resource .output_properties .iter() .map(|output_property| Result { - name: create_valid_id(&output_property.name), + name: output_property.get_wit_argument_name(), }) .collect(), }) @@ -65,33 +62,6 @@ fn convert_model(package: &crate::model::Package) -> Package { } } -fn create_valid_element_id(element_id: &ElementId) -> String { - let mut vec = element_id.namespace.clone(); - vec.push(element_id.name.clone()); - create_valid_id(&vec.join("-")) -} - -fn create_valid_id(s: &str) -> String { - let result: String = s - .chars() - .map(|c| { - if c.is_uppercase() { - format!("-{}", c.to_lowercase()) - } else if !c.is_alphanumeric() { - "-".to_string() - } else { - c.to_string() - } - }) - .collect(); - - let result = replace_multiple_dashes(&result); - let result = result.trim_matches('-').to_string(); - let result = format!("%{result}"); - - result -} - pub(crate) fn generate_wit(package: &crate::model::Package) -> anyhow::Result { let mut data = std::collections::BTreeMap::new(); data.insert("package", convert_model(package)); diff --git a/pulumi_wasm_generator_lib/src/utils.rs b/pulumi_wasm_generator_lib/src/utils.rs new file mode 100644 index 000000000..953bb3511 --- /dev/null +++ b/pulumi_wasm_generator_lib/src/utils.rs @@ -0,0 +1,14 @@ +use regex::Regex; + +pub(crate) fn replace_multiple_dashes(s: &str) -> String { + let re = Regex::new("-+").unwrap(); + let result = re.replace_all(s, "-"); + result.to_string() +} + +pub(crate) fn escape_wit_identifier(s: &str) -> &str { + match s { + "result" => "%result", + s => s, + } +} diff --git a/pulumi_wasm_generator_lib/tests/output/pulumi_providers/command/lib/wit/world.wit b/pulumi_wasm_generator_lib/tests/output/pulumi_providers/command/lib/wit/world.wit index 4300d46ea..dba26e812 100644 --- a/pulumi_wasm_generator_lib/tests/output/pulumi_providers/command/lib/wit/world.wit +++ b/pulumi_wasm_generator_lib/tests/output/pulumi_providers/command/lib/wit/world.wit @@ -1,102 +1,102 @@ -package pulumi:%command@0.9.2-ZERO.ZERO.ZERO-DEV; +package pulumi:command@0.9.2-ZERO.ZERO.ZERO-DEV; -world %command-pulumi { +world command-pulumi { import component:pulumi-wasm/register-interface@0.0.0-DEV; - export %local-command; - export %remote-command; - export %remote-copy-file; + export local-command; + export remote-command; + export remote-copy-file; } -world %command-pulumi-client { - import %local-command; - import %remote-command; - import %remote-copy-file; +world command-pulumi-client { + import local-command; + import remote-command; + import remote-copy-file; } -interface %local-command { +interface local-command { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %archive-paths: borrow, - %asset-paths: borrow, - %create: borrow, - %delete: borrow, - %dir: borrow, - %environment: borrow, - %interpreter: borrow, - %stdin: borrow, - %triggers: borrow, - %update: borrow, + archive-paths: borrow, + asset-paths: borrow, + create: borrow, + delete: borrow, + dir: borrow, + environment: borrow, + interpreter: borrow, + stdin: borrow, + triggers: borrow, + update: borrow, } record res { - %archive: output, - %archive-paths: output, - %asset-paths: output, - %assets: output, - %create: output, - %delete: output, - %dir: output, - %environment: output, - %interpreter: output, - %stderr: output, - %stdin: output, - %stdout: output, - %triggers: output, - %update: output, + archive: output, + archive-paths: output, + asset-paths: output, + assets: output, + create: output, + delete: output, + dir: output, + environment: output, + interpreter: output, + stderr: output, + stdin: output, + stdout: output, + triggers: output, + update: output, } invoke: func(name: string, args: args) -> res; } -interface %remote-command { +interface remote-command { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %connection: borrow, - %create: borrow, - %delete: borrow, - %environment: borrow, - %stdin: borrow, - %triggers: borrow, - %update: borrow, + connection: borrow, + create: borrow, + delete: borrow, + environment: borrow, + stdin: borrow, + triggers: borrow, + update: borrow, } record res { - %connection: output, - %create: output, - %delete: output, - %environment: output, - %stderr: output, - %stdin: output, - %stdout: output, - %triggers: output, - %update: output, + connection: output, + create: output, + delete: output, + environment: output, + stderr: output, + stdin: output, + stdout: output, + triggers: output, + update: output, } invoke: func(name: string, args: args) -> res; } -interface %remote-copy-file { +interface remote-copy-file { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %connection: borrow, - %local-path: borrow, - %remote-path: borrow, - %triggers: borrow, + connection: borrow, + local-path: borrow, + remote-path: borrow, + triggers: borrow, } record res { - %connection: output, - %local-path: output, - %remote-path: output, - %triggers: output, + connection: output, + local-path: output, + remote-path: output, + triggers: output, } invoke: func(name: string, args: args) -> res; diff --git a/pulumi_wasm_generator_lib/tests/output/pulumi_providers/command/provider/wit/world.wit b/pulumi_wasm_generator_lib/tests/output/pulumi_providers/command/provider/wit/world.wit index 4300d46ea..dba26e812 100644 --- a/pulumi_wasm_generator_lib/tests/output/pulumi_providers/command/provider/wit/world.wit +++ b/pulumi_wasm_generator_lib/tests/output/pulumi_providers/command/provider/wit/world.wit @@ -1,102 +1,102 @@ -package pulumi:%command@0.9.2-ZERO.ZERO.ZERO-DEV; +package pulumi:command@0.9.2-ZERO.ZERO.ZERO-DEV; -world %command-pulumi { +world command-pulumi { import component:pulumi-wasm/register-interface@0.0.0-DEV; - export %local-command; - export %remote-command; - export %remote-copy-file; + export local-command; + export remote-command; + export remote-copy-file; } -world %command-pulumi-client { - import %local-command; - import %remote-command; - import %remote-copy-file; +world command-pulumi-client { + import local-command; + import remote-command; + import remote-copy-file; } -interface %local-command { +interface local-command { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %archive-paths: borrow, - %asset-paths: borrow, - %create: borrow, - %delete: borrow, - %dir: borrow, - %environment: borrow, - %interpreter: borrow, - %stdin: borrow, - %triggers: borrow, - %update: borrow, + archive-paths: borrow, + asset-paths: borrow, + create: borrow, + delete: borrow, + dir: borrow, + environment: borrow, + interpreter: borrow, + stdin: borrow, + triggers: borrow, + update: borrow, } record res { - %archive: output, - %archive-paths: output, - %asset-paths: output, - %assets: output, - %create: output, - %delete: output, - %dir: output, - %environment: output, - %interpreter: output, - %stderr: output, - %stdin: output, - %stdout: output, - %triggers: output, - %update: output, + archive: output, + archive-paths: output, + asset-paths: output, + assets: output, + create: output, + delete: output, + dir: output, + environment: output, + interpreter: output, + stderr: output, + stdin: output, + stdout: output, + triggers: output, + update: output, } invoke: func(name: string, args: args) -> res; } -interface %remote-command { +interface remote-command { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %connection: borrow, - %create: borrow, - %delete: borrow, - %environment: borrow, - %stdin: borrow, - %triggers: borrow, - %update: borrow, + connection: borrow, + create: borrow, + delete: borrow, + environment: borrow, + stdin: borrow, + triggers: borrow, + update: borrow, } record res { - %connection: output, - %create: output, - %delete: output, - %environment: output, - %stderr: output, - %stdin: output, - %stdout: output, - %triggers: output, - %update: output, + connection: output, + create: output, + delete: output, + environment: output, + stderr: output, + stdin: output, + stdout: output, + triggers: output, + update: output, } invoke: func(name: string, args: args) -> res; } -interface %remote-copy-file { +interface remote-copy-file { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %connection: borrow, - %local-path: borrow, - %remote-path: borrow, - %triggers: borrow, + connection: borrow, + local-path: borrow, + remote-path: borrow, + triggers: borrow, } record res { - %connection: output, - %local-path: output, - %remote-path: output, - %triggers: output, + connection: output, + local-path: output, + remote-path: output, + triggers: output, } invoke: func(name: string, args: args) -> res; diff --git a/pulumi_wasm_generator_lib/tests/output/pulumi_providers/docker/lib/wit/world.wit b/pulumi_wasm_generator_lib/tests/output/pulumi_providers/docker/lib/wit/world.wit index 2bd75dd9a..0fd099234 100644 --- a/pulumi_wasm_generator_lib/tests/output/pulumi_providers/docker/lib/wit/world.wit +++ b/pulumi_wasm_generator_lib/tests/output/pulumi_providers/docker/lib/wit/world.wit @@ -1,433 +1,433 @@ -package pulumi:%docker@4.5.3-ZERO.ZERO.ZERO-DEV; +package pulumi:docker@4.5.3-ZERO.ZERO.ZERO-DEV; -world %docker-pulumi { +world docker-pulumi { import component:pulumi-wasm/register-interface@0.0.0-DEV; - export %container; - export %image; - export %network; - export %plugin; - export %registry-image; - export %remote-image; - export %secret; - export %service; - export %service-config; - export %tag; - export %volume; + export container; + export image; + export network; + export plugin; + export registry-image; + export remote-image; + export secret; + export service; + export service-config; + export tag; + export volume; } -world %docker-pulumi-client { - import %container; - import %image; - import %network; - import %plugin; - import %registry-image; - import %remote-image; - import %secret; - import %service; - import %service-config; - import %tag; - import %volume; +world docker-pulumi-client { + import container; + import image; + import network; + import plugin; + import registry-image; + import remote-image; + import secret; + import service; + import service-config; + import tag; + import volume; } -interface %container { +interface container { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %attach: borrow, - %capabilities: borrow, - %cgroupns-mode: borrow, - %command: borrow, - %container-read-refresh-timeout-milliseconds: borrow, - %cpu-set: borrow, - %cpu-shares: borrow, - %destroy-grace-seconds: borrow, - %devices: borrow, - %dns: borrow, - %dns-opts: borrow, - %dns-searches: borrow, - %domainname: borrow, - %entrypoints: borrow, - %envs: borrow, - %gpus: borrow, - %group-adds: borrow, - %healthcheck: borrow, - %hostname: borrow, - %hosts: borrow, - %image: borrow, - %init: borrow, - %ipc-mode: borrow, - %labels: borrow, - %log-driver: borrow, - %log-opts: borrow, - %logs: borrow, - %max-retry-count: borrow, - %memory: borrow, - %memory-swap: borrow, - %mounts: borrow, - %must-run: borrow, - %name: borrow, - %network-mode: borrow, - %networks-advanced: borrow, - %pid-mode: borrow, - %ports: borrow, - %privileged: borrow, - %publish-all-ports: borrow, - %read-only: borrow, - %remove-volumes: borrow, - %restart: borrow, - %rm: borrow, - %runtime: borrow, - %security-opts: borrow, - %shm-size: borrow, - %start: borrow, - %stdin-open: borrow, - %stop-signal: borrow, - %stop-timeout: borrow, - %storage-opts: borrow, - %sysctls: borrow, - %tmpfs: borrow, - %tty: borrow, - %ulimits: borrow, - %uploads: borrow, - %user: borrow, - %userns-mode: borrow, - %volumes: borrow, - %wait: borrow, - %wait-timeout: borrow, - %working-dir: borrow, + attach: borrow, + capabilities: borrow, + cgroupns-mode: borrow, + command: borrow, + container-read-refresh-timeout-milliseconds: borrow, + cpu-set: borrow, + cpu-shares: borrow, + destroy-grace-seconds: borrow, + devices: borrow, + dns: borrow, + dns-opts: borrow, + dns-searches: borrow, + domainname: borrow, + entrypoints: borrow, + envs: borrow, + gpus: borrow, + group-adds: borrow, + healthcheck: borrow, + hostname: borrow, + hosts: borrow, + image: borrow, + init: borrow, + ipc-mode: borrow, + labels: borrow, + log-driver: borrow, + log-opts: borrow, + logs: borrow, + max-retry-count: borrow, + memory: borrow, + memory-swap: borrow, + mounts: borrow, + must-run: borrow, + name: borrow, + network-mode: borrow, + networks-advanced: borrow, + pid-mode: borrow, + ports: borrow, + privileged: borrow, + publish-all-ports: borrow, + read-only: borrow, + remove-volumes: borrow, + restart: borrow, + rm: borrow, + runtime: borrow, + security-opts: borrow, + shm-size: borrow, + start: borrow, + stdin-open: borrow, + stop-signal: borrow, + stop-timeout: borrow, + storage-opts: borrow, + sysctls: borrow, + tmpfs: borrow, + tty: borrow, + ulimits: borrow, + uploads: borrow, + user: borrow, + userns-mode: borrow, + volumes: borrow, + wait: borrow, + wait-timeout: borrow, + working-dir: borrow, } record res { - %attach: output, - %bridge: output, - %capabilities: output, - %cgroupns-mode: output, - %command: output, - %container-logs: output, - %container-read-refresh-timeout-milliseconds: output, - %cpu-set: output, - %cpu-shares: output, - %destroy-grace-seconds: output, - %devices: output, - %dns: output, - %dns-opts: output, - %dns-searches: output, - %domainname: output, - %entrypoints: output, - %envs: output, - %exit-code: output, - %gpus: output, - %group-adds: output, - %healthcheck: output, - %hostname: output, - %hosts: output, - %image: output, - %init: output, - %ipc-mode: output, - %labels: output, - %log-driver: output, - %log-opts: output, - %logs: output, - %max-retry-count: output, - %memory: output, - %memory-swap: output, - %mounts: output, - %must-run: output, - %name: output, - %network-datas: output, - %network-mode: output, - %networks-advanced: output, - %pid-mode: output, - %ports: output, - %privileged: output, - %publish-all-ports: output, - %read-only: output, - %remove-volumes: output, - %restart: output, - %rm: output, - %runtime: output, - %security-opts: output, - %shm-size: output, - %start: output, - %stdin-open: output, - %stop-signal: output, - %stop-timeout: output, - %storage-opts: output, - %sysctls: output, - %tmpfs: output, - %tty: output, - %ulimits: output, - %uploads: output, - %user: output, - %userns-mode: output, - %volumes: output, - %wait: output, - %wait-timeout: output, - %working-dir: output, + attach: output, + bridge: output, + capabilities: output, + cgroupns-mode: output, + command: output, + container-logs: output, + container-read-refresh-timeout-milliseconds: output, + cpu-set: output, + cpu-shares: output, + destroy-grace-seconds: output, + devices: output, + dns: output, + dns-opts: output, + dns-searches: output, + domainname: output, + entrypoints: output, + envs: output, + exit-code: output, + gpus: output, + group-adds: output, + healthcheck: output, + hostname: output, + hosts: output, + image: output, + init: output, + ipc-mode: output, + labels: output, + log-driver: output, + log-opts: output, + logs: output, + max-retry-count: output, + memory: output, + memory-swap: output, + mounts: output, + must-run: output, + name: output, + network-datas: output, + network-mode: output, + networks-advanced: output, + pid-mode: output, + ports: output, + privileged: output, + publish-all-ports: output, + read-only: output, + remove-volumes: output, + restart: output, + rm: output, + runtime: output, + security-opts: output, + shm-size: output, + start: output, + stdin-open: output, + stop-signal: output, + stop-timeout: output, + storage-opts: output, + sysctls: output, + tmpfs: output, + tty: output, + ulimits: output, + uploads: output, + user: output, + userns-mode: output, + volumes: output, + wait: output, + wait-timeout: output, + working-dir: output, } invoke: func(name: string, args: args) -> res; } -interface %image { +interface image { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %build: borrow, - %build-on-preview: borrow, - %image-name: borrow, - %registry: borrow, - %skip-push: borrow, + build: borrow, + build-on-preview: borrow, + image-name: borrow, + registry: borrow, + skip-push: borrow, } record res { - %base-image-name: output, - %context: output, - %dockerfile: output, - %image-name: output, - %platform: output, - %registry-server: output, - %repo-digest: output, + base-image-name: output, + context: output, + dockerfile: output, + image-name: output, + platform: output, + registry-server: output, + repo-digest: output, } invoke: func(name: string, args: args) -> res; } -interface %network { +interface network { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %attachable: borrow, - %check-duplicate: borrow, - %driver: borrow, - %ingress: borrow, - %internal: borrow, - %ipam-configs: borrow, - %ipam-driver: borrow, - %ipam-options: borrow, - %ipv6: borrow, - %labels: borrow, - %name: borrow, - %options: borrow, + attachable: borrow, + check-duplicate: borrow, + driver: borrow, + ingress: borrow, + internal: borrow, + ipam-configs: borrow, + ipam-driver: borrow, + ipam-options: borrow, + ipv6: borrow, + labels: borrow, + name: borrow, + options: borrow, } record res { - %attachable: output, - %check-duplicate: output, - %driver: output, - %ingress: output, - %internal: output, - %ipam-configs: output, - %ipam-driver: output, - %ipam-options: output, - %ipv6: output, - %labels: output, - %name: output, - %options: output, - %scope: output, + attachable: output, + check-duplicate: output, + driver: output, + ingress: output, + internal: output, + ipam-configs: output, + ipam-driver: output, + ipam-options: output, + ipv6: output, + labels: output, + name: output, + options: output, + scope: output, } invoke: func(name: string, args: args) -> res; } -interface %plugin { +interface plugin { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %alias: borrow, - %enable-timeout: borrow, - %enabled: borrow, - %envs: borrow, - %force-destroy: borrow, - %force-disable: borrow, - %grant-all-permissions: borrow, - %grant-permissions: borrow, - %name: borrow, + alias: borrow, + enable-timeout: borrow, + enabled: borrow, + envs: borrow, + force-destroy: borrow, + force-disable: borrow, + grant-all-permissions: borrow, + grant-permissions: borrow, + name: borrow, } record res { - %alias: output, - %enable-timeout: output, - %enabled: output, - %envs: output, - %force-destroy: output, - %force-disable: output, - %grant-all-permissions: output, - %grant-permissions: output, - %name: output, - %plugin-reference: output, + alias: output, + enable-timeout: output, + enabled: output, + envs: output, + force-destroy: output, + force-disable: output, + grant-all-permissions: output, + grant-permissions: output, + name: output, + plugin-reference: output, } invoke: func(name: string, args: args) -> res; } -interface %registry-image { +interface registry-image { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %insecure-skip-verify: borrow, - %keep-remotely: borrow, - %name: borrow, - %triggers: borrow, + insecure-skip-verify: borrow, + keep-remotely: borrow, + name: borrow, + triggers: borrow, } record res { - %insecure-skip-verify: output, - %keep-remotely: output, - %name: output, - %sha256-digest: output, - %triggers: output, + insecure-skip-verify: output, + keep-remotely: output, + name: output, + sha256-digest: output, + triggers: output, } invoke: func(name: string, args: args) -> res; } -interface %remote-image { +interface remote-image { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %build: borrow, - %force-remove: borrow, - %keep-locally: borrow, - %name: borrow, - %platform: borrow, - %pull-triggers: borrow, - %triggers: borrow, + build: borrow, + force-remove: borrow, + keep-locally: borrow, + name: borrow, + platform: borrow, + pull-triggers: borrow, + triggers: borrow, } record res { - %build: output, - %force-remove: output, - %image-id: output, - %keep-locally: output, - %name: output, - %platform: output, - %pull-triggers: output, - %repo-digest: output, - %triggers: output, + build: output, + force-remove: output, + image-id: output, + keep-locally: output, + name: output, + platform: output, + pull-triggers: output, + repo-digest: output, + triggers: output, } invoke: func(name: string, args: args) -> res; } -interface %secret { +interface secret { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %data: borrow, - %labels: borrow, - %name: borrow, + data: borrow, + labels: borrow, + name: borrow, } record res { - %data: output, - %labels: output, - %name: output, + data: output, + labels: output, + name: output, } invoke: func(name: string, args: args) -> res; } -interface %service { +interface service { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %auth: borrow, - %converge-config: borrow, - %endpoint-spec: borrow, - %labels: borrow, - %mode: borrow, - %name: borrow, - %rollback-config: borrow, - %task-spec: borrow, - %update-config: borrow, + auth: borrow, + converge-config: borrow, + endpoint-spec: borrow, + labels: borrow, + mode: borrow, + name: borrow, + rollback-config: borrow, + task-spec: borrow, + update-config: borrow, } record res { - %auth: output, - %converge-config: output, - %endpoint-spec: output, - %labels: output, - %mode: output, - %name: output, - %rollback-config: output, - %task-spec: output, - %update-config: output, + auth: output, + converge-config: output, + endpoint-spec: output, + labels: output, + mode: output, + name: output, + rollback-config: output, + task-spec: output, + update-config: output, } invoke: func(name: string, args: args) -> res; } -interface %service-config { +interface service-config { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %data: borrow, - %name: borrow, + data: borrow, + name: borrow, } record res { - %data: output, - %name: output, + data: output, + name: output, } invoke: func(name: string, args: args) -> res; } -interface %tag { +interface tag { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %source-image: borrow, - %target-image: borrow, + source-image: borrow, + target-image: borrow, } record res { - %source-image: output, - %source-image-id: output, - %target-image: output, + source-image: output, + source-image-id: output, + target-image: output, } invoke: func(name: string, args: args) -> res; } -interface %volume { +interface volume { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %driver: borrow, - %driver-opts: borrow, - %labels: borrow, - %name: borrow, + driver: borrow, + driver-opts: borrow, + labels: borrow, + name: borrow, } record res { - %driver: output, - %driver-opts: output, - %labels: output, - %mountpoint: output, - %name: output, + driver: output, + driver-opts: output, + labels: output, + mountpoint: output, + name: output, } invoke: func(name: string, args: args) -> res; diff --git a/pulumi_wasm_generator_lib/tests/output/pulumi_providers/docker/provider/wit/world.wit b/pulumi_wasm_generator_lib/tests/output/pulumi_providers/docker/provider/wit/world.wit index 2bd75dd9a..0fd099234 100644 --- a/pulumi_wasm_generator_lib/tests/output/pulumi_providers/docker/provider/wit/world.wit +++ b/pulumi_wasm_generator_lib/tests/output/pulumi_providers/docker/provider/wit/world.wit @@ -1,433 +1,433 @@ -package pulumi:%docker@4.5.3-ZERO.ZERO.ZERO-DEV; +package pulumi:docker@4.5.3-ZERO.ZERO.ZERO-DEV; -world %docker-pulumi { +world docker-pulumi { import component:pulumi-wasm/register-interface@0.0.0-DEV; - export %container; - export %image; - export %network; - export %plugin; - export %registry-image; - export %remote-image; - export %secret; - export %service; - export %service-config; - export %tag; - export %volume; + export container; + export image; + export network; + export plugin; + export registry-image; + export remote-image; + export secret; + export service; + export service-config; + export tag; + export volume; } -world %docker-pulumi-client { - import %container; - import %image; - import %network; - import %plugin; - import %registry-image; - import %remote-image; - import %secret; - import %service; - import %service-config; - import %tag; - import %volume; +world docker-pulumi-client { + import container; + import image; + import network; + import plugin; + import registry-image; + import remote-image; + import secret; + import service; + import service-config; + import tag; + import volume; } -interface %container { +interface container { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %attach: borrow, - %capabilities: borrow, - %cgroupns-mode: borrow, - %command: borrow, - %container-read-refresh-timeout-milliseconds: borrow, - %cpu-set: borrow, - %cpu-shares: borrow, - %destroy-grace-seconds: borrow, - %devices: borrow, - %dns: borrow, - %dns-opts: borrow, - %dns-searches: borrow, - %domainname: borrow, - %entrypoints: borrow, - %envs: borrow, - %gpus: borrow, - %group-adds: borrow, - %healthcheck: borrow, - %hostname: borrow, - %hosts: borrow, - %image: borrow, - %init: borrow, - %ipc-mode: borrow, - %labels: borrow, - %log-driver: borrow, - %log-opts: borrow, - %logs: borrow, - %max-retry-count: borrow, - %memory: borrow, - %memory-swap: borrow, - %mounts: borrow, - %must-run: borrow, - %name: borrow, - %network-mode: borrow, - %networks-advanced: borrow, - %pid-mode: borrow, - %ports: borrow, - %privileged: borrow, - %publish-all-ports: borrow, - %read-only: borrow, - %remove-volumes: borrow, - %restart: borrow, - %rm: borrow, - %runtime: borrow, - %security-opts: borrow, - %shm-size: borrow, - %start: borrow, - %stdin-open: borrow, - %stop-signal: borrow, - %stop-timeout: borrow, - %storage-opts: borrow, - %sysctls: borrow, - %tmpfs: borrow, - %tty: borrow, - %ulimits: borrow, - %uploads: borrow, - %user: borrow, - %userns-mode: borrow, - %volumes: borrow, - %wait: borrow, - %wait-timeout: borrow, - %working-dir: borrow, + attach: borrow, + capabilities: borrow, + cgroupns-mode: borrow, + command: borrow, + container-read-refresh-timeout-milliseconds: borrow, + cpu-set: borrow, + cpu-shares: borrow, + destroy-grace-seconds: borrow, + devices: borrow, + dns: borrow, + dns-opts: borrow, + dns-searches: borrow, + domainname: borrow, + entrypoints: borrow, + envs: borrow, + gpus: borrow, + group-adds: borrow, + healthcheck: borrow, + hostname: borrow, + hosts: borrow, + image: borrow, + init: borrow, + ipc-mode: borrow, + labels: borrow, + log-driver: borrow, + log-opts: borrow, + logs: borrow, + max-retry-count: borrow, + memory: borrow, + memory-swap: borrow, + mounts: borrow, + must-run: borrow, + name: borrow, + network-mode: borrow, + networks-advanced: borrow, + pid-mode: borrow, + ports: borrow, + privileged: borrow, + publish-all-ports: borrow, + read-only: borrow, + remove-volumes: borrow, + restart: borrow, + rm: borrow, + runtime: borrow, + security-opts: borrow, + shm-size: borrow, + start: borrow, + stdin-open: borrow, + stop-signal: borrow, + stop-timeout: borrow, + storage-opts: borrow, + sysctls: borrow, + tmpfs: borrow, + tty: borrow, + ulimits: borrow, + uploads: borrow, + user: borrow, + userns-mode: borrow, + volumes: borrow, + wait: borrow, + wait-timeout: borrow, + working-dir: borrow, } record res { - %attach: output, - %bridge: output, - %capabilities: output, - %cgroupns-mode: output, - %command: output, - %container-logs: output, - %container-read-refresh-timeout-milliseconds: output, - %cpu-set: output, - %cpu-shares: output, - %destroy-grace-seconds: output, - %devices: output, - %dns: output, - %dns-opts: output, - %dns-searches: output, - %domainname: output, - %entrypoints: output, - %envs: output, - %exit-code: output, - %gpus: output, - %group-adds: output, - %healthcheck: output, - %hostname: output, - %hosts: output, - %image: output, - %init: output, - %ipc-mode: output, - %labels: output, - %log-driver: output, - %log-opts: output, - %logs: output, - %max-retry-count: output, - %memory: output, - %memory-swap: output, - %mounts: output, - %must-run: output, - %name: output, - %network-datas: output, - %network-mode: output, - %networks-advanced: output, - %pid-mode: output, - %ports: output, - %privileged: output, - %publish-all-ports: output, - %read-only: output, - %remove-volumes: output, - %restart: output, - %rm: output, - %runtime: output, - %security-opts: output, - %shm-size: output, - %start: output, - %stdin-open: output, - %stop-signal: output, - %stop-timeout: output, - %storage-opts: output, - %sysctls: output, - %tmpfs: output, - %tty: output, - %ulimits: output, - %uploads: output, - %user: output, - %userns-mode: output, - %volumes: output, - %wait: output, - %wait-timeout: output, - %working-dir: output, + attach: output, + bridge: output, + capabilities: output, + cgroupns-mode: output, + command: output, + container-logs: output, + container-read-refresh-timeout-milliseconds: output, + cpu-set: output, + cpu-shares: output, + destroy-grace-seconds: output, + devices: output, + dns: output, + dns-opts: output, + dns-searches: output, + domainname: output, + entrypoints: output, + envs: output, + exit-code: output, + gpus: output, + group-adds: output, + healthcheck: output, + hostname: output, + hosts: output, + image: output, + init: output, + ipc-mode: output, + labels: output, + log-driver: output, + log-opts: output, + logs: output, + max-retry-count: output, + memory: output, + memory-swap: output, + mounts: output, + must-run: output, + name: output, + network-datas: output, + network-mode: output, + networks-advanced: output, + pid-mode: output, + ports: output, + privileged: output, + publish-all-ports: output, + read-only: output, + remove-volumes: output, + restart: output, + rm: output, + runtime: output, + security-opts: output, + shm-size: output, + start: output, + stdin-open: output, + stop-signal: output, + stop-timeout: output, + storage-opts: output, + sysctls: output, + tmpfs: output, + tty: output, + ulimits: output, + uploads: output, + user: output, + userns-mode: output, + volumes: output, + wait: output, + wait-timeout: output, + working-dir: output, } invoke: func(name: string, args: args) -> res; } -interface %image { +interface image { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %build: borrow, - %build-on-preview: borrow, - %image-name: borrow, - %registry: borrow, - %skip-push: borrow, + build: borrow, + build-on-preview: borrow, + image-name: borrow, + registry: borrow, + skip-push: borrow, } record res { - %base-image-name: output, - %context: output, - %dockerfile: output, - %image-name: output, - %platform: output, - %registry-server: output, - %repo-digest: output, + base-image-name: output, + context: output, + dockerfile: output, + image-name: output, + platform: output, + registry-server: output, + repo-digest: output, } invoke: func(name: string, args: args) -> res; } -interface %network { +interface network { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %attachable: borrow, - %check-duplicate: borrow, - %driver: borrow, - %ingress: borrow, - %internal: borrow, - %ipam-configs: borrow, - %ipam-driver: borrow, - %ipam-options: borrow, - %ipv6: borrow, - %labels: borrow, - %name: borrow, - %options: borrow, + attachable: borrow, + check-duplicate: borrow, + driver: borrow, + ingress: borrow, + internal: borrow, + ipam-configs: borrow, + ipam-driver: borrow, + ipam-options: borrow, + ipv6: borrow, + labels: borrow, + name: borrow, + options: borrow, } record res { - %attachable: output, - %check-duplicate: output, - %driver: output, - %ingress: output, - %internal: output, - %ipam-configs: output, - %ipam-driver: output, - %ipam-options: output, - %ipv6: output, - %labels: output, - %name: output, - %options: output, - %scope: output, + attachable: output, + check-duplicate: output, + driver: output, + ingress: output, + internal: output, + ipam-configs: output, + ipam-driver: output, + ipam-options: output, + ipv6: output, + labels: output, + name: output, + options: output, + scope: output, } invoke: func(name: string, args: args) -> res; } -interface %plugin { +interface plugin { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %alias: borrow, - %enable-timeout: borrow, - %enabled: borrow, - %envs: borrow, - %force-destroy: borrow, - %force-disable: borrow, - %grant-all-permissions: borrow, - %grant-permissions: borrow, - %name: borrow, + alias: borrow, + enable-timeout: borrow, + enabled: borrow, + envs: borrow, + force-destroy: borrow, + force-disable: borrow, + grant-all-permissions: borrow, + grant-permissions: borrow, + name: borrow, } record res { - %alias: output, - %enable-timeout: output, - %enabled: output, - %envs: output, - %force-destroy: output, - %force-disable: output, - %grant-all-permissions: output, - %grant-permissions: output, - %name: output, - %plugin-reference: output, + alias: output, + enable-timeout: output, + enabled: output, + envs: output, + force-destroy: output, + force-disable: output, + grant-all-permissions: output, + grant-permissions: output, + name: output, + plugin-reference: output, } invoke: func(name: string, args: args) -> res; } -interface %registry-image { +interface registry-image { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %insecure-skip-verify: borrow, - %keep-remotely: borrow, - %name: borrow, - %triggers: borrow, + insecure-skip-verify: borrow, + keep-remotely: borrow, + name: borrow, + triggers: borrow, } record res { - %insecure-skip-verify: output, - %keep-remotely: output, - %name: output, - %sha256-digest: output, - %triggers: output, + insecure-skip-verify: output, + keep-remotely: output, + name: output, + sha256-digest: output, + triggers: output, } invoke: func(name: string, args: args) -> res; } -interface %remote-image { +interface remote-image { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %build: borrow, - %force-remove: borrow, - %keep-locally: borrow, - %name: borrow, - %platform: borrow, - %pull-triggers: borrow, - %triggers: borrow, + build: borrow, + force-remove: borrow, + keep-locally: borrow, + name: borrow, + platform: borrow, + pull-triggers: borrow, + triggers: borrow, } record res { - %build: output, - %force-remove: output, - %image-id: output, - %keep-locally: output, - %name: output, - %platform: output, - %pull-triggers: output, - %repo-digest: output, - %triggers: output, + build: output, + force-remove: output, + image-id: output, + keep-locally: output, + name: output, + platform: output, + pull-triggers: output, + repo-digest: output, + triggers: output, } invoke: func(name: string, args: args) -> res; } -interface %secret { +interface secret { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %data: borrow, - %labels: borrow, - %name: borrow, + data: borrow, + labels: borrow, + name: borrow, } record res { - %data: output, - %labels: output, - %name: output, + data: output, + labels: output, + name: output, } invoke: func(name: string, args: args) -> res; } -interface %service { +interface service { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %auth: borrow, - %converge-config: borrow, - %endpoint-spec: borrow, - %labels: borrow, - %mode: borrow, - %name: borrow, - %rollback-config: borrow, - %task-spec: borrow, - %update-config: borrow, + auth: borrow, + converge-config: borrow, + endpoint-spec: borrow, + labels: borrow, + mode: borrow, + name: borrow, + rollback-config: borrow, + task-spec: borrow, + update-config: borrow, } record res { - %auth: output, - %converge-config: output, - %endpoint-spec: output, - %labels: output, - %mode: output, - %name: output, - %rollback-config: output, - %task-spec: output, - %update-config: output, + auth: output, + converge-config: output, + endpoint-spec: output, + labels: output, + mode: output, + name: output, + rollback-config: output, + task-spec: output, + update-config: output, } invoke: func(name: string, args: args) -> res; } -interface %service-config { +interface service-config { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %data: borrow, - %name: borrow, + data: borrow, + name: borrow, } record res { - %data: output, - %name: output, + data: output, + name: output, } invoke: func(name: string, args: args) -> res; } -interface %tag { +interface tag { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %source-image: borrow, - %target-image: borrow, + source-image: borrow, + target-image: borrow, } record res { - %source-image: output, - %source-image-id: output, - %target-image: output, + source-image: output, + source-image-id: output, + target-image: output, } invoke: func(name: string, args: args) -> res; } -interface %volume { +interface volume { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %driver: borrow, - %driver-opts: borrow, - %labels: borrow, - %name: borrow, + driver: borrow, + driver-opts: borrow, + labels: borrow, + name: borrow, } record res { - %driver: output, - %driver-opts: output, - %labels: output, - %mountpoint: output, - %name: output, + driver: output, + driver-opts: output, + labels: output, + mountpoint: output, + name: output, } invoke: func(name: string, args: args) -> res; diff --git a/pulumi_wasm_generator_lib/tests/output/pulumi_providers/random/lib/wit/world.wit b/pulumi_wasm_generator_lib/tests/output/pulumi_providers/random/lib/wit/world.wit index 1a0ac4ff1..cec608df2 100644 --- a/pulumi_wasm_generator_lib/tests/output/pulumi_providers/random/lib/wit/world.wit +++ b/pulumi_wasm_generator_lib/tests/output/pulumi_providers/random/lib/wit/world.wit @@ -1,229 +1,229 @@ -package pulumi:%random@4.15.0-ZERO.ZERO.ZERO-DEV; +package pulumi:random@4.15.0-ZERO.ZERO.ZERO-DEV; -world %random-pulumi { +world random-pulumi { import component:pulumi-wasm/register-interface@0.0.0-DEV; - export %random-bytes; - export %random-id; - export %random-integer; - export %random-password; - export %random-pet; - export %random-shuffle; - export %random-string; - export %random-uuid; + export random-bytes; + export random-id; + export random-integer; + export random-password; + export random-pet; + export random-shuffle; + export random-string; + export random-uuid; } -world %random-pulumi-client { - import %random-bytes; - import %random-id; - import %random-integer; - import %random-password; - import %random-pet; - import %random-shuffle; - import %random-string; - import %random-uuid; +world random-pulumi-client { + import random-bytes; + import random-id; + import random-integer; + import random-password; + import random-pet; + import random-shuffle; + import random-string; + import random-uuid; } -interface %random-bytes { +interface random-bytes { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, + keepers: borrow, + length: borrow, } record res { - %base64: output, - %hex: output, - %keepers: output, - %length: output, + base64: output, + hex: output, + keepers: output, + length: output, } invoke: func(name: string, args: args) -> res; } -interface %random-id { +interface random-id { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %byte-length: borrow, - %keepers: borrow, - %prefix: borrow, + byte-length: borrow, + keepers: borrow, + prefix: borrow, } record res { - %b64-std: output, - %b64-url: output, - %byte-length: output, - %dec: output, - %hex: output, - %keepers: output, - %prefix: output, + b64-std: output, + b64-url: output, + byte-length: output, + dec: output, + hex: output, + keepers: output, + prefix: output, } invoke: func(name: string, args: args) -> res; } -interface %random-integer { +interface random-integer { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %max: borrow, - %min: borrow, - %seed: borrow, + keepers: borrow, + max: borrow, + min: borrow, + seed: borrow, } record res { - %keepers: output, - %max: output, - %min: output, + keepers: output, + max: output, + min: output, %result: output, - %seed: output, + seed: output, } invoke: func(name: string, args: args) -> res; } -interface %random-password { +interface random-password { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, - %lower: borrow, - %min-lower: borrow, - %min-numeric: borrow, - %min-special: borrow, - %min-upper: borrow, - %number: borrow, - %numeric: borrow, - %override-special: borrow, - %special: borrow, - %upper: borrow, + keepers: borrow, + length: borrow, + lower: borrow, + min-lower: borrow, + min-numeric: borrow, + min-special: borrow, + min-upper: borrow, + number: borrow, + numeric: borrow, + override-special: borrow, + special: borrow, + upper: borrow, } record res { - %bcrypt-hash: output, - %keepers: output, - %length: output, - %lower: output, - %min-lower: output, - %min-numeric: output, - %min-special: output, - %min-upper: output, - %number: output, - %numeric: output, - %override-special: output, + bcrypt-hash: output, + keepers: output, + length: output, + lower: output, + min-lower: output, + min-numeric: output, + min-special: output, + min-upper: output, + number: output, + numeric: output, + override-special: output, %result: output, - %special: output, - %upper: output, + special: output, + upper: output, } invoke: func(name: string, args: args) -> res; } -interface %random-pet { +interface random-pet { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, - %prefix: borrow, - %separator: borrow, + keepers: borrow, + length: borrow, + prefix: borrow, + separator: borrow, } record res { - %keepers: output, - %length: output, - %prefix: output, - %separator: output, + keepers: output, + length: output, + prefix: output, + separator: output, } invoke: func(name: string, args: args) -> res; } -interface %random-shuffle { +interface random-shuffle { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %inputs: borrow, - %keepers: borrow, - %result-count: borrow, - %seed: borrow, + inputs: borrow, + keepers: borrow, + result-count: borrow, + seed: borrow, } record res { - %inputs: output, - %keepers: output, - %result-count: output, - %results: output, - %seed: output, + inputs: output, + keepers: output, + result-count: output, + results: output, + seed: output, } invoke: func(name: string, args: args) -> res; } -interface %random-string { +interface random-string { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, - %lower: borrow, - %min-lower: borrow, - %min-numeric: borrow, - %min-special: borrow, - %min-upper: borrow, - %number: borrow, - %numeric: borrow, - %override-special: borrow, - %special: borrow, - %upper: borrow, + keepers: borrow, + length: borrow, + lower: borrow, + min-lower: borrow, + min-numeric: borrow, + min-special: borrow, + min-upper: borrow, + number: borrow, + numeric: borrow, + override-special: borrow, + special: borrow, + upper: borrow, } record res { - %keepers: output, - %length: output, - %lower: output, - %min-lower: output, - %min-numeric: output, - %min-special: output, - %min-upper: output, - %number: output, - %numeric: output, - %override-special: output, + keepers: output, + length: output, + lower: output, + min-lower: output, + min-numeric: output, + min-special: output, + min-upper: output, + number: output, + numeric: output, + override-special: output, %result: output, - %special: output, - %upper: output, + special: output, + upper: output, } invoke: func(name: string, args: args) -> res; } -interface %random-uuid { +interface random-uuid { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, + keepers: borrow, } record res { - %keepers: output, + keepers: output, %result: output, } diff --git a/pulumi_wasm_generator_lib/tests/output/pulumi_providers/random/provider/wit/world.wit b/pulumi_wasm_generator_lib/tests/output/pulumi_providers/random/provider/wit/world.wit index 1a0ac4ff1..cec608df2 100644 --- a/pulumi_wasm_generator_lib/tests/output/pulumi_providers/random/provider/wit/world.wit +++ b/pulumi_wasm_generator_lib/tests/output/pulumi_providers/random/provider/wit/world.wit @@ -1,229 +1,229 @@ -package pulumi:%random@4.15.0-ZERO.ZERO.ZERO-DEV; +package pulumi:random@4.15.0-ZERO.ZERO.ZERO-DEV; -world %random-pulumi { +world random-pulumi { import component:pulumi-wasm/register-interface@0.0.0-DEV; - export %random-bytes; - export %random-id; - export %random-integer; - export %random-password; - export %random-pet; - export %random-shuffle; - export %random-string; - export %random-uuid; + export random-bytes; + export random-id; + export random-integer; + export random-password; + export random-pet; + export random-shuffle; + export random-string; + export random-uuid; } -world %random-pulumi-client { - import %random-bytes; - import %random-id; - import %random-integer; - import %random-password; - import %random-pet; - import %random-shuffle; - import %random-string; - import %random-uuid; +world random-pulumi-client { + import random-bytes; + import random-id; + import random-integer; + import random-password; + import random-pet; + import random-shuffle; + import random-string; + import random-uuid; } -interface %random-bytes { +interface random-bytes { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, + keepers: borrow, + length: borrow, } record res { - %base64: output, - %hex: output, - %keepers: output, - %length: output, + base64: output, + hex: output, + keepers: output, + length: output, } invoke: func(name: string, args: args) -> res; } -interface %random-id { +interface random-id { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %byte-length: borrow, - %keepers: borrow, - %prefix: borrow, + byte-length: borrow, + keepers: borrow, + prefix: borrow, } record res { - %b64-std: output, - %b64-url: output, - %byte-length: output, - %dec: output, - %hex: output, - %keepers: output, - %prefix: output, + b64-std: output, + b64-url: output, + byte-length: output, + dec: output, + hex: output, + keepers: output, + prefix: output, } invoke: func(name: string, args: args) -> res; } -interface %random-integer { +interface random-integer { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %max: borrow, - %min: borrow, - %seed: borrow, + keepers: borrow, + max: borrow, + min: borrow, + seed: borrow, } record res { - %keepers: output, - %max: output, - %min: output, + keepers: output, + max: output, + min: output, %result: output, - %seed: output, + seed: output, } invoke: func(name: string, args: args) -> res; } -interface %random-password { +interface random-password { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, - %lower: borrow, - %min-lower: borrow, - %min-numeric: borrow, - %min-special: borrow, - %min-upper: borrow, - %number: borrow, - %numeric: borrow, - %override-special: borrow, - %special: borrow, - %upper: borrow, + keepers: borrow, + length: borrow, + lower: borrow, + min-lower: borrow, + min-numeric: borrow, + min-special: borrow, + min-upper: borrow, + number: borrow, + numeric: borrow, + override-special: borrow, + special: borrow, + upper: borrow, } record res { - %bcrypt-hash: output, - %keepers: output, - %length: output, - %lower: output, - %min-lower: output, - %min-numeric: output, - %min-special: output, - %min-upper: output, - %number: output, - %numeric: output, - %override-special: output, + bcrypt-hash: output, + keepers: output, + length: output, + lower: output, + min-lower: output, + min-numeric: output, + min-special: output, + min-upper: output, + number: output, + numeric: output, + override-special: output, %result: output, - %special: output, - %upper: output, + special: output, + upper: output, } invoke: func(name: string, args: args) -> res; } -interface %random-pet { +interface random-pet { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, - %prefix: borrow, - %separator: borrow, + keepers: borrow, + length: borrow, + prefix: borrow, + separator: borrow, } record res { - %keepers: output, - %length: output, - %prefix: output, - %separator: output, + keepers: output, + length: output, + prefix: output, + separator: output, } invoke: func(name: string, args: args) -> res; } -interface %random-shuffle { +interface random-shuffle { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %inputs: borrow, - %keepers: borrow, - %result-count: borrow, - %seed: borrow, + inputs: borrow, + keepers: borrow, + result-count: borrow, + seed: borrow, } record res { - %inputs: output, - %keepers: output, - %result-count: output, - %results: output, - %seed: output, + inputs: output, + keepers: output, + result-count: output, + results: output, + seed: output, } invoke: func(name: string, args: args) -> res; } -interface %random-string { +interface random-string { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, - %length: borrow, - %lower: borrow, - %min-lower: borrow, - %min-numeric: borrow, - %min-special: borrow, - %min-upper: borrow, - %number: borrow, - %numeric: borrow, - %override-special: borrow, - %special: borrow, - %upper: borrow, + keepers: borrow, + length: borrow, + lower: borrow, + min-lower: borrow, + min-numeric: borrow, + min-special: borrow, + min-upper: borrow, + number: borrow, + numeric: borrow, + override-special: borrow, + special: borrow, + upper: borrow, } record res { - %keepers: output, - %length: output, - %lower: output, - %min-lower: output, - %min-numeric: output, - %min-special: output, - %min-upper: output, - %number: output, - %numeric: output, - %override-special: output, + keepers: output, + length: output, + lower: output, + min-lower: output, + min-numeric: output, + min-special: output, + min-upper: output, + number: output, + numeric: output, + override-special: output, %result: output, - %special: output, - %upper: output, + special: output, + upper: output, } invoke: func(name: string, args: args) -> res; } -interface %random-uuid { +interface random-uuid { use component:pulumi-wasm/output-interface@0.0.0-DEV.{output}; record args { - %keepers: borrow, + keepers: borrow, } record res { - %keepers: output, + keepers: output, %result: output, } diff --git a/pulumi_wasm_generator_lib/tests/output/pulumi_tests/cyclic-types/lib/wit/world.wit b/pulumi_wasm_generator_lib/tests/output/pulumi_tests/cyclic-types/lib/wit/world.wit index 82ef8c76a..626db78a4 100644 --- a/pulumi_wasm_generator_lib/tests/output/pulumi_tests/cyclic-types/lib/wit/world.wit +++ b/pulumi_wasm_generator_lib/tests/output/pulumi_tests/cyclic-types/lib/wit/world.wit @@ -1,9 +1,9 @@ -package pulumi:%example@0.0.1-ZERO.ZERO.ZERO-DEV; +package pulumi:example@0.0.1-ZERO.ZERO.ZERO-DEV; -world %example-pulumi { +world example-pulumi { import component:pulumi-wasm/register-interface@0.0.0-DEV; } -world %example-pulumi-client { +world example-pulumi-client { } diff --git a/pulumi_wasm_generator_lib/tests/output/pulumi_tests/cyclic-types/provider/wit/world.wit b/pulumi_wasm_generator_lib/tests/output/pulumi_tests/cyclic-types/provider/wit/world.wit index 82ef8c76a..626db78a4 100644 --- a/pulumi_wasm_generator_lib/tests/output/pulumi_tests/cyclic-types/provider/wit/world.wit +++ b/pulumi_wasm_generator_lib/tests/output/pulumi_tests/cyclic-types/provider/wit/world.wit @@ -1,9 +1,9 @@ -package pulumi:%example@0.0.1-ZERO.ZERO.ZERO-DEV; +package pulumi:example@0.0.1-ZERO.ZERO.ZERO-DEV; -world %example-pulumi { +world example-pulumi { import component:pulumi-wasm/register-interface@0.0.0-DEV; } -world %example-pulumi-client { +world example-pulumi-client { } diff --git a/pulumi_wasm_generator_lib/tests/output/pulumi_tests/mini-awsnative/lib/wit/world.wit b/pulumi_wasm_generator_lib/tests/output/pulumi_tests/mini-awsnative/lib/wit/world.wit index 47c7ea657..9ce492869 100644 --- a/pulumi_wasm_generator_lib/tests/output/pulumi_tests/mini-awsnative/lib/wit/world.wit +++ b/pulumi_wasm_generator_lib/tests/output/pulumi_tests/mini-awsnative/lib/wit/world.wit @@ -1,9 +1,9 @@ -package pulumi:%aws-native@0.0.1-ZERO.ZERO.ZERO-DEV; +package pulumi:aws-native@0.0.1-ZERO.ZERO.ZERO-DEV; -world %aws-native-pulumi { +world aws-native-pulumi { import component:pulumi-wasm/register-interface@0.0.0-DEV; } -world %aws-native-pulumi-client { +world aws-native-pulumi-client { } diff --git a/pulumi_wasm_generator_lib/tests/output/pulumi_tests/mini-awsnative/provider/wit/world.wit b/pulumi_wasm_generator_lib/tests/output/pulumi_tests/mini-awsnative/provider/wit/world.wit index 47c7ea657..9ce492869 100644 --- a/pulumi_wasm_generator_lib/tests/output/pulumi_tests/mini-awsnative/provider/wit/world.wit +++ b/pulumi_wasm_generator_lib/tests/output/pulumi_tests/mini-awsnative/provider/wit/world.wit @@ -1,9 +1,9 @@ -package pulumi:%aws-native@0.0.1-ZERO.ZERO.ZERO-DEV; +package pulumi:aws-native@0.0.1-ZERO.ZERO.ZERO-DEV; -world %aws-native-pulumi { +world aws-native-pulumi { import component:pulumi-wasm/register-interface@0.0.0-DEV; } -world %aws-native-pulumi-client { +world aws-native-pulumi-client { }