2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.so.cloudify.v3.client;
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;
31 public class NodeInstancesResource {
33 private final CloudifyClient client;
35 public NodeInstancesResource(CloudifyClient client) {
39 public ListNodeInstances list() {
40 return new ListNodeInstances();
43 public GetNodeInstance byId(String id) {
44 return new GetNodeInstance(id);
47 public UpdateNodeInstance update(String id, UpdateNodeInstanceParams params) {
48 return new UpdateNodeInstance(id, params);
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);
58 public class ListNodeInstances extends CloudifyRequest<NodeInstances> {
59 public ListNodeInstances() {
60 super(client, HttpMethod.GET, "/api/v3/node-instances", null, NodeInstances.class);
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), NodeInstance.class);