Class: Fog::AWS::Kinesis::Real
- Inherits:
-
Object
- Object
- Fog::AWS::Kinesis::Real
- Includes:
- CredentialFetcher::ConnectionMethods
- Defined in:
- lib/fog/aws/kinesis.rb,
lib/fog/aws/requests/kinesis/put_record.rb,
lib/fog/aws/requests/kinesis/get_records.rb,
lib/fog/aws/requests/kinesis/put_records.rb,
lib/fog/aws/requests/kinesis/split_shard.rb,
lib/fog/aws/requests/kinesis/list_streams.rb,
lib/fog/aws/requests/kinesis/merge_shards.rb,
lib/fog/aws/requests/kinesis/create_stream.rb,
lib/fog/aws/requests/kinesis/delete_stream.rb,
lib/fog/aws/requests/kinesis/describe_stream.rb,
lib/fog/aws/requests/kinesis/add_tags_to_stream.rb,
lib/fog/aws/requests/kinesis/get_shard_iterator.rb,
lib/fog/aws/requests/kinesis/list_tags_for_stream.rb,
lib/fog/aws/requests/kinesis/remove_tags_from_stream.rb
Instance Method Summary collapse
-
#add_tags_to_stream(options = {}) ⇒ Object
Adds or updates tags for the specified Amazon Kinesis stream.
-
#create_stream(options = {}) ⇒ Object
Creates a Amazon Kinesis stream.
-
#delete_stream(options = {}) ⇒ Object
Deletes a stream and all its shards and data.
-
#describe_stream(options = {}) ⇒ Object
Describes the specified stream.
-
#get_records(options = {}) ⇒ Object
Gets data records from a shard.
-
#get_shard_iterator(options = {}) ⇒ Object
Gets a shard iterator.
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
-
#list_streams(options = {}) ⇒ Object
List available streams.
-
#list_tags_for_stream(options = {}) ⇒ Object
Lists the tags for the specified Amazon Kinesis stream.
-
#merge_shards(options = {}) ⇒ Object
Merges two adjacent shards in a stream and combines them into a single shard to reduce the stream’s capacity to ingest and transport data.
-
#put_record(options = {}) ⇒ Object
Writes a single data record from a producer into an Amazon Kinesis stream.
-
#put_records(options = {}) ⇒ Object
Writes multiple data records from a producer into an Amazon Kinesis stream in a single call (also referred to as a PutRecords request).
-
#remove_tags_from_stream(options = {}) ⇒ Object
Deletes tags from the specified Amazon Kinesis stream.
-
#split_shard(options = {}) ⇒ Object
Splits a shard into two new shards in the stream, to increase the stream’s capacity to ingest and transport data.
Methods included from CredentialFetcher::ConnectionMethods
#refresh_credentials_if_expired
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/fog/aws/kinesis.rb', line 36 def initialize(={}) @use_iam_profile = [:use_iam_profile] @connection_options = [:connection_options] || {} @instrumentor = [:instrumentor] @instrumentor_name = [:instrumentor_name] || 'fog.aws.kinesis' [:region] ||= 'us-east-1' @region = [:region] @host = [:host] || "kinesis.#{[:region]}.amazonaws.com" @path = [:path] || '/' @persistent = [:persistent] || true @port = [:port] || 443 @scheme = [:scheme] || 'https' @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) @version = "20131202" setup_credentials() end |
Instance Method Details
#add_tags_to_stream(options = {}) ⇒ Object
Adds or updates tags for the specified Amazon Kinesis stream.
Options
-
StreamName<~String>: The name of the stream.
-
Tags<~Hash>: The set of key-value pairs to use to create the tags.
Returns
-
response<~Excon::Response>:
See Also
docs.aws.amazon.com/kinesis/latest/APIReference/API_AddTagsToStream.html
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fog/aws/requests/kinesis/add_tags_to_stream.rb', line 16 def (={}) body = { "StreamName" => .delete("StreamName"), "Tags" => .delete("Tags") }.reject{ |_,v| v.nil? } request({ 'X-Amz-Target' => "Kinesis_#{@version}.AddTagsToStream", :body => body, }.merge()) end |
#create_stream(options = {}) ⇒ Object
Creates a Amazon Kinesis stream.
Options
-
ShardCount<~Number>: The number of shards that the stream will use.
-
StreamName<~String>: A name to identify the stream.
Returns
-
response<~Excon::Response>:
See Also
docs.aws.amazon.com/kinesis/latest/APIReference/API_CreateStream.html
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fog/aws/requests/kinesis/create_stream.rb', line 16 def create_stream(={}) body = { "ShardCount" => .delete("ShardCount") || 1, "StreamName" => .delete("StreamName") }.reject{ |_,v| v.nil? } request({ 'X-Amz-Target' => "Kinesis_#{@version}.CreateStream", :body => body, }.merge()) end |
#delete_stream(options = {}) ⇒ Object
Deletes a stream and all its shards and data.
Options
-
StreamName<~String>: A name to identify the stream.
Returns
-
response<~Excon::Response>:
See Also
docs.aws.amazon.com/kinesis/latest/APIReference/API_DeleteStream.html
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/aws/requests/kinesis/delete_stream.rb', line 15 def delete_stream(={}) body = { "StreamName" => .delete("StreamName") }.reject{ |_,v| v.nil? } request({ 'X-Amz-Target' => "Kinesis_#{@version}.DeleteStream", :body => body, }.merge()) end |
#describe_stream(options = {}) ⇒ Object
Describes the specified stream.
Options
-
ExclusiveStartShardId<~String>: The shard ID of the shard to start with.
-
Limit<~Number>: The maximum number of shards to return.
-
StreamName<~String>: The name of the stream to describe.
Returns
-
response<~Excon::Response>:
See Also
docs.aws.amazon.com/kinesis/latest/APIReference/API_DescribeStream.html
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fog/aws/requests/kinesis/describe_stream.rb', line 17 def describe_stream(={}) body = { "ExclusiveStartShardId" => .delete("ExclusiveStartShardId"), "Limit" => .delete("Limit"), "StreamName" => .delete("StreamName") }.reject{ |_,v| v.nil? } response = request({ :idempotent => true, 'X-Amz-Target' => "Kinesis_#{@version}.DescribeStream", :body => body, }.merge()) response.body = Fog::JSON.decode(response.body) unless response.body.nil? response.body response end |
#get_records(options = {}) ⇒ Object
Gets data records from a shard.
Options
-
Limit<~Number>: The maximum number of records to return.
-
ShardIterator<~String>: The position in the shard from which you want to start sequentially reading data records.
Returns
-
response<~Excon::Response>:
See Also
docs.aws.amazon.com/kinesis/latest/APIReference/API_GetRecords.html
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/aws/requests/kinesis/get_records.rb', line 16 def get_records(={}) body = { "Limit" => .delete("Limit"), "ShardIterator" => .delete("ShardIterator") }.reject{ |_,v| v.nil? } response = request({ 'X-Amz-Target' => "Kinesis_#{@version}.GetRecords", :body => body, }.merge()) response.body = Fog::JSON.decode(response.body) unless response.body.nil? response end |
#get_shard_iterator(options = {}) ⇒ Object
Gets a shard iterator.
Options
-
ShardId<~String>: The shard ID of the shard to get the iterator for.
-
ShardIteratorType<~String>: Determines how the shard iterator is used to start reading data records from the shard.
-
StartingSequenceNumber<~String>: The sequence number of the data record in the shard from which to start reading from.
-
StreamName<~String>: A name to identify the stream.
Returns
-
response<~Excon::Response>:
See Also
docs.aws.amazon.com/kinesis/latest/APIReference/API_GetShardIterator.html
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fog/aws/requests/kinesis/get_shard_iterator.rb', line 18 def get_shard_iterator(={}) body = { "ShardId" => .delete("ShardId"), "ShardIteratorType" => .delete("ShardIteratorType"), "StartingSequenceNumber" => .delete("StartingSequenceNumber"), "StreamName" => .delete("StreamName") }.reject{ |_,v| v.nil? } response = request({ 'X-Amz-Target' => "Kinesis_#{@version}.GetShardIterator", :body => body, }.merge()) response.body = Fog::JSON.decode(response.body) unless response.body.nil? response end |
#list_streams(options = {}) ⇒ Object
List available streams
Options
-
ExclusiveStartStreamName<~String>: The name of the stream to start the list with.
-
Limit<~Number>: The maximum number of streams to list.
Returns
-
response<~Excon::Response>:
See Also
docs.aws.amazon.com/kinesis/latest/APIReference/API_ListStreams.html
16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/aws/requests/kinesis/list_streams.rb', line 16 def list_streams(={}) response = request({ :idempotent => true, 'X-Amz-Target' => "Kinesis_#{@version}.ListStreams", :body => {}, }.merge()) response.body = Fog::JSON.decode(response.body) unless response.body.nil? response end |
#list_tags_for_stream(options = {}) ⇒ Object
Lists the tags for the specified Amazon Kinesis stream.
Options
-
ExclusiveStartTagKey<~String>: The key to use as the starting point for the list of tags.
-
Limit<~Number>: The number of tags to return.
-
StreamName<~String>: The name of the stream.
Returns
-
response<~Excon::Response>:
See Also
docs.aws.amazon.com/kinesis/latest/APIReference/API_ListTagsForStream.html
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fog/aws/requests/kinesis/list_tags_for_stream.rb', line 17 def (={}) body = { "ExclusiveStartTagKey" => .delete("ExclusiveStartTagKey"), "Limit" => .delete("Limit"), "StreamName" => .delete("StreamName") }.reject{ |_,v| v.nil? } response = request({ :idempotent => true, 'X-Amz-Target' => "Kinesis_#{@version}.ListTagsForStream", :body => body, }.merge()) response.body = Fog::JSON.decode(response.body) unless response.body.nil? response.body response end |
#merge_shards(options = {}) ⇒ Object
Merges two adjacent shards in a stream and combines them into a single shard to reduce the stream’s capacity to ingest and transport data.
Options
-
AdjacentShardToMerge<~String>: The shard ID of the adjacent shard for the merge.
-
ShardToMerge<~String>: The shard ID of the shard to combine with the adjacent shard for the merge.
-
StreamName<~String>: The name of the stream for the merge.
Returns
-
response<~Excon::Response>:
See Also
docs.aws.amazon.com/kinesis/latest/APIReference/API_MergeShards.html
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/aws/requests/kinesis/merge_shards.rb', line 17 def merge_shards(={}) body = { "AdjacentShardToMerge" => .delete("AdjacentShardToMerge"), "ShardToMerge" => .delete("ShardToMerge"), "StreamName" => .delete("StreamName") }.reject{ |_,v| v.nil? } request({ 'X-Amz-Target' => "Kinesis_#{@version}.MergeShards", :body => body, }.merge()) end |
#put_record(options = {}) ⇒ Object
Writes a single data record from a producer into an Amazon Kinesis stream.
Options
-
Data<~Blob>: The data blob to put into the record, which is base64-encoded when the blob is serialized.
-
ExplicitHashKey<~String>: The hash value used to determine explicitly the shard that the data record is assigned to by overriding the partition key hash.
-
PartitionKey<~String>: Determines which shard in the stream the data record is assigned to.
-
SequenceNumberForOrdering<~String>: Guarantees strictly increasing sequence numbers, for puts from the same client and to the same partition key.
-
StreamName<~String>: The stream name associated with the request.
Returns
-
response<~Excon::Response>:
See Also
docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecord.html
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/fog/aws/requests/kinesis/put_record.rb', line 19 def put_record(={}) body = { "Data" => .delete("Data"), "ExplicitHashKey" => .delete("ExplicitHashKey"), "PartitionKey" => .delete("PartitionKey"), "SequenceNumberForOrdering" => .delete("SequenceNumberForOrdering"), "StreamName" => .delete("StreamName") }.reject{ |_,v| v.nil? } response = request({ 'X-Amz-Target' => "Kinesis_#{@version}.PutRecord", :body => body, }.merge()) response.body = Fog::JSON.decode(response.body) unless response.body.nil? response end |
#put_records(options = {}) ⇒ Object
Writes multiple data records from a producer into an Amazon Kinesis stream in a single call (also referred to as a PutRecords request).
Options
-
Records<~Array>: The records associated with the request.
-
Record<~Hash>: A record.
-
Data<~Blob>: The data blob to put into the record, which is base64-encoded when the blob is serialized.
-
ExplicitHashKey<~String>: The hash value used to determine explicitly the shard that the data record is assigned to by overriding the partition key hash.
-
PartitionKey<~String>: Determines which shard in the stream the data record is assigned to.
-
-
-
StreamName<~String>: The stream name associated with the request.
Returns
-
response<~Excon::Response>:
See Also
docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecords.html
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fog/aws/requests/kinesis/put_records.rb', line 20 def put_records(={}) body = { "Records" => .delete("Records"), "StreamName" => .delete("StreamName") }.reject{ |_,v| v.nil? } response = request({ 'X-Amz-Target' => "Kinesis_#{@version}.PutRecords", :body => body, }.merge()) response.body = Fog::JSON.decode(response.body) unless response.body.nil? response end |
#remove_tags_from_stream(options = {}) ⇒ Object
Deletes tags from the specified Amazon Kinesis stream.
Options
-
StreamName<~String>: The name of the stream.
-
TagKeys<~Array>: A list of tag keys.
Returns
-
response<~Excon::Response>:
See Also
docs.aws.amazon.com/kinesis/latest/APIReference/API_RemoveTagsFromStream.html
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fog/aws/requests/kinesis/remove_tags_from_stream.rb', line 16 def (={}) body = { "StreamName" => .delete("StreamName"), "TagKeys" => .delete("TagKeys") }.reject{ |_,v| v.nil? } request({ 'X-Amz-Target' => "Kinesis_#{@version}.RemoveTagsFromStream", :body => body, }.merge()) end |
#split_shard(options = {}) ⇒ Object
Splits a shard into two new shards in the stream, to increase the stream’s capacity to ingest and transport data.
Options
-
NewStartingHashKey<~String>: A hash key value for the starting hash key of one of the child shards created by the split.
-
ShardToSplit<~String>: The shard ID of the shard to split.
-
StreamName<~String>: The name of the stream for the shard split.
Returns
-
response<~Excon::Response>:
See Also
docs.aws.amazon.com/kinesis/latest/APIReference/API_SplitShard.html
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/aws/requests/kinesis/split_shard.rb', line 17 def split_shard(={}) body = { "NewStartingHashKey" => .delete("NewStartingHashKey"), "ShardToSplit" => .delete("ShardToSplit"), "StreamName" => .delete("StreamName") }.reject{ |_,v| v.nil? } request({ 'X-Amz-Target' => "Kinesis_#{@version}.SplitShard", :body => body, }.merge()) end |