summaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src
diff options
context:
space:
mode:
authorSmokowski, Steven <steve.smokowski@att.com>2020-05-07 15:55:44 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-05-07 15:55:44 -0400
commitf3929629c37453199d2bca8d27d2d9dfb6d2b86c (patch)
treee4d0fe10c6b390b94616f2ad2de7dcb892ce4f21 /adapters/mso-adapter-utils/src
parent5e67cc099f6bcade2f12bf9220bdf3682f2d06c1 (diff)
added queryImage method
Add queryImage method to openstack utils Issue-ID: SO-2909 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I4006dfb4a31e6cea5898f2782f4fe3f84f878212
Diffstat (limited to 'adapters/mso-adapter-utils/src')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
index 687afeda40..9d6bf65dce 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
@@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.glance.Glance;
+import com.woorea.openstack.glance.model.Image;
import com.woorea.openstack.glance.model.Images;
@Component
@@ -93,4 +94,17 @@ public class GlanceClientImpl extends MsoCommonUtils {
}
}
+ public Image queryImage(String cloudSiteId, String tenantId, String imageId)
+ throws MsoCloudSiteNotFound, GlanceClientException {
+ try {
+ Glance glanceClient = getGlanceClient(cloudSiteId, tenantId);
+ // list is set to false, otherwise an invalid URL is appended
+ OpenStackRequest<Image> request = glanceClient.images().show(imageId);
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Glance Client", e);
+ throw new GlanceClientException("Error building Glance Client", e);
+ }
+ }
+
}