use of com.epam.pipeline.entity.docker.TagsListing in project cloud-pipeline by epam.
the class DockerClient method getImageTags.
public List<String> getImageTags(String registryPath, String image) {
String url = String.format(TAGS_LIST, registryPath, image);
try {
URI uri = new URI(url);
HttpEntity entity = getAuthHeaders();
ResponseEntity<TagsListing> response = getRestTemplate().exchange(uri, HttpMethod.GET, entity, new ParameterizedTypeReference<TagsListing>() {
});
if (response.getStatusCode() == HttpStatus.OK) {
return response.getBody().getTags();
} else {
throw new UnexpectedResponseStatusException(response.getStatusCode());
}
} catch (URISyntaxException | HttpClientErrorException | UnexpectedResponseStatusException e) {
LOGGER.error(e.getMessage(), e);
throw new DockerConnectionException(url, e.getMessage());
}
}
Aggregations