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

com.spotify.docker.client.DockerConfig Maven / Gradle / Ivy

There is a newer version: 8.16.0
Show newest version
/*-
 * -\-\-
 * docker-client
 * --
 * Copyright (C) 2016 - 2018 Spotify AB
 * --
 * 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 com.spotify.docker.client;

import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableMap;
import com.spotify.docker.client.messages.RegistryAuth;

import java.util.Map;
import javax.annotation.Nullable;

/**
 * Represents the contents of the docker config.json file.
 */
@AutoValue
@JsonAutoDetect(fieldVisibility = ANY, getterVisibility = NONE, setterVisibility = NONE)
public abstract class DockerConfig {

  @Nullable
  @JsonProperty("credHelpers")
  public abstract ImmutableMap credHelpers();

  @Nullable
  @JsonProperty("auths")
  public abstract ImmutableMap auths();

  @Nullable
  @JsonProperty("HttpHeaders")
  public abstract ImmutableMap httpHeaders();

  @Nullable
  @JsonProperty("credsStore")
  public abstract String credsStore();

  @Nullable
  @JsonProperty("detachKeys")
  public abstract String detachKeys();

  @Nullable
  @JsonProperty("stackOrchestrator")
  public abstract String stackOrchestrator();

  @Nullable
  @JsonProperty("psFormat")
  public abstract String psFormat();

  @Nullable
  @JsonProperty("imagesFormat")
  public abstract String imagesFormat();

  @JsonCreator
  public static DockerConfig create(
          @JsonProperty("credHelpers") final Map credHelpers,
          @JsonProperty("auths") final Map auths,
          @JsonProperty("HttpHeaders") final Map httpHeaders,
          @JsonProperty("credsStore") final String credsStore,
          @JsonProperty("detachKeys") final String detachKeys,
          @JsonProperty("stackOrchestrator") final String stackOrchestrator,
          @JsonProperty("psFormat") final String psFormat,
          @JsonProperty("imagesFormat") final String imagesFormat) {
    return new AutoValue_DockerConfig(
        credHelpers == null
            ? ImmutableMap.of()
            : ImmutableMap.copyOf(credHelpers),
        auths == null
            ? ImmutableMap.of()
            : ImmutableMap.copyOf(auths),
        httpHeaders == null
            ? ImmutableMap.of()
            : ImmutableMap.copyOf(httpHeaders),
        credsStore,
        detachKeys,
        stackOrchestrator,
        psFormat,
        imagesFormat);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy