[CCSDK-1985]GR Toolkit Refactor
[ccsdk/sli/plugins.git] / grToolkit / provider / src / main / java / org / onap / ccsdk / sli / plugins / grtoolkit / data / SiteHealth.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * openECOMP : SDN-C
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights
6  *                      reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.ccsdk.sli.plugins.grtoolkit.data;
23
24 import java.util.ArrayList;
25 import java.util.Collections;
26 import java.util.List;
27
28
29 /**
30  * A data container for Site health.
31  *
32  * @author Anthony Haddox
33  * @see org.onap.ccsdk.sli.plugins.grtoolkit.resolver.HealthResolver
34  */
35 public class SiteHealth {
36     private List<AdminHealth> adminHealth;
37     private List<DatabaseHealth> databaseHealth;
38     private List<ClusterHealth> clusterHealth;
39
40     private Health health;
41     private String id;
42     private String role;
43
44     public SiteHealth() {
45         adminHealth = new ArrayList<>();
46         databaseHealth = new ArrayList<>();
47         clusterHealth = new ArrayList<>();
48
49         // Faulty by default, it's up to the health check to affirm the health
50         health = Health.FAULTY;
51     }
52
53     public SiteHealth withAdminHealth(AdminHealth... health) {
54         Collections.addAll(adminHealth, health);
55         return this;
56     }
57
58     public SiteHealth withDatabaseHealth(DatabaseHealth... health) {
59         Collections.addAll(databaseHealth, health);
60         return this;
61     }
62
63     public SiteHealth withClusterHealth(ClusterHealth... health) {
64         Collections.addAll(clusterHealth, health);
65         return this;
66     }
67
68     public SiteHealth withId(String id) {
69         this.id = id;
70         return this;
71     }
72
73     public SiteHealth withRole(String role) {
74         this.role = role;
75         return this;
76     }
77
78     public Health getHealth() {
79         return health;
80     }
81
82     public void setHealth(Health health) {
83         this.health = health;
84     }
85
86     public List<AdminHealth> getAdminHealth() {
87         return adminHealth;
88     }
89
90     public void setAdminHealth(List<AdminHealth> adminHealth) {
91         this.adminHealth = adminHealth;
92     }
93
94     public List<DatabaseHealth> getDatabaseHealth() {
95         return databaseHealth;
96     }
97
98     public void setDatabaseHealth(List<DatabaseHealth> databaseHealth) {
99         this.databaseHealth = databaseHealth;
100     }
101
102     public List<ClusterHealth> getClusterHealth() {
103         return clusterHealth;
104     }
105
106     public void setClusterHealth(List<ClusterHealth> clusterHealth) {
107         this.clusterHealth = clusterHealth;
108     }
109
110     public String getId() {
111         return id;
112     }
113
114     public void setId(String id) {
115         this.id = id;
116     }
117
118     public String getRole() {
119         return role;
120     }
121
122     public void setRole(String role) {
123         this.role = role;
124     }
125 }