Skip to content

Commit

Permalink
Bon (#390)
Browse files Browse the repository at this point in the history
Closes #288
  • Loading branch information
andrzejressel authored Sep 15, 2024
1 parent 9085d85 commit 1301322
Show file tree
Hide file tree
Showing 527 changed files with 3,844 additions and 608 deletions.
67 changes: 67 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,4 @@ reqwest = "0.12.5"
wit-component = "0.217.0"
wit-parser = "0.217.0"
wasmprinter = "0.217.0"
bon = "2.2.1"
6 changes: 3 additions & 3 deletions examples/dependencies/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ local-test:
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true

cargo build -p pulumi_wasm_runner
cargo component build -p pulumi_wasm_example_multiple_providers
cargo component build -p pulumi_wasm_random_provider
cargo build -p pulumi_wasm_runner --release
cargo component build -p pulumi_wasm_example_multiple_providers --release
cargo component build -p pulumi_wasm_random_provider --release
$env:PULUMI_CONFIG_PASSPHRASE=" "
pulumi destroy -y
pulumi up -y
49 changes: 7 additions & 42 deletions examples/dependencies/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,58 +9,23 @@ fn test_main() -> Result<(), Error> {
let length: Output<i32> = Output::new(&4);
let random_string_1 = random_string::create(
"test_1",
RandomStringArgs {
keepers: Output::empty(),
length,
lower: Output::empty(),
min_lower: Output::empty(),
min_numeric: Output::empty(),
min_special: Output::empty(),
min_upper: Output::empty(),
number: Output::empty(),
numeric: Output::empty(),
override_special: Output::empty(),
special: Output::empty(),
upper: Output::empty(),
},
RandomStringArgs::builder().length(length).build_struct(),
);

let new_length = random_string_1.result.map(|s| s.len() as i32);

let random_string_2 = random_string::create(
"test_2",
RandomStringArgs {
keepers: Output::empty(),
length: new_length,
lower: Output::empty(),
min_lower: Output::empty(),
min_numeric: Output::empty(),
min_special: Output::empty(),
min_upper: Output::empty(),
number: Output::empty(),
numeric: Output::empty(),
override_special: Output::empty(),
special: Output::empty(),
upper: Output::empty(),
},
RandomStringArgs::builder()
.length(new_length)
.build_struct(),
);

let random_string_3 = random_string::create(
"test_3",
RandomStringArgs {
keepers: Output::empty(),
length: random_string_2.length.map(|i| i * 2),
lower: Output::empty(),
min_lower: Output::empty(),
min_numeric: Output::empty(),
min_special: Output::empty(),
min_upper: Output::empty(),
number: Output::empty(),
numeric: Output::empty(),
override_special: Output::empty(),
special: Output::empty(),
upper: Output::empty(),
},
RandomStringArgs::builder()
.length(random_string_2.length.map(|i| i * 2))
.build_struct(),
);

add_export("result", &random_string_1.result);
Expand Down
6 changes: 3 additions & 3 deletions examples/docker/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ local-test:
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true

cargo build -p pulumi_wasm_runner
cargo component build -p pulumi_wasm_example_multiple_providers
cargo component build -p pulumi_wasm_random_provider
cargo build -p pulumi_wasm_runner --release
cargo component build -p pulumi_wasm_example_multiple_providers --release
cargo component build -p pulumi_wasm_random_provider --release
$env:PULUMI_CONFIG_PASSPHRASE=" "
pulumi destroy -y
pulumi up -y
104 changes: 19 additions & 85 deletions examples/docker/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,102 +1,36 @@
use anyhow::Error;

use pulumi_wasm_docker::{container, image, ContainerLabel, DockerBuild};
use pulumi_wasm_rust::{add_export, pulumi_main, Output};
use pulumi_wasm_rust::{add_export, pulumi_main};

#[pulumi_main]
fn test_main() -> Result<(), Error> {
let cont = container::create(
"container",
container::ContainerArgs {
attach: true.into(),
capabilities: Output::empty(),
cgroupns_mode: Output::empty(),
command: vec!["echo".to_string(), "Hello World!".to_string()].into(),
container_read_refresh_timeout_milliseconds: Output::empty(),
cpu_set: Output::empty(),
cpu_shares: Output::empty(),
destroy_grace_seconds: Output::empty(),
devices: Output::empty(),
dns: Output::empty(),
dns_opts: Output::empty(),
dns_searches: Output::empty(),
domainname: Output::empty(),
entrypoints: Output::empty(),
envs: Output::empty(),
gpus: Output::empty(),
group_adds: Output::empty(),
healthcheck: Output::empty(),
hostname: Output::empty(),
hosts: Output::empty(),
image: "public.ecr.aws/ubuntu/ubuntu:latest".to_string().into(),
init: Output::empty(),
ipc_mode: Output::empty(),
labels: vec![ContainerLabel {
container::ContainerArgs::builder()
.attach(true)
.command(["echo", "Hello World!"])
.image("public.ecr.aws/ubuntu/ubuntu:latest")
.labels(vec![ContainerLabel {
label: Box::new("label_1".to_string()),
value: Box::new("value_1".to_string()),
}]
.into(),
log_driver: Output::empty(),
log_opts: Output::empty(),
logs: true.into(),
max_retry_count: Output::empty(),
memory: Output::empty(),
memory_swap: Output::empty(),
mounts: Output::empty(),
must_run: false.into(),
name: Output::empty(),
network_mode: Output::empty(),
networks_advanced: Output::empty(),
pid_mode: Output::empty(),
ports: Output::empty(),
privileged: Output::empty(),
publish_all_ports: Output::empty(),
read_only: Output::empty(),
remove_volumes: Output::empty(),
restart: Output::empty(),
rm: Output::empty(),
runtime: Output::empty(),
security_opts: Output::empty(),
shm_size: Output::empty(),
start: Output::empty(),
stdin_open: Output::empty(),
stop_signal: Output::empty(),
stop_timeout: Output::empty(),
storage_opts: Output::empty(),
sysctls: Output::empty(),
tmpfs: Output::empty(),
tty: Output::empty(),
ulimits: Output::empty(),
uploads: Output::empty(),
user: Output::empty(),
userns_mode: Output::empty(),
volumes: Output::empty(),
wait: Output::empty(),
wait_timeout: Output::empty(),
working_dir: Output::empty(),
},
}])
.logs(true)
.must_run(false)
.build_struct(),
);

let image = image::create(
"image",
image::ImageArgs {
build: DockerBuild {
add_hosts: None.into(),
args: None.into(),
builder_version: None.into(),
cache_from: None.into(),
context: Some("docker/".to_string()).into(),
dockerfile: None.into(),
network: None.into(),
platform: None.into(),
target: None.into(),
}
.into(),
build_on_preview: Output::empty(),
image_name: "image:test".to_string().into(),
registry: Output::empty(),
skip_push: true.into(),
},
image::ImageArgs::builder()
.build(
DockerBuild::builder()
.context(Some("docker/".to_string()))
.build_struct(),
)
.image_name("image:test")
.skip_push(true)
.build_struct(),
);

add_export("logs", &cont.container_logs);
Expand Down
8 changes: 4 additions & 4 deletions examples/multiple_providers/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ local-test:
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true

cargo build -p pulumi_wasm_runner
cargo component build -p pulumi_wasm_example_multiple_providers
cargo component build -p pulumi_wasm_docker_provider
cargo component build -p pulumi_wasm_random_provider
cargo build -p pulumi_wasm_runner --release
cargo component build -p pulumi_wasm_example_multiple_providers --release
cargo component build -p pulumi_wasm_docker_provider --release
cargo component build -p pulumi_wasm_random_provider --release
$env:PULUMI_CONFIG_PASSPHRASE=" "
pulumi destroy -y
pulumi up -y
Loading

0 comments on commit 1301322

Please sign in to comment.