bipinprasad commented on a change in pull request #3366: URL: https://github.com/apache/storm/pull/3366#discussion_r548541861
########## File path: storm-server/src/main/java/org/apache/storm/container/oci/OciContainerExecutorConfig.java ########## @@ -0,0 +1,1309 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.storm.container.oci; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonRawValue; + +import java.util.List; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_DEFAULT) +public class OciContainerExecutorConfig { + private final String version; + private final String username; + private final String containerId; + private final String pidFile; + private final String containerScriptPath; + private final List<OciLayer> layers; + private final int reapLayerKeepCount; + private final OciRuntimeConfig ociRuntimeConfig; + + public OciContainerExecutorConfig() { + this(null, null, null, null, null, null, 0, null); + } + + public OciContainerExecutorConfig(String username, + String containerId, + String pidFile, String containerScriptPath, String containerCredentialsPath, + List<String> localDirs, + List<String> logDirs, List<OciLayer> layers, int reapLayerKeepCount, + OciRuntimeConfig ociRuntimeConfig) { + this("0.1", username, containerId, pidFile, + containerScriptPath, layers, reapLayerKeepCount, ociRuntimeConfig); + } + + public OciContainerExecutorConfig(String version, String username, + String containerId, + String pidFile, String containerScriptPath, + List<OciLayer> layers, int reapLayerKeepCount, + OciRuntimeConfig ociRuntimeConfig) { + this.version = version; + this.username = username; + this.containerId = containerId; + this.pidFile = pidFile; + this.containerScriptPath = containerScriptPath; + this.layers = layers; + this.reapLayerKeepCount = reapLayerKeepCount; + this.ociRuntimeConfig = ociRuntimeConfig; + } + + public String getVersion() { + return version; + } + + public String getUsername() { + return username; + } + + public String getContainerId() { + return containerId; + } + + public String getPidFile() { + return pidFile; + } + + public String getContainerScriptPath() { + return containerScriptPath; + } + + public List<OciLayer> getLayers() { + return layers; + } + + public int getReapLayerKeepCount() { + return reapLayerKeepCount; + } + + public OciRuntimeConfig getOciRuntimeConfig() { + return ociRuntimeConfig; + } + + @JsonInclude(JsonInclude.Include.NON_DEFAULT) + public static class OciLayer { + private final String mediaType; + private final String path; + + public OciLayer(String mediaType, String path) { + this.mediaType = mediaType; + this.path = path; + } + + public OciLayer() { + this(null, null); + } + + public String getMediaType() { + return mediaType; + } + + public String getPath() { + return path; + } + + @Override + public String toString() { + return "OciLayer{" + + "mediaType='" + mediaType + '\'' + + ", path='" + path + '\'' + + '}'; + } + } + + @JsonInclude(JsonInclude.Include.NON_DEFAULT) + public static class OciRuntimeConfig { + private final OciRootConfig root; + private final List<OciMount> mounts; + private final OciProcessConfig process; + private final OciHooksConfig hooks; + private final OciAnnotationsConfig annotations; + private final OciLinuxConfig linux; + private final String hostname; + + public OciRuntimeConfig() { + this(null, null, null, null, null, null, null); + } + + public OciRuntimeConfig(OciRootConfig root, List<OciMount> mounts, + OciProcessConfig process, String hostname, OciHooksConfig hooks, OciAnnotationsConfig annotations, + OciLinuxConfig linux) { + this.root = root; + this.mounts = mounts; + this.process = process; + this.hostname = hostname; + this.hooks = hooks; + this.annotations = annotations; + this.linux = linux; + } + + public OciRootConfig getRoot() { + return root; + } + + public List<OciMount> getMounts() { + return mounts; + } + + public OciProcessConfig getProcess() { + return process; + } + + public String getHostname() { + return hostname; + } + + public OciHooksConfig getHooks() { + return hooks; + } + + public OciAnnotationsConfig getAnnotations() { + return annotations; + } + + public OciLinuxConfig getLinux() { + return linux; + } + + @JsonInclude(JsonInclude.Include.NON_DEFAULT) + static class OciRootConfig { + private final String path; + private final boolean readonly; + + OciRootConfig(String path, boolean readonly) { + this.path = path; + this.readonly = readonly; + } + + OciRootConfig() { + this(null, false); + } + + public String getPath() { + return path; + } + + public boolean isReadonly() { + return readonly; + } + } + + @JsonInclude(JsonInclude.Include.NON_DEFAULT) + static class OciMount { + private final String destination; + private final String type; + private final String source; + private final List<String> options; + + OciMount(String destination, String type, String source, List<String> options) { + this.destination = destination; + this.type = type; + this.source = source; + this.options = options; + } + + OciMount(String destination, String source, List<String> options) { Review comment: Unused constructor. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org