public async virtual Task <Response <OSFamily> > GetAsync(string osFamilyName, CancellationToken cancellationToken = default) { if (osFamilyName == null) { throw new ArgumentNullException(nameof(osFamilyName)); } using var scope = _clientDiagnostics.CreateScope("OSFamilyCollection.Get"); scope.Start(); try { var response = await _cloudServiceOperatingSystemsRestClient.GetOSFamilyAsync(Id.SubscriptionId, _location, osFamilyName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new OSFamily(this, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <OSFamilyResource> > GetAsync(string osFamilyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(osFamilyName, nameof(osFamilyName)); using var scope = _osFamilyCloudServiceOperatingSystemsClientDiagnostics.CreateScope("OSFamilyCollection.Get"); scope.Start(); try { var response = await _osFamilyCloudServiceOperatingSystemsRestClient.GetOSFamilyAsync(Id.SubscriptionId, _location, osFamilyName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new OSFamilyResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <OSFamily> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _oSFamilyCloudServiceOperatingSystemsClientDiagnostics.CreateScope("OSFamily.Get"); scope.Start(); try { var response = await _oSFamilyCloudServiceOperatingSystemsRestClient.GetOSFamilyAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _oSFamilyCloudServiceOperatingSystemsClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new OSFamily(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }