public async virtual Task <Response <OSVersion> > GetAsync(string osVersionName, CancellationToken cancellationToken = default) { if (osVersionName == null) { throw new ArgumentNullException(nameof(osVersionName)); } using var scope = _clientDiagnostics.CreateScope("OSVersionCollection.Get"); scope.Start(); try { var response = await _cloudServiceOperatingSystemsRestClient.GetOSVersionAsync(Id.SubscriptionId, _location, osVersionName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new OSVersion(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <CloudServiceOSVersionResource> > GetAsync(string osVersionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(osVersionName, nameof(osVersionName)); using var scope = _cloudServiceOSVersionCloudServiceOperatingSystemsClientDiagnostics.CreateScope("CloudServiceOSVersionCollection.Get"); scope.Start(); try { var response = await _cloudServiceOSVersionCloudServiceOperatingSystemsRestClient.GetOSVersionAsync(Id.SubscriptionId, new AzureLocation(_location), osVersionName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new CloudServiceOSVersionResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <OSVersion> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _oSVersionCloudServiceOperatingSystemsClientDiagnostics.CreateScope("OSVersion.Get"); scope.Start(); try { var response = await _oSVersionCloudServiceOperatingSystemsRestClient.GetOSVersionAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _oSVersionCloudServiceOperatingSystemsClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new OSVersion(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }