public virtual Response <ProfileResource> Get(CancellationToken cancellationToken = default) { using var scope = _profileClientDiagnostics.CreateScope("ProfileResource.Get"); scope.Start(); try { var response = _profileRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new ProfileResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <Profile> Get(string profileName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(profileName, nameof(profileName)); using var scope = _profileClientDiagnostics.CreateScope("ProfileCollection.Get"); scope.Start(); try { var response = _profileRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, profileName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new Profile(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }