From d6c999bb7eeec452ddb8195907da97a8141c92a6 Mon Sep 17 00:00:00 2001 From: Andrzej Ressel Date: Mon, 1 Apr 2024 23:29:24 +0200 Subject: [PATCH] Support optional result fields --- examples/simple/justfile | 7 + examples/simple/src/lib.rs | 4 + examples/simple/tests/test.rs | 7 + .../src/bindings.rs | 1684 ----------------- .../pulumi_wasm_provider_random/src/lib.rs | 332 ++-- .../wit/deps/pulumi-wasm.wit | 2 +- .../src/lib.rs | 4 +- .../src/source.rs | 349 ++-- .../wit/deps/pulumi-wasm.wit | 2 +- pulumi_wasm/src/bindings.rs | 53 +- pulumi_wasm/src/finalizer.rs | 7 +- pulumi_wasm/src/lib.rs | 35 +- pulumi_wasm/src/output.rs | 7 +- .../src/output/provider/lib.rs.handlebars | 2 +- .../src/output/provider/source_code.rs | 5 + .../src/output/wit/dependencies.wit | 2 +- pulumi_wasm_generator/src/schema.rs | 4 +- .../output/random_provider/lib/src/source.rs | 128 +- .../lib/wit/deps/pulumi-wasm.wit | 2 +- .../random_provider/provider/src/lib.rs | 108 +- .../provider/wit/deps/pulumi-wasm.wit | 2 +- wits/world.wit | 2 +- 22 files changed, 469 insertions(+), 2279 deletions(-) delete mode 100644 providers/pulumi_wasm_provider_random/src/bindings.rs diff --git a/examples/simple/justfile b/examples/simple/justfile index 2a3783092..a61b03253 100644 --- a/examples/simple/justfile +++ b/examples/simple/justfile @@ -6,3 +6,10 @@ build: run: just build cargo run -p pulumi_wasm_runner -- run --wasm ../../target/wasm32-wasi/debug/composed.wasm + +[windows] +local-test: + #!pwsh + $env:PULUMI_CONFIG_PASSPHRASE=" " + pulumi destroy -y + pulumi up -y \ No newline at end of file diff --git a/examples/simple/src/lib.rs b/examples/simple/src/lib.rs index 6369f078f..0f989a056 100644 --- a/examples/simple/src/lib.rs +++ b/examples/simple/src/lib.rs @@ -25,6 +25,10 @@ fn test_main() -> Result<(), Error> { special: None.into(), upper: None.into(), }); + + let t = random_string.result.map(|s| format!("Result: {s}")); + add_export("result", random_string.result); + add_export("transformed_result", t); Ok(()) } diff --git a/examples/simple/tests/test.rs b/examples/simple/tests/test.rs index 90167239f..a3be044d4 100644 --- a/examples/simple/tests/test.rs +++ b/examples/simple/tests/test.rs @@ -49,7 +49,14 @@ fn test_integration() -> Result<(), anyhow::Error> { .as_str() .ok_or(anyhow!("[result] is not a string"))?; + let transformed_result = stack + .pointer("/transformed_result") + .ok_or(anyhow!("Cannot find [transformed_result] in stack export"))? + .as_str() + .ok_or(anyhow!("[transformed_result] is not a string"))?; + assert_eq!(result.len(), 36); + assert_eq!(transformed_result, format!("Result: {}", result)); Ok(()) } diff --git a/providers/pulumi_wasm_provider_random/src/bindings.rs b/providers/pulumi_wasm_provider_random/src/bindings.rs deleted file mode 100644 index 837237d18..000000000 --- a/providers/pulumi_wasm_provider_random/src/bindings.rs +++ /dev/null @@ -1,1684 +0,0 @@ -// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! -// Options used: -pub mod component { - pub mod pulumi_wasm { - #[allow(clippy::all)] - pub mod output_interface { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - - #[derive(Debug)] - #[repr(transparent)] - pub struct Output { - handle: _rt::Resource, - } - - impl Output { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: _rt::Resource::from_handle(handle), - } - } - - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - } - - unsafe impl _rt::WasmResource for Output { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "component:pulumi-wasm/output-interface@0.1.0")] - extern "C" { - #[link_name = "[resource-drop]output"] - fn drop(_: u32); - } - - drop(_handle); - } - } - } - - #[allow(unused_unsafe, clippy::all)] - pub fn describe_outputs() -> _rt::String { - unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "component:pulumi-wasm/output-interface@0.1.0")] - extern "C" { - #[link_name = "describe-outputs"] - fn wit_import(_: *mut u8); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: *mut u8) { - unreachable!() - } - wit_import(ptr0); - let l1 = *ptr0.add(0).cast::<*mut u8>(); - let l2 = *ptr0.add(4).cast::(); - let len3 = l2; - let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3); - _rt::string_lift(bytes3) - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn non_done_exists() -> bool { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "component:pulumi-wasm/output-interface@0.1.0")] - extern "C" { - #[link_name = "non-done-exists"] - fn wit_import() -> i32; - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import() -> i32 { - unreachable!() - } - let ret = wit_import(); - _rt::bool_lift(ret as u8) - } - } - impl Output { - #[allow(unused_unsafe, clippy::all)] - pub fn new(value: &[u8]) -> Self { - unsafe { - let vec0 = value; - let ptr0 = vec0.as_ptr().cast::(); - let len0 = vec0.len(); - - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "component:pulumi-wasm/output-interface@0.1.0")] - extern "C" { - #[link_name = "[constructor]output"] - fn wit_import(_: *mut u8, _: usize) -> i32; - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: *mut u8, _: usize) -> i32 { - unreachable!() - } - let ret = wit_import(ptr0.cast_mut(), len0); - Output::from_handle(ret as u32) - } - } - } - impl Output { - #[allow(unused_unsafe, clippy::all)] - pub fn map(&self, function_name: &str) -> Output { - unsafe { - let vec0 = function_name; - let ptr0 = vec0.as_ptr().cast::(); - let len0 = vec0.len(); - - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "component:pulumi-wasm/output-interface@0.1.0")] - extern "C" { - #[link_name = "[method]output.map"] - fn wit_import(_: i32, _: *mut u8, _: usize) -> i32; - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8, _: usize) -> i32 { - unreachable!() - } - let ret = wit_import((self).handle() as i32, ptr0.cast_mut(), len0); - Output::from_handle(ret as u32) - } - } - } - impl Output { - #[allow(unused_unsafe, clippy::all)] - pub fn get(&self) -> Option<_rt::Vec> { - unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "component:pulumi-wasm/output-interface@0.1.0")] - extern "C" { - #[link_name = "[method]output.get"] - fn wit_import(_: i32, _: *mut u8); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { - unreachable!() - } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { - 0 => None, - 1 => { - let e = { - let l2 = *ptr0.add(4).cast::<*mut u8>(); - let l3 = *ptr0.add(8).cast::(); - let len4 = l3; - - _rt::Vec::from_raw_parts(l2.cast(), len4, len4) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - } - } - } - impl Output { - #[allow(unused_unsafe, clippy::all)] - pub fn get_field(&self, field: &str) -> Output { - unsafe { - let vec0 = field; - let ptr0 = vec0.as_ptr().cast::(); - let len0 = vec0.len(); - - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "component:pulumi-wasm/output-interface@0.1.0")] - extern "C" { - #[link_name = "[method]output.get-field"] - fn wit_import(_: i32, _: *mut u8, _: usize) -> i32; - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8, _: usize) -> i32 { - unreachable!() - } - let ret = wit_import((self).handle() as i32, ptr0.cast_mut(), len0); - Output::from_handle(ret as u32) - } - } - } - impl Output { - #[allow(unused_unsafe, clippy::all)] - pub fn get_type(&self) -> _rt::String { - unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "component:pulumi-wasm/output-interface@0.1.0")] - extern "C" { - #[link_name = "[method]output.get-type"] - fn wit_import(_: i32, _: *mut u8); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { - unreachable!() - } - wit_import((self).handle() as i32, ptr0); - let l1 = *ptr0.add(0).cast::<*mut u8>(); - let l2 = *ptr0.add(4).cast::(); - let len3 = l2; - let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3); - _rt::string_lift(bytes3) - } - } - } - impl Output { - #[allow(unused_unsafe, clippy::all)] - pub fn duplicate(&self) -> Output { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "component:pulumi-wasm/output-interface@0.1.0")] - extern "C" { - #[link_name = "[method]output.duplicate"] - fn wit_import(_: i32) -> i32; - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { - unreachable!() - } - let ret = wit_import((self).handle() as i32); - Output::from_handle(ret as u32) - } - } - } - } - - #[allow(clippy::all)] - pub mod register_interface { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Output = super::super::super::component::pulumi_wasm::output_interface::Output; - pub struct ObjectField<'a> { - pub name: _rt::String, - pub value: &'a Output, - } - impl<'a> ::core::fmt::Debug for ObjectField<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("ObjectField") - .field("name", &self.name) - .field("value", &self.value) - .finish() - } - } - pub struct RegisterResourceRequest<'a> { - pub type_: _rt::String, - pub name: _rt::String, - pub object: _rt::Vec>, - } - impl<'a> ::core::fmt::Debug for RegisterResourceRequest<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("RegisterResourceRequest") - .field("type", &self.type_) - .field("name", &self.name) - .field("object", &self.object) - .finish() - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn register(request: &RegisterResourceRequest<'_>) -> Output { - unsafe { - let RegisterResourceRequest { - type_: type_0, - name: name0, - object: object0, - } = request; - let vec1 = type_0; - let ptr1 = vec1.as_ptr().cast::(); - let len1 = vec1.len(); - let vec2 = name0; - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - let vec5 = object0; - let len5 = vec5.len(); - let layout5 = _rt::alloc::Layout::from_size_align_unchecked(vec5.len() * 12, 4); - let result5 = if layout5.size() != 0 { - let ptr = _rt::alloc::alloc(layout5).cast::(); - if ptr.is_null() { - _rt::alloc::handle_alloc_error(layout5); - } - ptr - } else { - { - ::core::ptr::null_mut() - } - }; - for (i, e) in vec5.into_iter().enumerate() { - let base = result5.add(i * 12); - { - let ObjectField { - name: name3, - value: value3, - } = e; - let vec4 = name3; - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - *base.add(4).cast::() = len4; - *base.add(0).cast::<*mut u8>() = ptr4.cast_mut(); - *base.add(8).cast::() = (value3).handle() as i32; - } - } - - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "component:pulumi-wasm/register-interface@0.1.0")] - extern "C" { - #[link_name = "register"] - fn wit_import( - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - ) -> i32; - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import( - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - ) -> i32 { - unreachable!() - } - let ret = - wit_import(ptr1.cast_mut(), len1, ptr2.cast_mut(), len2, result5, len5); - if layout5.size() != 0 { - _rt::alloc::dealloc(result5.cast(), layout5); - } - super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(ret as u32) - } - } - } - } -} -pub mod exports { - pub mod pulumi { - pub mod random { - #[allow(clippy::all)] - pub mod random_bytes { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; - use super::super::super::super::_rt; - pub type Output = - super::super::super::super::component::pulumi_wasm::output_interface::Output; - pub struct Args<'a> { - pub keepers: &'a Output, - pub length: &'a Output, - } - impl<'a> ::core::fmt::Debug for Args<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Args") - .field("keepers", &self.keepers) - .field("length", &self.length) - .finish() - } - } - pub struct Res { - pub base64: Output, - pub hex: Output, - pub keepers: Output, - pub length: Output, - } - impl ::core::fmt::Debug for Res { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Res") - .field("base64", &self.base64) - .field("hex", &self.hex) - .field("keepers", &self.keepers) - .field("length", &self.length) - .finish() - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_invoke_cabi( - arg0: *mut u8, - arg1: usize, - arg2: i32, - arg3: i32, - ) -> *mut u8 { - let handle1; - let handle2; - let len0 = arg1; - let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); - let result3 = T::invoke( - _rt::string_lift(bytes0), - Args { - keepers: { - handle1 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg2 as u32); - &handle1 - }, - length: { - handle2 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg3 as u32); - &handle2 - }, - }, - ); - let ptr4 = _RET_AREA.0.as_mut_ptr().cast::(); - let Res { - base64: base645, - hex: hex5, - keepers: keepers5, - length: length5, - } = result3; - *ptr4.add(0).cast::() = (base645).take_handle() as i32; - *ptr4.add(4).cast::() = (hex5).take_handle() as i32; - *ptr4.add(8).cast::() = (keepers5).take_handle() as i32; - *ptr4.add(12).cast::() = (length5).take_handle() as i32; - ptr4 - } - pub trait Guest { - fn invoke(name: _rt::String, args: Args<'_>) -> Res; - } - #[doc(hidden)] - - macro_rules! __export_pulumi_random_random_bytes_4_15_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "pulumi:random/random-bytes@4.15.0#invoke"] - unsafe extern "C" fn export_invoke(arg0: *mut u8,arg1: usize,arg2: i32,arg3: i32,) -> *mut u8 { - $($path_to_types)*::_export_invoke_cabi::<$ty>(arg0, arg1, arg2, arg3) - } - };); - } - #[doc(hidden)] - pub(crate) use __export_pulumi_random_random_bytes_4_15_0_cabi; - #[repr(align(4))] - struct _RetArea([::core::mem::MaybeUninit; 16]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 16]); - } - - #[allow(clippy::all)] - pub mod random_id { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; - use super::super::super::super::_rt; - pub type Output = - super::super::super::super::component::pulumi_wasm::output_interface::Output; - pub struct Args<'a> { - pub byte_length: &'a Output, - pub keepers: &'a Output, - pub prefix: &'a Output, - } - impl<'a> ::core::fmt::Debug for Args<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Args") - .field("byte-length", &self.byte_length) - .field("keepers", &self.keepers) - .field("prefix", &self.prefix) - .finish() - } - } - pub struct Res { - pub b64_std: Output, - pub b64_url: Output, - pub byte_length: Output, - pub dec: Output, - pub hex: Output, - pub keepers: Output, - pub prefix: Output, - } - impl ::core::fmt::Debug for Res { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Res") - .field("b64-std", &self.b64_std) - .field("b64-url", &self.b64_url) - .field("byte-length", &self.byte_length) - .field("dec", &self.dec) - .field("hex", &self.hex) - .field("keepers", &self.keepers) - .field("prefix", &self.prefix) - .finish() - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_invoke_cabi( - arg0: *mut u8, - arg1: usize, - arg2: i32, - arg3: i32, - arg4: i32, - ) -> *mut u8 { - let handle1; - let handle2; - let handle3; - let len0 = arg1; - let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); - let result4 = T::invoke( - _rt::string_lift(bytes0), - Args { - byte_length: { - handle1 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg2 as u32); - &handle1 - }, - keepers: { - handle2 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg3 as u32); - &handle2 - }, - prefix: { - handle3 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg4 as u32); - &handle3 - }, - }, - ); - let ptr5 = _RET_AREA.0.as_mut_ptr().cast::(); - let Res { - b64_std: b64_std6, - b64_url: b64_url6, - byte_length: byte_length6, - dec: dec6, - hex: hex6, - keepers: keepers6, - prefix: prefix6, - } = result4; - *ptr5.add(0).cast::() = (b64_std6).take_handle() as i32; - *ptr5.add(4).cast::() = (b64_url6).take_handle() as i32; - *ptr5.add(8).cast::() = (byte_length6).take_handle() as i32; - *ptr5.add(12).cast::() = (dec6).take_handle() as i32; - *ptr5.add(16).cast::() = (hex6).take_handle() as i32; - *ptr5.add(20).cast::() = (keepers6).take_handle() as i32; - *ptr5.add(24).cast::() = (prefix6).take_handle() as i32; - ptr5 - } - pub trait Guest { - fn invoke(name: _rt::String, args: Args<'_>) -> Res; - } - #[doc(hidden)] - - macro_rules! __export_pulumi_random_random_id_4_15_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "pulumi:random/random-id@4.15.0#invoke"] - unsafe extern "C" fn export_invoke(arg0: *mut u8,arg1: usize,arg2: i32,arg3: i32,arg4: i32,) -> *mut u8 { - $($path_to_types)*::_export_invoke_cabi::<$ty>(arg0, arg1, arg2, arg3, arg4) - } - };); - } - #[doc(hidden)] - pub(crate) use __export_pulumi_random_random_id_4_15_0_cabi; - #[repr(align(4))] - struct _RetArea([::core::mem::MaybeUninit; 28]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 28]); - } - - #[allow(clippy::all)] - pub mod random_integer { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; - use super::super::super::super::_rt; - pub type Output = - super::super::super::super::component::pulumi_wasm::output_interface::Output; - pub struct Args<'a> { - pub keepers: &'a Output, - pub max: &'a Output, - pub min: &'a Output, - pub seed: &'a Output, - } - impl<'a> ::core::fmt::Debug for Args<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Args") - .field("keepers", &self.keepers) - .field("max", &self.max) - .field("min", &self.min) - .field("seed", &self.seed) - .finish() - } - } - pub struct Res { - pub keepers: Output, - pub max: Output, - pub min: Output, - pub result: Output, - pub seed: Output, - } - impl ::core::fmt::Debug for Res { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Res") - .field("keepers", &self.keepers) - .field("max", &self.max) - .field("min", &self.min) - .field("result", &self.result) - .field("seed", &self.seed) - .finish() - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_invoke_cabi( - arg0: *mut u8, - arg1: usize, - arg2: i32, - arg3: i32, - arg4: i32, - arg5: i32, - ) -> *mut u8 { - let handle1; - let handle2; - let handle3; - let handle4; - let len0 = arg1; - let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); - let result5 = T::invoke( - _rt::string_lift(bytes0), - Args { - keepers: { - handle1 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg2 as u32); - &handle1 - }, - max: { - handle2 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg3 as u32); - &handle2 - }, - min: { - handle3 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg4 as u32); - &handle3 - }, - seed: { - handle4 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg5 as u32); - &handle4 - }, - }, - ); - let ptr6 = _RET_AREA.0.as_mut_ptr().cast::(); - let Res { - keepers: keepers7, - max: max7, - min: min7, - result: result7, - seed: seed7, - } = result5; - *ptr6.add(0).cast::() = (keepers7).take_handle() as i32; - *ptr6.add(4).cast::() = (max7).take_handle() as i32; - *ptr6.add(8).cast::() = (min7).take_handle() as i32; - *ptr6.add(12).cast::() = (result7).take_handle() as i32; - *ptr6.add(16).cast::() = (seed7).take_handle() as i32; - ptr6 - } - pub trait Guest { - fn invoke(name: _rt::String, args: Args<'_>) -> Res; - } - #[doc(hidden)] - - macro_rules! __export_pulumi_random_random_integer_4_15_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "pulumi:random/random-integer@4.15.0#invoke"] - unsafe extern "C" fn export_invoke(arg0: *mut u8,arg1: usize,arg2: i32,arg3: i32,arg4: i32,arg5: i32,) -> *mut u8 { - $($path_to_types)*::_export_invoke_cabi::<$ty>(arg0, arg1, arg2, arg3, arg4, arg5) - } - };); - } - #[doc(hidden)] - pub(crate) use __export_pulumi_random_random_integer_4_15_0_cabi; - #[repr(align(4))] - struct _RetArea([::core::mem::MaybeUninit; 20]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 20]); - } - - #[allow(clippy::all)] - pub mod random_password { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; - use super::super::super::super::_rt; - pub type Output = - super::super::super::super::component::pulumi_wasm::output_interface::Output; - pub struct Args<'a> { - pub keepers: &'a Output, - pub length: &'a Output, - pub lower: &'a Output, - pub min_lower: &'a Output, - pub min_numeric: &'a Output, - pub min_special: &'a Output, - pub min_upper: &'a Output, - pub number: &'a Output, - pub numeric: &'a Output, - pub override_special: &'a Output, - pub special: &'a Output, - pub upper: &'a Output, - } - impl<'a> ::core::fmt::Debug for Args<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Args") - .field("keepers", &self.keepers) - .field("length", &self.length) - .field("lower", &self.lower) - .field("min-lower", &self.min_lower) - .field("min-numeric", &self.min_numeric) - .field("min-special", &self.min_special) - .field("min-upper", &self.min_upper) - .field("number", &self.number) - .field("numeric", &self.numeric) - .field("override-special", &self.override_special) - .field("special", &self.special) - .field("upper", &self.upper) - .finish() - } - } - pub struct Res { - pub bcrypt_hash: Output, - pub keepers: Output, - pub length: Output, - pub lower: Output, - pub min_lower: Output, - pub min_numeric: Output, - pub min_special: Output, - pub min_upper: Output, - pub number: Output, - pub numeric: Output, - pub override_special: Output, - pub result: Output, - pub special: Output, - pub upper: Output, - } - impl ::core::fmt::Debug for Res { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Res") - .field("bcrypt-hash", &self.bcrypt_hash) - .field("keepers", &self.keepers) - .field("length", &self.length) - .field("lower", &self.lower) - .field("min-lower", &self.min_lower) - .field("min-numeric", &self.min_numeric) - .field("min-special", &self.min_special) - .field("min-upper", &self.min_upper) - .field("number", &self.number) - .field("numeric", &self.numeric) - .field("override-special", &self.override_special) - .field("result", &self.result) - .field("special", &self.special) - .field("upper", &self.upper) - .finish() - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_invoke_cabi( - arg0: *mut u8, - arg1: usize, - arg2: i32, - arg3: i32, - arg4: i32, - arg5: i32, - arg6: i32, - arg7: i32, - arg8: i32, - arg9: i32, - arg10: i32, - arg11: i32, - arg12: i32, - arg13: i32, - ) -> *mut u8 { - let handle1; - let handle2; - let handle3; - let handle4; - let handle5; - let handle6; - let handle7; - let handle8; - let handle9; - let handle10; - let handle11; - let handle12; - let len0 = arg1; - let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); - let result13 = T::invoke( - _rt::string_lift(bytes0), - Args { - keepers: { - handle1 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg2 as u32); - &handle1 - }, - length: { - handle2 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg3 as u32); - &handle2 - }, - lower: { - handle3 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg4 as u32); - &handle3 - }, - min_lower: { - handle4 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg5 as u32); - &handle4 - }, - min_numeric: { - handle5 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg6 as u32); - &handle5 - }, - min_special: { - handle6 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg7 as u32); - &handle6 - }, - min_upper: { - handle7 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg8 as u32); - &handle7 - }, - number: { - handle8 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg9 as u32); - &handle8 - }, - numeric: { - handle9 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg10 as u32); - &handle9 - }, - override_special: { - handle10 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg11 as u32); - &handle10 - }, - special: { - handle11 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg12 as u32); - &handle11 - }, - upper: { - handle12 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg13 as u32); - &handle12 - }, - }, - ); - let ptr14 = _RET_AREA.0.as_mut_ptr().cast::(); - let Res { - bcrypt_hash: bcrypt_hash15, - keepers: keepers15, - length: length15, - lower: lower15, - min_lower: min_lower15, - min_numeric: min_numeric15, - min_special: min_special15, - min_upper: min_upper15, - number: number15, - numeric: numeric15, - override_special: override_special15, - result: result15, - special: special15, - upper: upper15, - } = result13; - *ptr14.add(0).cast::() = (bcrypt_hash15).take_handle() as i32; - *ptr14.add(4).cast::() = (keepers15).take_handle() as i32; - *ptr14.add(8).cast::() = (length15).take_handle() as i32; - *ptr14.add(12).cast::() = (lower15).take_handle() as i32; - *ptr14.add(16).cast::() = (min_lower15).take_handle() as i32; - *ptr14.add(20).cast::() = (min_numeric15).take_handle() as i32; - *ptr14.add(24).cast::() = (min_special15).take_handle() as i32; - *ptr14.add(28).cast::() = (min_upper15).take_handle() as i32; - *ptr14.add(32).cast::() = (number15).take_handle() as i32; - *ptr14.add(36).cast::() = (numeric15).take_handle() as i32; - *ptr14.add(40).cast::() = (override_special15).take_handle() as i32; - *ptr14.add(44).cast::() = (result15).take_handle() as i32; - *ptr14.add(48).cast::() = (special15).take_handle() as i32; - *ptr14.add(52).cast::() = (upper15).take_handle() as i32; - ptr14 - } - pub trait Guest { - fn invoke(name: _rt::String, args: Args<'_>) -> Res; - } - #[doc(hidden)] - - macro_rules! __export_pulumi_random_random_password_4_15_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "pulumi:random/random-password@4.15.0#invoke"] - unsafe extern "C" fn export_invoke(arg0: *mut u8,arg1: usize,arg2: i32,arg3: i32,arg4: i32,arg5: i32,arg6: i32,arg7: i32,arg8: i32,arg9: i32,arg10: i32,arg11: i32,arg12: i32,arg13: i32,) -> *mut u8 { - $($path_to_types)*::_export_invoke_cabi::<$ty>(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) - } - };); -} - #[doc(hidden)] - pub(crate) use __export_pulumi_random_random_password_4_15_0_cabi; - #[repr(align(4))] - struct _RetArea([::core::mem::MaybeUninit; 56]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 56]); - } - - #[allow(clippy::all)] - pub mod random_pet { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; - use super::super::super::super::_rt; - pub type Output = - super::super::super::super::component::pulumi_wasm::output_interface::Output; - pub struct Args<'a> { - pub keepers: &'a Output, - pub length: &'a Output, - pub prefix: &'a Output, - pub separator: &'a Output, - } - impl<'a> ::core::fmt::Debug for Args<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Args") - .field("keepers", &self.keepers) - .field("length", &self.length) - .field("prefix", &self.prefix) - .field("separator", &self.separator) - .finish() - } - } - pub struct Res { - pub keepers: Output, - pub length: Output, - pub prefix: Output, - pub separator: Output, - } - impl ::core::fmt::Debug for Res { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Res") - .field("keepers", &self.keepers) - .field("length", &self.length) - .field("prefix", &self.prefix) - .field("separator", &self.separator) - .finish() - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_invoke_cabi( - arg0: *mut u8, - arg1: usize, - arg2: i32, - arg3: i32, - arg4: i32, - arg5: i32, - ) -> *mut u8 { - let handle1; - let handle2; - let handle3; - let handle4; - let len0 = arg1; - let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); - let result5 = T::invoke( - _rt::string_lift(bytes0), - Args { - keepers: { - handle1 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg2 as u32); - &handle1 - }, - length: { - handle2 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg3 as u32); - &handle2 - }, - prefix: { - handle3 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg4 as u32); - &handle3 - }, - separator: { - handle4 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg5 as u32); - &handle4 - }, - }, - ); - let ptr6 = _RET_AREA.0.as_mut_ptr().cast::(); - let Res { - keepers: keepers7, - length: length7, - prefix: prefix7, - separator: separator7, - } = result5; - *ptr6.add(0).cast::() = (keepers7).take_handle() as i32; - *ptr6.add(4).cast::() = (length7).take_handle() as i32; - *ptr6.add(8).cast::() = (prefix7).take_handle() as i32; - *ptr6.add(12).cast::() = (separator7).take_handle() as i32; - ptr6 - } - pub trait Guest { - fn invoke(name: _rt::String, args: Args<'_>) -> Res; - } - #[doc(hidden)] - - macro_rules! __export_pulumi_random_random_pet_4_15_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "pulumi:random/random-pet@4.15.0#invoke"] - unsafe extern "C" fn export_invoke(arg0: *mut u8,arg1: usize,arg2: i32,arg3: i32,arg4: i32,arg5: i32,) -> *mut u8 { - $($path_to_types)*::_export_invoke_cabi::<$ty>(arg0, arg1, arg2, arg3, arg4, arg5) - } - };); -} - #[doc(hidden)] - pub(crate) use __export_pulumi_random_random_pet_4_15_0_cabi; - #[repr(align(4))] - struct _RetArea([::core::mem::MaybeUninit; 16]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 16]); - } - - #[allow(clippy::all)] - pub mod random_shuffle { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; - use super::super::super::super::_rt; - pub type Output = - super::super::super::super::component::pulumi_wasm::output_interface::Output; - pub struct Args<'a> { - pub inputs: &'a Output, - pub keepers: &'a Output, - pub result_count: &'a Output, - pub seed: &'a Output, - } - impl<'a> ::core::fmt::Debug for Args<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Args") - .field("inputs", &self.inputs) - .field("keepers", &self.keepers) - .field("result-count", &self.result_count) - .field("seed", &self.seed) - .finish() - } - } - pub struct Res { - pub inputs: Output, - pub keepers: Output, - pub result_count: Output, - pub results: Output, - pub seed: Output, - } - impl ::core::fmt::Debug for Res { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Res") - .field("inputs", &self.inputs) - .field("keepers", &self.keepers) - .field("result-count", &self.result_count) - .field("results", &self.results) - .field("seed", &self.seed) - .finish() - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_invoke_cabi( - arg0: *mut u8, - arg1: usize, - arg2: i32, - arg3: i32, - arg4: i32, - arg5: i32, - ) -> *mut u8 { - let handle1; - let handle2; - let handle3; - let handle4; - let len0 = arg1; - let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); - let result5 = T::invoke( - _rt::string_lift(bytes0), - Args { - inputs: { - handle1 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg2 as u32); - &handle1 - }, - keepers: { - handle2 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg3 as u32); - &handle2 - }, - result_count: { - handle3 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg4 as u32); - &handle3 - }, - seed: { - handle4 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg5 as u32); - &handle4 - }, - }, - ); - let ptr6 = _RET_AREA.0.as_mut_ptr().cast::(); - let Res { - inputs: inputs7, - keepers: keepers7, - result_count: result_count7, - results: results7, - seed: seed7, - } = result5; - *ptr6.add(0).cast::() = (inputs7).take_handle() as i32; - *ptr6.add(4).cast::() = (keepers7).take_handle() as i32; - *ptr6.add(8).cast::() = (result_count7).take_handle() as i32; - *ptr6.add(12).cast::() = (results7).take_handle() as i32; - *ptr6.add(16).cast::() = (seed7).take_handle() as i32; - ptr6 - } - pub trait Guest { - fn invoke(name: _rt::String, args: Args<'_>) -> Res; - } - #[doc(hidden)] - - macro_rules! __export_pulumi_random_random_shuffle_4_15_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "pulumi:random/random-shuffle@4.15.0#invoke"] - unsafe extern "C" fn export_invoke(arg0: *mut u8,arg1: usize,arg2: i32,arg3: i32,arg4: i32,arg5: i32,) -> *mut u8 { - $($path_to_types)*::_export_invoke_cabi::<$ty>(arg0, arg1, arg2, arg3, arg4, arg5) - } - };); -} - #[doc(hidden)] - pub(crate) use __export_pulumi_random_random_shuffle_4_15_0_cabi; - #[repr(align(4))] - struct _RetArea([::core::mem::MaybeUninit; 20]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 20]); - } - - #[allow(clippy::all)] - pub mod random_string { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; - use super::super::super::super::_rt; - pub type Output = - super::super::super::super::component::pulumi_wasm::output_interface::Output; - pub struct Args<'a> { - pub keepers: &'a Output, - pub length: &'a Output, - pub lower: &'a Output, - pub min_lower: &'a Output, - pub min_numeric: &'a Output, - pub min_special: &'a Output, - pub min_upper: &'a Output, - pub number: &'a Output, - pub numeric: &'a Output, - pub override_special: &'a Output, - pub special: &'a Output, - pub upper: &'a Output, - } - impl<'a> ::core::fmt::Debug for Args<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Args") - .field("keepers", &self.keepers) - .field("length", &self.length) - .field("lower", &self.lower) - .field("min-lower", &self.min_lower) - .field("min-numeric", &self.min_numeric) - .field("min-special", &self.min_special) - .field("min-upper", &self.min_upper) - .field("number", &self.number) - .field("numeric", &self.numeric) - .field("override-special", &self.override_special) - .field("special", &self.special) - .field("upper", &self.upper) - .finish() - } - } - pub struct Res { - pub keepers: Output, - pub length: Output, - pub lower: Output, - pub min_lower: Output, - pub min_numeric: Output, - pub min_special: Output, - pub min_upper: Output, - pub number: Output, - pub numeric: Output, - pub override_special: Output, - pub result: Output, - pub special: Output, - pub upper: Output, - } - impl ::core::fmt::Debug for Res { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Res") - .field("keepers", &self.keepers) - .field("length", &self.length) - .field("lower", &self.lower) - .field("min-lower", &self.min_lower) - .field("min-numeric", &self.min_numeric) - .field("min-special", &self.min_special) - .field("min-upper", &self.min_upper) - .field("number", &self.number) - .field("numeric", &self.numeric) - .field("override-special", &self.override_special) - .field("result", &self.result) - .field("special", &self.special) - .field("upper", &self.upper) - .finish() - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_invoke_cabi( - arg0: *mut u8, - arg1: usize, - arg2: i32, - arg3: i32, - arg4: i32, - arg5: i32, - arg6: i32, - arg7: i32, - arg8: i32, - arg9: i32, - arg10: i32, - arg11: i32, - arg12: i32, - arg13: i32, - ) -> *mut u8 { - let handle1; - let handle2; - let handle3; - let handle4; - let handle5; - let handle6; - let handle7; - let handle8; - let handle9; - let handle10; - let handle11; - let handle12; - let len0 = arg1; - let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); - let result13 = T::invoke( - _rt::string_lift(bytes0), - Args { - keepers: { - handle1 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg2 as u32); - &handle1 - }, - length: { - handle2 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg3 as u32); - &handle2 - }, - lower: { - handle3 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg4 as u32); - &handle3 - }, - min_lower: { - handle4 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg5 as u32); - &handle4 - }, - min_numeric: { - handle5 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg6 as u32); - &handle5 - }, - min_special: { - handle6 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg7 as u32); - &handle6 - }, - min_upper: { - handle7 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg8 as u32); - &handle7 - }, - number: { - handle8 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg9 as u32); - &handle8 - }, - numeric: { - handle9 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg10 as u32); - &handle9 - }, - override_special: { - handle10 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg11 as u32); - &handle10 - }, - special: { - handle11 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg12 as u32); - &handle11 - }, - upper: { - handle12 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg13 as u32); - &handle12 - }, - }, - ); - let ptr14 = _RET_AREA.0.as_mut_ptr().cast::(); - let Res { - keepers: keepers15, - length: length15, - lower: lower15, - min_lower: min_lower15, - min_numeric: min_numeric15, - min_special: min_special15, - min_upper: min_upper15, - number: number15, - numeric: numeric15, - override_special: override_special15, - result: result15, - special: special15, - upper: upper15, - } = result13; - *ptr14.add(0).cast::() = (keepers15).take_handle() as i32; - *ptr14.add(4).cast::() = (length15).take_handle() as i32; - *ptr14.add(8).cast::() = (lower15).take_handle() as i32; - *ptr14.add(12).cast::() = (min_lower15).take_handle() as i32; - *ptr14.add(16).cast::() = (min_numeric15).take_handle() as i32; - *ptr14.add(20).cast::() = (min_special15).take_handle() as i32; - *ptr14.add(24).cast::() = (min_upper15).take_handle() as i32; - *ptr14.add(28).cast::() = (number15).take_handle() as i32; - *ptr14.add(32).cast::() = (numeric15).take_handle() as i32; - *ptr14.add(36).cast::() = (override_special15).take_handle() as i32; - *ptr14.add(40).cast::() = (result15).take_handle() as i32; - *ptr14.add(44).cast::() = (special15).take_handle() as i32; - *ptr14.add(48).cast::() = (upper15).take_handle() as i32; - ptr14 - } - pub trait Guest { - fn invoke(name: _rt::String, args: Args<'_>) -> Res; - } - #[doc(hidden)] - - macro_rules! __export_pulumi_random_random_string_4_15_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "pulumi:random/random-string@4.15.0#invoke"] - unsafe extern "C" fn export_invoke(arg0: *mut u8,arg1: usize,arg2: i32,arg3: i32,arg4: i32,arg5: i32,arg6: i32,arg7: i32,arg8: i32,arg9: i32,arg10: i32,arg11: i32,arg12: i32,arg13: i32,) -> *mut u8 { - $($path_to_types)*::_export_invoke_cabi::<$ty>(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) - } - };); -} - #[doc(hidden)] - pub(crate) use __export_pulumi_random_random_string_4_15_0_cabi; - #[repr(align(4))] - struct _RetArea([::core::mem::MaybeUninit; 52]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 52]); - } - - #[allow(clippy::all)] - pub mod random_uuid { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; - use super::super::super::super::_rt; - pub type Output = - super::super::super::super::component::pulumi_wasm::output_interface::Output; - pub struct Args<'a> { - pub keepers: &'a Output, - } - impl<'a> ::core::fmt::Debug for Args<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Args") - .field("keepers", &self.keepers) - .finish() - } - } - pub struct Res { - pub keepers: Output, - pub result: Output, - } - impl ::core::fmt::Debug for Res { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Res") - .field("keepers", &self.keepers) - .field("result", &self.result) - .finish() - } - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_invoke_cabi( - arg0: *mut u8, - arg1: usize, - arg2: i32, - ) -> *mut u8 { - let handle1; - let len0 = arg1; - let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); - let result2 = T::invoke( - _rt::string_lift(bytes0), - Args { - keepers: { - handle1 = super::super::super::super::component::pulumi_wasm::output_interface::Output::from_handle(arg2 as u32); - &handle1 - }, - }, - ); - let ptr3 = _RET_AREA.0.as_mut_ptr().cast::(); - let Res { - keepers: keepers4, - result: result4, - } = result2; - *ptr3.add(0).cast::() = (keepers4).take_handle() as i32; - *ptr3.add(4).cast::() = (result4).take_handle() as i32; - ptr3 - } - pub trait Guest { - fn invoke(name: _rt::String, args: Args<'_>) -> Res; - } - #[doc(hidden)] - - macro_rules! __export_pulumi_random_random_uuid_4_15_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "pulumi:random/random-uuid@4.15.0#invoke"] - unsafe extern "C" fn export_invoke(arg0: *mut u8,arg1: usize,arg2: i32,) -> *mut u8 { - $($path_to_types)*::_export_invoke_cabi::<$ty>(arg0, arg1, arg2) - } - };); -} - #[doc(hidden)] - pub(crate) use __export_pulumi_random_random_uuid_4_15_0_cabi; - #[repr(align(4))] - struct _RetArea([::core::mem::MaybeUninit; 8]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 8]); - } - } - } -} -mod _rt { - - use core::fmt; - use core::marker; - use core::sync::atomic::{AtomicU32, Ordering::Relaxed}; - - /// A type which represents a component model resource, either imported or - /// exported into this component. - /// - /// This is a low-level wrapper which handles the lifetime of the resource - /// (namely this has a destructor). The `T` provided defines the component model - /// intrinsics that this wrapper uses. - /// - /// One of the chief purposes of this type is to provide `Deref` implementations - /// to access the underlying data when it is owned. - /// - /// This type is primarily used in generated code for exported and imported - /// resources. - #[repr(transparent)] - pub struct Resource { - // NB: This would ideally be `u32` but it is not. The fact that this has - // interior mutability is not exposed in the API of this type except for the - // `take_handle` method which is supposed to in theory be private. - // - // This represents, almost all the time, a valid handle value. When it's - // invalid it's stored as `u32::MAX`. - handle: AtomicU32, - _marker: marker::PhantomData, - } - - /// A trait which all wasm resources implement, namely providing the ability to - /// drop a resource. - /// - /// This generally is implemented by generated code, not user-facing code. - pub unsafe trait WasmResource { - /// Invokes the `[resource-drop]...` intrinsic. - unsafe fn drop(handle: u32); - } - - impl Resource { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - debug_assert!(handle != u32::MAX); - Self { - handle: AtomicU32::new(handle), - _marker: marker::PhantomData, - } - } - - /// Takes ownership of the handle owned by `resource`. - /// - /// Note that this ideally would be `into_handle` taking `Resource` by - /// ownership. The code generator does not enable that in all situations, - /// unfortunately, so this is provided instead. - /// - /// Also note that `take_handle` is in theory only ever called on values - /// owned by a generated function. For example a generated function might - /// take `Resource` as an argument but then call `take_handle` on a - /// reference to that argument. In that sense the dynamic nature of - /// `take_handle` should only be exposed internally to generated code, not - /// to user code. - #[doc(hidden)] - pub fn take_handle(resource: &Resource) -> u32 { - resource.handle.swap(u32::MAX, Relaxed) - } - - #[doc(hidden)] - pub fn handle(resource: &Resource) -> u32 { - resource.handle.load(Relaxed) - } - } - - impl fmt::Debug for Resource { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("Resource") - .field("handle", &self.handle) - .finish() - } - } - - impl Drop for Resource { - fn drop(&mut self) { - unsafe { - match self.handle.load(Relaxed) { - // If this handle was "taken" then don't do anything in the - // destructor. - u32::MAX => {} - - // ... but otherwise do actually destroy it with the imported - // component model intrinsic as defined through `T`. - other => T::drop(other), - } - } - } - } - pub use alloc_crate::string::String; - pub use alloc_crate::vec::Vec; - pub unsafe fn string_lift(bytes: Vec) -> String { - if cfg!(debug_assertions) { - String::from_utf8(bytes).unwrap() - } else { - String::from_utf8_unchecked(bytes) - } - } - pub unsafe fn bool_lift(val: u8) -> bool { - if cfg!(debug_assertions) { - match val { - 0 => false, - 1 => true, - _ => panic!("invalid bool discriminant"), - } - } else { - ::core::mem::transmute::(val) - } - } - pub unsafe fn invalid_enum_discriminant() -> T { - if cfg!(debug_assertions) { - panic!("invalid enum discriminant") - } else { - core::hint::unreachable_unchecked() - } - } - pub use alloc_crate::alloc; - extern crate alloc as alloc_crate; -} - -/// Generates `#[no_mangle]` functions to export the specified type as the -/// root implementation of all generated traits. -/// -/// For more information see the documentation of `wit_bindgen::generate!`. -/// -/// ```rust -/// # macro_rules! export{ ($($t:tt)*) => (); } -/// # trait Guest {} -/// struct MyType; -/// -/// impl Guest for MyType { -/// // ... -/// } -/// -/// export!(MyType); -/// ``` -#[allow(unused_macros)] -#[doc(hidden)] - -macro_rules! __export_main_world_impl { - ($ty:ident) => (self::export!($ty with_types_in self);); - ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( - $($path_to_types_root)*::exports::pulumi::random::random_bytes::__export_pulumi_random_random_bytes_4_15_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::pulumi::random::random_bytes); - $($path_to_types_root)*::exports::pulumi::random::random_id::__export_pulumi_random_random_id_4_15_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::pulumi::random::random_id); - $($path_to_types_root)*::exports::pulumi::random::random_integer::__export_pulumi_random_random_integer_4_15_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::pulumi::random::random_integer); - $($path_to_types_root)*::exports::pulumi::random::random_password::__export_pulumi_random_random_password_4_15_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::pulumi::random::random_password); - $($path_to_types_root)*::exports::pulumi::random::random_pet::__export_pulumi_random_random_pet_4_15_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::pulumi::random::random_pet); - $($path_to_types_root)*::exports::pulumi::random::random_shuffle::__export_pulumi_random_random_shuffle_4_15_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::pulumi::random::random_shuffle); - $($path_to_types_root)*::exports::pulumi::random::random_string::__export_pulumi_random_random_string_4_15_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::pulumi::random::random_string); - $($path_to_types_root)*::exports::pulumi::random::random_uuid::__export_pulumi_random_random_uuid_4_15_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::pulumi::random::random_uuid); - ) -} -#[doc(inline)] -pub(crate) use __export_main_world_impl as export; - -#[cfg(target_arch = "wasm32")] -#[link_section = "component-type:wit-bindgen:0.21.0:main-world:encoded world"] -#[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 2581] = *b"\ -\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\x94\x13\x01A\x02\x01\ -A\x15\x01B\x15\x04\0\x06output\x03\x01\x01p}\x01i\0\x01@\x01\x05value\x01\0\x02\x04\ -\0\x13[constructor]output\x01\x03\x01h\0\x01@\x02\x04self\x04\x0dfunction-names\0\ -\x02\x04\0\x12[method]output.map\x01\x05\x01k\x01\x01@\x01\x04self\x04\0\x06\x04\ -\0\x12[method]output.get\x01\x07\x01@\x02\x04self\x04\x05fields\0\x02\x04\0\x18[\ -method]output.get-field\x01\x08\x01@\x01\x04self\x04\0s\x04\0\x17[method]output.\ -get-type\x01\x09\x01@\x01\x04self\x04\0\x02\x04\0\x18[method]output.duplicate\x01\ -\x0a\x01@\0\0s\x04\0\x10describe-outputs\x01\x0b\x01@\0\0\x7f\x04\0\x0fnon-done-\ -exists\x01\x0c\x03\x01,component:pulumi-wasm/output-interface@0.1.0\x05\0\x02\x03\ -\0\0\x06output\x01B\x0b\x02\x03\x02\x01\x01\x04\0\x06output\x03\0\0\x01h\x01\x01\ -r\x02\x04names\x05value\x02\x04\0\x0cobject-field\x03\0\x03\x01p\x04\x01r\x03\x04\ -types\x04names\x06object\x05\x04\0\x19register-resource-request\x03\0\x06\x01i\x01\ -\x01@\x01\x07request\x07\0\x08\x04\0\x08register\x01\x09\x03\x01.component:pulum\ -i-wasm/register-interface@0.1.0\x05\x02\x01B\x0a\x02\x03\x02\x01\x01\x04\0\x06ou\ -tput\x03\0\0\x01h\x01\x01r\x02\x07keepers\x02\x06length\x02\x04\0\x04args\x03\0\x03\ -\x01i\x01\x01r\x04\x06base64\x05\x03hex\x05\x07keepers\x05\x06length\x05\x04\0\x03\ -res\x03\0\x06\x01@\x02\x04names\x04args\x04\0\x07\x04\0\x06invoke\x01\x08\x04\x01\ -!pulumi:random/random-bytes@4.15.0\x05\x03\x01B\x0a\x02\x03\x02\x01\x01\x04\0\x06\ -output\x03\0\0\x01h\x01\x01r\x03\x0bbyte-length\x02\x07keepers\x02\x06prefix\x02\ -\x04\0\x04args\x03\0\x03\x01i\x01\x01r\x07\x07b64-std\x05\x07b64-url\x05\x0bbyte\ --length\x05\x03dec\x05\x03hex\x05\x07keepers\x05\x06prefix\x05\x04\0\x03res\x03\0\ -\x06\x01@\x02\x04names\x04args\x04\0\x07\x04\0\x06invoke\x01\x08\x04\x01\x1epulu\ -mi:random/random-id@4.15.0\x05\x04\x01B\x0a\x02\x03\x02\x01\x01\x04\0\x06output\x03\ -\0\0\x01h\x01\x01r\x04\x07keepers\x02\x03max\x02\x03min\x02\x04seed\x02\x04\0\x04\ -args\x03\0\x03\x01i\x01\x01r\x05\x07keepers\x05\x03max\x05\x03min\x05\x06result\x05\ -\x04seed\x05\x04\0\x03res\x03\0\x06\x01@\x02\x04names\x04args\x04\0\x07\x04\0\x06\ -invoke\x01\x08\x04\x01#pulumi:random/random-integer@4.15.0\x05\x05\x01B\x0a\x02\x03\ -\x02\x01\x01\x04\0\x06output\x03\0\0\x01h\x01\x01r\x0c\x07keepers\x02\x06length\x02\ -\x05lower\x02\x09min-lower\x02\x0bmin-numeric\x02\x0bmin-special\x02\x09min-uppe\ -r\x02\x06number\x02\x07numeric\x02\x10override-special\x02\x07special\x02\x05upp\ -er\x02\x04\0\x04args\x03\0\x03\x01i\x01\x01r\x0e\x0bbcrypt-hash\x05\x07keepers\x05\ -\x06length\x05\x05lower\x05\x09min-lower\x05\x0bmin-numeric\x05\x0bmin-special\x05\ -\x09min-upper\x05\x06number\x05\x07numeric\x05\x10override-special\x05\x06result\ -\x05\x07special\x05\x05upper\x05\x04\0\x03res\x03\0\x06\x01@\x02\x04names\x04arg\ -s\x04\0\x07\x04\0\x06invoke\x01\x08\x04\x01$pulumi:random/random-password@4.15.0\ -\x05\x06\x01B\x0a\x02\x03\x02\x01\x01\x04\0\x06output\x03\0\0\x01h\x01\x01r\x04\x07\ -keepers\x02\x06length\x02\x06prefix\x02\x09separator\x02\x04\0\x04args\x03\0\x03\ -\x01i\x01\x01r\x04\x07keepers\x05\x06length\x05\x06prefix\x05\x09separator\x05\x04\ -\0\x03res\x03\0\x06\x01@\x02\x04names\x04args\x04\0\x07\x04\0\x06invoke\x01\x08\x04\ -\x01\x1fpulumi:random/random-pet@4.15.0\x05\x07\x01B\x0a\x02\x03\x02\x01\x01\x04\ -\0\x06output\x03\0\0\x01h\x01\x01r\x04\x06inputs\x02\x07keepers\x02\x0cresult-co\ -unt\x02\x04seed\x02\x04\0\x04args\x03\0\x03\x01i\x01\x01r\x05\x06inputs\x05\x07k\ -eepers\x05\x0cresult-count\x05\x07results\x05\x04seed\x05\x04\0\x03res\x03\0\x06\ -\x01@\x02\x04names\x04args\x04\0\x07\x04\0\x06invoke\x01\x08\x04\x01#pulumi:rand\ -om/random-shuffle@4.15.0\x05\x08\x01B\x0a\x02\x03\x02\x01\x01\x04\0\x06output\x03\ -\0\0\x01h\x01\x01r\x0c\x07keepers\x02\x06length\x02\x05lower\x02\x09min-lower\x02\ -\x0bmin-numeric\x02\x0bmin-special\x02\x09min-upper\x02\x06number\x02\x07numeric\ -\x02\x10override-special\x02\x07special\x02\x05upper\x02\x04\0\x04args\x03\0\x03\ -\x01i\x01\x01r\x0d\x07keepers\x05\x06length\x05\x05lower\x05\x09min-lower\x05\x0b\ -min-numeric\x05\x0bmin-special\x05\x09min-upper\x05\x06number\x05\x07numeric\x05\ -\x10override-special\x05\x06result\x05\x07special\x05\x05upper\x05\x04\0\x03res\x03\ -\0\x06\x01@\x02\x04names\x04args\x04\0\x07\x04\0\x06invoke\x01\x08\x04\x01\"pulu\ -mi:random/random-string@4.15.0\x05\x09\x01B\x0a\x02\x03\x02\x01\x01\x04\0\x06out\ -put\x03\0\0\x01h\x01\x01r\x01\x07keepers\x02\x04\0\x04args\x03\0\x03\x01i\x01\x01\ -r\x02\x07keepers\x05\x06result\x05\x04\0\x03res\x03\0\x06\x01@\x02\x04names\x04a\ -rgs\x04\0\x07\x04\0\x06invoke\x01\x08\x04\x01\x20pulumi:random/random-uuid@4.15.\ -0\x05\x0a\x04\x01\x1fpulumi:random/main-world@4.15.0\x04\0\x0b\x10\x01\0\x0amain\ --world\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.201\ -.0\x10wit-bindgen-rust\x060.21.0"; - -#[inline(never)] -#[doc(hidden)] -#[cfg(target_arch = "wasm32")] -pub fn __link_custom_section_describing_imports() { - wit_bindgen_rt::maybe_link_cabi_realloc(); -} diff --git a/providers/pulumi_wasm_provider_random/src/lib.rs b/providers/pulumi_wasm_provider_random/src/lib.rs index 15c025398..d9e2b3290 100644 --- a/providers/pulumi_wasm_provider_random/src/lib.rs +++ b/providers/pulumi_wasm_provider_random/src/lib.rs @@ -1,6 +1,4 @@ -use crate::bindings::component::pulumi_wasm::register_interface::{ - register, ObjectField, RegisterResourceRequest, -}; +use crate::bindings::component::pulumi_wasm::register_interface::{ObjectField, register, RegisterResourceRequest}; use bindings::exports::pulumi::random::random_bytes; use bindings::exports::pulumi::random::random_id; use bindings::exports::pulumi::random::random_integer; @@ -26,25 +24,20 @@ impl random_bytes::Guest for Component { type_: "random:index/randomBytes:RandomBytes".into(), name, object: vec![ - ObjectField { - name: "keepers".into(), - value: args.keepers, - }, - ObjectField { - name: "length".into(), - value: args.length, - }, + ObjectField { name: "keepers".into(), value: args.keepers }, + ObjectField { name: "length".into(), value: args.length }, ], }; let o = register(&request); random_bytes::Res { - base64: o.get_field("base64"), - hex: o.get_field("hex"), - keepers: o.get_field("keepers"), - length: o.get_field("length"), + base64: o.get_field("base64", true), + hex: o.get_field("hex", true), + keepers: o.get_field("keepers", false), + length: o.get_field("length", true), } + } } impl random_id::Guest for Component { @@ -54,32 +47,24 @@ impl random_id::Guest for Component { type_: "random:index/randomId:RandomId".into(), name, object: vec![ - ObjectField { - name: "byteLength".into(), - value: args.byte_length, - }, - ObjectField { - name: "keepers".into(), - value: args.keepers, - }, - ObjectField { - name: "prefix".into(), - value: args.prefix, - }, + ObjectField { name: "byteLength".into(), value: args.byte_length }, + ObjectField { name: "keepers".into(), value: args.keepers }, + ObjectField { name: "prefix".into(), value: args.prefix }, ], }; let o = register(&request); random_id::Res { - b64_std: o.get_field("b64Std"), - b64_url: o.get_field("b64Url"), - byte_length: o.get_field("byteLength"), - dec: o.get_field("dec"), - hex: o.get_field("hex"), - keepers: o.get_field("keepers"), - prefix: o.get_field("prefix"), + b64_std: o.get_field("b64Std", true), + b64_url: o.get_field("b64Url", true), + byte_length: o.get_field("byteLength", true), + dec: o.get_field("dec", true), + hex: o.get_field("hex", true), + keepers: o.get_field("keepers", false), + prefix: o.get_field("prefix", false), } + } } impl random_integer::Guest for Component { @@ -89,34 +74,23 @@ impl random_integer::Guest for Component { type_: "random:index/randomInteger:RandomInteger".into(), name, object: vec![ - ObjectField { - name: "keepers".into(), - value: args.keepers, - }, - ObjectField { - name: "max".into(), - value: args.max, - }, - ObjectField { - name: "min".into(), - value: args.min, - }, - ObjectField { - name: "seed".into(), - value: args.seed, - }, + ObjectField { name: "keepers".into(), value: args.keepers }, + ObjectField { name: "max".into(), value: args.max }, + ObjectField { name: "min".into(), value: args.min }, + ObjectField { name: "seed".into(), value: args.seed }, ], }; let o = register(&request); random_integer::Res { - keepers: o.get_field("keepers"), - max: o.get_field("max"), - min: o.get_field("min"), - result: o.get_field("result"), - seed: o.get_field("seed"), + keepers: o.get_field("keepers", false), + max: o.get_field("max", true), + min: o.get_field("min", true), + result: o.get_field("result", true), + seed: o.get_field("seed", false), } + } } impl random_password::Guest for Component { @@ -126,75 +100,40 @@ impl random_password::Guest for Component { type_: "random:index/randomPassword:RandomPassword".into(), name, object: vec![ - ObjectField { - name: "keepers".into(), - value: args.keepers, - }, - ObjectField { - name: "length".into(), - value: args.length, - }, - ObjectField { - name: "lower".into(), - value: args.lower, - }, - ObjectField { - name: "minLower".into(), - value: args.min_lower, - }, - ObjectField { - name: "minNumeric".into(), - value: args.min_numeric, - }, - ObjectField { - name: "minSpecial".into(), - value: args.min_special, - }, - ObjectField { - name: "minUpper".into(), - value: args.min_upper, - }, - ObjectField { - name: "number".into(), - value: args.number, - }, - ObjectField { - name: "numeric".into(), - value: args.numeric, - }, - ObjectField { - name: "overrideSpecial".into(), - value: args.override_special, - }, - ObjectField { - name: "special".into(), - value: args.special, - }, - ObjectField { - name: "upper".into(), - value: args.upper, - }, + ObjectField { name: "keepers".into(), value: args.keepers }, + ObjectField { name: "length".into(), value: args.length }, + ObjectField { name: "lower".into(), value: args.lower }, + ObjectField { name: "minLower".into(), value: args.min_lower }, + ObjectField { name: "minNumeric".into(), value: args.min_numeric }, + ObjectField { name: "minSpecial".into(), value: args.min_special }, + ObjectField { name: "minUpper".into(), value: args.min_upper }, + ObjectField { name: "number".into(), value: args.number }, + ObjectField { name: "numeric".into(), value: args.numeric }, + ObjectField { name: "overrideSpecial".into(), value: args.override_special }, + ObjectField { name: "special".into(), value: args.special }, + ObjectField { name: "upper".into(), value: args.upper }, ], }; let o = register(&request); random_password::Res { - bcrypt_hash: o.get_field("bcryptHash"), - keepers: o.get_field("keepers"), - length: o.get_field("length"), - lower: o.get_field("lower"), - min_lower: o.get_field("minLower"), - min_numeric: o.get_field("minNumeric"), - min_special: o.get_field("minSpecial"), - min_upper: o.get_field("minUpper"), - number: o.get_field("number"), - numeric: o.get_field("numeric"), - override_special: o.get_field("overrideSpecial"), - result: o.get_field("result"), - special: o.get_field("special"), - upper: o.get_field("upper"), + bcrypt_hash: o.get_field("bcryptHash", true), + keepers: o.get_field("keepers", false), + length: o.get_field("length", true), + lower: o.get_field("lower", true), + min_lower: o.get_field("minLower", true), + min_numeric: o.get_field("minNumeric", true), + min_special: o.get_field("minSpecial", true), + min_upper: o.get_field("minUpper", true), + number: o.get_field("number", true), + numeric: o.get_field("numeric", true), + override_special: o.get_field("overrideSpecial", false), + result: o.get_field("result", true), + special: o.get_field("special", true), + upper: o.get_field("upper", true), } + } } impl random_pet::Guest for Component { @@ -204,33 +143,22 @@ impl random_pet::Guest for Component { type_: "random:index/randomPet:RandomPet".into(), name, object: vec![ - ObjectField { - name: "keepers".into(), - value: args.keepers, - }, - ObjectField { - name: "length".into(), - value: args.length, - }, - ObjectField { - name: "prefix".into(), - value: args.prefix, - }, - ObjectField { - name: "separator".into(), - value: args.separator, - }, + ObjectField { name: "keepers".into(), value: args.keepers }, + ObjectField { name: "length".into(), value: args.length }, + ObjectField { name: "prefix".into(), value: args.prefix }, + ObjectField { name: "separator".into(), value: args.separator }, ], }; let o = register(&request); random_pet::Res { - keepers: o.get_field("keepers"), - length: o.get_field("length"), - prefix: o.get_field("prefix"), - separator: o.get_field("separator"), + keepers: o.get_field("keepers", false), + length: o.get_field("length", true), + prefix: o.get_field("prefix", false), + separator: o.get_field("separator", true), } + } } impl random_shuffle::Guest for Component { @@ -240,34 +168,23 @@ impl random_shuffle::Guest for Component { type_: "random:index/randomShuffle:RandomShuffle".into(), name, object: vec![ - ObjectField { - name: "inputs".into(), - value: args.inputs, - }, - ObjectField { - name: "keepers".into(), - value: args.keepers, - }, - ObjectField { - name: "resultCount".into(), - value: args.result_count, - }, - ObjectField { - name: "seed".into(), - value: args.seed, - }, + ObjectField { name: "inputs".into(), value: args.inputs }, + ObjectField { name: "keepers".into(), value: args.keepers }, + ObjectField { name: "resultCount".into(), value: args.result_count }, + ObjectField { name: "seed".into(), value: args.seed }, ], }; let o = register(&request); random_shuffle::Res { - inputs: o.get_field("inputs"), - keepers: o.get_field("keepers"), - result_count: o.get_field("resultCount"), - results: o.get_field("results"), - seed: o.get_field("seed"), + inputs: o.get_field("inputs", true), + keepers: o.get_field("keepers", false), + result_count: o.get_field("resultCount", false), + results: o.get_field("results", true), + seed: o.get_field("seed", false), } + } } impl random_string::Guest for Component { @@ -277,74 +194,39 @@ impl random_string::Guest for Component { type_: "random:index/randomString:RandomString".into(), name, object: vec![ - ObjectField { - name: "keepers".into(), - value: args.keepers, - }, - ObjectField { - name: "length".into(), - value: args.length, - }, - ObjectField { - name: "lower".into(), - value: args.lower, - }, - ObjectField { - name: "minLower".into(), - value: args.min_lower, - }, - ObjectField { - name: "minNumeric".into(), - value: args.min_numeric, - }, - ObjectField { - name: "minSpecial".into(), - value: args.min_special, - }, - ObjectField { - name: "minUpper".into(), - value: args.min_upper, - }, - ObjectField { - name: "number".into(), - value: args.number, - }, - ObjectField { - name: "numeric".into(), - value: args.numeric, - }, - ObjectField { - name: "overrideSpecial".into(), - value: args.override_special, - }, - ObjectField { - name: "special".into(), - value: args.special, - }, - ObjectField { - name: "upper".into(), - value: args.upper, - }, + ObjectField { name: "keepers".into(), value: args.keepers }, + ObjectField { name: "length".into(), value: args.length }, + ObjectField { name: "lower".into(), value: args.lower }, + ObjectField { name: "minLower".into(), value: args.min_lower }, + ObjectField { name: "minNumeric".into(), value: args.min_numeric }, + ObjectField { name: "minSpecial".into(), value: args.min_special }, + ObjectField { name: "minUpper".into(), value: args.min_upper }, + ObjectField { name: "number".into(), value: args.number }, + ObjectField { name: "numeric".into(), value: args.numeric }, + ObjectField { name: "overrideSpecial".into(), value: args.override_special }, + ObjectField { name: "special".into(), value: args.special }, + ObjectField { name: "upper".into(), value: args.upper }, ], }; let o = register(&request); random_string::Res { - keepers: o.get_field("keepers"), - length: o.get_field("length"), - lower: o.get_field("lower"), - min_lower: o.get_field("minLower"), - min_numeric: o.get_field("minNumeric"), - min_special: o.get_field("minSpecial"), - min_upper: o.get_field("minUpper"), - number: o.get_field("number"), - numeric: o.get_field("numeric"), - override_special: o.get_field("overrideSpecial"), - result: o.get_field("result"), - special: o.get_field("special"), - upper: o.get_field("upper"), + keepers: o.get_field("keepers", false), + length: o.get_field("length", true), + lower: o.get_field("lower", true), + min_lower: o.get_field("minLower", true), + min_numeric: o.get_field("minNumeric", true), + min_special: o.get_field("minSpecial", true), + min_upper: o.get_field("minUpper", true), + number: o.get_field("number", true), + numeric: o.get_field("numeric", true), + override_special: o.get_field("overrideSpecial", false), + result: o.get_field("result", true), + special: o.get_field("special", true), + upper: o.get_field("upper", true), } + } } impl random_uuid::Guest for Component { @@ -353,17 +235,17 @@ impl random_uuid::Guest for Component { let request = RegisterResourceRequest { type_: "random:index/randomUuid:RandomUuid".into(), name, - object: vec![ObjectField { - name: "keepers".into(), - value: args.keepers, - }], + object: vec![ + ObjectField { name: "keepers".into(), value: args.keepers }, + ], }; let o = register(&request); random_uuid::Res { - keepers: o.get_field("keepers"), - result: o.get_field("result"), + keepers: o.get_field("keepers", false), + result: o.get_field("result", true), } + } } diff --git a/providers/pulumi_wasm_provider_random/wit/deps/pulumi-wasm.wit b/providers/pulumi_wasm_provider_random/wit/deps/pulumi-wasm.wit index c5fabe8ce..1fe672b9d 100644 --- a/providers/pulumi_wasm_provider_random/wit/deps/pulumi-wasm.wit +++ b/providers/pulumi_wasm_provider_random/wit/deps/pulumi-wasm.wit @@ -9,7 +9,7 @@ interface output-interface { constructor(value: list); map: func(function-name: string) -> output; get: func() -> option>; - get-field: func(field: string) -> output; + get-field: func(field: string, required: bool) -> output; get-type: func() -> string; duplicate: func() -> output; } diff --git a/providers/pulumi_wasm_provider_random_rust/src/lib.rs b/providers/pulumi_wasm_provider_random_rust/src/lib.rs index 30c4e18c8..056f69585 100644 --- a/providers/pulumi_wasm_provider_random_rust/src/lib.rs +++ b/providers/pulumi_wasm_provider_random_rust/src/lib.rs @@ -1,5 +1,5 @@ -use crate::bindings::component::pulumi_wasm::output_interface::Output as WitOutput; use pulumi_wasm_rust::Output; +use crate::bindings::component::pulumi_wasm::output_interface::Output as WitOutput; pub mod source; #[allow(clippy::all)] @@ -26,4 +26,4 @@ fn clone(output: Output) -> WitOutput { let cloned = inner.duplicate(); WitOutput::from_handle(cloned.take_handle()) } -} +} \ No newline at end of file diff --git a/providers/pulumi_wasm_provider_random_rust/src/source.rs b/providers/pulumi_wasm_provider_random_rust/src/source.rs index 5a5ca2642..f007ad957 100644 --- a/providers/pulumi_wasm_provider_random_rust/src/source.rs +++ b/providers/pulumi_wasm_provider_random_rust/src/source.rs @@ -1,3 +1,4 @@ + pub mod random_bytes { pub struct RandomBytesArgs<'a> { @@ -7,34 +8,30 @@ pub mod random_bytes { } pub struct RandomBytesResult { - pub base64: pulumi_wasm_rust::Output>, - pub hex: pulumi_wasm_rust::Output>, + pub base64: pulumi_wasm_rust::Output, + pub hex: pulumi_wasm_rust::Output, pub keepers: pulumi_wasm_rust::Output>>, pub length: pulumi_wasm_rust::Output, } pub fn random_bytes(args: RandomBytesArgs) -> RandomBytesResult { - let result = crate::bindings::pulumi::random::random_bytes::invoke( - args.name, - &crate::bindings::pulumi::random::random_bytes::Args { - keepers: &crate::clone::>>( - args.keepers, - ), - length: &crate::clone::(args.length), - }, - ); + + let result = crate::bindings::pulumi::random::random_bytes::invoke(args.name, &crate::bindings::pulumi::random::random_bytes::Args { + keepers: &crate::clone::>>(args.keepers), + length: &crate::clone::(args.length), + }); RandomBytesResult { - base64: crate::random_to_domain_mapper::>(result.base64), - hex: crate::random_to_domain_mapper::>(result.hex), - keepers: crate::random_to_domain_mapper::< - Option>, - >(result.keepers), + base64: crate::random_to_domain_mapper::(result.base64), + hex: crate::random_to_domain_mapper::(result.hex), + keepers: crate::random_to_domain_mapper::>>(result.keepers), length: crate::random_to_domain_mapper::(result.length), } } + } + pub mod random_id { pub struct RandomIdArgs<'a> { @@ -45,41 +42,37 @@ pub mod random_id { } pub struct RandomIdResult { - pub b64_std: pulumi_wasm_rust::Output>, - pub b64_url: pulumi_wasm_rust::Output>, + pub b64_std: pulumi_wasm_rust::Output, + pub b64_url: pulumi_wasm_rust::Output, pub byte_length: pulumi_wasm_rust::Output, - pub dec: pulumi_wasm_rust::Output>, - pub hex: pulumi_wasm_rust::Output>, + pub dec: pulumi_wasm_rust::Output, + pub hex: pulumi_wasm_rust::Output, pub keepers: pulumi_wasm_rust::Output>>, pub prefix: pulumi_wasm_rust::Output>, } pub fn random_id(args: RandomIdArgs) -> RandomIdResult { - let result = crate::bindings::pulumi::random::random_id::invoke( - args.name, - &crate::bindings::pulumi::random::random_id::Args { - byte_length: &crate::clone::(args.byte_length), - keepers: &crate::clone::>>( - args.keepers, - ), - prefix: &crate::clone::>(args.prefix), - }, - ); + + let result = crate::bindings::pulumi::random::random_id::invoke(args.name, &crate::bindings::pulumi::random::random_id::Args { + byte_length: &crate::clone::(args.byte_length), + keepers: &crate::clone::>>(args.keepers), + prefix: &crate::clone::>(args.prefix), + }); RandomIdResult { - b64_std: crate::random_to_domain_mapper::>(result.b64_std), - b64_url: crate::random_to_domain_mapper::>(result.b64_url), + b64_std: crate::random_to_domain_mapper::(result.b64_std), + b64_url: crate::random_to_domain_mapper::(result.b64_url), byte_length: crate::random_to_domain_mapper::(result.byte_length), - dec: crate::random_to_domain_mapper::>(result.dec), - hex: crate::random_to_domain_mapper::>(result.hex), - keepers: crate::random_to_domain_mapper::< - Option>, - >(result.keepers), + dec: crate::random_to_domain_mapper::(result.dec), + hex: crate::random_to_domain_mapper::(result.hex), + keepers: crate::random_to_domain_mapper::>>(result.keepers), prefix: crate::random_to_domain_mapper::>(result.prefix), } } + } + pub mod random_integer { pub struct RandomIntegerArgs<'a> { @@ -94,35 +87,31 @@ pub mod random_integer { pub keepers: pulumi_wasm_rust::Output>>, pub max: pulumi_wasm_rust::Output, pub min: pulumi_wasm_rust::Output, - pub result: pulumi_wasm_rust::Output>, + pub result: pulumi_wasm_rust::Output, pub seed: pulumi_wasm_rust::Output>, } pub fn random_integer(args: RandomIntegerArgs) -> RandomIntegerResult { - let result = crate::bindings::pulumi::random::random_integer::invoke( - args.name, - &crate::bindings::pulumi::random::random_integer::Args { - keepers: &crate::clone::>>( - args.keepers, - ), - max: &crate::clone::(args.max), - min: &crate::clone::(args.min), - seed: &crate::clone::>(args.seed), - }, - ); + + let result = crate::bindings::pulumi::random::random_integer::invoke(args.name, &crate::bindings::pulumi::random::random_integer::Args { + keepers: &crate::clone::>>(args.keepers), + max: &crate::clone::(args.max), + min: &crate::clone::(args.min), + seed: &crate::clone::>(args.seed), + }); RandomIntegerResult { - keepers: crate::random_to_domain_mapper::< - Option>, - >(result.keepers), + keepers: crate::random_to_domain_mapper::>>(result.keepers), max: crate::random_to_domain_mapper::(result.max), min: crate::random_to_domain_mapper::(result.min), - result: crate::random_to_domain_mapper::>(result.result), + result: crate::random_to_domain_mapper::(result.result), seed: crate::random_to_domain_mapper::>(result.seed), } } + } + pub mod random_password { pub struct RandomPasswordArgs<'a> { @@ -142,66 +131,60 @@ pub mod random_password { } pub struct RandomPasswordResult { - pub bcrypt_hash: pulumi_wasm_rust::Output>, + pub bcrypt_hash: pulumi_wasm_rust::Output, pub keepers: pulumi_wasm_rust::Output>>, pub length: pulumi_wasm_rust::Output, - pub lower: pulumi_wasm_rust::Output>, - pub min_lower: pulumi_wasm_rust::Output>, - pub min_numeric: pulumi_wasm_rust::Output>, - pub min_special: pulumi_wasm_rust::Output>, - pub min_upper: pulumi_wasm_rust::Output>, - pub number: pulumi_wasm_rust::Output>, - pub numeric: pulumi_wasm_rust::Output>, + pub lower: pulumi_wasm_rust::Output, + pub min_lower: pulumi_wasm_rust::Output, + pub min_numeric: pulumi_wasm_rust::Output, + pub min_special: pulumi_wasm_rust::Output, + pub min_upper: pulumi_wasm_rust::Output, + pub number: pulumi_wasm_rust::Output, + pub numeric: pulumi_wasm_rust::Output, pub override_special: pulumi_wasm_rust::Output>, - pub result: pulumi_wasm_rust::Output>, - pub special: pulumi_wasm_rust::Output>, - pub upper: pulumi_wasm_rust::Output>, + pub result: pulumi_wasm_rust::Output, + pub special: pulumi_wasm_rust::Output, + pub upper: pulumi_wasm_rust::Output, } pub fn random_password(args: RandomPasswordArgs) -> RandomPasswordResult { - let result = crate::bindings::pulumi::random::random_password::invoke( - args.name, - &crate::bindings::pulumi::random::random_password::Args { - keepers: &crate::clone::>>( - args.keepers, - ), - length: &crate::clone::(args.length), - lower: &crate::clone::>(args.lower), - min_lower: &crate::clone::>(args.min_lower), - min_numeric: &crate::clone::>(args.min_numeric), - min_special: &crate::clone::>(args.min_special), - min_upper: &crate::clone::>(args.min_upper), - number: &crate::clone::>(args.number), - numeric: &crate::clone::>(args.numeric), - override_special: &crate::clone::>(args.override_special), - special: &crate::clone::>(args.special), - upper: &crate::clone::>(args.upper), - }, - ); + + let result = crate::bindings::pulumi::random::random_password::invoke(args.name, &crate::bindings::pulumi::random::random_password::Args { + keepers: &crate::clone::>>(args.keepers), + length: &crate::clone::(args.length), + lower: &crate::clone::>(args.lower), + min_lower: &crate::clone::>(args.min_lower), + min_numeric: &crate::clone::>(args.min_numeric), + min_special: &crate::clone::>(args.min_special), + min_upper: &crate::clone::>(args.min_upper), + number: &crate::clone::>(args.number), + numeric: &crate::clone::>(args.numeric), + override_special: &crate::clone::>(args.override_special), + special: &crate::clone::>(args.special), + upper: &crate::clone::>(args.upper), + }); RandomPasswordResult { - bcrypt_hash: crate::random_to_domain_mapper::>(result.bcrypt_hash), - keepers: crate::random_to_domain_mapper::< - Option>, - >(result.keepers), + bcrypt_hash: crate::random_to_domain_mapper::(result.bcrypt_hash), + keepers: crate::random_to_domain_mapper::>>(result.keepers), length: crate::random_to_domain_mapper::(result.length), - lower: crate::random_to_domain_mapper::>(result.lower), - min_lower: crate::random_to_domain_mapper::>(result.min_lower), - min_numeric: crate::random_to_domain_mapper::>(result.min_numeric), - min_special: crate::random_to_domain_mapper::>(result.min_special), - min_upper: crate::random_to_domain_mapper::>(result.min_upper), - number: crate::random_to_domain_mapper::>(result.number), - numeric: crate::random_to_domain_mapper::>(result.numeric), - override_special: crate::random_to_domain_mapper::>( - result.override_special, - ), - result: crate::random_to_domain_mapper::>(result.result), - special: crate::random_to_domain_mapper::>(result.special), - upper: crate::random_to_domain_mapper::>(result.upper), + lower: crate::random_to_domain_mapper::(result.lower), + min_lower: crate::random_to_domain_mapper::(result.min_lower), + min_numeric: crate::random_to_domain_mapper::(result.min_numeric), + min_special: crate::random_to_domain_mapper::(result.min_special), + min_upper: crate::random_to_domain_mapper::(result.min_upper), + number: crate::random_to_domain_mapper::(result.number), + numeric: crate::random_to_domain_mapper::(result.numeric), + override_special: crate::random_to_domain_mapper::>(result.override_special), + result: crate::random_to_domain_mapper::(result.result), + special: crate::random_to_domain_mapper::(result.special), + upper: crate::random_to_domain_mapper::(result.upper), } } + } + pub mod random_pet { pub struct RandomPetArgs<'a> { @@ -214,35 +197,31 @@ pub mod random_pet { pub struct RandomPetResult { pub keepers: pulumi_wasm_rust::Output>>, - pub length: pulumi_wasm_rust::Output>, + pub length: pulumi_wasm_rust::Output, pub prefix: pulumi_wasm_rust::Output>, - pub separator: pulumi_wasm_rust::Output>, + pub separator: pulumi_wasm_rust::Output, } pub fn random_pet(args: RandomPetArgs) -> RandomPetResult { - let result = crate::bindings::pulumi::random::random_pet::invoke( - args.name, - &crate::bindings::pulumi::random::random_pet::Args { - keepers: &crate::clone::>>( - args.keepers, - ), - length: &crate::clone::>(args.length), - prefix: &crate::clone::>(args.prefix), - separator: &crate::clone::>(args.separator), - }, - ); + + let result = crate::bindings::pulumi::random::random_pet::invoke(args.name, &crate::bindings::pulumi::random::random_pet::Args { + keepers: &crate::clone::>>(args.keepers), + length: &crate::clone::>(args.length), + prefix: &crate::clone::>(args.prefix), + separator: &crate::clone::>(args.separator), + }); RandomPetResult { - keepers: crate::random_to_domain_mapper::< - Option>, - >(result.keepers), - length: crate::random_to_domain_mapper::>(result.length), + keepers: crate::random_to_domain_mapper::>>(result.keepers), + length: crate::random_to_domain_mapper::(result.length), prefix: crate::random_to_domain_mapper::>(result.prefix), - separator: crate::random_to_domain_mapper::>(result.separator), + separator: crate::random_to_domain_mapper::(result.separator), } } + } + pub mod random_shuffle { pub struct RandomShuffleArgs<'a> { @@ -257,35 +236,31 @@ pub mod random_shuffle { pub inputs: pulumi_wasm_rust::Output>, pub keepers: pulumi_wasm_rust::Output>>, pub result_count: pulumi_wasm_rust::Output>, - pub results: pulumi_wasm_rust::Output>>, + pub results: pulumi_wasm_rust::Output>, pub seed: pulumi_wasm_rust::Output>, } pub fn random_shuffle(args: RandomShuffleArgs) -> RandomShuffleResult { - let result = crate::bindings::pulumi::random::random_shuffle::invoke( - args.name, - &crate::bindings::pulumi::random::random_shuffle::Args { - inputs: &crate::clone::>(args.inputs), - keepers: &crate::clone::>>( - args.keepers, - ), - result_count: &crate::clone::>(args.result_count), - seed: &crate::clone::>(args.seed), - }, - ); + + let result = crate::bindings::pulumi::random::random_shuffle::invoke(args.name, &crate::bindings::pulumi::random::random_shuffle::Args { + inputs: &crate::clone::>(args.inputs), + keepers: &crate::clone::>>(args.keepers), + result_count: &crate::clone::>(args.result_count), + seed: &crate::clone::>(args.seed), + }); RandomShuffleResult { inputs: crate::random_to_domain_mapper::>(result.inputs), - keepers: crate::random_to_domain_mapper::< - Option>, - >(result.keepers), + keepers: crate::random_to_domain_mapper::>>(result.keepers), result_count: crate::random_to_domain_mapper::>(result.result_count), - results: crate::random_to_domain_mapper::>>(result.results), + results: crate::random_to_domain_mapper::>(result.results), seed: crate::random_to_domain_mapper::>(result.seed), } } + } + pub mod random_string { pub struct RandomStringArgs<'a> { @@ -307,62 +282,56 @@ pub mod random_string { pub struct RandomStringResult { pub keepers: pulumi_wasm_rust::Output>>, pub length: pulumi_wasm_rust::Output, - pub lower: pulumi_wasm_rust::Output>, - pub min_lower: pulumi_wasm_rust::Output>, - pub min_numeric: pulumi_wasm_rust::Output>, - pub min_special: pulumi_wasm_rust::Output>, - pub min_upper: pulumi_wasm_rust::Output>, - pub number: pulumi_wasm_rust::Output>, - pub numeric: pulumi_wasm_rust::Output>, + pub lower: pulumi_wasm_rust::Output, + pub min_lower: pulumi_wasm_rust::Output, + pub min_numeric: pulumi_wasm_rust::Output, + pub min_special: pulumi_wasm_rust::Output, + pub min_upper: pulumi_wasm_rust::Output, + pub number: pulumi_wasm_rust::Output, + pub numeric: pulumi_wasm_rust::Output, pub override_special: pulumi_wasm_rust::Output>, - pub result: pulumi_wasm_rust::Output>, - pub special: pulumi_wasm_rust::Output>, - pub upper: pulumi_wasm_rust::Output>, + pub result: pulumi_wasm_rust::Output, + pub special: pulumi_wasm_rust::Output, + pub upper: pulumi_wasm_rust::Output, } pub fn random_string(args: RandomStringArgs) -> RandomStringResult { - let result = crate::bindings::pulumi::random::random_string::invoke( - args.name, - &crate::bindings::pulumi::random::random_string::Args { - keepers: &crate::clone::>>( - args.keepers, - ), - length: &crate::clone::(args.length), - lower: &crate::clone::>(args.lower), - min_lower: &crate::clone::>(args.min_lower), - min_numeric: &crate::clone::>(args.min_numeric), - min_special: &crate::clone::>(args.min_special), - min_upper: &crate::clone::>(args.min_upper), - number: &crate::clone::>(args.number), - numeric: &crate::clone::>(args.numeric), - override_special: &crate::clone::>(args.override_special), - special: &crate::clone::>(args.special), - upper: &crate::clone::>(args.upper), - }, - ); + + let result = crate::bindings::pulumi::random::random_string::invoke(args.name, &crate::bindings::pulumi::random::random_string::Args { + keepers: &crate::clone::>>(args.keepers), + length: &crate::clone::(args.length), + lower: &crate::clone::>(args.lower), + min_lower: &crate::clone::>(args.min_lower), + min_numeric: &crate::clone::>(args.min_numeric), + min_special: &crate::clone::>(args.min_special), + min_upper: &crate::clone::>(args.min_upper), + number: &crate::clone::>(args.number), + numeric: &crate::clone::>(args.numeric), + override_special: &crate::clone::>(args.override_special), + special: &crate::clone::>(args.special), + upper: &crate::clone::>(args.upper), + }); RandomStringResult { - keepers: crate::random_to_domain_mapper::< - Option>, - >(result.keepers), + keepers: crate::random_to_domain_mapper::>>(result.keepers), length: crate::random_to_domain_mapper::(result.length), - lower: crate::random_to_domain_mapper::>(result.lower), - min_lower: crate::random_to_domain_mapper::>(result.min_lower), - min_numeric: crate::random_to_domain_mapper::>(result.min_numeric), - min_special: crate::random_to_domain_mapper::>(result.min_special), - min_upper: crate::random_to_domain_mapper::>(result.min_upper), - number: crate::random_to_domain_mapper::>(result.number), - numeric: crate::random_to_domain_mapper::>(result.numeric), - override_special: crate::random_to_domain_mapper::>( - result.override_special, - ), - result: crate::random_to_domain_mapper::>(result.result), - special: crate::random_to_domain_mapper::>(result.special), - upper: crate::random_to_domain_mapper::>(result.upper), + lower: crate::random_to_domain_mapper::(result.lower), + min_lower: crate::random_to_domain_mapper::(result.min_lower), + min_numeric: crate::random_to_domain_mapper::(result.min_numeric), + min_special: crate::random_to_domain_mapper::(result.min_special), + min_upper: crate::random_to_domain_mapper::(result.min_upper), + number: crate::random_to_domain_mapper::(result.number), + numeric: crate::random_to_domain_mapper::(result.numeric), + override_special: crate::random_to_domain_mapper::>(result.override_special), + result: crate::random_to_domain_mapper::(result.result), + special: crate::random_to_domain_mapper::(result.special), + upper: crate::random_to_domain_mapper::(result.upper), } } + } + pub mod random_uuid { pub struct RandomUuidArgs<'a> { @@ -372,24 +341,20 @@ pub mod random_uuid { pub struct RandomUuidResult { pub keepers: pulumi_wasm_rust::Output>>, - pub result: pulumi_wasm_rust::Output>, + pub result: pulumi_wasm_rust::Output, } pub fn random_uuid(args: RandomUuidArgs) -> RandomUuidResult { - let result = crate::bindings::pulumi::random::random_uuid::invoke( - args.name, - &crate::bindings::pulumi::random::random_uuid::Args { - keepers: &crate::clone::>>( - args.keepers, - ), - }, - ); + + let result = crate::bindings::pulumi::random::random_uuid::invoke(args.name, &crate::bindings::pulumi::random::random_uuid::Args { + keepers: &crate::clone::>>(args.keepers), + }); RandomUuidResult { - keepers: crate::random_to_domain_mapper::< - Option>, - >(result.keepers), - result: crate::random_to_domain_mapper::>(result.result), + keepers: crate::random_to_domain_mapper::>>(result.keepers), + result: crate::random_to_domain_mapper::(result.result), } } + } + diff --git a/providers/pulumi_wasm_provider_random_rust/wit/deps/pulumi-wasm.wit b/providers/pulumi_wasm_provider_random_rust/wit/deps/pulumi-wasm.wit index c5fabe8ce..1fe672b9d 100644 --- a/providers/pulumi_wasm_provider_random_rust/wit/deps/pulumi-wasm.wit +++ b/providers/pulumi_wasm_provider_random_rust/wit/deps/pulumi-wasm.wit @@ -9,7 +9,7 @@ interface output-interface { constructor(value: list); map: func(function-name: string) -> output; get: func() -> option>; - get-field: func(field: string) -> output; + get-field: func(field: string, required: bool) -> output; get-type: func() -> string; duplicate: func() -> output; } diff --git a/pulumi_wasm/src/bindings.rs b/pulumi_wasm/src/bindings.rs index c17cfc59a..586aa763f 100644 --- a/pulumi_wasm/src/bindings.rs +++ b/pulumi_wasm/src/bindings.rs @@ -569,12 +569,14 @@ pub mod exports { arg0: i32, arg1: *mut u8, arg2: usize, + arg3: i32, ) -> i32 { let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let result1 = T::get_field( OutputBorrow::lift(arg0 as u32 as usize).get(), _rt::string_lift(bytes0), + _rt::bool_lift(arg3 as u8), ); (result1).take_handle() as i32 } @@ -659,7 +661,7 @@ pub mod exports { fn new(value: _rt::Vec) -> Self; fn map(&self, function_name: _rt::String) -> Output; fn get(&self) -> Option<_rt::Vec>; - fn get_field(&self, field: _rt::String) -> Output; + fn get_field(&self, field: _rt::String, required: bool) -> Output; fn get_type(&self) -> _rt::String; fn duplicate(&self) -> Output; } @@ -697,8 +699,8 @@ pub mod exports { $($path_to_types)*::__post_return_method_output_get::<<$ty as $($path_to_types)*::Guest>::Output>(arg0) } #[export_name = "component:pulumi-wasm/output-interface@0.1.0#[method]output.get-field"] - unsafe extern "C" fn export_method_output_get_field(arg0: i32,arg1: *mut u8,arg2: usize,) -> i32 { - $($path_to_types)*::_export_method_output_get_field_cabi::<<$ty as $($path_to_types)*::Guest>::Output>(arg0, arg1, arg2) + unsafe extern "C" fn export_method_output_get_field(arg0: i32,arg1: *mut u8,arg2: usize,arg3: i32,) -> i32 { + $($path_to_types)*::_export_method_output_get_field_cabi::<<$ty as $($path_to_types)*::Guest>::Output>(arg0, arg1, arg2, arg3) } #[export_name = "component:pulumi-wasm/output-interface@0.1.0#[method]output.get-type"] unsafe extern "C" fn export_method_output_get_type(arg0: i32,) -> *mut u8 { @@ -1268,8 +1270,8 @@ pub(crate) use __export_pulumi_wasm_impl as export; #[cfg(target_arch = "wasm32")] #[link_section = "component-type:wit-bindgen:0.21.0:pulumi-wasm:encoded world"] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1499] = *b"\ -\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xd9\x0a\x01A\x02\x01\ +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1509] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xe3\x0a\x01A\x02\x01\ A\x0d\x01B\x0a\x01m\x05\x05TRACE\x05DEBUG\x04INFO\x04WARN\x05ERROR\x04\0\x05leve\ l\x03\0\0\x01ks\x01ky\x01o\x02ss\x01p\x04\x01r\x07\x05level\x01\x06targets\x04ar\ gss\x0bmodule-path\x02\x04file\x02\x04line\x03\x0akey-values\x05\x04\0\x07conten\ @@ -1281,26 +1283,27 @@ ent:pulumi-wasm/log@0.1.0\x05\0\x01B\x08\x01@\0\0\x7f\x04\0\x0dis-in-preview\x01 \x03\x01\x01p}\x01i\0\x01@\x01\x05value\x01\0\x02\x04\0\x13[constructor]output\x01\ \x03\x01h\0\x01@\x02\x04self\x04\x0dfunction-names\0\x02\x04\0\x12[method]output\ .map\x01\x05\x01k\x01\x01@\x01\x04self\x04\0\x06\x04\0\x12[method]output.get\x01\ -\x07\x01@\x02\x04self\x04\x05fields\0\x02\x04\0\x18[method]output.get-field\x01\x08\ -\x01@\x01\x04self\x04\0s\x04\0\x17[method]output.get-type\x01\x09\x01@\x01\x04se\ -lf\x04\0\x02\x04\0\x18[method]output.duplicate\x01\x0a\x01@\0\0s\x04\0\x10descri\ -be-outputs\x01\x0b\x01@\0\0\x7f\x04\0\x0fnon-done-exists\x01\x0c\x04\x01,compone\ -nt:pulumi-wasm/output-interface@0.1.0\x05\x02\x02\x03\0\x02\x06output\x01B\x0b\x02\ -\x03\x02\x01\x03\x04\0\x06output\x03\0\0\x01h\x01\x01r\x02\x04names\x05value\x02\ -\x04\0\x0cobject-field\x03\0\x03\x01p\x04\x01r\x03\x04types\x04names\x06object\x05\ -\x04\0\x19register-resource-request\x03\0\x06\x01i\x01\x01@\x01\x07request\x07\0\ -\x08\x04\0\x08register\x01\x09\x04\x01.component:pulumi-wasm/register-interface@\ -0.1.0\x05\x04\x01B\x0f\x02\x03\x02\x01\x03\x04\0\x06output\x03\0\0\x01i\x01\x01p\ -}\x01r\x03\x02id\x02\x0bfunction-ids\x05value\x03\x04\0\x1bfunction-invocation-r\ -equest\x03\0\x04\x01h\x01\x01r\x02\x02id\x06\x05value\x03\x04\0\x1afunction-invo\ -cation-result\x03\0\x07\x01p\x05\x01@\x01\x06sources\0\x09\x04\0\x0dget-function\ -s\x01\x0a\x01p\x08\x01@\x01\x07results\x0b\x01\0\x04\0\x0dset-functions\x01\x0c\x04\ -\x015component:pulumi-wasm/function-reverse-callback@0.1.0\x05\x05\x01B\x07\x02\x03\ -\x02\x01\x03\x04\0\x06output\x03\0\0\x01h\x01\x01@\x02\x04names\x05value\x02\x01\ -\0\x04\0\x0aadd-export\x01\x03\x01@\0\0\x7f\x04\0\x06finish\x01\x04\x04\x01+comp\ -onent:pulumi-wasm/stack-interface@0.1.0\x05\x06\x04\x01'component:pulumi-wasm/pu\ -lumi-wasm@0.1.0\x04\0\x0b\x11\x01\0\x0bpulumi-wasm\x03\0\0\0G\x09producers\x01\x0c\ -processed-by\x02\x0dwit-component\x070.201.0\x10wit-bindgen-rust\x060.21.0"; +\x07\x01@\x03\x04self\x04\x05fields\x08required\x7f\0\x02\x04\0\x18[method]outpu\ +t.get-field\x01\x08\x01@\x01\x04self\x04\0s\x04\0\x17[method]output.get-type\x01\ +\x09\x01@\x01\x04self\x04\0\x02\x04\0\x18[method]output.duplicate\x01\x0a\x01@\0\ +\0s\x04\0\x10describe-outputs\x01\x0b\x01@\0\0\x7f\x04\0\x0fnon-done-exists\x01\x0c\ +\x04\x01,component:pulumi-wasm/output-interface@0.1.0\x05\x02\x02\x03\0\x02\x06o\ +utput\x01B\x0b\x02\x03\x02\x01\x03\x04\0\x06output\x03\0\0\x01h\x01\x01r\x02\x04\ +names\x05value\x02\x04\0\x0cobject-field\x03\0\x03\x01p\x04\x01r\x03\x04types\x04\ +names\x06object\x05\x04\0\x19register-resource-request\x03\0\x06\x01i\x01\x01@\x01\ +\x07request\x07\0\x08\x04\0\x08register\x01\x09\x04\x01.component:pulumi-wasm/re\ +gister-interface@0.1.0\x05\x04\x01B\x0f\x02\x03\x02\x01\x03\x04\0\x06output\x03\0\ +\0\x01i\x01\x01p}\x01r\x03\x02id\x02\x0bfunction-ids\x05value\x03\x04\0\x1bfunct\ +ion-invocation-request\x03\0\x04\x01h\x01\x01r\x02\x02id\x06\x05value\x03\x04\0\x1a\ +function-invocation-result\x03\0\x07\x01p\x05\x01@\x01\x06sources\0\x09\x04\0\x0d\ +get-functions\x01\x0a\x01p\x08\x01@\x01\x07results\x0b\x01\0\x04\0\x0dset-functi\ +ons\x01\x0c\x04\x015component:pulumi-wasm/function-reverse-callback@0.1.0\x05\x05\ +\x01B\x07\x02\x03\x02\x01\x03\x04\0\x06output\x03\0\0\x01h\x01\x01@\x02\x04names\ +\x05value\x02\x01\0\x04\0\x0aadd-export\x01\x03\x01@\0\0\x7f\x04\0\x06finish\x01\ +\x04\x04\x01+component:pulumi-wasm/stack-interface@0.1.0\x05\x06\x04\x01'compone\ +nt:pulumi-wasm/pulumi-wasm@0.1.0\x04\0\x0b\x11\x01\0\x0bpulumi-wasm\x03\0\0\0G\x09\ +producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.201.0\x10wit-bindgen-rus\ +t\x060.21.0"; #[inline(never)] #[doc(hidden)] diff --git a/pulumi_wasm/src/finalizer.rs b/pulumi_wasm/src/finalizer.rs index 84a742529..f4b3854b0 100644 --- a/pulumi_wasm/src/finalizer.rs +++ b/pulumi_wasm/src/finalizer.rs @@ -51,7 +51,7 @@ fn invoke_exporting_if_needed() { }; info!("Request: [{request:?}]"); external_world::register_resource_outputs(request.encode_to_vec().as_slice()); - Value::Nil + None }, ); } @@ -101,7 +101,10 @@ fn combine_outputs() -> bool { None => {} Some(i) => { changed = true; - o.replace(OutputContent::Done(i)); + match i { + None => o.replace(OutputContent::Nothing), + Some(i) => o.replace(OutputContent::Done(i)), + }; } }; }); diff --git a/pulumi_wasm/src/lib.rs b/pulumi_wasm/src/lib.rs index df85bc2db..703a1d2b1 100644 --- a/pulumi_wasm/src/lib.rs +++ b/pulumi_wasm/src/lib.rs @@ -1,3 +1,4 @@ +use crate::bindings::component::pulumi_wasm::external_world::is_in_preview; use crate::bindings::exports::component::pulumi_wasm::function_reverse_callback::{ FunctionInvocationRequest, FunctionInvocationResult, }; @@ -136,7 +137,7 @@ impl GuestOutput for Output { } } - fn get_field(&self, field: String) -> WasmOutput { + fn get_field(&self, field: String, required: bool) -> WasmOutput { wasm_common::setup_logger(); info!("Getting field [{field}] from Output [TODO]"); @@ -150,30 +151,22 @@ impl GuestOutput for Output { let key = Value::String(Utf8String::from(field.clone())); let maybe_value = m.iter().find(|(k, _)| k == &key).map(|(_, v)| v.clone()); //.unwrap_or(Value::Nil) match maybe_value { - None => { - // TODO: Implement - Value::Nil - // if is_in_preview() { - // Value::Nil - // } else { - // todo!() - // } + None if is_in_preview() => None, + None if required => { + error!("Field [{field}] not found in map [{m:?}]"); + unreachable!("Field [{field}] not found in map [{m:?}]") } - Some(v) => v, + None => Some(Value::Nil), + Some(v) => Some(v), } } - Value::Nil => todo!(), - Value::Boolean(_) => todo!(), - Value::Integer(_) => todo!(), - Value::F32(_) => todo!(), - Value::F64(_) => todo!(), - Value::String(_) => todo!(), - Value::Binary(_) => todo!(), - Value::Array(_) => todo!(), - Value::Ext(_, _) => todo!(), + v => { + error!("Value is not a map [{v}]"); + unreachable!("Value is not a map [{v}]") + } }; - info!("Result is [{v}]"); + info!("Result is [{v:?}]"); v }); @@ -395,7 +388,7 @@ impl register_interface::Guest for Component { info!("Message pack map: [{result:?}]"); - result + Some(result) }); WasmOutput::new(Output { diff --git a/pulumi_wasm/src/output.rs b/pulumi_wasm/src/output.rs index 43bdafe2e..6c5bcdc8d 100644 --- a/pulumi_wasm/src/output.rs +++ b/pulumi_wasm/src/output.rs @@ -70,7 +70,10 @@ pub(crate) fn output_map() -> &'static mut HashMap { pub(crate) enum OutputContent { Done(Value), Mapped(FunctionId, FunctionSource, OutputContentRefCell), - Func(Vec, Box) -> Value>), + Func( + Vec, + Box) -> Option>, + ), Nothing, } @@ -110,7 +113,7 @@ pub(crate) fn map_internal( f: F, ) -> Rc> where - F: Fn(Vec) -> Value + 'static, + F: Fn(Vec) -> Option + 'static, { create_wrapper(OutputContent::Func(ref_cell, Box::new(f))) } diff --git a/pulumi_wasm_generator/src/output/provider/lib.rs.handlebars b/pulumi_wasm_generator/src/output/provider/lib.rs.handlebars index b16361749..da68bbc88 100644 --- a/pulumi_wasm_generator/src/output/provider/lib.rs.handlebars +++ b/pulumi_wasm_generator/src/output/provider/lib.rs.handlebars @@ -30,7 +30,7 @@ impl {{name}}::Guest for Component { {{name}}::Res { {{#each output_properties}} - {{arg_name}}: o.get_field("{{name}}"), + {{arg_name}}: o.get_field("{{name}}", {{required}}), {{/each}} } diff --git a/pulumi_wasm_generator/src/output/provider/source_code.rs b/pulumi_wasm_generator/src/output/provider/source_code.rs index 7e9d65987..54fb8a478 100644 --- a/pulumi_wasm_generator/src/output/provider/source_code.rs +++ b/pulumi_wasm_generator/src/output/provider/source_code.rs @@ -17,6 +17,7 @@ struct InputProperty { struct OutputProperty { name: String, arg_name: String, + required: bool, } #[derive(Serialize)] @@ -56,6 +57,10 @@ fn convert_model(package: &crate::model::Package) -> Package { .map(|output_property| OutputProperty { name: output_property.name.clone(), arg_name: create_valid_id(&output_property.name), + required: match output_property.r#type { + crate::model::Type::Option(_) => false, + _ => true, + }, }) .collect(), }) diff --git a/pulumi_wasm_generator/src/output/wit/dependencies.wit b/pulumi_wasm_generator/src/output/wit/dependencies.wit index c5fabe8ce..1fe672b9d 100644 --- a/pulumi_wasm_generator/src/output/wit/dependencies.wit +++ b/pulumi_wasm_generator/src/output/wit/dependencies.wit @@ -9,7 +9,7 @@ interface output-interface { constructor(value: list); map: func(function-name: string) -> output; get: func() -> option>; - get-field: func(field: string) -> output; + get-field: func(field: string, required: bool) -> output; get-type: func() -> string; duplicate: func() -> output; } diff --git a/pulumi_wasm_generator/src/schema.rs b/pulumi_wasm_generator/src/schema.rs index e3b2f016c..de5685de5 100644 --- a/pulumi_wasm_generator/src/schema.rs +++ b/pulumi_wasm_generator/src/schema.rs @@ -57,6 +57,8 @@ struct Resource { input_properties: PulumiMap, #[serde(default, rename = "requiredInputs")] required_inputs: BTreeSet, + #[serde(default)] + required: BTreeSet, } #[derive(Deserialize, Debug)] @@ -169,7 +171,7 @@ fn resource_to_model( .map(|(output_name, output_property)| { let mut type_ = new_type_mapper(&output_property.r#type) .context(format!("Cannot handle [{output_name}] type"))?; - if !resource.required_inputs.contains(output_name) { + if !resource.required.contains(output_name) { type_ = crate::model::Type::Option(Box::new(type_)); } Ok(crate::model::OutputProperty { diff --git a/pulumi_wasm_generator/tests/output/random_provider/lib/src/source.rs b/pulumi_wasm_generator/tests/output/random_provider/lib/src/source.rs index 4bb4495a4..f007ad957 100644 --- a/pulumi_wasm_generator/tests/output/random_provider/lib/src/source.rs +++ b/pulumi_wasm_generator/tests/output/random_provider/lib/src/source.rs @@ -8,8 +8,8 @@ pub mod random_bytes { } pub struct RandomBytesResult { - pub base64: pulumi_wasm_rust::Output>, - pub hex: pulumi_wasm_rust::Output>, + pub base64: pulumi_wasm_rust::Output, + pub hex: pulumi_wasm_rust::Output, pub keepers: pulumi_wasm_rust::Output>>, pub length: pulumi_wasm_rust::Output, } @@ -22,8 +22,8 @@ pub mod random_bytes { }); RandomBytesResult { - base64: crate::random_to_domain_mapper::>(result.base64), - hex: crate::random_to_domain_mapper::>(result.hex), + base64: crate::random_to_domain_mapper::(result.base64), + hex: crate::random_to_domain_mapper::(result.hex), keepers: crate::random_to_domain_mapper::>>(result.keepers), length: crate::random_to_domain_mapper::(result.length), } @@ -42,11 +42,11 @@ pub mod random_id { } pub struct RandomIdResult { - pub b64_std: pulumi_wasm_rust::Output>, - pub b64_url: pulumi_wasm_rust::Output>, + pub b64_std: pulumi_wasm_rust::Output, + pub b64_url: pulumi_wasm_rust::Output, pub byte_length: pulumi_wasm_rust::Output, - pub dec: pulumi_wasm_rust::Output>, - pub hex: pulumi_wasm_rust::Output>, + pub dec: pulumi_wasm_rust::Output, + pub hex: pulumi_wasm_rust::Output, pub keepers: pulumi_wasm_rust::Output>>, pub prefix: pulumi_wasm_rust::Output>, } @@ -60,11 +60,11 @@ pub mod random_id { }); RandomIdResult { - b64_std: crate::random_to_domain_mapper::>(result.b64_std), - b64_url: crate::random_to_domain_mapper::>(result.b64_url), + b64_std: crate::random_to_domain_mapper::(result.b64_std), + b64_url: crate::random_to_domain_mapper::(result.b64_url), byte_length: crate::random_to_domain_mapper::(result.byte_length), - dec: crate::random_to_domain_mapper::>(result.dec), - hex: crate::random_to_domain_mapper::>(result.hex), + dec: crate::random_to_domain_mapper::(result.dec), + hex: crate::random_to_domain_mapper::(result.hex), keepers: crate::random_to_domain_mapper::>>(result.keepers), prefix: crate::random_to_domain_mapper::>(result.prefix), } @@ -87,7 +87,7 @@ pub mod random_integer { pub keepers: pulumi_wasm_rust::Output>>, pub max: pulumi_wasm_rust::Output, pub min: pulumi_wasm_rust::Output, - pub result: pulumi_wasm_rust::Output>, + pub result: pulumi_wasm_rust::Output, pub seed: pulumi_wasm_rust::Output>, } @@ -104,7 +104,7 @@ pub mod random_integer { keepers: crate::random_to_domain_mapper::>>(result.keepers), max: crate::random_to_domain_mapper::(result.max), min: crate::random_to_domain_mapper::(result.min), - result: crate::random_to_domain_mapper::>(result.result), + result: crate::random_to_domain_mapper::(result.result), seed: crate::random_to_domain_mapper::>(result.seed), } } @@ -131,20 +131,20 @@ pub mod random_password { } pub struct RandomPasswordResult { - pub bcrypt_hash: pulumi_wasm_rust::Output>, + pub bcrypt_hash: pulumi_wasm_rust::Output, pub keepers: pulumi_wasm_rust::Output>>, pub length: pulumi_wasm_rust::Output, - pub lower: pulumi_wasm_rust::Output>, - pub min_lower: pulumi_wasm_rust::Output>, - pub min_numeric: pulumi_wasm_rust::Output>, - pub min_special: pulumi_wasm_rust::Output>, - pub min_upper: pulumi_wasm_rust::Output>, - pub number: pulumi_wasm_rust::Output>, - pub numeric: pulumi_wasm_rust::Output>, + pub lower: pulumi_wasm_rust::Output, + pub min_lower: pulumi_wasm_rust::Output, + pub min_numeric: pulumi_wasm_rust::Output, + pub min_special: pulumi_wasm_rust::Output, + pub min_upper: pulumi_wasm_rust::Output, + pub number: pulumi_wasm_rust::Output, + pub numeric: pulumi_wasm_rust::Output, pub override_special: pulumi_wasm_rust::Output>, - pub result: pulumi_wasm_rust::Output>, - pub special: pulumi_wasm_rust::Output>, - pub upper: pulumi_wasm_rust::Output>, + pub result: pulumi_wasm_rust::Output, + pub special: pulumi_wasm_rust::Output, + pub upper: pulumi_wasm_rust::Output, } pub fn random_password(args: RandomPasswordArgs) -> RandomPasswordResult { @@ -165,20 +165,20 @@ pub mod random_password { }); RandomPasswordResult { - bcrypt_hash: crate::random_to_domain_mapper::>(result.bcrypt_hash), + bcrypt_hash: crate::random_to_domain_mapper::(result.bcrypt_hash), keepers: crate::random_to_domain_mapper::>>(result.keepers), length: crate::random_to_domain_mapper::(result.length), - lower: crate::random_to_domain_mapper::>(result.lower), - min_lower: crate::random_to_domain_mapper::>(result.min_lower), - min_numeric: crate::random_to_domain_mapper::>(result.min_numeric), - min_special: crate::random_to_domain_mapper::>(result.min_special), - min_upper: crate::random_to_domain_mapper::>(result.min_upper), - number: crate::random_to_domain_mapper::>(result.number), - numeric: crate::random_to_domain_mapper::>(result.numeric), + lower: crate::random_to_domain_mapper::(result.lower), + min_lower: crate::random_to_domain_mapper::(result.min_lower), + min_numeric: crate::random_to_domain_mapper::(result.min_numeric), + min_special: crate::random_to_domain_mapper::(result.min_special), + min_upper: crate::random_to_domain_mapper::(result.min_upper), + number: crate::random_to_domain_mapper::(result.number), + numeric: crate::random_to_domain_mapper::(result.numeric), override_special: crate::random_to_domain_mapper::>(result.override_special), - result: crate::random_to_domain_mapper::>(result.result), - special: crate::random_to_domain_mapper::>(result.special), - upper: crate::random_to_domain_mapper::>(result.upper), + result: crate::random_to_domain_mapper::(result.result), + special: crate::random_to_domain_mapper::(result.special), + upper: crate::random_to_domain_mapper::(result.upper), } } @@ -197,9 +197,9 @@ pub mod random_pet { pub struct RandomPetResult { pub keepers: pulumi_wasm_rust::Output>>, - pub length: pulumi_wasm_rust::Output>, + pub length: pulumi_wasm_rust::Output, pub prefix: pulumi_wasm_rust::Output>, - pub separator: pulumi_wasm_rust::Output>, + pub separator: pulumi_wasm_rust::Output, } pub fn random_pet(args: RandomPetArgs) -> RandomPetResult { @@ -213,9 +213,9 @@ pub mod random_pet { RandomPetResult { keepers: crate::random_to_domain_mapper::>>(result.keepers), - length: crate::random_to_domain_mapper::>(result.length), + length: crate::random_to_domain_mapper::(result.length), prefix: crate::random_to_domain_mapper::>(result.prefix), - separator: crate::random_to_domain_mapper::>(result.separator), + separator: crate::random_to_domain_mapper::(result.separator), } } @@ -236,7 +236,7 @@ pub mod random_shuffle { pub inputs: pulumi_wasm_rust::Output>, pub keepers: pulumi_wasm_rust::Output>>, pub result_count: pulumi_wasm_rust::Output>, - pub results: pulumi_wasm_rust::Output>>, + pub results: pulumi_wasm_rust::Output>, pub seed: pulumi_wasm_rust::Output>, } @@ -253,7 +253,7 @@ pub mod random_shuffle { inputs: crate::random_to_domain_mapper::>(result.inputs), keepers: crate::random_to_domain_mapper::>>(result.keepers), result_count: crate::random_to_domain_mapper::>(result.result_count), - results: crate::random_to_domain_mapper::>>(result.results), + results: crate::random_to_domain_mapper::>(result.results), seed: crate::random_to_domain_mapper::>(result.seed), } } @@ -282,17 +282,17 @@ pub mod random_string { pub struct RandomStringResult { pub keepers: pulumi_wasm_rust::Output>>, pub length: pulumi_wasm_rust::Output, - pub lower: pulumi_wasm_rust::Output>, - pub min_lower: pulumi_wasm_rust::Output>, - pub min_numeric: pulumi_wasm_rust::Output>, - pub min_special: pulumi_wasm_rust::Output>, - pub min_upper: pulumi_wasm_rust::Output>, - pub number: pulumi_wasm_rust::Output>, - pub numeric: pulumi_wasm_rust::Output>, + pub lower: pulumi_wasm_rust::Output, + pub min_lower: pulumi_wasm_rust::Output, + pub min_numeric: pulumi_wasm_rust::Output, + pub min_special: pulumi_wasm_rust::Output, + pub min_upper: pulumi_wasm_rust::Output, + pub number: pulumi_wasm_rust::Output, + pub numeric: pulumi_wasm_rust::Output, pub override_special: pulumi_wasm_rust::Output>, - pub result: pulumi_wasm_rust::Output>, - pub special: pulumi_wasm_rust::Output>, - pub upper: pulumi_wasm_rust::Output>, + pub result: pulumi_wasm_rust::Output, + pub special: pulumi_wasm_rust::Output, + pub upper: pulumi_wasm_rust::Output, } pub fn random_string(args: RandomStringArgs) -> RandomStringResult { @@ -315,17 +315,17 @@ pub mod random_string { RandomStringResult { keepers: crate::random_to_domain_mapper::>>(result.keepers), length: crate::random_to_domain_mapper::(result.length), - lower: crate::random_to_domain_mapper::>(result.lower), - min_lower: crate::random_to_domain_mapper::>(result.min_lower), - min_numeric: crate::random_to_domain_mapper::>(result.min_numeric), - min_special: crate::random_to_domain_mapper::>(result.min_special), - min_upper: crate::random_to_domain_mapper::>(result.min_upper), - number: crate::random_to_domain_mapper::>(result.number), - numeric: crate::random_to_domain_mapper::>(result.numeric), + lower: crate::random_to_domain_mapper::(result.lower), + min_lower: crate::random_to_domain_mapper::(result.min_lower), + min_numeric: crate::random_to_domain_mapper::(result.min_numeric), + min_special: crate::random_to_domain_mapper::(result.min_special), + min_upper: crate::random_to_domain_mapper::(result.min_upper), + number: crate::random_to_domain_mapper::(result.number), + numeric: crate::random_to_domain_mapper::(result.numeric), override_special: crate::random_to_domain_mapper::>(result.override_special), - result: crate::random_to_domain_mapper::>(result.result), - special: crate::random_to_domain_mapper::>(result.special), - upper: crate::random_to_domain_mapper::>(result.upper), + result: crate::random_to_domain_mapper::(result.result), + special: crate::random_to_domain_mapper::(result.special), + upper: crate::random_to_domain_mapper::(result.upper), } } @@ -341,7 +341,7 @@ pub mod random_uuid { pub struct RandomUuidResult { pub keepers: pulumi_wasm_rust::Output>>, - pub result: pulumi_wasm_rust::Output>, + pub result: pulumi_wasm_rust::Output, } pub fn random_uuid(args: RandomUuidArgs) -> RandomUuidResult { @@ -352,7 +352,7 @@ pub mod random_uuid { RandomUuidResult { keepers: crate::random_to_domain_mapper::>>(result.keepers), - result: crate::random_to_domain_mapper::>(result.result), + result: crate::random_to_domain_mapper::(result.result), } } diff --git a/pulumi_wasm_generator/tests/output/random_provider/lib/wit/deps/pulumi-wasm.wit b/pulumi_wasm_generator/tests/output/random_provider/lib/wit/deps/pulumi-wasm.wit index c5fabe8ce..1fe672b9d 100644 --- a/pulumi_wasm_generator/tests/output/random_provider/lib/wit/deps/pulumi-wasm.wit +++ b/pulumi_wasm_generator/tests/output/random_provider/lib/wit/deps/pulumi-wasm.wit @@ -9,7 +9,7 @@ interface output-interface { constructor(value: list); map: func(function-name: string) -> output; get: func() -> option>; - get-field: func(field: string) -> output; + get-field: func(field: string, required: bool) -> output; get-type: func() -> string; duplicate: func() -> output; } diff --git a/pulumi_wasm_generator/tests/output/random_provider/provider/src/lib.rs b/pulumi_wasm_generator/tests/output/random_provider/provider/src/lib.rs index 39012ad21..10f5523b6 100644 --- a/pulumi_wasm_generator/tests/output/random_provider/provider/src/lib.rs +++ b/pulumi_wasm_generator/tests/output/random_provider/provider/src/lib.rs @@ -32,10 +32,10 @@ impl random_bytes::Guest for Component { let o = register(&request); random_bytes::Res { - base64: o.get_field("base64"), - hex: o.get_field("hex"), - keepers: o.get_field("keepers"), - length: o.get_field("length"), + base64: o.get_field("base64, true"), + hex: o.get_field("hex, true"), + keepers: o.get_field("keepers, false"), + length: o.get_field("length, true"), } } @@ -56,13 +56,13 @@ impl random_id::Guest for Component { let o = register(&request); random_id::Res { - b64_std: o.get_field("b64Std"), - b64_url: o.get_field("b64Url"), - byte_length: o.get_field("byteLength"), - dec: o.get_field("dec"), - hex: o.get_field("hex"), - keepers: o.get_field("keepers"), - prefix: o.get_field("prefix"), + b64_std: o.get_field("b64Std, true"), + b64_url: o.get_field("b64Url, true"), + byte_length: o.get_field("byteLength, true"), + dec: o.get_field("dec, true"), + hex: o.get_field("hex, true"), + keepers: o.get_field("keepers, false"), + prefix: o.get_field("prefix, false"), } } @@ -84,11 +84,11 @@ impl random_integer::Guest for Component { let o = register(&request); random_integer::Res { - keepers: o.get_field("keepers"), - max: o.get_field("max"), - min: o.get_field("min"), - result: o.get_field("result"), - seed: o.get_field("seed"), + keepers: o.get_field("keepers, false"), + max: o.get_field("max, true"), + min: o.get_field("min, true"), + result: o.get_field("result, true"), + seed: o.get_field("seed, false"), } } @@ -118,20 +118,20 @@ impl random_password::Guest for Component { let o = register(&request); random_password::Res { - bcrypt_hash: o.get_field("bcryptHash"), - keepers: o.get_field("keepers"), - length: o.get_field("length"), - lower: o.get_field("lower"), - min_lower: o.get_field("minLower"), - min_numeric: o.get_field("minNumeric"), - min_special: o.get_field("minSpecial"), - min_upper: o.get_field("minUpper"), - number: o.get_field("number"), - numeric: o.get_field("numeric"), - override_special: o.get_field("overrideSpecial"), - result: o.get_field("result"), - special: o.get_field("special"), - upper: o.get_field("upper"), + bcrypt_hash: o.get_field("bcryptHash, true"), + keepers: o.get_field("keepers, false"), + length: o.get_field("length, true"), + lower: o.get_field("lower, true"), + min_lower: o.get_field("minLower, true"), + min_numeric: o.get_field("minNumeric, true"), + min_special: o.get_field("minSpecial, true"), + min_upper: o.get_field("minUpper, true"), + number: o.get_field("number, true"), + numeric: o.get_field("numeric, true"), + override_special: o.get_field("overrideSpecial, false"), + result: o.get_field("result, true"), + special: o.get_field("special, true"), + upper: o.get_field("upper, true"), } } @@ -153,10 +153,10 @@ impl random_pet::Guest for Component { let o = register(&request); random_pet::Res { - keepers: o.get_field("keepers"), - length: o.get_field("length"), - prefix: o.get_field("prefix"), - separator: o.get_field("separator"), + keepers: o.get_field("keepers, false"), + length: o.get_field("length, true"), + prefix: o.get_field("prefix, false"), + separator: o.get_field("separator, true"), } } @@ -178,11 +178,11 @@ impl random_shuffle::Guest for Component { let o = register(&request); random_shuffle::Res { - inputs: o.get_field("inputs"), - keepers: o.get_field("keepers"), - result_count: o.get_field("resultCount"), - results: o.get_field("results"), - seed: o.get_field("seed"), + inputs: o.get_field("inputs, true"), + keepers: o.get_field("keepers, false"), + result_count: o.get_field("resultCount, false"), + results: o.get_field("results, true"), + seed: o.get_field("seed, false"), } } @@ -212,19 +212,19 @@ impl random_string::Guest for Component { let o = register(&request); random_string::Res { - keepers: o.get_field("keepers"), - length: o.get_field("length"), - lower: o.get_field("lower"), - min_lower: o.get_field("minLower"), - min_numeric: o.get_field("minNumeric"), - min_special: o.get_field("minSpecial"), - min_upper: o.get_field("minUpper"), - number: o.get_field("number"), - numeric: o.get_field("numeric"), - override_special: o.get_field("overrideSpecial"), - result: o.get_field("result"), - special: o.get_field("special"), - upper: o.get_field("upper"), + keepers: o.get_field("keepers, false"), + length: o.get_field("length, true"), + lower: o.get_field("lower, true"), + min_lower: o.get_field("minLower, true"), + min_numeric: o.get_field("minNumeric, true"), + min_special: o.get_field("minSpecial, true"), + min_upper: o.get_field("minUpper, true"), + number: o.get_field("number, true"), + numeric: o.get_field("numeric, true"), + override_special: o.get_field("overrideSpecial, false"), + result: o.get_field("result, true"), + special: o.get_field("special, true"), + upper: o.get_field("upper, true"), } } @@ -243,8 +243,8 @@ impl random_uuid::Guest for Component { let o = register(&request); random_uuid::Res { - keepers: o.get_field("keepers"), - result: o.get_field("result"), + keepers: o.get_field("keepers, false"), + result: o.get_field("result, true"), } } diff --git a/pulumi_wasm_generator/tests/output/random_provider/provider/wit/deps/pulumi-wasm.wit b/pulumi_wasm_generator/tests/output/random_provider/provider/wit/deps/pulumi-wasm.wit index c5fabe8ce..1fe672b9d 100644 --- a/pulumi_wasm_generator/tests/output/random_provider/provider/wit/deps/pulumi-wasm.wit +++ b/pulumi_wasm_generator/tests/output/random_provider/provider/wit/deps/pulumi-wasm.wit @@ -9,7 +9,7 @@ interface output-interface { constructor(value: list); map: func(function-name: string) -> output; get: func() -> option>; - get-field: func(field: string) -> output; + get-field: func(field: string, required: bool) -> output; get-type: func() -> string; duplicate: func() -> output; } diff --git a/wits/world.wit b/wits/world.wit index 9552b17a7..0fa1a95d9 100644 --- a/wits/world.wit +++ b/wits/world.wit @@ -88,7 +88,7 @@ interface output-interface { constructor(value: list); map: func(function-name: string) -> output; get: func() -> option>; - get-field: func(field: string) -> output; + get-field: func(field: string, required: bool) -> output; get-type: func() -> string; duplicate: func() -> output; }