Exemple #1
0
 private void SendHeartbeat()
 {
     HttpPostJsonUpdate(GetHeartbeatUri(_config.NodeFrontUrl), new HeartbeatDTO
     {
         name              = Environment.MachineName,
         osPlatform        = "Windows",
         groups            = _config.GetAgentGroups(),
         url               = _hostControlUrl,
         apiKey            = _config.ApiKey,
         version           = VersionUtil.GetAgentVersion(),
         configVersion     = _config.ConfigVersion,
         loadBalancerState = _loadBalancerService.UseLoadBalancer ? _loadBalancerService.GetCurrentState() : null
     });
 }
        public DeployUnitModule(IAsimovConfig config)
        {
            Get["/units/list"] = _ =>
            {
                var request = this.Bind <GetDeployUnitsRequestDto>();
                var units   = GetDeployUnits(config, request);
                return(Response.AsJson(units));
            };

            Get["/units/list/{group}"] = urlArgs =>
            {
                var units = GetDeployUnits(config, new GetDeployUnitsRequestDto
                {
                    AgentGroups = new[] { (string)urlArgs.group }
                });
                return(Response.AsJson(units));
            };

            Get["/units/deploy-parameters/{unitName}"] = urlArgs =>
            {
                var deployUnit = config.GetUnitByName((string)urlArgs.unitName);
                if (deployUnit == null)
                {
                    return(404);
                }

                var parameters = deployUnit.GetDeployParameters().Select(deployParameter => deployParameter.GetDescriptor()).ToList();

                return(Response.AsJson(parameters));
            };

            Get["/agent-groups"]  = _ => Response.AsJson(config.GetAgentGroups());
            Get["/unit-groups"]   = _ => Response.AsJson(config.GetUnitGroups());
            Get["/unit-types"]    = _ => Response.AsJson(config.GetUnitTypes());
            Get["/unit-tags"]     = _ => Response.AsJson(config.GetUnitTags());
            Get["/unit-statuses"] = _ => Response.AsJson(config.GetUnitStatuses());
        }