public virtual Response <PrivateLinkService> Get(string expand = null, CancellationToken cancellationToken = default) { using var scope = _privateLinkServiceClientDiagnostics.CreateScope("PrivateLinkService.Get"); scope.Start(); try { var response = _privateLinkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken); if (response.Value == null) { throw _privateLinkServiceClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new PrivateLinkService(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <PrivateLinkService> Get(string serviceName, string expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PrivateLinkServiceCollection.Get"); scope.Start(); try { if (serviceName == null) { throw new ArgumentNullException(nameof(serviceName)); } var response = _restClient.Get(Id.ResourceGroupName, serviceName, expand, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new PrivateLinkService(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }