public async virtual Task <Response <FileShare> > GetAsync(string shareName, string expand = null, string xMsSnapshot = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("FileShareContainer.Get"); scope.Start(); try { if (shareName == null) { throw new ArgumentNullException(nameof(shareName)); } var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, shareName, expand, xMsSnapshot, cancellationToken : cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new FileShare(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <FileShare> > GetAsync(string shareName, string expand = null, string xMsSnapshot = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(shareName, nameof(shareName)); using var scope = _fileShareClientDiagnostics.CreateScope("FileShareCollection.Get"); scope.Start(); try { var response = await _fileShareRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, shareName, expand, xMsSnapshot, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new FileShare(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }