Search in sources :

Example 1 with RegistryListing

use of com.epam.pipeline.entity.docker.RegistryListing in project cloud-pipeline by epam.

the class DockerClient method getRegistryEntries.

public Set<String> getRegistryEntries() {
    try {
        URI uri = new URI(String.format(LIST_REGISTRY_URL, hostName));
        HttpEntity entity = getAuthHeaders();
        ResponseEntity<RegistryListing> response = getRestTemplate().exchange(uri, HttpMethod.GET, entity, new ParameterizedTypeReference<RegistryListing>() {
        });
        if (response.getStatusCode() == HttpStatus.OK) {
            return response.getBody().getRepositories();
        } else {
            throw new UnexpectedResponseStatusException(response.getStatusCode());
        }
    } catch (URISyntaxException | UnexpectedResponseStatusException e) {
        LOGGER.error(e.getMessage(), e);
        return Collections.emptySet();
    }
}
Also used : HttpEntity(org.springframework.http.HttpEntity) UnexpectedResponseStatusException(com.epam.pipeline.exception.git.UnexpectedResponseStatusException) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) RegistryListing(com.epam.pipeline.entity.docker.RegistryListing)

Aggregations

RegistryListing (com.epam.pipeline.entity.docker.RegistryListing)1 UnexpectedResponseStatusException (com.epam.pipeline.exception.git.UnexpectedResponseStatusException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 HttpEntity (org.springframework.http.HttpEntity)1