gcloud_sdk/
lib.rs

1//! # Google Cloud SDK for Rust
2//!
3//! Library provides all available APIs generated based:
4//! - on proto interfaces for gRPC;
5//! - OpenAPI spec for REST APIs not available as gRPC;
6//!
7//! The library also provides and easy-to-use client API for both gRPC and REST,
8//! that supports Google Authentication natively.
9//!
10//! ## gRPC example
11//! ```ignore
12//!
13//!     let firestore_client: GoogleApi<FirestoreClient<GoogleAuthMiddleware>> =
14//!        GoogleApi::from_function(
15//!            FirestoreClient::new,
16//!            "https://firestore.googleapis.com",
17//!            // cloud resource prefix: used only for some of the APIs (such as Firestore)
18//!            Some(cloud_resource_prefix.clone()),
19//!        )
20//!        .await?;
21//!
22//!     let response = firestore_client
23//!         .get()
24//!         .list_documents(tonic::Request::new(ListDocumentsRequest {
25//!             parent: format!("{}/documents", cloud_resource_prefix),
26//!             ..Default::default()
27//!         }))
28//!         .await?;
29//!
30//! ```
31//! ## REST example
32//! ```ignore
33//!
34//! let google_rest_client = gcloud_sdk::GoogleRestApi::new().await?;
35//!
36//! let response = gcloud_sdk::google_rest_apis::storage::buckets_api::storage_buckets_list(
37//!     &google_rest_client.create_google_storage_config().await?,
38//!     gcloud_sdk::google_rest_apis::storage::buckets_api::StoragePeriodBucketsPeriodListParams {
39//!         project: google_project_id,
40//!         ..Default::default()
41//!     }
42//! ).await?;
43//!
44//! ```
45//!
46//! Complete examples available on [github](https://github.com/abdolence/gcloud-sdk-rs/tree/master/src/examples).
47//!
48
49mod apis;
50pub use apis::*;
51
52pub mod error;
53mod token_source;
54pub use token_source::auth_token_generator::GoogleAuthTokenGenerator;
55pub use token_source::metadata::Metadata as GceMetadataClient;
56pub use token_source::{ExternalJwtFunctionSource, Token, TokenSourceType};
57
58mod api_client;
59pub use api_client::*;
60
61mod middleware;
62
63pub mod proto_ext;
64
65#[cfg(feature = "rest")]
66mod rest_apis;
67
68#[cfg(feature = "rest")]
69pub use rest_apis::*;
70
71pub const GCLOUD_SDK_USER_AGENT: &str = concat!("gcloud-sdk-rs/v", env!("CARGO_PKG_VERSION"));
72
73// Re-exports
74pub use prost;
75pub use prost_types;
76pub use secret_vault_value::SecretValue;
77pub use tonic;