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
49#![allow(unexpected_cfgs)]
50mod apis;
51pub use apis::*;
52
53pub mod error;
54mod token_source;
55pub use token_source::auth_token_generator::GoogleAuthTokenGenerator;
56pub use token_source::metadata::Metadata as GceMetadataClient;
57pub use token_source::{BoxSource, ExternalJwtFunctionSource, Source, Token, TokenSourceType};
58
59mod api_client;
60pub use api_client::*;
61
62mod middleware;
63
64pub mod proto_ext;
65
66#[cfg(feature = "rest")]
67mod rest_apis;
68
69#[cfg(feature = "rest")]
70pub use rest_apis::*;
71
72pub const GCLOUD_SDK_USER_AGENT: &str = concat!("gcloud-sdk-rs/v", env!("CARGO_PKG_VERSION"));
73
74// Re-exports
75pub use prost;
76pub use prost_types;
77pub use secret_vault_value::SecretValue;
78pub use tonic;