public static RemoteApiVersion create(final int major, final int minor) { Preconditions.checkArgument(major > 0, "Major version must be bigger than 0 but is " + major); Preconditions.checkArgument(minor > 0, "Minor version must be bigger than 0 but is " + minor); return new RemoteApiVersion(major, minor); }
public static RemoteApiVersion parseConfig(final String version) { Preconditions.checkArgument(version != null, "Version must not be null"); final Matcher matcher = VERSION_REGEX.matcher(version); if (matcher.matches()) { return create(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2))); } throw new IllegalArgumentException(version + " can not be parsed"); }
protected String registryConfigs(AuthConfigurations authConfigs) { try { final String json; final ObjectMapper objectMapper = new ObjectMapper(); final RemoteApiVersion apiVersion = dockerClientConfig.getApiVersion(); if (apiVersion.equals(UNKNOWN_VERSION)) { ObjectNode rootNode = objectMapper.valueToTree(authConfigs.getConfigs()); // all registries final ObjectNode authNodes = objectMapper.valueToTree(authConfigs); // wrapped in "configs":{} rootNode.setAll(authNodes); // merge 2 variants json = rootNode.toString(); } else if (apiVersion.isGreaterOrEqual(VERSION_1_19)) { json = objectMapper.writeValueAsString(authConfigs.getConfigs()); } else { json = objectMapper.writeValueAsString(authConfigs); } return BaseEncoding.base64Url().encode(json.getBytes()); } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void init(DockerClientConfig dockerClientConfig) { super.init(dockerClientConfig); bootstrap = new Bootstrap(); String scheme = dockerClientConfig.getDockerHost().getScheme(); String host = ""; if ("unix".equals(scheme)) { nettyInitializer = new UnixDomainSocketInitializer(); host = "DUMMY"; } else if ("tcp".equals(scheme)) { nettyInitializer = new InetSocketInitializer(); host = dockerClientConfig.getDockerHost().getHost() + ":" + Integer.toString(dockerClientConfig.getDockerHost().getPort()); } eventLoopGroup = nettyInitializer.init(bootstrap, dockerClientConfig); baseResource = new NettyWebTarget(this::connect, host) .path(dockerClientConfig.getApiVersion().asWebPathPart()); }
public final Builder withApiVersion(RemoteApiVersion apiVersion) { this.apiVersion = apiVersion.getVersion(); return this; }
public static RemoteApiVersion parseConfigWithDefault(final String version) { if (Strings.isNullOrEmpty(version)) { return UNKNOWN_VERSION; } try { return parseConfig(version); } catch (IllegalArgumentException e) { return UNKNOWN_VERSION; } }
@Override public void init(DockerClientConfig dockerClientConfig) { super.init(dockerClientConfig); bootstrap = new Bootstrap(); String scheme = dockerClientConfig.getDockerHost().getScheme(); String host = ""; if ("unix".equals(scheme)) { nettyInitializer = new UnixDomainSocketInitializer(); host = "DUMMY"; } else if ("tcp".equals(scheme)) { nettyInitializer = new InetSocketInitializer(); host = dockerClientConfig.getDockerHost().getHost() + ":" + Integer.toString(dockerClientConfig.getDockerHost().getPort()); } eventLoopGroup = nettyInitializer.init(bootstrap, dockerClientConfig); baseResource = new NettyWebTarget(channelProvider, host).path(dockerClientConfig.getApiVersion().asWebPathPart()); }
public final Builder withApiVersion(RemoteApiVersion apiVersion) { this.apiVersion = apiVersion.getVersion(); return this; }
public static RemoteApiVersion parseConfigWithDefault(final String version) { if (Strings.isNullOrEmpty(version)) { return UNKNOWN_VERSION; } try { return parseConfig(version); } catch (IllegalArgumentException e) { return UNKNOWN_VERSION; } }
baseResource = client.target(sanitizeUrl(originalUri).toString()).path(dockerClientConfig.getApiVersion().asWebPathPart());
@Nonnull protected String registryConfigs(@Nonnull AuthConfigurations authConfigs) { try { final String json; final ObjectMapper objectMapper = new ObjectMapper(); final RemoteApiVersion apiVersion = dockerClientConfig.getApiVersion(); if (apiVersion.equals(UNKNOWN_VERSION)) { ObjectNode rootNode = objectMapper.valueToTree(authConfigs.getConfigs()); // all registries final ObjectNode authNodes = objectMapper.valueToTree(authConfigs); // wrapped in "configs":{} rootNode.setAll(authNodes); // merge 2 variants json = rootNode.toString(); } else if (apiVersion.isGreaterOrEqual(VERSION_1_19)) { json = objectMapper.writeValueAsString(authConfigs.getConfigs()); } else { json = objectMapper.writeValueAsString(authConfigs); } return BaseEncoding.base64Url().encode(json.getBytes()); } catch (IOException e) { throw new RuntimeException(e); } }
public static RemoteApiVersion parseConfig(final String version) { Preconditions.checkArgument(version != null, "Version must not be null"); final Matcher matcher = VERSION_REGEX.matcher(version); if (matcher.matches()) { return create(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2))); } throw new IllegalArgumentException(version + " can not be parsed"); }
public static RemoteApiVersion create(final int major, final int minor) { Preconditions.checkArgument(major > 0, "Major version must be bigger than 0 but is " + major); Preconditions.checkArgument(minor > 0, "Minor version must be bigger than 0 but is " + minor); return new RemoteApiVersion(major, minor); }
@Override public void init(DockerClientConfig dockerClientConfig) { checkNotNull(dockerClientConfig, "config was not specified"); this.dockerClientConfig = dockerClientConfig; bootstrap = new Bootstrap(); String scheme = dockerClientConfig.getDockerHost().getScheme(); if ("unix".equals(scheme)) { nettyInitializer = new UnixDomainSocketInitializer(); } else if ("tcp".equals(scheme)) { nettyInitializer = new InetSocketInitializer(); } eventLoopGroup = nettyInitializer.init(bootstrap, dockerClientConfig); baseResource = new WebTarget(channelProvider).path(dockerClientConfig.getApiVersion().asWebPathPart()); }
@Nonnull protected String registryConfigs(@Nonnull AuthConfigurations authConfigs) { try { final String json; final ObjectMapper objectMapper = new ObjectMapper(); final RemoteApiVersion apiVersion = dockerClientConfig.getApiVersion(); if (apiVersion.equals(UNKNOWN_VERSION)) { ObjectNode rootNode = objectMapper.valueToTree(authConfigs.getConfigs()); // all registries final ObjectNode authNodes = objectMapper.valueToTree(authConfigs); // wrapped in "configs":{} rootNode.setAll(authNodes); // merge 2 variants json = rootNode.toString(); } else if (apiVersion.isGreaterOrEqual(VERSION_1_19)) { json = objectMapper.writeValueAsString(authConfigs.getConfigs()); } else { json = objectMapper.writeValueAsString(authConfigs); } return BaseEncoding.base64Url().encode(json.getBytes()); } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void init(DockerClientConfig dockerClientConfig) { super.init(dockerClientConfig); bootstrap = new Bootstrap(); String scheme = dockerClientConfig.getDockerHost().getScheme(); String host = ""; if ("unix".equals(scheme)) { nettyInitializer = new UnixDomainSocketInitializer(); host = "DUMMY"; } else if ("tcp".equals(scheme)) { nettyInitializer = new InetSocketInitializer(); host = dockerClientConfig.getDockerHost().getHost() + ":" + Integer.toString(dockerClientConfig.getDockerHost().getPort()); } eventLoopGroup = nettyInitializer.init(bootstrap, dockerClientConfig); baseResource = new NettyWebTarget(channelProvider, host).path(dockerClientConfig.getApiVersion().asWebPathPart()); }
protected String registryConfigs(AuthConfigurations authConfigs) { try { final String json; final ObjectMapper objectMapper = new ObjectMapper(); final RemoteApiVersion apiVersion = dockerClientConfig.getApiVersion(); if (apiVersion.equals(UNKNOWN_VERSION)) { ObjectNode rootNode = objectMapper.valueToTree(authConfigs.getConfigs()); // all registries final ObjectNode authNodes = objectMapper.valueToTree(authConfigs); // wrapped in "configs":{} rootNode.setAll(authNodes); // merge 2 variants json = rootNode.toString(); } else if (apiVersion.isGreaterOrEqual(VERSION_1_19)) { json = objectMapper.writeValueAsString(authConfigs.getConfigs()); } else { json = objectMapper.writeValueAsString(authConfigs); } return BaseEncoding.base64Url().encode(json.getBytes()); } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void init(DockerClientConfig dockerClientConfig) { super.init(dockerClientConfig); bootstrap = new Bootstrap(); String scheme = dockerClientConfig.getDockerHost().getScheme(); String host = ""; if ("unix".equals(scheme)) { nettyInitializer = new UnixDomainSocketInitializer(); host = "DUMMY"; } else if ("tcp".equals(scheme)) { nettyInitializer = new InetSocketInitializer(); host = dockerClientConfig.getDockerHost().getHost() + ":" + Integer.toString(dockerClientConfig.getDockerHost().getPort()); } eventLoopGroup = nettyInitializer.init(bootstrap, dockerClientConfig); baseResource = new NettyWebTarget(this::connect, host) .path(dockerClientConfig.getApiVersion().asWebPathPart()); }
baseResource = client.target(sanitizeUrl(originalUri).toString()).path(dockerClientConfig.getApiVersion().asWebPathPart());