secretOptions;
private LogConfiguration(BuilderImpl builder) {
this.logDriver = builder.logDriver;
this.options = builder.options;
this.secretOptions = builder.secretOptions;
}
/**
*
* The log driver to use for the container. The valid values listed for this parameter are log drivers that the
* Amazon ECS container agent can communicate with by default.
*
*
* For tasks using the Fargate launch type, the supported log drivers are awslogs
and
* splunk
.
*
*
* For tasks using the EC2 launch type, the supported log drivers are awslogs
, syslog
,
* gelf
, fluentd
, splunk
, journald
, and json-file
.
*
*
* For more information about using the awslogs
log driver, see Using the awslogs Log
* Driver in the Amazon Elastic Container Service Developer Guide .
*
*
*
* If you have a custom driver that is not listed above that you would like to work with the Amazon ECS container
* agent, you can fork the Amazon ECS container agent project that is available on GitHub and customize it to work with that driver.
* We encourage you to submit pull requests for changes that you would like to have included. However, Amazon Web
* Services does not currently support running modified copies of this software.
*
*
*
* This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the
* Docker Remote API version on your container instance, log in to your container instance and run the following
* command: sudo docker version --format '{{.Server.APIVersion}}'
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #logDriver} will
* return {@link LogDriver#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #logDriverAsString}.
*
*
* @return The log driver to use for the container. The valid values listed for this parameter are log drivers that
* the Amazon ECS container agent can communicate with by default.
*
* For tasks using the Fargate launch type, the supported log drivers are awslogs
and
* splunk
.
*
*
* For tasks using the EC2 launch type, the supported log drivers are awslogs
,
* syslog
, gelf
, fluentd
, splunk
, journald
,
* and json-file
.
*
*
* For more information about using the awslogs
log driver, see Using the awslogs
* Log Driver in the Amazon Elastic Container Service Developer Guide .
*
*
*
* If you have a custom driver that is not listed above that you would like to work with the Amazon ECS
* container agent, you can fork the Amazon ECS container agent project that is available on GitHub and customize it to work with that
* driver. We encourage you to submit pull requests for changes that you would like to have included.
* However, Amazon Web Services does not currently support running modified copies of this software.
*
*
*
* This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To
* check the Docker Remote API version on your container instance, log in to your container instance and run
* the following command: sudo docker version --format '{{.Server.APIVersion}}'
* @see LogDriver
*/
public LogDriver logDriver() {
return LogDriver.fromValue(logDriver);
}
/**
*
* The log driver to use for the container. The valid values listed for this parameter are log drivers that the
* Amazon ECS container agent can communicate with by default.
*
*
* For tasks using the Fargate launch type, the supported log drivers are awslogs
and
* splunk
.
*
*
* For tasks using the EC2 launch type, the supported log drivers are awslogs
, syslog
,
* gelf
, fluentd
, splunk
, journald
, and json-file
.
*
*
* For more information about using the awslogs
log driver, see Using the awslogs Log
* Driver in the Amazon Elastic Container Service Developer Guide .
*
*
*
* If you have a custom driver that is not listed above that you would like to work with the Amazon ECS container
* agent, you can fork the Amazon ECS container agent project that is available on GitHub and customize it to work with that driver.
* We encourage you to submit pull requests for changes that you would like to have included. However, Amazon Web
* Services does not currently support running modified copies of this software.
*
*
*
* This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the
* Docker Remote API version on your container instance, log in to your container instance and run the following
* command: sudo docker version --format '{{.Server.APIVersion}}'
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #logDriver} will
* return {@link LogDriver#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #logDriverAsString}.
*
*
* @return The log driver to use for the container. The valid values listed for this parameter are log drivers that
* the Amazon ECS container agent can communicate with by default.
*
* For tasks using the Fargate launch type, the supported log drivers are awslogs
and
* splunk
.
*
*
* For tasks using the EC2 launch type, the supported log drivers are awslogs
,
* syslog
, gelf
, fluentd
, splunk
, journald
,
* and json-file
.
*
*
* For more information about using the awslogs
log driver, see Using the awslogs
* Log Driver in the Amazon Elastic Container Service Developer Guide .
*
*
*
* If you have a custom driver that is not listed above that you would like to work with the Amazon ECS
* container agent, you can fork the Amazon ECS container agent project that is available on GitHub and customize it to work with that
* driver. We encourage you to submit pull requests for changes that you would like to have included.
* However, Amazon Web Services does not currently support running modified copies of this software.
*
*
*
* This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To
* check the Docker Remote API version on your container instance, log in to your container instance and run
* the following command: sudo docker version --format '{{.Server.APIVersion}}'
* @see LogDriver
*/
public String logDriverAsString() {
return logDriver;
}
/**
*
* The configuration options to send to the log driver. This parameter requires version 1.19 of the Docker Remote
* API or greater on your container instance. To check the Docker Remote API version on your container instance, log
* in to your container instance and run the following command:
* sudo docker version --format '{{.Server.APIVersion}}'
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The configuration options to send to the log driver. This parameter requires version 1.19 of the Docker
* Remote API or greater on your container instance. To check the Docker Remote API version on your
* container instance, log in to your container instance and run the following command:
* sudo docker version --format '{{.Server.APIVersion}}'
*/
public Map options() {
return options;
}
/**
*
* The secrets to pass to the log configuration.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The secrets to pass to the log configuration.
*/
public List secretOptions() {
return secretOptions;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(logDriverAsString());
hashCode = 31 * hashCode + Objects.hashCode(options());
hashCode = 31 * hashCode + Objects.hashCode(secretOptions());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof LogConfiguration)) {
return false;
}
LogConfiguration other = (LogConfiguration) obj;
return Objects.equals(logDriverAsString(), other.logDriverAsString()) && Objects.equals(options(), other.options())
&& Objects.equals(secretOptions(), other.secretOptions());
}
/**
* 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 String toString() {
return ToString.builder("LogConfiguration").add("LogDriver", logDriverAsString()).add("Options", options())
.add("SecretOptions", secretOptions()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "logDriver":
return Optional.ofNullable(clazz.cast(logDriverAsString()));
case "options":
return Optional.ofNullable(clazz.cast(options()));
case "secretOptions":
return Optional.ofNullable(clazz.cast(secretOptions()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((LogConfiguration) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The log driver to use for the container. The valid values listed for this parameter are log drivers that the
* Amazon ECS container agent can communicate with by default.
*
*
* For tasks using the Fargate launch type, the supported log drivers are awslogs
and
* splunk
.
*
*
* For tasks using the EC2 launch type, the supported log drivers are awslogs
, syslog
,
* gelf
, fluentd
, splunk
, journald
, and
* json-file
.
*
*
* For more information about using the awslogs
log driver, see Using the awslogs Log
* Driver in the Amazon Elastic Container Service Developer Guide .
*
*
*
* If you have a custom driver that is not listed above that you would like to work with the Amazon ECS
* container agent, you can fork the Amazon ECS container agent project that is available on GitHub and customize it to work with that
* driver. We encourage you to submit pull requests for changes that you would like to have included. However,
* Amazon Web Services does not currently support running modified copies of this software.
*
*
*
* This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check
* the Docker Remote API version on your container instance, log in to your container instance and run the
* following command: sudo docker version --format '{{.Server.APIVersion}}'
*
*
* @param logDriver
* The log driver to use for the container. The valid values listed for this parameter are log drivers
* that the Amazon ECS container agent can communicate with by default.
*
* For tasks using the Fargate launch type, the supported log drivers are awslogs
and
* splunk
.
*
*
* For tasks using the EC2 launch type, the supported log drivers are awslogs
,
* syslog
, gelf
, fluentd
, splunk
,
* journald
, and json-file
.
*
*
* For more information about using the awslogs
log driver, see Using the
* awslogs Log Driver in the Amazon Elastic Container Service Developer Guide .
*
*
*
* If you have a custom driver that is not listed above that you would like to work with the Amazon ECS
* container agent, you can fork the Amazon ECS container agent project that is available on GitHub and customize it to work with
* that driver. We encourage you to submit pull requests for changes that you would like to have
* included. However, Amazon Web Services does not currently support running modified copies of this
* software.
*
*
*
* This parameter requires version 1.18 of the Docker Remote API or greater on your container instance.
* To check the Docker Remote API version on your container instance, log in to your container instance
* and run the following command: sudo docker version --format '{{.Server.APIVersion}}'
* @see LogDriver
* @return Returns a reference to this object so that method calls can be chained together.
* @see LogDriver
*/
Builder logDriver(String logDriver);
/**
*
* The log driver to use for the container. The valid values listed for this parameter are log drivers that the
* Amazon ECS container agent can communicate with by default.
*
*
* For tasks using the Fargate launch type, the supported log drivers are awslogs
and
* splunk
.
*
*
* For tasks using the EC2 launch type, the supported log drivers are awslogs
, syslog
,
* gelf
, fluentd
, splunk
, journald
, and
* json-file
.
*
*
* For more information about using the awslogs
log driver, see Using the awslogs Log
* Driver in the Amazon Elastic Container Service Developer Guide .
*
*
*
* If you have a custom driver that is not listed above that you would like to work with the Amazon ECS
* container agent, you can fork the Amazon ECS container agent project that is available on GitHub and customize it to work with that
* driver. We encourage you to submit pull requests for changes that you would like to have included. However,
* Amazon Web Services does not currently support running modified copies of this software.
*
*
*
* This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check
* the Docker Remote API version on your container instance, log in to your container instance and run the
* following command: sudo docker version --format '{{.Server.APIVersion}}'
*
*
* @param logDriver
* The log driver to use for the container. The valid values listed for this parameter are log drivers
* that the Amazon ECS container agent can communicate with by default.
*
* For tasks using the Fargate launch type, the supported log drivers are awslogs
and
* splunk
.
*
*
* For tasks using the EC2 launch type, the supported log drivers are awslogs
,
* syslog
, gelf
, fluentd
, splunk
,
* journald
, and json-file
.
*
*
* For more information about using the awslogs
log driver, see Using the
* awslogs Log Driver in the Amazon Elastic Container Service Developer Guide .
*
*
*
* If you have a custom driver that is not listed above that you would like to work with the Amazon ECS
* container agent, you can fork the Amazon ECS container agent project that is available on GitHub and customize it to work with
* that driver. We encourage you to submit pull requests for changes that you would like to have
* included. However, Amazon Web Services does not currently support running modified copies of this
* software.
*
*
*
* This parameter requires version 1.18 of the Docker Remote API or greater on your container instance.
* To check the Docker Remote API version on your container instance, log in to your container instance
* and run the following command: sudo docker version --format '{{.Server.APIVersion}}'
* @see LogDriver
* @return Returns a reference to this object so that method calls can be chained together.
* @see LogDriver
*/
Builder logDriver(LogDriver logDriver);
/**
*
* The configuration options to send to the log driver. This parameter requires version 1.19 of the Docker
* Remote API or greater on your container instance. To check the Docker Remote API version on your container
* instance, log in to your container instance and run the following command:
* sudo docker version --format '{{.Server.APIVersion}}'
*
*
* @param options
* The configuration options to send to the log driver. This parameter requires version 1.19 of the
* Docker Remote API or greater on your container instance. To check the Docker Remote API version on
* your container instance, log in to your container instance and run the following command:
* sudo docker version --format '{{.Server.APIVersion}}'
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder options(Map options);
/**
*
* The secrets to pass to the log configuration.
*
*
* @param secretOptions
* The secrets to pass to the log configuration.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder secretOptions(Collection secretOptions);
/**
*
* The secrets to pass to the log configuration.
*
*
* @param secretOptions
* The secrets to pass to the log configuration.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder secretOptions(Secret... secretOptions);
/**
*
* The secrets to pass to the log configuration.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to
* create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its
* result is passed to {@link #secretOptions(List)}.
*
* @param secretOptions
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #secretOptions(List)
*/
Builder secretOptions(Consumer... secretOptions);
}
static final class BuilderImpl implements Builder {
private String logDriver;
private Map options = DefaultSdkAutoConstructMap.getInstance();
private List secretOptions = DefaultSdkAutoConstructList.getInstance();
private BuilderImpl() {
}
private BuilderImpl(LogConfiguration model) {
logDriver(model.logDriver);
options(model.options);
secretOptions(model.secretOptions);
}
public final String getLogDriverAsString() {
return logDriver;
}
@Override
public final Builder logDriver(String logDriver) {
this.logDriver = logDriver;
return this;
}
@Override
public final Builder logDriver(LogDriver logDriver) {
this.logDriver(logDriver == null ? null : logDriver.toString());
return this;
}
public final void setLogDriver(String logDriver) {
this.logDriver = logDriver;
}
public final Map getOptions() {
return options;
}
@Override
public final Builder options(Map options) {
this.options = LogConfigurationOptionsMapCopier.copy(options);
return this;
}
public final void setOptions(Map options) {
this.options = LogConfigurationOptionsMapCopier.copy(options);
}
public final Collection getSecretOptions() {
return secretOptions != null ? secretOptions.stream().map(Secret::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder secretOptions(Collection secretOptions) {
this.secretOptions = SecretListCopier.copy(secretOptions);
return this;
}
@Override
@SafeVarargs
public final Builder secretOptions(Secret... secretOptions) {
secretOptions(Arrays.asList(secretOptions));
return this;
}
@Override
@SafeVarargs
public final Builder secretOptions(Consumer... secretOptions) {
secretOptions(Stream.of(secretOptions).map(c -> Secret.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final void setSecretOptions(Collection secretOptions) {
this.secretOptions = SecretListCopier.copyFromBuilder(secretOptions);
}
@Override
public LogConfiguration build() {
return new LogConfiguration(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}