public async virtual Task <Response <PrivateLinkService> > GetAsync(string serviceName, string expand = null, CancellationToken cancellationToken = default) { if (serviceName == null) { throw new ArgumentNullException(nameof(serviceName)); } using var scope = _clientDiagnostics.CreateScope("PrivateLinkServiceCollection.Get"); scope.Start(); try { var response = await _privateLinkServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, serviceName, expand, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new PrivateLinkService(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <PrivateLinkService> > GetAsync(string expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PrivateLinkService.Get"); scope.Start(); try { var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, expand, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new PrivateLinkService(this, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }