All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.ivs.model.Stream Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Ivs module holds the client classes that are used for communicating with Ivs.

There is a newer version: 2.28.4
Show newest version
/*
 * 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.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.core.traits.TimestampFormatTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Specifies a live video stream that has been ingested and distributed. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Stream implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField CHANNEL_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("channelArn").getter(getter(Stream::channelArn)).setter(setter(Builder::channelArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("channelArn").build()).build(); private static final SdkField STREAM_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("streamId").getter(getter(Stream::streamId)).setter(setter(Builder::streamId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("streamId").build()).build(); private static final SdkField PLAYBACK_URL_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("playbackUrl").getter(getter(Stream::playbackUrl)).setter(setter(Builder::playbackUrl)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("playbackUrl").build()).build(); private static final SdkField START_TIME_FIELD = SdkField . builder(MarshallingType.INSTANT) .memberName("startTime") .getter(getter(Stream::startTime)) .setter(setter(Builder::startTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startTime").build(), TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build(); private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("state") .getter(getter(Stream::stateAsString)).setter(setter(Builder::state)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("state").build()).build(); private static final SdkField HEALTH_FIELD = SdkField. builder(MarshallingType.STRING).memberName("health") .getter(getter(Stream::healthAsString)).setter(setter(Builder::health)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("health").build()).build(); private static final SdkField VIEWER_COUNT_FIELD = SdkField. builder(MarshallingType.LONG) .memberName("viewerCount").getter(getter(Stream::viewerCount)).setter(setter(Builder::viewerCount)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("viewerCount").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CHANNEL_ARN_FIELD, STREAM_ID_FIELD, PLAYBACK_URL_FIELD, START_TIME_FIELD, STATE_FIELD, HEALTH_FIELD, VIEWER_COUNT_FIELD)); private static final long serialVersionUID = 1L; private final String channelArn; private final String streamId; private final String playbackUrl; private final Instant startTime; private final String state; private final String health; private final Long viewerCount; private Stream(BuilderImpl builder) { this.channelArn = builder.channelArn; this.streamId = builder.streamId; this.playbackUrl = builder.playbackUrl; this.startTime = builder.startTime; this.state = builder.state; this.health = builder.health; this.viewerCount = builder.viewerCount; } /** *

* Channel ARN for the stream. *

* * @return Channel ARN for the stream. */ public final String channelArn() { return channelArn; } /** *

* Unique identifier for a live or previously live stream in the specified channel. *

* * @return Unique identifier for a live or previously live stream in the specified channel. */ public final String streamId() { return streamId; } /** *

* URL of the master playlist, required by the video player to play the HLS stream. *

* * @return URL of the master playlist, required by the video player to play the HLS stream. */ public final String playbackUrl() { return playbackUrl; } /** *

* Time of the stream’s start. This is an ISO 8601 timestamp; note that this is returned as a string. *

* * @return Time of the stream’s start. This is an ISO 8601 timestamp; note that this is returned as a string. */ public final Instant startTime() { return startTime; } /** *

* The stream’s state. Do not rely on the OFFLINE state, as the API may not return it; instead, a * "NotBroadcasting" error will indicate that the stream is not live. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link StreamState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #stateAsString}. *

* * @return The stream’s state. Do not rely on the OFFLINE state, as the API may not return it; instead, * a "NotBroadcasting" error will indicate that the stream is not live. * @see StreamState */ public final StreamState state() { return StreamState.fromValue(state); } /** *

* The stream’s state. Do not rely on the OFFLINE state, as the API may not return it; instead, a * "NotBroadcasting" error will indicate that the stream is not live. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link StreamState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #stateAsString}. *

* * @return The stream’s state. Do not rely on the OFFLINE state, as the API may not return it; instead, * a "NotBroadcasting" error will indicate that the stream is not live. * @see StreamState */ public final String stateAsString() { return state; } /** *

* The stream’s health. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #health} will * return {@link StreamHealth#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #healthAsString}. *

* * @return The stream’s health. * @see StreamHealth */ public final StreamHealth health() { return StreamHealth.fromValue(health); } /** *

* The stream’s health. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #health} will * return {@link StreamHealth#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #healthAsString}. *

* * @return The stream’s health. * @see StreamHealth */ public final String healthAsString() { return health; } /** *

* A count of concurrent views of the stream. Typically, a new view appears in viewerCount within 15 * seconds of when video playback starts and a view is removed from viewerCount within 1 minute of when * video playback ends. A value of -1 indicates that the request timed out; in this case, retry. *

* * @return A count of concurrent views of the stream. Typically, a new view appears in viewerCount * within 15 seconds of when video playback starts and a view is removed from viewerCount * within 1 minute of when video playback ends. A value of -1 indicates that the request timed out; in this * case, retry. */ public final Long viewerCount() { return viewerCount; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(channelArn()); hashCode = 31 * hashCode + Objects.hashCode(streamId()); hashCode = 31 * hashCode + Objects.hashCode(playbackUrl()); hashCode = 31 * hashCode + Objects.hashCode(startTime()); hashCode = 31 * hashCode + Objects.hashCode(stateAsString()); hashCode = 31 * hashCode + Objects.hashCode(healthAsString()); hashCode = 31 * hashCode + Objects.hashCode(viewerCount()); 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 Stream)) { return false; } Stream other = (Stream) obj; return Objects.equals(channelArn(), other.channelArn()) && Objects.equals(streamId(), other.streamId()) && Objects.equals(playbackUrl(), other.playbackUrl()) && Objects.equals(startTime(), other.startTime()) && Objects.equals(stateAsString(), other.stateAsString()) && Objects.equals(healthAsString(), other.healthAsString()) && Objects.equals(viewerCount(), other.viewerCount()); } /** * 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("Stream").add("ChannelArn", channelArn()).add("StreamId", streamId()) .add("PlaybackUrl", playbackUrl()).add("StartTime", startTime()).add("State", stateAsString()) .add("Health", healthAsString()).add("ViewerCount", viewerCount()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "channelArn": return Optional.ofNullable(clazz.cast(channelArn())); case "streamId": return Optional.ofNullable(clazz.cast(streamId())); case "playbackUrl": return Optional.ofNullable(clazz.cast(playbackUrl())); case "startTime": return Optional.ofNullable(clazz.cast(startTime())); case "state": return Optional.ofNullable(clazz.cast(stateAsString())); case "health": return Optional.ofNullable(clazz.cast(healthAsString())); case "viewerCount": return Optional.ofNullable(clazz.cast(viewerCount())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Stream) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Channel ARN for the stream. *

* * @param channelArn * Channel ARN for the stream. * @return Returns a reference to this object so that method calls can be chained together. */ Builder channelArn(String channelArn); /** *

* Unique identifier for a live or previously live stream in the specified channel. *

* * @param streamId * Unique identifier for a live or previously live stream in the specified channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder streamId(String streamId); /** *

* URL of the master playlist, required by the video player to play the HLS stream. *

* * @param playbackUrl * URL of the master playlist, required by the video player to play the HLS stream. * @return Returns a reference to this object so that method calls can be chained together. */ Builder playbackUrl(String playbackUrl); /** *

* Time of the stream’s start. This is an ISO 8601 timestamp; note that this is returned as a string. *

* * @param startTime * Time of the stream’s start. This is an ISO 8601 timestamp; note that this is returned as a * string. * @return Returns a reference to this object so that method calls can be chained together. */ Builder startTime(Instant startTime); /** *

* The stream’s state. Do not rely on the OFFLINE state, as the API may not return it; instead, a * "NotBroadcasting" error will indicate that the stream is not live. *

* * @param state * The stream’s state. Do not rely on the OFFLINE state, as the API may not return it; * instead, a "NotBroadcasting" error will indicate that the stream is not live. * @see StreamState * @return Returns a reference to this object so that method calls can be chained together. * @see StreamState */ Builder state(String state); /** *

* The stream’s state. Do not rely on the OFFLINE state, as the API may not return it; instead, a * "NotBroadcasting" error will indicate that the stream is not live. *

* * @param state * The stream’s state. Do not rely on the OFFLINE state, as the API may not return it; * instead, a "NotBroadcasting" error will indicate that the stream is not live. * @see StreamState * @return Returns a reference to this object so that method calls can be chained together. * @see StreamState */ Builder state(StreamState state); /** *

* The stream’s health. *

* * @param health * The stream’s health. * @see StreamHealth * @return Returns a reference to this object so that method calls can be chained together. * @see StreamHealth */ Builder health(String health); /** *

* The stream’s health. *

* * @param health * The stream’s health. * @see StreamHealth * @return Returns a reference to this object so that method calls can be chained together. * @see StreamHealth */ Builder health(StreamHealth health); /** *

* A count of concurrent views of the stream. Typically, a new view appears in viewerCount within * 15 seconds of when video playback starts and a view is removed from viewerCount within 1 minute * of when video playback ends. A value of -1 indicates that the request timed out; in this case, retry. *

* * @param viewerCount * A count of concurrent views of the stream. Typically, a new view appears in viewerCount * within 15 seconds of when video playback starts and a view is removed from viewerCount * within 1 minute of when video playback ends. A value of -1 indicates that the request timed out; in * this case, retry. * @return Returns a reference to this object so that method calls can be chained together. */ Builder viewerCount(Long viewerCount); } static final class BuilderImpl implements Builder { private String channelArn; private String streamId; private String playbackUrl; private Instant startTime; private String state; private String health; private Long viewerCount; private BuilderImpl() { } private BuilderImpl(Stream model) { channelArn(model.channelArn); streamId(model.streamId); playbackUrl(model.playbackUrl); startTime(model.startTime); state(model.state); health(model.health); viewerCount(model.viewerCount); } public final String getChannelArn() { return channelArn; } public final void setChannelArn(String channelArn) { this.channelArn = channelArn; } @Override public final Builder channelArn(String channelArn) { this.channelArn = channelArn; return this; } public final String getStreamId() { return streamId; } public final void setStreamId(String streamId) { this.streamId = streamId; } @Override public final Builder streamId(String streamId) { this.streamId = streamId; return this; } public final String getPlaybackUrl() { return playbackUrl; } public final void setPlaybackUrl(String playbackUrl) { this.playbackUrl = playbackUrl; } @Override public final Builder playbackUrl(String playbackUrl) { this.playbackUrl = playbackUrl; return this; } public final Instant getStartTime() { return startTime; } public final void setStartTime(Instant startTime) { this.startTime = startTime; } @Override public final Builder startTime(Instant startTime) { this.startTime = startTime; return this; } public final String getState() { return state; } public final void setState(String state) { this.state = state; } @Override public final Builder state(String state) { this.state = state; return this; } @Override public final Builder state(StreamState state) { this.state(state == null ? null : state.toString()); return this; } public final String getHealth() { return health; } public final void setHealth(String health) { this.health = health; } @Override public final Builder health(String health) { this.health = health; return this; } @Override public final Builder health(StreamHealth health) { this.health(health == null ? null : health.toString()); return this; } public final Long getViewerCount() { return viewerCount; } public final void setViewerCount(Long viewerCount) { this.viewerCount = viewerCount; } @Override public final Builder viewerCount(Long viewerCount) { this.viewerCount = viewerCount; return this; } @Override public Stream build() { return new Stream(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy