
software.amazon.awssdk.services.chimesdkmediapipelines.model.MediaConcatenationPipeline 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.chimesdkmediapipelines.model;
import java.io.Serializable;
import java.time.Instant;
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.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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.traits.TimestampFormatTrait;
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;
/**
*
* Concatenates audio and video data from one or more data streams.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class MediaConcatenationPipeline implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField MEDIA_PIPELINE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MediaPipelineId").getter(getter(MediaConcatenationPipeline::mediaPipelineId))
.setter(setter(Builder::mediaPipelineId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MediaPipelineId").build()).build();
private static final SdkField MEDIA_PIPELINE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MediaPipelineArn").getter(getter(MediaConcatenationPipeline::mediaPipelineArn))
.setter(setter(Builder::mediaPipelineArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MediaPipelineArn").build()).build();
private static final SdkField> SOURCES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Sources")
.getter(getter(MediaConcatenationPipeline::sources))
.setter(setter(Builder::sources))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Sources").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ConcatenationSource::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> SINKS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Sinks")
.getter(getter(MediaConcatenationPipeline::sinks))
.setter(setter(Builder::sinks))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Sinks").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ConcatenationSink::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(MediaConcatenationPipeline::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField CREATED_TIMESTAMP_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("CreatedTimestamp")
.getter(getter(MediaConcatenationPipeline::createdTimestamp))
.setter(setter(Builder::createdTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTimestamp").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField UPDATED_TIMESTAMP_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("UpdatedTimestamp")
.getter(getter(MediaConcatenationPipeline::updatedTimestamp))
.setter(setter(Builder::updatedTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdatedTimestamp").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final List> SDK_FIELDS = Collections
.unmodifiableList(Arrays.asList(MEDIA_PIPELINE_ID_FIELD, MEDIA_PIPELINE_ARN_FIELD, SOURCES_FIELD, SINKS_FIELD,
STATUS_FIELD, CREATED_TIMESTAMP_FIELD, UPDATED_TIMESTAMP_FIELD));
private static final long serialVersionUID = 1L;
private final String mediaPipelineId;
private final String mediaPipelineArn;
private final List sources;
private final List sinks;
private final String status;
private final Instant createdTimestamp;
private final Instant updatedTimestamp;
private MediaConcatenationPipeline(BuilderImpl builder) {
this.mediaPipelineId = builder.mediaPipelineId;
this.mediaPipelineArn = builder.mediaPipelineArn;
this.sources = builder.sources;
this.sinks = builder.sinks;
this.status = builder.status;
this.createdTimestamp = builder.createdTimestamp;
this.updatedTimestamp = builder.updatedTimestamp;
}
/**
*
* The ID of the media pipeline being concatenated.
*
*
* @return The ID of the media pipeline being concatenated.
*/
public final String mediaPipelineId() {
return mediaPipelineId;
}
/**
*
* The ARN of the media pipeline that you specify in the SourceConfiguration
object.
*
*
* @return The ARN of the media pipeline that you specify in the SourceConfiguration
object.
*/
public final String mediaPipelineArn() {
return mediaPipelineArn;
}
/**
* For responses, this returns true if the service returned a value for the Sources 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 hasSources() {
return sources != null && !(sources instanceof SdkAutoConstructList);
}
/**
*
* The data sources being concatenated.
*
*
* 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 #hasSources} method.
*
*
* @return The data sources being concatenated.
*/
public final List sources() {
return sources;
}
/**
* For responses, this returns true if the service returned a value for the Sinks 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 hasSinks() {
return sinks != null && !(sinks instanceof SdkAutoConstructList);
}
/**
*
* The data sinks of the concatenation pipeline.
*
*
* 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 #hasSinks} method.
*
*
* @return The data sinks of the concatenation pipeline.
*/
public final List sinks() {
return sinks;
}
/**
*
* The status of the concatenation pipeline.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link MediaPipelineStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the concatenation pipeline.
* @see MediaPipelineStatus
*/
public final MediaPipelineStatus status() {
return MediaPipelineStatus.fromValue(status);
}
/**
*
* The status of the concatenation pipeline.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link MediaPipelineStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the concatenation pipeline.
* @see MediaPipelineStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The time at which the concatenation pipeline was created.
*
*
* @return The time at which the concatenation pipeline was created.
*/
public final Instant createdTimestamp() {
return createdTimestamp;
}
/**
*
* The time at which the concatenation pipeline was last updated.
*
*
* @return The time at which the concatenation pipeline was last updated.
*/
public final Instant updatedTimestamp() {
return updatedTimestamp;
}
@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(mediaPipelineId());
hashCode = 31 * hashCode + Objects.hashCode(mediaPipelineArn());
hashCode = 31 * hashCode + Objects.hashCode(hasSources() ? sources() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasSinks() ? sinks() : null);
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(createdTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(updatedTimestamp());
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 MediaConcatenationPipeline)) {
return false;
}
MediaConcatenationPipeline other = (MediaConcatenationPipeline) obj;
return Objects.equals(mediaPipelineId(), other.mediaPipelineId())
&& Objects.equals(mediaPipelineArn(), other.mediaPipelineArn()) && hasSources() == other.hasSources()
&& Objects.equals(sources(), other.sources()) && hasSinks() == other.hasSinks()
&& Objects.equals(sinks(), other.sinks()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(createdTimestamp(), other.createdTimestamp())
&& Objects.equals(updatedTimestamp(), other.updatedTimestamp());
}
/**
* 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("MediaConcatenationPipeline").add("MediaPipelineId", mediaPipelineId())
.add("MediaPipelineArn", mediaPipelineArn()).add("Sources", hasSources() ? sources() : null)
.add("Sinks", hasSinks() ? sinks() : null).add("Status", statusAsString())
.add("CreatedTimestamp", createdTimestamp()).add("UpdatedTimestamp", updatedTimestamp()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "MediaPipelineId":
return Optional.ofNullable(clazz.cast(mediaPipelineId()));
case "MediaPipelineArn":
return Optional.ofNullable(clazz.cast(mediaPipelineArn()));
case "Sources":
return Optional.ofNullable(clazz.cast(sources()));
case "Sinks":
return Optional.ofNullable(clazz.cast(sinks()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "CreatedTimestamp":
return Optional.ofNullable(clazz.cast(createdTimestamp()));
case "UpdatedTimestamp":
return Optional.ofNullable(clazz.cast(updatedTimestamp()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function