public virtual Response <PrivateEndpointResource> Get(string expand = null, CancellationToken cancellationToken = default) { using var scope = _privateEndpointClientDiagnostics.CreateScope("PrivateEndpointResource.Get"); scope.Start(); try { var response = _privateEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new PrivateEndpointResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <PrivateEndpoint> Get(string privateEndpointName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); using var scope = _privateEndpointClientDiagnostics.CreateScope("PrivateEndpointCollection.Get"); scope.Start(); try { var response = _privateEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, privateEndpointName, expand, cancellationToken); if (response.Value == null) { throw _privateEndpointClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new PrivateEndpoint(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <PrivateEndpoint> Get(string privateEndpointName, string expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PrivateEndpointContainer.Get"); scope.Start(); try { if (privateEndpointName == null) { throw new ArgumentNullException(nameof(privateEndpointName)); } var response = _restClient.Get(Id.ResourceGroupName, privateEndpointName, expand, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new PrivateEndpoint(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }