fix: resolve all C# compiler warnings (CS8604, CS8618, CS8603, CS1573, xUnit1012)

- CS8604: Use cmdlet's own Node property instead of nullable task.Node
  in WaitForTask calls across all VM cmdlets
- CS8618: Make PveSession.ServerVersion nullable (PveVersion?) since it
  is set post-construction by PveAuthenticator
- CS8603: Add null-forgiving operator where IsNullOrWhiteSpace guards
  guarantee non-null in PveHttpClient
- CS1573: Add XML param documentation to all public service methods
- xUnit1012: Make test parameters nullable (string?) for null test cases

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Clint Branham
2026-03-18 18:11:49 -05:00
parent 0dc7f5f833
commit 0c70e11fe8
21 changed files with 157 additions and 18 deletions
@@ -14,7 +14,7 @@ namespace PSProxmoxVE.Core.Authentication
public string? Ticket { get; }
public string? CsrfToken { get; }
public DateTime TicketExpiry { get; }
public PveVersion ServerVersion { get; internal set; }
public PveVersion? ServerVersion { get; internal set; }
/// <summary>Returns true if the ticket has expired (only relevant for Ticket auth mode)</summary>
public bool IsExpired
+1 -1
View File
@@ -372,7 +372,7 @@ namespace PSProxmoxVE.Core.Client
// Some endpoints return a plain string in "message"
var message = json["message"]?.ToString();
if (!string.IsNullOrWhiteSpace(message))
return message;
return message!;
}
catch
{
@@ -23,6 +23,8 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Returns network interface configurations for a node.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="type">
/// Optional interface type filter (e.g. "bridge", "bond", "eth", "vlan", "alias").
/// </param>
@@ -45,6 +47,9 @@ namespace PSProxmoxVE.Core.Services
/// Creates a network interface on a node. Changes are pending until
/// <see cref="ApplyNetworkConfig"/> is called. Returns the new interface config.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="config">Network interface configuration parameters.</param>
public PveNetwork CreateNetwork(
PveSession session,
string node,
@@ -68,6 +73,10 @@ namespace PSProxmoxVE.Core.Services
/// Updates an existing network interface on a node. Changes are pending until
/// <see cref="ApplyNetworkConfig"/> is called.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="iface">The network interface name.</param>
/// <param name="config">Network interface configuration parameters to update.</param>
public void SetNetwork(
PveSession session,
string node,
@@ -91,6 +100,9 @@ namespace PSProxmoxVE.Core.Services
/// Removes a network interface from a node. Changes are pending until
/// <see cref="ApplyNetworkConfig"/> is called.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="iface">The network interface name to remove.</param>
public void RemoveNetwork(PveSession session, string node, string iface)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -104,6 +116,8 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Applies pending network configuration changes on a node. Returns the task UPID.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
public PveTask ApplyNetworkConfig(PveSession session, string node)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -122,6 +136,7 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Returns all SDN zone definitions. Requires PVE 8.0+.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
public PveSdnZone[] GetSdnZones(PveSession session)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -136,6 +151,7 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Returns all SDN VNet definitions. Requires PVE 8.0+.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
public PveSdnVnet[] GetSdnVnets(PveSession session)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -150,6 +166,8 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Creates an SDN zone. Requires PVE 8.0+.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="config">SDN zone configuration parameters.</param>
public PveSdnZone CreateSdnZone(
PveSession session,
Dictionary<string, object> config)
@@ -171,6 +189,8 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Removes an SDN zone. Requires PVE 8.0+.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="zone">The SDN zone identifier to remove.</param>
public void RemoveSdnZone(PveSession session, string zone)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -184,6 +204,8 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Creates an SDN VNet. Requires PVE 8.0+.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="config">SDN VNet configuration parameters.</param>
public PveSdnVnet CreateSdnVnet(
PveSession session,
Dictionary<string, object> config)
@@ -205,6 +227,8 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Removes an SDN VNet. Requires PVE 8.0+.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="vnet">The SDN VNet identifier to remove.</param>
public void RemoveSdnVnet(PveSession session, string vnet)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -16,6 +16,9 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Returns all snapshots for a VM.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
public PveSnapshot[] GetSnapshots(PveSession session, string node, int vmid)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -31,6 +34,9 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Creates a snapshot of a VM. Returns the task UPID.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
/// <param name="snapname">Snapshot name (alphanumeric, no spaces).</param>
/// <param name="description">Optional description.</param>
/// <param name="vmstate">Whether to save VM RAM state (live snapshot). Default false.</param>
@@ -63,6 +69,10 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Removes a snapshot from a VM. Returns the task UPID.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
/// <param name="snapname">The snapshot name to remove.</param>
public PveTask RemoveSnapshot(
PveSession session,
string node,
@@ -82,6 +92,10 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Rolls a VM back to a snapshot. Returns the task UPID.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
/// <param name="snapname">The snapshot name to roll back to.</param>
public PveTask RollbackSnapshot(
PveSession session,
string node,
@@ -22,6 +22,8 @@ namespace PSProxmoxVE.Core.Services
/// Returns storage definitions. If <paramref name="node"/> is null, returns
/// the cluster-wide storage list; otherwise returns storage visible on that node.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">Optional cluster node name to filter storage by node.</param>
public PveStorage[] GetStorages(PveSession session, string? node = null)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -39,6 +41,9 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Returns the contents of a storage volume on a specific node.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="storage">The storage identifier.</param>
/// <param name="contentType">
/// Optional content type filter (e.g. "iso", "vztmpl", "images", "backup").
/// </param>
@@ -69,6 +74,10 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Uploads an ISO (or other file) to a storage on a node. Returns the task UPID.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="storage">The storage identifier.</param>
/// <param name="filePath">Path to the file to upload.</param>
/// <param name="checksum">Optional checksum value.</param>
/// <param name="checksumAlgorithm">Optional checksum algorithm (e.g. "sha256").</param>
/// <param name="progressCallback">Optional callback with (bytesSent, totalBytes).</param>
@@ -106,6 +115,12 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Downloads a file from a URL directly to a storage on a node. Returns the task UPID.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="storage">The storage identifier.</param>
/// <param name="url">The URL to download from.</param>
/// <param name="filename">The target filename on the storage.</param>
/// <param name="contentType">The content type (e.g. "iso", "vztmpl").</param>
public PveTask DownloadUrl(
PveSession session,
string node,
@@ -142,6 +157,8 @@ namespace PSProxmoxVE.Core.Services
/// Creates a new storage definition at the cluster level. Returns the task UPID or
/// null if the API returns no task (some storage types apply immediately).
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="config">Storage configuration parameters.</param>
public PveStorage CreateStorage(PveSession session, Dictionary<string, object> config)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -159,6 +176,8 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Removes a cluster-level storage definition.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="storage">The storage identifier to remove.</param>
public void RemoveStorage(PveSession session, string storage)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -18,6 +18,8 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Returns all VM templates. If <paramref name="node"/> is null, searches all cluster nodes.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">Optional cluster node name to filter templates by node.</param>
public PveVm[] GetTemplates(PveSession session, string? node = null)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -29,6 +31,9 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Converts an existing VM into a template. Returns the task UPID.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
/// <remarks>
/// The VM must be stopped and must not already be a template.
/// Once converted, this operation cannot be reversed via the API.
@@ -47,6 +52,9 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Removes a VM template (delegates to <see cref="VmService.RemoveVm"/>).
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
/// <param name="purge">
/// If true, also removes all associated backup files and jobs.
/// </param>
@@ -18,6 +18,7 @@ namespace PSProxmoxVE.Core.Services
// -------------------------------------------------------------------------
/// <summary>Returns all users.</summary>
/// <param name="session">The authenticated PVE session.</param>
public PveUser[] GetUsers(PveSession session)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -29,6 +30,8 @@ namespace PSProxmoxVE.Core.Services
}
/// <summary>Returns a single user by their user ID (e.g. "admin@pam").</summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="userId">The user ID in "username@realm" format.</param>
public PveUser GetUser(PveSession session, string userId)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -48,6 +51,7 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Creates a new user account.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="userId">User ID in "username@realm" format.</param>
/// <param name="config">Additional fields (password, email, firstname, lastname, etc.).</param>
public void CreateUser(
@@ -70,6 +74,8 @@ namespace PSProxmoxVE.Core.Services
}
/// <summary>Removes a user account.</summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="userId">The user ID in "username@realm" format.</param>
public void RemoveUser(PveSession session, string userId)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -81,6 +87,9 @@ namespace PSProxmoxVE.Core.Services
}
/// <summary>Updates one or more properties of an existing user.</summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="userId">The user ID in "username@realm" format.</param>
/// <param name="config">User properties to update.</param>
public void SetUser(
PveSession session,
string userId,
@@ -103,6 +112,8 @@ namespace PSProxmoxVE.Core.Services
// -------------------------------------------------------------------------
/// <summary>Returns all API tokens for the specified user.</summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="userId">The user ID in "username@realm" format.</param>
public PveApiToken[] GetApiTokens(PveSession session, string userId)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -122,6 +133,7 @@ namespace PSProxmoxVE.Core.Services
/// Creates a new API token for the specified user and returns the token object,
/// including the secret <c>Value</c> (shown only once).
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="userId">User ID in "username@realm" format.</param>
/// <param name="tokenId">Token identifier (alphanumeric and hyphens).</param>
/// <param name="comment">Optional description.</param>
@@ -161,6 +173,9 @@ namespace PSProxmoxVE.Core.Services
}
/// <summary>Removes an API token.</summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="userId">The user ID in "username@realm" format.</param>
/// <param name="tokenId">The token identifier to remove.</param>
public void RemoveApiToken(PveSession session, string userId, string tokenId)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -179,6 +194,7 @@ namespace PSProxmoxVE.Core.Services
// -------------------------------------------------------------------------
/// <summary>Returns all roles.</summary>
/// <param name="session">The authenticated PVE session.</param>
public PveRole[] GetRoles(PveSession session)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -190,6 +206,7 @@ namespace PSProxmoxVE.Core.Services
}
/// <summary>Creates a new role.</summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="roleId">Role name.</param>
/// <param name="privileges">Comma-separated list of privilege strings.</param>
public void CreateRole(PveSession session, string roleId, string? privileges = null)
@@ -206,6 +223,8 @@ namespace PSProxmoxVE.Core.Services
}
/// <summary>Removes a role.</summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="roleId">The role name to remove.</param>
public void RemoveRole(PveSession session, string roleId)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -223,6 +242,7 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Returns the effective permissions (resolved privilege set) for a user or token.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="userId">Optional user ID to query; defaults to the authenticated user.</param>
/// <param name="path">Optional path to restrict the query.</param>
public PvePermission[] GetPermissions(
@@ -262,6 +282,7 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Sets (adds or updates) an ACL entry.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="path">Access control path (e.g. "/", "/nodes/pve", "/vms/100").</param>
/// <param name="roles">Comma-separated role IDs.</param>
/// <param name="users">Comma-separated user IDs.</param>
@@ -23,6 +23,8 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Returns VMs. If <paramref name="node"/> is null, queries every cluster node.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">Optional cluster node name to filter VMs by node.</param>
public PveVm[] GetVms(PveSession session, string? node = null)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -62,6 +64,9 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Returns a single VM by its ID on the specified node.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
public PveVm GetVm(PveSession session, string node, int vmid)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -78,6 +83,9 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Returns the full configuration of a VM.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
public PveVmConfig GetVmConfig(PveSession session, string node, int vmid)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -97,6 +105,10 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Updates one or more VM configuration settings. Changes are applied immediately (POST).
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
/// <param name="config">VM configuration parameters to update.</param>
public void SetVmConfig(PveSession session, string node, int vmid, Dictionary<string, object> config)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -118,6 +130,9 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Creates a new VM. Returns the task UPID.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="config">VM configuration parameters.</param>
public PveTask CreateVm(PveSession session, string node, Dictionary<string, object> config)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -134,14 +149,24 @@ namespace PSProxmoxVE.Core.Services
}
/// <summary>Starts a VM. Returns the task UPID.</summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
public PveTask StartVm(PveSession session, string node, int vmid)
=> PostStatus(session, node, vmid, "start");
/// <summary>Stops a VM (hard power-off). Returns the task UPID.</summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
public PveTask StopVm(PveSession session, string node, int vmid)
=> PostStatus(session, node, vmid, "stop");
/// <summary>Gracefully shuts down a VM. Returns the task UPID.</summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
/// <param name="timeoutSeconds">Optional shutdown timeout in seconds.</param>
public PveTask ShutdownVm(PveSession session, string node, int vmid, int? timeoutSeconds = null)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -158,14 +183,23 @@ namespace PSProxmoxVE.Core.Services
}
/// <summary>Resets a VM (hard reset). Returns the task UPID.</summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
public PveTask ResetVm(PveSession session, string node, int vmid)
=> PostStatus(session, node, vmid, "reset");
/// <summary>Suspends a VM (writes RAM state to disk). Returns the task UPID.</summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
public PveTask SuspendVm(PveSession session, string node, int vmid)
=> PostStatus(session, node, vmid, "suspend");
/// <summary>Resumes a suspended VM. Returns the task UPID.</summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
public PveTask ResumeVm(PveSession session, string node, int vmid)
=> PostStatus(session, node, vmid, "resume");
@@ -176,6 +210,10 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Removes a VM. Returns the task UPID.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
/// <param name="purge">If true, also removes all associated backup files and jobs.</param>
public PveTask RemoveVm(PveSession session, string node, int vmid, bool purge = false)
{
if (session == null) throw new ArgumentNullException(nameof(session));
@@ -191,6 +229,13 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Clones a VM. Returns the task UPID.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The source VM ID to clone.</param>
/// <param name="newid">The VM ID for the new clone.</param>
/// <param name="name">Optional name for the cloned VM.</param>
/// <param name="targetNode">Optional target node for the clone.</param>
/// <param name="full">If true, creates a full clone; otherwise a linked clone.</param>
public PveTask CloneVm(
PveSession session,
string node,
@@ -220,6 +265,11 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Migrates a VM to another node. Returns the task UPID.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The source cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
/// <param name="targetNode">The target node to migrate to.</param>
/// <param name="online">If true, performs an online (live) migration.</param>
public PveTask MigrateVm(
PveSession session,
string node,
@@ -246,6 +296,9 @@ namespace PSProxmoxVE.Core.Services
/// <summary>
/// Resizes a disk attached to a VM. Returns the task UPID.
/// </summary>
/// <param name="session">The authenticated PVE session.</param>
/// <param name="node">The cluster node name.</param>
/// <param name="vmid">The VM ID.</param>
/// <param name="disk">Disk identifier, e.g. "scsi0" or "virtio0".</param>
/// <param name="size">
/// New absolute size (e.g. "32G") or relative increase with "+" prefix (e.g. "+10G").
@@ -83,7 +83,7 @@ namespace PSProxmoxVE.Cmdlets.Vms
if (Wait.IsPresent)
{
var taskService = new TaskService();
task = taskService.WaitForTask(session, task.Node, task.Upid, null, null, null);
task = taskService.WaitForTask(session, SourceNode, task.Upid, null, null, null);
}
WriteObject(task);
@@ -64,7 +64,7 @@ namespace PSProxmoxVE.Cmdlets.Vms
if (Wait.IsPresent)
{
var taskService = new TaskService();
task = taskService.WaitForTask(session, task.Node, task.Upid, null, null, null);
task = taskService.WaitForTask(session, Node, task.Upid, null, null, null);
}
WriteObject(task);
@@ -181,7 +181,7 @@ namespace PSProxmoxVE.Cmdlets.Vms
if (Wait.IsPresent)
{
var taskService = new TaskService();
task = taskService.WaitForTask(session, task.Node, task.Upid, null, null, null);
task = taskService.WaitForTask(session, Node, task.Upid, null, null, null);
}
WriteObject(task);
@@ -66,7 +66,7 @@ namespace PSProxmoxVE.Cmdlets.Vms
if (Wait.IsPresent)
{
var taskService = new TaskService();
task = taskService.WaitForTask(session, task.Node, task.Upid, null, null, null);
task = taskService.WaitForTask(session, Node, task.Upid, null, null, null);
}
WriteObject(task);
@@ -50,7 +50,7 @@ namespace PSProxmoxVE.Cmdlets.Vms
if (Wait.IsPresent)
{
var taskService = new TaskService();
task = taskService.WaitForTask(session, task.Node, task.Upid, null, null, null);
task = taskService.WaitForTask(session, Node, task.Upid, null, null, null);
}
WriteObject(task);
@@ -68,7 +68,7 @@ namespace PSProxmoxVE.Cmdlets.Vms
if (Wait.IsPresent)
{
var taskService = new TaskService();
task = taskService.WaitForTask(session, task.Node, task.Upid, null, null, null);
task = taskService.WaitForTask(session, Node, task.Upid, null, null, null);
}
WriteObject(task);
@@ -57,13 +57,13 @@ namespace PSProxmoxVE.Cmdlets.Vms
var shutdownTask = vmService.ShutdownVm(session, Node, VmId, Timeout);
if (Wait.IsPresent)
taskService.WaitForTask(session, shutdownTask.Node, shutdownTask.Upid, null, null, null);
taskService.WaitForTask(session, Node, shutdownTask.Upid, null, null, null);
// Start
var startTask = vmService.StartVm(session, Node, VmId);
if (Wait.IsPresent)
startTask = taskService.WaitForTask(session, startTask.Node, startTask.Upid, null, null, null);
startTask = taskService.WaitForTask(session, Node, startTask.Upid, null, null, null);
WriteObject(startTask);
}
@@ -48,7 +48,7 @@ namespace PSProxmoxVE.Cmdlets.Vms
if (Wait.IsPresent)
{
var taskService = new TaskService();
task = taskService.WaitForTask(session, task.Node, task.Upid, null, null, null);
task = taskService.WaitForTask(session, Node, task.Upid, null, null, null);
}
WriteObject(task);
@@ -48,7 +48,7 @@ namespace PSProxmoxVE.Cmdlets.Vms
if (Wait.IsPresent)
{
var taskService = new TaskService();
task = taskService.WaitForTask(session, task.Node, task.Upid, null, null, null);
task = taskService.WaitForTask(session, Node, task.Upid, null, null, null);
}
WriteObject(task);
@@ -50,7 +50,7 @@ namespace PSProxmoxVE.Cmdlets.Vms
if (Wait.IsPresent)
{
var taskService = new TaskService();
task = taskService.WaitForTask(session, task.Node, task.Upid, null, null, null);
task = taskService.WaitForTask(session, Node, task.Upid, null, null, null);
}
WriteObject(task);
@@ -49,7 +49,7 @@ namespace PSProxmoxVE.Cmdlets.Vms
if (Wait.IsPresent)
{
var taskService = new TaskService();
task = taskService.WaitForTask(session, task.Node, task.Upid, null, null, null);
task = taskService.WaitForTask(session, Node, task.Upid, null, null, null);
}
WriteObject(task);
@@ -56,7 +56,7 @@ namespace PSProxmoxVE.Core.Tests.Authentication
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
public void ValidateHostname_NullOrEmpty_Throws_ForCredentials(string hostname)
public void ValidateHostname_NullOrEmpty_Throws_ForCredentials(string? hostname)
{
Assert.Throws<ArgumentException>(() =>
PveAuthenticator.AuthenticateWithCredentials(hostname, ValidPort, false, "root@pam", "password"));
@@ -66,7 +66,7 @@ namespace PSProxmoxVE.Core.Tests.Authentication
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
public void ValidateHostname_NullOrEmpty_Throws_ForApiToken(string hostname)
public void ValidateHostname_NullOrEmpty_Throws_ForApiToken(string? hostname)
{
Assert.Throws<ArgumentException>(() =>
PveAuthenticator.AuthenticateWithApiToken(hostname, ValidPort, false, "root@pam!mytoken=uuid"));
@@ -76,7 +76,7 @@ namespace PSProxmoxVE.Core.Tests.Authentication
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
public void ValidateApiToken_NullOrEmpty_Throws(string token)
public void ValidateApiToken_NullOrEmpty_Throws(string? token)
{
Assert.Throws<ArgumentException>(() =>
PveAuthenticator.AuthenticateWithApiToken(ValidHostname, ValidPort, false, token));
@@ -42,7 +42,7 @@ namespace PSProxmoxVE.Core.Tests.Authentication
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
public void Parse_NullOrEmpty_Throws(string input)
public void Parse_NullOrEmpty_Throws(string? input)
{
Assert.Throws<ArgumentException>(() => PveVersion.Parse(input));
}