google_cloud_storage/lib.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Google Cloud Client Libraries for Rust - Storage
16//!
17//! This crate contains traits, types, and functions to interact with [Google
18//! Cloud Storage]. Most applications will use the structs defined in the
19//! [client] module. More specifically:
20//!
21//! * [Storage][client::Storage]
22//! * [StorageControl][client::StorageControl]
23//! * [SignedUrlBuilder][builder::storage::SignedUrlBuilder]
24//!
25//! **NOTE:** This crate used to contain a different implementation, with a
26//! different surface. [@yoshidan](https://github.com/yoshidan) generously
27//! donated the crate name to Google. Their crate continues to live as
28//! [gcloud-storage].
29//!
30//! # Features
31//!
32//! - `default-rustls-provider`: enabled by default. Use the default rustls crypto
33//! provider ([aws-lc-rs]) for TLS and authentication. Applications with specific
34//! requirements for cryptography (such as exclusively using the [ring] crate)
35//! should disable this default and call
36//! `rustls::crypto::CryptoProvider::install_default()`.
37//! - `unstable-stream`: enable the (unstable) features to convert several types to
38//! a `future::Stream`.
39//!
40//! [aws-lc-rs]: https://crates.io/crates/aws-lc-rs
41//! [gcloud-storage]: https://crates.io/crates/gcloud-storage
42//! [Google Cloud Storage]: https://cloud.google.com/storage
43//! [ring]: https://crates.io/crates/ring
44
45pub use gax::Result;
46pub use gax::error::Error;
47
48pub mod backoff_policy;
49pub mod object_descriptor;
50pub mod read_object;
51pub mod read_resume_policy;
52pub mod retry_policy;
53pub mod signed_url;
54pub use crate::storage::request_options;
55pub use crate::storage::streaming_source;
56
57/// Re-export types from the `http` crate used in this module.
58pub mod http {
59 /// HTTP method used by the [SignedUrlBuilder][crate::builder::storage::SignedUrlBuilder].
60 pub use http::Method;
61
62 /// Metadata attributes used by the [Client::open_object][crate::client::Storage::open_object].
63 pub use http::HeaderMap;
64}
65
66mod control;
67mod storage;
68
69pub mod client {
70 //! Clients to interact with Google Cloud Storage.
71 pub use crate::control::client::StorageControl;
72 pub use crate::storage::client::Storage;
73}
74pub mod builder {
75 //! Request builders.
76 pub mod storage {
77 //! Request builders for [Storage][crate::client::Storage].
78 pub use crate::storage::client::ClientBuilder;
79 pub use crate::storage::open_object::OpenObject;
80 pub use crate::storage::read_object::ReadObject;
81 pub use crate::storage::signed_url::SignedUrlBuilder;
82 pub use crate::storage::write_object::WriteObject;
83 }
84 pub mod storage_control {
85 //! Request builders for [StorageControl][crate::client::StorageControl].
86 pub use crate::control::builder::*;
87 pub use crate::control::client::ClientBuilder;
88 }
89}
90pub mod error;
91/// The messages and enums that are part of this client library.
92pub use crate::control::model;
93pub mod builder_ext;
94pub mod model_ext;
95pub mod stub {
96 //! Traits to mock the clients in this library.
97 //!
98 //! Application developers may need to mock the clients in this library to test
99 //! how their application works with different (and sometimes hard to trigger)
100 //! client and service behavior. Such test can define mocks implementing the
101 //! trait(s) defined in this module, initialize the client with an instance of
102 //! this mock in their tests, and verify their application responds as expected.
103 pub use crate::control::stub::*;
104 pub use crate::storage::stub::*;
105 pub use crate::storage::transport::Storage as DefaultStorage;
106}
107
108#[allow(dead_code)]
109pub(crate) mod generated;
110
111#[allow(dead_code)]
112pub(crate) mod google {
113 pub mod iam {
114 pub mod v1 {
115 include!("generated/protos/storage/google.iam.v1.rs");
116 include!("generated/convert/iam/convert.rs");
117 }
118 }
119 pub mod longrunning {
120 include!("generated/protos/control/google.longrunning.rs");
121 include!("generated/convert/longrunning/convert.rs");
122 }
123 pub mod r#type {
124 include!("generated/protos/storage/google.r#type.rs");
125 include!("generated/convert/type/convert.rs");
126 }
127 pub mod rpc {
128 include!("generated/protos/storage/google.rpc.rs");
129 }
130 pub mod storage {
131 #[allow(deprecated)]
132 #[allow(clippy::large_enum_variant)]
133 pub mod v2 {
134 include!("generated/protos/storage/google.storage.v2.rs");
135 include!("generated/convert/storage/convert.rs");
136 }
137 pub mod control {
138 pub mod v2 {
139 include!("generated/protos/control/google.storage.control.v2.rs");
140 include!("generated/convert/control/convert.rs");
141 }
142 }
143 }
144}