/// <summary> /// The process record method. /// </summary> protected override void ProcessRecord() { ResponseType response = null; base.ProcessRecord(); try { var poolMember = new addPoolMember { poolId = VipPool.id, nodeId = VipNode != null ? VipNode.id : string.Empty, port = Port.GetValueOrDefault(), portSpecified = Port.HasValue, status = Enabled ? "ENABLED" : "DISABLED" }; response = Connection.ApiClient.Networking.VipPool.AddPoolMember(poolMember).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> /// Adds a Node, combined with Port information to the identified Pool as a new Pool Member. /// </summary> /// <param name="poolMember">The Pool Member</param> /// <returns>The async task of <see cref="ResponseType"/></returns> public async Task <ResponseType> AddPoolMember(addPoolMember poolMember) { return (await _api.PostAsync <addPoolMember, ResponseType>(ApiUris.AddPoolMember(_api.OrganizationId), poolMember)); }