Replaced all tabs with spaces in java and pom.xml
[so.git] / cloudify-client / src / main / java / org / onap / so / cloudify / v3 / client / NodeInstancesResource.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 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.so.cloudify.v3.client;
22
23 import org.onap.so.cloudify.v3.model.UpdateNodeInstanceParams;
24 import org.onap.so.cloudify.v3.model.NodeInstance;
25 import org.onap.so.cloudify.v3.model.NodeInstances;
26 import org.onap.so.cloudify.base.client.Entity;
27 import org.onap.so.cloudify.base.client.HttpMethod;
28 import org.onap.so.cloudify.base.client.CloudifyClient;
29 import org.onap.so.cloudify.base.client.CloudifyRequest;
30
31 public class NodeInstancesResource {
32
33     private final CloudifyClient client;
34
35     public NodeInstancesResource(CloudifyClient client) {
36         this.client = client;
37     }
38
39     public ListNodeInstances list() {
40         return new ListNodeInstances();
41     }
42
43     public GetNodeInstance byId(String id) {
44         return new GetNodeInstance(id);
45     }
46
47     public UpdateNodeInstance update(String id, UpdateNodeInstanceParams params) {
48         return new UpdateNodeInstance(id, params);
49     }
50
51
52     public class GetNodeInstance extends CloudifyRequest<NodeInstance> {
53         public GetNodeInstance(String id) {
54             super(client, HttpMethod.GET, "/api/v3/node-instances/" + id, null, NodeInstance.class);
55         }
56     }
57
58     public class ListNodeInstances extends CloudifyRequest<NodeInstances> {
59         public ListNodeInstances() {
60             super(client, HttpMethod.GET, "/api/v3/node-instances", null, NodeInstances.class);
61         }
62     }
63
64     public class UpdateNodeInstance extends CloudifyRequest<NodeInstance> {
65         public UpdateNodeInstance(String nodeInstanceId, UpdateNodeInstanceParams body) {
66             super(client, HttpMethod.PATCH, "/api/v3/node-instances/" + nodeInstanceId, Entity.json(body),
67                     NodeInstance.class);
68         }
69     }
70
71 }