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.ssm.model.MaintenanceWindowRunCommandParameters Maven / Gradle / Ivy
/*
* Copyright 2014-2019 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.ssm.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.Consumer;
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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The parameters for a RUN_COMMAND task type.
*
*
* For information about specifying and updating task parameters, see RegisterTaskWithMaintenanceWindow and
* UpdateMaintenanceWindowTask .
*
*
*
* LoggingInfo
has been deprecated. To specify an S3 bucket to contain logs, instead use the
* OutputS3BucketName
and OutputS3KeyPrefix
options in the
* TaskInvocationParameters
structure. For information about how Systems Manager handles these options for
* the supported maintenance window task types, see MaintenanceWindowTaskInvocationParameters .
*
*
* TaskParameters
has been deprecated. To specify parameters to pass to a task when it runs, instead use
* the Parameters
option in the TaskInvocationParameters
structure. For information about how
* Systems Manager handles these options for the supported maintenance window task types, see
* MaintenanceWindowTaskInvocationParameters .
*
*
* For Run Command tasks, Systems Manager uses specified values for TaskParameters
and
* LoggingInfo
only if no values are specified for TaskInvocationParameters
.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class MaintenanceWindowRunCommandParameters implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField COMMENT_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MaintenanceWindowRunCommandParameters::comment)).setter(setter(Builder::comment))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Comment").build()).build();
private static final SdkField DOCUMENT_HASH_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MaintenanceWindowRunCommandParameters::documentHash)).setter(setter(Builder::documentHash))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DocumentHash").build()).build();
private static final SdkField DOCUMENT_HASH_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MaintenanceWindowRunCommandParameters::documentHashTypeAsString))
.setter(setter(Builder::documentHashType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DocumentHashType").build()).build();
private static final SdkField NOTIFICATION_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.getter(getter(MaintenanceWindowRunCommandParameters::notificationConfig))
.setter(setter(Builder::notificationConfig)).constructor(NotificationConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NotificationConfig").build())
.build();
private static final SdkField OUTPUT_S3_BUCKET_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MaintenanceWindowRunCommandParameters::outputS3BucketName))
.setter(setter(Builder::outputS3BucketName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutputS3BucketName").build())
.build();
private static final SdkField OUTPUT_S3_KEY_PREFIX_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MaintenanceWindowRunCommandParameters::outputS3KeyPrefix)).setter(setter(Builder::outputS3KeyPrefix))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutputS3KeyPrefix").build()).build();
private static final SdkField>> PARAMETERS_FIELD = SdkField
.>> builder(MarshallingType.MAP)
.getter(getter(MaintenanceWindowRunCommandParameters::parameters))
.setter(setter(Builder::parameters))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Parameters").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 SdkField SERVICE_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(MaintenanceWindowRunCommandParameters::serviceRoleArn)).setter(setter(Builder::serviceRoleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServiceRoleArn").build()).build();
private static final SdkField TIMEOUT_SECONDS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(MaintenanceWindowRunCommandParameters::timeoutSeconds)).setter(setter(Builder::timeoutSeconds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TimeoutSeconds").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(COMMENT_FIELD,
DOCUMENT_HASH_FIELD, DOCUMENT_HASH_TYPE_FIELD, NOTIFICATION_CONFIG_FIELD, OUTPUT_S3_BUCKET_NAME_FIELD,
OUTPUT_S3_KEY_PREFIX_FIELD, PARAMETERS_FIELD, SERVICE_ROLE_ARN_FIELD, TIMEOUT_SECONDS_FIELD));
private static final long serialVersionUID = 1L;
private final String comment;
private final String documentHash;
private final String documentHashType;
private final NotificationConfig notificationConfig;
private final String outputS3BucketName;
private final String outputS3KeyPrefix;
private final Map> parameters;
private final String serviceRoleArn;
private final Integer timeoutSeconds;
private MaintenanceWindowRunCommandParameters(BuilderImpl builder) {
this.comment = builder.comment;
this.documentHash = builder.documentHash;
this.documentHashType = builder.documentHashType;
this.notificationConfig = builder.notificationConfig;
this.outputS3BucketName = builder.outputS3BucketName;
this.outputS3KeyPrefix = builder.outputS3KeyPrefix;
this.parameters = builder.parameters;
this.serviceRoleArn = builder.serviceRoleArn;
this.timeoutSeconds = builder.timeoutSeconds;
}
/**
*
* Information about the commands to run.
*
*
* @return Information about the commands to run.
*/
public String comment() {
return comment;
}
/**
*
* The SHA-256 or SHA-1 hash created by the system when the document was created. SHA-1 hashes have been deprecated.
*
*
* @return The SHA-256 or SHA-1 hash created by the system when the document was created. SHA-1 hashes have been
* deprecated.
*/
public String documentHash() {
return documentHash;
}
/**
*
* SHA-256 or SHA-1. SHA-1 hashes have been deprecated.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #documentHashType}
* will return {@link DocumentHashType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #documentHashTypeAsString}.
*
*
* @return SHA-256 or SHA-1. SHA-1 hashes have been deprecated.
* @see DocumentHashType
*/
public DocumentHashType documentHashType() {
return DocumentHashType.fromValue(documentHashType);
}
/**
*
* SHA-256 or SHA-1. SHA-1 hashes have been deprecated.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #documentHashType}
* will return {@link DocumentHashType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #documentHashTypeAsString}.
*
*
* @return SHA-256 or SHA-1. SHA-1 hashes have been deprecated.
* @see DocumentHashType
*/
public String documentHashTypeAsString() {
return documentHashType;
}
/**
*
* Configurations for sending notifications about command status changes on a per-instance basis.
*
*
* @return Configurations for sending notifications about command status changes on a per-instance basis.
*/
public NotificationConfig notificationConfig() {
return notificationConfig;
}
/**
*
* The name of the Amazon S3 bucket.
*
*
* @return The name of the Amazon S3 bucket.
*/
public String outputS3BucketName() {
return outputS3BucketName;
}
/**
*
* The Amazon S3 bucket subfolder.
*
*
* @return The Amazon S3 bucket subfolder.
*/
public String outputS3KeyPrefix() {
return outputS3KeyPrefix;
}
/**
*
* The parameters for the RUN_COMMAND task execution.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The parameters for the RUN_COMMAND task execution.
*/
public Map> parameters() {
return parameters;
}
/**
*
* The ARN of the IAM service role to use to publish Amazon Simple Notification Service (Amazon SNS) notifications
* for maintenance window Run Command tasks.
*
*
* @return The ARN of the IAM service role to use to publish Amazon Simple Notification Service (Amazon SNS)
* notifications for maintenance window Run Command tasks.
*/
public String serviceRoleArn() {
return serviceRoleArn;
}
/**
*
* If this time is reached and the command has not already started running, it doesn't run.
*
*
* @return If this time is reached and the command has not already started running, it doesn't run.
*/
public Integer timeoutSeconds() {
return timeoutSeconds;
}
@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(comment());
hashCode = 31 * hashCode + Objects.hashCode(documentHash());
hashCode = 31 * hashCode + Objects.hashCode(documentHashTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(notificationConfig());
hashCode = 31 * hashCode + Objects.hashCode(outputS3BucketName());
hashCode = 31 * hashCode + Objects.hashCode(outputS3KeyPrefix());
hashCode = 31 * hashCode + Objects.hashCode(parameters());
hashCode = 31 * hashCode + Objects.hashCode(serviceRoleArn());
hashCode = 31 * hashCode + Objects.hashCode(timeoutSeconds());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof MaintenanceWindowRunCommandParameters)) {
return false;
}
MaintenanceWindowRunCommandParameters other = (MaintenanceWindowRunCommandParameters) obj;
return Objects.equals(comment(), other.comment()) && Objects.equals(documentHash(), other.documentHash())
&& Objects.equals(documentHashTypeAsString(), other.documentHashTypeAsString())
&& Objects.equals(notificationConfig(), other.notificationConfig())
&& Objects.equals(outputS3BucketName(), other.outputS3BucketName())
&& Objects.equals(outputS3KeyPrefix(), other.outputS3KeyPrefix())
&& Objects.equals(parameters(), other.parameters()) && Objects.equals(serviceRoleArn(), other.serviceRoleArn())
&& Objects.equals(timeoutSeconds(), other.timeoutSeconds());
}
/**
* 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("MaintenanceWindowRunCommandParameters").add("Comment", comment())
.add("DocumentHash", documentHash()).add("DocumentHashType", documentHashTypeAsString())
.add("NotificationConfig", notificationConfig()).add("OutputS3BucketName", outputS3BucketName())
.add("OutputS3KeyPrefix", outputS3KeyPrefix()).add("Parameters", parameters())
.add("ServiceRoleArn", serviceRoleArn()).add("TimeoutSeconds", timeoutSeconds()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Comment":
return Optional.ofNullable(clazz.cast(comment()));
case "DocumentHash":
return Optional.ofNullable(clazz.cast(documentHash()));
case "DocumentHashType":
return Optional.ofNullable(clazz.cast(documentHashTypeAsString()));
case "NotificationConfig":
return Optional.ofNullable(clazz.cast(notificationConfig()));
case "OutputS3BucketName":
return Optional.ofNullable(clazz.cast(outputS3BucketName()));
case "OutputS3KeyPrefix":
return Optional.ofNullable(clazz.cast(outputS3KeyPrefix()));
case "Parameters":
return Optional.ofNullable(clazz.cast(parameters()));
case "ServiceRoleArn":
return Optional.ofNullable(clazz.cast(serviceRoleArn()));
case "TimeoutSeconds":
return Optional.ofNullable(clazz.cast(timeoutSeconds()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((MaintenanceWindowRunCommandParameters) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* Information about the commands to run.
*
*
* @param comment
* Information about the commands to run.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder comment(String comment);
/**
*
* The SHA-256 or SHA-1 hash created by the system when the document was created. SHA-1 hashes have been
* deprecated.
*
*
* @param documentHash
* The SHA-256 or SHA-1 hash created by the system when the document was created. SHA-1 hashes have been
* deprecated.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder documentHash(String documentHash);
/**
*
* SHA-256 or SHA-1. SHA-1 hashes have been deprecated.
*
*
* @param documentHashType
* SHA-256 or SHA-1. SHA-1 hashes have been deprecated.
* @see DocumentHashType
* @return Returns a reference to this object so that method calls can be chained together.
* @see DocumentHashType
*/
Builder documentHashType(String documentHashType);
/**
*
* SHA-256 or SHA-1. SHA-1 hashes have been deprecated.
*
*
* @param documentHashType
* SHA-256 or SHA-1. SHA-1 hashes have been deprecated.
* @see DocumentHashType
* @return Returns a reference to this object so that method calls can be chained together.
* @see DocumentHashType
*/
Builder documentHashType(DocumentHashType documentHashType);
/**
*
* Configurations for sending notifications about command status changes on a per-instance basis.
*
*
* @param notificationConfig
* Configurations for sending notifications about command status changes on a per-instance basis.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder notificationConfig(NotificationConfig notificationConfig);
/**
*
* Configurations for sending notifications about command status changes on a per-instance basis.
*
* This is a convenience that creates an instance of the {@link NotificationConfig.Builder} avoiding the need to
* create one manually via {@link NotificationConfig#builder()}.
*
* When the {@link Consumer} completes, {@link NotificationConfig.Builder#build()} is called immediately and its
* result is passed to {@link #notificationConfig(NotificationConfig)}.
*
* @param notificationConfig
* a consumer that will call methods on {@link NotificationConfig.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #notificationConfig(NotificationConfig)
*/
default Builder notificationConfig(Consumer notificationConfig) {
return notificationConfig(NotificationConfig.builder().applyMutation(notificationConfig).build());
}
/**
*
* The name of the Amazon S3 bucket.
*
*
* @param outputS3BucketName
* The name of the Amazon S3 bucket.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder outputS3BucketName(String outputS3BucketName);
/**
*
* The Amazon S3 bucket subfolder.
*
*
* @param outputS3KeyPrefix
* The Amazon S3 bucket subfolder.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder outputS3KeyPrefix(String outputS3KeyPrefix);
/**
*
* The parameters for the RUN_COMMAND task execution.
*
*
* @param parameters
* The parameters for the RUN_COMMAND task execution.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder parameters(Map> parameters);
/**
*
* The ARN of the IAM service role to use to publish Amazon Simple Notification Service (Amazon SNS)
* notifications for maintenance window Run Command tasks.
*
*
* @param serviceRoleArn
* The ARN of the IAM service role to use to publish Amazon Simple Notification Service (Amazon SNS)
* notifications for maintenance window Run Command tasks.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder serviceRoleArn(String serviceRoleArn);
/**
*
* If this time is reached and the command has not already started running, it doesn't run.
*
*
* @param timeoutSeconds
* If this time is reached and the command has not already started running, it doesn't run.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder timeoutSeconds(Integer timeoutSeconds);
}
static final class BuilderImpl implements Builder {
private String comment;
private String documentHash;
private String documentHashType;
private NotificationConfig notificationConfig;
private String outputS3BucketName;
private String outputS3KeyPrefix;
private Map> parameters = DefaultSdkAutoConstructMap.getInstance();
private String serviceRoleArn;
private Integer timeoutSeconds;
private BuilderImpl() {
}
private BuilderImpl(MaintenanceWindowRunCommandParameters model) {
comment(model.comment);
documentHash(model.documentHash);
documentHashType(model.documentHashType);
notificationConfig(model.notificationConfig);
outputS3BucketName(model.outputS3BucketName);
outputS3KeyPrefix(model.outputS3KeyPrefix);
parameters(model.parameters);
serviceRoleArn(model.serviceRoleArn);
timeoutSeconds(model.timeoutSeconds);
}
public final String getComment() {
return comment;
}
@Override
public final Builder comment(String comment) {
this.comment = comment;
return this;
}
public final void setComment(String comment) {
this.comment = comment;
}
public final String getDocumentHash() {
return documentHash;
}
@Override
public final Builder documentHash(String documentHash) {
this.documentHash = documentHash;
return this;
}
public final void setDocumentHash(String documentHash) {
this.documentHash = documentHash;
}
public final String getDocumentHashTypeAsString() {
return documentHashType;
}
@Override
public final Builder documentHashType(String documentHashType) {
this.documentHashType = documentHashType;
return this;
}
@Override
public final Builder documentHashType(DocumentHashType documentHashType) {
this.documentHashType(documentHashType.toString());
return this;
}
public final void setDocumentHashType(String documentHashType) {
this.documentHashType = documentHashType;
}
public final NotificationConfig.Builder getNotificationConfig() {
return notificationConfig != null ? notificationConfig.toBuilder() : null;
}
@Override
public final Builder notificationConfig(NotificationConfig notificationConfig) {
this.notificationConfig = notificationConfig;
return this;
}
public final void setNotificationConfig(NotificationConfig.BuilderImpl notificationConfig) {
this.notificationConfig = notificationConfig != null ? notificationConfig.build() : null;
}
public final String getOutputS3BucketName() {
return outputS3BucketName;
}
@Override
public final Builder outputS3BucketName(String outputS3BucketName) {
this.outputS3BucketName = outputS3BucketName;
return this;
}
public final void setOutputS3BucketName(String outputS3BucketName) {
this.outputS3BucketName = outputS3BucketName;
}
public final String getOutputS3KeyPrefix() {
return outputS3KeyPrefix;
}
@Override
public final Builder outputS3KeyPrefix(String outputS3KeyPrefix) {
this.outputS3KeyPrefix = outputS3KeyPrefix;
return this;
}
public final void setOutputS3KeyPrefix(String outputS3KeyPrefix) {
this.outputS3KeyPrefix = outputS3KeyPrefix;
}
public final Map> getParameters() {
return parameters;
}
@Override
public final Builder parameters(Map> parameters) {
this.parameters = ParametersCopier.copy(parameters);
return this;
}
public final void setParameters(Map> parameters) {
this.parameters = ParametersCopier.copy(parameters);
}
public final String getServiceRoleArn() {
return serviceRoleArn;
}
@Override
public final Builder serviceRoleArn(String serviceRoleArn) {
this.serviceRoleArn = serviceRoleArn;
return this;
}
public final void setServiceRoleArn(String serviceRoleArn) {
this.serviceRoleArn = serviceRoleArn;
}
public final Integer getTimeoutSeconds() {
return timeoutSeconds;
}
@Override
public final Builder timeoutSeconds(Integer timeoutSeconds) {
this.timeoutSeconds = timeoutSeconds;
return this;
}
public final void setTimeoutSeconds(Integer timeoutSeconds) {
this.timeoutSeconds = timeoutSeconds;
}
@Override
public MaintenanceWindowRunCommandParameters build() {
return new MaintenanceWindowRunCommandParameters(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}