public async virtual Task <Response <VirtualMachineRunCommand> > GetAsync(string runCommandName, string expand = null, CancellationToken cancellationToken = default) { if (runCommandName == null) { throw new ArgumentNullException(nameof(runCommandName)); } using var scope = _clientDiagnostics.CreateScope("VirtualMachineRunCommandCollection.Get"); scope.Start(); try { var response = await _virtualMachineRunCommandsRestClient.GetByVirtualMachineAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runCommandName, expand, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new VirtualMachineRunCommand(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <VirtualMachineRunCommandVirtualMachine> > GetAsync(string expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("VirtualMachineRunCommandVirtualMachine.Get"); scope.Start(); try { var response = await _restClient.GetByVirtualMachineAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new VirtualMachineRunCommandVirtualMachine(this, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }