in sdk/storage/Azure.Storage.Files.Shares/src/ShareClient.cs [2331:2739]
public virtual Response<ShareInfo> SetQuota(
int quotaInGB = default,
ShareFileRequestConditions conditions = default,
CancellationToken cancellationToken = default) =>
SetPropertiesInternal(
quotaInGB: quotaInGB,
accessTier: default,
rootSquash: default,
enableSnapshotVirtualDirectoryAccess: default,
enablePaidBursting: default,
paidBurstingMaxIops: default,
paidBurstingMaxBandwidthMibps: default,
provisionedMaxIops: default,
provisionedMaxBandwidthBandwidthMibps: default,
conditions: conditions,
operationName: $"{nameof(ShareClient)}.{nameof(SetQuota)}",
async: false,
cancellationToken)
.EnsureCompleted();
/// <summary>
/// Sets the maximum size of the share.
///
/// For more information, see
/// <see href="https://docs.microsoft.com/rest/api/storageservices/set-share-properties">
/// Set Share Properties</see>.
/// </summary>
/// <param name="quotaInGB">
/// Optional. The maximum size of the share.
/// If unspecified, use the service's default value.
/// </param>
/// <param name="conditions">
/// Optional <see cref="ShareFileRequestConditions"/> to add conditions
/// on setting the quota.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response{ShareInfo}"/> describing the updated
/// share.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// If multiple failures occur, an <see cref="AggregateException"/> will be thrown,
/// containing each failure instance.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual async Task<Response<ShareInfo>> SetQuotaAsync(
int quotaInGB = default,
ShareFileRequestConditions conditions = default,
CancellationToken cancellationToken = default) =>
await SetPropertiesInternal(
quotaInGB: quotaInGB,
accessTier: default,
rootSquash: default,
enableSnapshotVirtualDirectoryAccess: default,
enablePaidBursting: default,
paidBurstingMaxIops: default,
paidBurstingMaxBandwidthMibps: default,
provisionedMaxIops: default,
provisionedMaxBandwidthBandwidthMibps: default,
conditions: conditions,
operationName: $"{nameof(ShareClient)}.{nameof(SetQuota)}",
async: true,
cancellationToken)
.ConfigureAwait(false);
/// <summary>
/// Sets the maximum size of the share.
///
/// For more information, see
/// <see href="https://docs.microsoft.com/rest/api/storageservices/set-share-properties">
/// Set Share Properties</see>.
/// </summary>
/// <param name="quotaInGB">
/// Optional. The maximum size of the share.
/// If unspecified, use the service's default value.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response{ShareInfo}"/> describing the updated
/// share.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// If multiple failures occur, an <see cref="AggregateException"/> will be thrown,
/// containing each failure instance.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
public virtual Response<ShareInfo> SetQuota(
#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
int quotaInGB,
CancellationToken cancellationToken) =>
SetPropertiesInternal(
quotaInGB: quotaInGB,
accessTier: default,
rootSquash: default,
enableSnapshotVirtualDirectoryAccess: default,
enablePaidBursting: default,
paidBurstingMaxIops: default,
paidBurstingMaxBandwidthMibps: default,
provisionedMaxIops: default,
provisionedMaxBandwidthBandwidthMibps: default,
conditions: default,
operationName: $"{nameof(ShareClient)}.{nameof(SetQuota)}",
async: false,
cancellationToken)
.EnsureCompleted();
/// <summary>
/// Sets the maximum size of the share.
///
/// For more information, see
/// <see href="https://docs.microsoft.com/rest/api/storageservices/set-share-properties">
/// Set Share Properties</see>.
/// </summary>
/// <param name="quotaInGB">
/// Optional. The maximum size of the share.
/// If unspecified, use the service's default value.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response{ShareInfo}"/> describing the updated
/// share.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// If multiple failures occur, an <see cref="AggregateException"/> will be thrown,
/// containing each failure instance.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
public virtual async Task<Response<ShareInfo>> SetQuotaAsync(
#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
int quotaInGB,
CancellationToken cancellationToken) =>
await SetPropertiesInternal(
quotaInGB: quotaInGB,
accessTier: default,
rootSquash: default,
enableSnapshotVirtualDirectoryAccess: default,
enablePaidBursting: default,
paidBurstingMaxIops: default,
paidBurstingMaxBandwidthMibps: default,
provisionedMaxIops: default,
provisionedMaxBandwidthBandwidthMibps: default,
conditions: default,
operationName: $"{nameof(ShareClient)}.{nameof(SetQuota)}",
async: true,
cancellationToken)
.ConfigureAwait(false);
#endregion SetQuota
#region SetMetadata
/// <summary>
/// The <see cref="SetMetadata(Metadata, ShareFileRequestConditions, CancellationToken)"/>
/// operation sets user-defined metadata for the specified share as one or more name-value pairs.
///
/// For more information, see
/// <see href="https://docs.microsoft.com/rest/api/storageservices/set-share-metadata">
/// Set Share Metadata</see>.
/// </summary>
/// <param name="metadata">
/// Custom metadata to set for this share.
/// </param>
/// <param name="conditions">
/// Optional <see cref="ShareFileRequestConditions"/> to add conditions
/// on setting share metadata.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response{ShareInfo}"/> describing the updated
/// share.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// If multiple failures occur, an <see cref="AggregateException"/> will be thrown,
/// containing each failure instance.
/// </remarks>
public virtual Response<ShareInfo> SetMetadata(
Metadata metadata,
ShareFileRequestConditions conditions = default,
CancellationToken cancellationToken = default) =>
SetMetadataInternal(
metadata,
conditions: conditions,
async: false,
cancellationToken)
.EnsureCompleted();
/// <summary>
/// The <see cref="SetMetadataAsync(Metadata, ShareFileRequestConditions, CancellationToken)"/>
/// operation sets user-defined metadata for the specified share as one or more name-value pairs.
///
/// For more information, see
/// <see href="https://docs.microsoft.com/rest/api/storageservices/set-share-metadata">
/// Set Share Metadata</see>.
/// </summary>
/// <param name="metadata">
/// Custom metadata to set for this share.
/// </param>
/// <param name="conditions">
/// Optional <see cref="ShareFileRequestConditions"/> to add conditions
/// on setting share metadata.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response{ShareInfo}"/> describing the updated
/// share.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// If multiple failures occur, an <see cref="AggregateException"/> will be thrown,
/// containing each failure instance.
/// </remarks>
public virtual async Task<Response<ShareInfo>> SetMetadataAsync(
Metadata metadata,
ShareFileRequestConditions conditions = default,
CancellationToken cancellationToken = default) =>
await SetMetadataInternal(
metadata,
conditions: conditions,
async: true,
cancellationToken)
.ConfigureAwait(false);
/// <summary>
/// The <see cref="SetMetadata(Metadata, CancellationToken)"/> operation sets user-defined
/// metadata for the specified share as one or more name-value pairs.
///
/// For more information, see
/// <see href="https://docs.microsoft.com/rest/api/storageservices/set-share-metadata">
/// Set Share Metadata</see>.
/// </summary>
/// <param name="metadata">
/// Custom metadata to set for this share.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response{ShareInfo}"/> describing the updated
/// share.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// If multiple failures occur, an <see cref="AggregateException"/> will be thrown,
/// containing each failure instance.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
public virtual Response<ShareInfo> SetMetadata(
#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
Metadata metadata,
CancellationToken cancellationToken) =>
SetMetadataInternal(
metadata,
conditions: default,
async: false,
cancellationToken)
.EnsureCompleted();
/// <summary>
/// The <see cref="SetMetadataAsync(Metadata, CancellationToken)"/> operation sets user-defined
/// metadata for the specified share as one or more name-value pairs.
///
/// For more information, see
/// <see href="https://docs.microsoft.com/rest/api/storageservices/set-share-metadata">
/// Set Share Metadata</see>.
/// </summary>
/// <param name="metadata">
/// Custom metadata to set for this share.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response{ShareInfo}"/> describing the updated
/// share.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// If multiple failures occur, an <see cref="AggregateException"/> will be thrown,
/// containing each failure instance.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
public virtual async Task<Response<ShareInfo>> SetMetadataAsync(
#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken.
Metadata metadata,
CancellationToken cancellationToken) =>
await SetMetadataInternal(
metadata,
conditions: default,
async: true,
cancellationToken)
.ConfigureAwait(false);
/// <summary>
/// The <see cref="SetMetadataInternal"/> operation sets user-defined
/// metadata for the specified share as one or more name-value pairs.
///
/// For more information, see
/// <see href="https://docs.microsoft.com/rest/api/storageservices/set-share-metadata">
/// Set Share Metadata</see>.
/// </summary>
/// <param name="metadata">
/// Custom metadata to set for this share.
/// </param>
/// <param name="conditions">
/// Optional <see cref="ShareFileRequestConditions"/> to add conditions
/// on setting share metadata.
/// </param>
/// <param name="async">
/// Whether to invoke the operation asynchronously.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response{ShareInfo}"/> describing the updated
/// share.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// If multiple failures occur, an <see cref="AggregateException"/> will be thrown,
/// containing each failure instance.
/// </remarks>
private async Task<Response<ShareInfo>> SetMetadataInternal(
Metadata metadata,
ShareFileRequestConditions conditions,
bool async,
CancellationToken cancellationToken)
{
using (ClientConfiguration.Pipeline.BeginLoggingScope(nameof(ShareClient)))
{
ClientConfiguration.Pipeline.LogMethodEnter(
nameof(ShareClient),
message: $"{nameof(Uri)}: {Uri}");
DiagnosticScope scope = ClientConfiguration.ClientDiagnostics.CreateScope($"{nameof(ShareClient)}.{nameof(SetMetadata)}");
try
{
ResponseWithHeaders<ShareSetMetadataHeaders> response;
scope.Start();
if (async)
{
response = await ShareRestClient.SetMetadataAsync(
metadata: metadata,
shareFileRequestConditions: conditions,
cancellationToken: cancellationToken)
.ConfigureAwait(false);
}
else
{
response = ShareRestClient.SetMetadata(
metadata: metadata,
shareFileRequestConditions: conditions,
cancellationToken: cancellationToken);
}
return Response.FromValue(
response.ToShareInfo(),
response.GetRawResponse());
}
catch (Exception ex)
{
ClientConfiguration.Pipeline.LogException(ex);
scope.Failed(ex);
throw;
}
finally
{
ClientConfiguration.Pipeline.LogMethodExit(nameof(ShareClient));
scope.Dispose();
}
}
}