Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/storage/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,13 @@ pub enum WriteError {

type BoxError = Box<dyn std::error::Error + Send + Sync + 'static>;

/// Signed URL creation errors.
/// Signed URL and signed POST policy creation errors.
#[derive(thiserror::Error, Debug)]
#[error(transparent)]
pub struct SigningError(SigningErrorKind);

impl SigningError {
/// Returns true if the error was due to a problem signing the URL.
/// Returns true if the error was due to a problem signing the request.
pub fn is_signing(&self) -> bool {
matches!(self.0, SigningErrorKind::Signing(_))
}
Expand All @@ -288,15 +288,15 @@ impl SigningError {
matches!(self.0, SigningErrorKind::InvalidParameter(_, _))
}

/// A problem to sign the URL.
/// A problem to sign the request.
pub(crate) fn signing<T>(source: T) -> SigningError
where
T: Into<BoxError>,
{
SigningError(SigningErrorKind::Signing(source.into()))
}

/// A problem to sign the URL due to invalid input.
/// A problem to sign the request due to invalid input.
pub(crate) fn invalid_parameter<S: Into<String>, T>(field: S, source: T) -> SigningError
where
T: Into<BoxError>,
Expand All @@ -315,7 +315,7 @@ enum SigningErrorKind {
#[error("signing failed: {0}")]
Signing(#[source] BoxError),

/// An invalid input was provided to generate a signed URL.
/// An invalid input was provided to generate a signed URL or signed POST policy.
#[error("invalid `{0}` parameter: {1}")]
InvalidParameter(String, #[source] BoxError),
}
Expand Down
3 changes: 3 additions & 0 deletions src/storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
//! * [Storage][client::Storage]
//! * [StorageControl][client::StorageControl]
//! * [SignedUrlBuilder][builder::storage::SignedUrlBuilder]
//! * [PostPolicyV4Builder][builder::storage::PostPolicyV4Builder]
//!
//! **NOTE:** This crate used to contain a different implementation, with a
//! different surface. [@yoshidan](https://github.com/yoshidan) generously
Expand Down Expand Up @@ -58,6 +59,7 @@ pub(crate) use google_cloud_gax::response::Response;

pub mod backoff_policy;
pub mod object_descriptor;
pub mod post_policy_v4;
pub mod read_object;
pub mod read_resume_policy;
pub mod retry_policy;
Expand Down Expand Up @@ -96,6 +98,7 @@ pub mod builder {
//! Request builders for [Storage][crate::client::Storage].
pub use crate::storage::client::ClientBuilder;
pub use crate::storage::open_object::OpenObject;
pub use crate::storage::post_policy_v4::PostPolicyV4Builder;
pub use crate::storage::read_object::ReadObject;
pub use crate::storage::signed_url::SignedUrlBuilder;
pub use crate::storage::write_object::WriteObject;
Expand Down
19 changes: 19 additions & 0 deletions src/storage/src/post_policy_v4.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! Types related to signed V4 POST policies.
//!
//! See [PostPolicyV4Builder][crate::builder::storage::PostPolicyV4Builder].

pub use crate::storage::post_policy_v4::{PolicyV4Fields, PostPolicyV4, PostPolicyV4Condition};
1 change: 1 addition & 0 deletions src/storage/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub(crate) mod client;
pub(crate) mod common_options;
pub(crate) mod open_object;
pub(crate) mod perform_upload;
pub(crate) mod post_policy_v4;
pub(crate) mod read_object;
pub mod request_options;
pub(crate) mod signed_url;
Expand Down
Loading
Loading