public virtual Response <LeaseShareResponse> Lease(LeaseShareRequest parameters = null, string xMsSnapshot = null, CancellationToken cancellationToken = default) { using var scope = _fileShareClientDiagnostics.CreateScope("FileShare.Lease"); scope.Start(); try { var response = _fileShareRestClient.Lease(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, parameters, xMsSnapshot, cancellationToken); return(response); } catch (Exception e) { scope.Failed(e); throw; } }
/// <summary> /// The Lease Share operation establishes and manages a lock on a share for /// delete operations. The lock duration can be 15 to 60 seconds, or can be /// infinite. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group within the user's subscription. The name is /// case insensitive. /// </param> /// <param name='accountName'> /// The name of the storage account within the specified resource group. /// Storage account names must be between 3 and 24 characters in length and use /// numbers and lower-case letters only. /// </param> /// <param name='shareName'> /// The name of the file share within the specified storage account. File share /// names must be between 3 and 63 characters in length and use numbers, /// lower-case letters and dash (-) only. Every dash (-) character must be /// immediately preceded and followed by a letter or number. /// </param> /// <param name='parameters'> /// Lease Share request body. /// </param> /// <param name='xMsSnapshot'> /// Optional. Specify the snapshot time to lease a snapshot. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <LeaseShareResponse> LeaseAsync(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName, LeaseShareRequest parameters = default(LeaseShareRequest), string xMsSnapshot = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.LeaseWithHttpMessagesAsync(resourceGroupName, accountName, shareName, parameters, xMsSnapshot, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// The Lease Share operation establishes and manages a lock on a share for /// delete operations. The lock duration can be 15 to 60 seconds, or can be /// infinite. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group within the user's subscription. The name is /// case insensitive. /// </param> /// <param name='accountName'> /// The name of the storage account within the specified resource group. /// Storage account names must be between 3 and 24 characters in length and use /// numbers and lower-case letters only. /// </param> /// <param name='shareName'> /// The name of the file share within the specified storage account. File share /// names must be between 3 and 63 characters in length and use numbers, /// lower-case letters and dash (-) only. Every dash (-) character must be /// immediately preceded and followed by a letter or number. /// </param> /// <param name='parameters'> /// Lease Share request body. /// </param> /// <param name='xMsSnapshot'> /// Optional. Specify the snapshot time to lease a snapshot. /// </param> public static LeaseShareResponse Lease(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName, LeaseShareRequest parameters = default(LeaseShareRequest), string xMsSnapshot = default(string)) { return(operations.LeaseAsync(resourceGroupName, accountName, shareName, parameters, xMsSnapshot).GetAwaiter().GetResult()); }
public virtual async Task <Response <LeaseShareResponse> > LeaseAsync(string xMsSnapshot = null, LeaseShareRequest parameters = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("FileShare.Lease"); scope.Start(); try { var response = await _restClient.LeaseAsync(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, xMsSnapshot, parameters, cancellationToken).ConfigureAwait(false); return(response); } catch (Exception e) { scope.Failed(e); throw; } }