Class: Xmonitor::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/xmonitor/config.rb

Constant Summary collapse

KEY_REGION =
'region'
KEY_STREAM_NAME =
'stream_name'
KEY_ACCESS_KEY_ID =
'access_key_id'
KEY_SECRET_ACCESS_KEY =
'secret_access_key'
KEY_ATHENA_DATABASE =
'athena_database'
KEY_ATHENA_S3_BUCKET =
'athena_s3_bucket'
KEY_ATHENA_TABLE_NAME =
'athena_table_name'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Config

Returns a new instance of Config.



18
19
20
# File 'lib/xmonitor/config.rb', line 18

def initialize(*args)
  @region, @stream_name, @access_key_id, @secret_access_key, @athena_database, @athena_s3_bucket, @athena_table_name = *args
end

Instance Attribute Details

#access_key_idObject (readonly)

Returns the value of attribute access_key_id.



2
3
4
# File 'lib/xmonitor/config.rb', line 2

def access_key_id
  @access_key_id
end

#athena_databaseObject (readonly)

Returns the value of attribute athena_database.



2
3
4
# File 'lib/xmonitor/config.rb', line 2

def athena_database
  @athena_database
end

#athena_s3_bucketObject (readonly)

Returns the value of attribute athena_s3_bucket.



2
3
4
# File 'lib/xmonitor/config.rb', line 2

def athena_s3_bucket
  @athena_s3_bucket
end

#athena_table_nameObject (readonly)

Returns the value of attribute athena_table_name.



2
3
4
# File 'lib/xmonitor/config.rb', line 2

def athena_table_name
  @athena_table_name
end

#regionObject (readonly)

Returns the value of attribute region.



2
3
4
# File 'lib/xmonitor/config.rb', line 2

def region
  @region
end

#secret_access_keyObject (readonly)

Returns the value of attribute secret_access_key.



2
3
4
# File 'lib/xmonitor/config.rb', line 2

def secret_access_key
  @secret_access_key
end

#stream_nameObject (readonly)

Returns the value of attribute stream_name.



2
3
4
# File 'lib/xmonitor/config.rb', line 2

def stream_name
  @stream_name
end

Class Method Details

.from_yaml(path) ⇒ Object



12
13
14
15
16
# File 'lib/xmonitor/config.rb', line 12

def self.from_yaml(path)
  yaml = YAML.load(File.read(path))

  self.new(yaml[KEY_REGION], yaml[KEY_STREAM_NAME], yaml[KEY_ACCESS_KEY_ID], yaml[KEY_SECRET_ACCESS_KEY], yaml[KEY_ATHENA_DATABASE], yaml[KEY_ATHENA_S3_BUCKET], yaml[KEY_ATHENA_TABLE_NAME])
end