Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #91 from connorsmith256/feat/add-registry-type
Browse files Browse the repository at this point in the history
add registryType as required field to RegistryCredential
  • Loading branch information
Connor Smith authored Sep 21, 2022
2 parents 9924a4c + 202a036 commit f24afb0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
6 changes: 5 additions & 1 deletion configservice/config-service.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,9 @@ structure RegistryCredential {
token: String,
/// If supplied, username and password will be used for HTTP Basic authentication
username: String,
password: String
@sensitive
password: String,
/// The type of the registry (either "oci" or "bindle")
@required
registryType: String
}
6 changes: 5 additions & 1 deletion lattice-control/lattice-control-interface.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,10 @@ structure RegistryCredential {
token: String,
/// If supplied, username and password will be used for HTTP Basic authentication
username: String,
password: String
@sensitive
password: String,
/// The type of the registry (either "oci" or "bindle")
@required
registryType: String
}

2 changes: 1 addition & 1 deletion lattice-control/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wasmcloud-interface-lattice-control"
version = "0.14.1"
version = "0.15.0"
edition = "2021"
homepage = "https://wasmcloud.dev"
repository = "https://github.com/wasmCloud/interfaces"
Expand Down
23 changes: 20 additions & 3 deletions lattice-control/rust/src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2573,6 +2573,10 @@ pub fn decode_provider_descriptions(
pub struct RegistryCredential {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub password: Option<String>,
/// The type of the registry (either "oci" or "bindle")
#[serde(rename = "registryType")]
#[serde(default)]
pub registry_type: String,
/// If supplied, token authentication will be used for the registry
#[serde(default, skip_serializing_if = "Option::is_none")]
pub token: Option<String>,
Expand All @@ -2591,13 +2595,15 @@ pub fn encode_registry_credential<W: wasmbus_rpc::cbor::Write>(
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.map(3)?;
e.map(4)?;
if let Some(val) = val.password.as_ref() {
e.str("password")?;
e.str(val)?;
} else {
e.null()?;
}
e.str("registryType")?;
e.str(&val.registry_type)?;
if let Some(val) = val.token.as_ref() {
e.str("token")?;
e.str(val)?;
Expand All @@ -2620,6 +2626,7 @@ pub fn decode_registry_credential(
) -> Result<RegistryCredential, RpcError> {
let __result = {
let mut password: Option<Option<String>> = Some(None);
let mut registry_type: Option<String> = None;
let mut token: Option<Option<String>> = Some(None);
let mut username: Option<Option<String>> = Some(None);

Expand All @@ -2644,15 +2651,16 @@ pub fn decode_registry_credential(
Some(Some(d.str()?.to_string()))
}
}
1 => {
1 => registry_type = Some(d.str()?.to_string()),
2 => {
token = if wasmbus_rpc::cbor::Type::Null == d.datatype()? {
d.skip()?;
Some(None)
} else {
Some(Some(d.str()?.to_string()))
}
}
2 => {
3 => {
username = if wasmbus_rpc::cbor::Type::Null == d.datatype()? {
d.skip()?;
Some(None)
Expand All @@ -2676,6 +2684,7 @@ pub fn decode_registry_credential(
Some(Some(d.str()?.to_string()))
}
}
"registryType" => registry_type = Some(d.str()?.to_string()),
"token" => {
token = if wasmbus_rpc::cbor::Type::Null == d.datatype()? {
d.skip()?;
Expand All @@ -2698,6 +2707,14 @@ pub fn decode_registry_credential(
}
RegistryCredential {
password: password.unwrap(),

registry_type: if let Some(__x) = registry_type {
__x
} else {
return Err(RpcError::Deser(
"missing field RegistryCredential.registry_type (#1)".to_string(),
));
},
token: token.unwrap(),
username: username.unwrap(),
}
Expand Down

0 comments on commit f24afb0

Please sign in to comment.