summaryrefslogtreecommitdiffstats
path: root/cloudify-client/src/main
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-08 14:14:34 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-08 14:24:59 -0400
commitf47919f1fe367b612fa9c96d34c59f01a541e882 (patch)
tree5b6aa2fc36747d868897e68ccbec0c6db0aee81c /cloudify-client/src/main
parent54452b80a1cf4d22ef750bc1377f8c1b05431d57 (diff)
Replaced all tabs with spaces in java and pom.xml
Added in maven plugins to enforce coding style rules Added in eclipse java formatting xml Change-Id: I3727bbf4ce8dc66abfd8ad21b6cfd0890c5d3ff0 Issue-ID: SO-1765 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'cloudify-client/src/main')
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyBaseException.java31
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java216
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java2
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientTokenProvider.java83
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyConnectException.java19
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java310
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponse.java16
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java66
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseStatus.java12
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifySimpleTokenProvider.java21
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyTokenProvider.java4
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/Entity.java84
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/HttpMethod.java2
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java346
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientException.java28
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategy.java51
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java51
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java37
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/Cloudify.java16
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java2
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java28
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/NodeInstancesResource.java7
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/TokensResource.java5
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/AzureConfig.java73
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Blueprint.java112
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Blueprints.java41
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java25
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CloudifyError.java68
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CreateDeploymentParams.java34
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Deployment.java370
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/DeploymentOutputs.java75
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Deployments.java47
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Execution.java167
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Executions.java47
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Metadata.java34
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/NodeInstance.java278
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/NodeInstances.java41
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/OpenstackConfig.java89
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Pagination.java55
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/ParameterDefinition.java60
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/StartExecutionParams.java81
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Token.java44
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/UpdateExecutionParams.java23
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/UpdateNodeInstanceParams.java48
44 files changed, 1574 insertions, 1675 deletions
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyBaseException.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyBaseException.java
index a6e0cc3680..b8006cb45f 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyBaseException.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyBaseException.java
@@ -21,23 +21,22 @@
package org.onap.so.cloudify.base.client;
/**
- * A common abstract parent of all Openstack Exception types, allowing
- * calling classes the choice to catch all error exceptions together.
+ * A common abstract parent of all Openstack Exception types, allowing calling classes the choice to catch all error
+ * exceptions together.
*/
-public abstract class CloudifyBaseException extends RuntimeException
-{
- private static final long serialVersionUID = 1L;
+public abstract class CloudifyBaseException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
- /*
- * Implement only the basic constructors
- */
- public CloudifyBaseException () {}
-
- public CloudifyBaseException(String message) {
- super(message);
- }
+ /*
+ * Implement only the basic constructors
+ */
+ public CloudifyBaseException() {}
- public CloudifyBaseException(String message, Throwable cause) {
- super(message, cause);
- }
+ public CloudifyBaseException(String message) {
+ super(message);
+ }
+
+ public CloudifyBaseException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java
index 8387557c24..1893590106 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java
@@ -21,114 +21,116 @@
package org.onap.so.cloudify.base.client;
import java.util.Properties;
-
import org.onap.so.cloudify.connector.http.HttpClientConnector;
public class CloudifyClient {
-
- protected String managerEndpoint;
- protected String tenant = "default_tenant"; // Note - only default_tenant supported in community edition
-
- protected CloudifyTokenProvider tokenProvider;
-
- protected static int AUTHENTICATION_RETRIES = 1;
-
- protected CloudifyClientConnector connector;
-
- protected Properties properties = new Properties();
-
- public CloudifyClient(String managerEndpoint) {
- this.managerEndpoint = managerEndpoint;
- this.connector = new HttpClientConnector();
- }
-
- public CloudifyClient(String managerEndpoint, String tenant) {
- this.managerEndpoint = managerEndpoint;
- this.tenant = tenant;
- this.connector = new HttpClientConnector();
- }
-
- public CloudifyClient(String managerEndpoint, CloudifyClientConnector connector) {
- this.managerEndpoint = managerEndpoint;
- this.connector = connector;
- }
-
- /**
- * Execute a Cloudify request by making the REST API call. Return the
- * complete CloudifyResponse structure, which includes the complete
- * HTTP response.
- * @param request a CloudifyRequest object
- * @return a CloudifyResponse object
- */
- public <T> CloudifyResponse request(CloudifyRequest<T> request) {
- CloudifyResponseException authException = null;
-
- for (int i = 0; i <= AUTHENTICATION_RETRIES; i++) {
- request.endpoint(managerEndpoint);
- request.header("Tenant", tenant);
- if (tokenProvider != null)
- request.header("Authentication-Token", tokenProvider.getToken());
-
- try {
- return connector.request(request);
- } catch (CloudifyResponseException e) {
- if (e.getStatus() != CloudifyResponseStatus.NOT_AUTHORIZED
- || tokenProvider == null) {
- throw e;
- }
- authException = e;
- tokenProvider.expireToken();
- }
- }
-
- if (authException != null) {
- throw authException;
- }
-
- return null;
- }
-
- /**
- * Execute a CloudifyRequest by sending the REST API call to the Cloudify
- * Manager endpoint. The return type is a JSON POJO object containing the
- * response body entity.
- * @param request
- * @return a JSON POJO object specific to the request type
- */
- public <T> T execute(CloudifyRequest<T> request) {
- CloudifyResponse response = request(request);
- return (request.returnType() != null && request.returnType() != Void.class) ? response.getEntity(request.returnType()) : null;
- }
-
- public void property(String property, String value) {
- properties.put(property, value);
- }
-
- /**
- * Set a Token Provider. This class should be able to produce an
- * authentication token on-demand.
- * @param tokenProvider
- */
- public void setTokenProvider(CloudifyTokenProvider tokenProvider) {
- this.tokenProvider = tokenProvider;
- }
-
- /**
- * Manually set the authentication token to use for this client.
- * @param token
- */
- public void setToken(String token) {
- setTokenProvider(new CloudifySimpleTokenProvider(token));
- }
-
- /**
- * Perform a simple GET request with no request message body
- * @param path
- * @param returnType
- * @return An object of Class <R>
- */
- public <R> CloudifyRequest<R> get(String path, Class<R> returnType) {
- return new CloudifyRequest<R>(this, HttpMethod.GET, path, null, returnType);
- }
-
+
+ protected String managerEndpoint;
+ protected String tenant = "default_tenant"; // Note - only default_tenant supported in community edition
+
+ protected CloudifyTokenProvider tokenProvider;
+
+ protected static int AUTHENTICATION_RETRIES = 1;
+
+ protected CloudifyClientConnector connector;
+
+ protected Properties properties = new Properties();
+
+ public CloudifyClient(String managerEndpoint) {
+ this.managerEndpoint = managerEndpoint;
+ this.connector = new HttpClientConnector();
+ }
+
+ public CloudifyClient(String managerEndpoint, String tenant) {
+ this.managerEndpoint = managerEndpoint;
+ this.tenant = tenant;
+ this.connector = new HttpClientConnector();
+ }
+
+ public CloudifyClient(String managerEndpoint, CloudifyClientConnector connector) {
+ this.managerEndpoint = managerEndpoint;
+ this.connector = connector;
+ }
+
+ /**
+ * Execute a Cloudify request by making the REST API call. Return the complete CloudifyResponse structure, which
+ * includes the complete HTTP response.
+ *
+ * @param request a CloudifyRequest object
+ * @return a CloudifyResponse object
+ */
+ public <T> CloudifyResponse request(CloudifyRequest<T> request) {
+ CloudifyResponseException authException = null;
+
+ for (int i = 0; i <= AUTHENTICATION_RETRIES; i++) {
+ request.endpoint(managerEndpoint);
+ request.header("Tenant", tenant);
+ if (tokenProvider != null)
+ request.header("Authentication-Token", tokenProvider.getToken());
+
+ try {
+ return connector.request(request);
+ } catch (CloudifyResponseException e) {
+ if (e.getStatus() != CloudifyResponseStatus.NOT_AUTHORIZED || tokenProvider == null) {
+ throw e;
+ }
+ authException = e;
+ tokenProvider.expireToken();
+ }
+ }
+
+ if (authException != null) {
+ throw authException;
+ }
+
+ return null;
+ }
+
+ /**
+ * Execute a CloudifyRequest by sending the REST API call to the Cloudify Manager endpoint. The return type is a
+ * JSON POJO object containing the response body entity.
+ *
+ * @param request
+ * @return a JSON POJO object specific to the request type
+ */
+ public <T> T execute(CloudifyRequest<T> request) {
+ CloudifyResponse response = request(request);
+ return (request.returnType() != null && request.returnType() != Void.class)
+ ? response.getEntity(request.returnType())
+ : null;
+ }
+
+ public void property(String property, String value) {
+ properties.put(property, value);
+ }
+
+ /**
+ * Set a Token Provider. This class should be able to produce an authentication token on-demand.
+ *
+ * @param tokenProvider
+ */
+ public void setTokenProvider(CloudifyTokenProvider tokenProvider) {
+ this.tokenProvider = tokenProvider;
+ }
+
+ /**
+ * Manually set the authentication token to use for this client.
+ *
+ * @param token
+ */
+ public void setToken(String token) {
+ setTokenProvider(new CloudifySimpleTokenProvider(token));
+ }
+
+ /**
+ * Perform a simple GET request with no request message body
+ *
+ * @param path
+ * @param returnType
+ * @return An object of Class <R>
+ */
+ public <R> CloudifyRequest<R> get(String path, Class<R> returnType) {
+ return new CloudifyRequest<R>(this, HttpMethod.GET, path, null, returnType);
+ }
+
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java
index 2e00c4c396..f031f10bb5 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java
@@ -23,6 +23,6 @@ package org.onap.so.cloudify.base.client;
public interface CloudifyClientConnector {
- public <T> CloudifyResponse request(CloudifyRequest<T> request);
+ public <T> CloudifyResponse request(CloudifyRequest<T> request);
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientTokenProvider.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientTokenProvider.java
index 7676afa6c7..2478557afc 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientTokenProvider.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientTokenProvider.java
@@ -21,9 +21,7 @@
package org.onap.so.cloudify.base.client;
import java.util.Date;
-
import org.apache.commons.lang.time.DateUtils;
-
import org.onap.so.cloudify.v3.client.Cloudify;
import org.onap.so.cloudify.v3.client.TokensResource.GetToken;
import org.onap.so.cloudify.v3.model.Token;
@@ -36,50 +34,49 @@ import org.onap.so.cloudify.v3.model.Token;
*/
public class CloudifyClientTokenProvider implements CloudifyTokenProvider {
- String user;
- String password;
- String token;
- Date expiration;
- Cloudify cloudify = null;
+ String user;
+ String password;
+ String token;
+ Date expiration;
+ Cloudify cloudify = null;
+
+ public CloudifyClientTokenProvider(String cloudifyEndpoint, String user, String password) {
+ this.user = user;
+ this.password = password;
+
+ cloudify = new Cloudify(cloudifyEndpoint);
+ }
+
+ @Override
+ public String getToken() {
+ Date now = new Date();
+ if (token != null && expiration != null && expiration.after(now)) {
+ return token;
+ }
+
+ // Create a "Get Token" request. Force basic authentication to acquire the token itself.
+ GetToken tokenRequest = cloudify.tokens().token();
+ tokenRequest.setBasicAuthentication(user, password);
+ Token newToken = tokenRequest.execute();
- public CloudifyClientTokenProvider(String cloudifyEndpoint, String user, String password) {
- this.user = user;
- this.password = password;
-
- cloudify = new Cloudify (cloudifyEndpoint);
- }
+ token = newToken.getValue();
- @Override
- public String getToken() {
- Date now = new Date();
- if (token != null && expiration != null && expiration.after(now)) {
- return token;
- }
+ if (expiration == null) {
+ expiration = new Date();
+ }
+ // TODO: Make this property driven (or see if it comes back somehow in response)
+ expiration = DateUtils.addMinutes(expiration, 10);
- // Create a "Get Token" request. Force basic authentication to acquire the token itself.
- GetToken tokenRequest = cloudify.tokens().token();
- tokenRequest.setBasicAuthentication(user, password);
- Token newToken = tokenRequest.execute();
-
- token = newToken.getValue();
-
- if (expiration == null) {
- expiration = new Date();
- }
- // TODO: Make this property driven (or see if it comes back somehow in response)
- expiration = DateUtils.addMinutes(expiration, 10);
-
- return token;
- }
+ return token;
+ }
- @Override
- /**
- * This doesn't actually expire the token in Cloudify. It just prevents this token provider
- * from using it.
- */
- public void expireToken() {
- expiration = null;
- token = null;
- }
+ @Override
+ /**
+ * This doesn't actually expire the token in Cloudify. It just prevents this token provider from using it.
+ */
+ public void expireToken() {
+ expiration = null;
+ token = null;
+ }
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyConnectException.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyConnectException.java
index 3f378fd10f..5bcc27bafc 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyConnectException.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyConnectException.java
@@ -21,19 +21,18 @@
package org.onap.so.cloudify.base.client;
/**
- * Custom RuntimeException to report connection errors to Openstack endpoints.
- * Must be a RuntimeException to conform with OpenstackClient interface, which
- * does not declare specific Exceptions.
+ * Custom RuntimeException to report connection errors to Openstack endpoints. Must be a RuntimeException to conform
+ * with OpenstackClient interface, which does not declare specific Exceptions.
*/
public class CloudifyConnectException extends CloudifyBaseException {
- private static final long serialVersionUID = 7294957362769575271L;
+ private static final long serialVersionUID = 7294957362769575271L;
- public CloudifyConnectException(String message) {
- super(message);
- }
+ public CloudifyConnectException(String message) {
+ super(message);
+ }
- public CloudifyConnectException(String message, Throwable cause) {
- super(message, cause);
- }
+ public CloudifyConnectException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java
index ffa89fe4a3..0f9ad2da39 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java
@@ -28,161 +28,163 @@ import java.util.ArrayList;
import java.util.Map;
public class CloudifyRequest<R> {
-
- private CloudifyClient client;
-
- public CloudifyRequest() {
-
- }
-
- public CloudifyRequest(CloudifyClient client, HttpMethod method, CharSequence path, Entity<?> entity, Class<R> returnType) {
- this.client = client;
- this.method = method;
- this.path = new StringBuilder(path);
- this.entity = entity;
- this.returnType = returnType;
- header("Accept", "application/json");
- }
-
- private String endpoint;
-
- private HttpMethod method;
-
- private StringBuilder path = new StringBuilder();
-
- private Map<String, List<Object>> headers = new HashMap<String, List<Object>>();
-
- private Entity<?> entity;
-
- private Class<R> returnType;
-
- private boolean basicAuth = false;
- private String user = null;
- private String password = null;
-
- public CloudifyRequest<R> endpoint(String endpoint) {
- this.endpoint = endpoint;
- return this;
- }
-
- public String endpoint() {
- return endpoint;
- }
-
- public CloudifyRequest<R> method(HttpMethod method) {
- this.method = method;
- return this;
- }
-
- public HttpMethod method() {
- return method;
- }
-
- public CloudifyRequest<R> path(String path) {
- this.path.append(path);
- return this;
- }
-
- public String path() {
- return path.toString();
- }
-
- public CloudifyRequest<R> header(String name, Object value) {
- if(value != null) {
- headers.put(name, Arrays.asList(value));
- }
- return this;
- }
-
- public Map<String, List<Object>> headers() {
- return headers;
- }
-
- public <T> Entity<T> entity(T entity, String contentType) {
- return new Entity<T>(entity, contentType);
- }
-
- public Entity<?> entity() {
- return entity;
- }
-
- public <T> Entity<T> json(T entity) {
- return entity(entity, "application/json");
- }
-
- public void returnType(Class<R> returnType) {
- this.returnType = returnType;
- }
-
- public Class<R> returnType() {
- return returnType;
- }
-
- /*
- * Use Basic Authentication for this request. If not set, the client will use Token authentication
- * if a token provider is defined. Otherwise, no authentication will be applied.
- */
- public void setBasicAuthentication (String user, String password) {
- this.basicAuth = true;
- this.user = user;
- this.password= password;
- }
-
- public boolean isBasicAuth () {
- return this.basicAuth;
- }
-
- public String getUser() {
- return user;
- }
-
- public String getPassword() {
- return password;
- }
-
- public R execute() {
- return client.execute(this);
- }
-
- public CloudifyResponse request() {
- return client.request(this);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "CloudifyRequest [endpoint=" + endpoint + ", method=" + method
- + ", path=" + path + ", headers=" + headers + ", entity="
- + entity + ", returnType=" + returnType + "]";
- }
-
- private Map<String, List<Object> > queryParams = new LinkedHashMap<String, List<Object> >();
-
- public Map<String, List<Object> > queryParams() {
- return queryParams;
- }
-
- public CloudifyRequest<R> queryParam(String key, Object value) {
- if (queryParams.containsKey(key)) {
- List<Object> values = queryParams.get(key);
- values.add(value);
- } else {
- List<Object> values = new ArrayList<Object>();
- values.add(value);
- queryParams.put(key, values);
- }
-
- return this;
- }
-
- protected static String buildPath(String ... elements) {
- StringBuilder stringBuilder = new StringBuilder();
- for (String element : elements) {
+
+ private CloudifyClient client;
+
+ public CloudifyRequest() {
+
+ }
+
+ public CloudifyRequest(CloudifyClient client, HttpMethod method, CharSequence path, Entity<?> entity,
+ Class<R> returnType) {
+ this.client = client;
+ this.method = method;
+ this.path = new StringBuilder(path);
+ this.entity = entity;
+ this.returnType = returnType;
+ header("Accept", "application/json");
+ }
+
+ private String endpoint;
+
+ private HttpMethod method;
+
+ private StringBuilder path = new StringBuilder();
+
+ private Map<String, List<Object>> headers = new HashMap<String, List<Object>>();
+
+ private Entity<?> entity;
+
+ private Class<R> returnType;
+
+ private boolean basicAuth = false;
+ private String user = null;
+ private String password = null;
+
+ public CloudifyRequest<R> endpoint(String endpoint) {
+ this.endpoint = endpoint;
+ return this;
+ }
+
+ public String endpoint() {
+ return endpoint;
+ }
+
+ public CloudifyRequest<R> method(HttpMethod method) {
+ this.method = method;
+ return this;
+ }
+
+ public HttpMethod method() {
+ return method;
+ }
+
+ public CloudifyRequest<R> path(String path) {
+ this.path.append(path);
+ return this;
+ }
+
+ public String path() {
+ return path.toString();
+ }
+
+ public CloudifyRequest<R> header(String name, Object value) {
+ if (value != null) {
+ headers.put(name, Arrays.asList(value));
+ }
+ return this;
+ }
+
+ public Map<String, List<Object>> headers() {
+ return headers;
+ }
+
+ public <T> Entity<T> entity(T entity, String contentType) {
+ return new Entity<T>(entity, contentType);
+ }
+
+ public Entity<?> entity() {
+ return entity;
+ }
+
+ public <T> Entity<T> json(T entity) {
+ return entity(entity, "application/json");
+ }
+
+ public void returnType(Class<R> returnType) {
+ this.returnType = returnType;
+ }
+
+ public Class<R> returnType() {
+ return returnType;
+ }
+
+ /*
+ * Use Basic Authentication for this request. If not set, the client will use Token authentication if a token
+ * provider is defined. Otherwise, no authentication will be applied.
+ */
+ public void setBasicAuthentication(String user, String password) {
+ this.basicAuth = true;
+ this.user = user;
+ this.password = password;
+ }
+
+ public boolean isBasicAuth() {
+ return this.basicAuth;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public R execute() {
+ return client.execute(this);
+ }
+
+ public CloudifyResponse request() {
+ return client.request(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "CloudifyRequest [endpoint=" + endpoint + ", method=" + method + ", path=" + path + ", headers="
+ + headers + ", entity=" + entity + ", returnType=" + returnType + "]";
+ }
+
+ private Map<String, List<Object>> queryParams = new LinkedHashMap<String, List<Object>>();
+
+ public Map<String, List<Object>> queryParams() {
+ return queryParams;
+ }
+
+ public CloudifyRequest<R> queryParam(String key, Object value) {
+ if (queryParams.containsKey(key)) {
+ List<Object> values = queryParams.get(key);
+ values.add(value);
+ } else {
+ List<Object> values = new ArrayList<Object>();
+ values.add(value);
+ queryParams.put(key, values);
+ }
+
+ return this;
+ }
+
+ protected static String buildPath(String... elements) {
+ StringBuilder stringBuilder = new StringBuilder();
+ for (String element : elements) {
stringBuilder.append(element);
}
- return stringBuilder.toString();
- }
+ return stringBuilder.toString();
+ }
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponse.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponse.java
index 2d920734b5..6b70e5fa95 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponse.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponse.java
@@ -24,16 +24,16 @@ import java.io.InputStream;
import java.io.Serializable;
import java.util.Map;
-public interface CloudifyResponse extends Serializable{
+public interface CloudifyResponse extends Serializable {
- public <T> T getEntity(Class<T> returnType);
+ public <T> T getEntity(Class<T> returnType);
- public <T> T getErrorEntity(Class<T> returnType);
+ public <T> T getErrorEntity(Class<T> returnType);
- public InputStream getInputStream();
+ public InputStream getInputStream();
+
+ public String getHeader(String name);
+
+ public Map<String, String> headers();
- public String getHeader(String name);
-
- public Map<String, String> headers();
-
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java
index f7c42d3957..966cc8f144 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java
@@ -24,38 +24,38 @@ import org.onap.so.cloudify.v3.model.CloudifyError;
public class CloudifyResponseException extends CloudifyBaseException {
- private static final long serialVersionUID = 7294957362769575271L;
-
- protected String message;
- protected int status;
-
- // Make the response available for exception handling (includes body)
- protected CloudifyResponse response;
-
- public CloudifyResponseException(String message, int status) {
- this.message = message;
- this.status = status;
- this.response = null;
- }
-
- // Include the response message itself. The body is a CloudifyError JSON structure.
- public CloudifyResponseException(String message, int status, CloudifyResponse response) {
- CloudifyError error = response.getErrorEntity(CloudifyError.class);
- this.message = message + ": " + error.getErrorCode();
- this.status = status;
- this.response = response;
- }
-
- public String getMessage() {
- return message;
- }
-
- public int getStatus() {
- return status;
- }
-
- public CloudifyResponse getResponse() {
- return response;
- }
+ private static final long serialVersionUID = 7294957362769575271L;
+
+ protected String message;
+ protected int status;
+
+ // Make the response available for exception handling (includes body)
+ protected CloudifyResponse response;
+
+ public CloudifyResponseException(String message, int status) {
+ this.message = message;
+ this.status = status;
+ this.response = null;
+ }
+
+ // Include the response message itself. The body is a CloudifyError JSON structure.
+ public CloudifyResponseException(String message, int status, CloudifyResponse response) {
+ CloudifyError error = response.getErrorEntity(CloudifyError.class);
+ this.message = message + ": " + error.getErrorCode();
+ this.status = status;
+ this.response = response;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public int getStatus() {
+ return status;
+ }
+
+ public CloudifyResponse getResponse() {
+ return response;
+ }
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseStatus.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseStatus.java
index af6940c041..ccdd7a4168 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseStatus.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseStatus.java
@@ -22,16 +22,16 @@ package org.onap.so.cloudify.base.client;
public class CloudifyResponseStatus {
- public static final int OK = 200;
+ public static final int OK = 200;
- public static final int ACCEPTED = 201;
+ public static final int ACCEPTED = 201;
- public static final int BAD_REQUEST = 400;
+ public static final int BAD_REQUEST = 400;
- public static final int NOT_AUTHORIZED = 401;
+ public static final int NOT_AUTHORIZED = 401;
- public static final int NOT_FOUND = 404;
+ public static final int NOT_FOUND = 404;
- public static final int CONFLICT = 409;
+ public static final int CONFLICT = 409;
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifySimpleTokenProvider.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifySimpleTokenProvider.java
index 074d164b48..0c1e42d0e8 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifySimpleTokenProvider.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifySimpleTokenProvider.java
@@ -22,19 +22,18 @@ package org.onap.so.cloudify.base.client;
public class CloudifySimpleTokenProvider implements CloudifyTokenProvider {
- String token;
+ String token;
- public CloudifySimpleTokenProvider(String token) {
- this.token = token;
- }
+ public CloudifySimpleTokenProvider(String token) {
+ this.token = token;
+ }
- @Override
- public String getToken() {
- return this.token;
- }
+ @Override
+ public String getToken() {
+ return this.token;
+ }
- @Override
- public void expireToken() {
- }
+ @Override
+ public void expireToken() {}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyTokenProvider.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyTokenProvider.java
index 8915a0393b..7c31d9288f 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyTokenProvider.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyTokenProvider.java
@@ -22,8 +22,8 @@ package org.onap.so.cloudify.base.client;
public interface CloudifyTokenProvider {
- String getToken();
+ String getToken();
- void expireToken();
+ void expireToken();
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/Entity.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/Entity.java
index 15a913a4c4..095582fa51 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/Entity.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/Entity.java
@@ -21,51 +21,51 @@
package org.onap.so.cloudify.base.client;
public class Entity<T> {
-
- private T entity;
-
- private String contentType;
-
- public static <T> Entity<T> json(T entity) {
- return new Entity<T>(entity, "application/json");
- }
-
- public static <T> Entity<T> stream(T entity) {
- return new Entity<T>(entity, "application/octet-stream");
- }
- public Entity(T entity, String contentType) {
- super();
- this.entity = entity;
- this.contentType = contentType;
- }
+ private T entity;
- /**
- * @return the entity
- */
- public T getEntity() {
- return entity;
- }
+ private String contentType;
- /**
- * @param entity the entity to set
- */
- public void setEntity(T entity) {
- this.entity = entity;
- }
+ public static <T> Entity<T> json(T entity) {
+ return new Entity<T>(entity, "application/json");
+ }
- /**
- * @return the contentType
- */
- public String getContentType() {
- return contentType;
- }
+ public static <T> Entity<T> stream(T entity) {
+ return new Entity<T>(entity, "application/octet-stream");
+ }
+
+ public Entity(T entity, String contentType) {
+ super();
+ this.entity = entity;
+ this.contentType = contentType;
+ }
+
+ /**
+ * @return the entity
+ */
+ public T getEntity() {
+ return entity;
+ }
+
+ /**
+ * @param entity the entity to set
+ */
+ public void setEntity(T entity) {
+ this.entity = entity;
+ }
+
+ /**
+ * @return the contentType
+ */
+ public String getContentType() {
+ return contentType;
+ }
+
+ /**
+ * @param contentType the contentType to set
+ */
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
- /**
- * @param contentType the contentType to set
- */
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
-
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/HttpMethod.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/HttpMethod.java
index aa991dfcf8..2c5097f1ad 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/HttpMethod.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/HttpMethod.java
@@ -21,5 +21,5 @@
package org.onap.so.cloudify.base.client;
public enum HttpMethod {
- HEAD, GET, POST, PUT, PATCH, DELETE, OPTIONS, TRACE
+ HEAD, GET, POST, PUT, PATCH, DELETE, OPTIONS, TRACE
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java
index 247afb3124..e1992d98ca 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java
@@ -30,7 +30,6 @@ import java.net.UnknownHostException;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.auth.AuthScope;
@@ -55,7 +54,6 @@ import org.onap.so.cloudify.base.client.CloudifyConnectException;
import org.onap.so.cloudify.base.client.CloudifyRequest;
import org.onap.so.cloudify.base.client.CloudifyResponse;
import org.onap.so.cloudify.base.client.CloudifyResponseException;
-
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -67,183 +65,175 @@ import org.slf4j.LoggerFactory;
public class HttpClientConnector implements CloudifyClientConnector {
- private static ObjectMapper DEFAULT_MAPPER;
- private static ObjectMapper WRAPPED_MAPPER;
-
+ private static ObjectMapper DEFAULT_MAPPER;
+ private static ObjectMapper WRAPPED_MAPPER;
+
private static Logger logger = LoggerFactory.getLogger(HttpClientConnector.class);
- static {
- DEFAULT_MAPPER = new ObjectMapper();
-
- DEFAULT_MAPPER.setSerializationInclusion(Include.NON_NULL);
- DEFAULT_MAPPER.disable(SerializationFeature.INDENT_OUTPUT);
- DEFAULT_MAPPER.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
- DEFAULT_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
-
- WRAPPED_MAPPER = new ObjectMapper();
-
- WRAPPED_MAPPER.setSerializationInclusion(Include.NON_NULL);
- WRAPPED_MAPPER.disable(SerializationFeature.INDENT_OUTPUT);
- WRAPPED_MAPPER.enable(SerializationFeature.WRAP_ROOT_VALUE);
- WRAPPED_MAPPER.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
- WRAPPED_MAPPER.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
- WRAPPED_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
- }
-
- protected static <T> ObjectMapper getObjectMapper (Class<T> type) {
- return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER;
- }
-
- public <T> CloudifyResponse request(CloudifyRequest<T> request) {
-
- CloseableHttpClient httpClient = null; //HttpClients.createDefault();
-
- if (request.isBasicAuth()) {
- // Use Basic Auth for this request.
- CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
- credentialsProvider.setCredentials(AuthScope.ANY,
- new UsernamePasswordCredentials (request.getUser(), request.getPassword()));
-
- httpClient = HttpClients.custom().setRedirectStrategy(new HttpClientRedirectStrategy()).setDefaultCredentialsProvider(credentialsProvider).build();
- }
- else {
- // Don't use basic authentication. The Client will attempt Token-based authentication
- httpClient = HttpClients.custom().setRedirectStrategy(new HttpClientRedirectStrategy()).build();
- }
-
- URI uri = null;
-
- // Build the URI with query params
- try {
- URIBuilder uriBuilder = new URIBuilder(request.endpoint() + request.path());
-
- for(Map.Entry<String, List<Object> > entry : request.queryParams().entrySet()) {
- for (Object o : entry.getValue()) {
- uriBuilder.setParameter(entry.getKey(), String.valueOf(o));
- }
- }
-
- uri = uriBuilder.build();
- } catch (URISyntaxException e) {
- throw new HttpClientException (e);
- }
-
- HttpEntity entity = null;
- if (request.entity() != null) {
- // Special handling for streaming input
- if (request.entity().getEntity() instanceof InputStream) {
- // Entity is an InputStream
- entity = new InputStreamEntity ((InputStream) request.entity().getEntity());
- }
- else {
- // Assume to be JSON. Flatten the entity to a Json string
- try {
- // Get appropriate mapper, based on existence of a root element in Entity class
- ObjectMapper mapper = getObjectMapper (request.entity().getEntity().getClass());
-
- String entityJson = mapper.writeValueAsString (request.entity().getEntity());
- entity = new StringEntity(entityJson, ContentType.create(request.entity().getContentType()));
-
- logger.debug ("Request JSON Body: {}", entityJson.replaceAll("\"password\":\"[^\"]*\"",
- "\"password\":\"***\""));
-
- } catch (JsonProcessingException e) {
- throw new HttpClientException ("Json processing error on request entity", e);
- } catch (IOException e) {
- throw new HttpClientException ("Json IO error on request entity", e);
- }
- }
- }
-
- // Determine the HttpRequest class based on the method
- HttpUriRequest httpRequest;
-
- switch (request.method()) {
- case POST:
- HttpPost post = new HttpPost(uri);
- post.setEntity (entity);
- httpRequest = post;
- break;
-
- case GET:
- httpRequest = new HttpGet(uri);
- break;
-
- case PUT:
- HttpPut put = new HttpPut(uri);
- put.setEntity (entity);
- httpRequest = put;
- break;
-
- case DELETE:
- httpRequest = new HttpDelete(uri);
- break;
-
- default:
- throw new HttpClientException ("Unrecognized HTTP Method: " + request.method());
- }
-
- for (Entry<String, List<Object>> h : request.headers().entrySet()) {
- StringBuilder sb = new StringBuilder();
- for (Object v : h.getValue()) {
- sb.append(String.valueOf(v));
- }
- httpRequest.addHeader(h.getKey(), sb.toString());
- }
-
- // Get the Response. But don't get the body entity yet, as this response
- // will be wrapped in an HttpClientResponse. The HttpClientResponse
- // buffers the body in constructor, so can close the response here.
- HttpClientResponse httpClientResponse = null;
- CloseableHttpResponse httpResponse = null;
-
- // Catch known HttpClient exceptions, and wrap them in OpenStack Client Exceptions
- // so calling functions can distinguish. Only RuntimeExceptions are allowed.
- try {
- httpResponse = httpClient.execute(httpRequest);
-
- logger.debug ("Response status: {}", httpResponse.getStatusLine().getStatusCode());
-
- httpClientResponse = new HttpClientResponse (httpResponse);
-
- int status = httpResponse.getStatusLine().getStatusCode();
- if (status == HttpStatus.SC_OK || status == HttpStatus.SC_CREATED ||
- status == HttpStatus.SC_NO_CONTENT || status == HttpStatus.SC_ACCEPTED)
- {
- return httpClientResponse;
- }
- }
- catch (HttpResponseException e) {
- // What exactly does this mean? It does not appear to get thrown for
- // non-2XX responses as documented.
- throw new CloudifyResponseException(e.getMessage(), e.getStatusCode());
- }
- catch (UnknownHostException e) {
- throw new CloudifyConnectException("Unknown Host: " + e.getMessage());
- }
- catch (IOException e) {
- // Catch all other IOExceptions and throw as OpenStackConnectException
- throw new CloudifyConnectException(e.getMessage());
- }
- catch (Exception e) {
- // Catchall for anything else, must throw as a RuntimeException
- logger.error("Client exception", e);
- throw new RuntimeException("Unexpected client exception", e);
- }
- finally {
- // Have the body. Close the stream
- if (httpResponse != null)
- try {
- httpResponse.close();
- } catch (IOException e) {
- logger.debug("Unable to close HTTP Response: " + e);
- }
- }
-
- // Get here on an error response (4XX-5XX)
- throw new CloudifyResponseException(httpResponse.getStatusLine().getReasonPhrase(),
- httpResponse.getStatusLine().getStatusCode(),
- httpClientResponse);
- }
+ static {
+ DEFAULT_MAPPER = new ObjectMapper();
+
+ DEFAULT_MAPPER.setSerializationInclusion(Include.NON_NULL);
+ DEFAULT_MAPPER.disable(SerializationFeature.INDENT_OUTPUT);
+ DEFAULT_MAPPER.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ DEFAULT_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+
+ WRAPPED_MAPPER = new ObjectMapper();
+
+ WRAPPED_MAPPER.setSerializationInclusion(Include.NON_NULL);
+ WRAPPED_MAPPER.disable(SerializationFeature.INDENT_OUTPUT);
+ WRAPPED_MAPPER.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ WRAPPED_MAPPER.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
+ WRAPPED_MAPPER.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ WRAPPED_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+ }
+
+ protected static <T> ObjectMapper getObjectMapper(Class<T> type) {
+ return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER;
+ }
+
+ public <T> CloudifyResponse request(CloudifyRequest<T> request) {
+
+ CloseableHttpClient httpClient = null; // HttpClients.createDefault();
+
+ if (request.isBasicAuth()) {
+ // Use Basic Auth for this request.
+ CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
+ credentialsProvider.setCredentials(AuthScope.ANY,
+ new UsernamePasswordCredentials(request.getUser(), request.getPassword()));
+
+ httpClient = HttpClients.custom().setRedirectStrategy(new HttpClientRedirectStrategy())
+ .setDefaultCredentialsProvider(credentialsProvider).build();
+ } else {
+ // Don't use basic authentication. The Client will attempt Token-based authentication
+ httpClient = HttpClients.custom().setRedirectStrategy(new HttpClientRedirectStrategy()).build();
+ }
+
+ URI uri = null;
+
+ // Build the URI with query params
+ try {
+ URIBuilder uriBuilder = new URIBuilder(request.endpoint() + request.path());
+
+ for (Map.Entry<String, List<Object>> entry : request.queryParams().entrySet()) {
+ for (Object o : entry.getValue()) {
+ uriBuilder.setParameter(entry.getKey(), String.valueOf(o));
+ }
+ }
+
+ uri = uriBuilder.build();
+ } catch (URISyntaxException e) {
+ throw new HttpClientException(e);
+ }
+
+ HttpEntity entity = null;
+ if (request.entity() != null) {
+ // Special handling for streaming input
+ if (request.entity().getEntity() instanceof InputStream) {
+ // Entity is an InputStream
+ entity = new InputStreamEntity((InputStream) request.entity().getEntity());
+ } else {
+ // Assume to be JSON. Flatten the entity to a Json string
+ try {
+ // Get appropriate mapper, based on existence of a root element in Entity class
+ ObjectMapper mapper = getObjectMapper(request.entity().getEntity().getClass());
+
+ String entityJson = mapper.writeValueAsString(request.entity().getEntity());
+ entity = new StringEntity(entityJson, ContentType.create(request.entity().getContentType()));
+
+ logger.debug("Request JSON Body: {}",
+ entityJson.replaceAll("\"password\":\"[^\"]*\"", "\"password\":\"***\""));
+
+ } catch (JsonProcessingException e) {
+ throw new HttpClientException("Json processing error on request entity", e);
+ } catch (IOException e) {
+ throw new HttpClientException("Json IO error on request entity", e);
+ }
+ }
+ }
+
+ // Determine the HttpRequest class based on the method
+ HttpUriRequest httpRequest;
+
+ switch (request.method()) {
+ case POST:
+ HttpPost post = new HttpPost(uri);
+ post.setEntity(entity);
+ httpRequest = post;
+ break;
+
+ case GET:
+ httpRequest = new HttpGet(uri);
+ break;
+
+ case PUT:
+ HttpPut put = new HttpPut(uri);
+ put.setEntity(entity);
+ httpRequest = put;
+ break;
+
+ case DELETE:
+ httpRequest = new HttpDelete(uri);
+ break;
+
+ default:
+ throw new HttpClientException("Unrecognized HTTP Method: " + request.method());
+ }
+
+ for (Entry<String, List<Object>> h : request.headers().entrySet()) {
+ StringBuilder sb = new StringBuilder();
+ for (Object v : h.getValue()) {
+ sb.append(String.valueOf(v));
+ }
+ httpRequest.addHeader(h.getKey(), sb.toString());
+ }
+
+ // Get the Response. But don't get the body entity yet, as this response
+ // will be wrapped in an HttpClientResponse. The HttpClientResponse
+ // buffers the body in constructor, so can close the response here.
+ HttpClientResponse httpClientResponse = null;
+ CloseableHttpResponse httpResponse = null;
+
+ // Catch known HttpClient exceptions, and wrap them in OpenStack Client Exceptions
+ // so calling functions can distinguish. Only RuntimeExceptions are allowed.
+ try {
+ httpResponse = httpClient.execute(httpRequest);
+
+ logger.debug("Response status: {}", httpResponse.getStatusLine().getStatusCode());
+
+ httpClientResponse = new HttpClientResponse(httpResponse);
+
+ int status = httpResponse.getStatusLine().getStatusCode();
+ if (status == HttpStatus.SC_OK || status == HttpStatus.SC_CREATED || status == HttpStatus.SC_NO_CONTENT
+ || status == HttpStatus.SC_ACCEPTED) {
+ return httpClientResponse;
+ }
+ } catch (HttpResponseException e) {
+ // What exactly does this mean? It does not appear to get thrown for
+ // non-2XX responses as documented.
+ throw new CloudifyResponseException(e.getMessage(), e.getStatusCode());
+ } catch (UnknownHostException e) {
+ throw new CloudifyConnectException("Unknown Host: " + e.getMessage());
+ } catch (IOException e) {
+ // Catch all other IOExceptions and throw as OpenStackConnectException
+ throw new CloudifyConnectException(e.getMessage());
+ } catch (Exception e) {
+ // Catchall for anything else, must throw as a RuntimeException
+ logger.error("Client exception", e);
+ throw new RuntimeException("Unexpected client exception", e);
+ } finally {
+ // Have the body. Close the stream
+ if (httpResponse != null)
+ try {
+ httpResponse.close();
+ } catch (IOException e) {
+ logger.debug("Unable to close HTTP Response: " + e);
+ }
+ }
+
+ // Get here on an error response (4XX-5XX)
+ throw new CloudifyResponseException(httpResponse.getStatusLine().getReasonPhrase(),
+ httpResponse.getStatusLine().getStatusCode(), httpClientResponse);
+ }
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientException.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientException.java
index eb967af996..6f170baef5 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientException.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientException.java
@@ -21,22 +21,22 @@
package org.onap.so.cloudify.connector.http;
/*
- * Declare a RuntimeException since the Interface does not declare any
- * throwables. Any caught exception will be wrapped in HttpClientException
+ * Declare a RuntimeException since the Interface does not declare any throwables. Any caught exception will be wrapped
+ * in HttpClientException
*/
public class HttpClientException extends RuntimeException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public HttpClientException (String s) {
- super (s);
- }
-
- public HttpClientException (Exception e) {
- super ("Caught nested exception in HttpClient", e);
- }
-
- public HttpClientException (String s, Exception e) {
- super (s, e);
- }
+ public HttpClientException(String s) {
+ super(s);
+ }
+
+ public HttpClientException(Exception e) {
+ super("Caught nested exception in HttpClient", e);
+ }
+
+ public HttpClientException(String s, Exception e) {
+ super(s, e);
+ }
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategy.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategy.java
index a7575ff499..b8b4a5b018 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategy.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategy.java
@@ -21,7 +21,6 @@
package org.onap.so.cloudify.connector.http;
import java.net.URI;
-
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
@@ -36,15 +35,12 @@ import org.apache.http.impl.client.DefaultRedirectStrategy;
import org.apache.http.protocol.HttpContext;
/**
- * Custom {@link org.apache.http.client.RedirectStrategy} implementation
- * that automatically redirects all HEAD, GET and DELETE requests.
- * The {@link org.apache.http.client.DefaultRedirectStrategy} only
- * redirects GET and HEAD automatically, per the HTTP specification
- * (POST and PUT typically have bodies and thus cannot be redirected).
+ * Custom {@link org.apache.http.client.RedirectStrategy} implementation that automatically redirects all HEAD, GET and
+ * DELETE requests. The {@link org.apache.http.client.DefaultRedirectStrategy} only redirects GET and HEAD
+ * automatically, per the HTTP specification (POST and PUT typically have bodies and thus cannot be redirected).
*
- * A custom strategy is needed for the Openstack API, which can also send
- * 302 on a DELETE (by name) request, expecting the client to follow the
- * redirect to perform the actual deletion.
+ * A custom strategy is needed for the Openstack API, which can also send 302 on a DELETE (by name) request, expecting
+ * the client to follow the redirect to perform the actual deletion.
*/
@Immutable
public class HttpClientRedirectStrategy extends DefaultRedirectStrategy {
@@ -52,20 +48,16 @@ public class HttpClientRedirectStrategy extends DefaultRedirectStrategy {
/**
* Redirectable methods.
*/
- private static final String[] REDIRECT_METHODS = new String[] {
- HttpGet.METHOD_NAME,
- HttpDelete.METHOD_NAME,
- HttpHead.METHOD_NAME
- };
+ private static final String[] REDIRECT_METHODS =
+ new String[] {HttpGet.METHOD_NAME, HttpDelete.METHOD_NAME, HttpHead.METHOD_NAME};
/**
- * Determine if the request should be redirected.
- * This may not actually be needed, since the REDIRECT_METHODS
- * array has been updated with the DELETE.
+ * Determine if the request should be redirected. This may not actually be needed, since the REDIRECT_METHODS array
+ * has been updated with the DELETE.
*/
@Override
protected boolean isRedirectable(final String method) {
- for (final String m: REDIRECT_METHODS) {
+ for (final String m : REDIRECT_METHODS) {
if (m.equalsIgnoreCase(method)) {
return true;
}
@@ -74,16 +66,13 @@ public class HttpClientRedirectStrategy extends DefaultRedirectStrategy {
}
/**
- * Override the default redirect handling method. As implemented
- * in HttpClient, it does not preserve the method on 301 or 302
- * responses, always redirecting to a GET.
+ * Override the default redirect handling method. As implemented in HttpClient, it does not preserve the method on
+ * 301 or 302 responses, always redirecting to a GET.
*/
@Override
- public HttpUriRequest getRedirect(
- final HttpRequest request,
- final HttpResponse response,
- final HttpContext context) throws ProtocolException {
-
+ public HttpUriRequest getRedirect(final HttpRequest request, final HttpResponse response, final HttpContext context)
+ throws ProtocolException {
+
final URI uri = getLocationURI(request, response, context);
final String method = request.getRequestLine().getMethod();
if (method.equalsIgnoreCase(HttpHead.METHOD_NAME)) {
@@ -93,14 +82,14 @@ public class HttpClientRedirectStrategy extends DefaultRedirectStrategy {
} else {
final int status = response.getStatusLine().getStatusCode();
-
- HttpUriRequest newRequest = null;
- if (status == HttpStatus.SC_TEMPORARY_REDIRECT || status == HttpStatus.SC_MOVED_TEMPORARILY) {
+
+ HttpUriRequest newRequest = null;
+ if (status == HttpStatus.SC_TEMPORARY_REDIRECT || status == HttpStatus.SC_MOVED_TEMPORARILY) {
newRequest = RequestBuilder.copy(request).setUri(uri).build();
} else {
- newRequest = new HttpGet(uri);
+ newRequest = new HttpGet(uri);
}
- return newRequest;
+ return newRequest;
}
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java
index b9e7851c98..a96fdb6b50 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java
@@ -25,11 +25,9 @@ package org.onap.so.cloudify.connector.http;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
import com.fasterxml.jackson.databind.ObjectMapper;
-
import org.onap.so.cloudify.base.client.CloudifyResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -40,44 +38,43 @@ import java.util.Map;
public class HttpClientResponse implements CloudifyResponse {
private static Logger logger = LoggerFactory.getLogger(HttpClientResponse.class);
-
+
private HttpResponse response = null;
private String entityBody = null;
- public HttpClientResponse(HttpResponse response)
- {
+ public HttpClientResponse(HttpResponse response) {
this.response = response;
-
+
// Read the body so InputStream can be closed
if (response.getEntity() == null) {
// No body
logger.debug("No Response Body");
return;
}
-
- ByteArrayOutputStream responseBody = new ByteArrayOutputStream();
- try {
- response.getEntity().writeTo(responseBody);
- } catch (IOException e) {
- throw new HttpClientException ("Error Reading Response Body", e);
- }
- entityBody = responseBody.toString();
+
+ ByteArrayOutputStream responseBody = new ByteArrayOutputStream();
+ try {
+ response.getEntity().writeTo(responseBody);
+ } catch (IOException e) {
+ throw new HttpClientException("Error Reading Response Body", e);
+ }
+ entityBody = responseBody.toString();
logger.debug(entityBody);
}
-
+
@Override
- public <T> T getEntity (Class<T> returnType) {
- // Get appropriate mapper, based on existence of a root element
- ObjectMapper mapper = HttpClientConnector.getObjectMapper (returnType);
-
- T resp = null;
- try {
- resp = mapper.readValue(entityBody, returnType);
- } catch (Exception e) {
- throw new HttpClientException ("Caught exception in getEntity", e);
- }
- return resp;
+ public <T> T getEntity(Class<T> returnType) {
+ // Get appropriate mapper, based on existence of a root element
+ ObjectMapper mapper = HttpClientConnector.getObjectMapper(returnType);
+
+ T resp = null;
+ try {
+ resp = mapper.readValue(entityBody, returnType);
+ } catch (Exception e) {
+ throw new HttpClientException("Caught exception in getEntity", e);
+ }
+ return resp;
}
@Override
@@ -87,7 +84,7 @@ public class HttpClientResponse implements CloudifyResponse {
@Override
public InputStream getInputStream() {
- return new ByteArrayInputStream (entityBody.getBytes());
+ return new ByteArrayInputStream(entityBody.getBytes());
}
@Override
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java
index 03c130e4c5..3eae02bcee 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java
@@ -21,7 +21,6 @@
package org.onap.so.cloudify.v3.client;
import java.io.InputStream;
-
import org.onap.so.cloudify.v3.model.Blueprint;
import org.onap.so.cloudify.v3.model.Blueprints;
import org.onap.so.cloudify.base.client.Entity;
@@ -38,15 +37,15 @@ public class BlueprintsResource {
}
/*
- * Upload a blueprint package directly. The blueprint must be a ZIP archive.
- * However, this method will not validate this.
+ * Upload a blueprint package directly. The blueprint must be a ZIP archive. However, this method will not validate
+ * this.
*/
- public UploadBlueprint uploadFromStream (String blueprintId, String mainFileName, InputStream blueprint) {
- return new UploadBlueprint (blueprintId, mainFileName, blueprint, null);
+ public UploadBlueprint uploadFromStream(String blueprintId, String mainFileName, InputStream blueprint) {
+ return new UploadBlueprint(blueprintId, mainFileName, blueprint, null);
}
- public UploadBlueprint uploadFromUrl (String blueprintId, String mainFileName, String blueprintUrl) {
- return new UploadBlueprint (blueprintId, mainFileName, null, blueprintUrl);
+ public UploadBlueprint uploadFromUrl(String blueprintId, String mainFileName, String blueprintUrl) {
+ return new UploadBlueprint(blueprintId, mainFileName, null, blueprintUrl);
}
public ListBlueprints list() {
@@ -68,14 +67,14 @@ public class BlueprintsResource {
public class UploadBlueprint extends CloudifyRequest<Blueprint> {
public UploadBlueprint(String blueprintId, String mainFileName, InputStream blueprint, String blueprintUrl) {
- // Initialize the request elements dynamically.
- // Either a blueprint input stream or a URL will be provided.
- // If a URL is provided, add it to the query string
- // If a Stream is provided, set it as the Entity body
- super(client, HttpMethod.PUT,
- "/api/v3/blueprints/" + blueprintId + "?application_file_name=" + mainFileName + ((blueprintUrl != null) ? "&blueprint_archive=" + blueprintUrl : ""),
- ((blueprint != null) ? Entity.stream(blueprint) : null),
- Blueprint.class);
+ // Initialize the request elements dynamically.
+ // Either a blueprint input stream or a URL will be provided.
+ // If a URL is provided, add it to the query string
+ // If a Stream is provided, set it as the Entity body
+ super(client, HttpMethod.PUT,
+ "/api/v3/blueprints/" + blueprintId + "?application_file_name=" + mainFileName
+ + ((blueprintUrl != null) ? "&blueprint_archive=" + blueprintUrl : ""),
+ ((blueprint != null) ? Entity.stream(blueprint) : null), Blueprint.class);
}
}
@@ -94,10 +93,10 @@ public class BlueprintsResource {
public class ListBlueprints extends CloudifyRequest<Blueprints> {
public ListBlueprints() {
super(client, HttpMethod.GET, "/api/v3/blueprints", null, Blueprints.class);
- }
+ }
}
- // TODO: DownloadBlueprint is not supported, as it needs to return an input stream
- // containing the full blueprint ZIP.
- // For a full client library, this will require returning an open stream as the entity...
+ // TODO: DownloadBlueprint is not supported, as it needs to return an input stream
+ // containing the full blueprint ZIP.
+ // For a full client library, this will require returning an open stream as the entity...
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/Cloudify.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/Cloudify.java
index cd47e1937a..2fdd61ce48 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/Cloudify.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/Cloudify.java
@@ -34,15 +34,11 @@ public class Cloudify extends CloudifyClient {
private final NodeInstancesResource nodeInstances;
private final ExecutionsResource executions;
-/* Not supporting dynamic connectors
- public Cloudify(String endpoint, CloudifyClientConnector connector) {
- super(endpoint, connector);
- deployments = new DeploymentsResource(this);
- blueprints = new BlueprintsResource(this);
- nodeInstances = new NodeInstancesResource(this);
- tokens = new TokensResource(this);
- }
-*/
+ /*
+ * Not supporting dynamic connectors public Cloudify(String endpoint, CloudifyClientConnector connector) {
+ * super(endpoint, connector); deployments = new DeploymentsResource(this); blueprints = new
+ * BlueprintsResource(this); nodeInstances = new NodeInstancesResource(this); tokens = new TokensResource(this); }
+ */
public Cloudify(String endpoint, String tenant) {
super(endpoint, tenant);
deployments = new DeploymentsResource(this);
@@ -53,7 +49,7 @@ public class Cloudify extends CloudifyClient {
}
public Cloudify(String endpoint) {
- super(endpoint);
+ super(endpoint);
deployments = new DeploymentsResource(this);
blueprints = new BlueprintsResource(this);
nodeInstances = new NodeInstancesResource(this);
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java
index 1160bee420..262045a367 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java
@@ -84,7 +84,7 @@ public class DeploymentsResource {
public class ListDeployments extends CloudifyRequest<Deployments> {
public ListDeployments() {
super(client, HttpMethod.GET, "/api/v3/deployments", null, Deployments.class);
- }
+ }
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java
index 6057fbba97..51aaea94bb 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java
@@ -42,18 +42,19 @@ public class ExecutionsResource {
return new ListExecutions(null);
}
- public ListExecutions listSorted (String sortBy) {
+ public ListExecutions listSorted(String sortBy) {
return new ListExecutions("?_sort=" + sortBy);
}
-
+
// Return a filtered list.
// The filter parameter should be a query string of filter criteria (without leading "?")
- public ListExecutions listFiltered (String filter, String sortBy) {
- String listParams = "?" + filter;
- if (sortBy != null) listParams += "&_sort=" + sortBy;
+ public ListExecutions listFiltered(String filter, String sortBy) {
+ String listParams = "?" + filter;
+ if (sortBy != null)
+ listParams += "&_sort=" + sortBy;
return new ListExecutions(listParams);
}
-
+
public GetExecution byId(String id) {
return new GetExecution(id);
}
@@ -61,28 +62,29 @@ public class ExecutionsResource {
public StartExecution start(StartExecutionParams params) {
return new StartExecution(params);
}
-
+
public UpdateExecution updateStatus(String id, String status) {
- UpdateExecutionParams params = new UpdateExecutionParams();
- params.setStatus(status);
+ UpdateExecutionParams params = new UpdateExecutionParams();
+ params.setStatus(status);
return new UpdateExecution(id, params);
}
public CancelExecution cancel(String executionId, CancelExecutionParams params) {
return new CancelExecution(executionId, params);
}
-
+
public class GetExecution extends CloudifyRequest<Execution> {
- public GetExecution (String id) {
+ public GetExecution(String id) {
super(client, HttpMethod.GET, "/api/v3/executions/" + id, null, Execution.class);
}
}
public class ListExecutions extends CloudifyRequest<Executions> {
public ListExecutions(String listParams) {
- super(client, HttpMethod.GET, "/api/v3/executions" + ((listParams!=null) ? listParams : ""), null, Executions.class);
- }
+ super(client, HttpMethod.GET, "/api/v3/executions" + ((listParams != null) ? listParams : ""), null,
+ Executions.class);
+ }
}
public class StartExecution extends CloudifyRequest<Execution> {
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/NodeInstancesResource.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/NodeInstancesResource.java
index 801ced6ef7..bc82c77026 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/NodeInstancesResource.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/NodeInstancesResource.java
@@ -50,7 +50,7 @@ public class NodeInstancesResource {
public class GetNodeInstance extends CloudifyRequest<NodeInstance> {
- public GetNodeInstance (String id) {
+ public GetNodeInstance(String id) {
super(client, HttpMethod.GET, "/api/v3/node-instances/" + id, null, NodeInstance.class);
}
}
@@ -58,12 +58,13 @@ public class NodeInstancesResource {
public class ListNodeInstances extends CloudifyRequest<NodeInstances> {
public ListNodeInstances() {
super(client, HttpMethod.GET, "/api/v3/node-instances", null, NodeInstances.class);
- }
+ }
}
public class UpdateNodeInstance extends CloudifyRequest<NodeInstance> {
public UpdateNodeInstance(String nodeInstanceId, UpdateNodeInstanceParams body) {
- super(client, HttpMethod.PATCH, "/api/v3/node-instances/" + nodeInstanceId, Entity.json(body), NodeInstance.class);
+ super(client, HttpMethod.PATCH, "/api/v3/node-instances/" + nodeInstanceId, Entity.json(body),
+ NodeInstance.class);
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/TokensResource.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/TokensResource.java
index 3ef2ef2bb9..417d7c6eda 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/TokensResource.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/TokensResource.java
@@ -34,9 +34,8 @@ public class TokensResource {
}
/*
- * Get a new token for a user
- * TODO: User ID/Password logic need to be in the Client.
- * Results of a token query should also be able to add to the Client
+ * Get a new token for a user TODO: User ID/Password logic need to be in the Client. Results of a token query should
+ * also be able to add to the Client
*/
public GetToken token() {
return new GetToken();
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/AzureConfig.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/AzureConfig.java
index 29f2d1a8ce..8fd6b7c9c0 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/AzureConfig.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/AzureConfig.java
@@ -21,55 +21,54 @@
package org.onap.so.cloudify.v3.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class AzureConfig implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @JsonProperty("subscription_id")
- String subscriptionId;
+ private static final long serialVersionUID = 1L;
+
+ @JsonProperty("subscription_id")
+ String subscriptionId;
+
+ @JsonProperty("tenant_id")
+ String tenantId;
- @JsonProperty("tenant_id")
- String tenantId;
+ @JsonProperty("client_id")
+ String clientId;
- @JsonProperty("client_id")
- String clientId;
+ @JsonProperty("client_secret")
+ String clientSecret;
- @JsonProperty("client_secret")
- String clientSecret;
+ public String getSubscriptionId() {
+ return subscriptionId;
+ }
- public String getSubscriptionId() {
- return subscriptionId;
- }
+ public void setSubscriptionId(String subscriptionId) {
+ this.subscriptionId = subscriptionId;
+ }
- public void setSubscriptionId(String subscriptionId) {
- this.subscriptionId = subscriptionId;
- }
+ public String getTenantId() {
+ return tenantId;
+ }
- public String getTenantId() {
- return tenantId;
- }
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
- public void setTenantId(String tenantId) {
- this.tenantId = tenantId;
- }
+ public String getClientId() {
+ return clientId;
+ }
- public String getClientId() {
- return clientId;
- }
+ public void setClientId(String clientId) {
+ this.clientId = clientId;
+ }
- public void setClientId(String clientId) {
- this.clientId = clientId;
- }
+ public String getClientSecret() {
+ return clientSecret;
+ }
- public String getClientSecret() {
- return clientSecret;
- }
+ public void setClientSecret(String clientSecret) {
+ this.clientSecret = clientSecret;
+ }
- public void setClientSecret(String clientSecret) {
- this.clientSecret = clientSecret;
- }
-
-} \ No newline at end of file
+}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Blueprint.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Blueprint.java
index ef2a258b9e..873816d121 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Blueprint.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Blueprint.java
@@ -24,23 +24,22 @@ import java.io.IOException;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
@JsonIgnoreProperties(ignoreUnknown = true)
-//@JsonRootName("blueprint")
+// @JsonRootName("blueprint")
public class Blueprint implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 938604986548763151L;
- @JsonProperty("created_at")
+ /**
+ *
+ */
+ private static final long serialVersionUID = 938604986548763151L;
+
+ @JsonProperty("created_at")
private Date createdAt;
@JsonProperty("description")
@@ -48,19 +47,19 @@ public class Blueprint implements Serializable {
@JsonProperty("id")
private String id;
-
+
@JsonProperty("main_file_name")
private String mainFileName;
-
+
@JsonProperty("plan")
private Map<String, Object> plan = null;
-
+
@JsonProperty("tenant_name")
private String tenantName;
-
+
@JsonProperty("updated_at")
private Date updatedAt;
-
+
public Date getCreatedAt() {
return createdAt;
}
@@ -76,7 +75,7 @@ public class Blueprint implements Serializable {
public void setDescription(String description) {
this.description = description;
}
-
+
public String getId() {
return id;
}
@@ -92,24 +91,24 @@ public class Blueprint implements Serializable {
public void setMainFileName(String mainFileName) {
this.mainFileName = mainFileName;
}
-
+
public Map<String, Object> getPlan() {
- return this.plan;
+ return this.plan;
}
-
+
public void setPlan(Map<String, Object> plan) {
- this.plan = plan;
+ this.plan = plan;
}
public String getTenantName() {
- return tenantName;
- }
+ return tenantName;
+ }
- public void setTenantName(String tenantName) {
- this.tenantName = tenantName;
- }
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
- public Date getUpdatedAt() {
+ public Date getUpdatedAt() {
return updatedAt;
}
@@ -118,46 +117,37 @@ public class Blueprint implements Serializable {
}
- /*
- * Return an output as a Json-mapped Object of the provided type.
- * This is useful for json-object outputs.
- */
- public <T> T getMapValue (Map<String,Object> map, String key, Class<T> type)
- {
+ /*
+ * Return an output as a Json-mapped Object of the provided type. This is useful for json-object outputs.
+ */
+ public <T> T getMapValue(Map<String, Object> map, String key, Class<T> type) {
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper();
- if (map.containsKey(key)) {
- try {
- String s = mapper.writeValueAsString(map.get(key));
- return (mapper.readValue(s, type));
- }
- catch (IOException e) {
- return null;
- }
- }
- return null;
- }
+ if (map.containsKey(key)) {
+ try {
+ String s = mapper.writeValueAsString(map.get(key));
+ return (mapper.readValue(s, type));
+ } catch (IOException e) {
+ return null;
+ }
+ }
+ return null;
+ }
- @Override
+ @Override
public String toString() {
- return "Deployment{" +
- "id='" + id + '\'' +
- ", description='" + description + '\'' +
- ", createdAt=" + createdAt +
- ", updatedAt=" + updatedAt +
- ", mainFileName='" + mainFileName + '\'' +
- ", tenantName='" + tenantName + '\'' +
- '}';
- }
-
- /* Add a definition of the Cloudify "plan" attribute once we know what it is.
-
- @JsonIgnoreProperties(ignoreUnknown=true)
- public static final class Plan {
- }
-
-*/
-
+ return "Deployment{" + "id='" + id + '\'' + ", description='" + description + '\'' + ", createdAt=" + createdAt
+ + ", updatedAt=" + updatedAt + ", mainFileName='" + mainFileName + '\'' + ", tenantName='" + tenantName
+ + '\'' + '}';
+ }
+
+ /*
+ * Add a definition of the Cloudify "plan" attribute once we know what it is.
+ *
+ * @JsonIgnoreProperties(ignoreUnknown=true) public static final class Plan { }
+ *
+ */
+
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Blueprints.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Blueprints.java
index aa8e2fc28f..aebf1e5daa 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Blueprints.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Blueprints.java
@@ -22,33 +22,32 @@ package org.onap.so.cloudify.v3.model;
import java.io.Serializable;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Blueprints implements Serializable{
+public class Blueprints implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @JsonProperty("items")
+ private List<Blueprint> items;
- private static final long serialVersionUID = 1L;
+ @JsonProperty("metadata")
+ private Metadata metadata;
- @JsonProperty("items")
- private List<Blueprint> items;
-
- @JsonProperty("metadata")
- private Metadata metadata;
-
- public List<Blueprint> getItems() {
- return items;
- }
+ public List<Blueprint> getItems() {
+ return items;
+ }
- public void setItems(List<Blueprint> items) {
- this.items = items;
- }
+ public void setItems(List<Blueprint> items) {
+ this.items = items;
+ }
- public Metadata getMetadata() {
- return metadata;
- }
+ public Metadata getMetadata() {
+ return metadata;
+ }
- public void setMetadata(Metadata metadata) {
- this.metadata = metadata;
- }
+ public void setMetadata(Metadata metadata) {
+ this.metadata = metadata;
+ }
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java
index 4e90d699c7..0fbe1fc33d 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java
@@ -21,33 +21,30 @@
package org.onap.so.cloudify.v3.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class CancelExecutionParams implements Serializable {
- private static final long serialVersionUID = 1L;
-
+ private static final long serialVersionUID = 1L;
+
@JsonProperty("action")
private String action;
-
+
public final static String CANCEL_ACTION = "cancel";
public final static String FORCE_CANCEL_ACTION = "force-cancel";
-
+
public String getAction() {
- return action;
- }
+ return action;
+ }
- public void setAction(String action) {
- this.action = action;
- }
+ public void setAction(String action) {
+ this.action = action;
+ }
- @Override
+ @Override
public String toString() {
- return "CancelExecutionParams{" +
- "action='" + action + '\'' +
- '}';
+ return "CancelExecutionParams{" + "action='" + action + '\'' + '}';
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CloudifyError.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CloudifyError.java
index 546ae086d8..1638199ce9 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CloudifyError.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CloudifyError.java
@@ -21,54 +21,48 @@
package org.onap.so.cloudify.v3.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
/**
- * This class represents a generic Cloudify error response body.
- * These responses have a common format:
- * {
- * "message": "<error message>",
- * "error_code": "<cloudify error id string>".
- * "server_traceback": "<Python traceback>"
- * }
+ * This class represents a generic Cloudify error response body. These responses have a common format: { "message":
+ * "<error message>", "error_code": "<cloudify error id string>". "server_traceback": "<Python traceback>" }
*
* @author jc1348
*/
public class CloudifyError implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @JsonProperty("message")
- private String message;
-
- @JsonProperty("error_code")
- private String errorCode;
-
- @JsonProperty("server_traceback")
- private String serverTraceback;
-
- public String getMessage() {
- return message;
- }
+ private static final long serialVersionUID = 1L;
+
+ @JsonProperty("message")
+ private String message;
+
+ @JsonProperty("error_code")
+ private String errorCode;
+
+ @JsonProperty("server_traceback")
+ private String serverTraceback;
+
+ public String getMessage() {
+ return message;
+ }
- public void setMessage(String message) {
- this.message = message;
- }
+ public void setMessage(String message) {
+ this.message = message;
+ }
- public String getErrorCode() {
- return errorCode;
- }
+ public String getErrorCode() {
+ return errorCode;
+ }
- public void setErrorCode(String errorCode) {
- this.errorCode = errorCode;
- }
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
- public String getServerTraceback() {
- return serverTraceback;
- }
+ public String getServerTraceback() {
+ return serverTraceback;
+ }
- public void setServerTraceback(String serverTraceback) {
- this.serverTraceback = serverTraceback;
- }
+ public void setServerTraceback(String serverTraceback) {
+ this.serverTraceback = serverTraceback;
+ }
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CreateDeploymentParams.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CreateDeploymentParams.java
index 10b1854d81..66e9b61d27 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CreateDeploymentParams.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CreateDeploymentParams.java
@@ -21,42 +21,38 @@
package org.onap.so.cloudify.v3.model;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.io.Serializable;
import java.util.Map;
public class CreateDeploymentParams implements Serializable {
- private static final long serialVersionUID = 1L;
-
+ private static final long serialVersionUID = 1L;
+
@JsonProperty("blueprint_id")
private String blueprintId;
@JsonProperty("inputs")
private Map<String, Object> inputs;
- public String getBlueprintId() {
- return blueprintId;
- }
+ public String getBlueprintId() {
+ return blueprintId;
+ }
- public void setBlueprintId(String blueprintId) {
- this.blueprintId = blueprintId;
- }
+ public void setBlueprintId(String blueprintId) {
+ this.blueprintId = blueprintId;
+ }
- public Map<String, Object> getInputs() {
- return inputs;
- }
+ public Map<String, Object> getInputs() {
+ return inputs;
+ }
- public void setInputs(Map<String, Object> inputs) {
- this.inputs = inputs;
- }
+ public void setInputs(Map<String, Object> inputs) {
+ this.inputs = inputs;
+ }
@Override
public String toString() {
- return "CreateDeploymentBody{" +
- "blueprintId='" + blueprintId + '\'' +
- ", inputs=" + inputs +
- '}';
+ return "CreateDeploymentBody{" + "blueprintId='" + blueprintId + '\'' + ", inputs=" + inputs + '}';
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Deployment.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Deployment.java
index 9bb3107798..811cdc7333 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Deployment.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Deployment.java
@@ -25,18 +25,17 @@ import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
@JsonIgnoreProperties(ignoreUnknown = true)
-//@JsonRootName("deployment")
+// @JsonRootName("deployment")
public class Deployment implements Serializable {
- private static final long serialVersionUID = 1L;
-
+ private static final long serialVersionUID = 1L;
+
@JsonProperty("blueprint_id")
private String blueprintId;
@@ -51,13 +50,13 @@ public class Deployment implements Serializable {
@JsonProperty("groups")
private Map<String, Group> groups = null;
-
+
@JsonProperty("id")
private String id;
-
+
@JsonProperty("inputs")
private Map<String, Object> inputs = null;
-
+
// TODO: Expand the definition of a PolicyTrigger
@JsonProperty("policy_triggers")
private List<Object> policyTriggers;
@@ -68,7 +67,7 @@ public class Deployment implements Serializable {
@JsonProperty("scaling_groups")
private Map<String, ScalingGroup> scalingGroups = null;
-
+
@JsonProperty("tenant_name")
private String tenantName;
@@ -77,31 +76,31 @@ public class Deployment implements Serializable {
@JsonProperty("workflows")
private List<Workflow> workflows;
-
+
public List<Object> getPolicyTriggers() {
- return policyTriggers;
- }
+ return policyTriggers;
+ }
- public void setPolicyTriggers(List<Object> policyTriggers) {
- this.policyTriggers = policyTriggers;
- }
+ public void setPolicyTriggers(List<Object> policyTriggers) {
+ this.policyTriggers = policyTriggers;
+ }
- public List<Object> getPolicyTypes() {
- return policyTypes;
- }
+ public List<Object> getPolicyTypes() {
+ return policyTypes;
+ }
- public void setPolicyTypes(List<Object> policyTypes) {
- this.policyTypes = policyTypes;
- }
+ public void setPolicyTypes(List<Object> policyTypes) {
+ this.policyTypes = policyTypes;
+ }
- public String getBlueprintId() {
+ public String getBlueprintId() {
return blueprintId;
}
public void setBlueprintId(String blueprintId) {
this.blueprintId = blueprintId;
}
-
+
public Date getCreatedAt() {
return createdAt;
}
@@ -125,13 +124,13 @@ public class Deployment implements Serializable {
public void setDescription(String description) {
this.description = description;
}
-
+
public Map<String, Group> getGroups() {
- return this.groups;
+ return this.groups;
}
-
+
public void setGroups(Map<String, Group> groups) {
- this.groups = groups;
+ this.groups = groups;
}
public String getId() {
@@ -143,10 +142,11 @@ public class Deployment implements Serializable {
}
public Map<String, Object> getInputs() {
- return this.inputs;
+ return this.inputs;
}
+
public void setInputs(Map<String, Object> inputs) {
- this.inputs = inputs;
+ this.inputs = inputs;
}
public String getTenantName() {
@@ -158,14 +158,14 @@ public class Deployment implements Serializable {
}
public Map<String, ScalingGroup> getScalingGroups() {
- return scalingGroups;
- }
+ return scalingGroups;
+ }
- public void setScalingGroups(Map<String, ScalingGroup> scalingGroups) {
- this.scalingGroups = scalingGroups;
- }
+ public void setScalingGroups(Map<String, ScalingGroup> scalingGroups) {
+ this.scalingGroups = scalingGroups;
+ }
- public Date getUpdatedAt() {
+ public Date getUpdatedAt() {
return updatedAt;
}
@@ -185,181 +185,175 @@ public class Deployment implements Serializable {
* Nested subclasses for Group definitions
*/
public static final class Group {
- @JsonProperty ("policies")
- Object policies;
-
- @JsonProperty("members")
- List<String> members;
+ @JsonProperty("policies")
+ Object policies;
+
+ @JsonProperty("members")
+ List<String> members;
- public Object getPolicies() {
- return policies;
- }
+ public Object getPolicies() {
+ return policies;
+ }
- public void setPolicies(Object policies) {
- this.policies = policies;
- }
+ public void setPolicies(Object policies) {
+ this.policies = policies;
+ }
- public List<String> getMembers() {
- return members;
- }
+ public List<String> getMembers() {
+ return members;
+ }
- public void setMembers(List<String> members) {
- this.members = members;
- }
+ public void setMembers(List<String> members) {
+ this.members = members;
+ }
}
/*
* Nested subclasses for Scaling Group definitions
*/
public static final class ScalingGroup {
- @JsonProperty ("properties")
- ScalingGroupProperties properties;
-
- @JsonProperty("members")
- List<String> members;
+ @JsonProperty("properties")
+ ScalingGroupProperties properties;
+
+ @JsonProperty("members")
+ List<String> members;
- public ScalingGroupProperties getProperties() {
- return properties;
- }
+ public ScalingGroupProperties getProperties() {
+ return properties;
+ }
- public void setProperties(ScalingGroupProperties properties) {
- this.properties = properties;
- }
+ public void setProperties(ScalingGroupProperties properties) {
+ this.properties = properties;
+ }
- public List<String> getMembers() {
- return members;
- }
+ public List<String> getMembers() {
+ return members;
+ }
- public void setMembers(List<String> members) {
- this.members = members;
- }
+ public void setMembers(List<String> members) {
+ this.members = members;
+ }
}
public static final class ScalingGroupProperties {
- @JsonProperty("current_instances")
- int currentInstances;
-
- @JsonProperty("default_instances")
- int defaultInstances;
-
- @JsonProperty("max_instances")
- int maxInstances;
-
- @JsonProperty("min_instances")
- int minInstances;
-
- @JsonProperty("planned_instances")
- int plannedInstances;
-
- public int getCurrentInstances() {
- return currentInstances;
- }
-
- public void setCurrentInstances(int currentInstances) {
- this.currentInstances = currentInstances;
- }
-
- public int getDefaultInstances() {
- return defaultInstances;
- }
-
- public void setDefaultInstances(int defaultInstances) {
- this.defaultInstances = defaultInstances;
- }
-
- public int getMaxInstances() {
- return maxInstances;
- }
-
- public void setMaxInstances(int maxInstances) {
- this.maxInstances = maxInstances;
- }
-
- public int getMinInstances() {
- return minInstances;
- }
-
- public void setMinInstances(int minInstances) {
- this.minInstances = minInstances;
- }
-
- public int getPlannedInstances() {
- return plannedInstances;
- }
-
- public void setPlannedInstances(int plannedInstances) {
- this.plannedInstances = plannedInstances;
- }
- }
-
+ @JsonProperty("current_instances")
+ int currentInstances;
+
+ @JsonProperty("default_instances")
+ int defaultInstances;
+
+ @JsonProperty("max_instances")
+ int maxInstances;
+
+ @JsonProperty("min_instances")
+ int minInstances;
+
+ @JsonProperty("planned_instances")
+ int plannedInstances;
+
+ public int getCurrentInstances() {
+ return currentInstances;
+ }
+
+ public void setCurrentInstances(int currentInstances) {
+ this.currentInstances = currentInstances;
+ }
+
+ public int getDefaultInstances() {
+ return defaultInstances;
+ }
+
+ public void setDefaultInstances(int defaultInstances) {
+ this.defaultInstances = defaultInstances;
+ }
+
+ public int getMaxInstances() {
+ return maxInstances;
+ }
+
+ public void setMaxInstances(int maxInstances) {
+ this.maxInstances = maxInstances;
+ }
+
+ public int getMinInstances() {
+ return minInstances;
+ }
+
+ public void setMinInstances(int minInstances) {
+ this.minInstances = minInstances;
+ }
+
+ public int getPlannedInstances() {
+ return plannedInstances;
+ }
+
+ public void setPlannedInstances(int plannedInstances) {
+ this.plannedInstances = plannedInstances;
+ }
+ }
+
/*
- * Nested subclass for Deployment Workflow entities.
- * Note that Blueprint class also contains a slightly different Workflow structure.
+ * Nested subclass for Deployment Workflow entities. Note that Blueprint class also contains a slightly different
+ * Workflow structure.
*/
public static final class Workflow {
- @JsonProperty("name")
- private String name;
- @JsonProperty("created_at")
- private Date createdAt;
- @JsonProperty("parameters")
- private Map<String,ParameterDefinition> parameters;
-
- public Workflow() {}
-
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public Date getCreatedAt() {
- return createdAt;
- }
- public void setCreatedAt(Date createdAt) {
- this.createdAt = createdAt;
- }
- public Map<String, ParameterDefinition> getParameters() {
- return parameters;
- }
- public void setParameters(Map<String, ParameterDefinition> parameters) {
- this.parameters = parameters;
- }
- }
-
- /*
- * Return an output as a Json-mapped Object of the provided type.
- * This is useful for json-object outputs.
- */
- public <T> T getMapValue (Map<String,Object> map, String key, Class<T> type)
- {
-
- ObjectMapper mapper = new ObjectMapper();
- if (map.containsKey(key)) {
- try {
- String s = mapper.writeValueAsString(map.get(key));
- return (mapper.readValue(s, type));
- }
- catch (IOException e) {
- return null;
- }
- }
- return null;
- }
-
- @Override
+ @JsonProperty("name")
+ private String name;
+ @JsonProperty("created_at")
+ private Date createdAt;
+ @JsonProperty("parameters")
+ private Map<String, ParameterDefinition> parameters;
+
+ public Workflow() {}
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Date getCreatedAt() {
+ return createdAt;
+ }
+
+ public void setCreatedAt(Date createdAt) {
+ this.createdAt = createdAt;
+ }
+
+ public Map<String, ParameterDefinition> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(Map<String, ParameterDefinition> parameters) {
+ this.parameters = parameters;
+ }
+ }
+
+ /*
+ * Return an output as a Json-mapped Object of the provided type. This is useful for json-object outputs.
+ */
+ public <T> T getMapValue(Map<String, Object> map, String key, Class<T> type) {
+
+ ObjectMapper mapper = new ObjectMapper();
+ if (map.containsKey(key)) {
+ try {
+ String s = mapper.writeValueAsString(map.get(key));
+ return (mapper.readValue(s, type));
+ } catch (IOException e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ @Override
public String toString() {
- return "Deployment{" +
- "id='" + id + '\'' +
- ", description='" + description + '\'' +
- ", blueprintId='" + blueprintId + '\'' +
- ", createdBy='" + createdBy + '\'' +
- ", tenantName='" + tenantName + '\'' +
- ", createdAt=" + createdAt +
- ", updatedAt=" + updatedAt +
- ", inputs='" + inputs + '\'' +
- ", workflows=" + workflows +
- ", groups=" + groups +
- '}';
+ return "Deployment{" + "id='" + id + '\'' + ", description='" + description + '\'' + ", blueprintId='"
+ + blueprintId + '\'' + ", createdBy='" + createdBy + '\'' + ", tenantName='" + tenantName + '\''
+ + ", createdAt=" + createdAt + ", updatedAt=" + updatedAt + ", inputs='" + inputs + '\''
+ + ", workflows=" + workflows + ", groups=" + groups + '}';
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/DeploymentOutputs.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/DeploymentOutputs.java
index d34195cfd7..5d828720b0 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/DeploymentOutputs.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/DeploymentOutputs.java
@@ -23,65 +23,60 @@ package org.onap.so.cloudify.v3.model;
import java.io.IOException;
import java.io.Serializable;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
@JsonIgnoreProperties(ignoreUnknown = true)
-//@JsonRootName("outputs")
+// @JsonRootName("outputs")
public class DeploymentOutputs implements Serializable {
- private static final long serialVersionUID = 1L;
-
+ private static final long serialVersionUID = 1L;
+
@JsonProperty("deployment_id")
private String deploymentId;
-
+
@JsonProperty("outputs")
private Map<String, Object> outputs = null;
-
+
public Map<String, Object> getOutputs() {
- return this.outputs;
+ return this.outputs;
}
+
public void setOutputs(Map<String, Object> outputs) {
- this.outputs = outputs;
+ this.outputs = outputs;
+ }
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
}
-
- public String getDeploymentId() {
- return deploymentId;
- }
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
-
- /*
- * Return an output as a Json-mapped Object of the provided type.
- * This is useful for json-object outputs.
- */
- public <T> T getMapValue (Map<String,Object> map, String key, Class<T> type)
- {
-
- ObjectMapper mapper = new ObjectMapper();
- if (map.containsKey(key)) {
- try {
- String s = mapper.writeValueAsString(map.get(key));
- return (mapper.readValue(s, type));
- }
- catch (IOException e) {
- return null;
- }
- }
- return null;
- }
+ /*
+ * Return an output as a Json-mapped Object of the provided type. This is useful for json-object outputs.
+ */
+ public <T> T getMapValue(Map<String, Object> map, String key, Class<T> type) {
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ if (map.containsKey(key)) {
+ try {
+ String s = mapper.writeValueAsString(map.get(key));
+ return (mapper.readValue(s, type));
+ } catch (IOException e) {
+ return null;
+ }
+ }
+ return null;
+ }
- @Override
+ @Override
public String toString() {
- return "DeploymentOutputs{" +
- "deploymentId='" + deploymentId + '\'' +
- ", outputs='" + outputs + '\'' +
- '}';
+ return "DeploymentOutputs{" + "deploymentId='" + deploymentId + '\'' + ", outputs='" + outputs + '\'' + '}';
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Deployments.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Deployments.java
index f5019a74e9..b97164f528 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Deployments.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Deployments.java
@@ -21,34 +21,33 @@
package org.onap.so.cloudify.v3.model;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.io.Serializable;
import java.util.List;
public class Deployments implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @JsonProperty("items")
- private List<Deployment> items;
-
- @JsonProperty("metadata")
- private Metadata metadata;
-
- public List<Deployment> getItems() {
- return items;
- }
-
- public void setItems(List<Deployment> items) {
- this.items = items;
- }
-
- public Metadata getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Metadata metadata) {
- this.metadata = metadata;
- }
+ private static final long serialVersionUID = 1L;
+
+ @JsonProperty("items")
+ private List<Deployment> items;
+
+ @JsonProperty("metadata")
+ private Metadata metadata;
+
+ public List<Deployment> getItems() {
+ return items;
+ }
+
+ public void setItems(List<Deployment> items) {
+ this.items = items;
+ }
+
+ public Metadata getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(Metadata metadata) {
+ this.metadata = metadata;
+ }
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Execution.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Execution.java
index 73510ceeb0..258d8e525a 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Execution.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Execution.java
@@ -23,7 +23,6 @@ package org.onap.so.cloudify.v3.model;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -31,8 +30,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
// @JsonRootName("execution")
public class Execution implements Serializable {
- private static final long serialVersionUID = 1L;
-
+ private static final long serialVersionUID = 1L;
+
@JsonProperty("blueprint_id")
private String blueprintId;
@@ -47,127 +46,119 @@ public class Execution implements Serializable {
@JsonProperty("error")
private String error;
-
+
@JsonProperty("id")
private String id;
-
+
@JsonProperty("is_system_workflow")
private boolean isSystemWorkflow;
-
+
@JsonProperty("parameters")
private Map<String, Object> parameters;
-
+
@JsonProperty("status")
private String status;
-
+
@JsonProperty("tenant_name")
private String tenantName;
-
+
@JsonProperty("workflow_id")
private String workflowId;
- public String getBlueprintId() {
- return blueprintId;
- }
+ public String getBlueprintId() {
+ return blueprintId;
+ }
- public void setBlueprintId(String blueprintId) {
- this.blueprintId = blueprintId;
- }
+ public void setBlueprintId(String blueprintId) {
+ this.blueprintId = blueprintId;
+ }
- public Date getCreatedAt() {
- return createdAt;
- }
+ public Date getCreatedAt() {
+ return createdAt;
+ }
- public void setCreatedAt(Date createdAt) {
- this.createdAt = createdAt;
- }
+ public void setCreatedAt(Date createdAt) {
+ this.createdAt = createdAt;
+ }
- public String getCreatedBy() {
- return createdBy;
- }
+ public String getCreatedBy() {
+ return createdBy;
+ }
- public void setCreatedBy(String createdBy) {
- this.createdBy = createdBy;
- }
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
- public String getDeploymentId() {
- return deploymentId;
- }
+ public String getDeploymentId() {
+ return deploymentId;
+ }
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
- public String getError() {
- return error;
- }
+ public String getError() {
+ return error;
+ }
- public void setError(String error) {
- this.error = error;
- }
+ public void setError(String error) {
+ this.error = error;
+ }
- public String getId() {
- return id;
- }
+ public String getId() {
+ return id;
+ }
- public void setId(String id) {
- this.id = id;
- }
+ public void setId(String id) {
+ this.id = id;
+ }
- public boolean isSystemWorkflow() {
- return isSystemWorkflow;
- }
+ public boolean isSystemWorkflow() {
+ return isSystemWorkflow;
+ }
- public void setSystemWorkflow(boolean isSystemWorkflow) {
- this.isSystemWorkflow = isSystemWorkflow;
- }
+ public void setSystemWorkflow(boolean isSystemWorkflow) {
+ this.isSystemWorkflow = isSystemWorkflow;
+ }
- public Map<String, Object> getParameters() {
- return parameters;
- }
+ public Map<String, Object> getParameters() {
+ return parameters;
+ }
- public void setParameters(Map<String, Object> parameters) {
- this.parameters = parameters;
- }
+ public void setParameters(Map<String, Object> parameters) {
+ this.parameters = parameters;
+ }
- public String getStatus() {
- return status;
- }
+ public String getStatus() {
+ return status;
+ }
- public void setStatus(String status) {
- this.status = status;
- }
+ public void setStatus(String status) {
+ this.status = status;
+ }
- public String getTenantName() {
- return tenantName;
- }
+ public String getTenantName() {
+ return tenantName;
+ }
- public void setTenantName(String tenantName) {
- this.tenantName = tenantName;
- }
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
- public String getWorkflowId() {
- return workflowId;
- }
+ public String getWorkflowId() {
+ return workflowId;
+ }
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
+ public void setWorkflowId(String workflowId) {
+ this.workflowId = workflowId;
+ }
- @Override
+ @Override
public String toString() {
- return "Execution{" +
- "id='" + id + '\'' +
- ", blueprintId='" + blueprintId + '\'' +
- ", createdBy='" + createdBy + '\'' +
- ", createdAt=" + createdAt +
- ", deploymentId='" + deploymentId + '\'' +
- ", error=" + error +
- ", isSystemWorkflow=" + isSystemWorkflow +
- ", status=" + status +
- ", tenantName='" + tenantName + '\'' +
- ", parameters=" + parameters +
- '}';
+ return "Execution{" + "id='" + id + '\'' + ", blueprintId='" + blueprintId + '\'' + ", createdBy='" + createdBy
+ + '\'' + ", createdAt=" + createdAt + ", deploymentId='" + deploymentId + '\'' + ", error=" + error
+ + ", isSystemWorkflow=" + isSystemWorkflow + ", status=" + status + ", tenantName='" + tenantName + '\''
+ + ", parameters=" + parameters + '}';
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Executions.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Executions.java
index 2095f8acd9..e238bc7fee 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Executions.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Executions.java
@@ -21,34 +21,33 @@
package org.onap.so.cloudify.v3.model;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.io.Serializable;
import java.util.List;
public class Executions implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @JsonProperty("items")
- private List<Execution> items;
-
- @JsonProperty("metadata")
- private Metadata metadata;
-
- public List<Execution> getItems() {
- return items;
- }
-
- public void setItems(List<Execution> items) {
- this.items = items;
- }
-
- public Metadata getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Metadata metadata) {
- this.metadata = metadata;
- }
+ private static final long serialVersionUID = 1L;
+
+ @JsonProperty("items")
+ private List<Execution> items;
+
+ @JsonProperty("metadata")
+ private Metadata metadata;
+
+ public List<Execution> getItems() {
+ return items;
+ }
+
+ public void setItems(List<Execution> items) {
+ this.items = items;
+ }
+
+ public Metadata getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(Metadata metadata) {
+ this.metadata = metadata;
+ }
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Metadata.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Metadata.java
index 6ae895b30d..269ed9db8a 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Metadata.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Metadata.java
@@ -21,37 +21,29 @@
package org.onap.so.cloudify.v3.model;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.io.Serializable;
/**
- * This class represents a generic Cloudify response to a GET command.
- * These responses have a common format:
- * {
- * "items": [
- * List of objects of the requested type
- * ],
- * "metadata": {
- * }
- * }
+ * This class represents a generic Cloudify response to a GET command. These responses have a common format: { "items":
+ * [ List of objects of the requested type ], "metadata": { } }
*
* @author jc1348
*
*/
public class Metadata implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @JsonProperty("pagination")
- private Pagination pagination;
-
+ private static final long serialVersionUID = 1L;
+
+ @JsonProperty("pagination")
+ private Pagination pagination;
+
- public Pagination getPagination() {
- return pagination;
- }
+ public Pagination getPagination() {
+ return pagination;
+ }
- public void setPagination(Pagination pagination) {
- this.pagination = pagination;
- }
+ public void setPagination(Pagination pagination) {
+ this.pagination = pagination;
+ }
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/NodeInstance.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/NodeInstance.java
index ec597b77a4..4d7f8fb749 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/NodeInstance.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/NodeInstance.java
@@ -23,7 +23,6 @@ package org.onap.so.cloudify.v3.model;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -32,9 +31,9 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("node_instance")
public class NodeInstance implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @JsonProperty("created_by")
+ private static final long serialVersionUID = 1L;
+
+ @JsonProperty("created_by")
private String createdBy;
@JsonProperty("deployment_id")
@@ -45,19 +44,19 @@ public class NodeInstance implements Serializable {
@JsonProperty("id")
private String id;
-
+
@JsonProperty("node_id")
private String nodeId;
-
+
@JsonProperty("relationships")
private List<Object> relationships = null;
-
+
@JsonProperty("runtime_properties")
private Map<String, Object> runtimeProperties = null;
-
+
@JsonProperty("scaling_groups")
private List<ScalingGroupIdentifier> scalingGroups;
-
+
@JsonProperty("state")
private String state;
@@ -67,139 +66,132 @@ public class NodeInstance implements Serializable {
@JsonProperty("version")
private String version;
- public String getCreatedBy() {
- return createdBy;
- }
-
- public void setCreatedBy(String createdBy) {
- this.createdBy = createdBy;
- }
-
- public String getDeploymentId() {
- return deploymentId;
- }
-
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
-
- public String getHostId() {
- return hostId;
- }
-
- public void setHostId(String hostId) {
- this.hostId = hostId;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public List<Object> getRelationships() {
- return relationships;
- }
-
- public void setRelationships(List<Object> relationships) {
- this.relationships = relationships;
- }
-
- public Map<String, Object> getRuntimeProperties() {
- return runtimeProperties;
- }
-
- public void setRuntimeProperties(Map<String, Object> runtimeProperties) {
- this.runtimeProperties = runtimeProperties;
- }
-
- public List<ScalingGroupIdentifier> getScalingGroups() {
- return scalingGroups;
- }
-
- public void setScalingGroups(List<ScalingGroupIdentifier> scalingGroups) {
- this.scalingGroups = scalingGroups;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public String getTenantName() {
- return tenantName;
- }
-
- public void setTenantName(String tenantName) {
- this.tenantName = tenantName;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- /*
- * Nested structure representing scaling groups in which this node is a member
- */
- public static final class ScalingGroupIdentifier
- {
- @JsonProperty("name")
- private String name;
-
- @JsonProperty("id")
- private String id;
-
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getId() {
- return id;
- }
- public void setId(String id) {
- this.id = id;
- }
-
- public String toString() {
- return "Scaling Group{ name=" + name + ", id=" + id + "}";
- }
- }
-
- @Override
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
+
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
+
+ public String getHostId() {
+ return hostId;
+ }
+
+ public void setHostId(String hostId) {
+ this.hostId = hostId;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public List<Object> getRelationships() {
+ return relationships;
+ }
+
+ public void setRelationships(List<Object> relationships) {
+ this.relationships = relationships;
+ }
+
+ public Map<String, Object> getRuntimeProperties() {
+ return runtimeProperties;
+ }
+
+ public void setRuntimeProperties(Map<String, Object> runtimeProperties) {
+ this.runtimeProperties = runtimeProperties;
+ }
+
+ public List<ScalingGroupIdentifier> getScalingGroups() {
+ return scalingGroups;
+ }
+
+ public void setScalingGroups(List<ScalingGroupIdentifier> scalingGroups) {
+ this.scalingGroups = scalingGroups;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getTenantName() {
+ return tenantName;
+ }
+
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /*
+ * Nested structure representing scaling groups in which this node is a member
+ */
+ public static final class ScalingGroupIdentifier {
+ @JsonProperty("name")
+ private String name;
+
+ @JsonProperty("id")
+ private String id;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String toString() {
+ return "Scaling Group{ name=" + name + ", id=" + id + "}";
+ }
+ }
+
+ @Override
public String toString() {
- return "Deployment{" +
- "id='" + id + '\'' +
- "nodeId='" + nodeId + '\'' +
- ", createdBy='" + createdBy + '\'' +
- ", tenantName='" + tenantName + '\'' +
- ", state=" + state +
- ", deploymentId=" + deploymentId +
- ", hostId='" + hostId + '\'' +
- ", version='" + version + '\'' +
- ", relationships=" + relationships +
- ", runtimeProperties=" + runtimeProperties +
- ", scalingGroups=" + scalingGroups +
- '}';
- }
-
- // TODO: Need an object structure for Relationships
+ return "Deployment{" + "id='" + id + '\'' + "nodeId='" + nodeId + '\'' + ", createdBy='" + createdBy + '\''
+ + ", tenantName='" + tenantName + '\'' + ", state=" + state + ", deploymentId=" + deploymentId
+ + ", hostId='" + hostId + '\'' + ", version='" + version + '\'' + ", relationships=" + relationships
+ + ", runtimeProperties=" + runtimeProperties + ", scalingGroups=" + scalingGroups + '}';
+ }
+
+ // TODO: Need an object structure for Relationships
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/NodeInstances.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/NodeInstances.java
index ddaa209b75..8dd30d9696 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/NodeInstances.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/NodeInstances.java
@@ -21,34 +21,33 @@
package org.onap.so.cloudify.v3.model;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.io.Serializable;
import java.util.List;
-public class NodeInstances implements Serializable{
+public class NodeInstances implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @JsonProperty("items")
+ private List<NodeInstance> items;
- private static final long serialVersionUID = 1L;
+ @JsonProperty("metadata")
+ private Metadata metadata;
- @JsonProperty("items")
- private List<NodeInstance> items;
-
- @JsonProperty("metadata")
- private Metadata metadata;
-
- public List<NodeInstance> getItems() {
- return items;
- }
+ public List<NodeInstance> getItems() {
+ return items;
+ }
- public void setItems(List<NodeInstance> items) {
- this.items = items;
- }
+ public void setItems(List<NodeInstance> items) {
+ this.items = items;
+ }
- public Metadata getMetadata() {
- return metadata;
- }
+ public Metadata getMetadata() {
+ return metadata;
+ }
- public void setMetadata(Metadata metadata) {
- this.metadata = metadata;
- }
+ public void setMetadata(Metadata metadata) {
+ this.metadata = metadata;
+ }
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/OpenstackConfig.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/OpenstackConfig.java
index 03ab1f194c..8914a83a55 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/OpenstackConfig.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/OpenstackConfig.java
@@ -21,69 +21,68 @@
package org.onap.so.cloudify.v3.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class OpenstackConfig implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @JsonProperty("username")
- String username;
+ private static final long serialVersionUID = 1L;
+
+ @JsonProperty("username")
+ String username;
+
+ @JsonProperty("password")
+ String password;
- @JsonProperty("password")
- String password;
+ @JsonProperty("tenant_name")
+ String tenantName;
- @JsonProperty("tenant_name")
- String tenantName;
+ @JsonProperty("auth_url")
+ String authUrl;
- @JsonProperty("auth_url")
- String authUrl;
+ @JsonProperty("region")
+ String region;
- @JsonProperty("region")
- String region;
+ // NOTE: Not supporting "custom_configuration"
- // NOTE: Not supporting "custom_configuration"
+ public String getUsername() {
+ return username;
+ }
- public String getUsername() {
- return username;
- }
+ public void setUsername(String username) {
+ this.username = username;
+ }
- public void setUsername(String username) {
- this.username = username;
- }
+ public String getPassword() {
+ return password;
+ }
- public String getPassword() {
- return password;
- }
+ public void setPassword(String password) {
+ this.password = password;
+ }
- public void setPassword(String password) {
- this.password = password;
- }
+ public String getTenantName() {
+ return tenantName;
+ }
- public String getTenantName() {
- return tenantName;
- }
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
- public void setTenantName(String tenantName) {
- this.tenantName = tenantName;
- }
+ public String getAuthUrl() {
+ return authUrl;
+ }
- public String getAuthUrl() {
- return authUrl;
- }
+ public void setAuthUrl(String authUrl) {
+ this.authUrl = authUrl;
+ }
- public void setAuthUrl(String authUrl) {
- this.authUrl = authUrl;
- }
+ public String getRegion() {
+ return region;
+ }
- public String getRegion() {
- return region;
- }
+ public void setRegion(String region) {
+ this.region = region;
+ }
- public void setRegion(String region) {
- this.region = region;
- }
-
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Pagination.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Pagination.java
index 547c437b75..a292b13881 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Pagination.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Pagination.java
@@ -23,29 +23,34 @@ package org.onap.so.cloudify.v3.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Pagination {
- @JsonProperty("total")
- private int total;
- @JsonProperty("offset")
- private int offset;
- @JsonProperty("size")
- private int size;
-
- public int getTotal() {
- return total;
- }
- public void setTotal(int total) {
- this.total = total;
- }
- public int getOffset() {
- return offset;
- }
- public void setOffset(int offset) {
- this.offset = offset;
- }
- public int getSize() {
- return size;
- }
- public void setSize(int size) {
- this.size = size;
- }
+ @JsonProperty("total")
+ private int total;
+ @JsonProperty("offset")
+ private int offset;
+ @JsonProperty("size")
+ private int size;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
+
+ public void setOffset(int offset) {
+ this.offset = offset;
+ }
+
+ public int getSize() {
+ return size;
+ }
+
+ public void setSize(int size) {
+ this.size = size;
+ }
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/ParameterDefinition.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/ParameterDefinition.java
index ae79880cca..1ff70b68d6 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/ParameterDefinition.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/ParameterDefinition.java
@@ -21,38 +21,42 @@
package org.onap.so.cloudify.v3.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonIgnoreProperties(ignoreUnknown = true)
public class ParameterDefinition implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @JsonProperty("type")
- private String type;
- @JsonProperty("description")
- private String description;
- @JsonProperty("default")
- private Object defaultValue;
-
- public String getType() {
- return type;
- }
- public void setType(String type) {
- this.type = type;
- }
- public String getDescription() {
- return description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
- public Object getDefaultValue() {
- return defaultValue;
- }
- public void setDefaultValue(Object defaultValue) {
- this.defaultValue = defaultValue;
- }
+ private static final long serialVersionUID = 1L;
+
+ @JsonProperty("type")
+ private String type;
+ @JsonProperty("description")
+ private String description;
+ @JsonProperty("default")
+ private Object defaultValue;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Object getDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(Object defaultValue) {
+ this.defaultValue = defaultValue;
+ }
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/StartExecutionParams.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/StartExecutionParams.java
index f9d1cecb30..e12b7d094c 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/StartExecutionParams.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/StartExecutionParams.java
@@ -22,16 +22,15 @@ package org.onap.so.cloudify.v3.model;
import java.io.Serializable;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class StartExecutionParams implements Serializable {
- private static final long serialVersionUID = 1L;
-
+ private static final long serialVersionUID = 1L;
+
@JsonProperty("workflow_id")
private String workflowId;
-
+
@JsonProperty("deployment_id")
private String deploymentId;
@@ -43,56 +42,52 @@ public class StartExecutionParams implements Serializable {
@JsonProperty("parameters")
private Map<String, Object> parameters;
-
- public String getWorkflowId() {
- return workflowId;
- }
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
+ public String getWorkflowId() {
+ return workflowId;
+ }
- public String getDeploymentId() {
- return deploymentId;
- }
+ public void setWorkflowId(String workflowId) {
+ this.workflowId = workflowId;
+ }
+
+ public String getDeploymentId() {
+ return deploymentId;
+ }
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
+ public void setDeploymentId(String deploymentId) {
+ this.deploymentId = deploymentId;
+ }
- public boolean isAllowCustomParameters() {
- return allowCustomParameters;
- }
+ public boolean isAllowCustomParameters() {
+ return allowCustomParameters;
+ }
- public void setAllowCustomParameters(boolean allowCustomParameters) {
- this.allowCustomParameters = allowCustomParameters;
- }
+ public void setAllowCustomParameters(boolean allowCustomParameters) {
+ this.allowCustomParameters = allowCustomParameters;
+ }
- public boolean isForce() {
- return force;
- }
+ public boolean isForce() {
+ return force;
+ }
- public void setForce(boolean force) {
- this.force = force;
- }
+ public void setForce(boolean force) {
+ this.force = force;
+ }
- public Map<String, Object> getParameters() {
- return parameters;
- }
+ public Map<String, Object> getParameters() {
+ return parameters;
+ }
- public void setParameters(Map<String, Object> parameters) {
- this.parameters = parameters;
- }
+ public void setParameters(Map<String, Object> parameters) {
+ this.parameters = parameters;
+ }
- @Override
+ @Override
public String toString() {
- return "UpdateExecutionParams{" +
- "workflowId='" + workflowId + '\'' +
- "deploymentId='" + deploymentId + '\'' +
- "allowCustomParameters='" + allowCustomParameters + '\'' +
- "force='" + force + '\'' +
- "parameters='" + parameters + '\'' +
- '}';
+ return "UpdateExecutionParams{" + "workflowId='" + workflowId + '\'' + "deploymentId='" + deploymentId + '\''
+ + "allowCustomParameters='" + allowCustomParameters + '\'' + "force='" + force + '\'' + "parameters='"
+ + parameters + '\'' + '}';
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Token.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Token.java
index ebb968acbf..c5809d4a32 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Token.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/Token.java
@@ -21,47 +21,43 @@
package org.onap.so.cloudify.v3.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonIgnoreProperties(ignoreUnknown = true)
-//@JsonRootName("token")
+// @JsonRootName("token")
// The Token object is returned without a root element
public class Token implements Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- @JsonProperty("role")
+ @JsonProperty("role")
private String role;
@JsonProperty("value")
private String value;
-
- // Any expiration? Maybe something in the Headers?
-
- public String getRole() {
- return role;
- }
- public void setRole(String role) {
- this.role = role;
- }
+ // Any expiration? Maybe something in the Headers?
+
+ public String getRole() {
+ return role;
+ }
- public String getValue() {
- return value;
- }
+ public void setRole(String role) {
+ this.role = role;
+ }
- public void setValue(String value) {
- this.value = value;
- }
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
- @Override
+ @Override
public String toString() {
- return "Token{" +
- "role='" + role + '\'' +
- ", value='" + value + '\'' +
- '}';
+ return "Token{" + "role='" + role + '\'' + ", value='" + value + '\'' + '}';
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/UpdateExecutionParams.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/UpdateExecutionParams.java
index abd809b5d6..3f49b90626 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/UpdateExecutionParams.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/UpdateExecutionParams.java
@@ -21,30 +21,27 @@
package org.onap.so.cloudify.v3.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class UpdateExecutionParams implements Serializable {
- private static final long serialVersionUID = 1L;
-
+ private static final long serialVersionUID = 1L;
+
@JsonProperty("status")
private String status;
-
+
public String getStatus() {
- return status;
- }
+ return status;
+ }
- public void setStatus(String status) {
- this.status = status;
- }
+ public void setStatus(String status) {
+ this.status = status;
+ }
- @Override
+ @Override
public String toString() {
- return "UpdateExecutionParams{" +
- "status='" + status + '\'' +
- '}';
+ return "UpdateExecutionParams{" + "status='" + status + '\'' + '}';
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/UpdateNodeInstanceParams.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/UpdateNodeInstanceParams.java
index 946bb2165c..fabb70a49a 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/UpdateNodeInstanceParams.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/UpdateNodeInstanceParams.java
@@ -21,14 +21,13 @@
package org.onap.so.cloudify.v3.model;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.io.Serializable;
import java.util.Map;
public class UpdateNodeInstanceParams implements Serializable {
- private static final long serialVersionUID = 1L;
-
+ private static final long serialVersionUID = 1L;
+
@JsonProperty("state")
private String state;
@@ -40,37 +39,34 @@ public class UpdateNodeInstanceParams implements Serializable {
public String getState() {
- return state;
- }
+ return state;
+ }
- public void setState(String state) {
- this.state = state;
- }
+ public void setState(String state) {
+ this.state = state;
+ }
- public String getVersion() {
- return version;
- }
+ public String getVersion() {
+ return version;
+ }
- public void setVersion(String version) {
- this.version = version;
- }
+ public void setVersion(String version) {
+ this.version = version;
+ }
- public Map<String, Object> getRuntimeProperties() {
- return runtimeProperties;
- }
+ public Map<String, Object> getRuntimeProperties() {
+ return runtimeProperties;
+ }
- public void setRuntimeProperties(Map<String, Object> runtimeProperties) {
- this.runtimeProperties = runtimeProperties;
- }
+ public void setRuntimeProperties(Map<String, Object> runtimeProperties) {
+ this.runtimeProperties = runtimeProperties;
+ }
- @Override
+ @Override
public String toString() {
- return "UpdateNodeInstanceParams{" +
- "state='" + state + '\'' +
- "version='" + version + '\'' +
- ", runtimeProperties=" + runtimeProperties +
- '}';
+ return "UpdateNodeInstanceParams{" + "state='" + state + '\'' + "version='" + version + '\''
+ + ", runtimeProperties=" + runtimeProperties + '}';
}
}