public async virtual Task <Response <SqlStoredProcedure> > GetAsync(string storedProcedureName, CancellationToken cancellationToken = default) { if (storedProcedureName == null) { throw new ArgumentNullException(nameof(storedProcedureName)); } using var scope = _clientDiagnostics.CreateScope("SqlStoredProcedureCollection.Get"); scope.Start(); try { var response = await _sqlResourcesRestClient.GetSqlStoredProcedureAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, storedProcedureName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new SqlStoredProcedure(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <SqlStoredProcedureResource> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _sqlStoredProcedureSqlResourcesClientDiagnostics.CreateScope("SqlStoredProcedureResource.Get"); scope.Start(); try { var response = await _sqlStoredProcedureSqlResourcesRestClient.GetSqlStoredProcedureAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new SqlStoredProcedureResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }