public virtual Response <VirtualMachineRunCommand> Get(string expand = null, CancellationToken cancellationToken = default) { using var scope = _virtualMachineRunCommandClientDiagnostics.CreateScope("VirtualMachineRunCommand.Get"); scope.Start(); try { var response = _virtualMachineRunCommandRestClient.GetByVirtualMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken); if (response.Value == null) { throw _virtualMachineRunCommandClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualMachineRunCommand(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <VirtualMachineRunCommandResource> Get(string runCommandName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(runCommandName, nameof(runCommandName)); using var scope = _virtualMachineRunCommandClientDiagnostics.CreateScope("VirtualMachineRunCommandCollection.Get"); scope.Start(); try { var response = _virtualMachineRunCommandRestClient.GetByVirtualMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runCommandName, expand, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualMachineRunCommandResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <VirtualMachineRunCommandVirtualMachine> Get(string runCommandName, string expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("VirtualMachineRunCommandVirtualMachineContainer.Get"); scope.Start(); try { if (runCommandName == null) { throw new ArgumentNullException(nameof(runCommandName)); } var response = _restClient.GetByVirtualMachine(Id.ResourceGroupName, Id.Name, runCommandName, expand, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualMachineRunCommandVirtualMachine(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }