public static Tuple <string, GatewayMethodType> Invoke(string requestedUrl)
        {
            ClusterModel cluster = IoC.Resolve <ClusterRepository>()
                                   .FindAll()
                                   .FromRoute(requestedUrl);

            string resolvedLoadBalancer = _resolveLoadBalancer(cluster);

            switch (cluster.GatewayType)
            {
            case GatewayMethodType.PROXY:
            {
                string resolvedProxy = _routeToProxy(resolvedLoadBalancer);
                return(new Tuple <string, GatewayMethodType>(resolvedProxy, cluster.GatewayType));
            }

            case GatewayMethodType.REDIRECT:
            {
                return(new Tuple <string, GatewayMethodType>(resolvedLoadBalancer, cluster.GatewayType));
            }

            default:
            {
                throw new Exception(string.Format("Gateway Method '{0}' is Not A Supported Type", cluster.GatewayType.ToString()));
            }
            }
        }
Example #2
0
    private ClusterState GetClusterInfo(string id, string policy, bool enabled = true)
    {
        var clusterModel = new ClusterModel(
            new ClusterConfig
        {
            ClusterId   = id,
            HealthCheck = new HealthCheckConfig
            {
                Passive = new PassiveHealthCheckConfig
                {
                    Enabled = enabled,
                    Policy  = policy,
                }
            }
        },
            new HttpMessageInvoker(new HttpClientHandler()));
        var clusterState = new ClusterState(id);

        clusterState.Model = clusterModel;
        clusterState.Destinations.GetOrAdd("destination0", id => new DestinationState(id));
        clusterState.Destinations.GetOrAdd("destination1", id => new DestinationState(id));

        clusterState.DestinationsState = new ClusterDestinationsState(clusterState.Destinations.Values.ToList(), clusterState.Destinations.Values.ToList());

        return(clusterState);
    }
Example #3
0
        public ActionResult CreateCluster(ClusterModel objCluster)
        {
            var resultDto = new ResultDto();
            //if (ModelState.IsValid)
            //{
            var clusterDto = Mapper.Map <ClusterModel, ClusterDto>(objCluster);

            clusterDto.UserID = UserInfo.UserID;
            if (clusterDto.ClusterID == 0)
            {
                resultDto = _clusterService.Insert(clusterDto);
            }
            else
            {
                resultDto = _clusterService.Update(clusterDto);
            }
            if (resultDto.ObjectId > 0)
            {
                clusterDto           = _clusterService.GetByID(resultDto.ObjectId);
                objCluster           = Mapper.Map <ClusterDto, ClusterModel>(clusterDto);
                resultDto.ObjectCode = clusterDto.ClusterCode;
            }
            //}

            LoadDropDowns();

            ViewBag.Result = resultDto;
            return(View(objCluster));
        }
Example #4
0
        public void TestDeleteMultipleId()
        {
            long id = 123;

            var expected = new ClusterModel()
            {
                Id   = id,
                Name = "Local Machine",
                Ips  = "127.0.0.1",
            };

            Mock.Reset();
            Mock.Setup(srv => srv.Get(id, "Test User")).Returns(expected);
            Mock.Setup(srv => srv.Delete(It.IsAny <long>(), "Test User")).Returns(2);

            MockUser.Reset();

            LogAssert.Expect(LogType.Exception, new Regex("^Exception: More than one cluster has id"));

            var result = Browser.Delete($"/clusters/{id}").Result;

            Assert.AreEqual(HttpStatusCode.InternalServerError, result.StatusCode);
            Assert.That(result.ContentType.StartsWith("application/json"));
            Mock.Verify(srv => srv.Get(id, It.IsAny <string>()), Times.Once);
            Mock.Verify(srv => srv.Delete(id, "Test User"), Times.Once);
            Mock.VerifyNoOtherCalls();

            MockUser.VerifyNoOtherCalls();
        }
Example #5
0
        public void TestDeleteMissingId()
        {
            long id = 12345;

            var expected = new ClusterModel()
            {
                Id   = id,
                Name = "Local Machine",
                Ips  = "127.0.0.1",
            };

            Mock.Reset();
            Mock.Setup(srv => srv.Get(id, "Test User")).Returns(expected);
            Mock.Setup(srv => srv.Delete(It.IsAny <long>(), "Test User")).Returns(0);

            MockUser.Reset();

            var result = Browser.Delete($"/clusters/{id}").Result;

            Assert.AreEqual(HttpStatusCode.NotFound, result.StatusCode);
            Assert.That(result.ContentType.StartsWith("application/json"));

            Mock.Verify(srv => srv.Get(id, It.IsAny <string>()), Times.Once);
            Mock.Verify(srv => srv.Delete(id, "Test User"), Times.Once);
            Mock.VerifyNoOtherCalls();

            MockUser.VerifyNoOtherCalls();
        }
Example #6
0
 public long Add(ClusterModel cluster)
 {
     using (var db = DatabaseManager.Open())
     {
         return((long)db.Insert(cluster));
     }
 }
Example #7
0
 public int Update(ClusterModel cluster)
 {
     using (var db = DatabaseManager.Open())
     {
         return(db.Update(cluster));
     }
 }
        public AddClusterViewModel()
        {
            Cluster         = new ClusterModel();
            ValidationRules = new ClusterValidator();

            // Command
            PostCommand = new Command(Post);
        }
Example #9
0
 public static ClusterResponse Create(ClusterModel cluster)
 {
     return(new ClusterResponse()
     {
         Id = cluster.Id,
         Name = cluster.Name,
         Ips = string.IsNullOrEmpty(cluster.Ips) ? Array.Empty <string>() : cluster.Ips.Split(','),
     });
 }
Example #10
0
        public static ILoadDistributor MapTypeToDistrubtor(this ClusterModel node)
        {
            switch (node.LoadDistributorType)
            {
            case LoadDistributorType.ROUND_ROBIN:
                return(IoC.Resolve <RoundRobinDistribution>());

            default:
                return(null);
            }
        }
Example #11
0
        public static Task AddCluster(ClusterModel model)
        {
            var foundService = _serviceRepo.FindById(model.ServiceId);

            if (foundService == null)
            {
                throw new Exception("Service Does Not Exist, To Create a Cluster a Valid Serice Should Exist");
            }

            return(_repo.Create(model));
        }
Example #12
0
    public void ReassignProxyRequest_Success()
    {
        var client  = new HttpMessageInvoker(new SocketsHttpHandler());
        var context = new DefaultHttpContext();
        var d1      = new DestinationState("d1");
        var d2      = new DestinationState("d2");
        var cc1     = new ClusterConfig()
        {
            ClusterId = "c1"
        };
        var cm1 = new ClusterModel(cc1, client);
        var cs1 = new ClusterState("c1")
        {
            Model = cm1
        };
        var r1 = new RouteModel(new RouteConfig()
        {
            RouteId = "r1"
        }, cs1, HttpTransformer.Empty);
        var feature = new ReverseProxyFeature()
        {
            AllDestinations       = d1,
            AvailableDestinations = d1,
            Cluster            = cm1,
            Route              = r1,
            ProxiedDestination = d1,
        };

        context.Features.Set <IReverseProxyFeature>(feature);

        var cc2 = new ClusterConfig()
        {
            ClusterId = "cc2"
        };
        var cm2 = new ClusterModel(cc2, client);
        var cs2 = new ClusterState("cs2")
        {
            DestinationsState = new ClusterDestinationsState(d2, d2),
            Model             = cm2,
        };

        context.ReassignProxyRequest(cs2);

        var newFeature = context.GetReverseProxyFeature();

        Assert.NotSame(feature, newFeature);
        Assert.Same(d2, newFeature.AllDestinations);
        Assert.Same(d2, newFeature.AvailableDestinations);
        Assert.Same(d1, newFeature.ProxiedDestination); // Copied unmodified.
        Assert.Same(cm2, newFeature.Cluster);
        Assert.Same(r1, newFeature.Route);
    }
Example #13
0
        // ctor
        public ClusterDetailsViewModel(ClusterModel cluster)
        {
            // Property
            Cluster = cluster;
            Teams   = new ObservableCollection <TeamModel>();

            // Command
            GoToLocationCommand = new Command(GoToLocation);
            ShowLocationCommand = new Command(ShowLocation);
            DeleteCommand       = new Command(Delete);
            GoToPutPageCommand  = new Command(GoToPutPage);
            PullRefreshCommand  = new Command(Refresh);
        }
        public async Task NoDestinations_503()
        {
            var httpContext = new DefaultHttpContext();

            httpContext.Request.Method = "GET";
            httpContext.Request.Scheme = "https";
            httpContext.Request.Host   = new HostString("example.com");

            var httpClient   = new HttpMessageInvoker(new Mock <HttpMessageHandler>().Object);
            var cluster1     = new ClusterState(clusterId: "cluster1");
            var clusterModel = new ClusterModel(new ClusterConfig(), httpClient);
            var routeConfig  = new RouteModel(
                config: new RouteConfig(),
                cluster: cluster1,
                transformer: HttpTransformer.Default);

            httpContext.Features.Set <IReverseProxyFeature>(
                new ReverseProxyFeature()
            {
                AvailableDestinations = Array.Empty <DestinationState>(),
                Cluster = clusterModel,
                Route   = routeConfig,
            });

            Mock <IHttpForwarder>()
            .Setup(h => h.SendAsync(
                       httpContext,
                       It.IsAny <string>(),
                       httpClient,
                       It.IsAny <ForwarderRequestConfig>(),
                       It.IsAny <HttpTransformer>()))
            .Returns(() => throw new NotImplementedException());

            var sut = Create <ForwarderMiddleware>();

            Assert.Equal(0, cluster1.ConcurrencyCounter.Value);

            await sut.Invoke(httpContext);

            Assert.Equal(0, cluster1.ConcurrencyCounter.Value);

            Mock <IHttpForwarder>().Verify();
            Assert.Equal(StatusCodes.Status503ServiceUnavailable, httpContext.Response.StatusCode);
            var errorFeature = httpContext.Features.Get <IForwarderErrorFeature>();

            Assert.Equal(ForwarderError.NoAvailableDestinations, errorFeature?.Error);
            Assert.Null(errorFeature.Exception);
        }
Example #15
0
        // ctor
        public ClusterViewModel()
        {
            // Property
            Clusters        = new ObservableCollection <ClusterModel>();
            SelectedCluster = new ClusterModel();

            // Get
            Get();


            // Command
            SaveAsPDFCommand       = new Command(SaveAsPDF);
            PullRefreshCommand     = new Command(Refresh);
            GoToPostPageCommand    = new Command(GoToPostPage);
            GoToDetailsPageCommand = new Command(GoToDetailsPage);
        }
Example #16
0
        /*
         * Create mining model for the selected mining strucutre
         */
        private void CreateModels(MiningStructure objStructure)
        {
            MiningModel       ClusterModel;
            MiningModel       TreeModel;
            MiningModelColumn mmc;

            // Create the Cluster model and set the algorithm
            // and parameters
            DropExistingMiningModels(objStructure, sModelName);
            ClusterModel           = objStructure.CreateMiningModel(true, sModelName);
            ClusterModel.Algorithm = MiningModelAlgorithms.MicrosoftClustering;// "Microsoft_Clustering";
            ClusterModel.AlgorithmParameters.Add("CLUSTER_COUNT", 0);
            ClusterModel.Update();


            // The CreateMiningModel method adds
            // all the structure columns to the collection
            // Copy the Cluster model and change the necessary properties
            TreeModel = ClusterModel.Clone();
            DropExistingMiningModels(objStructure, sModelName + "Generation Trees");
            TreeModel.Name      = sModelName + "Generation Trees";
            TreeModel.ID        = sModelName + "Generation Trees";
            TreeModel.Algorithm = MiningModelAlgorithms.MicrosoftDecisionTrees;// "Microsoft_Decision_Trees";
            TreeModel.AlgorithmParameters.Clear();
            TreeModel.Columns["Gender"].Usage = "Predict";
            //TreeModel.Columns["PayChannels"].Usage = "Predict";

            // Add an aliased copy of the PayChannels table to the trees model
            mmc = TreeModel.Columns.Add("MaritalStatus");
            mmc.SourceColumnID = "MaritalStatus";
            mmc = mmc.Columns.Add("MaritalStatus");
            mmc.SourceColumnID = "MaritalStatus";
            mmc.Usage          = "Key";
            // Now set a filter on the PayChannels_Hbo_Encore table and use it
            // as input to predict other channels

            //TreeModel.Columns["PayChannels_Hbo_Encore"].Filter = "Channel=’HBO’ OR Channel=’Encore’";
            // Set a complementary filter on the payChannels predictable
            // nested table

            //TreeModel.Columns["PayChannels"].Filter = "Channel<>’HBO’ AND Channel<>’Encore’";
            objStructure.MiningModels.Add(TreeModel);

            // Submit the models to the server
            // ToDo: fix this
            //TreeModel.Update();
        }
Example #17
0
        public ActionResult CreateCluster(string id)
        {
            int ClusterId    = string.IsNullOrEmpty(id.DecryptString()) ? default(int) : Convert.ToInt32(id.DecryptString());
            var clusterDto   = new ClusterDto();
            var clusterModel = new ClusterModel();

            LoadDropDowns();

            if (ClusterId > 0)
            {
                clusterDto   = _clusterService.GetByID(ClusterId);
                clusterModel = Mapper.Map <ClusterDto, ClusterModel>(clusterDto);
            }

            ViewBag.Result = new ResultDto();
            return(View(clusterModel));
        }
    public HttpRequestMessage CreateRequest(ClusterModel cluster, DestinationModel destination)
    {
        var probeAddress = !string.IsNullOrEmpty(destination.Config.Health) ? destination.Config.Health : destination.Config.Address;
        var probePath    = cluster.Config.HealthCheck?.Active?.Path;

        UriHelper.FromAbsolute(probeAddress, out var destinationScheme, out var destinationHost, out var destinationPathBase, out _, out _);
        var probeUri = UriHelper.BuildAbsolute(destinationScheme, destinationHost, destinationPathBase, probePath, default);

        var request = new HttpRequestMessage(HttpMethod.Get, probeUri)
        {
            Version       = cluster.Config.HttpRequest?.Version ?? HttpVersion.Version20,
            VersionPolicy = cluster.Config.HttpRequest?.VersionPolicy ?? HttpVersionPolicy.RequestVersionOrLower,
        };

        request.Headers.Add(HeaderNames.UserAgent, _defaultUserAgent);

        return(request);
    }
        private static string _resolveLoadBalancer(ClusterModel cluster)
        {
            if (cluster == null)
            {
                return(null);
            }

            var nodePool = IoC.Resolve <ServerNodeRepository>()
                           .FindAll()
                           .InPool(cluserId: cluster.Id)
                           .ToList();

            ILoadDistributor loadDistributer = cluster.MapTypeToDistrubtor();

            using (var lb = new LoadBalancer(loadDistributer, nodePool, cluster.Id))
            {
                return(lb.SelectInstanceFromPool());
            }
        }
Example #20
0
    private ClusterState GetClusterInfo(string id, int destinationCount, int?failureThreshold = null)
    {
        var metadata = failureThreshold != null
            ? new Dictionary <string, string> {
            { ConsecutiveFailuresHealthPolicyOptions.ThresholdMetadataName, failureThreshold.ToString() }
        }
            : null;
        var clusterModel = new ClusterModel(
            new ClusterConfig
        {
            ClusterId   = id,
            HealthCheck = new HealthCheckConfig()
            {
                Active = new ActiveHealthCheckConfig
                {
                    Enabled = true,
                    Policy  = "policy",
                    Path    = "/api/health/",
                },
            },
            Metadata = metadata,
        },
            new HttpMessageInvoker(new HttpClientHandler()));
        var clusterState = new ClusterState(id);

        clusterState.Model = clusterModel;
        for (var i = 0; i < destinationCount; i++)
        {
            var destinationModel = new DestinationModel(new DestinationConfig {
                Address = $"https://localhost:1000{i}/{id}/", Health = $"https://localhost:2000{i}/{id}/"
            });
            var destinationId = $"destination{i}";
            clusterState.Destinations.GetOrAdd(destinationId, id => new DestinationState(id)
            {
                Model = destinationModel
            });
        }

        clusterState.DestinationsState = new ClusterDestinationsState(clusterState.Destinations.Values.ToList(), clusterState.Destinations.Values.ToList());

        return(clusterState);
    }
