/// <summary> /// The process record method. /// </summary> protected override void ProcessRecord() { ResponseType response = null; base.ProcessRecord(); try { var vipNode = new EditNodeType { id = Node.id, description = !string.IsNullOrWhiteSpace(Description) ? Description : Node.description, status = Enabled.HasValue ? (Enabled.Value ? "ENABLED" : "DISABLED") : Node.status, healthMonitorId = !string.IsNullOrWhiteSpace(HealthMonitorId) ? HealthMonitorId : Node.healthMonitor != null ? Node.healthMonitor.id : null, connectionLimit = ConnectionLimit > 0 ? ConnectionLimit : Node.connectionLimit, connectionRateLimit = ConnectionRateLimit > 0 ? ConnectionRateLimit : Node.connectionRateLimit }; response = Connection.ApiClient.Networking.VipNode.EditNode(vipNode).Result; } catch (AggregateException ae) { ae.Handle( e => { if (e is ComputeApiException) { WriteError(new ErrorRecord(e, "-2", ErrorCategory.InvalidOperation, Connection)); } else { // if (e is HttpRequestException) ThrowTerminatingError(new ErrorRecord(e, "-1", ErrorCategory.ConnectionError, Connection)); } return(true); }); } WriteObject(response); }
/// <summary> /// Updates the mutable properties of a Node. /// </summary> /// <param name="node">The edit node.</param> /// <returns>The async task of <see cref="ResponseType"/></returns> public async Task <ResponseType> EditNode(EditNodeType node) { return(await _api.PostAsync <EditNodeType, ResponseType>(ApiUris.EditVipNode(_api.OrganizationId), node)); }