Class UrlSigner.PostPolicy (3.4.0)

public sealed class PostPolicy

Represents an unsigned post policy. It needs to be signed with Sign(UrlSigner.PostPolicy, UrlSigner.Options) before it is used to enforced policies when posting objects via form.

Inheritance

System.Object > UrlSigner.PostPolicy

Namespace

Google.Cloud.Storage.V1

Assembly

Google.Cloud.Storage.V1.dll

Properties

Bucket

public string Bucket { get; }

Bucket name explicitly enforced by this policy, that is, if Google.Cloud.Storage.V1.UrlSigner.PostPolicy.SetField``2(``0,``1) has been called for BucketName. Otherwise, for instance, if the bucket name was specified as part of the Key element, this will return null.

Property Value
TypeDescription
System.String

Fields

public IReadOnlyDictionary<string, object> Fields { get; }

Collection of fields as defined by this policy. Post requests enforced by this policy should set, for each pair in this sequence, the given element to the exact given value.

Property Value
TypeDescription
System.Collections.Generic.IReadOnlyDictionary<System.String, System.Object>

Methods

ForBucketAndKey(String, String)

public static UrlSigner.PostPolicy ForBucketAndKey(string bucketName, string exactKeyValue)

Creates a new UrlSigner.PostPolicy instance which sets the BucketName and requires an exact match for the Google.Cloud.Storage.V1.UrlSigner.Key element.

Parameters
NameDescription
bucketNameSystem.String

The exact value for the bucket name.

exactKeyValueSystem.String

The value to match against. Must not be null.

Returns
TypeDescription
UrlSigner.PostPolicy

A new UrlSigner.PostPolicy instance.

ForBucketAndKeyStartsWith(String, String)

public static UrlSigner.PostPolicy ForBucketAndKeyStartsWith(string bucketName, string keyPrefix)

Creates a new UrlSigner.PostPolicy instance which sets the BucketName and requires a starts-with match for the Key element.

Parameters
NameDescription
bucketNameSystem.String

The exact value for the bucket name.

keyPrefixSystem.String

The value to match against. Must not be null.

Returns
TypeDescription
UrlSigner.PostPolicy

A new UrlSigner.PostPolicy instance.

SetCustomField<TValue>(UrlSigner.PostPolicyCustomElement, String, TValue, Func<TValue, Object>)

public void SetCustomField<TValue>(UrlSigner.PostPolicyCustomElement element, string elementName, TValue value, Func<TValue, object> valueToObject = null)

Sets a required field value for element of name elementName. If any condition existed on this instance for element of name elementName it will be overriden with this required field value.

Parameters
NameDescription
elementUrlSigner.PostPolicyCustomElement

The element for which to set a required field value.

elementNameSystem.String

The custom element name.

valueTValue

The value to set the element to.

valueToObjectSystem.Func<TValue, System.Object>

The function to convert value to the representation which with it should be included in the policy. May be null in which case TValue ToString() will be used.

Type Parameter
NameDescription
TValue

The type of the value to set the element to.

SetCustomStartsWith(UrlSigner.PostPolicyCustomElement, String, String)

public void SetCustomStartsWith(UrlSigner.PostPolicyCustomElement element, string elementName, string prefix)

Sets a starts-with condition for element of name elementName. If any condition existed on this instance for element of name elementName it will be overriden with this starts-with condition.

Parameters
NameDescription
elementUrlSigner.PostPolicyCustomElement

The element for which to set an starts-with condition.

elementNameSystem.String

The custom element name.

prefixSystem.String

The prefix to validate against.

SetField<TValue>(UrlSigner.PostPolicyStandardElement, TValue)

public void SetField<TValue>(UrlSigner.PostPolicyStandardElement element, TValue value)

Sets a required field value for element. If any condition existed on this instance for element it will be overriden with this required field value.

Parameters
NameDescription
elementUrlSigner.PostPolicyStandardElement

The element for which to set a required field value.

valueTValue

The value to set the element to.

Type Parameter
NameDescription
TValue

The type of the value to set the element to.

SetRange<TValue>(UrlSigner.PostPolicyStandardElement, TValue, TValue)

public void SetRange<TValue>(UrlSigner.PostPolicyStandardElement element, TValue min, TValue max)
    where TValue : IComparable

Sets a range condition for element. If any condition existed on this instance for element it will be overriden with this range condition.

Parameters
NameDescription
elementUrlSigner.PostPolicyStandardElement

The element for which to set a range condition.

minTValue

The range lower bound.

maxTValue

The range upper bound.

Type Parameter
NameDescription
TValue

The type of the values defining the range.

SetStartsWith(UrlSigner.PostPolicyStandardElement, String)

public void SetStartsWith(UrlSigner.PostPolicyStandardElement element, string prefix)

Sets a starts-with condition for element. If any condition existed on this instance for element it will be overriden with this starts-with condition.

Parameters
NameDescription
elementUrlSigner.PostPolicyStandardElement

The element for which to set an starts-with condition.

prefixSystem.String

The prefix to validate against.