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