public virtual Response <DscpConfiguration> Get(CancellationToken cancellationToken = default) { using var scope = _dscpConfigurationClientDiagnostics.CreateScope("DscpConfiguration.Get"); scope.Start(); try { var response = _dscpConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DscpConfiguration(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <DscpConfigurationResource> Get(string dscpConfigurationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(dscpConfigurationName, nameof(dscpConfigurationName)); using var scope = _dscpConfigurationClientDiagnostics.CreateScope("DscpConfigurationCollection.Get"); scope.Start(); try { var response = _dscpConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, dscpConfigurationName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DscpConfigurationResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <DscpConfiguration> Get(string dscpConfigurationName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("DscpConfigurationContainer.Get"); scope.Start(); try { if (dscpConfigurationName == null) { throw new ArgumentNullException(nameof(dscpConfigurationName)); } var response = _restClient.Get(Id.ResourceGroupName, dscpConfigurationName, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DscpConfiguration(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }