public virtual Response <DeletedServer> Get(string locationName, string deletedServerName, CancellationToken cancellationToken = default) { if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); } if (deletedServerName == null) { throw new ArgumentNullException(nameof(deletedServerName)); } using var scope = _clientDiagnostics.CreateScope("DeletedServerCollection.Get"); scope.Start(); try { var response = _deletedServersRestClient.Get(Id.SubscriptionId, locationName, deletedServerName, cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DeletedServer(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <DeletedServerResource> Get(string deletedServerName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(deletedServerName, nameof(deletedServerName)); using var scope = _deletedServerClientDiagnostics.CreateScope("DeletedServerCollection.Get"); scope.Start(); try { var response = _deletedServerRestClient.Get(Id.SubscriptionId, _locationName, deletedServerName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DeletedServerResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <DeletedServer> Get(CancellationToken cancellationToken = default) { using var scope = _deletedServerClientDiagnostics.CreateScope("DeletedServer.Get"); scope.Start(); try { var response = _deletedServerRestClient.Get(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw _deletedServerClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DeletedServer(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }