C# Class Candor.WindowsAzure.Storage.Blob.CloudBlobRules

Helper methods to convert a string into valid blob key values.
Show file Open project: michael-lang/candor-common

Public Methods

Method Description
GetValidBlobContainerName ( this name ) : String

Gets a valid azure identifier for blob container names by trimming out invalid characters, and changing to lower case. If the name is still invalid, then an exception occurs. See remarks for naming rules.

A blob container name must start with a letter or number, and can only contain letters, numbers, and the dash (-) character. The first and last letters in the container name must be alphanumeric. The dash (-) character cannot be the first or last character. Consecutive dash characters are not permitted in the container name. All letters in a container name must be lowercase. A container name must be from 3 to 63 characters long.

GetValidBlobName ( this name, bool strict = false ) : String

Gets a valid blob name by removing excess slashes and dots. If the name is still invalid, then an exception occurs. See remarks for naming rules.

A blob name can contain any combination of characters, but reserved URL characters must be properly escaped. A blob name must be at least one character long and cannot be more than 1,024 characters long. Blob names are case-sensitive. Avoid names the end with a dot (.), o forward slash (/), or a sequence or combination of the two.

Method Details

GetValidBlobContainerName() public static method

Gets a valid azure identifier for blob container names by trimming out invalid characters, and changing to lower case. If the name is still invalid, then an exception occurs. See remarks for naming rules.
A blob container name must start with a letter or number, and can only contain letters, numbers, and the dash (-) character. The first and last letters in the container name must be alphanumeric. The dash (-) character cannot be the first or last character. Consecutive dash characters are not permitted in the container name. All letters in a container name must be lowercase. A container name must be from 3 to 63 characters long.
public static GetValidBlobContainerName ( this name ) : String
name this
return String

GetValidBlobName() public static method

Gets a valid blob name by removing excess slashes and dots. If the name is still invalid, then an exception occurs. See remarks for naming rules.
A blob name can contain any combination of characters, but reserved URL characters must be properly escaped. A blob name must be at least one character long and cannot be more than 1,024 characters long. Blob names are case-sensitive. Avoid names the end with a dot (.), o forward slash (/), or a sequence or combination of the two.
public static GetValidBlobName ( this name, bool strict = false ) : String
name this
strict bool Specifies if an exception is thrown if the cleaned up name would need url encoding to be stored.
return String