You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.
Class: Aws::KinesisVideo::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::KinesisVideo::Client
- Defined in:
- (unknown)
Overview
An API client for Amazon Kinesis Video Streams. To construct a client, you need to configure a :region
and :credentials
.
kinesisvideo = Aws::KinesisVideo::Client.new(
region: region_name,
credentials: credentials,
# ...
)
See #initialize for a full list of supported configuration options.
Region
You can configure a default region in the following locations:
ENV['AWS_REGION']
Aws.config[:region]
Go here for a list of supported regions.
Credentials
Default credentials are loaded automatically from the following locations:
ENV['AWS_ACCESS_KEY_ID']
andENV['AWS_SECRET_ACCESS_KEY']
Aws.config[:credentials]
- The shared credentials ini file at
~/.aws/credentials
(more information) - From an instance profile when running on EC2
You can also construct a credentials object from one of the following classes:
Alternatively, you configure credentials with :access_key_id
and
:secret_access_key
:
# load credentials from disk
creds = YAML.load(File.read('/path/to/secrets'))
Aws::KinesisVideo::Client.new(
access_key_id: creds['access_key_id'],
secret_access_key: creds['secret_access_key']
)
Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.
Instance Attribute Summary
Attributes inherited from Seahorse::Client::Base
Constructor collapse
-
#initialize(options = {}) ⇒ Aws::KinesisVideo::Client
constructor
Constructs an API client.
API Operations collapse
-
#create_signaling_channel(options = {}) ⇒ Types::CreateSignalingChannelOutput
Creates a signaling channel.
-
#create_stream(options = {}) ⇒ Types::CreateStreamOutput
Creates a new Kinesis video stream.
-
#delete_signaling_channel(options = {}) ⇒ Struct
Deletes a specified signaling channel.
-
#delete_stream(options = {}) ⇒ Struct
Deletes a Kinesis video stream and the data contained in the stream.
-
#describe_signaling_channel(options = {}) ⇒ Types::DescribeSignalingChannelOutput
Returns the most current information about the signaling channel.
-
#describe_stream(options = {}) ⇒ Types::DescribeStreamOutput
Returns the most current information about the specified stream.
-
#get_data_endpoint(options = {}) ⇒ Types::GetDataEndpointOutput
Gets an endpoint for a specified stream for either reading or writing.
-
#get_signaling_channel_endpoint(options = {}) ⇒ Types::GetSignalingChannelEndpointOutput
Provides an endpoint for the specified signaling channel to send and receive messages.
-
#list_signaling_channels(options = {}) ⇒ Types::ListSignalingChannelsOutput
Returns an array of
ChannelInfo
objects. -
#list_streams(options = {}) ⇒ Types::ListStreamsOutput
Returns an array of
StreamInfo
objects. -
#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceOutput
Returns a list of tags associated with the specified signaling channel.
.
-
#list_tags_for_stream(options = {}) ⇒ Types::ListTagsForStreamOutput
Returns a list of tags associated with the specified stream.
In the request, you must specify either the
StreamName
or theStreamARN
. -
#tag_resource(options = {}) ⇒ Struct
Adds one or more tags to a signaling channel.
-
#tag_stream(options = {}) ⇒ Struct
Adds one or more tags to a stream.
-
#untag_resource(options = {}) ⇒ Struct
Removes one or more tags from a signaling channel.
-
#untag_stream(options = {}) ⇒ Struct
Removes one or more tags from a stream.
-
#update_data_retention(options = {}) ⇒ Struct
Increases or decreases the stream's data retention period by the value that you specify.
-
#update_signaling_channel(options = {}) ⇒ Struct
Updates the existing signaling channel.
-
#update_stream(options = {}) ⇒ Struct
Updates stream metadata, such as the device name and media type.
You must provide the stream name or the Amazon Resource Name (ARN) of the stream.
To make sure that you have the latest version of the stream before updating it, you can specify the stream version.
Instance Method Summary collapse
-
#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean
Waiters polls an API operation until a resource enters a desired state.
-
#waiter_names ⇒ Array<Symbol>
Returns the list of supported waiters.
Methods inherited from Seahorse::Client::Base
add_plugin, api, #build_request, clear_plugins, define, new, #operation, #operation_names, plugins, remove_plugin, set_api, set_plugins
Methods included from Seahorse::Client::HandlerBuilder
#handle, #handle_request, #handle_response
Constructor Details
#initialize(options = {}) ⇒ Aws::KinesisVideo::Client
Constructs an API client.
Instance Method Details
#create_signaling_channel(options = {}) ⇒ Types::CreateSignalingChannelOutput
Creates a signaling channel.
CreateSignalingChannel
is an asynchronous operation.
#create_stream(options = {}) ⇒ Types::CreateStreamOutput
Creates a new Kinesis video stream.
When you create a new stream, Kinesis Video Streams assigns it a version number. When you change the stream's metadata, Kinesis Video Streams updates the version.
CreateStream
is an asynchronous operation.
For information about how the service works, see How it Works.
You must have permissions for the KinesisVideo:CreateStream
action.
#delete_signaling_channel(options = {}) ⇒ Struct
Deletes a specified signaling channel. DeleteSignalingChannel
is an asynchronous operation. If you don't specify the channel's current version, the most recent version is deleted.
#delete_stream(options = {}) ⇒ Struct
Deletes a Kinesis video stream and the data contained in the stream.
This method marks the stream for deletion, and makes the data in the stream inaccessible immediately.
To ensure that you have the latest version of the stream before deleting it, you can specify the stream version. Kinesis Video Streams assigns a version to each stream. When you update a stream, Kinesis Video Streams assigns a new version number. To get the latest stream version, use the DescribeStream
API.
This operation requires permission for the KinesisVideo:DeleteStream
action.
#describe_signaling_channel(options = {}) ⇒ Types::DescribeSignalingChannelOutput
Returns the most current information about the signaling channel. You must specify either the name or the Amazon Resource Name (ARN) of the channel that you want to describe.
#describe_stream(options = {}) ⇒ Types::DescribeStreamOutput
Returns the most current information about the specified stream. You must specify either the StreamName
or the StreamARN
.
#get_data_endpoint(options = {}) ⇒ Types::GetDataEndpointOutput
Gets an endpoint for a specified stream for either reading or writing. Use this endpoint in your application to read from the specified stream (using the GetMedia
or GetMediaForFragmentList
operations) or write to it (using the PutMedia
operation).
The returned endpoint does not have the API name appended. The client needs to add the API name to the returned endpoint.
In the request, specify the stream either by StreamName
or StreamARN
.
#get_signaling_channel_endpoint(options = {}) ⇒ Types::GetSignalingChannelEndpointOutput
Provides an endpoint for the specified signaling channel to send and receive messages. This API uses the SingleMasterChannelEndpointConfiguration
input parameter, which consists of the Protocols
and Role
properties.
Protocols
is used to determine the communication mechanism. For example, if you specify WSS
as the protocol, this API produces a secure websocket endpoint. If you specify HTTPS
as the protocol, this API generates an HTTPS endpoint.
Role
determines the messaging permissions. A MASTER
role results in this API generating an endpoint that a client can use to communicate with any of the viewers on the channel. A VIEWER
role results in this API generating an endpoint that a client can use to communicate only with a MASTER
.
#list_signaling_channels(options = {}) ⇒ Types::ListSignalingChannelsOutput
Returns an array of ChannelInfo
objects. Each object describes a signaling channel. To retrieve only those channels that satisfy a specific condition, you can specify a ChannelNameCondition
.
#list_streams(options = {}) ⇒ Types::ListStreamsOutput
Returns an array of StreamInfo
objects. Each object describes a stream. To retrieve only streams that satisfy a specific condition, you can specify a StreamNameCondition
.
#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceOutput
Returns a list of tags associated with the specified signaling channel.
#list_tags_for_stream(options = {}) ⇒ Types::ListTagsForStreamOutput
Returns a list of tags associated with the specified stream.
In the request, you must specify either the StreamName
or the StreamARN
.
#tag_resource(options = {}) ⇒ Struct
Adds one or more tags to a signaling channel. A tag is a key-value pair (the value is optional) that you can define and assign to AWS resources. If you specify a tag that already exists, the tag value is replaced with the value that you specify in the request. For more information, see Using Cost Allocation Tags in the AWS Billing and Cost Management User Guide.
#tag_stream(options = {}) ⇒ Struct
Adds one or more tags to a stream. A tag is a key-value pair (the value is optional) that you can define and assign to AWS resources. If you specify a tag that already exists, the tag value is replaced with the value that you specify in the request. For more information, see Using Cost Allocation Tags in the AWS Billing and Cost Management User Guide.
You must provide either the StreamName
or the StreamARN
.
This operation requires permission for the KinesisVideo:TagStream
action.
Kinesis video streams support up to 50 tags.
#untag_resource(options = {}) ⇒ Struct
Removes one or more tags from a signaling channel. In the request, specify only a tag key or keys; don't specify the value. If you specify a tag key that does not exist, it's ignored.
#untag_stream(options = {}) ⇒ Struct
Removes one or more tags from a stream. In the request, specify only a tag key or keys; don't specify the value. If you specify a tag key that does not exist, it's ignored.
In the request, you must provide the StreamName
or StreamARN
.
#update_data_retention(options = {}) ⇒ Struct
Increases or decreases the stream's data retention period by the value that you specify. To indicate whether you want to increase or decrease the data retention period, specify the Operation
parameter in the request body. In the request, you must specify either the StreamName
or the StreamARN
.
The retention period that you specify replaces the current value.
This operation requires permission for the KinesisVideo:UpdateDataRetention
action.
Changing the data retention period affects the data in the stream as follows:
-
If the data retention period is increased, existing data is retained for the new retention period. For example, if the data retention period is increased from one hour to seven hours, all existing data is retained for seven hours.
-
If the data retention period is decreased, existing data is retained for the new retention period. For example, if the data retention period is decreased from seven hours to one hour, all existing data is retained for one hour, and any data older than one hour is deleted immediately.
#update_signaling_channel(options = {}) ⇒ Struct
Updates the existing signaling channel. This is an asynchronous operation and takes time to complete.
If the MessageTtlSeconds
value is updated (either increased or reduced), it only applies to new messages sent via this channel after it's been updated. Existing messages are still expired as per the previous MessageTtlSeconds
value.
#update_stream(options = {}) ⇒ Struct
Updates stream metadata, such as the device name and media type.
You must provide the stream name or the Amazon Resource Name (ARN) of the stream.
To make sure that you have the latest version of the stream before updating it, you can specify the stream version. Kinesis Video Streams assigns a version to each stream. When you update a stream, Kinesis Video Streams assigns a new version number. To get the latest stream version, use the DescribeStream
API.
UpdateStream
is an asynchronous operation, and takes time to complete.
#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean
Waiters polls an API operation until a resource enters a desired state.
Basic Usage
Waiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:
# poll for ~25 seconds
client.wait_until(...) do |w|
w.max_attempts = 5
w.delay = 5
end
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success
or :failure
from these callbacks,
it will terminate the waiter.
started_at = Time.now
client.wait_until(...) do |w|
# disable max attempts
w.max_attempts = nil
# poll for 1 hour, instead of a number of attempts
w.before_wait do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
end
Handling Errors
When a waiter is successful, it returns true
. When a waiter
fails, it raises an error. All errors raised extend from
Waiters::Errors::WaiterFailed.
begin
client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
#waiter_names ⇒ Array<Symbol>
Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:
Waiter Name | Client Method | Default Delay: | Default Max Attempts: |
---|