diff --git a/Cargo.lock b/Cargo.lock index 0b0ac2b..06852ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1588,9 +1588,9 @@ dependencies = [ [[package]] name = "golem-cloud-client" -version = "0.0.55" +version = "0.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e671ea3574e42e3efb770fcb7d4ab3137d45f51e25e5b987aecbb71f56e3f8a2" +checksum = "c37dde0f1db28e35736c70e49adedd76fe25cc4fd17b06b97372ef3e46caf19d" dependencies = [ "async-trait", "bytes", @@ -1606,9 +1606,9 @@ dependencies = [ [[package]] name = "golem-examples" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "838c16d6d9e6bbacfb31f21ddf1b6881e10064801a306ae5a00e8d21967f77ac" +checksum = "7b4c71f4bf85c07873de5b4894386dcb340ad4b42b099cc90599e961077bd95a" dependencies = [ "Inflector", "derive_more", @@ -1623,9 +1623,9 @@ dependencies = [ [[package]] name = "golem-gateway-client" -version = "0.0.55" +version = "0.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b01957ae49ca640ddf5e5ccda4f54796e0076e66647e45aca0544a33d4681ec7" +checksum = "f7c941e65ebd24d9c75bf2b3ec8bbbcc09b8d0689c627e95420e70956a501a6c" dependencies = [ "async-trait", "bytes", @@ -1654,9 +1654,9 @@ dependencies = [ [[package]] name = "golem-wasm-rpc" -version = "0.0.11" +version = "0.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00022b15f014c5a4d5484c261f75f78b0d631761c9de877b45873076c5d7ecee" +checksum = "518c081e27efb23da63ee29f05c5d635daa5db441831ee7af86708dfed17b2b8" dependencies = [ "arbitrary", "bigdecimal", @@ -1672,9 +1672,9 @@ dependencies = [ [[package]] name = "golem-wasm-rpc-stubgen" -version = "0.0.11" +version = "0.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "381507b741738ad7cce6dcf37e2855229b4789abeb563d2d42ad6a143a488596" +checksum = "e258572974b59ab958a91e8d71f2f93a1c44771591405ed9d593a22f8c760172" dependencies = [ "anyhow", "cargo-component", diff --git a/Cargo.toml b/Cargo.toml index 3f4baf9..42fb36e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,10 +17,10 @@ clap = { version = "4.4.12", features = ["derive"] } clap-verbosity-flag = "2.1.1" derive_more = "0.99.17" futures-util = "0.3.30" -golem-cloud-client = "0.0.55" -golem-gateway-client = "0.0.55" -golem-examples = "0.1.11" -golem-wasm-rpc-stubgen = { version = "0.0.11", optional = true } +golem-cloud-client = "0.0.58" +golem-gateway-client = "0.0.58" +golem-examples = "0.1.12" +golem-wasm-rpc-stubgen = { version = "0.0.12", optional = true } http = "1.0.0" indoc = "2.0.4" itertools = "0.11.0" diff --git a/src/auth.rs b/src/auth.rs index 7e8576f..42f4098 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -18,10 +18,7 @@ use std::path::{Path, PathBuf}; use async_trait::async_trait; use chrono::{DateTime, Utc}; -use golem_cloud_client::model::OAuth2Data; -use golem_cloud_client::model::Token; -use golem_cloud_client::model::TokenSecret; -use golem_cloud_client::model::UnsafeToken; +use golem_cloud_client::model::{OAuth2Data, Token, TokenSecret, UnsafeToken}; use indoc::printdoc; use serde::{Deserialize, Serialize}; use tracing::info; diff --git a/src/clients.rs b/src/clients.rs index 582bad8..f9432be 100644 --- a/src/clients.rs +++ b/src/clients.rs @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +use golem_cloud_client::model::{TokenSecret, UnsafeToken}; + use crate::model::{AccountId, ProjectAction}; -use golem_cloud_client::model::TokenSecret; -use golem_cloud_client::model::UnsafeToken; pub mod account; pub mod errors; diff --git a/src/clients/account.rs b/src/clients/account.rs index 70f8303..36d74d8 100644 --- a/src/clients/account.rs +++ b/src/clients/account.rs @@ -13,9 +13,7 @@ // limitations under the License. use async_trait::async_trait; -use golem_cloud_client::model::Account; -use golem_cloud_client::model::AccountData; -use golem_cloud_client::model::Plan; +use golem_cloud_client::model::{Account, AccountData, Plan}; use tracing::info; use crate::model::{AccountId, GolemError}; diff --git a/src/clients/errors.rs b/src/clients/errors.rs index 482689f..bde2ddc 100644 --- a/src/clients/errors.rs +++ b/src/clients/errors.rs @@ -12,15 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -use golem_cloud_client::api::AccountError; -use golem_cloud_client::api::GrantError; -use golem_cloud_client::api::LoginError; -use golem_cloud_client::api::ProjectError; -use golem_cloud_client::api::ProjectGrantError; -use golem_cloud_client::api::ProjectPolicyError; -use golem_cloud_client::api::TemplateError; -use golem_cloud_client::api::TokenError; -use golem_cloud_client::api::WorkerError; +use golem_cloud_client::api::{ + AccountError, GrantError, LoginError, ProjectError, ProjectGrantError, ProjectPolicyError, + TemplateError, TokenError, WorkerError, +}; pub trait ResponseContentErrorMapper { fn map(self) -> String; diff --git a/src/clients/gateway/certificate.rs b/src/clients/gateway/certificate.rs index be0c37a..8329d31 100644 --- a/src/clients/gateway/certificate.rs +++ b/src/clients/gateway/certificate.rs @@ -13,8 +13,7 @@ // limitations under the License. use async_trait::async_trait; -use golem_gateway_client::model::Certificate; -use golem_gateway_client::model::CertificateRequest; +use golem_gateway_client::model::{Certificate, CertificateRequest}; use uuid::Uuid; use crate::model::{GolemError, ProjectId}; diff --git a/src/clients/gateway/domain.rs b/src/clients/gateway/domain.rs index f1c6595..91dd013 100644 --- a/src/clients/gateway/domain.rs +++ b/src/clients/gateway/domain.rs @@ -13,8 +13,7 @@ // limitations under the License. use async_trait::async_trait; -use golem_gateway_client::model::ApiDomain; -use golem_gateway_client::model::DomainRequest; +use golem_gateway_client::model::{ApiDomain, DomainRequest}; use crate::model::{GolemError, ProjectId}; diff --git a/src/clients/gateway/errors.rs b/src/clients/gateway/errors.rs index afbde68..5c055c2 100644 --- a/src/clients/gateway/errors.rs +++ b/src/clients/gateway/errors.rs @@ -12,11 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -use golem_gateway_client::api::ApiCertificateError; -use golem_gateway_client::api::ApiDefinitionError; -use golem_gateway_client::api::ApiDeploymentError; -use golem_gateway_client::api::ApiDomainError; -use golem_gateway_client::api::HealthcheckError; +use golem_gateway_client::api::{ + ApiCertificateError, ApiDefinitionError, ApiDeploymentError, ApiDomainError, HealthcheckError, +}; pub trait ResponseContentErrorMapper { fn map(self) -> String; diff --git a/src/clients/login.rs b/src/clients/login.rs index 41addd6..fdcb266 100644 --- a/src/clients/login.rs +++ b/src/clients/login.rs @@ -14,10 +14,7 @@ use async_trait::async_trait; use golem_cloud_client::api::LoginClient as HttpClient; -use golem_cloud_client::model::OAuth2Data; -use golem_cloud_client::model::Token; -use golem_cloud_client::model::TokenSecret; -use golem_cloud_client::model::UnsafeToken; +use golem_cloud_client::model::{OAuth2Data, Token, TokenSecret, UnsafeToken}; use golem_cloud_client::{Context, Security}; use tracing::info; diff --git a/src/clients/policy.rs b/src/clients/policy.rs index 84355fe..b536186 100644 --- a/src/clients/policy.rs +++ b/src/clients/policy.rs @@ -13,9 +13,7 @@ // limitations under the License. use async_trait::async_trait; -use golem_cloud_client::model::ProjectActions; -use golem_cloud_client::model::ProjectPolicy; -use golem_cloud_client::model::ProjectPolicyData; +use golem_cloud_client::model::{ProjectActions, ProjectPolicy, ProjectPolicyData}; use tracing::info; use crate::clients::action_cli_to_api; diff --git a/src/clients/project.rs b/src/clients/project.rs index 8d2d3af..20e0f4c 100644 --- a/src/clients/project.rs +++ b/src/clients/project.rs @@ -13,8 +13,7 @@ // limitations under the License. use async_trait::async_trait; -use golem_cloud_client::model::Project; -use golem_cloud_client::model::ProjectDataRequest; +use golem_cloud_client::model::{Project, ProjectDataRequest}; use indoc::formatdoc; use tracing::info; diff --git a/src/clients/project_grant.rs b/src/clients/project_grant.rs index 95c9bf4..aa03d04 100644 --- a/src/clients/project_grant.rs +++ b/src/clients/project_grant.rs @@ -13,8 +13,7 @@ // limitations under the License. use async_trait::async_trait; -use golem_cloud_client::model::ProjectGrant; -use golem_cloud_client::model::ProjectGrantDataRequest; +use golem_cloud_client::model::{ProjectGrant, ProjectGrantDataRequest}; use tracing::info; use crate::clients::action_cli_to_api; diff --git a/src/clients/template.rs b/src/clients/template.rs index 2ae688c..58ba5ba 100644 --- a/src/clients/template.rs +++ b/src/clients/template.rs @@ -15,21 +15,11 @@ use std::io::Read; use async_trait::async_trait; -use golem_cloud_client::model::Export; -use golem_cloud_client::model::ExportFunction; -use golem_cloud_client::model::ExportInstance; -use golem_cloud_client::model::FunctionParameter; -use golem_cloud_client::model::FunctionResult; -use golem_cloud_client::model::NameOptionTypePair; -use golem_cloud_client::model::NameTypePair; -use golem_cloud_client::model::Template; -use golem_cloud_client::model::TemplateQuery; -use golem_cloud_client::model::Type; -use golem_cloud_client::model::TypeEnum; -use golem_cloud_client::model::TypeFlags; -use golem_cloud_client::model::TypeRecord; -use golem_cloud_client::model::TypeTuple; -use golem_cloud_client::model::TypeVariant; +use golem_cloud_client::model::{ + Export, ExportFunction, ExportInstance, FunctionParameter, FunctionResult, NameOptionTypePair, + NameTypePair, ResourceMode, Template, TemplateQuery, Type, TypeEnum, TypeFlags, TypeRecord, + TypeTuple, TypeVariant, +}; use serde::Serialize; use tokio::fs::File; use tracing::info; @@ -168,6 +158,10 @@ fn render_type(typ: &Type) -> String { Type::U8 { .. } => "u8".to_string(), Type::S8 { .. } => "s8".to_string(), Type::Bool { .. } => "bool".to_string(), + Type::Handle(handle) => match handle.mode { + ResourceMode::Borrowed => format!("&handle<{}>", handle.resource_id), + ResourceMode::Owned => format!("handle<{}>", handle.resource_id), + }, } } diff --git a/src/clients/token.rs b/src/clients/token.rs index 4e9177f..27732fc 100644 --- a/src/clients/token.rs +++ b/src/clients/token.rs @@ -14,9 +14,7 @@ use async_trait::async_trait; use chrono::{DateTime, Utc}; -use golem_cloud_client::model::CreateTokenDto; -use golem_cloud_client::model::Token; -use golem_cloud_client::model::UnsafeToken; +use golem_cloud_client::model::{CreateTokenDto, Token, UnsafeToken}; use tracing::info; use crate::model::{AccountId, GolemError, TokenId}; diff --git a/src/clients/worker.rs b/src/clients/worker.rs index bf4fe21..1daec9f 100644 --- a/src/clients/worker.rs +++ b/src/clients/worker.rs @@ -16,12 +16,10 @@ use std::time::Duration; use async_trait::async_trait; use futures_util::{future, pin_mut, SinkExt, StreamExt}; -use golem_cloud_client::model::CallingConvention; -use golem_cloud_client::model::InvokeParameters; -use golem_cloud_client::model::InvokeResult; -use golem_cloud_client::model::VersionedWorkerId; -use golem_cloud_client::model::WorkerCreationRequest; -use golem_cloud_client::model::WorkerMetadata; +use golem_cloud_client::model::{ + CallingConvention, InvokeParameters, InvokeResult, VersionedWorkerId, WorkerCreationRequest, + WorkerMetadata, +}; use golem_cloud_client::Context; use native_tls::TlsConnector; use serde::Deserialize; diff --git a/src/gateway/deployment.rs b/src/gateway/deployment.rs index 8d543db..b132f2b 100644 --- a/src/gateway/deployment.rs +++ b/src/gateway/deployment.rs @@ -14,8 +14,7 @@ use async_trait::async_trait; use clap::Subcommand; -use golem_gateway_client::model::ApiDeployment; -use golem_gateway_client::model::ApiSite; +use golem_gateway_client::model::{ApiDeployment, ApiSite}; use crate::clients::gateway::deployment::DeploymentClient; use crate::clients::project::ProjectClient;