de00df8856f445e0d7093fca3133a04828da9725
[policy/drools-pdp.git] / feature-healthcheck / src / main / java / org / onap / policy / drools / healthcheck / HealthCheck.java
1 /*
2  * ============LICENSE_START=======================================================
3  * feature-healthcheck
4  * ================================================================================
5  * Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.drools.healthcheck;
22
23 import java.util.ArrayList;
24 import java.util.List;
25 import lombok.Getter;
26 import lombok.Setter;
27 import lombok.ToString;
28 import org.onap.policy.common.capabilities.Startable;
29
30 /**
31  * Healthcheck.
32  */
33 public interface HealthCheck extends Startable {
34
35     /**
36      * Healthcheck Report.
37      */
38     @Getter
39     @Setter
40     @ToString
41     public static class Report {
42         /**
43          * Named Entity in the report.
44          */
45         private String name;
46
47         /**
48          * URL queried.
49          */
50         private String url;
51
52         /**
53          * healthy.
54          */
55         private boolean healthy;
56
57         /**
58          * return code.
59          */
60         private int code;
61
62         /**
63          * Message from remote entity.
64          */
65         private String message;
66     }
67
68     /**
69      * Report aggregation.
70      */
71     @Getter
72     @Setter
73     @ToString
74     public static class Reports {
75         private boolean healthy;
76         private List<Report> details = new ArrayList<>();
77     }
78
79     /**
80      * Perform a healthcheck.
81      *
82      * @return a report
83      */
84     Reports healthCheck();
85 }