public async virtual Task <Response <SchemaGroup> > GetAsync(string schemaGroupName, CancellationToken cancellationToken = default) { if (schemaGroupName == null) { throw new ArgumentNullException(nameof(schemaGroupName)); } using var scope = _clientDiagnostics.CreateScope("SchemaGroupCollection.Get"); scope.Start(); try { var response = await _schemaRegistryRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaGroupName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new SchemaGroup(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <SchemaGroup> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _schemaGroupSchemaRegistryClientDiagnostics.CreateScope("SchemaGroup.Get"); scope.Start(); try { var response = await _schemaGroupSchemaRegistryRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new SchemaGroup(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }