Class UrlSigner.Options (3.4.0)

public sealed class Options

Options for the UrlSigner. Options can be duration or expiration based regarding the validity of the signed URL.

Inheritance

System.Object > UrlSigner.Options

Namespace

Google.Cloud.Storage.V1

Assembly

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
TypeDescription
System.String
Remarks

When using V2 bucket bound host names are not supported and Sign(UrlSigner.RequestTemplate, UrlSigner.Options) and SignAsync(UrlSigner.RequestTemplate, UrlSigner.Options, CancellationToken) will throw System.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
TypeDescription
System.Nullable<System.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
TypeDescription
System.Nullable<System.DateTimeOffset>

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) then https will be used. Defaults to https.

Property Value
TypeDescription
System.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
TypeDescription
SigningVersion

UrlStyle

public UrlSigner.UrlStyle UrlStyle { get; }

The style of signed URL to generate. Defaults to PathStyle.

Property Value
TypeDescription
UrlSigner.UrlStyle
Remarks

When using V2 only PathStyle and VirtualHostedStyle are supported and Sign(UrlSigner.RequestTemplate, UrlSigner.Options) and SignAsync(UrlSigner.RequestTemplate, UrlSigner.Options, CancellationToken) will throw System.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
NameDescription
durationSystem.TimeSpan

The duration to create these options with.

Returns
TypeDescription
UrlSigner.Options

A new options set.

FromExpiration(DateTimeOffset)

public static UrlSigner.Options FromExpiration(DateTimeOffset expiration)

Creates a new UrlSigner.Options from the given expiration.

Parameter
NameDescription
expirationSystem.DateTimeOffset

The expiration to create these options with.

Returns
TypeDescription
UrlSigner.Options

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
NameDescription
bucketBoundHostnameSystem.String

The new bucket bound domain.

Returns
TypeDescription
UrlSigner.Options

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
NameDescription
durationSystem.TimeSpan

The new duration.

Returns
TypeDescription
UrlSigner.Options

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
NameDescription
expirationSystem.DateTimeOffset

The new expiration.

Returns
TypeDescription
UrlSigner.Options

A new set of options with the given expiration.

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
NameDescription
schemeSystem.String

The new scheme. May be null in which case https will be used.

Returns
TypeDescription
UrlSigner.Options

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
NameDescription
versionSigningVersion

The new signing version.

Returns
TypeDescription
UrlSigner.Options

A set of options with the given signing version.

WithUrlStyle(UrlSigner.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.

Parameter
NameDescription
urlStyleUrlSigner.UrlStyle

The new url style.

Returns
TypeDescription
UrlSigner.Options

A new set ofoptions with the given url style.