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//! [gcloud-storage]: https://crates.io/crates/gcloud-storage
31//! [Google Cloud Storage]: https://cloud.google.com/storage
32
33pub use gax::Result;
34pub use gax::error::Error;
35
36pub mod backoff_policy;
37pub mod object_descriptor;
38pub mod read_object;
39pub mod read_resume_policy;
40pub mod retry_policy;
41pub mod signed_url;
42pub use crate::storage::request_options;
43pub use crate::storage::streaming_source;
44
45/// Re-export types from the `http` crate used in this module.
46pub mod http {
47 /// HTTP method used by the [SignedUrlBuilder][crate::builder::storage::SignedUrlBuilder].
48 pub use http::Method;
49
50 /// Metadata attributes used by the [Client::open_object][crate::client::Storage::open_object].
51 pub use http::HeaderMap;
52}
53
54mod control;
55mod storage;
56
57pub mod client {
58 //! Clients to interact with Google Cloud Storage.
59 pub use crate::control::client::StorageControl;
60 pub use crate::storage::client::Storage;
61}
62pub mod builder {
63 //! Request builders.
64 pub mod storage {
65 //! Request builders for [Storage][crate::client::Storage].
66 pub use crate::storage::client::ClientBuilder;
67 pub use crate::storage::open_object::OpenObject;
68 pub use crate::storage::read_object::ReadObject;
69 pub use crate::storage::signed_url::SignedUrlBuilder;
70 pub use crate::storage::write_object::WriteObject;
71 }
72 pub mod storage_control {
73 //! Request builders for [StorageControl][crate::client::StorageControl].
74 pub use crate::control::builder::*;
75 pub use crate::control::client::ClientBuilder;
76 }
77}
78pub mod error;
79/// The messages and enums that are part of this client library.
80pub use crate::control::model;
81pub mod builder_ext;
82pub mod model_ext;
83pub mod stub {
84 //! Traits to mock the clients in this library.
85 //!
86 //! Application developers may need to mock the clients in this library to test
87 //! how their application works with different (and sometimes hard to trigger)
88 //! client and service behavior. Such test can define mocks implementing the
89 //! trait(s) defined in this module, initialize the client with an instance of
90 //! this mock in their tests, and verify their application responds as expected.
91 pub use crate::control::stub::*;
92 pub use crate::storage::stub::*;
93 pub use crate::storage::transport::Storage as DefaultStorage;
94}
95
96#[allow(dead_code)]
97pub(crate) mod generated;
98
99#[allow(dead_code)]
100pub(crate) mod google {
101 pub mod iam {
102 pub mod v1 {
103 include!("generated/protos/storage/google.iam.v1.rs");
104 include!("generated/convert/iam/convert.rs");
105 }
106 }
107 pub mod longrunning {
108 include!("generated/protos/control/google.longrunning.rs");
109 include!("generated/convert/longrunning/convert.rs");
110 }
111 pub mod r#type {
112 include!("generated/protos/storage/google.r#type.rs");
113 include!("generated/convert/type/convert.rs");
114 }
115 pub mod rpc {
116 include!("generated/protos/storage/google.rpc.rs");
117 }
118 pub mod storage {
119 #[allow(deprecated)]
120 #[allow(clippy::large_enum_variant)]
121 pub mod v2 {
122 include!("generated/protos/storage/google.storage.v2.rs");
123 include!("generated/convert/storage/convert.rs");
124 }
125 pub mod control {
126 pub mod v2 {
127 include!("generated/protos/control/google.storage.control.v2.rs");
128 include!("generated/convert/control/convert.rs");
129 }
130 }
131 }
132}