software.amazon.awssdk.services.ivs.model.ThumbnailConfiguration Maven / Gradle / Ivy
Show all versions of ivs 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.ivs.model;
import java.io.Serializable;
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.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.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;
/**
*
* An object representing a configuration of thumbnails for recorded video.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ThumbnailConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField RECORDING_MODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("recordingMode").getter(getter(ThumbnailConfiguration::recordingModeAsString))
.setter(setter(Builder::recordingMode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("recordingMode").build()).build();
private static final SdkField TARGET_INTERVAL_SECONDS_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("targetIntervalSeconds").getter(getter(ThumbnailConfiguration::targetIntervalSeconds))
.setter(setter(Builder::targetIntervalSeconds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targetIntervalSeconds").build())
.build();
private static final SdkField RESOLUTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("resolution").getter(getter(ThumbnailConfiguration::resolutionAsString))
.setter(setter(Builder::resolution))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resolution").build()).build();
private static final SdkField> STORAGE_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("storage")
.getter(getter(ThumbnailConfiguration::storageAsStrings))
.setter(setter(Builder::storageWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("storage").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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RECORDING_MODE_FIELD,
TARGET_INTERVAL_SECONDS_FIELD, RESOLUTION_FIELD, STORAGE_FIELD));
private static final long serialVersionUID = 1L;
private final String recordingMode;
private final Long targetIntervalSeconds;
private final String resolution;
private final List storage;
private ThumbnailConfiguration(BuilderImpl builder) {
this.recordingMode = builder.recordingMode;
this.targetIntervalSeconds = builder.targetIntervalSeconds;
this.resolution = builder.resolution;
this.storage = builder.storage;
}
/**
*
* Thumbnail recording mode. Default: INTERVAL
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #recordingMode}
* will return {@link RecordingMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #recordingModeAsString}.
*
*
* @return Thumbnail recording mode. Default: INTERVAL
.
* @see RecordingMode
*/
public final RecordingMode recordingMode() {
return RecordingMode.fromValue(recordingMode);
}
/**
*
* Thumbnail recording mode. Default: INTERVAL
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #recordingMode}
* will return {@link RecordingMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #recordingModeAsString}.
*
*
* @return Thumbnail recording mode. Default: INTERVAL
.
* @see RecordingMode
*/
public final String recordingModeAsString() {
return recordingMode;
}
/**
*
* The targeted thumbnail-generation interval in seconds. This is configurable (and required) only if
* recordingMode
is INTERVAL
. Default: 60.
*
*
* Important: For the BASIC
channel type, setting a value for targetIntervalSeconds
* does not guarantee that thumbnails are generated at the specified interval. For thumbnails to be generated at the
* targetIntervalSeconds
interval, the IDR/Keyframe
value for the input video must be less
* than the targetIntervalSeconds
value. See Amazon IVS Streaming
* Configuration for information on setting IDR/Keyframe
to the recommended value in video-encoder
* settings.
*
*
* @return The targeted thumbnail-generation interval in seconds. This is configurable (and required) only if
* recordingMode
is INTERVAL
. Default: 60.
*
* Important: For the BASIC
channel type, setting a value for
* targetIntervalSeconds
does not guarantee that thumbnails are generated at the specified
* interval. For thumbnails to be generated at the targetIntervalSeconds
interval, the
* IDR/Keyframe
value for the input video must be less than the
* targetIntervalSeconds
value. See Amazon IVS Streaming
* Configuration for information on setting IDR/Keyframe
to the recommended value in
* video-encoder settings.
*/
public final Long targetIntervalSeconds() {
return targetIntervalSeconds;
}
/**
*
* Indicates the desired resolution of recorded thumbnails. Thumbnails are recorded at the selected resolution if
* the corresponding rendition is available during the stream; otherwise, they are recorded at source resolution.
* For more information about resolution values and their corresponding height and width dimensions, see Auto-Record to Amazon S3. Default:
* Null (source resolution is returned).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #resolution} will
* return {@link ThumbnailConfigurationResolution#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #resolutionAsString}.
*
*
* @return Indicates the desired resolution of recorded thumbnails. Thumbnails are recorded at the selected
* resolution if the corresponding rendition is available during the stream; otherwise, they are recorded at
* source resolution. For more information about resolution values and their corresponding height and width
* dimensions, see Auto-Record
* to Amazon S3. Default: Null (source resolution is returned).
* @see ThumbnailConfigurationResolution
*/
public final ThumbnailConfigurationResolution resolution() {
return ThumbnailConfigurationResolution.fromValue(resolution);
}
/**
*
* Indicates the desired resolution of recorded thumbnails. Thumbnails are recorded at the selected resolution if
* the corresponding rendition is available during the stream; otherwise, they are recorded at source resolution.
* For more information about resolution values and their corresponding height and width dimensions, see Auto-Record to Amazon S3. Default:
* Null (source resolution is returned).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #resolution} will
* return {@link ThumbnailConfigurationResolution#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #resolutionAsString}.
*
*
* @return Indicates the desired resolution of recorded thumbnails. Thumbnails are recorded at the selected
* resolution if the corresponding rendition is available during the stream; otherwise, they are recorded at
* source resolution. For more information about resolution values and their corresponding height and width
* dimensions, see Auto-Record
* to Amazon S3. Default: Null (source resolution is returned).
* @see ThumbnailConfigurationResolution
*/
public final String resolutionAsString() {
return resolution;
}
/**
*
* Indicates the format in which thumbnails are recorded. SEQUENTIAL
records all generated thumbnails
* in a serial manner, to the media/thumbnails directory. LATEST
saves the latest thumbnail in
* media/latest_thumbnail/thumb.jpg and overwrites it at the interval specified by
* targetIntervalSeconds
. You can enable both SEQUENTIAL
and LATEST
. Default:
* SEQUENTIAL
.
*
*
* 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 #hasStorage} method.
*
*
* @return Indicates the format in which thumbnails are recorded. SEQUENTIAL
records all generated
* thumbnails in a serial manner, to the media/thumbnails directory. LATEST
saves the latest
* thumbnail in media/latest_thumbnail/thumb.jpg and overwrites it at the interval specified by
* targetIntervalSeconds
. You can enable both SEQUENTIAL
and LATEST
.
* Default: SEQUENTIAL
.
*/
public final List storage() {
return ThumbnailConfigurationStorageListCopier.copyStringToEnum(storage);
}
/**
* For responses, this returns true if the service returned a value for the Storage 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 hasStorage() {
return storage != null && !(storage instanceof SdkAutoConstructList);
}
/**
*
* Indicates the format in which thumbnails are recorded. SEQUENTIAL
records all generated thumbnails
* in a serial manner, to the media/thumbnails directory. LATEST
saves the latest thumbnail in
* media/latest_thumbnail/thumb.jpg and overwrites it at the interval specified by
* targetIntervalSeconds
. You can enable both SEQUENTIAL
and LATEST
. Default:
* SEQUENTIAL
.
*
*
* 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 #hasStorage} method.
*
*
* @return Indicates the format in which thumbnails are recorded. SEQUENTIAL
records all generated
* thumbnails in a serial manner, to the media/thumbnails directory. LATEST
saves the latest
* thumbnail in media/latest_thumbnail/thumb.jpg and overwrites it at the interval specified by
* targetIntervalSeconds
. You can enable both SEQUENTIAL
and LATEST
.
* Default: SEQUENTIAL
.
*/
public final List storageAsStrings() {
return storage;
}
@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(recordingModeAsString());
hashCode = 31 * hashCode + Objects.hashCode(targetIntervalSeconds());
hashCode = 31 * hashCode + Objects.hashCode(resolutionAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasStorage() ? storageAsStrings() : 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 ThumbnailConfiguration)) {
return false;
}
ThumbnailConfiguration other = (ThumbnailConfiguration) obj;
return Objects.equals(recordingModeAsString(), other.recordingModeAsString())
&& Objects.equals(targetIntervalSeconds(), other.targetIntervalSeconds())
&& Objects.equals(resolutionAsString(), other.resolutionAsString()) && hasStorage() == other.hasStorage()
&& Objects.equals(storageAsStrings(), other.storageAsStrings());
}
/**
* 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("ThumbnailConfiguration").add("RecordingMode", recordingModeAsString())
.add("TargetIntervalSeconds", targetIntervalSeconds()).add("Resolution", resolutionAsString())
.add("Storage", hasStorage() ? storageAsStrings() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "recordingMode":
return Optional.ofNullable(clazz.cast(recordingModeAsString()));
case "targetIntervalSeconds":
return Optional.ofNullable(clazz.cast(targetIntervalSeconds()));
case "resolution":
return Optional.ofNullable(clazz.cast(resolutionAsString()));
case "storage":
return Optional.ofNullable(clazz.cast(storageAsStrings()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function