@GET
  @Path("/{imageStream}")
  @Produces(MediaType.APPLICATION_JSON)
  public ImageStream getImageStream(
      @PathParam("namespace") String namespace, @PathParam("imageStream") String imageStream)
      throws UnauthorizedException, ServerException {

    return toDto(
        ImageStream.class,
        clientFactory.getOpenshiftClient().get(ResourceKind.IMAGE_STREAM, imageStream, namespace));
  }
 @PUT
 @Path("/{imageStream}")
 @Consumes(MediaType.APPLICATION_JSON)
 @Produces(MediaType.APPLICATION_JSON)
 public ImageStream updateImageStream(
     @PathParam("namespace") String namespace,
     @PathParam("imageStream") String imageStreamName,
     ImageStream imageStream)
     throws ForbiddenException, UnauthorizedException, ServerException {
   if (!imageStreamName.equals(imageStream.getMetadata().getName())) {
     throw new ForbiddenException("Name of resources can read only access mode");
   }
   final IClient client = clientFactory.getOpenshiftClient();
   return toDto(ImageStream.class, client.update(toOpenshiftResource(client, imageStream)));
 }
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  public List<ImageStream> getImageStreams(
      @PathParam("namespace") String namespace, @QueryParam("application") String application)
      throws UnauthorizedException, ServerException {
    Map<String, String> labels = new HashMap<>();
    if (application != null) {
      labels.put("application", application);
    }

    List<IImageStream> imageStreams =
        clientFactory.getOpenshiftClient().list(ResourceKind.IMAGE_STREAM, namespace, labels);
    return imageStreams
        .stream()
        .map(imageStream -> toDto(ImageStream.class, imageStream))
        .collect(Collectors.toList());
  }
  @POST
  @Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.APPLICATION_JSON)
  public ImageStream createImageStream(
      @PathParam("namespace") String namespace, ImageStream imageStream)
      throws BadRequestException, UnauthorizedException, ServerException {
    if (imageStream.getKind() == null) {
      imageStream.setKind(ResourceKind.IMAGE_STREAM);
    }
    if (!ResourceKind.IMAGE_STREAM.equals(imageStream.getKind())) {
      throw new BadRequestException(
          imageStream.getKind() + " cannot be handled as a " + ResourceKind.IMAGE_STREAM);
    }

    final IClient client = clientFactory.getOpenshiftClient();
    final IImageStream openshiftImageStream = toOpenshiftResource(client, imageStream);
    return toDto(ImageStream.class, client.create(openshiftImageStream, namespace));
  }