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

software.amazon.awssdk.services.lambda.model.ImageConfig Maven / Gradle / Ivy

/*
 * 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.lambda.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Configuration values that override the container image Dockerfile settings. For more information, see Container image settings. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ImageConfig implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField> ENTRY_POINT_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("EntryPoint") .getter(getter(ImageConfig::entryPoint)) .setter(setter(Builder::entryPoint)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EntryPoint").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> COMMAND_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Command") .getter(getter(ImageConfig::command)) .setter(setter(Builder::command)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Command").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField WORKING_DIRECTORY_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("WorkingDirectory").getter(getter(ImageConfig::workingDirectory)) .setter(setter(Builder::workingDirectory)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WorkingDirectory").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ENTRY_POINT_FIELD, COMMAND_FIELD, WORKING_DIRECTORY_FIELD)); private static final long serialVersionUID = 1L; private final List entryPoint; private final List command; private final String workingDirectory; private ImageConfig(BuilderImpl builder) { this.entryPoint = builder.entryPoint; this.command = builder.command; this.workingDirectory = builder.workingDirectory; } /** * For responses, this returns true if the service returned a value for the EntryPoint 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 hasEntryPoint() { return entryPoint != null && !(entryPoint instanceof SdkAutoConstructList); } /** *

* Specifies the entry point to their application, which is typically the location of the runtime executable. *

*

* 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 #hasEntryPoint} method. *

* * @return Specifies the entry point to their application, which is typically the location of the runtime * executable. */ public final List entryPoint() { return entryPoint; } /** * For responses, this returns true if the service returned a value for the Command 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 hasCommand() { return command != null && !(command instanceof SdkAutoConstructList); } /** *

* Specifies parameters that you want to pass in with ENTRYPOINT. *

*

* 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 #hasCommand} method. *

* * @return Specifies parameters that you want to pass in with ENTRYPOINT. */ public final List command() { return command; } /** *

* Specifies the working directory. *

* * @return Specifies the working directory. */ public final String workingDirectory() { return workingDirectory; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(hasEntryPoint() ? entryPoint() : null); hashCode = 31 * hashCode + Objects.hashCode(hasCommand() ? command() : null); hashCode = 31 * hashCode + Objects.hashCode(workingDirectory()); 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 ImageConfig)) { return false; } ImageConfig other = (ImageConfig) obj; return hasEntryPoint() == other.hasEntryPoint() && Objects.equals(entryPoint(), other.entryPoint()) && hasCommand() == other.hasCommand() && Objects.equals(command(), other.command()) && Objects.equals(workingDirectory(), other.workingDirectory()); } /** * 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("ImageConfig").add("EntryPoint", hasEntryPoint() ? entryPoint() : null) .add("Command", hasCommand() ? command() : null).add("WorkingDirectory", workingDirectory()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "EntryPoint": return Optional.ofNullable(clazz.cast(entryPoint())); case "Command": return Optional.ofNullable(clazz.cast(command())); case "WorkingDirectory": return Optional.ofNullable(clazz.cast(workingDirectory())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ImageConfig) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Specifies the entry point to their application, which is typically the location of the runtime executable. *

* * @param entryPoint * Specifies the entry point to their application, which is typically the location of the runtime * executable. * @return Returns a reference to this object so that method calls can be chained together. */ Builder entryPoint(Collection entryPoint); /** *

* Specifies the entry point to their application, which is typically the location of the runtime executable. *

* * @param entryPoint * Specifies the entry point to their application, which is typically the location of the runtime * executable. * @return Returns a reference to this object so that method calls can be chained together. */ Builder entryPoint(String... entryPoint); /** *

* Specifies parameters that you want to pass in with ENTRYPOINT. *

* * @param command * Specifies parameters that you want to pass in with ENTRYPOINT. * @return Returns a reference to this object so that method calls can be chained together. */ Builder command(Collection command); /** *

* Specifies parameters that you want to pass in with ENTRYPOINT. *

* * @param command * Specifies parameters that you want to pass in with ENTRYPOINT. * @return Returns a reference to this object so that method calls can be chained together. */ Builder command(String... command); /** *

* Specifies the working directory. *

* * @param workingDirectory * Specifies the working directory. * @return Returns a reference to this object so that method calls can be chained together. */ Builder workingDirectory(String workingDirectory); } static final class BuilderImpl implements Builder { private List entryPoint = DefaultSdkAutoConstructList.getInstance(); private List command = DefaultSdkAutoConstructList.getInstance(); private String workingDirectory; private BuilderImpl() { } private BuilderImpl(ImageConfig model) { entryPoint(model.entryPoint); command(model.command); workingDirectory(model.workingDirectory); } public final Collection getEntryPoint() { if (entryPoint instanceof SdkAutoConstructList) { return null; } return entryPoint; } public final void setEntryPoint(Collection entryPoint) { this.entryPoint = StringListCopier.copy(entryPoint); } @Override public final Builder entryPoint(Collection entryPoint) { this.entryPoint = StringListCopier.copy(entryPoint); return this; } @Override @SafeVarargs public final Builder entryPoint(String... entryPoint) { entryPoint(Arrays.asList(entryPoint)); return this; } public final Collection getCommand() { if (command instanceof SdkAutoConstructList) { return null; } return command; } public final void setCommand(Collection command) { this.command = StringListCopier.copy(command); } @Override public final Builder command(Collection command) { this.command = StringListCopier.copy(command); return this; } @Override @SafeVarargs public final Builder command(String... command) { command(Arrays.asList(command)); return this; } public final String getWorkingDirectory() { return workingDirectory; } public final void setWorkingDirectory(String workingDirectory) { this.workingDirectory = workingDirectory; } @Override public final Builder workingDirectory(String workingDirectory) { this.workingDirectory = workingDirectory; return this; } @Override public ImageConfig build() { return new ImageConfig(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy