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.CreateDeploymentParams;
24 import org.onap.so.cloudify.v3.model.Deployment;
25 import org.onap.so.cloudify.v3.model.DeploymentOutputs;
26 import org.onap.so.cloudify.v3.model.Deployments;
27 import org.onap.so.cloudify.base.client.Entity;
28 import org.onap.so.cloudify.base.client.HttpMethod;
29 import org.onap.so.cloudify.base.client.CloudifyClient;
30 import org.onap.so.cloudify.base.client.CloudifyRequest;
32 public class DeploymentsResource {
34 private final CloudifyClient client;
36 public DeploymentsResource(CloudifyClient client) {
40 public CreateDeployment create(String deploymentId, CreateDeploymentParams body) {
41 return new CreateDeployment(deploymentId, body);
44 public ListDeployments list() {
45 return new ListDeployments();
48 public GetDeployment byId(String id) {
49 return new GetDeployment(id);
52 public GetDeploymentOutputs outputsById(String id) {
53 return new GetDeploymentOutputs(id);
56 public DeleteDeployment deleteByName(String name) {
57 return new DeleteDeployment(name);
60 public class CreateDeployment extends CloudifyRequest<Deployment> {
61 public CreateDeployment(String deploymentId, CreateDeploymentParams body) {
62 super(client, HttpMethod.PUT, "/api/v3/deployments/" + deploymentId, Entity.json(body), Deployment.class);
66 public class DeleteDeployment extends CloudifyRequest<Deployment> {
67 public DeleteDeployment(String deploymentId) {
68 super(client, HttpMethod.DELETE, "/api/v3/deployments/" + deploymentId, null, Deployment.class);
72 public class GetDeployment extends CloudifyRequest<Deployment> {
73 public GetDeployment(String id) {
74 super(client, HttpMethod.GET, "/api/v3/deployments/" + id, null, Deployment.class);
78 public class GetDeploymentOutputs extends CloudifyRequest<DeploymentOutputs> {
79 public GetDeploymentOutputs(String id) {
80 super(client, HttpMethod.GET, "/api/v3/deployments/" + id + "/outputs", null, DeploymentOutputs.class);
84 public class ListDeployments extends CloudifyRequest<Deployments> {
85 public ListDeployments() {
86 super(client, HttpMethod.GET, "/api/v3/deployments", null, Deployments.class);