/// <summary> /// Generates the resource. /// </summary> /// <param name="connectionString">Optional connection string for the resource.</param> /// <param name="parameters">The resource parameters.</param> /// <returns>Returns the resource.</returns> public override ResourceToken CreateResourceToken(string connectionString, ResourceParameters parameters) { if (string.IsNullOrWhiteSpace(connectionString)) { throw new ArgumentException("connectionString is invalid"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } BlobParameters blobParameters = parameters as BlobParameters; if (blobParameters == null) { throw new ArgumentException("Expected a BlobParameters collection", "parameters"); } if (string.IsNullOrWhiteSpace(blobParameters.Container)) { throw new ArgumentException("The container name must not be null or empty", "parameters.Container"); } if (string.IsNullOrWhiteSpace(blobParameters.Name)) { throw new ArgumentException("The blob name must not be null or empty", "parameters.Name"); } StorageProvider storageProvider = new StorageProvider(connectionString); return storageProvider.CreateBlobAccessToken(blobParameters.Container, blobParameters.Name, blobParameters.Permissions, blobParameters.Expiration); }
/// <summary> /// Generates the resource. /// </summary> /// <param name="connectionString">Optional connection string for the resource.</param> /// <param name="parameters">The resource parameters.</param> /// <returns>Returns the resource.</returns> public override ResourceToken CreateResourceToken(string connectionString, ResourceParameters parameters) { if (string.IsNullOrWhiteSpace(connectionString)) { throw new ArgumentException("connectionString is invalid"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } ResourceParameters queueParameters = parameters; if (string.IsNullOrWhiteSpace(queueParameters.Name)) { throw new ArgumentException("The queue name must not be null or empty", "parameters.Name"); } StorageProvider storageProvider = new StorageProvider(connectionString); return storageProvider.CreateQueueAccessToken(queueParameters.Name, queueParameters.Permissions, queueParameters.Expiration); }