コード例 #1
0
ファイル: ImageStore.cs プロジェクト: andersosthus/SfCmd
        public async Task ListAsync(string packageName = null)
        {
            try
            {
                var requestUriTemp = string.IsNullOrWhiteSpace(packageName)
                    ? ClusterConnection.CreateUri($"/ImageStore")
                    : ClusterConnection.CreateUri($"/ImageStore/{packageName}");

                var queryParams = new Dictionary <string, string>
                {
                    ["api-version"] = Constants.ApiVersion
                };
                var requestUri = QueryHelpers.AddQueryString(requestUriTemp.ToString(), queryParams);

                var response = await ClusterConnection.HttpClient.GetAsync(requestUri).ConfigureAwait(false);

                response.EnsureSuccessStatusCode();

                var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #2
0
        private KubeClientOptions GetKubeClientOptions(ClusterConnection settings)
        {
            switch (settings.Kind)
            {
            case ConfigKind.NoAuthentication:
                return(new KubeClientOptions
                {
                    ApiEndPoint = new Uri(settings.Url),
                    AuthStrategy = KubeAuthStrategy.None,
                    AllowInsecure = settings.AllowInsecure, // Don't validate server certificate
                    KubeNamespace = settings.DefaultNamespace,
                });

            case ConfigKind.KubeConfigFile:
                return(K8sConfig.Load(settings.KubeConfigFile).ToKubeClientOptions(
                           kubeContextName: settings.DefaultContext,
                           defaultKubeNamespace: settings.DefaultNamespace
                           ));

            case ConfigKind.BearerToken:
                return(new KubeClientOptions
                {
                    ApiEndPoint = new Uri(settings.Url),
                    AuthStrategy = KubeAuthStrategy.BearerToken,
                    AccessToken = settings.AccessToken,
                    AllowInsecure = settings.AllowInsecure, // Don't validate server certificate
                    KubeNamespace = settings.DefaultNamespace,
                });

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #3
0
        public void CopyConnectionTest()
        {
            ClusterConnection c = target.CopyConnection();

            Assert.IsInstanceOfType(c, typeof(ClusterConnection));
            Assert.IsInstanceOfType(c, typeof(BrightClusterConnection));
            Assert.IsInstanceOfType(c.Connection(), typeof(BrightClusterShell));
            Assert.AreNotSame(c.Connection(), target.Connection());
            BrightClusterShell s1 = (BrightClusterShell)target.Connection();
            BrightClusterShell s2 = (BrightClusterShell)c.Connection();

            Assert.AreEqual(s1.password, s2.password);
            Assert.AreEqual(s1.username, s2.username);
            Assert.AreEqual(s1.url, s2.url);
            BrightClusterConnection con = (BrightClusterConnection)c;

            Assert.AreEqual(target.password, con.password);
            Assert.AreEqual(s1.password, target.password);

            Assert.AreEqual(target.username, con.username);
            Assert.AreEqual(s1.username, target.username);

            Assert.AreEqual(target.url, con.url);
            Assert.AreEqual(s1.url, target.url);
        }
コード例 #4
0
        private async Task LoadBalancingTask(ClusterConnection connection)
        {
            for (int instanceId = 0; instanceId < 2; ++instanceId)
            {
                await connection.SendAsync <LoadBalancingInitRequest>(new DeliveryOptions { InstanceId = instanceId });
            }

            const int requestsCount = 100;

            for (int i = 0; i < requestsCount; ++i)
            {
                await connection.SendAsync <LoadBalancingRequest>();
            }

            var requestsHandled = new List <int>();

            for (int instanceId = 0; instanceId < 2; ++instanceId)
            {
                var response = await connection
                               .SendAsync <LoadBalancingGetStatsRequest, LoadBalancingGetStatsResponse>(new DeliveryOptions { InstanceId = instanceId });

                int value = response?.Result ?? 0;

                Assert.True(value > 0);

                requestsHandled.Add(value);
            }

            Assert.Equal(2, requestsHandled.Count);
            Assert.Equal(requestsCount, requestsHandled.Sum());
            Assert.True((double)Math.Abs(requestsHandled[0] - requestsHandled[1]) / requestsCount < 0.25);
        }
コード例 #5
0
        private async Task SequentialSumTask(ClusterConnection connection)
        {
            const int requestCount = 10;
            int       expectedSum  = 0;

            var initResponse =
                await connection.SendAsync <InitSumRequest, InitSumResponse>();

            int instanceId = initResponse?.InstanceId ?? -1;
            int counterId  = initResponse?.CounterId ?? -1;

            for (int i = 0; i < requestCount; ++i)
            {
                expectedSum += i;
                await connection.SendAsync(new DeliveryOptions { InstanceId = instanceId }, new AddRequest { CounterId = counterId, Value = i });
            }

            var getResponse =
                await connection.SendAsync <GetSumRequest, GetSumResponse>(
                    new DeliveryOptions { InstanceId = instanceId },
                    new GetSumRequest { CounterId = counterId }
                    );

            Assert.Equal(expectedSum, getResponse?.Result ?? 0);
        }
コード例 #6
0
        /// <summary>
        /// Adds new nodes to the system.
        /// </summary>
        /// <param name="monitoredSystems">A list containing the nodes to be added.</param>
        private void AddNodes(object monitoredSystems)
        {
            var nodes = (List <WorkstationInfo>)monitoredSystems;

            foreach (WorkstationInfo current in nodes)
            {
                RegisterNode(current, clusterType.ToString() + ID);
            }

            PluginManager.Instance.UpdateDatabase();

            foreach (WorkstationInfo current in nodes)
            {
                ClusterConnection nodeConnection = clusterConnection.CopyConnection();

                foreach (IPlugin currentPlugin in clusterPlugins)
                {
                    CreateTimerJobs(new List <WorkstationInfo> {
                        current
                    }, new List <IPlugin> {
                        currentPlugin
                    }, nodeConnection);
                }
            }
        }
コード例 #7
0
ファイル: Client.cs プロジェクト: sn0opy/EVESharp
 public Client(NodeContainer container, ClusterConnection clusterConnection, ServiceManager serviceManager, ItemFactory itemFactory)
 {
     this.Container            = container;
     this.ClusterConnection    = clusterConnection;
     this.ServiceManager       = serviceManager;
     this.ItemFactory          = itemFactory;
     this.PendingNotifications = new PyList();
 }
コード例 #8
0
        public async void New()
        {
            var connection = new ClusterConnection();

            if (await Edit(connection))
            {
                Connections.Add(connection);
            }
        }
コード例 #9
0
        private async Task SquaresAsyncTask(ClusterConnection connection)
        {
            const int requestCount = 10;

            for (int i = 0; i < requestCount; ++i)
            {
                var response = await connection
                               .SendAsync <SquareRequest, SquareResponse>(new SquareRequest { Value = i });

                Assert.Equal(i * i, response?.Result ?? 0);
            }
        }
コード例 #10
0
        public void AcquireDataTest()
        {
            GraphicCard       target = new GraphicCard();                     // TODO: Passenden Wert initialisieren
            string            monitoredSystemName             = string.Empty; // TODO: Passenden Wert initialisieren
            ClusterConnection clusterConnection               = null;         // TODO: Passenden Wert initialisieren
            List <Tuple <string, object, DataType> > expected = null;         // TODO: Passenden Wert initialisieren
            List <Tuple <string, object, DataType> > actual;

            actual = target.AcquireData(monitoredSystemName, clusterConnection);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Überprüfen Sie die Richtigkeit dieser Testmethode.");
        }
コード例 #11
0
            public void ConvertClusterErrorToClientError()
            {
                var connMock    = new Mock <IConnection>();
                var handlerMock = new Mock <IClusterErrorHandler>();
                var clusterConn = new ClusterConnection(connMock.Object, Uri, AccessMode.Read, handlerMock.Object);

                var inError  = new ClientException("random error");
                var outError = Record.Exception(() => clusterConn.OnError(inError));

                outError.Should().Be(inError);
                handlerMock.Verify(x => x.OnConnectionError(Uri, inError), Times.Never);
                handlerMock.Verify(x => x.OnWriteError(Uri), Times.Never);
            }
コード例 #12
0
            public async Task ConvertConnectionErrorToSessionExpired()
            {
                var handlerMock = new Mock <IClusterErrorHandler>();
                var clusterConn =
                    new ClusterConnection(CreateConnectionWithMode(AccessMode.Read), Uri, handlerMock.Object);

                var inError  = new ServiceUnavailableException("Connection error");
                var outError = await Record.ExceptionAsync(() => clusterConn.OnErrorAsync(inError));

                outError.Should().BeOfType <SessionExpiredException>();
                handlerMock.Verify(x => x.OnConnectionErrorAsync(Uri, inError), Times.Once);
                handlerMock.Verify(x => x.OnWriteError(Uri), Times.Never);
            }
コード例 #13
0
            public async Task TreatsDatabaseUnavailableAsConnectionError()
            {
                var handlerMock = new Mock <IClusterErrorHandler>();
                var clusterConn =
                    new ClusterConnection(CreateConnectionWithMode(AccessMode.Read), Uri, handlerMock.Object);

                var inError  = new TransientException("Neo.TransientError.General.DatabaseUnavailable", "Store copying");
                var outError = await Record.ExceptionAsync(() => clusterConn.OnErrorAsync(inError));

                outError.Should().BeEquivalentTo(inError);

                handlerMock.Verify(x => x.OnConnectionErrorAsync(Uri, inError));
            }
コード例 #14
0
ファイル: BaseTest.cs プロジェクト: dbratus/PingPong
        private ClusterConnection CreateConnection(string[] uris, ISerializer seriaizer)
        {
            var connection = new ClusterConnection(uris, new ClusterConnectionSettings {
                Serializer  = seriaizer,
                TlsSettings =
                {
                    AllowSelfSignedCertificates = true
                }
            });

            connection.Connect().Wait();
            return(connection);
        }
コード例 #15
0
            public async Task ConvertWriteClusterErrorToSessionExpiredError(string code)
            {
                var handlerMock = new Mock <IClusterErrorHandler>();
                var clusterConn =
                    new ClusterConnection(CreateConnectionWithMode(AccessMode.Write), Uri, handlerMock.Object);

                var inError  = ErrorExtensions.ParseServerException(code, null);
                var outError = await Record.ExceptionAsync(() => clusterConn.OnErrorAsync(inError));

                outError.Should().BeOfType <SessionExpiredException>();
                handlerMock.Verify(x => x.OnConnectionErrorAsync(Uri, inError), Times.Never);
                handlerMock.Verify(x => x.OnWriteError(Uri), Times.Once);
            }
コード例 #16
0
            public void ConvertConnectionErrorToSessionExpired()
            {
                var connMock    = new Mock <IConnection>();
                var handlerMock = new Mock <IClusterErrorHandler>();
                var clusterConn = new ClusterConnection(connMock.Object, Uri, AccessMode.Read, handlerMock.Object);

                var inError  = new ServiceUnavailableException("Connection error");
                var outError = Record.Exception(() => clusterConn.OnError(inError));

                outError.Should().BeOfType <SessionExpiredException>();
                handlerMock.Verify(x => x.OnConnectionError(Uri, inError), Times.Once);
                handlerMock.Verify(x => x.OnWriteError(Uri), Times.Never);
            }
コード例 #17
0
            public void TreatsDatabaseUnavailableAsConnectionError()
            {
                var connMock    = new Mock <IConnection>();
                var handlerMock = new Mock <IClusterErrorHandler>();
                var clusterConn = new ClusterConnection(connMock.Object, Uri, AccessMode.Read, handlerMock.Object);

                var inError  = new TransientException("Neo.TransientError.General.DatabaseUnavailable", "Store copying");
                var outError = Record.Exception(() => clusterConn.OnError(inError));

                outError.ShouldBeEquivalentTo(inError);

                handlerMock.Verify(x => x.OnConnectionError(Uri, inError));
            }
コード例 #18
0
            public void ConvertWriteClusterErrorToSessionExpiredError(string code)
            {
                var connMock    = new Mock <IConnection>();
                var handlerMock = new Mock <IClusterErrorHandler>();
                var clusterConn = new ClusterConnection(connMock.Object, Uri, AccessMode.Write, handlerMock.Object);

                var inError  = ErrorExtensions.ParseServerException(code, null);
                var outError = Record.Exception(() => clusterConn.OnError(inError));

                outError.Should().BeOfType <SessionExpiredException>();
                handlerMock.Verify(x => x.OnConnectionError(Uri, inError), Times.Never);
                handlerMock.Verify(x => x.OnWriteError(Uri), Times.Once);
            }
コード例 #19
0
            public async Task ConvertClusterErrorToClientError()
            {
                var handlerMock = new Mock <IClusterErrorHandler>();
                var clusterConn =
                    new ClusterConnection(CreateConnectionWithMode(AccessMode.Read), Uri, handlerMock.Object);

                var inError  = new ClientException("random error");
                var outError = await Record.ExceptionAsync(() => clusterConn.OnErrorAsync(inError));

                outError.Should().Be(inError);
                handlerMock.Verify(x => x.OnConnectionErrorAsync(Uri, inError), Times.Never);
                handlerMock.Verify(x => x.OnWriteError(Uri), Times.Never);
            }
コード例 #20
0
ファイル: Register.cs プロジェクト: andersosthus/SfCmd
        public async Task <bool> RegisterAsync(string packageName)
        {
            try
            {
                var requestUriTemp = ClusterConnection.CreateUri($"/ApplicationTypes/$/Provision").ToString();
                var queryParams    = new Dictionary <string, string>
                {
                    ["api-version"] = Constants.ApiVersion
                };
                var requestUri = QueryHelpers.AddQueryString(requestUriTemp, queryParams);

                var body = new Dictionary <string, object>
                {
                    ["ApplicationTypeBuildPath"] = packageName
                };

                var bodyContent = new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, "application/json");

                Logger.Log($"Registering {packageName}");
                var response =
                    await ClusterConnection.HttpClient.PostAsync(requestUri, bodyContent).ConfigureAwait(false);

                if (!response.IsSuccessStatusCode)
                {
                    try
                    {
                        var errorBody = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

                        Console.WriteLine("Things exploded...");
                        Console.WriteLine(errorBody);
                    }
                    catch (Exception ex)
                    {
                        return(false);
                    }

                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(false);
            }

            return(true);
        }
コード例 #21
0
ファイル: contractMgr.cs プロジェクト: lanicon/EVESharp
        private void PrepareItemsForCourierOrAuctionContract(MySqlConnection connection, ulong contractID,
                                                             ClusterConnection clusterConnection, PyList <PyList> itemList, Station station, int ownerID, int shipID)
        {
            // create the container in the system to ensure it's not visible to the player
            Container container = this.ItemFactory.CreateSimpleItem(this.TypeManager[Types.PlasticWrap],
                                                                    this.ItemFactory.LocationSystem.ID, station.ID, Flags.None) as Container;

            Dictionary <int, ContractDB.ItemQuantityEntry> items =
                this.DB.PrepareItemsForContract(connection, contractID, itemList, station, ownerID, container.ID, shipID);

            double volume = 0;

            // build notification for item changes
            OnItemChange changes            = new OnItemChange();
            long         stationNode        = this.SystemManager.GetNodeStationBelongsTo(station.ID);
            bool         stationBelongsToUs = this.SystemManager.StationBelongsToUs(station.ID);

            // notify the changes in the items to the nodes
            foreach ((int _, ContractDB.ItemQuantityEntry item) in items)
            {
                if (stationNode == 0 || stationBelongsToUs == true)
                {
                    ItemEntity entity = this.ItemFactory.LoadItem(item.ItemID);

                    entity.LocationID = container.ID;
                    entity.Persist();

                    // notify the character
                    this.NotificationManager.NotifyCharacter(ownerID, Notifications.Client.Inventory.OnItemChange.BuildLocationChange(entity, station.ID));
                }
                else
                {
                    // queue the notification
                    changes.AddChange(item.ItemID, "locationID", station.ID, container.ID);
                }

                // ensure the volume is taken into account
                volume += item.Volume;
            }

            // notify the proper node if needed
            if (changes.Updates.Count > 0)
            {
                this.NotificationManager.NotifyNode(stationNode, changes);
            }

            // update the contract with the crate and the new volume
            this.DB.UpdateContractCrateAndVolume(ref connection, contractID, container.ID, volume);
        }
コード例 #22
0
ファイル: ServiceHost.cs プロジェクト: dbratus/PingPong
        private static async Task ConnectCluster(ServiceHostConfig config, ClusterConnection clusterConnection)
        {
            _logger.Info("Connecting cluster after {0} sec.", config.ClusterConnectionSettings.ConnectionDelay);

            try
            {
                await clusterConnection.Connect(TimeSpan.FromSeconds(config.ClusterConnectionSettings.ConnectionDelay));

                _logger.Info("Cluster connected.");
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Failed to connect cluster. Interservice communication is not available.");
            }
        }
コード例 #23
0
ファイル: ImageStore.cs プロジェクト: andersosthus/SfCmd
        public async Task <bool> UploadAsync(FileInfo file, string fileInImageStore, string appPackagePathInStore)
        {
            try
            {
                var fileRelativePath = $"{appPackagePathInStore}\\{fileInImageStore}";
                var requestUriTemp   =
                    ClusterConnection.CreateUri($"/ImageStore/{appPackagePathInStore}\\{fileInImageStore}").ToString();

                var queryParams = new Dictionary <string, string>
                {
                    ["api-version"] = Constants.ApiVersion
                };
                var requestUri = QueryHelpers.AddQueryString(requestUriTemp, queryParams);

                ByteArrayContent byteContent;

                // Handle the _.dir marker files
                if (file.Name.Equals("_.dir", StringComparison.CurrentCultureIgnoreCase))
                {
                    byteContent = new ByteArrayContent(new byte[0]);
                }
                else
                {
                    using (
                        var sourceStream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.None)
                        )
                    {
                        var data = new byte[file.Length];
                        await sourceStream.ReadAsync(data, 0, data.Length).ConfigureAwait(false);

                        byteContent = new ByteArrayContent(data);
                    }
                }

                Logger.Log($"Uploading {file.FullName} as {fileRelativePath}");

                var response = await retryPolicy
                               .ExecuteAsync(() => ClusterConnection.HttpClient.PutAsync(requestUri, byteContent))
                               .ConfigureAwait(false);

                return(response.IsSuccessStatusCode);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(false);
            }
        }
コード例 #24
0
ファイル: BaseTest.cs プロジェクト: dbratus/PingPong
        protected void WaitForPendingRequests(ClusterConnection connection, double mult = 1.0)
        {
            var startedAt = DateTime.Now;

            while (connection.HasPendingRequests)
            {
                if (DateTime.Now - startedAt > MaxTestTime * mult)
                {
                    throw new Exception("Test timeout");
                }

                connection.Update();

                Thread.Yield();
            }
        }
コード例 #25
0
ファイル: BaseTest.cs プロジェクト: dbratus/PingPong
        protected void WaitForTaskCompletion(ClusterConnection connection, Task task, double mult = 1.0)
        {
            var startedAt = DateTime.Now;

            while (!task.IsCompleted)
            {
                if (DateTime.Now - startedAt > MaxTestTime * mult)
                {
                    throw new Exception("Test timeout");
                }

                connection.Update();

                Thread.Yield();
            }
        }
コード例 #26
0
ファイル: Application.cs プロジェクト: andersosthus/SfCmd
        public async Task <bool> UpgradeAsync(ApplicationUpgrade upgradeOptions)
        {
            try
            {
                var requestUriTemp =
                    ClusterConnection.CreateUri($"/Applications/{upgradeOptions.ApplicationName}/$/Upgrade").ToString();
                var queryParams = new Dictionary <string, string>
                {
                    ["api-version"] = Constants.ApiVersion
                };
                var requestUri = QueryHelpers.AddQueryString(requestUriTemp, queryParams);

                var body = new Dictionary <string, object>
                {
                    ["Name"] = upgradeOptions.ApplicationName,
                    ["TargetApplicationTypeVersion"] = upgradeOptions.TargetVersion,
                    ["UpgradeKind"]        = 1,
                    ["RollingUpgradeMode"] = (int)upgradeOptions.RollingUpgradeMode,
                    ["ForceRestart"]       = upgradeOptions.ForceRestart,
                    ["MonitoringPolicy"]   = new Dictionary <string, object>
                    {
                        ["FailureAction"] = (int)upgradeOptions.FailureAction,
                        ["HealthCheckWaitDurationInMilliseconds"] =
                            upgradeOptions.HealthCheckWaitDuration.ToMilliSeconds().ToString(),
                        ["HealthCheckStableDurationInMilliseconds"] =
                            upgradeOptions.HealthCheckStableDuration.ToMilliSeconds().ToString(),
                        ["HealthCheckRetryTimeoutInMilliseconds"] =
                            upgradeOptions.HealthCheckRetryTimeout.ToMilliSeconds().ToString(),
                    }
                };
                var jsonContent = new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, "application/json");

                var response = await ClusterConnection.HttpClient
                               .PostAsync(requestUri, jsonContent)
                               .ConfigureAwait(false);

                response.EnsureSuccessStatusCode();

                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            return(false);
        }
コード例 #27
0
        private object FormatClusterConnection(ClusterConnection clusterConnection)
        {
            var resultPSObj = new PSObject(clusterConnection);

            var fabricClientSettingsPSObj = new PSObject(clusterConnection.FabricClientSettings);

            fabricClientSettingsPSObj.Members.Add(
                new PSCodeMethod(
                    Constants.ToStringMethodName,
                    typeof(OutputFormatter).GetMethod(Constants.FormatObjectMethodName)));

            resultPSObj.Properties.Add(
                new PSNoteProperty(
                    Constants.ClusterConnectionFabricClientSettingsPropertyName,
                    fabricClientSettingsPSObj));

            if (clusterConnection.GatewayInformation != null)
            {
                var gatewayInfoPSObj = new PSObject(clusterConnection.GatewayInformation);
                gatewayInfoPSObj.Members.Add(
                    new PSCodeMethod(
                        Constants.ToStringMethodName,
                        typeof(OutputFormatter).GetMethod(Constants.FormatObjectMethodName)));

                resultPSObj.Properties.Add(
                    new PSNoteProperty(
                        Constants.GatewayInformationPropertyName,
                        gatewayInfoPSObj));
            }

            if (clusterConnection.AzureActiveDirectoryMetadata != null)
            {
                var metadataPSObj = new PSObject(clusterConnection.AzureActiveDirectoryMetadata);
                metadataPSObj.Members.Add(
                    new PSCodeMethod(
                        Constants.ToStringMethodName,
                        typeof(OutputFormatter).GetMethod(Constants.FormatObjectMethodName)));

                resultPSObj.Properties.Add(
                    new PSNoteProperty(
                        Constants.AzureActiveDirectoryMetadataPropertyName,
                        metadataPSObj));
            }

            return(resultPSObj);
        }
コード例 #28
0
        private async Task ServiceCommunicationTask(ClusterConnection connection)
        {
            const string expectedMessage = "Test message";

            var transferResponse = await connection
                                   .SendAsync <TransferMessageRequest, TransferMessageResponse>(new TransferMessageRequest {
                Message = expectedMessage
            });

            var options = new DeliveryOptions {
                InstanceId = transferResponse?.ServedByInstance ?? -1
            };
            var getResponse = await connection
                              .SendAsync <GetTransferredMessageRequest, GetTransferredMessageResponse>(options);

            Assert.Equal(expectedMessage, getResponse?.Message ?? "");
        }
コード例 #29
0
ファイル: ServiceHost.cs プロジェクト: dbratus/PingPong
        private async Task UpdateClusterConnection(ServiceHostConfig config, ClusterConnection clusterConnection)
        {
            try
            {
                while (_updateClusterConnection)
                {
                    clusterConnection.Update();

                    await Task.Delay(TimeSpan.FromMilliseconds(config.ClusterConnectionSettings.UpdatePeriodMs));
                }
            }
            catch (Exception ex)
            {
                // Server callbacks are just async completions. They are not expected to throw exceptions.
                _logger.Fatal(ex, "Callbacks invocation faulted. No more callbacks will be invoked.");
            }
        }
コード例 #30
0
        public ClusterViewModel(ClusterConnection settings)
            : base(null, "cluster")
        {
            Settings = settings;
            Log      = new ObservableCollection <string>();
            Log.Add("Init cluster");

            ILoggerFactory loggers = new LoggerFactory();

            loggers.AddProvider(new StringLoggerProvider(Log));

            var options = GetKubeClientOptions(settings);

            options.LoggerFactory = loggers;
            Cluster   = new Cluster(loggers, options, System.Reactive.Concurrency.DispatcherScheduler.Current);
            TabTitle  = Cluster.Options?.ApiEndPoint?.ToString() ?? "Cluster xxx";
            Namespace = settings.DefaultNamespace;
        }