diff --git a/providers/pulumi_wasm_provider_cloudflare_rust/src/resource/zone_settings_override.rs b/providers/pulumi_wasm_provider_cloudflare_rust/src/resource/zone_settings_override.rs index 2e897e32d..94aae5870 100644 --- a/providers/pulumi_wasm_provider_cloudflare_rust/src/resource/zone_settings_override.rs +++ b/providers/pulumi_wasm_provider_cloudflare_rust/src/resource/zone_settings_override.rs @@ -11,7 +11,7 @@ //! for a feature that is not available on the plan configured for the zone will //! result in an error: //! -//! ``` +//! ```sh //! Error: invalid zone setting "\" (value: \) found - cannot be set as it is read only //! ``` //! diff --git a/providers/pulumi_wasm_provider_docker_rust/src/function/get_plugin.rs b/providers/pulumi_wasm_provider_docker_rust/src/function/get_plugin.rs index 5b61ddf2e..d9bcbbf53 100644 --- a/providers/pulumi_wasm_provider_docker_rust/src/function/get_plugin.rs +++ b/providers/pulumi_wasm_provider_docker_rust/src/function/get_plugin.rs @@ -17,7 +17,6 @@ //! fn::docker:getPlugin: //! id: "e9a9db917b3bfd6706b5d3a66d4bceb9f" //! ``` -//! #[derive(bon::Builder)] #[builder(finish_fn = build_struct)] diff --git a/providers/pulumi_wasm_provider_docker_rust/src/resource/image.rs b/providers/pulumi_wasm_provider_docker_rust/src/resource/image.rs index 676576ed4..629e06118 100644 --- a/providers/pulumi_wasm_provider_docker_rust/src/resource/image.rs +++ b/providers/pulumi_wasm_provider_docker_rust/src/resource/image.rs @@ -53,94 +53,6 @@ //! ``` //! //! -//! {{% examples %}} -//! ## Example Usage -//! {{% example %}} -//! ### A Docker image build -//! -//! ```typescript -//! import * as pulumi from "@pulumi/pulumi"; -//! import * as docker from "@pulumi/docker"; -//! -//! const demoImage = new docker.Image("demo-image", { -//! build: { -//! context: ".", -//! dockerfile: "Dockerfile", -//! platform: "linux/amd64", -//! }, -//! imageName: "username/image:tag1", -//! skipPush: true, -//! }); -//! export const imageName = demoImage.imageName; -//! ``` -//! ```python -//! import pulumi -//! import pulumi_docker as docker -//! -//! demo_image = docker.Image("demo-image", -//! build=docker.DockerBuildArgs( -//! context=".", -//! dockerfile="Dockerfile", -//! platform="linux/amd64", -//! ), -//! image_name="username/image:tag1", -//! skip_push=True) -//! pulumi.export("imageName", demo_image.image_name) -//! ``` -//! ```csharp -//! using System.Collections.Generic; -//! using System.Linq; -//! using Pulumi; -//! using Docker = Pulumi.Docker; -//! -//! return await Deployment.RunAsync(() => -//! { -//! var demoImage = new Docker.Image("demo-image", new() -//! { -//! Build = new Docker.Inputs.DockerBuildArgs -//! { -//! Context = ".", -//! Dockerfile = "Dockerfile", -//! Platform = "linux/amd64", -//! }, -//! ImageName = "username/image:tag1", -//! SkipPush = true, -//! }); -//! -//! return new Dictionary -//! { -//! ["imageName"] = demoImage.ImageName, -//! }; -//! }); -//! -//! ``` -//! ```go -//! package main -//! -//! import ( -//! "github.com/pulumi/pulumi-docker/sdk/v4/go/docker" -//! "github.com/pulumi/pulumi/sdk/v3/go/pulumi" -//! ) -//! -//! func main() { -//! pulumi.Run(func(ctx *pulumi.Context) error { -//! demoImage, err := docker.NewImage(ctx, "demo-image", &docker.ImageArgs{ -//! Build: &docker.DockerBuildArgs{ -//! Context: pulumi.String("."), -//! Dockerfile: pulumi.String("Dockerfile"), -//! Platform: pulumi.String("linux/amd64"), -//! }, -//! ImageName: pulumi.String("username/image:tag1"), -//! SkipPush: pulumi.Bool(true), -//! }) -//! if err != nil { -//! return err -//! } -//! ctx.Export("imageName", demoImage.ImageName) -//! return nil -//! }) -//! } -//! ``` //! ```yaml //! config: {} //! description: A Docker image build @@ -162,125 +74,6 @@ //! runtime: yaml //! variables: {} //! ``` -//! ```java -//! package generated_program; -//! -//! import com.pulumi.Context; -//! import com.pulumi.Pulumi; -//! import com.pulumi.core.Output; -//! import com.pulumi.docker.Image; -//! import com.pulumi.docker.ImageArgs; -//! import com.pulumi.docker.inputs.DockerBuildArgs; -//! import java.util.List; -//! import java.util.ArrayList; -//! import java.util.Map; -//! import java.io.File; -//! import java.nio.file.Files; -//! import java.nio.file.Paths; -//! -//! public class App { -//! public static void main(String[] args) { -//! Pulumi.run(App::stack); -//! } -//! -//! public static void stack(Context ctx) { -//! var demoImage = new Image("demoImage", ImageArgs.builder() -//! .build(DockerBuildArgs.builder() -//! .context(".") -//! .dockerfile("Dockerfile") -//! .platform("linux/amd64") -//! .build()) -//! .imageName("username/image:tag1") -//! .skipPush(true) -//! .build()); -//! -//! ctx.export("imageName", demoImage.imageName()); -//! } -//! } -//! ``` -//! {{% /example %}} -//! {{% example %}} -//! ### A Docker image build and push -//! -//! ```typescript -//! import * as pulumi from "@pulumi/pulumi"; -//! import * as docker from "@pulumi/docker"; -//! -//! const demoPushImage = new docker.Image("demo-push-image", { -//! build: { -//! context: ".", -//! dockerfile: "Dockerfile", -//! }, -//! imageName: "docker.io/username/push-image:tag1", -//! }); -//! export const imageName = demoPushImage.imageName; -//! export const repoDigest = demoPushImage.repoDigest; -//! ``` -//! ```python -//! import pulumi -//! import pulumi_docker as docker -//! -//! demo_push_image = docker.Image("demo-push-image", -//! build=docker.DockerBuildArgs( -//! context=".", -//! dockerfile="Dockerfile", -//! ), -//! image_name="docker.io/username/push-image:tag1") -//! pulumi.export("imageName", demo_push_image.image_name) -//! pulumi.export("repoDigest", demo_push_image.repo_digest) -//! ``` -//! ```csharp -//! using System.Collections.Generic; -//! using System.Linq; -//! using Pulumi; -//! using Docker = Pulumi.Docker; -//! -//! return await Deployment.RunAsync(() => -//! { -//! var demoPushImage = new Docker.Image("demo-push-image", new() -//! { -//! Build = new Docker.Inputs.DockerBuildArgs -//! { -//! Context = ".", -//! Dockerfile = "Dockerfile", -//! }, -//! ImageName = "docker.io/username/push-image:tag1", -//! }); -//! -//! return new Dictionary -//! { -//! ["imageName"] = demoPushImage.ImageName, -//! ["repoDigest"] = demoPushImage.RepoDigest, -//! }; -//! }); -//! -//! ``` -//! ```go -//! package main -//! -//! import ( -//! "github.com/pulumi/pulumi-docker/sdk/v4/go/docker" -//! "github.com/pulumi/pulumi/sdk/v3/go/pulumi" -//! ) -//! -//! func main() { -//! pulumi.Run(func(ctx *pulumi.Context) error { -//! demoPushImage, err := docker.NewImage(ctx, "demo-push-image", &docker.ImageArgs{ -//! Build: &docker.DockerBuildArgs{ -//! Context: pulumi.String("."), -//! Dockerfile: pulumi.String("Dockerfile"), -//! }, -//! ImageName: pulumi.String("docker.io/username/push-image:tag1"), -//! }) -//! if err != nil { -//! return err -//! } -//! ctx.Export("imageName", demoPushImage.ImageName) -//! ctx.Export("repoDigest", demoPushImage.RepoDigest) -//! return nil -//! }) -//! } -//! ``` //! ```yaml //! config: {} //! description: A Docker image build and push @@ -301,205 +94,6 @@ //! runtime: yaml //! variables: {} //! ``` -//! ```java -//! package generated_program; -//! -//! import com.pulumi.Context; -//! import com.pulumi.Pulumi; -//! import com.pulumi.core.Output; -//! import com.pulumi.docker.Image; -//! import com.pulumi.docker.ImageArgs; -//! import com.pulumi.docker.inputs.DockerBuildArgs; -//! import java.util.List; -//! import java.util.ArrayList; -//! import java.util.Map; -//! import java.io.File; -//! import java.nio.file.Files; -//! import java.nio.file.Paths; -//! -//! public class App { -//! public static void main(String[] args) { -//! Pulumi.run(App::stack); -//! } -//! -//! public static void stack(Context ctx) { -//! var demoPushImage = new Image("demoPushImage", ImageArgs.builder() -//! .build(DockerBuildArgs.builder() -//! .context(".") -//! .dockerfile("Dockerfile") -//! .build()) -//! .imageName("docker.io/username/push-image:tag1") -//! .build()); -//! -//! ctx.export("imageName", demoPushImage.imageName()); -//! ctx.export("repoDigest", demoPushImage.repoDigest()); -//! } -//! } -//! ``` -//! {{% /example %}} -//! {{% example %}} -//! ### Docker image build using caching with AWS Elastic Container Registry -//! -//! ```typescript -//! import * as pulumi from "@pulumi/pulumi"; -//! import * as aws from "@pulumi/aws"; -//! import * as docker from "@pulumi/docker"; -//! -//! const ecrRepository = new aws.ecr.Repository("ecr-repository", {name: "docker-repository"}); -//! const authToken = aws.ecr.getAuthorizationTokenOutput({ -//! registryId: ecrRepository.registryId, -//! }); -//! const myAppImage = new docker.Image("my-app-image", { -//! build: { -//! args: { -//! BUILDKIT_INLINE_CACHE: "1", -//! }, -//! cacheFrom: { -//! images: [pulumi.interpolate`${ecrRepository.repositoryUrl}:latest`], -//! }, -//! context: "app/", -//! dockerfile: "Dockerfile", -//! }, -//! imageName: pulumi.interpolate`${ecrRepository.repositoryUrl}:latest`, -//! registry: { -//! password: pulumi.secret(authToken.apply(authToken => authToken.password)), -//! server: ecrRepository.repositoryUrl, -//! }, -//! }); -//! export const imageName = myAppImage.imageName; -//! ``` -//! ```python -//! import pulumi -//! import pulumi_aws as aws -//! import pulumi_docker as docker -//! -//! ecr_repository = aws.ecr.Repository("ecr-repository", name="docker-repository") -//! auth_token = aws.ecr.get_authorization_token_output(registry_id=ecr_repository.registry_id) -//! my_app_image = docker.Image("my-app-image", -//! build=docker.DockerBuildArgs( -//! args={ -//! "BUILDKIT_INLINE_CACHE": "1", -//! }, -//! cache_from=docker.CacheFromArgs( -//! images=[ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:latest")], -//! ), -//! context="app/", -//! dockerfile="Dockerfile", -//! ), -//! image_name=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:latest"), -//! registry=docker.RegistryArgs( -//! password=pulumi.Output.secret(auth_token.password), -//! server=ecr_repository.repository_url, -//! )) -//! pulumi.export("imageName", my_app_image.image_name) -//! ``` -//! ```csharp -//! using System.Collections.Generic; -//! using System.Linq; -//! using Pulumi; -//! using Aws = Pulumi.Aws; -//! using Docker = Pulumi.Docker; -//! -//! return await Deployment.RunAsync(() => -//! { -//! var ecrRepository = new Aws.Ecr.Repository("ecr-repository", new() -//! { -//! Name = "docker-repository", -//! }); -//! -//! var authToken = Aws.Ecr.GetAuthorizationToken.Invoke(new() -//! { -//! RegistryId = ecrRepository.RegistryId, -//! }); -//! -//! var myAppImage = new Docker.Image("my-app-image", new() -//! { -//! Build = new Docker.Inputs.DockerBuildArgs -//! { -//! Args = -//! { -//! { "BUILDKIT_INLINE_CACHE", "1" }, -//! }, -//! CacheFrom = new Docker.Inputs.CacheFromArgs -//! { -//! Images = new[] -//! { -//! ecrRepository.RepositoryUrl.Apply(repositoryUrl => $"{repositoryUrl}:latest"), -//! }, -//! }, -//! Context = "app/", -//! Dockerfile = "Dockerfile", -//! }, -//! ImageName = ecrRepository.RepositoryUrl.Apply(repositoryUrl => $"{repositoryUrl}:latest"), -//! Registry = new Docker.Inputs.RegistryArgs -//! { -//! Password = Output.CreateSecret(authToken.Apply(getAuthorizationTokenResult => getAuthorizationTokenResult.Password)), -//! Server = ecrRepository.RepositoryUrl, -//! }, -//! }); -//! -//! return new Dictionary -//! { -//! ["imageName"] = myAppImage.ImageName, -//! }; -//! }); -//! -//! ``` -//! ```go -//! package main -//! -//! import ( -//! "fmt" -//! -//! "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecr" -//! "github.com/pulumi/pulumi-docker/sdk/v4/go/docker" -//! "github.com/pulumi/pulumi/sdk/v3/go/pulumi" -//! ) -//! -//! func main() { -//! pulumi.Run(func(ctx *pulumi.Context) error { -//! ecrRepository, err := ecr.NewRepository(ctx, "ecr-repository", &ecr.RepositoryArgs{ -//! Name: pulumi.String("docker-repository"), -//! }) -//! if err != nil { -//! return err -//! } -//! authToken := ecr.GetAuthorizationTokenOutput(ctx, ecr.GetAuthorizationTokenOutputArgs{ -//! RegistryId: ecrRepository.RegistryId, -//! }, nil) -//! myAppImage, err := docker.NewImage(ctx, "my-app-image", &docker.ImageArgs{ -//! Build: &docker.DockerBuildArgs{ -//! Args: pulumi.StringMap{ -//! "BUILDKIT_INLINE_CACHE": pulumi.String("1"), -//! }, -//! CacheFrom: &docker.CacheFromArgs{ -//! Images: pulumi.StringArray{ -//! ecrRepository.RepositoryUrl.ApplyT(func(repositoryUrl string) (string, error) { -//! return fmt.Sprintf("%v:latest", repositoryUrl), nil -//! }).(pulumi.StringOutput), -//! }, -//! }, -//! Context: pulumi.String("app/"), -//! Dockerfile: pulumi.String("Dockerfile"), -//! }, -//! ImageName: ecrRepository.RepositoryUrl.ApplyT(func(repositoryUrl string) (string, error) { -//! return fmt.Sprintf("%v:latest", repositoryUrl), nil -//! }).(pulumi.StringOutput), -//! Registry: &docker.RegistryArgs{ -//! Password: pulumi.ToSecret(authToken.ApplyT(func(authToken ecr.GetAuthorizationTokenResult) (*string, error) { -//! return &authToken.Password, nil -//! }).(pulumi.StringPtrOutput)).(pulumi.StringOutput), -//! Server: ecrRepository.RepositoryUrl, -//! }, -//! }) -//! if err != nil { -//! return err -//! } -//! ctx.Export("imageName", myAppImage.ImageName) -//! return nil -//! }) -//! } -//! ``` //! ```yaml //! config: {} //! description: Docker image build using caching with AWS Elastic Container Registry @@ -535,64 +129,6 @@ //! fn::aws:ecr:getAuthorizationToken: //! registryId: ${ecr-repository.registryId} //! ``` -//! ```java -//! package generated_program; -//! -//! import com.pulumi.Context; -//! import com.pulumi.Pulumi; -//! import com.pulumi.core.Output; -//! import com.pulumi.aws.ecr.Repository; -//! import com.pulumi.aws.ecr.RepositoryArgs; -//! import com.pulumi.aws.ecr.EcrFunctions; -//! import com.pulumi.aws.ecr.inputs.GetAuthorizationTokenArgs; -//! import com.pulumi.docker.Image; -//! import com.pulumi.docker.ImageArgs; -//! import com.pulumi.docker.inputs.DockerBuildArgs; -//! import com.pulumi.docker.inputs.CacheFromArgs; -//! import com.pulumi.docker.inputs.RegistryArgs; -//! import java.util.List; -//! import java.util.ArrayList; -//! import java.util.Map; -//! import java.io.File; -//! import java.nio.file.Files; -//! import java.nio.file.Paths; -//! -//! public class App { -//! public static void main(String[] args) { -//! Pulumi.run(App::stack); -//! } -//! -//! public static void stack(Context ctx) { -//! var ecrRepository = new Repository("ecrRepository", RepositoryArgs.builder() -//! .name("docker-repository") -//! .build()); -//! -//! final var authToken = EcrFunctions.getAuthorizationToken(GetAuthorizationTokenArgs.builder() -//! .registryId(ecrRepository.registryId()) -//! .build()); -//! -//! var myAppImage = new Image("myAppImage", ImageArgs.builder() -//! .build(DockerBuildArgs.builder() -//! .args(Map.of("BUILDKIT_INLINE_CACHE", "1")) -//! .cacheFrom(CacheFromArgs.builder() -//! .images(ecrRepository.repositoryUrl().applyValue(repositoryUrl -> String.format("%s:latest", repositoryUrl))) -//! .build()) -//! .context("app/") -//! .dockerfile("Dockerfile") -//! .build()) -//! .imageName(ecrRepository.repositoryUrl().applyValue(repositoryUrl -> String.format("%s:latest", repositoryUrl))) -//! .registry(RegistryArgs.builder() -//! .password(Output.ofSecret(authToken.applyValue(getAuthorizationTokenResult -> getAuthorizationTokenResult).applyValue(authToken -> authToken.applyValue(getAuthorizationTokenResult -> getAuthorizationTokenResult.password())))) -//! .server(ecrRepository.repositoryUrl()) -//! .build()) -//! .build()); -//! -//! ctx.export("imageName", myAppImage.imageName()); -//! } -//! } -//! ``` -//! {{% /example %}} -//! {{% /examples %}} #[derive(bon::Builder)] #[builder(finish_fn = build_struct)] diff --git a/providers/pulumi_wasm_provider_docker_rust/src/resource/network.rs b/providers/pulumi_wasm_provider_docker_rust/src/resource/network.rs index 076dd4952..a699dd37c 100644 --- a/providers/pulumi_wasm_provider_docker_rust/src/resource/network.rs +++ b/providers/pulumi_wasm_provider_docker_rust/src/resource/network.rs @@ -33,12 +33,13 @@ //! //! you provide the definition for the resource as follows //! -//! ```yaml -//! resources: -//! foo: -//! type: docker:Network -//! properties: -//! name: "foo" +//! ```ignore +//! use pulumi_wasm_rust::Output; +//! use pulumi_wasm_rust::{add_export, pulumi_main}; +//! #[pulumi_main] +//! fn test_main() -> Result<(), Error> { +//! let foo = network::create("foo", NetworkArgs::builder().name("foo").build_struct()); +//! } //! ``` //! //! then the import command is as follows diff --git a/providers/pulumi_wasm_provider_docker_rust/src/resource/secret.rs b/providers/pulumi_wasm_provider_docker_rust/src/resource/secret.rs index e2b1f5fb9..6da96c6bc 100644 --- a/providers/pulumi_wasm_provider_docker_rust/src/resource/secret.rs +++ b/providers/pulumi_wasm_provider_docker_rust/src/resource/secret.rs @@ -2,7 +2,7 @@ //! //! ## Import //! -//! ``` +//! ```sh //! # Docker secret cannot be imported as the secret data, once set, is never exposed again. //! ``` diff --git a/providers/pulumi_wasm_provider_docker_rust/src/resource/service.rs b/providers/pulumi_wasm_provider_docker_rust/src/resource/service.rs index 87f053ca2..d5906964a 100644 --- a/providers/pulumi_wasm_provider_docker_rust/src/resource/service.rs +++ b/providers/pulumi_wasm_provider_docker_rust/src/resource/service.rs @@ -21,19 +21,36 @@ //! //! you provide the definition for the resource as follows //! -//! ```yaml -//! resources: -//! foo: -//! type: docker:Service -//! name: foo -//! properties: -//! taskSpec: -//! containerSpec: -//! image: "nginx" -//! endpointSpec: -//! ports: -//! - targetPort: 80 -//! publishedPort: 8080 +//! ```ignore +//! use pulumi_wasm_rust::Output; +//! use pulumi_wasm_rust::{add_export, pulumi_main}; +//! #[pulumi_main] +//! fn test_main() -> Result<(), Error> { +//! let foo = service::create( +//! "foo", +//! ServiceArgs::builder() +//! .endpoint_spec( +//! ServiceEndpointSpec::builder() +//! .ports( +//! vec![ +//! ServiceEndpointSpecPort::builder().publishedPort(8080) +//! .targetPort(80).build_struct(), +//! ], +//! ) +//! .build_struct(), +//! ) +//! .task_spec( +//! ServiceTaskSpec::builder() +//! .containerSpec( +//! ServiceTaskSpecContainerSpec::builder() +//! .image("nginx") +//! .build_struct(), +//! ) +//! .build_struct(), +//! ) +//! .build_struct(), +//! ); +//! } //! ``` //! //! then the import command is as follows diff --git a/providers/pulumi_wasm_provider_docker_rust/src/resource/service_config.rs b/providers/pulumi_wasm_provider_docker_rust/src/resource/service_config.rs index 76ff2eb20..dc1dbde27 100644 --- a/providers/pulumi_wasm_provider_docker_rust/src/resource/service_config.rs +++ b/providers/pulumi_wasm_provider_docker_rust/src/resource/service_config.rs @@ -18,13 +18,18 @@ //! //! you provide the definition for the resource as follows //! -//! ```yaml -//! resources: -//! foo: -//! type: docker:ServiceConfig -//! name: foo -//! properties: -//! data: 'base64encode("{\"a\": \"b\"}")' +//! ```ignore +//! use pulumi_wasm_rust::Output; +//! use pulumi_wasm_rust::{add_export, pulumi_main}; +//! #[pulumi_main] +//! fn test_main() -> Result<(), Error> { +//! let foo = service_config::create( +//! "foo", +//! ServiceConfigArgs::builder() +//! .data("base64encode(\"{\\\"a\\\": \\\"b\\\"}\")") +//! .build_struct(), +//! ); +//! } //! ``` //! //! then the import command is as follows diff --git a/pulumi_wasm_generator_lib/src/description.rs b/pulumi_wasm_generator_lib/src/description.rs index 394eaad23..3f787d058 100644 --- a/pulumi_wasm_generator_lib/src/description.rs +++ b/pulumi_wasm_generator_lib/src/description.rs @@ -1,5 +1,7 @@ use crate::code_generation::generate_code_from_string; -use crate::description::State::{Examples, Initial, Language, Shell, YAML}; +use crate::description::State::{ + Examples, Initial, LanguageInExamples, LanguageOutsideExamples, Shell, Yaml, +}; use crate::model::Package; struct DescriptionState { @@ -30,8 +32,9 @@ impl<'a> Description<'a> { let (new_state, lines) = match state { Initial => Self::initial_transition(line), Examples => Self::examples_transition(line), - YAML(yaml_lines) => Self::yaml_transition(line, yaml_lines, self.package), - Language => Self::language_transition(line), + Yaml(yaml_lines) => Self::yaml_transition(line, yaml_lines, self.package), + LanguageInExamples => Self::language_transition(line), + LanguageOutsideExamples => Self::language_outside_examples_transition(line), Shell => Self::shell_transition(line), }; result_lines.extend(lines); @@ -49,15 +52,17 @@ impl<'a> Description<'a> { fn initial_transition(line: &str) -> (State, Vec) { match line.trim() { "" | "{{% examples %}}" => (Examples, vec![]), - "```" | "```sh" | "```shell" | "```text" => (Shell, vec![line.to_string()]), + // Rustdoc treats ``` as rust code block + "```" => (Shell, vec!["```sh".to_string()]), + l if l.starts_with("```") => (LanguageOutsideExamples, vec![line.to_string()]), _ => (Initial, vec![line.to_string()]), } } fn examples_transition(line: &str) -> (State, Vec) { match line.trim() { - "```yaml" => (YAML(vec![]), vec![]), - "```typescript" | "```python" | "```java" | "```go" => (Language, vec![]), + "```yaml" => (Yaml(vec![]), vec![]), + "```typescript" | "```python" | "```java" | "```go" => (LanguageInExamples, vec![]), "{{% example %}}" | "{{% /example %}}" => (Examples, vec![]), "{{% /examples %}}" | "" => (Initial, vec![]), _ => (Examples, vec![]), @@ -67,7 +72,7 @@ impl<'a> Description<'a> { fn language_transition(line: &str) -> (State, Vec) { match line.trim() { "```" => (Examples, vec![]), - _ => (Language, vec![]), + _ => (LanguageInExamples, vec![]), } } @@ -78,6 +83,13 @@ impl<'a> Description<'a> { } } + fn language_outside_examples_transition(line: &str) -> (State, Vec) { + match line.trim() { + "```" => (Initial, vec![line.to_string()]), + _ => (LanguageOutsideExamples, vec![line.to_string()]), + } + } + fn yaml_transition( line: &str, mut yaml_lines: Vec, @@ -115,7 +127,7 @@ impl<'a> Description<'a> { } _ => { yaml_lines.push(line.to_string()); - (YAML(yaml_lines), vec![]) + (Yaml(yaml_lines), vec![]) } } } @@ -124,8 +136,9 @@ impl<'a> Description<'a> { enum State { Initial, Examples, - YAML(Vec), - Language, + Yaml(Vec), + LanguageInExamples, + LanguageOutsideExamples, Shell, } diff --git a/pulumi_wasm_generator_lib/src/dockerfixes/getPlugin/1_fixed.md b/pulumi_wasm_generator_lib/src/dockerfixes/getPlugin/1_fixed.md index 6cde69cdf..156de3b06 100644 --- a/pulumi_wasm_generator_lib/src/dockerfixes/getPlugin/1_fixed.md +++ b/pulumi_wasm_generator_lib/src/dockerfixes/getPlugin/1_fixed.md @@ -3,18 +3,21 @@ Reads the local Docker plugin. The plugin must be installed locally. ## Example Usage ### With alias + ```yaml variables: byAlias: fn::docker:getPlugin: alias: "sample-volume-plugin:latest" ``` + ### With ID + ```yaml variables: byId: fn::docker:getPlugin: id: "e9a9db917b3bfd6706b5d3a66d4bceb9f" ``` - + diff --git a/pulumi_wasm_generator_lib/src/dockerfixes/network/1_fixed.md b/pulumi_wasm_generator_lib/src/dockerfixes/network/1_fixed.md index 599393cc5..9cad7575a 100644 --- a/pulumi_wasm_generator_lib/src/dockerfixes/network/1_fixed.md +++ b/pulumi_wasm_generator_lib/src/dockerfixes/network/1_fixed.md @@ -96,6 +96,7 @@ prints the long ID you provide the definition for the resource as follows + ```yaml resources: foo: @@ -103,6 +104,7 @@ resources: properties: name: "foo" ``` + then the import command is as follows diff --git a/pulumi_wasm_generator_lib/src/dockerfixes/service/1_fixed.md b/pulumi_wasm_generator_lib/src/dockerfixes/service/1_fixed.md index fa739e98d..7f612f73e 100644 --- a/pulumi_wasm_generator_lib/src/dockerfixes/service/1_fixed.md +++ b/pulumi_wasm_generator_lib/src/dockerfixes/service/1_fixed.md @@ -21,6 +21,7 @@ prints this ID you provide the definition for the resource as follows + ```yaml resources: foo: @@ -35,6 +36,7 @@ resources: - targetPort: 80 publishedPort: 8080 ``` + then the import command is as follows diff --git a/pulumi_wasm_generator_lib/src/dockerfixes/serviceConfig/1_fixed.md b/pulumi_wasm_generator_lib/src/dockerfixes/serviceConfig/1_fixed.md index f5b25fe05..518f3dd79 100644 --- a/pulumi_wasm_generator_lib/src/dockerfixes/serviceConfig/1_fixed.md +++ b/pulumi_wasm_generator_lib/src/dockerfixes/serviceConfig/1_fixed.md @@ -18,6 +18,7 @@ prints the id you provide the definition for the resource as follows + ```yaml resources: foo: @@ -26,6 +27,7 @@ resources: properties: data: 'base64encode("{\"a\": \"b\"}")' ``` + then the import command is as follows