Expand description
§Google Cloud SDK for Rust
Library provides all available APIs generated based:
- on proto interfaces for gRPC;
- OpenAPI spec for REST APIs not available as gRPC;
The library also provides and easy-to-use client API for both gRPC and REST, that supports Google Authentication natively.
§gRPC example
ⓘ
let firestore_client: GoogleApi<FirestoreClient<GoogleAuthMiddleware>> =
GoogleApi::from_function(
FirestoreClient::new,
"https://firestore.googleapis.com",
// cloud resource prefix: used only for some of the APIs (such as Firestore)
Some(cloud_resource_prefix.clone()),
)
.await?;
let response = firestore_client
.get()
.list_documents(tonic::Request::new(ListDocumentsRequest {
parent: format!("{}/documents", cloud_resource_prefix),
..Default::default()
}))
.await?;
§REST example
ⓘ
let google_rest_client = gcloud_sdk::GoogleRestApi::new().await?;
let response = gcloud_sdk::google_rest_apis::storage::buckets_api::storage_buckets_list(
&google_rest_client.create_google_storage_config().await?,
gcloud_sdk::google_rest_apis::storage::buckets_api::StoragePeriodBucketsPeriodListParams {
project: google_project_id,
..Default::default()
}
).await?;
Complete examples available on github.
Re-exports§
pub use prost;
pub use prost_types;
pub use tonic;
Modules§
Structs§
- External
JwtFunction Source - GceMetadata
Client - Google
ApiClient - Google
ApiClient Builder Function - Google
Auth Token Generator - Google
Environment - Google
Rest Api - Secret
Value - Token