aws-sdk-ivs 1.74.0

AWS SDK for Amazon Interactive Video Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Specifies a live video stream that has been ingested and distributed.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Stream {
    /// <p>Channel ARN for the stream.</p>
    pub channel_arn: ::std::option::Option<::std::string::String>,
    /// <p>Unique identifier for a live or previously live stream in the specified channel.</p>
    pub stream_id: ::std::option::Option<::std::string::String>,
    /// <p>URL of the master playlist, required by the video player to play the HLS stream.</p>
    pub playback_url: ::std::option::Option<::std::string::String>,
    /// <p>Time of the stream’s start. This is an ISO 8601 timestamp; <i>note that this is returned as a string</i>.</p>
    pub start_time: ::std::option::Option<::aws_smithy_types::DateTime>,
    /// <p>The stream’s state. Do not rely on the <code>OFFLINE</code> state, as the API may not return it; instead, a "NotBroadcasting" error will indicate that the stream is not live.</p>
    pub state: ::std::option::Option<crate::types::StreamState>,
    /// <p>The stream’s health.</p>
    pub health: ::std::option::Option<crate::types::StreamHealth>,
    /// <p>A count of concurrent views of the stream. Typically, a new view appears in <code>viewerCount</code> within 15 seconds of when video playback starts and a view is removed from <code>viewerCount</code> within 1 minute of when video playback ends. A value of -1 indicates that the request timed out; in this case, retry.</p>
    pub viewer_count: i64,
}
impl Stream {
    /// <p>Channel ARN for the stream.</p>
    pub fn channel_arn(&self) -> ::std::option::Option<&str> {
        self.channel_arn.as_deref()
    }
    /// <p>Unique identifier for a live or previously live stream in the specified channel.</p>
    pub fn stream_id(&self) -> ::std::option::Option<&str> {
        self.stream_id.as_deref()
    }
    /// <p>URL of the master playlist, required by the video player to play the HLS stream.</p>
    pub fn playback_url(&self) -> ::std::option::Option<&str> {
        self.playback_url.as_deref()
    }
    /// <p>Time of the stream’s start. This is an ISO 8601 timestamp; <i>note that this is returned as a string</i>.</p>
    pub fn start_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.start_time.as_ref()
    }
    /// <p>The stream’s state. Do not rely on the <code>OFFLINE</code> state, as the API may not return it; instead, a "NotBroadcasting" error will indicate that the stream is not live.</p>
    pub fn state(&self) -> ::std::option::Option<&crate::types::StreamState> {
        self.state.as_ref()
    }
    /// <p>The stream’s health.</p>
    pub fn health(&self) -> ::std::option::Option<&crate::types::StreamHealth> {
        self.health.as_ref()
    }
    /// <p>A count of concurrent views of the stream. Typically, a new view appears in <code>viewerCount</code> within 15 seconds of when video playback starts and a view is removed from <code>viewerCount</code> within 1 minute of when video playback ends. A value of -1 indicates that the request timed out; in this case, retry.</p>
    pub fn viewer_count(&self) -> i64 {
        self.viewer_count
    }
}
impl Stream {
    /// Creates a new builder-style object to manufacture [`Stream`](crate::types::Stream).
    pub fn builder() -> crate::types::builders::StreamBuilder {
        crate::types::builders::StreamBuilder::default()
    }
}

/// A builder for [`Stream`](crate::types::Stream).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct StreamBuilder {
    pub(crate) channel_arn: ::std::option::Option<::std::string::String>,
    pub(crate) stream_id: ::std::option::Option<::std::string::String>,
    pub(crate) playback_url: ::std::option::Option<::std::string::String>,
    pub(crate) start_time: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) state: ::std::option::Option<crate::types::StreamState>,
    pub(crate) health: ::std::option::Option<crate::types::StreamHealth>,
    pub(crate) viewer_count: ::std::option::Option<i64>,
}
impl StreamBuilder {
    /// <p>Channel ARN for the stream.</p>
    pub fn channel_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.channel_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Channel ARN for the stream.</p>
    pub fn set_channel_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.channel_arn = input;
        self
    }
    /// <p>Channel ARN for the stream.</p>
    pub fn get_channel_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.channel_arn
    }
    /// <p>Unique identifier for a live or previously live stream in the specified channel.</p>
    pub fn stream_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.stream_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Unique identifier for a live or previously live stream in the specified channel.</p>
    pub fn set_stream_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.stream_id = input;
        self
    }
    /// <p>Unique identifier for a live or previously live stream in the specified channel.</p>
    pub fn get_stream_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.stream_id
    }
    /// <p>URL of the master playlist, required by the video player to play the HLS stream.</p>
    pub fn playback_url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.playback_url = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>URL of the master playlist, required by the video player to play the HLS stream.</p>
    pub fn set_playback_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.playback_url = input;
        self
    }
    /// <p>URL of the master playlist, required by the video player to play the HLS stream.</p>
    pub fn get_playback_url(&self) -> &::std::option::Option<::std::string::String> {
        &self.playback_url
    }
    /// <p>Time of the stream’s start. This is an ISO 8601 timestamp; <i>note that this is returned as a string</i>.</p>
    pub fn start_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.start_time = ::std::option::Option::Some(input);
        self
    }
    /// <p>Time of the stream’s start. This is an ISO 8601 timestamp; <i>note that this is returned as a string</i>.</p>
    pub fn set_start_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.start_time = input;
        self
    }
    /// <p>Time of the stream’s start. This is an ISO 8601 timestamp; <i>note that this is returned as a string</i>.</p>
    pub fn get_start_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.start_time
    }
    /// <p>The stream’s state. Do not rely on the <code>OFFLINE</code> state, as the API may not return it; instead, a "NotBroadcasting" error will indicate that the stream is not live.</p>
    pub fn state(mut self, input: crate::types::StreamState) -> Self {
        self.state = ::std::option::Option::Some(input);
        self
    }
    /// <p>The stream’s state. Do not rely on the <code>OFFLINE</code> state, as the API may not return it; instead, a "NotBroadcasting" error will indicate that the stream is not live.</p>
    pub fn set_state(mut self, input: ::std::option::Option<crate::types::StreamState>) -> Self {
        self.state = input;
        self
    }
    /// <p>The stream’s state. Do not rely on the <code>OFFLINE</code> state, as the API may not return it; instead, a "NotBroadcasting" error will indicate that the stream is not live.</p>
    pub fn get_state(&self) -> &::std::option::Option<crate::types::StreamState> {
        &self.state
    }
    /// <p>The stream’s health.</p>
    pub fn health(mut self, input: crate::types::StreamHealth) -> Self {
        self.health = ::std::option::Option::Some(input);
        self
    }
    /// <p>The stream’s health.</p>
    pub fn set_health(mut self, input: ::std::option::Option<crate::types::StreamHealth>) -> Self {
        self.health = input;
        self
    }
    /// <p>The stream’s health.</p>
    pub fn get_health(&self) -> &::std::option::Option<crate::types::StreamHealth> {
        &self.health
    }
    /// <p>A count of concurrent views of the stream. Typically, a new view appears in <code>viewerCount</code> within 15 seconds of when video playback starts and a view is removed from <code>viewerCount</code> within 1 minute of when video playback ends. A value of -1 indicates that the request timed out; in this case, retry.</p>
    pub fn viewer_count(mut self, input: i64) -> Self {
        self.viewer_count = ::std::option::Option::Some(input);
        self
    }
    /// <p>A count of concurrent views of the stream. Typically, a new view appears in <code>viewerCount</code> within 15 seconds of when video playback starts and a view is removed from <code>viewerCount</code> within 1 minute of when video playback ends. A value of -1 indicates that the request timed out; in this case, retry.</p>
    pub fn set_viewer_count(mut self, input: ::std::option::Option<i64>) -> Self {
        self.viewer_count = input;
        self
    }
    /// <p>A count of concurrent views of the stream. Typically, a new view appears in <code>viewerCount</code> within 15 seconds of when video playback starts and a view is removed from <code>viewerCount</code> within 1 minute of when video playback ends. A value of -1 indicates that the request timed out; in this case, retry.</p>
    pub fn get_viewer_count(&self) -> &::std::option::Option<i64> {
        &self.viewer_count
    }
    /// Consumes the builder and constructs a [`Stream`](crate::types::Stream).
    pub fn build(self) -> crate::types::Stream {
        crate::types::Stream {
            channel_arn: self.channel_arn,
            stream_id: self.stream_id,
            playback_url: self.playback_url,
            start_time: self.start_time,
            state: self.state,
            health: self.health,
            viewer_count: self.viewer_count.unwrap_or_default(),
        }
    }
}