diff options
author | Jakub Dudycz <jakub.dudycz@nokia.com> | 2018-08-07 14:18:37 +0200 |
---|---|---|
committer | Jakub Dudycz <jakub.dudycz@nokia.com> | 2018-08-08 14:51:38 +0200 |
commit | dd827e2c1cc984d9ed1fed9914cbef0e985ea625 (patch) | |
tree | ace76509b89db99ca68509991f410426c1316cd3 /hv-collector-health-check/src | |
parent | f16fff6a5c15474d86ea304b499535076d5a368c (diff) |
Create health check module
Create ves-hv-collector-health-check module with dummy api server and connect it with ves-hv-collector-main
This is a preparation for health check mechanism implementation
Change-Id: I2f668ab7337b1ed7e2afea6c56f34880de3ef1b5
Issue-ID: DCAEGEN2-659
Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
Diffstat (limited to 'hv-collector-health-check/src')
-rw-r--r-- | hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/http/HealthCheckApiServer.kt | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/http/HealthCheckApiServer.kt b/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/http/HealthCheckApiServer.kt new file mode 100644 index 00000000..9cab031a --- /dev/null +++ b/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/http/HealthCheckApiServer.kt @@ -0,0 +1,49 @@ +/* + * ============LICENSE_START======================================================= + * dcaegen2-collectors-veshv + * ================================================================================ + * Copyright (C) 2018 NOKIA + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.dcae.collectors.veshv.healthcheck.http + +import arrow.effects.IO +import ratpack.handling.Chain +import ratpack.http.Status +import ratpack.server.RatpackServer +import ratpack.server.ServerConfig + +/** + * @author Jakub Dudycz <jakub.dudycz@nokia.com> + * @since August 2018 + */ +class HealthCheckApiServer { + + fun start(port: Int): IO<RatpackServer> = IO { + RatpackServer + .start { + it + .serverConfig(ServerConfig.embedded().port(port).development(false)) + .handlers(this::configureHandlers) + } + } + + private fun configureHandlers(chain: Chain) { + chain + .get("healthcheck") { ctx -> + ctx.response.status(Status.OK).send() + } + } +}
\ No newline at end of file |