Class: Conrad::Emitters::AmazonBase

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/conrad/emitters/amazon_base.rb

Overview

Base class for AWS-based emitters

Direct Known Subclasses

Kinesis, Sqs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ AmazonBase

Returns a new instance of AmazonBase.

Parameters:

  • queue_url (String)

    the queue to send messages to

  • region (String)

    region the queue lives in

  • access_key_id (String)

    AWS Acesss Key ID

  • secret_access_key (String)

    AWS Secret Access Key

Raises:

  • (InvalidAwsCredentials)

    if access_key_id or secret_access_key are not provided AND the running environment does not have valid AWS credentials

  • (Aws::Errors::MissingRegionError)

    if region is not provided and also not set via an allowed AWS environment variable



34
35
36
37
# File 'lib/conrad/emitters/amazon_base.rb', line 34

def initialize(args = {})
  super
  create_client(region: region, access_key_id: access_key_id, secret_access_key: secret_access_key)
end

Instance Attribute Details

#access_key_idString?

Deprecated.

Will be removed in 3.0.0, no migration path

Returns the configured AWS Access key ID.

Returns:

  • (String, nil)

    the configured AWS Access key ID



15
16
17
# File 'lib/conrad/emitters/amazon_base.rb', line 15

def access_key_id
  @access_key_id
end

#clientAws::SQS::Client

Returns the created client.

Returns:

  • (Aws::SQS::Client)

    the created client



22
23
24
# File 'lib/conrad/emitters/amazon_base.rb', line 22

def client
  @client
end

#regionString?

Returns the configured region.

Returns:

  • (String, nil)

    the configured region



11
12
13
# File 'lib/conrad/emitters/amazon_base.rb', line 11

def region
  @region
end

#secret_access_keyString?

Deprecated.

Will be removed in 3.0.0, no migration path

Returns the configured AWS secret access key.

Returns:

  • (String, nil)

    the configured AWS secret access key



19
20
21
# File 'lib/conrad/emitters/amazon_base.rb', line 19

def secret_access_key
  @secret_access_key
end