Class: Asherah::Config
- Inherits:
-
Object
- Object
- Asherah::Config
- Defined in:
- lib/asherah/config.rb
Constant Summary collapse
- MAPPING =
{ service_name: :ServiceName, product_id: :ProductID, kms: :KMS, metastore: :Metastore, connection_string: :ConnectionString, replica_read_consistency: :ReplicaReadConsistency, sql_metastore_db_type: :SQLMetastoreDBType, dynamo_db_endpoint: :DynamoDBEndpoint, dynamo_db_region: :DynamoDBRegion, dynamo_db_table_name: :DynamoDBTableName, enable_region_suffix: :EnableRegionSuffix, region_map: :RegionMap, preferred_region: :PreferredRegion, session_cache_max_size: :SessionCacheMaxSize, session_cache_duration: :SessionCacheDuration, enable_session_caching: :EnableSessionCaching, expire_after: :ExpireAfter, check_interval: :CheckInterval, verbose: :Verbose }.freeze
- KMS_TYPES =
['static', 'aws', 'test-debug-static'].freeze
- METASTORE_TYPES =
['rdbms', 'dynamodb', 'memory', 'test-debug-memory'].freeze
- SQL_METASTORE_DB_TYPES =
['mysql', 'postgres', 'oracle'].freeze
Instance Attribute Summary collapse
-
#check_interval, ⇒ Integer
The amount of time in seconds before cached keys are considered stale.
-
#connection_string, ⇒ String
The database connection string (required when metastore is rdbms).
-
#dynamo_db_endpoint, ⇒ String
An optional endpoint URL (for dynamodb metastore).
-
#dynamo_db_region, ⇒ String
The AWS region for DynamoDB requests (for dynamodb metastore).
-
#dynamo_db_table_name, ⇒ String
The table name for DynamoDB (for dynamodb metastore).
-
#enable_region_suffix, ⇒ Boolean
Configure the metastore to use regional suffixes (for dynamodb metastore).
-
#enable_session_caching, ⇒ Boolean
Enable shared session caching.
-
#expire_after, ⇒ Integer
The amount of time in seconds a key is considered valid.
-
#kms, ⇒ String
The master key management service (static or aws).
-
#metastore, ⇒ String
The type of metastore for persisting keys (rdbms, dynamodb, memory).
-
#preferred_region, ⇒ String
The preferred AWS region (required for aws kms).
-
#product_id, ⇒ String
The name of the product that owns this service.
-
#region_map, ⇒ String
List of key-value pairs in the form of REGION1=ARN1 (required for aws kms).
-
#replica_read_consistency, ⇒ String
For Aurora sessions using write forwarding (eventual, global, session).
-
#service_name, ⇒ String
The name of this service.
-
#session_cache_duration, ⇒ Integer
The amount of time in seconds a session will remain cached.
-
#session_cache_max_size, ⇒ Integer
The maximum number of sessions to cache.
-
#sql_metastore_db_type, ⇒ String
Which SQL driver to use (mysql, postgres, oracle), defaults to mysql.
-
#verbose, ⇒ Boolean
Enable verbose logging output.
Instance Method Summary collapse
Instance Attribute Details
#check_interval, ⇒ Integer
The amount of time in seconds before cached keys are considered stale
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def check_interval,
@check_interval,
end
|
#connection_string, ⇒ String
The database connection string (required when metastore is rdbms)
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def connection_string,
@connection_string,
end
|
#dynamo_db_endpoint, ⇒ String
An optional endpoint URL (for dynamodb metastore)
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def dynamo_db_endpoint,
@dynamo_db_endpoint,
end
|
#dynamo_db_region, ⇒ String
The AWS region for DynamoDB requests (for dynamodb metastore)
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def dynamo_db_region,
@dynamo_db_region,
end
|
#dynamo_db_table_name, ⇒ String
The table name for DynamoDB (for dynamodb metastore)
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def dynamo_db_table_name,
@dynamo_db_table_name,
end
|
#enable_region_suffix, ⇒ Boolean
Configure the metastore to use regional suffixes (for dynamodb metastore)
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def enable_region_suffix,
@enable_region_suffix,
end
|
#enable_session_caching, ⇒ Boolean
Enable shared session caching
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def enable_session_caching,
@enable_session_caching,
end
|
#expire_after, ⇒ Integer
The amount of time in seconds a key is considered valid
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def expire_after,
@expire_after,
end
|
#kms, ⇒ String
The master key management service (static or aws)
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def kms,
@kms,
end
|
#metastore, ⇒ String
The type of metastore for persisting keys (rdbms, dynamodb, memory)
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def metastore,
@metastore,
end
|
#preferred_region, ⇒ String
The preferred AWS region (required for aws kms)
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def preferred_region,
@preferred_region,
end
|
#product_id, ⇒ String
The name of the product that owns this service
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def product_id,
@product_id,
end
|
#region_map, ⇒ String
List of key-value pairs in the form of REGION1=ARN1 (required for aws kms)
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def region_map,
@region_map,
end
|
#replica_read_consistency, ⇒ String
For Aurora sessions using write forwarding (eventual, global, session)
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def replica_read_consistency,
@replica_read_consistency,
end
|
#service_name, ⇒ String
The name of this service
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def service_name,
@service_name,
end
|
#session_cache_duration, ⇒ Integer
The amount of time in seconds a session will remain cached
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def session_cache_duration,
@session_cache_duration,
end
|
#session_cache_max_size, ⇒ Integer
The maximum number of sessions to cache
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def session_cache_max_size,
@session_cache_max_size,
end
|
#sql_metastore_db_type, ⇒ String
Which SQL driver to use (mysql, postgres, oracle), defaults to mysql
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def sql_metastore_db_type,
@sql_metastore_db_type,
end
|
#verbose, ⇒ Boolean
Enable verbose logging output
25 26 27 |
# File 'lib/asherah/config.rb', line 25
def verbose,
@verbose,
end
|
Instance Method Details
#to_json(*args) ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/asherah/config.rb', line 63 def to_json(*args) config = {}.tap do |c| MAPPING.each_pair do |our_key, their_key| value = public_send(our_key) c[their_key] = value unless value.nil? end end JSON.generate(config, *args) end |
#validate! ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/asherah/config.rb', line 54 def validate! validate_service_name validate_product_id validate_kms validate_kms_attributes end |