public virtual Response <ScalingPlan> Get(CancellationToken cancellationToken = default) { using var scope = _scalingPlanClientDiagnostics.CreateScope("ScalingPlan.Get"); scope.Start(); try { var response = _scalingPlanRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) { throw _scalingPlanClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new ScalingPlan(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <ScalingPlanResource> Get(string scalingPlanName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); using var scope = _scalingPlanClientDiagnostics.CreateScope("ScalingPlanCollection.Get"); scope.Start(); try { var response = _scalingPlanRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, scalingPlanName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new ScalingPlanResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }