aboutsummaryrefslogtreecommitdiffstats
path: root/ccsdk-app-common/src/main/java/org/onap/ccsdk/dashboard/rest/IControllerRestClient.java
blob: 5e060e99b912c1737c534b96dc4f5616f2fc073a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/*******************************************************************************
 * =============LICENSE_START=========================================================
 *
 * =================================================================================
 *  Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 *  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=========================================================
 *
 *  ECOMP is a trademark and service mark of AT&T Intellectual Property.
 *******************************************************************************/
package org.onap.ccsdk.dashboard.rest;

import java.net.URI;
import java.time.Instant;
import java.util.List;

import org.onap.ccsdk.dashboard.model.CloudifyBlueprintContent;
import org.onap.ccsdk.dashboard.model.CloudifyBlueprintList;
import org.onap.ccsdk.dashboard.model.CloudifyBlueprintUpload;
import org.onap.ccsdk.dashboard.model.CloudifyDeploymentList;
import org.onap.ccsdk.dashboard.model.CloudifyDeploymentRequest;
import org.onap.ccsdk.dashboard.model.CloudifyExecution;
import org.onap.ccsdk.dashboard.model.CloudifyExecutionList;
import org.onap.ccsdk.dashboard.model.CloudifyExecutionRequest;
import org.onap.ccsdk.dashboard.model.ConsulDatacenter;
import org.onap.ccsdk.dashboard.model.ConsulHealthServiceRegistration;
import org.onap.ccsdk.dashboard.model.ConsulNodeInfo;
import org.onap.ccsdk.dashboard.model.ConsulServiceHealth;
import org.onap.ccsdk.dashboard.model.ConsulServiceHealthHistory;
import org.onap.ccsdk.dashboard.model.ConsulServiceInfo;

/**
 * Defines the interface of the Controller REST client.
 */
public interface IControllerRestClient {

    String blueprintsPath = "blueprints";
    String viewBlueprintsPath = "viewblueprints";
    String deploymentsPath = "deployments";
    String executionsPath = "executions";
    String healthServicesPath = "healthservices";

    /**
     * Gets the list of Cloudify blueprints.
     *
     * @return CloudifyBlueprintList
     */
    CloudifyBlueprintList getBlueprints();

    /**
     * Gets the Cloudify blueprint metadata for the specified ID
     *
     * @param id
     *            Blueprint ID
     * @return CloudifyBlueprintList of size 1; null if not found
     */
    CloudifyBlueprintList getBlueprint(String id);

    /**
     * Gets the Cloudify blueprint content for the specified ID
     *
     * @param id
     *            Blueprint ID
     * @return Blueprint content
     */
    CloudifyBlueprintContent viewBlueprint(String id);

    /**
     * Uploads a Cloudify blueprint.
     *
     * @param blueprint
     *            Cloudify Blueprint to upload
     * @return CloudifyBlueprintList of size 1; null if not found
     */
    CloudifyBlueprintList uploadBlueprint(CloudifyBlueprintUpload blueprint);

    /**
     * Deletes the Cloudify blueprint with the specified id.
     *
     * @param id
     *            Blueprint ID
     * @return Status code; e.g., 200, 202, 204.
     */
    int deleteBlueprint(String id);

    /**
     * Gets the list of Cloudify deployments.
     *
     * @return CloudifyDeploymentList
     */
    CloudifyDeploymentList getDeployments();

    /**
     * Gets the Cloudify deployment for the specified ID
     *
     * @param id
     *            Deployment ID
     * @return CloudifyDeploymentList of size 1; null if not found.
     */
    CloudifyDeploymentList getDeployment(String id);

    /**
     * Creates a Cloudify deployment.
     *
     * @param deployment
     *            Deployment details
     * @return CloudifyDeploymentList of size 1
     */
    CloudifyDeploymentList createDeployment(CloudifyDeploymentRequest deployment);

    /**
     * Deletes the Cloudify deployment with the specified id.
     *
     * @param id
     *            Deployment ID
     * @param ignoreLiveNodes
     *            Boolean indicator whether to delete even if live nodes exist
     * @return Status code; e.g., 200, 202, 204.
     */
    int deleteDeployment(String id, boolean ignoreLiveNodes);

    /**
     * Gets the Cloudify executions for the specified deployment ID
     *
     * @param deploymentId
     *            Deployment ID
     * @return CloudifyExecutionList
     */
    CloudifyExecutionList getExecutions(String deploymentId);

    /**
     * Gets the Cloudify execution for the specified execution ID and deployment
     * ID
     *
     * @param executionId
     *            Execution ID
     * @param deploymentId
     *            Deployment ID
     * @return CloudifyExecutionList of size 1
     */
    CloudifyExecutionList getExecution(String executionId, String deploymentId);

    /**
     * Starts a Cloudify execution.
     *
     * @param execution
     *            Execution details
     * @return CloudifyExecution
     */
    CloudifyExecution startExecution(CloudifyExecutionRequest execution);

    /**
     * Deletes the Cloudify execution with the specified ids.
     *
     * @param executionId
     *            execution ID
     * @param deploymentId
     *            Deployment ID
     * @param action
     *            either "cancel" or "force-cancel"
     * @return Status code; e.g., 200, 202, 204.
     */
    int cancelExecution(String executionId, String deploymentId, String action);

    /**
     * Registers a service with Consul for health check.
     *
     * @param registration
     *            Details about the service to be registered.
     * @return Result of registering a service
     */
    URI registerService(ConsulHealthServiceRegistration registration);

    /**
     * Deregister a service with Consul for health check.
     *
     * @param serviceName
     *            Name of the service to be deregister.
     * @return Response code
     */
    int deregisterService(String serviceName);

    /**
     * Gets all the services that are monitored by Consul.
     *
     * @return List of ConsulServiceHealth
     */
    List<ConsulServiceInfo> getServices();

    /**
     * Gets the status for the specified service on all nodes.
     *
     * @param serviceName
     *            Service name
     * @return List of ConsulServiceHealth
     */
    List<ConsulServiceHealth> getServiceHealth(String serviceName);

    /**
     * Gets the status for the specified service on all nodes for the specified
     * time window.
     *
     * @param serviceName
     *            Service name
     * @param start
     *            Start (earliest point) of the time window
     * @param end
     *            End (latest point) of the time window
     * @return List of ConsulServiceHealth
     */
    List<ConsulServiceHealthHistory> getServiceHealthHistory(String serviceName, Instant start, Instant end);

    /**
     * Gets all the nodes that are monitored by Consul.
     *
     * @return List of ConsulNodeHealth
     */
    List<ConsulNodeInfo> getNodes();

    /**
     * Gets the status for all registered services running on the specified
     * node.
     *
     * @param nodeId
     *            Node ID
     * @return List of ConsulServiceHealth
     */
    List<ConsulServiceHealth> getNodeServicesHealth(String nodeId);

    /**
     * Gets all the data centers that are monitored by Consul.
     *
     * @return List of ConsulDatacenter objects
     */
    List<ConsulDatacenter> getDatacenters();
}