Esempio n. 1
0
        /// <summary>
        /// Ensure the <see cref="BlobSasBuilder"/>'s properties are in a
        /// consistent state.
        /// </summary>
        private void EnsureState()
        {
            // Container
            if (String.IsNullOrEmpty(this.BlobName))
            {
                // Make sure the permission characters are in the correct order
                this.Permissions = ContainerSasPermissions.Parse(this.Permissions).ToString();
                this.Resource    = Constants.Sas.Resource.Container;
            }

            // Blob or Snapshot
            else
            {
                // Blob
                if (String.IsNullOrEmpty(this.Snapshot))
                {
                    // Make sure the permission characters are in the correct order
                    this.Permissions = BlobSasPermissions.Parse(this.Permissions).ToString();
                    this.Resource    = Constants.Sas.Resource.Blob;
                }
                // Snapshot
                else
                {
                    // Make sure the permission characters are in the correct order
                    this.Permissions = SnapshotSasPermissions.Parse(this.Permissions).ToString();
                    this.Resource    = Constants.Sas.Resource.BlobSnapshot;
                }
            }
            if (String.IsNullOrEmpty(this.Version))
            {
                this.Version = SasQueryParameters.DefaultSasVersion;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Sets the permissions for a Snapshot SAS.
 /// </summary>
 /// <param name="permissions">
 /// <see cref="SnapshotSasPermissions"/> containing the allowed permissions.
 /// </param>
 public void SetPermissions(SnapshotSasPermissions permissions)
 {
     Permissions = permissions.ToPermissionsString();
 }