software.amazon.awssdk.services.applicationdiscovery.model.BatchDeleteConfigurationTask Maven / Gradle / Ivy
Show all versions of applicationdiscovery Show documentation
/*
* 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.applicationdiscovery.model;
import java.io.Serializable;
import java.time.Instant;
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.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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;
/**
*
* A metadata object that represents the deletion task being executed.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class BatchDeleteConfigurationTask implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField TASK_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("taskId")
.getter(getter(BatchDeleteConfigurationTask::taskId)).setter(setter(Builder::taskId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskId").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(BatchDeleteConfigurationTask::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("startTime").getter(getter(BatchDeleteConfigurationTask::startTime)).setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startTime").build()).build();
private static final SdkField END_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("endTime").getter(getter(BatchDeleteConfigurationTask::endTime)).setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("endTime").build()).build();
private static final SdkField CONFIGURATION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("configurationType").getter(getter(BatchDeleteConfigurationTask::configurationTypeAsString))
.setter(setter(Builder::configurationType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("configurationType").build()).build();
private static final SdkField> REQUESTED_CONFIGURATIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("requestedConfigurations")
.getter(getter(BatchDeleteConfigurationTask::requestedConfigurations))
.setter(setter(Builder::requestedConfigurations))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("requestedConfigurations").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> DELETED_CONFIGURATIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("deletedConfigurations")
.getter(getter(BatchDeleteConfigurationTask::deletedConfigurations))
.setter(setter(Builder::deletedConfigurations))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deletedConfigurations").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> FAILED_CONFIGURATIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("failedConfigurations")
.getter(getter(BatchDeleteConfigurationTask::failedConfigurations))
.setter(setter(Builder::failedConfigurations))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("failedConfigurations").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(FailedConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> DELETION_WARNINGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("deletionWarnings")
.getter(getter(BatchDeleteConfigurationTask::deletionWarnings))
.setter(setter(Builder::deletionWarnings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deletionWarnings").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(DeletionWarning::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TASK_ID_FIELD, STATUS_FIELD,
START_TIME_FIELD, END_TIME_FIELD, CONFIGURATION_TYPE_FIELD, REQUESTED_CONFIGURATIONS_FIELD,
DELETED_CONFIGURATIONS_FIELD, FAILED_CONFIGURATIONS_FIELD, DELETION_WARNINGS_FIELD));
private static final long serialVersionUID = 1L;
private final String taskId;
private final String status;
private final Instant startTime;
private final Instant endTime;
private final String configurationType;
private final List requestedConfigurations;
private final List deletedConfigurations;
private final List failedConfigurations;
private final List deletionWarnings;
private BatchDeleteConfigurationTask(BuilderImpl builder) {
this.taskId = builder.taskId;
this.status = builder.status;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
this.configurationType = builder.configurationType;
this.requestedConfigurations = builder.requestedConfigurations;
this.deletedConfigurations = builder.deletedConfigurations;
this.failedConfigurations = builder.failedConfigurations;
this.deletionWarnings = builder.deletionWarnings;
}
/**
*
* The deletion task's unique identifier.
*
*
* @return The deletion task's unique identifier.
*/
public final String taskId() {
return taskId;
}
/**
*
* The current execution status of the deletion task. Valid status are: INITIALIZING | VALIDATING | DELETING |
* COMPLETED | FAILED.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link BatchDeleteConfigurationTaskStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service
* is available from {@link #statusAsString}.
*
*
* @return The current execution status of the deletion task. Valid status are: INITIALIZING | VALIDATING | DELETING
* | COMPLETED | FAILED.
* @see BatchDeleteConfigurationTaskStatus
*/
public final BatchDeleteConfigurationTaskStatus status() {
return BatchDeleteConfigurationTaskStatus.fromValue(status);
}
/**
*
* The current execution status of the deletion task. Valid status are: INITIALIZING | VALIDATING | DELETING |
* COMPLETED | FAILED.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link BatchDeleteConfigurationTaskStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service
* is available from {@link #statusAsString}.
*
*
* @return The current execution status of the deletion task. Valid status are: INITIALIZING | VALIDATING | DELETING
* | COMPLETED | FAILED.
* @see BatchDeleteConfigurationTaskStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* An epoch seconds timestamp (UTC) of when the deletion task was started.
*
*
* @return An epoch seconds timestamp (UTC) of when the deletion task was started.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* An epoch seconds timestamp (UTC) of when the deletion task was completed or failed.
*
*
* @return An epoch seconds timestamp (UTC) of when the deletion task was completed or failed.
*/
public final Instant endTime() {
return endTime;
}
/**
*
* The type of configuration item to delete. Supported types are: SERVER.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #configurationType}
* will return {@link DeletionConfigurationItemType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service
* is available from {@link #configurationTypeAsString}.
*
*
* @return The type of configuration item to delete. Supported types are: SERVER.
* @see DeletionConfigurationItemType
*/
public final DeletionConfigurationItemType configurationType() {
return DeletionConfigurationItemType.fromValue(configurationType);
}
/**
*
* The type of configuration item to delete. Supported types are: SERVER.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #configurationType}
* will return {@link DeletionConfigurationItemType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service
* is available from {@link #configurationTypeAsString}.
*
*
* @return The type of configuration item to delete. Supported types are: SERVER.
* @see DeletionConfigurationItemType
*/
public final String configurationTypeAsString() {
return configurationType;
}
/**
* For responses, this returns true if the service returned a value for the RequestedConfigurations 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 hasRequestedConfigurations() {
return requestedConfigurations != null && !(requestedConfigurations instanceof SdkAutoConstructList);
}
/**
*
* The list of configuration IDs that were originally requested to be deleted by the deletion task.
*
*
* 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 #hasRequestedConfigurations} method.
*
*
* @return The list of configuration IDs that were originally requested to be deleted by the deletion task.
*/
public final List requestedConfigurations() {
return requestedConfigurations;
}
/**
* For responses, this returns true if the service returned a value for the DeletedConfigurations 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 hasDeletedConfigurations() {
return deletedConfigurations != null && !(deletedConfigurations instanceof SdkAutoConstructList);
}
/**
*
* The list of configuration IDs that were successfully deleted by the deletion task.
*
*
* 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 #hasDeletedConfigurations} method.
*
*
* @return The list of configuration IDs that were successfully deleted by the deletion task.
*/
public final List deletedConfigurations() {
return deletedConfigurations;
}
/**
* For responses, this returns true if the service returned a value for the FailedConfigurations 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 hasFailedConfigurations() {
return failedConfigurations != null && !(failedConfigurations instanceof SdkAutoConstructList);
}
/**
*
* A list of configuration IDs that failed to delete during the deletion task, each paired with an error message.
*
*
* 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 #hasFailedConfigurations} method.
*
*
* @return A list of configuration IDs that failed to delete during the deletion task, each paired with an error
* message.
*/
public final List failedConfigurations() {
return failedConfigurations;
}
/**
* For responses, this returns true if the service returned a value for the DeletionWarnings 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 hasDeletionWarnings() {
return deletionWarnings != null && !(deletionWarnings instanceof SdkAutoConstructList);
}
/**
*
* A list of configuration IDs that produced warnings regarding their deletion, paired with a warning message.
*
*
* 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 #hasDeletionWarnings} method.
*
*
* @return A list of configuration IDs that produced warnings regarding their deletion, paired with a warning
* message.
*/
public final List deletionWarnings() {
return deletionWarnings;
}
@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(taskId());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(configurationTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasRequestedConfigurations() ? requestedConfigurations() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasDeletedConfigurations() ? deletedConfigurations() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasFailedConfigurations() ? failedConfigurations() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasDeletionWarnings() ? deletionWarnings() : 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 BatchDeleteConfigurationTask)) {
return false;
}
BatchDeleteConfigurationTask other = (BatchDeleteConfigurationTask) obj;
return Objects.equals(taskId(), other.taskId()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(startTime(), other.startTime()) && Objects.equals(endTime(), other.endTime())
&& Objects.equals(configurationTypeAsString(), other.configurationTypeAsString())
&& hasRequestedConfigurations() == other.hasRequestedConfigurations()
&& Objects.equals(requestedConfigurations(), other.requestedConfigurations())
&& hasDeletedConfigurations() == other.hasDeletedConfigurations()
&& Objects.equals(deletedConfigurations(), other.deletedConfigurations())
&& hasFailedConfigurations() == other.hasFailedConfigurations()
&& Objects.equals(failedConfigurations(), other.failedConfigurations())
&& hasDeletionWarnings() == other.hasDeletionWarnings()
&& Objects.equals(deletionWarnings(), other.deletionWarnings());
}
/**
* 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("BatchDeleteConfigurationTask").add("TaskId", taskId()).add("Status", statusAsString())
.add("StartTime", startTime()).add("EndTime", endTime()).add("ConfigurationType", configurationTypeAsString())
.add("RequestedConfigurations", hasRequestedConfigurations() ? requestedConfigurations() : null)
.add("DeletedConfigurations", hasDeletedConfigurations() ? deletedConfigurations() : null)
.add("FailedConfigurations", hasFailedConfigurations() ? failedConfigurations() : null)
.add("DeletionWarnings", hasDeletionWarnings() ? deletionWarnings() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "taskId":
return Optional.ofNullable(clazz.cast(taskId()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "startTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "endTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "configurationType":
return Optional.ofNullable(clazz.cast(configurationTypeAsString()));
case "requestedConfigurations":
return Optional.ofNullable(clazz.cast(requestedConfigurations()));
case "deletedConfigurations":
return Optional.ofNullable(clazz.cast(deletedConfigurations()));
case "failedConfigurations":
return Optional.ofNullable(clazz.cast(failedConfigurations()));
case "deletionWarnings":
return Optional.ofNullable(clazz.cast(deletionWarnings()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function