pub struct SignedURLOptions {
    pub google_access_id: String,
    pub sign_by: SignBy,
    pub method: SignedURLMethod,
    pub expires: Duration,
    pub content_type: Option<String>,
    pub headers: Vec<String>,
    pub query_parameters: HashMap<String, Vec<String>>,
    pub md5: Option<String>,
    pub style: Box<dyn URLStyle + Send + Sync>,
    pub insecure: bool,
    pub scheme: SigningScheme,
}
Expand description

SignedURLOptions allows you to restrict the access to the signed URL.

Fields

google_access_id: String

GoogleAccessID represents the authorizer of the signed URL generation. It is typically the Google service account client email address from the Google Developers Console in the form of “xxx@developer.gserviceaccount.com”. Required.

sign_by: SignBy

PrivateKey is the Google service account private key. It is obtainable from the Google Developers Console. At https://console.developers.google.com/project//apiui/credential, create a service account client ID or reuse one of your existing service account credentials. Click on the “Generate new P12 key” to generate and download a new private key. Once you download the P12 file, use the following command to convert it into a PEM file.

$ openssl pkcs12 -in key.p12 -passin pass:notasecret -out key.pem -nodes

Provide the contents of the PEM file as a byte slice. Exactly one of PrivateKey or SignBytes must be non-nil.

SignBytes is a function for implementing custom signing.

method: SignedURLMethod

Method is the HTTP method to be used with the signed URL. Signed URLs can be used with GET, HEAD, PUT, and DELETE requests. Required.

expires: Duration

Expires is the expiration time on the signed URL. It must be a datetime in the future. For SigningSchemeV4, the expiration may be no more than seven days in the future. Required.

content_type: Option<String>

ContentType is the content type header the client must provide to use the generated signed URL. Optional.

headers: Vec<String>

Headers is a list of extension headers the client must provide in order to use the generated signed URL. Each must be a string of the form “key:values”, with multiple values separated by a semicolon. Optional.

query_parameters: HashMap<String, Vec<String>>

QueryParameters is a map of additional query parameters. When SigningScheme is V4, this is used in computing the signature, and the client must use the same query parameters when using the generated signed URL. Optional.

md5: Option<String>

MD5 is the base64 encoded MD5 checksum of the file. If provided, the client should provide the exact value on the request header in order to use the signed URL. Optional.

style: Box<dyn URLStyle + Send + Sync>

Style provides options for the type of URL to use. Options are PathStyle (default), BucketBoundHostname, and VirtualHostedStyle. See https://cloud.google.com/storage/docs/request-endpoints for details. Only supported for V4 signing. Optional.

insecure: bool

Insecure determines whether the signed URL should use HTTPS (default) or HTTP. Only supported for V4 signing. Optional.

scheme: SigningScheme

Scheme determines the version of URL signing to use. Default is SigningSchemeV4.

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more