public sealed class UrlSigner.Options
Reference documentation and code samples for the Google Cloud Storage v1 API class UrlSigner.Options.
Options for the UrlSigner. Options can be duration or expiration based regarding the validity of the signed URL.
Namespace
Google.Cloud.Storage.V1Assembly
Google.Cloud.Storage.V1.dll
Properties
BucketBoundHostname
public string BucketBoundHostname { get; }
A bucket bound host to use for generating the signed URL. If UrlStyle is BucketBoundHostname this won't be null. It will be null otherwise. Use WithBucketBoundHostname(string) to set.
Property Value | |
---|---|
Type | Description |
string |
When using V2 bucket bound host names are not supported and Sign(RequestTemplate, Options) and SignAsync(RequestTemplate, Options, CancellationToken) will throw ArgumentException if BucketBoundHostname is not null.
Duration
public TimeSpan? Duration { get; }
The length of time for which the signed URL should remain usable, counting from the moment the signed URL is created. Exactly one of Duration and Expiration will be set.
Property Value | |
---|---|
Type | Description |
TimeSpan |
Expiration
public DateTimeOffset? Expiration { get; }
The point in time after which the signed URL will be invalid. Exactly one of Duration and Expiration will be set.
Property Value | |
---|---|
Type | Description |
DateTimeOffset |
Host
public string Host { get; }
The host to use for generating the signed URL. This will never be null. If null is specified in WithHost(string) then the appropriate default value will be used. Will be ignored if UrlStyle is set to BucketBoundHostname.
Property Value | |
---|---|
Type | Description |
string |
Port
public int? Port { get; }
The port for the signed URL. The port is not included on the signature itself, only on the resulting signed URL. Defaults to null. Will be ignored if UrlStyle is set to BucketBoundHostname.
Property Value | |
---|---|
Type | Description |
int |
Scheme
public string Scheme { get; }
The Scheme to use for the request. Only http or https supported. This will never be null. If null is specified in WithScheme(string) an appropriate default value will be used.
Property Value | |
---|---|
Type | Description |
string |
SigningVersion
public SigningVersion SigningVersion { get; }
The signing version to use for generating the signed URL. This will default to Default which is currently the same as V4.
Property Value | |
---|---|
Type | Description |
SigningVersion |
UrlStyle
public UrlSigner.UrlStyle UrlStyle { get; }
The style of signed URL to generate. Defaults to PathStyle.
Property Value | |
---|---|
Type | Description |
UrlSignerUrlStyle |
When using V2 only PathStyle and VirtualHostedStyle are supported and Sign(RequestTemplate, Options) and SignAsync(RequestTemplate, Options, CancellationToken) will throw ArgumentException if UrlStyle is other than one of these two values.
Methods
FromDuration(TimeSpan)
public static UrlSigner.Options FromDuration(TimeSpan duration)
Creates a new UrlSigner.Options from the given duration.
Parameter | |
---|---|
Name | Description |
duration | TimeSpan The duration to create these options with. |
Returns | |
---|---|
Type | Description |
UrlSignerOptions | A new options set. |
FromExpiration(DateTimeOffset)
public static UrlSigner.Options FromExpiration(DateTimeOffset expiration)
Creates a new UrlSigner.Options from the given expiration.
Parameter | |
---|---|
Name | Description |
expiration | DateTimeOffset The expiration to create these options with. |
Returns | |
---|---|
Type | Description |
UrlSignerOptions | A new options set. |
WithBucketBoundHostname(string)
public UrlSigner.Options WithBucketBoundHostname(string bucketBoundHostname)
Returns a new set of options with the same values as this one except for bucket bound domain and the url style which will be set to BucketBoundHostname.
Parameter | |
---|---|
Name | Description |
bucketBoundHostname | string The new bucket bound domain. |
Returns | |
---|---|
Type | Description |
UrlSignerOptions | A new set of options with the given bucket bound domain and the url style set to BucketBoundHostname. |
WithDuration(TimeSpan)
public UrlSigner.Options WithDuration(TimeSpan duration)
Returns a new set of options with the same values as this one but duration based.
Parameter | |
---|---|
Name | Description |
duration | TimeSpan The new duration. |
Returns | |
---|---|
Type | Description |
UrlSignerOptions | A new set of options with the given duration. |
WithExpiration(DateTimeOffset)
public UrlSigner.Options WithExpiration(DateTimeOffset expiration)
Returns a new set of options with the same values as this one but expiration based.
Parameter | |
---|---|
Name | Description |
expiration | DateTimeOffset The new expiration. |
Returns | |
---|---|
Type | Description |
UrlSignerOptions | A new set of options with the given expiration. |
WithHost(string)
public UrlSigner.Options WithHost(string host)
Returns a new set of options with the same values as this one except for the host.
Parameter | |
---|---|
Name | Description |
host | string The new host. May be null in which case DefaultStorageHost will be used. |
Returns | |
---|---|
Type | Description |
UrlSignerOptions | A new set of options with the given host. |
WithPort(int?)
public UrlSigner.Options WithPort(int? port)
Returns a new set of options with the same values as this one except for the port.
Parameter | |
---|---|
Name | Description |
port | int The new port. May be null. |
Returns | |
---|---|
Type | Description |
UrlSignerOptions | A new set of options with the given host. |
WithScheme(string)
public UrlSigner.Options WithScheme(string scheme)
Returns a new set of options with the same values as this one except for the scheme.
Parameter | |
---|---|
Name | Description |
scheme | string The new scheme. May be null in which case https will be used. |
Returns | |
---|---|
Type | Description |
UrlSignerOptions | A new set of options with the given scheme. |
WithSigningVersion(SigningVersion)
public UrlSigner.Options WithSigningVersion(SigningVersion version)
Returns a new set of options with the same values as this one except for the signing version.
Parameter | |
---|---|
Name | Description |
version | SigningVersion The new signing version. |
Returns | |
---|---|
Type | Description |
UrlSignerOptions | A set of options with the given signing version. |
WithUrlStyle(UrlStyle)
public UrlSigner.Options WithUrlStyle(UrlSigner.UrlStyle urlStyle)
Returns a new set of options with the same values as this one except for the UrlStyle value and BucketBoundHostname set to null.
Parameter | |
---|---|
Name | Description |
urlStyle | UrlSignerUrlStyle The new url style. |
Returns | |
---|---|
Type | Description |
UrlSignerOptions | A new set ofoptions with the given url style. |
Use WithBucketBoundHostname(string) to set BucketBoundHostname.