public async virtual Task <Response <ConsumerGroup> > GetAsync(string consumerGroupName, CancellationToken cancellationToken = default) { if (consumerGroupName == null) { throw new ArgumentNullException(nameof(consumerGroupName)); } using var scope = _clientDiagnostics.CreateScope("ConsumerGroupCollection.Get"); scope.Start(); try { var response = await _consumerGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, consumerGroupName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new ConsumerGroup(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <ConsumerGroupResource> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _consumerGroupClientDiagnostics.CreateScope("ConsumerGroupResource.Get"); scope.Start(); try { var response = await _consumerGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, 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 ConsumerGroupResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }