Skip to content

Commit

Permalink
Fixed compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
abdolence committed Jul 9, 2024
1 parent 9c4e141 commit c62ff30
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 48 deletions.
4 changes: 2 additions & 2 deletions gcloud-protos-generator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "protosgen"
version = "0.10.0"
version = "0.11.0"
authors = ["mechiru <[email protected]>", "[email protected]"]
edition = "2021"

[dependencies]
tonic-build = { version = "0.11", features = ["prost-build"] }
tonic-build = { version = "0.12", features = ["prost-build"] }
prost-build = "0.12"
prettyplease = "0.2"
syn = { version = "2", default-features = false, features = ["full", "parsing"] }
21 changes: 6 additions & 15 deletions gcloud-sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gcloud-sdk"
version = "0.24.8"
version = "0.25.0"
authors = ["Abdulla Abdurakhmanov <[email protected]>","mechiru <[email protected]>"]
edition = "2021"
license = "MIT OR Apache-2.0"
Expand All @@ -19,7 +19,7 @@ doctest = false
default = ["tls-roots"]
tls-roots = ["tonic/tls-roots", "reqwest/rustls-tls-native-roots"]
tls-webpki-roots = ["tonic/tls-webpki-roots", "reqwest/rustls-tls"]
rest = ["bytes", "serde_with"]
rest = ["serde_with"]
ccc-hosted-marketplace-v2 = []
google-actions-sdk-v2 = []
google-actions-sdk-v2-conversation = []
Expand Down Expand Up @@ -90,10 +90,6 @@ google-cloud-apigateway-v1 = []
google-cloud-apigeeconnect-v1 = []
google-cloud-apigeeregistry-v1 = []
google-cloud-asset-v1 = []
# google-cloud-asset-v1p1beta1 = []
# google-cloud-asset-v1p2beta1 = []
# google-cloud-asset-v1p4beta1 = []
# google-cloud-asset-v1p5beta1 = []
google-cloud-asset-v1p7beta1 = []
google-cloud-assuredworkloads-v1 = []
google-cloud-assuredworkloads-v1beta1 = []
Expand Down Expand Up @@ -358,11 +354,9 @@ google-example-showcase-v1 = []
google-example-showcase-v1beta1 = []
google-example-showcase-v1beta2 = []
google-example-showcase-v1beta3 = []
#google-firebase-fcm-connection-v1alpha1 = []
google-firestore-admin-v1 = []
google-firestore-admin-v1beta1 = []
google-firestore-admin-v1beta2 = []
# google-firestore-bundle = []
google-firestore-v1 = []
google-firestore-v1beta1 = []
google-gapic-metadata = []
Expand Down Expand Up @@ -414,15 +408,12 @@ google-watcher-v1 = []
grafeas-v1 = []
grafeas-v1beta1 = []
maps-fleetengine-delivery-v1 = []
# grafeas-v1beta1-attestation = []
grafeas-v1beta1-build = []
grafeas-v1beta1-deployment = []
# grafeas-v1beta1-discovery = []
grafeas-v1beta1-image = []
grafeas-v1beta1-package = []
grafeas-v1beta1-provenance = []
grafeas-v1beta1-source = []
# grafeas-v1beta1-vulnerability = []
maps-fleetengine-v1 = []

# REST features
Expand All @@ -438,8 +429,8 @@ tower = "0.4"
tower-layer = "0.3"
tower-util = "0.3"
futures = "0.3"
prost = "0.12"
prost-types = "0.12"
prost = "0.13"
prost-types = "0.13"
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1" }
url = { version = "2.5" }
Expand All @@ -451,8 +442,8 @@ tokio= { version = "1" }
tracing = "0.1"
secret-vault-value = { version="0.3", features=["proto", "serde"] }
once_cell = "1.19"
reqwest = { version="0.11", features=["multipart", "json", "gzip", "stream"], default-features = false }
bytes = { version = "1", optional = true }
reqwest = { version="0.12", features=["multipart", "json", "gzip", "stream"], default-features = false }
bytes = { version = "1"}
serde_with = { version = "3", optional = true }

[dev-dependencies]
Expand Down
12 changes: 6 additions & 6 deletions gcloud-sdk/src/api_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::token_source::*;
#[async_trait]
pub trait GoogleApiClientBuilder<C>
where
C: Clone + Send + Sync,
C: Clone + Send,
{
fn create_client(&self, channel: GoogleAuthMiddlewareService<Channel>) -> C;
}
Expand All @@ -23,7 +23,7 @@ where
pub struct GoogleApiClient<B, C>
where
B: GoogleApiClientBuilder<C>,
C: Clone + Send + Sync,
C: Clone + Send,
{
builder: B,
service: GoogleAuthMiddlewareService<Channel>,
Expand All @@ -33,7 +33,7 @@ where
impl<B, C> GoogleApiClient<B, C>
where
B: GoogleApiClientBuilder<C>,
C: Clone + Send + Sync,
C: Clone + Send,
{
pub async fn with_token_source<S: AsRef<str>>(
builder: B,
Expand Down Expand Up @@ -79,14 +79,14 @@ where
#[derive(Clone)]
pub struct GoogleApiClientBuilderFunction<C>
where
C: Clone + Send + Sync,
C: Clone + Send,
{
f: fn(GoogleAuthMiddlewareService<Channel>) -> C,
}

impl<C> GoogleApiClientBuilder<C> for GoogleApiClientBuilderFunction<C>
where
C: Clone + Send + Sync,
C: Clone + Send,
{
fn create_client(&self, channel: GoogleAuthMiddlewareService<Channel>) -> C {
(self.f)(channel)
Expand All @@ -95,7 +95,7 @@ where

impl<C> GoogleApiClient<GoogleApiClientBuilderFunction<C>, C>
where
C: Clone + Send + Sync,
C: Clone + Send,
{
pub async fn from_function<S: AsRef<str>>(
builder_fn: fn(GoogleAuthMiddlewareService<Channel>) -> C,
Expand Down
4 changes: 2 additions & 2 deletions gcloud-sdk/src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ where
T: GrpcService<RequestBody> + Send + Clone + 'static,
T::Future: 'static + Send,
RequestBody: 'static + Send,
T::ResponseBody: 'static + Send + Sync,
T::Error: 'static + Send + Sync,
T::ResponseBody: 'static + Send,
T::Error: 'static + Send,
{
type Response = hyper::Response<T::ResponseBody>;
type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
Expand Down
29 changes: 9 additions & 20 deletions gcloud-sdk/src/proto_ext/kms.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use bytes::{Buf, BufMut};
use crate::google::cloud::kms::v1::ProtectionLevel;
use secret_vault_value::SecretValue;

Expand Down Expand Up @@ -82,10 +83,7 @@ pub struct EncryptRequest {

impl prost::Message for EncryptRequest {
#[allow(unused_variables)]
fn encode_raw<B>(&self, buf: &mut B)
where
B: ::prost::bytes::BufMut,
{
fn encode_raw(&self, buf: &mut impl BufMut) {
if self.name != "" {
::prost::encoding::string::encode(1u32, &self.name, buf);
}
Expand All @@ -103,16 +101,13 @@ impl prost::Message for EncryptRequest {
}
}
#[allow(unused_variables)]
fn merge_field<B>(
fn merge_field(
&mut self,
tag: u32,
wire_type: ::prost::encoding::WireType,
buf: &mut B,
buf: &mut impl Buf,
ctx: ::prost::encoding::DecodeContext,
) -> ::core::result::Result<(), ::prost::DecodeError>
where
B: ::prost::bytes::Buf,
{
) -> ::core::result::Result<(), ::prost::DecodeError> {
const STRUCT_NAME: &str = "EncryptRequest";
match tag {
1u32 => {
Expand Down Expand Up @@ -239,10 +234,7 @@ pub struct DecryptResponse {

impl prost::Message for DecryptResponse {
#[allow(unused_variables)]
fn encode_raw<B>(&self, buf: &mut B)
where
B: ::prost::bytes::BufMut,
{
fn encode_raw(&self, buf: &mut impl BufMut) {
if !self.plaintext.ref_sensitive_value().is_empty() {
::prost::encoding::bytes::encode(1u32, self.plaintext.ref_sensitive_value(), buf);
}
Expand All @@ -257,16 +249,13 @@ impl prost::Message for DecryptResponse {
}
}
#[allow(unused_variables)]
fn merge_field<B>(
fn merge_field(
&mut self,
tag: u32,
wire_type: ::prost::encoding::WireType,
buf: &mut B,
buf: &mut impl Buf,
ctx: ::prost::encoding::DecodeContext,
) -> ::core::result::Result<(), ::prost::DecodeError>
where
B: ::prost::bytes::Buf,
{
) -> ::core::result::Result<(), ::prost::DecodeError> {
const STRUCT_NAME: &str = "DecryptResponse";
match tag {
1u32 => ::prost::encoding::bytes::merge(
Expand Down
6 changes: 3 additions & 3 deletions gcloud-sdk/src/token_source/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ pub async fn create_source(
TokenSourceType::Json(json) => Ok(from_json(json.as_bytes(), &token_scopes)?.into()),
TokenSourceType::File(path) => Ok(from_file(path, &token_scopes)?.into()),
TokenSourceType::MetadataServer => {
if let Some(src) = from_metadata(&token_scopes, "default").await? {
if let Some(src) = from_metadata(&token_scopes, "default".to_string()).await? {
Ok(src.into())
} else {
Err(crate::error::ErrorKind::TokenSource.into())
}
}
TokenSourceType::MetadataServerWithAccount(account) => {
if let Some(src) = from_metadata(&token_scopes, &account).await? {
if let Some(src) = from_metadata(&token_scopes, account).await? {
Ok(src.into())
} else {
Err(crate::error::ErrorKind::TokenSource.into())
Expand All @@ -68,7 +68,7 @@ pub async fn find_default(token_scopes: &[String]) -> crate::error::Result<BoxSo
debug!("Creating token based on standard config files such as application_default_credentials.json");
return Ok(src.into());
}
if let Some(src) = from_metadata(token_scopes, "default").await? {
if let Some(src) = from_metadata(token_scopes, "default".to_string()).await? {
debug!("Creating token based on metadata server");
return Ok(src.into());
}
Expand Down

0 comments on commit c62ff30

Please sign in to comment.