Example #21
0
        public List <ClusterModel> GetCluster(long clusterId)
        {
            var localRouteModel = new ClusterModel();
            var res             = new List <ClusterModel>();

            using (var dataModel = new MibarimEntities())
            {
                /*var paths = dataModel.Path_Cluster.Where(x => x.cluster == clusterId).ToList();
                 * foreach (var pathCluster in paths)
                 * {
                 *  var thePath = dataModel.RouteRequestGPaths.FirstOrDefault(x => x.RoutePathId == pathCluster.pathId);
                 *  var routes =
                 *      dataModel.RouteRequests.Where(x => x.RouteRequestUId == thePath.RouteRequestUId).ToList();
                 *  var theRoute = routes.FirstOrDefault();
                 *  var user = dataModel.vwUserInfoes.FirstOrDefault(x => x.UserId == theRoute.RouteRequestUserId);
                 *  var timings = _timingService.GetRequestTimings(routes.Select(x => x.RouteRequestId).ToList()).ToList();
                 *  string timing = _timingService.GetTimingString(timings);
                 *  localRouteModel = new ClusterModel();
                 *  localRouteModel.NameFamily = user.Name + " " + user.Family;
                 *  localRouteModel.RouteStartTime = timing;
                 *  localRouteModel.SrcPoint.Lat = theRoute.SrcLatitude.ToString("G29");
                 *  localRouteModel.SrcPoint.Lng = theRoute.SrcLongitude.ToString("G29");
                 *  localRouteModel.DstPoint.Lat = theRoute.DstLatitude.ToString("G29");
                 *  localRouteModel.DstPoint.Lng = theRoute.DstLongitude.ToString("G29");
                 *  if (routes.FirstOrDefault().IsDrive)
                 *  {
                 *      localRouteModel.LocalRouteType = LocalRouteTypes.Driver;
                 *  }
                 *  else
                 *  {
                 *      localRouteModel.LocalRouteType = LocalRouteTypes.Passenger;
                 *  }
                 *
                 *  var routePaths = dataModel.RouteRequestGRoutes.Where(x => x.RoutePathId == thePath.RoutePathId).ToList();
                 *  localRouteModel.PathRoute.path = AdminMapper.CastRouteToPathRoute(routePaths);
                 *  res.Add(localRouteModel);
                 *
                 * }*/
            }
            return(res);
        }
Example #22
0
        private ClusterState GetClusterInfo(string id, int destinationCount, double?failureRateLimit = null, TimeSpan?reactivationPeriod = null)
        {
            var metadata = failureRateLimit != null
                ? new Dictionary <string, string> {
                { TransportFailureRateHealthPolicyOptions.FailureRateLimitMetadataName, failureRateLimit?.ToString(CultureInfo.InvariantCulture) }
            }
                : null;
            var clusterModel = new ClusterModel(
                new ClusterConfig
            {
                ClusterId   = id,
                HealthCheck = new HealthCheckConfig
                {
                    Passive = new PassiveHealthCheckConfig
                    {
                        Enabled            = true,
                        Policy             = "policy",
                        ReactivationPeriod = reactivationPeriod,
                    }
                },
                Metadata = metadata,
            },
                new HttpMessageInvoker(new HttpClientHandler()));
            var clusterState = new ClusterState(id);

            clusterState.Model = clusterModel;
            for (var i = 0; i < destinationCount; i++)
            {
                var destinationModel = new DestinationModel(new DestinationConfig {
                    Address = $"https://localhost:1000{i}/{id}/", Health = $"https://localhost:2000{i}/{id}/"
                });
                var destinationId = $"destination{i}";
                clusterState.Destinations.GetOrAdd(destinationId, id => new DestinationState(id)
                {
                    Model = destinationModel
                });
            }

            return(clusterState);
        }
Example #23
0
        public void TestGet()
        {
            long id = 123;

            var expected = new ClusterModel()
            {
                Id   = id,
                Name = "ClusterName",
                Ips  = "LocalHost",
            };

            Mock.Reset();
            Mock.Setup(srv => srv.Get(id, "Test User")).Returns(expected);

            MockUser.Reset();

            var result = Browser.Get($"/clusters/{id}").Result;

            Assert.AreEqual(HttpStatusCode.OK, result.StatusCode);
            Assert.That(result.ContentType.StartsWith("application/json"));

            var cluster = result.Body.DeserializeJson <ClusterResponse>();

            Assert.AreEqual(expected.Id, cluster.Id);
            Assert.AreEqual(expected.Name, cluster.Name);
            var ipArray = expected.Ips.Split(',');

            Assert.AreEqual(ipArray.Length, cluster.Ips.Length);
            for (int i = 0; i < ipArray.Length; i++)
            {
                Assert.AreEqual(ipArray[i], cluster.Ips[i]);
            }

            Mock.Verify(srv => srv.Get(id, "Test User"), Times.Once);
            Mock.VerifyNoOtherCalls();

            MockUser.VerifyNoOtherCalls();
        }
Example #24
0
 public static Task Update(ClusterModel model)
 {
     return(_repo.Update(model));
 }
 public ActionResult <Task> DeleteCluster([FromBody] ClusterModel model) => Clusters.DeleteCluster(model);
        public async Task Invoke_Works()
        {
            var events = TestEventListener.Collect();

            var httpContext = new DefaultHttpContext();

            httpContext.Request.Method      = "GET";
            httpContext.Request.Scheme      = "https";
            httpContext.Request.Host        = new HostString("example.com");
            httpContext.Request.Path        = "/api/test";
            httpContext.Request.QueryString = new QueryString("?a=b&c=d");

            var httpClient         = new HttpMessageInvoker(new Mock <HttpMessageHandler>().Object);
            var httpRequestOptions = new ForwarderRequestConfig
            {
                ActivityTimeout = TimeSpan.FromSeconds(60),
                Version         = HttpVersion.Version11,
#if NET
                VersionPolicy = HttpVersionPolicy.RequestVersionExact,
#endif
            };
            var cluster1     = new ClusterState(clusterId: "cluster1");
            var clusterModel = new ClusterModel(new ClusterConfig()
            {
                HttpRequest = httpRequestOptions
            },
                                                httpClient);
            var destination1 = cluster1.Destinations.GetOrAdd(
                "destination1",
                id => new DestinationState(id)
            {
                Model = new DestinationModel(new DestinationConfig {
                    Address = "https://localhost:123/a/b/"
                })
            });
            var routeConfig = new RouteModel(
                config: new RouteConfig()
            {
                RouteId = "Route-1"
            },
                cluster: cluster1,
                transformer: HttpTransformer.Default);

            httpContext.Features.Set <IReverseProxyFeature>(
                new ReverseProxyFeature()
            {
                AvailableDestinations = new List <DestinationState>()
                {
                    destination1
                }.AsReadOnly(),
                Cluster = clusterModel,
                Route   = routeConfig,
            });
            httpContext.Features.Set(cluster1);

            var tcs1 = new TaskCompletionSource <bool>();
            var tcs2 = new TaskCompletionSource <bool>();

            Mock <IHttpForwarder>()
            .Setup(h => h.SendAsync(
                       httpContext,
                       It.Is <string>(uri => uri == "https://localhost:123/a/b/"),
                       httpClient,
                       It.Is <ForwarderRequestConfig>(requestOptions =>
                                                      requestOptions.ActivityTimeout == httpRequestOptions.ActivityTimeout &&
                                                      requestOptions.Version == httpRequestOptions.Version
#if NET
                                                      && requestOptions.VersionPolicy == httpRequestOptions.VersionPolicy
#endif
                                                      ),
                       It.IsAny <HttpTransformer>()))
            .Returns(
                async() =>
            {
                tcs1.TrySetResult(true);
                await tcs2.Task;
                return(ForwarderError.None);
            })
            .Verifiable();

            var sut = Create <ForwarderMiddleware>();

            Assert.Equal(0, cluster1.ConcurrencyCounter.Value);
            Assert.Equal(0, destination1.ConcurrentRequestCount);

            var task = sut.Invoke(httpContext);
            if (task.IsFaulted)
            {
                // Something went wrong, don't hang the test.
                await task;
            }

            Mock <IHttpForwarder>().Verify();

            await tcs1.Task; // Wait until we get to the proxying step.
            Assert.Equal(1, cluster1.ConcurrencyCounter.Value);
            Assert.Equal(1, destination1.ConcurrentRequestCount);

            Assert.Same(destination1, httpContext.GetReverseProxyFeature().ProxiedDestination);

            tcs2.TrySetResult(true);
            await task;
            Assert.Equal(0, cluster1.ConcurrencyCounter.Value);
            Assert.Equal(0, destination1.ConcurrentRequestCount);

            var invoke = Assert.Single(events, e => e.EventName == "ForwarderInvoke");
            Assert.Equal(3, invoke.Payload.Count);
            Assert.Equal(cluster1.ClusterId, (string)invoke.Payload[0]);
            Assert.Equal(routeConfig.Config.RouteId, (string)invoke.Payload[1]);
            Assert.Equal(destination1.DestinationId, (string)invoke.Payload[2]);
        }
 public ActionResult <Task> CreateCluster([FromBody] ClusterModel model) => Clusters.AddCluster(model);
Example #28
0
 public static Task DeleteCluster(ClusterModel model) => _repo.Delete(model);
 public ActionResult <Task> Update([FromBody] ClusterModel model) => Clusters.Update(model);
Example #30
0
 // We intentionally do not consider destination changes when updating the cluster Revision.
 // Revision is used to rebuild routing endpoints which should be unrelated to destinations,
 // and destinations are the most likely to change.
 internal bool HasConfigChanged(ClusterModel newModel)
 {
     return(!Config.EqualsExcludingDestinations(newModel.Config) || newModel.HttpClient != HttpClient);
 }