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.opsworks.model.DeploymentCommand 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
/*
* 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.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.ListTrait;
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;
/**
*
* Used to specify a stack or deployment command.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DeploymentCommand implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(DeploymentCommand::nameAsString)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField>> ARGS_FIELD = SdkField
.>> builder(MarshallingType.MAP)
.memberName("Args")
.getter(getter(DeploymentCommand::args))
.setter(setter(Builder::args))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Args").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField.> builder(MarshallingType.LIST)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder()
.location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build())
.build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, ARGS_FIELD));
private static final long serialVersionUID = 1L;
private final String name;
private final Map> args;
private DeploymentCommand(BuilderImpl builder) {
this.name = builder.name;
this.args = builder.args;
}
/**
*
* Specifies the operation. You can specify only one command.
*
*
* For stacks, the following commands are available:
*
*
*
*
* execute_recipes
: Execute one or more recipes. To specify the recipes, set an Args
* parameter named recipes
to the list of recipes to be executed. For example, to execute
* phpapp::appsetup
, set Args
to {"recipes":["phpapp::appsetup"]}
.
*
*
*
*
* install_dependencies
: Install the stack's dependencies.
*
*
*
*
* update_custom_cookbooks
: Update the stack's custom cookbooks.
*
*
*
*
* update_dependencies
: Update the stack's dependencies.
*
*
*
*
*
* The update_dependencies and install_dependencies commands are supported only for Linux instances. You can run the
* commands successfully on Windows instances, but they do nothing.
*
*
*
* For apps, the following commands are available:
*
*
*
*
* deploy
: Deploy an app. Ruby on Rails apps have an optional Args
parameter named
* migrate
. Set Args
to {"migrate":["true"]} to migrate the database. The default setting
* is {"migrate":["false"]}.
*
*
*
*
* rollback
Roll the app back to the previous version. When you update an app, AWS OpsWorks Stacks
* stores the previous version, up to a maximum of five versions. You can use this command to roll an app back as
* many as four versions.
*
*
*
*
* start
: Start the app's web or application server.
*
*
*
*
* stop
: Stop the app's web or application server.
*
*
*
*
* restart
: Restart the app's web or application server.
*
*
*
*
* undeploy
: Undeploy the app.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #name} will return
* {@link DeploymentCommandName#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #nameAsString}.
*
*
* @return Specifies the operation. You can specify only one command.
*
* For stacks, the following commands are available:
*
*
*
*
* execute_recipes
: Execute one or more recipes. To specify the recipes, set an
* Args
parameter named recipes
to the list of recipes to be executed. For
* example, to execute phpapp::appsetup
, set Args
to
* {"recipes":["phpapp::appsetup"]}
.
*
*
*
*
* install_dependencies
: Install the stack's dependencies.
*
*
*
*
* update_custom_cookbooks
: Update the stack's custom cookbooks.
*
*
*
*
* update_dependencies
: Update the stack's dependencies.
*
*
*
*
*
* The update_dependencies and install_dependencies commands are supported only for Linux instances. You can
* run the commands successfully on Windows instances, but they do nothing.
*
*
*
* For apps, the following commands are available:
*
*
*
*
* deploy
: Deploy an app. Ruby on Rails apps have an optional Args
parameter named
* migrate
. Set Args
to {"migrate":["true"]} to migrate the database. The default
* setting is {"migrate":["false"]}.
*
*
*
*
* rollback
Roll the app back to the previous version. When you update an app, AWS OpsWorks
* Stacks stores the previous version, up to a maximum of five versions. You can use this command to roll an
* app back as many as four versions.
*
*
*
*
* start
: Start the app's web or application server.
*
*
*
*
* stop
: Stop the app's web or application server.
*
*
*
*
* restart
: Restart the app's web or application server.
*
*
*
*
* undeploy
: Undeploy the app.
*
*
* @see DeploymentCommandName
*/
public final DeploymentCommandName name() {
return DeploymentCommandName.fromValue(name);
}
/**
*
* Specifies the operation. You can specify only one command.
*
*
* For stacks, the following commands are available:
*
*
*
*
* execute_recipes
: Execute one or more recipes. To specify the recipes, set an Args
* parameter named recipes
to the list of recipes to be executed. For example, to execute
* phpapp::appsetup
, set Args
to {"recipes":["phpapp::appsetup"]}
.
*
*
*
*
* install_dependencies
: Install the stack's dependencies.
*
*
*
*
* update_custom_cookbooks
: Update the stack's custom cookbooks.
*
*
*
*
* update_dependencies
: Update the stack's dependencies.
*
*
*
*
*
* The update_dependencies and install_dependencies commands are supported only for Linux instances. You can run the
* commands successfully on Windows instances, but they do nothing.
*
*
*
* For apps, the following commands are available:
*
*
*
*
* deploy
: Deploy an app. Ruby on Rails apps have an optional Args
parameter named
* migrate
. Set Args
to {"migrate":["true"]} to migrate the database. The default setting
* is {"migrate":["false"]}.
*
*
*
*
* rollback
Roll the app back to the previous version. When you update an app, AWS OpsWorks Stacks
* stores the previous version, up to a maximum of five versions. You can use this command to roll an app back as
* many as four versions.
*
*
*
*
* start
: Start the app's web or application server.
*
*
*
*
* stop
: Stop the app's web or application server.
*
*
*
*
* restart
: Restart the app's web or application server.
*
*
*
*
* undeploy
: Undeploy the app.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #name} will return
* {@link DeploymentCommandName#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #nameAsString}.
*
*
* @return Specifies the operation. You can specify only one command.
*
* For stacks, the following commands are available:
*
*
*
*
* execute_recipes
: Execute one or more recipes. To specify the recipes, set an
* Args
parameter named recipes
to the list of recipes to be executed. For
* example, to execute phpapp::appsetup
, set Args
to
* {"recipes":["phpapp::appsetup"]}
.
*
*
*
*
* install_dependencies
: Install the stack's dependencies.
*
*
*
*
* update_custom_cookbooks
: Update the stack's custom cookbooks.
*
*
*
*
* update_dependencies
: Update the stack's dependencies.
*
*
*
*
*
* The update_dependencies and install_dependencies commands are supported only for Linux instances. You can
* run the commands successfully on Windows instances, but they do nothing.
*
*
*
* For apps, the following commands are available:
*
*
*
*
* deploy
: Deploy an app. Ruby on Rails apps have an optional Args
parameter named
* migrate
. Set Args
to {"migrate":["true"]} to migrate the database. The default
* setting is {"migrate":["false"]}.
*
*
*
*
* rollback
Roll the app back to the previous version. When you update an app, AWS OpsWorks
* Stacks stores the previous version, up to a maximum of five versions. You can use this command to roll an
* app back as many as four versions.
*
*
*
*
* start
: Start the app's web or application server.
*
*
*
*
* stop
: Stop the app's web or application server.
*
*
*
*
* restart
: Restart the app's web or application server.
*
*
*
*
* undeploy
: Undeploy the app.
*
*
* @see DeploymentCommandName
*/
public final String nameAsString() {
return name;
}
/**
* For responses, this returns true if the service returned a value for the Args 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 hasArgs() {
return args != null && !(args instanceof SdkAutoConstructMap);
}
/**
*
* The arguments of those commands that take arguments. It should be set to a JSON object with the following format:
*
*
* {"arg_name1" : ["value1", "value2", ...], "arg_name2" : ["value1", "value2", ...], ...}
*
*
* The update_dependencies
command takes two arguments:
*
*
*
*
* upgrade_os_to
- Specifies the desired Amazon Linux version for instances whose OS you want to
* upgrade, such as Amazon Linux 2016.09
. You must also set the allow_reboot
argument to
* true.
*
*
*
*
* allow_reboot
- Specifies whether to allow AWS OpsWorks Stacks to reboot the instances if necessary,
* after installing the updates. This argument can be set to either true
or false
. The
* default value is false
.
*
*
*
*
* For example, to upgrade an instance to Amazon Linux 2016.09, set Args
to the following.
*
*
* { "upgrade_os_to":["Amazon Linux 2016.09"], "allow_reboot":["true"] }
*
*
* 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 #hasArgs} method.
*
*
* @return The arguments of those commands that take arguments. It should be set to a JSON object with the following
* format:
*
* {"arg_name1" : ["value1", "value2", ...], "arg_name2" : ["value1", "value2", ...], ...}
*
*
* The update_dependencies
command takes two arguments:
*
*
*
*
* upgrade_os_to
- Specifies the desired Amazon Linux version for instances whose OS you want
* to upgrade, such as Amazon Linux 2016.09
. You must also set the allow_reboot
* argument to true.
*
*
*
*
* allow_reboot
- Specifies whether to allow AWS OpsWorks Stacks to reboot the instances if
* necessary, after installing the updates. This argument can be set to either true
or
* false
. The default value is false
.
*
*
*
*
* For example, to upgrade an instance to Amazon Linux 2016.09, set Args
to the following.
*
*
* { "upgrade_os_to":["Amazon Linux 2016.09"], "allow_reboot":["true"] }
*/
public final Map> args() {
return args;
}
@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(nameAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasArgs() ? args() : 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 DeploymentCommand)) {
return false;
}
DeploymentCommand other = (DeploymentCommand) obj;
return Objects.equals(nameAsString(), other.nameAsString()) && hasArgs() == other.hasArgs()
&& Objects.equals(args(), other.args());
}
/**
* 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("DeploymentCommand").add("Name", nameAsString()).add("Args", hasArgs() ? args() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Name":
return Optional.ofNullable(clazz.cast(nameAsString()));
case "Args":
return Optional.ofNullable(clazz.cast(args()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((DeploymentCommand) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* Specifies the operation. You can specify only one command.
*
*
* For stacks, the following commands are available:
*
*
*
*
* execute_recipes
: Execute one or more recipes. To specify the recipes, set an Args
* parameter named recipes
to the list of recipes to be executed. For example, to execute
* phpapp::appsetup
, set Args
to {"recipes":["phpapp::appsetup"]}
.
*
*
*
*
* install_dependencies
: Install the stack's dependencies.
*
*
*
*
* update_custom_cookbooks
: Update the stack's custom cookbooks.
*
*
*
*
* update_dependencies
: Update the stack's dependencies.
*
*
*
*
*
* The update_dependencies and install_dependencies commands are supported only for Linux instances. You can run
* the commands successfully on Windows instances, but they do nothing.
*
*
*
* For apps, the following commands are available:
*
*
*
*
* deploy
: Deploy an app. Ruby on Rails apps have an optional Args
parameter named
* migrate
. Set Args
to {"migrate":["true"]} to migrate the database. The default
* setting is {"migrate":["false"]}.
*
*
*
*
* rollback
Roll the app back to the previous version. When you update an app, AWS OpsWorks Stacks
* stores the previous version, up to a maximum of five versions. You can use this command to roll an app back
* as many as four versions.
*
*
*
*
* start
: Start the app's web or application server.
*
*
*
*
* stop
: Stop the app's web or application server.
*
*
*
*
* restart
: Restart the app's web or application server.
*
*
*
*
* undeploy
: Undeploy the app.
*
*
*
*
* @param name
* Specifies the operation. You can specify only one command.
*
* For stacks, the following commands are available:
*
*
*
*
* execute_recipes
: Execute one or more recipes. To specify the recipes, set an
* Args
parameter named recipes
to the list of recipes to be executed. For
* example, to execute phpapp::appsetup
, set Args
to
* {"recipes":["phpapp::appsetup"]}
.
*
*
*
*
* install_dependencies
: Install the stack's dependencies.
*
*
*
*
* update_custom_cookbooks
: Update the stack's custom cookbooks.
*
*
*
*
* update_dependencies
: Update the stack's dependencies.
*
*
*
*
*
* The update_dependencies and install_dependencies commands are supported only for Linux instances. You
* can run the commands successfully on Windows instances, but they do nothing.
*
*
*
* For apps, the following commands are available:
*
*
*
*
* deploy
: Deploy an app. Ruby on Rails apps have an optional Args
parameter
* named migrate
. Set Args
to {"migrate":["true"]} to migrate the database. The
* default setting is {"migrate":["false"]}.
*
*
*
*
* rollback
Roll the app back to the previous version. When you update an app, AWS OpsWorks
* Stacks stores the previous version, up to a maximum of five versions. You can use this command to roll
* an app back as many as four versions.
*
*
*
*
* start
: Start the app's web or application server.
*
*
*
*
* stop
: Stop the app's web or application server.
*
*
*
*
* restart
: Restart the app's web or application server.
*
*
*
*
* undeploy
: Undeploy the app.
*
*
* @see DeploymentCommandName
* @return Returns a reference to this object so that method calls can be chained together.
* @see DeploymentCommandName
*/
Builder name(String name);
/**
*
* Specifies the operation. You can specify only one command.
*
*
* For stacks, the following commands are available:
*
*
*
*
* execute_recipes
: Execute one or more recipes. To specify the recipes, set an Args
* parameter named recipes
to the list of recipes to be executed. For example, to execute
* phpapp::appsetup
, set Args
to {"recipes":["phpapp::appsetup"]}
.
*
*
*
*
* install_dependencies
: Install the stack's dependencies.
*
*
*
*
* update_custom_cookbooks
: Update the stack's custom cookbooks.
*
*
*
*
* update_dependencies
: Update the stack's dependencies.
*
*
*
*
*
* The update_dependencies and install_dependencies commands are supported only for Linux instances. You can run
* the commands successfully on Windows instances, but they do nothing.
*
*
*
* For apps, the following commands are available:
*
*
*
*
* deploy
: Deploy an app. Ruby on Rails apps have an optional Args
parameter named
* migrate
. Set Args
to {"migrate":["true"]} to migrate the database. The default
* setting is {"migrate":["false"]}.
*
*
*
*
* rollback
Roll the app back to the previous version. When you update an app, AWS OpsWorks Stacks
* stores the previous version, up to a maximum of five versions. You can use this command to roll an app back
* as many as four versions.
*
*
*
*
* start
: Start the app's web or application server.
*
*
*
*
* stop
: Stop the app's web or application server.
*
*
*
*
* restart
: Restart the app's web or application server.
*
*
*
*
* undeploy
: Undeploy the app.
*
*
*
*
* @param name
* Specifies the operation. You can specify only one command.
*
* For stacks, the following commands are available:
*
*
*
*
* execute_recipes
: Execute one or more recipes. To specify the recipes, set an
* Args
parameter named recipes
to the list of recipes to be executed. For
* example, to execute phpapp::appsetup
, set Args
to
* {"recipes":["phpapp::appsetup"]}
.
*
*
*
*
* install_dependencies
: Install the stack's dependencies.
*
*
*
*
* update_custom_cookbooks
: Update the stack's custom cookbooks.
*
*
*
*
* update_dependencies
: Update the stack's dependencies.
*
*
*
*
*
* The update_dependencies and install_dependencies commands are supported only for Linux instances. You
* can run the commands successfully on Windows instances, but they do nothing.
*
*
*
* For apps, the following commands are available:
*
*
*
*
* deploy
: Deploy an app. Ruby on Rails apps have an optional Args
parameter
* named migrate
. Set Args
to {"migrate":["true"]} to migrate the database. The
* default setting is {"migrate":["false"]}.
*
*
*
*
* rollback
Roll the app back to the previous version. When you update an app, AWS OpsWorks
* Stacks stores the previous version, up to a maximum of five versions. You can use this command to roll
* an app back as many as four versions.
*
*
*
*
* start
: Start the app's web or application server.
*
*
*
*
* stop
: Stop the app's web or application server.
*
*
*
*
* restart
: Restart the app's web or application server.
*
*
*
*
* undeploy
: Undeploy the app.
*
*
* @see DeploymentCommandName
* @return Returns a reference to this object so that method calls can be chained together.
* @see DeploymentCommandName
*/
Builder name(DeploymentCommandName name);
/**
*
* The arguments of those commands that take arguments. It should be set to a JSON object with the following
* format:
*
*
* {"arg_name1" : ["value1", "value2", ...], "arg_name2" : ["value1", "value2", ...], ...}
*
*
* The update_dependencies
command takes two arguments:
*
*
*
*
* upgrade_os_to
- Specifies the desired Amazon Linux version for instances whose OS you want to
* upgrade, such as Amazon Linux 2016.09
. You must also set the allow_reboot
argument
* to true.
*
*
*
*
* allow_reboot
- Specifies whether to allow AWS OpsWorks Stacks to reboot the instances if
* necessary, after installing the updates. This argument can be set to either true
or
* false
. The default value is false
.
*
*
*
*
* For example, to upgrade an instance to Amazon Linux 2016.09, set Args
to the following.
*
*
* { "upgrade_os_to":["Amazon Linux 2016.09"], "allow_reboot":["true"] }
*
*
* @param args
* The arguments of those commands that take arguments. It should be set to a JSON object with the
* following format:
*
* {"arg_name1" : ["value1", "value2", ...], "arg_name2" : ["value1", "value2", ...], ...}
*
*
* The update_dependencies
command takes two arguments:
*
*
*
*
* upgrade_os_to
- Specifies the desired Amazon Linux version for instances whose OS you
* want to upgrade, such as Amazon Linux 2016.09
. You must also set the
* allow_reboot
argument to true.
*
*
*
*
* allow_reboot
- Specifies whether to allow AWS OpsWorks Stacks to reboot the instances if
* necessary, after installing the updates. This argument can be set to either true
or
* false
. The default value is false
.
*
*
*
*
* For example, to upgrade an instance to Amazon Linux 2016.09, set Args
to the following.
*
*
* { "upgrade_os_to":["Amazon Linux 2016.09"], "allow_reboot":["true"] }
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder args(Map> args);
}
static final class BuilderImpl implements Builder {
private String name;
private Map> args = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(DeploymentCommand model) {
name(model.name);
args(model.args);
}
public final String getName() {
return name;
}
public final void setName(String name) {
this.name = name;
}
@Override
public final Builder name(String name) {
this.name = name;
return this;
}
@Override
public final Builder name(DeploymentCommandName name) {
this.name(name == null ? null : name.toString());
return this;
}
public final Map> getArgs() {
if (args instanceof SdkAutoConstructMap) {
return null;
}
return args;
}
public final void setArgs(Map> args) {
this.args = DeploymentCommandArgsCopier.copy(args);
}
@Override
public final Builder args(Map> args) {
this.args = DeploymentCommandArgsCopier.copy(args);
return this;
}
@Override
public DeploymentCommand build() {
return new DeploymentCommand(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}