software.amazon.awssdk.services.controltower.model.ControlOperationSummary Maven / Gradle / Ivy
Show all versions of controltower 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.controltower.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
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.LocationTrait;
import software.amazon.awssdk.core.traits.TimestampFormatTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* A summary of information about the specified control operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ControlOperationSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CONTROL_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("controlIdentifier").getter(getter(ControlOperationSummary::controlIdentifier))
.setter(setter(Builder::controlIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("controlIdentifier").build()).build();
private static final SdkField ENABLED_CONTROL_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("enabledControlIdentifier").getter(getter(ControlOperationSummary::enabledControlIdentifier))
.setter(setter(Builder::enabledControlIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("enabledControlIdentifier").build())
.build();
private static final SdkField END_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("endTime")
.getter(getter(ControlOperationSummary::endTime))
.setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("endTime").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField OPERATION_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("operationIdentifier").getter(getter(ControlOperationSummary::operationIdentifier))
.setter(setter(Builder::operationIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("operationIdentifier").build())
.build();
private static final SdkField OPERATION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("operationType").getter(getter(ControlOperationSummary::operationTypeAsString))
.setter(setter(Builder::operationType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("operationType").build()).build();
private static final SdkField START_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("startTime")
.getter(getter(ControlOperationSummary::startTime))
.setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startTime").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(ControlOperationSummary::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField STATUS_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("statusMessage").getter(getter(ControlOperationSummary::statusMessage))
.setter(setter(Builder::statusMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("statusMessage").build()).build();
private static final SdkField TARGET_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("targetIdentifier").getter(getter(ControlOperationSummary::targetIdentifier))
.setter(setter(Builder::targetIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targetIdentifier").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CONTROL_IDENTIFIER_FIELD,
ENABLED_CONTROL_IDENTIFIER_FIELD, END_TIME_FIELD, OPERATION_IDENTIFIER_FIELD, OPERATION_TYPE_FIELD, START_TIME_FIELD,
STATUS_FIELD, STATUS_MESSAGE_FIELD, TARGET_IDENTIFIER_FIELD));
private static final long serialVersionUID = 1L;
private final String controlIdentifier;
private final String enabledControlIdentifier;
private final Instant endTime;
private final String operationIdentifier;
private final String operationType;
private final Instant startTime;
private final String status;
private final String statusMessage;
private final String targetIdentifier;
private ControlOperationSummary(BuilderImpl builder) {
this.controlIdentifier = builder.controlIdentifier;
this.enabledControlIdentifier = builder.enabledControlIdentifier;
this.endTime = builder.endTime;
this.operationIdentifier = builder.operationIdentifier;
this.operationType = builder.operationType;
this.startTime = builder.startTime;
this.status = builder.status;
this.statusMessage = builder.statusMessage;
this.targetIdentifier = builder.targetIdentifier;
}
/**
*
* The controlIdentifier
of a control.
*
*
* @return The controlIdentifier
of a control.
*/
public final String controlIdentifier() {
return controlIdentifier;
}
/**
*
* The controlIdentifier
of an enabled control.
*
*
* @return The controlIdentifier
of an enabled control.
*/
public final String enabledControlIdentifier() {
return enabledControlIdentifier;
}
/**
*
* The time at which the control operation was completed.
*
*
* @return The time at which the control operation was completed.
*/
public final Instant endTime() {
return endTime;
}
/**
*
* The unique identifier of a control operation.
*
*
* @return The unique identifier of a control operation.
*/
public final String operationIdentifier() {
return operationIdentifier;
}
/**
*
* The type of operation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #operationType}
* will return {@link ControlOperationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #operationTypeAsString}.
*
*
* @return The type of operation.
* @see ControlOperationType
*/
public final ControlOperationType operationType() {
return ControlOperationType.fromValue(operationType);
}
/**
*
* The type of operation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #operationType}
* will return {@link ControlOperationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #operationTypeAsString}.
*
*
* @return The type of operation.
* @see ControlOperationType
*/
public final String operationTypeAsString() {
return operationType;
}
/**
*
* The time at which a control operation began.
*
*
* @return The time at which a control operation began.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The status of the specified control operation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ControlOperationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the specified control operation.
* @see ControlOperationStatus
*/
public final ControlOperationStatus status() {
return ControlOperationStatus.fromValue(status);
}
/**
*
* The status of the specified control operation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ControlOperationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the specified control operation.
* @see ControlOperationStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* A speficic message displayed as part of the control status.
*
*
* @return A speficic message displayed as part of the control status.
*/
public final String statusMessage() {
return statusMessage;
}
/**
*
* The unique identifier of the target of a control operation.
*
*
* @return The unique identifier of the target of a control operation.
*/
public final String targetIdentifier() {
return targetIdentifier;
}
@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(controlIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(enabledControlIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(operationIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(operationTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusMessage());
hashCode = 31 * hashCode + Objects.hashCode(targetIdentifier());
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 ControlOperationSummary)) {
return false;
}
ControlOperationSummary other = (ControlOperationSummary) obj;
return Objects.equals(controlIdentifier(), other.controlIdentifier())
&& Objects.equals(enabledControlIdentifier(), other.enabledControlIdentifier())
&& Objects.equals(endTime(), other.endTime())
&& Objects.equals(operationIdentifier(), other.operationIdentifier())
&& Objects.equals(operationTypeAsString(), other.operationTypeAsString())
&& Objects.equals(startTime(), other.startTime()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(statusMessage(), other.statusMessage())
&& Objects.equals(targetIdentifier(), other.targetIdentifier());
}
/**
* 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("ControlOperationSummary").add("ControlIdentifier", controlIdentifier())
.add("EnabledControlIdentifier", enabledControlIdentifier()).add("EndTime", endTime())
.add("OperationIdentifier", operationIdentifier()).add("OperationType", operationTypeAsString())
.add("StartTime", startTime()).add("Status", statusAsString()).add("StatusMessage", statusMessage())
.add("TargetIdentifier", targetIdentifier()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "controlIdentifier":
return Optional.ofNullable(clazz.cast(controlIdentifier()));
case "enabledControlIdentifier":
return Optional.ofNullable(clazz.cast(enabledControlIdentifier()));
case "endTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "operationIdentifier":
return Optional.ofNullable(clazz.cast(operationIdentifier()));
case "operationType":
return Optional.ofNullable(clazz.cast(operationTypeAsString()));
case "startTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "statusMessage":
return Optional.ofNullable(clazz.cast(statusMessage()));
case "targetIdentifier":
return Optional.ofNullable(clazz.cast(targetIdentifier()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function