Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into string_const
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejressel committed Dec 15, 2024
2 parents 085f152 + cd5f21f commit 9523632
Show file tree
Hide file tree
Showing 49 changed files with 1,953 additions and 16 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ jobs:
workspaces: |
./
pulumi_wasm_generator_lib/tests/output/cyclic-types/
pulumi_wasm_generator_lib/tests/output/functions-secrets/
pulumi_wasm_generator_lib/tests/output/mini-awsnative/
pulumi_wasm_generator_lib/tests/output/output-funcs/
pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/
pulumi_wasm_generator_lib/tests/output/unions-inline/
pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/
- name: Regenerate provider list
run: just regenerate-provider-list
- name: Check
Expand Down Expand Up @@ -204,7 +209,12 @@ jobs:
workspaces: |
./
pulumi_wasm_generator_lib/tests/output/cyclic-types/
pulumi_wasm_generator_lib/tests/output/functions-secrets/
pulumi_wasm_generator_lib/tests/output/mini-awsnative/
pulumi_wasm_generator_lib/tests/output/output-funcs/
pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/
pulumi_wasm_generator_lib/tests/output/unions-inline/
pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/
- uses: benjlevesque/[email protected]
id: short-sha
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@ jobs:
workspaces: |
./
pulumi_wasm_generator_lib/tests/output/cyclic-types/
pulumi_wasm_generator_lib/tests/output/functions-secrets/
pulumi_wasm_generator_lib/tests/output/mini-awsnative/
pulumi_wasm_generator_lib/tests/output/output-funcs/
pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/
pulumi_wasm_generator_lib/tests/output/unions-inline/
pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/
- name: Build
run: |
Expand Down Expand Up @@ -253,7 +258,12 @@ jobs:
workspaces: |
./
pulumi_wasm_generator_lib/tests/output/cyclic-types/
pulumi_wasm_generator_lib/tests/output/functions-secrets/
pulumi_wasm_generator_lib/tests/output/mini-awsnative/
pulumi_wasm_generator_lib/tests/output/output-funcs/
pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/
pulumi_wasm_generator_lib/tests/output/unions-inline/
pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/
- name: Add target
run: rustup target add ${{ matrix.rust-target }}
Expand Down
11 changes: 8 additions & 3 deletions pulumi_wasm_generator_lib/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(crate) enum Type {
Object(Box<Type>),
Ref(Ref),
Option(Box<Type>),
DiscriminatedUnion(Vec<Ref>),
DiscriminatedUnion(Vec<Type>),
ConstString(String)
}

Expand Down Expand Up @@ -45,7 +45,7 @@ impl Type {
"pulumi_wasm_provider_common::OneOf{}<{}>",
refs.len(),
refs.iter()
.map(|r| Type::Ref(r.clone()).get_rust_type())
.map(|r| r.get_rust_type())
.collect::<Vec<_>>()
.join(", ")
),
Expand All @@ -64,7 +64,12 @@ impl Type {
Type::Array(t) => t.get_internal_discriminated_union(),
Type::Object(o) => o.get_internal_discriminated_union(),
Type::Option(o) => o.get_internal_discriminated_union(),
Type::DiscriminatedUnion(m) => Some(m.iter().map(|r| Type::Ref(r.clone())).collect()),
Type::DiscriminatedUnion(types) => Some(
types
.iter()
.flat_map(|t| t.get_internal_discriminated_union().unwrap_or_default())
.collect(),
),
}
}

Expand Down
54 changes: 44 additions & 10 deletions pulumi_wasm_generator_lib/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,28 @@ struct Type {
}

#[derive(Deserialize, Debug)]
struct OneOfType {
#[serde(untagged)]
enum OneOfType {
Ref(OneOfTypeRef),
Primitive(OneOfTypePrimitive),
}

#[derive(Deserialize, Debug)]
struct OneOfTypeRef {
#[serde(rename = "$ref")]
ref_: String,
}
#[derive(Deserialize, Debug)]
struct OneOfTypePrimitive {
#[serde(rename = "type")]
type_: OneOfTypePrimitiveType,
}
#[derive(Deserialize, Debug)]

enum OneOfTypePrimitiveType {
#[serde(rename = "string")]
String,
}

#[derive(Deserialize, Debug)]
struct Property {
Expand Down Expand Up @@ -76,7 +94,7 @@ struct Resource {

#[derive(Deserialize, Debug)]
struct EnumValue {
name: String,
name: Option<String>,
description: Option<String>,
value: Option<String>,
}
Expand Down Expand Up @@ -185,10 +203,15 @@ fn create_discriminated_union(one_of: &[OneOfType]) -> Result<crate::model::Type
Ok(crate::model::Type::DiscriminatedUnion(
one_of
.iter()
.map(|r| {
Ref::new(&r.ref_)
.context(format!("Cannot convert ref fo type {r:?}"))
.unwrap()
.map(|r| match r {
OneOfType::Ref(r) => crate::model::Type::Ref(
Ref::new(&r.ref_)
.context(format!("Cannot convert ref fo type {r:?}"))
.unwrap(),
),
OneOfType::Primitive(primitive) => match primitive.type_ {
OneOfTypePrimitiveType::String => crate::model::Type::String,
},
})
.collect(),
))
Expand Down Expand Up @@ -387,10 +410,21 @@ fn create_string_enum(description: &Option<String>, enum_values: &[EnumValue]) -
description.clone(),
enum_values
.iter()
.map(|enum_value| StringEnumElement {
name: enum_value.name.clone(),
value: enum_value.value.clone(),
description: enum_value.description.clone(),
.map(|enum_value| {
let (real_name, real_value) = match (&enum_value.name, &enum_value.value) {
(Some(name), Some(value)) => (name.clone(), Some(value.clone())),
(Some(name), None) => (name.clone(), None),
(None, Some(value)) => (value.clone(), None),
(None, None) => {
panic!("Invalid enum value: {enum_value:?}")
}
};

StringEnumElement {
name: real_name,
value: real_value,
description: enum_value.description.clone(),
}
})
.collect(),
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "main"
version = "0.0.1"
edition = "2021"

[workspace]
members = [
"provider",
"lib"
]

[workspace.dependencies]
wit-bindgen-rt = "0.33.0"
wit-bindgen = "0.33.0"
automod = "1.0.14"
pulumi_wasm_common = { path = "../../../../pulumi_wasm_common" }
pulumi_wasm_rust = { path = "../../../../pulumi_wasm_rust" }
pulumi_wasm_wit = { path = "../../../../pulumi_wasm_wit" }
pulumi_wasm_provider_common = { path = "../../../../pulumi_wasm_provider_common" }
serde = "1.0.197"
bon = "2.2.1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "pulumi_wasm_myedgeorder"
version = "0.0.1-0.0.0-DEV"
edition = "2021"

[dependencies]
wit-bindgen.workspace = true
pulumi_wasm_rust.workspace = true
serde.workspace = true
pulumi_wasm_wit = { workspace = true, features = ["client"] }
bon.workspace = true
pulumi_wasm_provider_common.workspace = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//! The list of configurations.
//! API Version: 2020-12-01-preview.
#[derive(bon::Builder, Clone)]
#[builder(finish_fn = build_struct)]
pub struct ListConfigurationsArgs {
/// Holds details about product hierarchy information and filterable property.
#[builder(into)]
pub configuration_filters: pulumi_wasm_rust::Output<Vec<crate::types::ConfigurationFilters>>,
/// Customer subscription properties. Clients can display available products to unregistered customers by explicitly passing subscription details
#[builder(into, default = ::pulumi_wasm_rust::Output::empty())]
pub customer_subscription_details: pulumi_wasm_rust::Output<Option<crate::types::CustomerSubscriptionDetails>>,
/// $skipToken is supported on list of configurations, which provides the next page in the list of configurations.
#[builder(into, default = ::pulumi_wasm_rust::Output::empty())]
pub skip_token: pulumi_wasm_rust::Output<Option<String>>,
}

pub struct ListConfigurationsResult {
/// Link for the next set of configurations.
pub next_link: pulumi_wasm_rust::Output<Option<String>>,
/// List of configurations.
pub value: pulumi_wasm_rust::Output<Vec<crate::types::ConfigurationResponse>>,
}

///
/// Registers a new resource with the given unique name and arguments
///
pub fn invoke(
args: ListConfigurationsArgs
) -> ListConfigurationsResult {

let result = crate::bindings::pulumi::myedgeorder::list_configurations::invoke(
&crate::bindings::pulumi::myedgeorder::list_configurations::Args {
configuration_filters: &args.configuration_filters.get_inner(),
customer_subscription_details: &args.customer_subscription_details.get_inner(),
skip_token: &args.skip_token.get_inner(),
}
);

ListConfigurationsResult {
next_link: crate::into_domain(result.next_link),
value: crate::into_domain(result.value),
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//! The list of product families.
//! API Version: 2020-12-01-preview.
#[derive(bon::Builder, Clone)]
#[builder(finish_fn = build_struct)]
pub struct ListProductFamiliesArgs {
/// Customer subscription properties. Clients can display available products to unregistered customers by explicitly passing subscription details
#[builder(into, default = ::pulumi_wasm_rust::Output::empty())]
pub customer_subscription_details: pulumi_wasm_rust::Output<Option<crate::types::CustomerSubscriptionDetails>>,
/// $expand is supported on configurations parameter for product, which provides details on the configurations for the product.
#[builder(into, default = ::pulumi_wasm_rust::Output::empty())]
pub expand: pulumi_wasm_rust::Output<Option<String>>,
/// Dictionary of filterable properties on product family.
#[builder(into)]
pub filterable_properties: pulumi_wasm_rust::Output<std::collections::HashMap<String, Vec<crate::types::FilterableProperty>>>,
/// $skipToken is supported on list of product families, which provides the next page in the list of product families.
#[builder(into, default = ::pulumi_wasm_rust::Output::empty())]
pub skip_token: pulumi_wasm_rust::Output<Option<String>>,
}

pub struct ListProductFamiliesResult {
/// Link for the next set of product families.
pub next_link: pulumi_wasm_rust::Output<Option<String>>,
/// List of product families.
pub value: pulumi_wasm_rust::Output<Vec<crate::types::ProductFamilyResponse>>,
}

///
/// Registers a new resource with the given unique name and arguments
///
pub fn invoke(
args: ListProductFamiliesArgs
) -> ListProductFamiliesResult {

let result = crate::bindings::pulumi::myedgeorder::list_product_families::invoke(
&crate::bindings::pulumi::myedgeorder::list_product_families::Args {
customer_subscription_details: &args.customer_subscription_details.get_inner(),
expand: &args.expand.get_inner(),
filterable_properties: &args.filterable_properties.get_inner(),
skip_token: &args.skip_token.get_inner(),
}
);

ListProductFamiliesResult {
next_link: crate::into_domain(result.next_link),
value: crate::into_domain(result.value),
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod list_configurations;
pub mod list_product_families;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use pulumi_wasm_rust::Output;
use pulumi_wasm_wit::client_bindings::component::pulumi_wasm::output_interface::Output as WitOutput;
#[allow(clippy::doc_lazy_continuation, clippy::tabs_in_doc_comments)]
mod function;
pub use function::*;
#[allow(clippy::doc_lazy_continuation, clippy::tabs_in_doc_comments)]
mod types;
pub use types::*;

mod bindings {
wit_bindgen::generate!({
// the name of the world in the `*.wit` input file
world: "myedgeorder-pulumi-client",
with: {
"component:pulumi-wasm/[email protected]": pulumi_wasm_wit::client_bindings::component::pulumi_wasm::output_interface
}
});
}

fn into_domain<F: serde::Serialize>(output: WitOutput) -> Output<F> {
unsafe { Output::<F>::new_from_handle(output) }
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//! Availability information of a product system.
#[derive(serde::Deserialize, serde::Serialize, bon::Builder, Debug, PartialEq, Clone)]
#[builder(finish_fn = build_struct)]
pub struct AvailabilityInformationResponse {
/// Current availability stage of the product. Availability stage
#[builder(into)]
#[serde(rename = "availabilityStage")]
pub r#availability_stage: Box<String>,
/// Reason why the product is disabled.
#[builder(into)]
#[serde(rename = "disabledReason")]
pub r#disabled_reason: Box<String>,
/// Message for why the product is disabled.
#[builder(into)]
#[serde(rename = "disabledReasonMessage")]
pub r#disabled_reason_message: Box<String>,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//! Holds billing meter details for each type of billing
#[derive(serde::Deserialize, serde::Serialize, bon::Builder, Debug, PartialEq, Clone)]
#[builder(finish_fn = build_struct)]
pub struct BillingMeterDetailsResponse {
/// Frequency of recurrence
#[builder(into)]
#[serde(rename = "frequency")]
pub r#frequency: Box<String>,
/// Represents MeterDetails
#[builder(into)]
#[serde(rename = "meterDetails")]
pub r#meter_details: Box<pulumi_wasm_provider_common::OneOf2<crate::types::Pav2MeterDetailsResponse, crate::types::PurchaseMeterDetailsResponse>>,
/// Represents Metering type (eg one-time or recurrent)
#[builder(into)]
#[serde(rename = "meteringType")]
pub r#metering_type: Box<String>,
/// Represents Billing type name
#[builder(into)]
#[serde(rename = "name")]
pub r#name: Box<String>,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//! Configuration filters
#[derive(serde::Deserialize, serde::Serialize, bon::Builder, Debug, PartialEq, Clone)]
#[builder(finish_fn = build_struct)]
pub struct ConfigurationFilters {
/// Filters specific to product
#[builder(into, default = Box::new(None))]
#[serde(rename = "filterableProperty")]
pub r#filterable_property: Box<Option<Vec<crate::types::FilterableProperty>>>,
/// Product hierarchy information
#[builder(into)]
#[serde(rename = "hierarchyInformation")]
pub r#hierarchy_information: Box<crate::types::HierarchyInformation>,
}
Loading

0 comments on commit 9523632

Please sign in to comment.