Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.mediatailor.model.Channel 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.mediatailor.model;
import java.beans.Transient;
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.Map;
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.MapTrait;
import software.amazon.awssdk.core.traits.TimestampFormatTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The configuration parameters for a channel.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Channel implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
.getter(getter(Channel::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();
private static final SdkField CHANNEL_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ChannelName").getter(getter(Channel::channelName)).setter(setter(Builder::channelName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ChannelName").build()).build();
private static final SdkField CHANNEL_STATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ChannelState").getter(getter(Channel::channelState)).setter(setter(Builder::channelState))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ChannelState").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("CreationTime")
.getter(getter(Channel::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.UNIX_TIMESTAMP)).build();
private static final SdkField FILLER_SLATE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("FillerSlate").getter(getter(Channel::fillerSlate)).setter(setter(Builder::fillerSlate))
.constructor(SlateSource::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FillerSlate").build()).build();
private static final SdkField LAST_MODIFIED_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("LastModifiedTime")
.getter(getter(Channel::lastModifiedTime))
.setter(setter(Builder::lastModifiedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedTime").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.UNIX_TIMESTAMP)).build();
private static final SdkField> OUTPUTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Outputs")
.getter(getter(Channel::outputs))
.setter(setter(Builder::outputs))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Outputs").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ResponseOutputItem::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField PLAYBACK_MODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PlaybackMode").getter(getter(Channel::playbackMode)).setter(setter(Builder::playbackMode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PlaybackMode").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("Tags")
.getter(getter(Channel::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, CHANNEL_NAME_FIELD,
CHANNEL_STATE_FIELD, CREATION_TIME_FIELD, FILLER_SLATE_FIELD, LAST_MODIFIED_TIME_FIELD, OUTPUTS_FIELD,
PLAYBACK_MODE_FIELD, TAGS_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final String channelName;
private final String channelState;
private final Instant creationTime;
private final SlateSource fillerSlate;
private final Instant lastModifiedTime;
private final List outputs;
private final String playbackMode;
private final Map tags;
private Channel(BuilderImpl builder) {
this.arn = builder.arn;
this.channelName = builder.channelName;
this.channelState = builder.channelState;
this.creationTime = builder.creationTime;
this.fillerSlate = builder.fillerSlate;
this.lastModifiedTime = builder.lastModifiedTime;
this.outputs = builder.outputs;
this.playbackMode = builder.playbackMode;
this.tags = builder.tags;
}
/**
*
* The ARN of the channel.
*
*
* @return The ARN of the channel.
*/
public final String arn() {
return arn;
}
/**
*
* The name of the channel.
*
*
* @return The name of the channel.
*/
public final String channelName() {
return channelName;
}
/**
*
* Returns the state whether the channel is running or not.
*
*
* @return Returns the state whether the channel is running or not.
*/
public final String channelState() {
return channelState;
}
/**
*
* The timestamp of when the channel was created.
*
*
* @return The timestamp of when the channel was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The slate used to fill gaps between programs in the schedule. You must configure filler slate if your channel
* uses the LINEAR PlaybackMode. MediaTailor doesn't support filler slate for channels using the LOOP PlaybackMode.
*
*
* @return The slate used to fill gaps between programs in the schedule. You must configure filler slate if your
* channel uses the LINEAR PlaybackMode. MediaTailor doesn't support filler slate for channels using the
* LOOP PlaybackMode.
*/
public final SlateSource fillerSlate() {
return fillerSlate;
}
/**
*
* The timestamp of when the channel was last modified.
*
*
* @return The timestamp of when the channel was last modified.
*/
public final Instant lastModifiedTime() {
return lastModifiedTime;
}
/**
* For responses, this returns true if the service returned a value for the Outputs 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 hasOutputs() {
return outputs != null && !(outputs instanceof SdkAutoConstructList);
}
/**
*
* The channel's output properties.
*
*
* 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 #hasOutputs} method.
*
*
* @return The channel's output properties.
*/
public final List outputs() {
return outputs;
}
/**
*
* The type of playback mode for this channel.
*
*
* LINEAR - Programs play back-to-back only once.
*
*
* LOOP - Programs play back-to-back in an endless loop. When the last program in the schedule plays, playback loops
* back to the first program in the schedule.
*
*
* @return The type of playback mode for this channel.
*
* LINEAR - Programs play back-to-back only once.
*
*
* LOOP - Programs play back-to-back in an endless loop. When the last program in the schedule plays,
* playback loops back to the first program in the schedule.
*/
public final String playbackMode() {
return playbackMode;
}
/**
* For responses, this returns true if the service returned a value for the Tags 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 hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructMap);
}
/**
*
* The tags to assign to the channel.
*
*
* 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 #hasTags} method.
*
*
* @return The tags to assign to the channel.
*/
public final Map tags() {
return tags;
}
@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(arn());
hashCode = 31 * hashCode + Objects.hashCode(channelName());
hashCode = 31 * hashCode + Objects.hashCode(channelState());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(fillerSlate());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedTime());
hashCode = 31 * hashCode + Objects.hashCode(hasOutputs() ? outputs() : null);
hashCode = 31 * hashCode + Objects.hashCode(playbackMode());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : 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 Channel)) {
return false;
}
Channel other = (Channel) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(channelName(), other.channelName())
&& Objects.equals(channelState(), other.channelState()) && Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(fillerSlate(), other.fillerSlate())
&& Objects.equals(lastModifiedTime(), other.lastModifiedTime()) && hasOutputs() == other.hasOutputs()
&& Objects.equals(outputs(), other.outputs()) && Objects.equals(playbackMode(), other.playbackMode())
&& hasTags() == other.hasTags() && Objects.equals(tags(), other.tags());
}
/**
* 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("Channel").add("Arn", arn()).add("ChannelName", channelName())
.add("ChannelState", channelState()).add("CreationTime", creationTime()).add("FillerSlate", fillerSlate())
.add("LastModifiedTime", lastModifiedTime()).add("Outputs", hasOutputs() ? outputs() : null)
.add("PlaybackMode", playbackMode()).add("Tags", hasTags() ? tags() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "ChannelName":
return Optional.ofNullable(clazz.cast(channelName()));
case "ChannelState":
return Optional.ofNullable(clazz.cast(channelState()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "FillerSlate":
return Optional.ofNullable(clazz.cast(fillerSlate()));
case "LastModifiedTime":
return Optional.ofNullable(clazz.cast(lastModifiedTime()));
case "Outputs":
return Optional.ofNullable(clazz.cast(outputs()));
case "PlaybackMode":
return Optional.ofNullable(clazz.cast(playbackMode()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((Channel) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The ARN of the channel.
*
*
* @param arn
* The ARN of the channel.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder arn(String arn);
/**
*
* The name of the channel.
*
*
* @param channelName
* The name of the channel.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder channelName(String channelName);
/**
*
* Returns the state whether the channel is running or not.
*
*
* @param channelState
* Returns the state whether the channel is running or not.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder channelState(String channelState);
/**
*
* The timestamp of when the channel was created.
*
*
* @param creationTime
* The timestamp of when the channel was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder creationTime(Instant creationTime);
/**
*
* The slate used to fill gaps between programs in the schedule. You must configure filler slate if your channel
* uses the LINEAR PlaybackMode. MediaTailor doesn't support filler slate for channels using the LOOP
* PlaybackMode.
*
*
* @param fillerSlate
* The slate used to fill gaps between programs in the schedule. You must configure filler slate if your
* channel uses the LINEAR PlaybackMode. MediaTailor doesn't support filler slate for channels using the
* LOOP PlaybackMode.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder fillerSlate(SlateSource fillerSlate);
/**
*
* The slate used to fill gaps between programs in the schedule. You must configure filler slate if your channel
* uses the LINEAR PlaybackMode. MediaTailor doesn't support filler slate for channels using the LOOP
* PlaybackMode.
*
* This is a convenience that creates an instance of the {@link SlateSource.Builder} avoiding the need to create
* one manually via {@link SlateSource#builder()}.
*
* When the {@link Consumer} completes, {@link SlateSource.Builder#build()} is called immediately and its result
* is passed to {@link #fillerSlate(SlateSource)}.
*
* @param fillerSlate
* a consumer that will call methods on {@link SlateSource.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #fillerSlate(SlateSource)
*/
default Builder fillerSlate(Consumer fillerSlate) {
return fillerSlate(SlateSource.builder().applyMutation(fillerSlate).build());
}
/**
*
* The timestamp of when the channel was last modified.
*
*
* @param lastModifiedTime
* The timestamp of when the channel was last modified.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder lastModifiedTime(Instant lastModifiedTime);
/**
*
* The channel's output properties.
*
*
* @param outputs
* The channel's output properties.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder outputs(Collection outputs);
/**
*
* The channel's output properties.
*
*
* @param outputs
* The channel's output properties.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder outputs(ResponseOutputItem... outputs);
/**
*
* The channel's output properties.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the
* need to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately
* and its result is passed to {@link #outputs(List)}.
*
* @param outputs
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #outputs(List)
*/
Builder outputs(Consumer... outputs);
/**
*
* The type of playback mode for this channel.
*
*
* LINEAR - Programs play back-to-back only once.
*
*
* LOOP - Programs play back-to-back in an endless loop. When the last program in the schedule plays, playback
* loops back to the first program in the schedule.
*
*
* @param playbackMode
* The type of playback mode for this channel.
*
* LINEAR - Programs play back-to-back only once.
*
*
* LOOP - Programs play back-to-back in an endless loop. When the last program in the schedule plays,
* playback loops back to the first program in the schedule.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder playbackMode(String playbackMode);
/**
*
* The tags to assign to the channel.
*
*
* @param tags
* The tags to assign to the channel.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Map tags);
}
static final class BuilderImpl implements Builder {
private String arn;
private String channelName;
private String channelState;
private Instant creationTime;
private SlateSource fillerSlate;
private Instant lastModifiedTime;
private List outputs = DefaultSdkAutoConstructList.getInstance();
private String playbackMode;
private Map tags = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(Channel model) {
arn(model.arn);
channelName(model.channelName);
channelState(model.channelState);
creationTime(model.creationTime);
fillerSlate(model.fillerSlate);
lastModifiedTime(model.lastModifiedTime);
outputs(model.outputs);
playbackMode(model.playbackMode);
tags(model.tags);
}
public final String getArn() {
return arn;
}
public final void setArn(String arn) {
this.arn = arn;
}
@Override
@Transient
public final Builder arn(String arn) {
this.arn = arn;
return this;
}
public final String getChannelName() {
return channelName;
}
public final void setChannelName(String channelName) {
this.channelName = channelName;
}
@Override
@Transient
public final Builder channelName(String channelName) {
this.channelName = channelName;
return this;
}
public final String getChannelState() {
return channelState;
}
public final void setChannelState(String channelState) {
this.channelState = channelState;
}
@Override
@Transient
public final Builder channelState(String channelState) {
this.channelState = channelState;
return this;
}
public final Instant getCreationTime() {
return creationTime;
}
public final void setCreationTime(Instant creationTime) {
this.creationTime = creationTime;
}
@Override
@Transient
public final Builder creationTime(Instant creationTime) {
this.creationTime = creationTime;
return this;
}
public final SlateSource.Builder getFillerSlate() {
return fillerSlate != null ? fillerSlate.toBuilder() : null;
}
public final void setFillerSlate(SlateSource.BuilderImpl fillerSlate) {
this.fillerSlate = fillerSlate != null ? fillerSlate.build() : null;
}
@Override
@Transient
public final Builder fillerSlate(SlateSource fillerSlate) {
this.fillerSlate = fillerSlate;
return this;
}
public final Instant getLastModifiedTime() {
return lastModifiedTime;
}
public final void setLastModifiedTime(Instant lastModifiedTime) {
this.lastModifiedTime = lastModifiedTime;
}
@Override
@Transient
public final Builder lastModifiedTime(Instant lastModifiedTime) {
this.lastModifiedTime = lastModifiedTime;
return this;
}
public final List getOutputs() {
List result = ResponseOutputsCopier.copyToBuilder(this.outputs);
if (result instanceof SdkAutoConstructList) {
return null;
}
return result;
}
public final void setOutputs(Collection outputs) {
this.outputs = ResponseOutputsCopier.copyFromBuilder(outputs);
}
@Override
@Transient
public final Builder outputs(Collection outputs) {
this.outputs = ResponseOutputsCopier.copy(outputs);
return this;
}
@Override
@Transient
@SafeVarargs
public final Builder outputs(ResponseOutputItem... outputs) {
outputs(Arrays.asList(outputs));
return this;
}
@Override
@Transient
@SafeVarargs
public final Builder outputs(Consumer... outputs) {
outputs(Stream.of(outputs).map(c -> ResponseOutputItem.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final String getPlaybackMode() {
return playbackMode;
}
public final void setPlaybackMode(String playbackMode) {
this.playbackMode = playbackMode;
}
@Override
@Transient
public final Builder playbackMode(String playbackMode) {
this.playbackMode = playbackMode;
return this;
}
public final Map getTags() {
if (tags instanceof SdkAutoConstructMap) {
return null;
}
return tags;
}
public final void setTags(Map tags) {
this.tags = ___mapOf__stringCopier.copy(tags);
}
@Override
@Transient
public final Builder tags(Map tags) {
this.tags = ___mapOf__stringCopier.copy(tags);
return this;
}
@Override
public Channel build() {
return new Channel(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}