Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.ecs.model.DockerVolumeConfiguration Maven / Gradle / Ivy
Go to download
The AWS Java SDK for the Amazon EC2 Container Service holds the client classes that are used for
communicating with the
Amazon EC2 Container Service
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 software.amazon.awssdk.services.ecs.model;
import java.beans.Transient;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* This parameter is specified when you're using Docker volumes. Docker volumes are only supported when you're using the
* EC2 launch type. Windows containers only support the use of the local
driver. To use bind mounts,
* specify a host
instead.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DockerVolumeConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField SCOPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("scope")
.getter(getter(DockerVolumeConfiguration::scopeAsString)).setter(setter(Builder::scope))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("scope").build()).build();
private static final SdkField AUTOPROVISION_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("autoprovision").getter(getter(DockerVolumeConfiguration::autoprovision))
.setter(setter(Builder::autoprovision))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("autoprovision").build()).build();
private static final SdkField DRIVER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("driver")
.getter(getter(DockerVolumeConfiguration::driver)).setter(setter(Builder::driver))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("driver").build()).build();
private static final SdkField> DRIVER_OPTS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("driverOpts")
.getter(getter(DockerVolumeConfiguration::driverOpts))
.setter(setter(Builder::driverOpts))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("driverOpts").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField> LABELS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("labels")
.getter(getter(DockerVolumeConfiguration::labels))
.setter(setter(Builder::labels))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("labels").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SCOPE_FIELD,
AUTOPROVISION_FIELD, DRIVER_FIELD, DRIVER_OPTS_FIELD, LABELS_FIELD));
private static final long serialVersionUID = 1L;
private final String scope;
private final Boolean autoprovision;
private final String driver;
private final Map driverOpts;
private final Map labels;
private DockerVolumeConfiguration(BuilderImpl builder) {
this.scope = builder.scope;
this.autoprovision = builder.autoprovision;
this.driver = builder.driver;
this.driverOpts = builder.driverOpts;
this.labels = builder.labels;
}
/**
*
* The scope for the Docker volume that determines its lifecycle. Docker volumes that are scoped to a
* task
are automatically provisioned when the task starts and destroyed when the task stops. Docker
* volumes that are scoped as shared
persist after the task stops.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #scope} will return
* {@link Scope#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #scopeAsString}.
*
*
* @return The scope for the Docker volume that determines its lifecycle. Docker volumes that are scoped to a
* task
are automatically provisioned when the task starts and destroyed when the task stops.
* Docker volumes that are scoped as shared
persist after the task stops.
* @see Scope
*/
public final Scope scope() {
return Scope.fromValue(scope);
}
/**
*
* The scope for the Docker volume that determines its lifecycle. Docker volumes that are scoped to a
* task
are automatically provisioned when the task starts and destroyed when the task stops. Docker
* volumes that are scoped as shared
persist after the task stops.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #scope} will return
* {@link Scope#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #scopeAsString}.
*
*
* @return The scope for the Docker volume that determines its lifecycle. Docker volumes that are scoped to a
* task
are automatically provisioned when the task starts and destroyed when the task stops.
* Docker volumes that are scoped as shared
persist after the task stops.
* @see Scope
*/
public final String scopeAsString() {
return scope;
}
/**
*
* If this value is true
, the Docker volume is created if it doesn't already exist.
*
*
*
* This field is only used if the scope
is shared
.
*
*
*
* @return If this value is true
, the Docker volume is created if it doesn't already exist.
*
* This field is only used if the scope
is shared
.
*
*/
public final Boolean autoprovision() {
return autoprovision;
}
/**
*
* The Docker volume driver to use. The driver value must match the driver name provided by Docker because it is
* used for task placement. If the driver was installed using the Docker plugin CLI, use
* docker plugin ls
to retrieve the driver name from your container instance. If the driver was
* installed using another method, use Docker plugin discovery to retrieve the driver name. For more information,
* see Docker plugin discovery .
* This parameter maps to Driver
in the Create a volume section of the Docker Remote API and the xxdriver
option to docker volume create .
*
*
* @return The Docker volume driver to use. The driver value must match the driver name provided by Docker because
* it is used for task placement. If the driver was installed using the Docker plugin CLI, use
* docker plugin ls
to retrieve the driver name from your container instance. If the driver was
* installed using another method, use Docker plugin discovery to retrieve the driver name. For more
* information, see Docker
* plugin discovery . This parameter maps to Driver
in the Create a volume section of
* the Docker Remote API and the
* xxdriver
option to docker volume create .
*/
public final String driver() {
return driver;
}
/**
* For responses, this returns true if the service returned a value for the DriverOpts property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasDriverOpts() {
return driverOpts != null && !(driverOpts instanceof SdkAutoConstructMap);
}
/**
*
* A map of Docker driver-specific options passed through. This parameter maps to DriverOpts
in the Create a volume section of the Docker Remote API and the xxopt
option to docker volume create .
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasDriverOpts} method.
*
*
* @return A map of Docker driver-specific options passed through. This parameter maps to DriverOpts
in
* the Create a volume
* section of the Docker Remote API and the
* xxopt
option to docker volume create .
*/
public final Map driverOpts() {
return driverOpts;
}
/**
* For responses, this returns true if the service returned a value for the Labels property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasLabels() {
return labels != null && !(labels instanceof SdkAutoConstructMap);
}
/**
*
* Custom metadata to add to your Docker volume. This parameter maps to Labels
in the Create a volume section of the Docker Remote API and the xxlabel
option to docker volume create .
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasLabels} method.
*
*
* @return Custom metadata to add to your Docker volume. This parameter maps to Labels
in the Create a volume section of
* the Docker Remote API and the
* xxlabel
option to docker volume create .
*/
public final Map labels() {
return labels;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(scopeAsString());
hashCode = 31 * hashCode + Objects.hashCode(autoprovision());
hashCode = 31 * hashCode + Objects.hashCode(driver());
hashCode = 31 * hashCode + Objects.hashCode(hasDriverOpts() ? driverOpts() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasLabels() ? labels() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DockerVolumeConfiguration)) {
return false;
}
DockerVolumeConfiguration other = (DockerVolumeConfiguration) obj;
return Objects.equals(scopeAsString(), other.scopeAsString()) && Objects.equals(autoprovision(), other.autoprovision())
&& Objects.equals(driver(), other.driver()) && hasDriverOpts() == other.hasDriverOpts()
&& Objects.equals(driverOpts(), other.driverOpts()) && hasLabels() == other.hasLabels()
&& Objects.equals(labels(), other.labels());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("DockerVolumeConfiguration").add("Scope", scopeAsString()).add("Autoprovision", autoprovision())
.add("Driver", driver()).add("DriverOpts", hasDriverOpts() ? driverOpts() : null)
.add("Labels", hasLabels() ? labels() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "scope":
return Optional.ofNullable(clazz.cast(scopeAsString()));
case "autoprovision":
return Optional.ofNullable(clazz.cast(autoprovision()));
case "driver":
return Optional.ofNullable(clazz.cast(driver()));
case "driverOpts":
return Optional.ofNullable(clazz.cast(driverOpts()));
case "labels":
return Optional.ofNullable(clazz.cast(labels()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((DockerVolumeConfiguration) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The scope for the Docker volume that determines its lifecycle. Docker volumes that are scoped to a
* task
are automatically provisioned when the task starts and destroyed when the task stops.
* Docker volumes that are scoped as shared
persist after the task stops.
*
*
* @param scope
* The scope for the Docker volume that determines its lifecycle. Docker volumes that are scoped to a
* task
are automatically provisioned when the task starts and destroyed when the task
* stops. Docker volumes that are scoped as shared
persist after the task stops.
* @see Scope
* @return Returns a reference to this object so that method calls can be chained together.
* @see Scope
*/
Builder scope(String scope);
/**
*
* The scope for the Docker volume that determines its lifecycle. Docker volumes that are scoped to a
* task
are automatically provisioned when the task starts and destroyed when the task stops.
* Docker volumes that are scoped as shared
persist after the task stops.
*
*
* @param scope
* The scope for the Docker volume that determines its lifecycle. Docker volumes that are scoped to a
* task
are automatically provisioned when the task starts and destroyed when the task
* stops. Docker volumes that are scoped as shared
persist after the task stops.
* @see Scope
* @return Returns a reference to this object so that method calls can be chained together.
* @see Scope
*/
Builder scope(Scope scope);
/**
*
* If this value is true
, the Docker volume is created if it doesn't already exist.
*
*
*
* This field is only used if the scope
is shared
.
*
*
*
* @param autoprovision
* If this value is true
, the Docker volume is created if it doesn't already exist.
*
*
* This field is only used if the scope
is shared
.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder autoprovision(Boolean autoprovision);
/**
*
* The Docker volume driver to use. The driver value must match the driver name provided by Docker because it is
* used for task placement. If the driver was installed using the Docker plugin CLI, use
* docker plugin ls
to retrieve the driver name from your container instance. If the driver was
* installed using another method, use Docker plugin discovery to retrieve the driver name. For more
* information, see Docker plugin
* discovery . This parameter maps to Driver
in the Create a volume section of the Docker Remote API and the xxdriver
option
* to docker volume create .
*
*
* @param driver
* The Docker volume driver to use. The driver value must match the driver name provided by Docker
* because it is used for task placement. If the driver was installed using the Docker plugin CLI, use
* docker plugin ls
to retrieve the driver name from your container instance. If the driver
* was installed using another method, use Docker plugin discovery to retrieve the driver name. For more
* information, see Docker
* plugin discovery . This parameter maps to Driver
in the Create a volume section of
* the Docker Remote API and the
* xxdriver
option to docker volume create .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder driver(String driver);
/**
*
* A map of Docker driver-specific options passed through. This parameter maps to DriverOpts
in the
* Create a volume section of the
* Docker Remote API and the xxopt
option
* to docker volume create .
*
*
* @param driverOpts
* A map of Docker driver-specific options passed through. This parameter maps to DriverOpts
* in the Create a volume
* section of the Docker Remote API and the
* xxopt
option to docker volume create .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder driverOpts(Map driverOpts);
/**
*
* Custom metadata to add to your Docker volume. This parameter maps to Labels
in the Create a volume section of the Docker Remote API and the xxlabel
option to
* docker volume create .
*
*
* @param labels
* Custom metadata to add to your Docker volume. This parameter maps to Labels
in the Create a volume section of
* the Docker Remote API and the
* xxlabel
option to docker volume create .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder labels(Map labels);
}
static final class BuilderImpl implements Builder {
private String scope;
private Boolean autoprovision;
private String driver;
private Map driverOpts = DefaultSdkAutoConstructMap.getInstance();
private Map labels = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(DockerVolumeConfiguration model) {
scope(model.scope);
autoprovision(model.autoprovision);
driver(model.driver);
driverOpts(model.driverOpts);
labels(model.labels);
}
public final String getScope() {
return scope;
}
public final void setScope(String scope) {
this.scope = scope;
}
@Override
@Transient
public final Builder scope(String scope) {
this.scope = scope;
return this;
}
@Override
@Transient
public final Builder scope(Scope scope) {
this.scope(scope == null ? null : scope.toString());
return this;
}
public final Boolean getAutoprovision() {
return autoprovision;
}
public final void setAutoprovision(Boolean autoprovision) {
this.autoprovision = autoprovision;
}
@Override
@Transient
public final Builder autoprovision(Boolean autoprovision) {
this.autoprovision = autoprovision;
return this;
}
public final String getDriver() {
return driver;
}
public final void setDriver(String driver) {
this.driver = driver;
}
@Override
@Transient
public final Builder driver(String driver) {
this.driver = driver;
return this;
}
public final Map getDriverOpts() {
if (driverOpts instanceof SdkAutoConstructMap) {
return null;
}
return driverOpts;
}
public final void setDriverOpts(Map driverOpts) {
this.driverOpts = StringMapCopier.copy(driverOpts);
}
@Override
@Transient
public final Builder driverOpts(Map driverOpts) {
this.driverOpts = StringMapCopier.copy(driverOpts);
return this;
}
public final Map getLabels() {
if (labels instanceof SdkAutoConstructMap) {
return null;
}
return labels;
}
public final void setLabels(Map labels) {
this.labels = StringMapCopier.copy(labels);
}
@Override
@Transient
public final Builder labels(Map labels) {
this.labels = StringMapCopier.copy(labels);
return this;
}
@Override
public DockerVolumeConfiguration build() {
return new DockerVolumeConfiguration(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}