private WebTarget createPushRequestFromTag(final String nameAndTag) {
    ImageDescriptor descriptor = new ImageDescriptor(nameAndTag);
    WebTarget target =
        getServiceEndPoint().path(descriptor.getRegistryRepositoryAndImage()).path("push");

    if (descriptor.getTag().isPresent()) {
      target = target.queryParam("tag", descriptor.getTag().get());
    }

    return target;
  }
  public String pullImage(final String image) {
    ImageDescriptor descriptor = new ImageDescriptor(image);

    WebTarget target = getServiceEndPoint().path("create");

    target = target.queryParam("fromImage", descriptor.getRegistryRepositoryAndImage());

    if (descriptor.getTag().isPresent()) {
      target = target.queryParam("tag", descriptor.getTag().get());
    }

    return target
        .request()
        .header(REGISTRY_AUTH_HEADER, getRegistryAuthHeaderValue())
        .accept(MediaType.APPLICATION_JSON_TYPE)
        .post(null, String.class);
  }
  public void tagImage(final String imageId, final String nameAndTag) {
    ImageDescriptor descriptor = new ImageDescriptor(nameAndTag);

    WebTarget target =
        getServiceEndPoint()
            .path(imageId)
            .path("tag")
            .queryParam("repo", descriptor.getRegistryRepositoryAndImage());

    Optional<String> targetTag = descriptor.getTag();
    if (targetTag.isPresent()) {
      target = target.queryParam("tag", targetTag.get());
    }

    Response response = target.request().accept(MediaType.APPLICATION_JSON_TYPE).post(null);

    Response.StatusType statusInfo = response.getStatusInfo();

    response.close();

    checkImageTargetingResponse(imageId, statusInfo);
  }
  public String pullImage(final String image) {
    ImageDescriptor descriptor = new ImageDescriptor(image);

    WebTarget target =
        getServiceEndPoint().path("create").queryParam("fromImage", descriptor.getImage());

    if (descriptor.getRepository().isPresent()) {
      target = target.queryParam("repo", descriptor.getRepository().get());
    }

    if (descriptor.getTag().isPresent()) {
      target = target.queryParam("tag", descriptor.getTag().get());
    }

    if (descriptor.getRegistry().isPresent()) {
      target = target.queryParam("registry", descriptor.getRegistry().get());
    }

    return target.request().accept(MediaType.APPLICATION_JSON_TYPE).post(null, String.class);
  }