public virtual Response <TopLevelDomain> Get(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); using var scope = _topLevelDomainClientDiagnostics.CreateScope("TopLevelDomainCollection.Get"); scope.Start(); try { var response = _topLevelDomainRestClient.Get(Id.SubscriptionId, name, cancellationToken); if (response.Value == null) { throw _topLevelDomainClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new TopLevelDomain(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <TopLevelDomainResource> Get(CancellationToken cancellationToken = default) { using var scope = _topLevelDomainClientDiagnostics.CreateScope("TopLevelDomainResource.Get"); scope.Start(); try { var response = _topLevelDomainRestClient.Get(Id.SubscriptionId, Id.Name, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new TopLevelDomainResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }