aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openecomp/dcae/inventory/clients/DatabusControllerClient.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/openecomp/dcae/inventory/clients/DatabusControllerClient.java')
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/clients/DatabusControllerClient.java34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/main/java/org/openecomp/dcae/inventory/clients/DatabusControllerClient.java b/src/main/java/org/openecomp/dcae/inventory/clients/DatabusControllerClient.java
index ac3bbf1..9df11d5 100644
--- a/src/main/java/org/openecomp/dcae/inventory/clients/DatabusControllerClient.java
+++ b/src/main/java/org/openecomp/dcae/inventory/clients/DatabusControllerClient.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.clients;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.clients;
+
import org.openecomp.dcae.inventory.InventoryConfiguration;
import org.openecomp.dcae.inventory.exceptions.DatabusControllerClientException;
import com.fasterxml.jackson.core.type.TypeReference;
@@ -51,7 +48,7 @@ public class DatabusControllerClient {
resourcePath = (new StringBuilder("/")).append(resourcePath).toString();
}
- return UriBuilder.fromPath(resourcePath.toString()).scheme("http").host(this.connectionConfiguration.getHost())
+ return UriBuilder.fromPath(resourcePath.toString()).scheme("https").host(this.connectionConfiguration.getHost())
.port(this.connectionConfiguration.getPort()).build();
}
@@ -74,6 +71,11 @@ public class DatabusControllerClient {
} catch (IOException e) {
throw new DatabusControllerClientException(e);
}
+ } else if (response.getStatus() == 401) {
+ // You probably got this because your mech id/password is not authorized
+ throw new DatabusControllerClientException(String.format("Check the mech id/password: %d", response.getStatus()));
+ } else if (response.getStatus() == 403) {
+ throw new DatabusControllerClientException(String.format("Credentials not authorized: %d", response.getStatus()));
}
throw new DatabusControllerClientException(String.format("Unexpected error from databus controller: %d",