public virtual Response <ServiceObjectiveResource> Get(string serviceObjectiveName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(serviceObjectiveName, nameof(serviceObjectiveName)); using var scope = _serviceObjectiveClientDiagnostics.CreateScope("ServiceObjectiveCollection.Get"); scope.Start(); try { var response = _serviceObjectiveRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serviceObjectiveName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new ServiceObjectiveResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <ServiceObjective> Get(CancellationToken cancellationToken = default) { using var scope = _serviceObjectiveClientDiagnostics.CreateScope("ServiceObjective.Get"); scope.Start(); try { var response = _serviceObjectiveRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw _serviceObjectiveClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new ServiceObjective(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }