public virtual Response <VirtualApplianceSite> Get(string siteName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); using var scope = _virtualApplianceSiteClientDiagnostics.CreateScope("VirtualApplianceSiteCollection.Get"); scope.Start(); try { var response = _virtualApplianceSiteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, siteName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualApplianceSite(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <VirtualApplianceSite> Get(string siteName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("VirtualApplianceSiteContainer.Get"); scope.Start(); try { if (siteName == null) { throw new ArgumentNullException(nameof(siteName)); } var response = _restClient.Get(Id.ResourceGroupName, Id.Name, siteName, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualApplianceSite(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <VirtualApplianceSiteResource> Get(CancellationToken cancellationToken = default) { using var scope = _virtualApplianceSiteClientDiagnostics.CreateScope("VirtualApplianceSiteResource.Get"); scope.Start(); try { var response = _virtualApplianceSiteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualApplianceSiteResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }