private OmnetSimulation() { NativeLibrary runtimehost = new NativeLibrary(null); _Test = runtimehost.LoadFunction <TestType>("test"); _CreateNodeAndId = runtimehost.LoadFunction <CreateNodeAndIdType>("daa_createNodeAndId"); _CreateNode = runtimehost.LoadFunction <CreateNodeType>("daa_createNode"); _Send = runtimehost.LoadFunction <SendType>("daa_send"); _WaitMilliseconds = runtimehost.LoadFunction <WaitMillisecondsType>("daa_wait_ms"); _WaitSeconds = runtimehost.LoadFunction <WaitSecondsType>("daa_wait_s"); _SetGlobalTimerMillisecounds = runtimehost.LoadFunction <SetGlobalTimerMillisecoundsType>("daa_set_global_timer_ms"); _SetGlobalTimerSeconds = runtimehost.LoadFunction <SetGlobalTimerSecondsType>("daa_set_global_timer_s"); _GetGlobalTime = runtimehost.LoadFunction <GetGlobalTimeType>("daa_getGlobalTime"); }
/// <summary> /// The process record method. /// </summary> protected override void ProcessRecord() { ResponseType response = null; base.ProcessRecord(); try { var vipNode = new CreateNodeType { networkDomainId = NetworkDomain.id, name = NodeName, description = Description, ItemElementName = IPType, Item = IPAddress, status = Enabled ? "ENABLED" : "DISABLED", healthMonitorId = HealthMonitorId, connectionLimit = ConnectionLimit, connectionRateLimit = ConnectionRateLimit }; response = Connection.ApiClient.Networking.VipNode.CreateNode(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> /// Creates a Node on a Network Domain in an MCP 2.0 data center location. /// </summary> /// <param name="node">The create node.</param> /// <returns>The async task of <see cref="ResponseType"/></returns> public async Task <ResponseType> CreateNode(CreateNodeType node) { return(await _api.PostAsync <CreateNodeType, ResponseType>(ApiUris.AddVipNode(_api.OrganizationId), node)); }