All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mandas.docker.client.messages.swarm.ContainerSpec Maven / Gradle / Ivy

There is a newer version: 8.0.3
Show newest version
/*-
 * -\-\-
 * docker-client
 * --
 * Copyright (C) 2016 Spotify AB
 * Copyright (C) 9/2019 - 2020 Dimitris Mandalidis
 * --
 * Licensed 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.mandas.docker.client.messages.swarm;

import java.util.List;
import java.util.Map;

import org.immutables.value.Value.Immutable;
import org.mandas.docker.Nullable;
import org.mandas.docker.client.messages.ContainerConfig;
import org.mandas.docker.client.messages.mount.Mount;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

@JsonDeserialize(builder = ImmutableContainerSpec.Builder.class)
@Immutable
public interface ContainerSpec {

  @JsonProperty("Image")
  String image();

  /**
   * @return an optional hostname
   * @since API 1.26
   */
  @Nullable
  @JsonProperty("Hostname")
  String hostname();

  @JsonProperty("Labels")
  Map labels();

  @Nullable
  @JsonProperty("Command")
  List command();

  @Nullable
  @JsonProperty("Args")
  List args();

  @Nullable
  @JsonProperty("Env")
  List env();

  @Nullable
  @JsonProperty("Dir")
  String dir();

  @Nullable
  @JsonProperty("User")
  String user();

  @Nullable
  @JsonProperty("Groups")
  List groups();

  @Nullable
  @JsonProperty("TTY")
  Boolean tty();

  @Nullable
  @JsonProperty("Mounts")
  List mounts();

  @Nullable
  @JsonProperty("StopGracePeriod")
  Long stopGracePeriod();

  /**
   * @return an optional healthcheck
   * @since API 1.26
   */
  @Nullable
  @JsonProperty("Healthcheck")
  ContainerConfig.Healthcheck healthcheck();

  /**
   * @return a lits of hosts
   * @since API 1.26
   */
  @Nullable
  @JsonProperty("Hosts")
  List hosts();

  /**
   * @return a list of secrets
   * @since API 1.26
   */
  @Nullable
  @JsonProperty("Secrets")
  List secrets();

  /**
   * @return a list of configs
   * @since API 1.30
   */
  @Nullable
  @JsonProperty("Configs")
  List configs();

  @Nullable
  @JsonProperty("DNSConfig")
  DnsConfig dnsConfig();
  
  @JsonProperty("Sysctls")
  Map sysctls();

  /**
   * @return a init property in container specification
   * @since 1.37
   */
  @Nullable
  @JsonProperty("Init")
  Boolean init();

  interface Builder {

    Builder image(String image);

    Builder addLabel(final String label, final String value);

    Builder hostname(String hostname);

    Builder labels(Map labels);

    Builder command(String... commands);

    Builder command(Iterable commands);

    Builder args(String... args);

    Builder args(Iterable args);

    Builder env(String... env);

    Builder env(Iterable env);

    Builder dir(String dir);

    Builder user(String user);

    Builder groups(String... groups);

    Builder groups(Iterable groups);

    Builder tty(Boolean tty);

    Builder mounts(Mount... mounts);

    Builder mounts(Iterable mounts);

    Builder stopGracePeriod(Long stopGracePeriod);

    Builder dnsConfig(DnsConfig dnsConfig);

    Builder healthcheck(ContainerConfig.Healthcheck healthcheck);

    Builder hosts(Iterable hosts);

    Builder secrets(Iterable secrets);

    Builder configs(Iterable configs);
    
    Builder init(Boolean init);
    
    Builder sysctls(Map sysctls);
    
    Builder addSysctl(String key, String value);

    ContainerSpec build();
  }

  public static Builder builder() {
    return ImmutableContainerSpec.builder();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy