software.amazon.awssdk.services.iot.model.AuditMitigationActionsTaskMetadata Maven / Gradle / Ivy
Show all versions of iot 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.iot.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Information about an audit mitigation actions task that is returned by ListAuditMitigationActionsTasks
.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AuditMitigationActionsTaskMetadata implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField TASK_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("taskId")
.getter(getter(AuditMitigationActionsTaskMetadata::taskId)).setter(setter(Builder::taskId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskId").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("startTime").getter(getter(AuditMitigationActionsTaskMetadata::startTime))
.setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startTime").build()).build();
private static final SdkField TASK_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("taskStatus").getter(getter(AuditMitigationActionsTaskMetadata::taskStatusAsString))
.setter(setter(Builder::taskStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskStatus").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TASK_ID_FIELD,
START_TIME_FIELD, TASK_STATUS_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final String taskId;
private final Instant startTime;
private final String taskStatus;
private AuditMitigationActionsTaskMetadata(BuilderImpl builder) {
this.taskId = builder.taskId;
this.startTime = builder.startTime;
this.taskStatus = builder.taskStatus;
}
/**
*
* The unique identifier for the task.
*
*
* @return The unique identifier for the task.
*/
public final String taskId() {
return taskId;
}
/**
*
* The time at which the audit mitigation actions task was started.
*
*
* @return The time at which the audit mitigation actions task was started.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The current state of the audit mitigation actions task.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #taskStatus} will
* return {@link AuditMitigationActionsTaskStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #taskStatusAsString}.
*
*
* @return The current state of the audit mitigation actions task.
* @see AuditMitigationActionsTaskStatus
*/
public final AuditMitigationActionsTaskStatus taskStatus() {
return AuditMitigationActionsTaskStatus.fromValue(taskStatus);
}
/**
*
* The current state of the audit mitigation actions task.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #taskStatus} will
* return {@link AuditMitigationActionsTaskStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #taskStatusAsString}.
*
*
* @return The current state of the audit mitigation actions task.
* @see AuditMitigationActionsTaskStatus
*/
public final String taskStatusAsString() {
return taskStatus;
}
@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(taskId());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(taskStatusAsString());
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 AuditMitigationActionsTaskMetadata)) {
return false;
}
AuditMitigationActionsTaskMetadata other = (AuditMitigationActionsTaskMetadata) obj;
return Objects.equals(taskId(), other.taskId()) && Objects.equals(startTime(), other.startTime())
&& Objects.equals(taskStatusAsString(), other.taskStatusAsString());
}
/**
* 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("AuditMitigationActionsTaskMetadata").add("TaskId", taskId()).add("StartTime", startTime())
.add("TaskStatus", taskStatusAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "taskId":
return Optional.ofNullable(clazz.cast(taskId()));
case "startTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "taskStatus":
return Optional.ofNullable(clazz.cast(taskStatusAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("taskId", TASK_ID_FIELD);
map.put("startTime", START_TIME_FIELD);
map.put("taskStatus", TASK_STATUS_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function