
software.amazon.awssdk.services.synthetics.model.CanaryTimeline Maven / Gradle / Ivy
/*
* 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.synthetics.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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* This structure contains information about when the canary was created and modified.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CanaryTimeline implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField CREATED_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("Created").getter(getter(CanaryTimeline::created)).setter(setter(Builder::created))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Created").build()).build();
private static final SdkField LAST_MODIFIED_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastModified").getter(getter(CanaryTimeline::lastModified)).setter(setter(Builder::lastModified))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModified").build()).build();
private static final SdkField LAST_STARTED_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastStarted").getter(getter(CanaryTimeline::lastStarted)).setter(setter(Builder::lastStarted))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastStarted").build()).build();
private static final SdkField LAST_STOPPED_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastStopped").getter(getter(CanaryTimeline::lastStopped)).setter(setter(Builder::lastStopped))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastStopped").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CREATED_FIELD,
LAST_MODIFIED_FIELD, LAST_STARTED_FIELD, LAST_STOPPED_FIELD));
private static final long serialVersionUID = 1L;
private final Instant created;
private final Instant lastModified;
private final Instant lastStarted;
private final Instant lastStopped;
private CanaryTimeline(BuilderImpl builder) {
this.created = builder.created;
this.lastModified = builder.lastModified;
this.lastStarted = builder.lastStarted;
this.lastStopped = builder.lastStopped;
}
/**
*
* The date and time the canary was created.
*
*
* @return The date and time the canary was created.
*/
public final Instant created() {
return created;
}
/**
*
* The date and time the canary was most recently modified.
*
*
* @return The date and time the canary was most recently modified.
*/
public final Instant lastModified() {
return lastModified;
}
/**
*
* The date and time that the canary's most recent run started.
*
*
* @return The date and time that the canary's most recent run started.
*/
public final Instant lastStarted() {
return lastStarted;
}
/**
*
* The date and time that the canary's most recent run ended.
*
*
* @return The date and time that the canary's most recent run ended.
*/
public final Instant lastStopped() {
return lastStopped;
}
@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(created());
hashCode = 31 * hashCode + Objects.hashCode(lastModified());
hashCode = 31 * hashCode + Objects.hashCode(lastStarted());
hashCode = 31 * hashCode + Objects.hashCode(lastStopped());
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 CanaryTimeline)) {
return false;
}
CanaryTimeline other = (CanaryTimeline) obj;
return Objects.equals(created(), other.created()) && Objects.equals(lastModified(), other.lastModified())
&& Objects.equals(lastStarted(), other.lastStarted()) && Objects.equals(lastStopped(), other.lastStopped());
}
/**
* 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("CanaryTimeline").add("Created", created()).add("LastModified", lastModified())
.add("LastStarted", lastStarted()).add("LastStopped", lastStopped()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Created":
return Optional.ofNullable(clazz.cast(created()));
case "LastModified":
return Optional.ofNullable(clazz.cast(lastModified()));
case "LastStarted":
return Optional.ofNullable(clazz.cast(lastStarted()));
case "LastStopped":
return Optional.ofNullable(clazz.cast(lastStopped()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy