Skip to content

Commit

Permalink
chore(wit): update bindings for shared applications
Browse files Browse the repository at this point in the history
Signed-off-by: Brooks Townsend <[email protected]>
  • Loading branch information
brooksmtownsend committed Sep 24, 2024
1 parent 824209c commit cbb8c30
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 8 deletions.
31 changes: 29 additions & 2 deletions crates/wadm-types/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ use crate::{
},
CapabilityProperties, Component, ComponentProperties, ConfigDefinition, ConfigProperty,
LinkProperty, Manifest, Metadata, Policy, Properties, SecretProperty, SecretSourceProperty,
Specification, Spread, SpreadScalerProperty, TargetConfig, Trait, TraitProperty,
SharedApplicationComponentProperties, Specification, Spread, SpreadScalerProperty,
TargetConfig, Trait, TraitProperty,
};
use wasmcloud::wadm;
use wasmcloud::wadm::{self};

wit_bindgen_wrpc::generate!({
generate_unused_types: true,
Expand Down Expand Up @@ -87,6 +88,7 @@ impl From<Properties> for wadm::types::Properties {
impl From<ComponentProperties> for wadm::types::ComponentProperties {
fn from(properties: ComponentProperties) -> Self {
wadm::types::ComponentProperties {
application: properties.application.map(Into::into),
image: properties.image,
id: properties.id,
config: properties.config.into_iter().map(|c| c.into()).collect(),
Expand All @@ -98,6 +100,7 @@ impl From<ComponentProperties> for wadm::types::ComponentProperties {
impl From<CapabilityProperties> for wadm::types::CapabilityProperties {
fn from(properties: CapabilityProperties) -> Self {
wadm::types::CapabilityProperties {
application: properties.application.map(Into::into),
image: properties.image,
id: properties.id,
config: properties.config.into_iter().map(|c| c.into()).collect(),
Expand Down Expand Up @@ -135,6 +138,17 @@ impl From<SecretSourceProperty> for wadm::types::SecretSourceProperty {
}
}

impl From<SharedApplicationComponentProperties>
for wadm::types::SharedApplicationComponentProperties
{
fn from(properties: SharedApplicationComponentProperties) -> Self {
wadm::types::SharedApplicationComponentProperties {
name: properties.name,
component: properties.component,
}
}
}

impl From<Trait> for wadm::types::Trait {
fn from(trait_: Trait) -> Self {
wadm::types::Trait {
Expand Down Expand Up @@ -391,6 +405,7 @@ impl From<wadm::types::ComponentProperties> for ComponentProperties {
fn from(properties: wadm::types::ComponentProperties) -> Self {
ComponentProperties {
image: properties.image,
application: properties.application.map(Into::into),
id: properties.id,
config: properties.config.into_iter().map(|c| c.into()).collect(),
secrets: properties.secrets.into_iter().map(|c| c.into()).collect(),
Expand All @@ -402,6 +417,7 @@ impl From<wadm::types::CapabilityProperties> for CapabilityProperties {
fn from(properties: wadm::types::CapabilityProperties) -> Self {
CapabilityProperties {
image: properties.image,
application: properties.application.map(Into::into),
id: properties.id,
config: properties.config.into_iter().map(|c| c.into()).collect(),
secrets: properties.secrets.into_iter().map(|c| c.into()).collect(),
Expand Down Expand Up @@ -438,6 +454,17 @@ impl From<wadm::types::SecretSourceProperty> for SecretSourceProperty {
}
}

impl From<wadm::types::SharedApplicationComponentProperties>
for SharedApplicationComponentProperties
{
fn from(properties: wadm::types::SharedApplicationComponentProperties) -> Self {
SharedApplicationComponentProperties {
name: properties.name,
component: properties.component,
}
}
}

impl From<wadm::types::Trait> for Trait {
fn from(trait_: wadm::types::Trait) -> Self {
Trait {
Expand Down
4 changes: 2 additions & 2 deletions crates/wadm-types/wit/deps.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[wadm]
path = "../../../wit/wadm"
sha256 = "30b945b53e5dc1220f25da83449571e119cfd4029647a1908e5658d72335424e"
sha512 = "bbd7e5883dc4014ea246a33cf9386b11803cb330854e5691af526971c7131ad358eec9ad8f6dbf0ccd20efe0fedb43a3304f8e9538832d73cce7db09f82f1176"
sha256 = "be9dcb406ac45d69c18c70d962572b9def1f59787246caf27b54f255a817ace7"
sha512 = "c3a3dc09613acff547165627174323096e50abd31998a3514917cc7b2596d86ae04bf4950cbbfac932fc82b2039f435f278fe25eb6f9d23ab7678662e8d528f1"
12 changes: 10 additions & 2 deletions crates/wadm-types/wit/deps/wadm/types.wit
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,17 @@ interface types {

// Properties for a component
record component-properties {
image: string,
image: option<string>,
application: option<shared-application-component-properties>,
id: option<string>,
config: list<config-property>,
secrets: list<secret-property>,
}

// Properties for a capability
record capability-properties {
image: string,
image: option<string>,
application: option<shared-application-component-properties>,
id: option<string>,
config: list<config-property>,
secrets: list<secret-property>,
Expand Down Expand Up @@ -187,6 +189,12 @@ interface types {
version: option<string>,
}

// Shared application component properties
record shared-application-component-properties {
name: string,
component: string
}

// Target configuration
record target-config {
name: string,
Expand Down
12 changes: 10 additions & 2 deletions wit/wadm/types.wit
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,17 @@ interface types {

// Properties for a component
record component-properties {
image: string,
image: option<string>,
application: option<shared-application-component-properties>,
id: option<string>,
config: list<config-property>,
secrets: list<secret-property>,
}

// Properties for a capability
record capability-properties {
image: string,
image: option<string>,
application: option<shared-application-component-properties>,
id: option<string>,
config: list<config-property>,
secrets: list<secret-property>,
Expand Down Expand Up @@ -187,6 +189,12 @@ interface types {
version: option<string>,
}

// Shared application component properties
record shared-application-component-properties {
name: string,
component: string
}

// Target configuration
record target-config {
name: string,
Expand Down

0 comments on commit cbb8c30

Please sign in to comment.