From f3929629c37453199d2bca8d27d2d9dfb6d2b86c Mon Sep 17 00:00:00 2001 From: "Smokowski, Steven" Date: Thu, 7 May 2020 15:55:44 -0400 Subject: added queryImage method Add queryImage method to openstack utils Issue-ID: SO-2909 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I4006dfb4a31e6cea5898f2782f4fe3f84f878212 --- .../java/org/onap/so/openstack/utils/GlanceClientImpl.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'adapters/mso-adapter-utils/src/main/java/org') 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 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); + } + } + } -- cgit 1.2.3-korg