diff options
author | Steve Smokowski <ss835w@att.com> | 2020-05-11 14:08:18 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-05-11 14:08:18 +0000 |
commit | 1b08c1ff96623e55200305fc411a8ad03ddd16d1 (patch) | |
tree | 3a4b18b33b0fdbbbf767ca47bd459c24d2c5bb1d | |
parent | 12a6186f7df04286b9148ca13029f72b03c7024c (diff) | |
parent | f3929629c37453199d2bca8d27d2d9dfb6d2b86c (diff) |
Merge "added queryImage method"
-rw-r--r-- | adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java | 14 |
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); + } + } + } |