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

software.amazon.awssdk.services.opsworks.model.Recipes Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS OpsWorks module holds the client classes that are used for communicating with AWS OpsWorks Service

There is a newer version: 2.29.39
Show newest version
/*
 * 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.opsworks.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;

/**
 * 

* AWS OpsWorks Stacks supports five lifecycle events: setup, configuration, deploy, * undeploy, and shutdown. For each layer, AWS OpsWorks Stacks runs a set of standard recipes for each * event. In addition, you can provide custom recipes for any or all layers and events. AWS OpsWorks Stacks runs custom * event recipes after the standard recipes. LayerCustomRecipes specifies the custom recipes for a * particular layer to be run in response to each of the five events. *

*

* To specify a recipe, use the cookbook's directory name in the repository followed by two colons and the recipe name, * which is the recipe's file name without the .rb extension. For example: phpapp2::dbsetup specifies the dbsetup.rb * recipe in the repository's phpapp2 folder. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Recipes implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField> SETUP_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Setup") .getter(getter(Recipes::setup)) .setter(setter(Builder::setup)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Setup").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> CONFIGURE_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Configure") .getter(getter(Recipes::configure)) .setter(setter(Builder::configure)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Configure").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> DEPLOY_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Deploy") .getter(getter(Recipes::deploy)) .setter(setter(Builder::deploy)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Deploy").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> UNDEPLOY_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Undeploy") .getter(getter(Recipes::undeploy)) .setter(setter(Builder::undeploy)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Undeploy").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> SHUTDOWN_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Shutdown") .getter(getter(Recipes::shutdown)) .setter(setter(Builder::shutdown)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Shutdown").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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SETUP_FIELD, CONFIGURE_FIELD, DEPLOY_FIELD, UNDEPLOY_FIELD, SHUTDOWN_FIELD)); private static final long serialVersionUID = 1L; private final List setup; private final List configure; private final List deploy; private final List undeploy; private final List shutdown; private Recipes(BuilderImpl builder) { this.setup = builder.setup; this.configure = builder.configure; this.deploy = builder.deploy; this.undeploy = builder.undeploy; this.shutdown = builder.shutdown; } /** * Returns true if the Setup property was specified by the sender (it may be empty), or false if the sender did not * specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public final boolean hasSetup() { return setup != null && !(setup instanceof SdkAutoConstructList); } /** *

* An array of custom recipe names to be run following a setup event. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasSetup()} to see if a value was sent in this field. *

* * @return An array of custom recipe names to be run following a setup event. */ public final List setup() { return setup; } /** * Returns true if the Configure property was specified by the sender (it may be empty), or false if the sender did * not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public final boolean hasConfigure() { return configure != null && !(configure instanceof SdkAutoConstructList); } /** *

* An array of custom recipe names to be run following a configure event. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasConfigure()} to see if a value was sent in this field. *

* * @return An array of custom recipe names to be run following a configure event. */ public final List configure() { return configure; } /** * Returns true if the Deploy property was specified by the sender (it may be empty), or false if the sender did not * specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public final boolean hasDeploy() { return deploy != null && !(deploy instanceof SdkAutoConstructList); } /** *

* An array of custom recipe names to be run following a deploy event. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasDeploy()} to see if a value was sent in this field. *

* * @return An array of custom recipe names to be run following a deploy event. */ public final List deploy() { return deploy; } /** * Returns true if the Undeploy property was specified by the sender (it may be empty), or false if the sender did * not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public final boolean hasUndeploy() { return undeploy != null && !(undeploy instanceof SdkAutoConstructList); } /** *

* An array of custom recipe names to be run following a undeploy event. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasUndeploy()} to see if a value was sent in this field. *

* * @return An array of custom recipe names to be run following a undeploy event. */ public final List undeploy() { return undeploy; } /** * Returns true if the Shutdown property was specified by the sender (it may be empty), or false if the sender did * not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public final boolean hasShutdown() { return shutdown != null && !(shutdown instanceof SdkAutoConstructList); } /** *

* An array of custom recipe names to be run following a shutdown event. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasShutdown()} to see if a value was sent in this field. *

* * @return An array of custom recipe names to be run following a shutdown event. */ public final List shutdown() { return shutdown; } @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(hasSetup() ? setup() : null); hashCode = 31 * hashCode + Objects.hashCode(hasConfigure() ? configure() : null); hashCode = 31 * hashCode + Objects.hashCode(hasDeploy() ? deploy() : null); hashCode = 31 * hashCode + Objects.hashCode(hasUndeploy() ? undeploy() : null); hashCode = 31 * hashCode + Objects.hashCode(hasShutdown() ? shutdown() : 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 Recipes)) { return false; } Recipes other = (Recipes) obj; return hasSetup() == other.hasSetup() && Objects.equals(setup(), other.setup()) && hasConfigure() == other.hasConfigure() && Objects.equals(configure(), other.configure()) && hasDeploy() == other.hasDeploy() && Objects.equals(deploy(), other.deploy()) && hasUndeploy() == other.hasUndeploy() && Objects.equals(undeploy(), other.undeploy()) && hasShutdown() == other.hasShutdown() && Objects.equals(shutdown(), other.shutdown()); } /** * 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("Recipes").add("Setup", hasSetup() ? setup() : null) .add("Configure", hasConfigure() ? configure() : null).add("Deploy", hasDeploy() ? deploy() : null) .add("Undeploy", hasUndeploy() ? undeploy() : null).add("Shutdown", hasShutdown() ? shutdown() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Setup": return Optional.ofNullable(clazz.cast(setup())); case "Configure": return Optional.ofNullable(clazz.cast(configure())); case "Deploy": return Optional.ofNullable(clazz.cast(deploy())); case "Undeploy": return Optional.ofNullable(clazz.cast(undeploy())); case "Shutdown": return Optional.ofNullable(clazz.cast(shutdown())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Recipes) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* An array of custom recipe names to be run following a setup event. *

* * @param setup * An array of custom recipe names to be run following a setup event. * @return Returns a reference to this object so that method calls can be chained together. */ Builder setup(Collection setup); /** *

* An array of custom recipe names to be run following a setup event. *

* * @param setup * An array of custom recipe names to be run following a setup event. * @return Returns a reference to this object so that method calls can be chained together. */ Builder setup(String... setup); /** *

* An array of custom recipe names to be run following a configure event. *

* * @param configure * An array of custom recipe names to be run following a configure event. * @return Returns a reference to this object so that method calls can be chained together. */ Builder configure(Collection configure); /** *

* An array of custom recipe names to be run following a configure event. *

* * @param configure * An array of custom recipe names to be run following a configure event. * @return Returns a reference to this object so that method calls can be chained together. */ Builder configure(String... configure); /** *

* An array of custom recipe names to be run following a deploy event. *

* * @param deploy * An array of custom recipe names to be run following a deploy event. * @return Returns a reference to this object so that method calls can be chained together. */ Builder deploy(Collection deploy); /** *

* An array of custom recipe names to be run following a deploy event. *

* * @param deploy * An array of custom recipe names to be run following a deploy event. * @return Returns a reference to this object so that method calls can be chained together. */ Builder deploy(String... deploy); /** *

* An array of custom recipe names to be run following a undeploy event. *

* * @param undeploy * An array of custom recipe names to be run following a undeploy event. * @return Returns a reference to this object so that method calls can be chained together. */ Builder undeploy(Collection undeploy); /** *

* An array of custom recipe names to be run following a undeploy event. *

* * @param undeploy * An array of custom recipe names to be run following a undeploy event. * @return Returns a reference to this object so that method calls can be chained together. */ Builder undeploy(String... undeploy); /** *

* An array of custom recipe names to be run following a shutdown event. *

* * @param shutdown * An array of custom recipe names to be run following a shutdown event. * @return Returns a reference to this object so that method calls can be chained together. */ Builder shutdown(Collection shutdown); /** *

* An array of custom recipe names to be run following a shutdown event. *

* * @param shutdown * An array of custom recipe names to be run following a shutdown event. * @return Returns a reference to this object so that method calls can be chained together. */ Builder shutdown(String... shutdown); } static final class BuilderImpl implements Builder { private List setup = DefaultSdkAutoConstructList.getInstance(); private List configure = DefaultSdkAutoConstructList.getInstance(); private List deploy = DefaultSdkAutoConstructList.getInstance(); private List undeploy = DefaultSdkAutoConstructList.getInstance(); private List shutdown = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(Recipes model) { setup(model.setup); configure(model.configure); deploy(model.deploy); undeploy(model.undeploy); shutdown(model.shutdown); } public final Collection getSetup() { if (setup instanceof SdkAutoConstructList) { return null; } return setup; } @Override public final Builder setup(Collection setup) { this.setup = StringsCopier.copy(setup); return this; } @Override @SafeVarargs public final Builder setup(String... setup) { setup(Arrays.asList(setup)); return this; } public final void setSetup(Collection setup) { this.setup = StringsCopier.copy(setup); } public final Collection getConfigure() { if (configure instanceof SdkAutoConstructList) { return null; } return configure; } @Override public final Builder configure(Collection configure) { this.configure = StringsCopier.copy(configure); return this; } @Override @SafeVarargs public final Builder configure(String... configure) { configure(Arrays.asList(configure)); return this; } public final void setConfigure(Collection configure) { this.configure = StringsCopier.copy(configure); } public final Collection getDeploy() { if (deploy instanceof SdkAutoConstructList) { return null; } return deploy; } @Override public final Builder deploy(Collection deploy) { this.deploy = StringsCopier.copy(deploy); return this; } @Override @SafeVarargs public final Builder deploy(String... deploy) { deploy(Arrays.asList(deploy)); return this; } public final void setDeploy(Collection deploy) { this.deploy = StringsCopier.copy(deploy); } public final Collection getUndeploy() { if (undeploy instanceof SdkAutoConstructList) { return null; } return undeploy; } @Override public final Builder undeploy(Collection undeploy) { this.undeploy = StringsCopier.copy(undeploy); return this; } @Override @SafeVarargs public final Builder undeploy(String... undeploy) { undeploy(Arrays.asList(undeploy)); return this; } public final void setUndeploy(Collection undeploy) { this.undeploy = StringsCopier.copy(undeploy); } public final Collection getShutdown() { if (shutdown instanceof SdkAutoConstructList) { return null; } return shutdown; } @Override public final Builder shutdown(Collection shutdown) { this.shutdown = StringsCopier.copy(shutdown); return this; } @Override @SafeVarargs public final Builder shutdown(String... shutdown) { shutdown(Arrays.asList(shutdown)); return this; } public final void setShutdown(Collection shutdown) { this.shutdown = StringsCopier.copy(shutdown); } @Override public Recipes build() { return new Recipes(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy