public virtual Response <VirtualMachine> Get(CancellationToken cancellationToken = default) { using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachine.Get"); scope.Start(); try { var response = _virtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualMachine(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <ScVmmVirtualMachineResource> Get(string virtualMachineName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(virtualMachineName, nameof(virtualMachineName)); using var scope = _scVmmVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("ScVmmVirtualMachineCollection.Get"); scope.Start(); try { var response = _scVmmVirtualMachineVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualMachineName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new ScVmmVirtualMachineResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <VirtualMachine> Get(string vmName, InstanceViewTypes?expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachineCollection.Get"); scope.Start(); try { var response = _virtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vmName, expand, cancellationToken); if (response.Value == null) { throw _virtualMachineClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualMachine(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <VirtualMachine> Get(string vmName, InstanceViewTypes?expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("VirtualMachineContainer.Get"); scope.Start(); try { if (vmName == null) { throw new ArgumentNullException(nameof(vmName)); } var response = _restClient.Get(Id.ResourceGroupName, vmName, expand, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualMachine(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }