Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get functions #413

Merged
merged 22 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/dependencies/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ local-test:
$PSNativeCommandUseErrorActionPreference = $true

cargo build -p pulumi_wasm_runner --release
cargo component build -p pulumi_wasm_example_multiple_providers --release
cargo component build -p pulumi_wasm --release
cargo component build -p pulumi_wasm_example_dependencies --release
cargo component build -p pulumi_wasm_random_provider --release
$env:PULUMI_CONFIG_PASSPHRASE=" "
pulumi destroy -y
Expand Down
5 changes: 3 additions & 2 deletions examples/docker/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ local-test:
$PSNativeCommandUseErrorActionPreference = $true

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
cargo component build -p pulumi_wasm --release
cargo component build -p pulumi_wasm_example_docker --release
cargo component build -p pulumi_wasm_docker_provider --release
$env:PULUMI_CONFIG_PASSPHRASE=" "
pulumi destroy -y
pulumi up -y
8 changes: 8 additions & 0 deletions examples/docker/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Error;

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

Expand Down Expand Up @@ -33,8 +34,15 @@ fn test_main() -> Result<(), Error> {
.build_struct(),
);

let remote_image = pulumi_wasm_docker::get_remote_image::invoke(
GetRemoteImageArgs::builder()
.name("public.ecr.aws/ubuntu/ubuntu:latest")
.build_struct(),
);

add_export("logs", &cont.container_logs);
add_export("image_id", &image.image_name);
add_export("labels", &cont.labels.map(|f| f[0].value.clone()));
add_export("remote_image_id", &remote_image.repo_digest);
Ok(())
}
7 changes: 7 additions & 0 deletions examples/docker/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,16 @@ fn test_integration() -> Result<(), anyhow::Error> {
.as_str()
.ok_or(anyhow!("[labels] is not a string"))?;

let remote_image_id = stack
.pointer("/remote_image_id")
.ok_or(anyhow!("Cannot find [remote_image_id] in stack export"))?
.as_str()
.ok_or(anyhow!("[remote_image_id] is not a string"))?;

assert!(logs.contains("Hello World!"));
assert!(!image_id.is_empty());
assert!(labels.contains("value_1"));
assert!(remote_image_id.starts_with("public.ecr.aws/ubuntu/ubuntu@sha256:"));

Ok(())
}
1 change: 1 addition & 0 deletions examples/multiple_providers/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ local-test:
$PSNativeCommandUseErrorActionPreference = $true

cargo build -p pulumi_wasm_runner --release
cargo component build -p pulumi_wasm --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
Expand Down
3 changes: 2 additions & 1 deletion examples/simple/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ local-test:
$PSNativeCommandUseErrorActionPreference = $true

cargo build -p pulumi_wasm_runner --release
cargo component build -p pulumi_wasm_example_multiple_providers --release
cargo component build -p pulumi_wasm --release
cargo component build -p pulumi_wasm_example_simple --release
cargo component build -p pulumi_wasm_random_provider --release
$env:PULUMI_CONFIG_PASSPHRASE=" "
pulumi destroy -y
Expand Down
3 changes: 0 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ regenerate-providers:
cargo run -p pulumi_wasm_generator -- gen-rust --remove true --schema providers/cloudflare.json --output providers/pulumi_wasm_provider_cloudflare_rust
# DO NOT EDIT - REGENERATE-PROVIDERS - END

regenerate-and-fmt:
just regenerate-providers build-wasm-components fmt

publish:
cargo publish -p pulumi_wasm_wit --all-features
cargo publish -p pulumi_wasm_proto --all-features
Expand Down
Loading
Loading