software.amazon.awssdk.services.kinesisvideoarchivedmedia.model.ClipFragmentSelector Maven / Gradle / Ivy
Show all versions of kinesisvideoarchivedmedia 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.kinesisvideoarchivedmedia.model;
import java.io.Serializable;
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.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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Describes the timestamp range and timestamp origin of a range of fragments.
*
*
* Fragments that have duplicate producer timestamps are deduplicated. This means that if producers are producing a
* stream of fragments with producer timestamps that are approximately equal to the true clock time, the clip will
* contain all of the fragments within the requested timestamp range. If some fragments are ingested within the same
* time range and very different points in time, only the oldest ingested collection of fragments are returned.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ClipFragmentSelector implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField FRAGMENT_SELECTOR_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FragmentSelectorType").getter(getter(ClipFragmentSelector::fragmentSelectorTypeAsString))
.setter(setter(Builder::fragmentSelectorType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FragmentSelectorType").build())
.build();
private static final SdkField TIMESTAMP_RANGE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("TimestampRange")
.getter(getter(ClipFragmentSelector::timestampRange)).setter(setter(Builder::timestampRange))
.constructor(ClipTimestampRange::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TimestampRange").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FRAGMENT_SELECTOR_TYPE_FIELD,
TIMESTAMP_RANGE_FIELD));
private static final long serialVersionUID = 1L;
private final String fragmentSelectorType;
private final ClipTimestampRange timestampRange;
private ClipFragmentSelector(BuilderImpl builder) {
this.fragmentSelectorType = builder.fragmentSelectorType;
this.timestampRange = builder.timestampRange;
}
/**
*
* The origin of the timestamps to use (Server or Producer).
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #fragmentSelectorType} will return {@link ClipFragmentSelectorType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #fragmentSelectorTypeAsString}.
*
*
* @return The origin of the timestamps to use (Server or Producer).
* @see ClipFragmentSelectorType
*/
public final ClipFragmentSelectorType fragmentSelectorType() {
return ClipFragmentSelectorType.fromValue(fragmentSelectorType);
}
/**
*
* The origin of the timestamps to use (Server or Producer).
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #fragmentSelectorType} will return {@link ClipFragmentSelectorType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #fragmentSelectorTypeAsString}.
*
*
* @return The origin of the timestamps to use (Server or Producer).
* @see ClipFragmentSelectorType
*/
public final String fragmentSelectorTypeAsString() {
return fragmentSelectorType;
}
/**
*
* The range of timestamps to return.
*
*
* @return The range of timestamps to return.
*/
public final ClipTimestampRange timestampRange() {
return timestampRange;
}
@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(fragmentSelectorTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(timestampRange());
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 ClipFragmentSelector)) {
return false;
}
ClipFragmentSelector other = (ClipFragmentSelector) obj;
return Objects.equals(fragmentSelectorTypeAsString(), other.fragmentSelectorTypeAsString())
&& Objects.equals(timestampRange(), other.timestampRange());
}
/**
* 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("ClipFragmentSelector").add("FragmentSelectorType", fragmentSelectorTypeAsString())
.add("TimestampRange", timestampRange()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "FragmentSelectorType":
return Optional.ofNullable(clazz.cast(fragmentSelectorTypeAsString()));
case "TimestampRange":
return Optional.ofNullable(clazz.cast(timestampRange()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function