Module: HybridPlatformsConductor::Credentials::ConfigDSLExtension
- Defined in:
- lib/hybrid_platforms_conductor/credentials.rb
Overview
Extend the Config DSL
Instance Attribute Summary collapse
-
#credentials ⇒ Object
readonly
List of credentials.
Instance Method Summary collapse
-
#credentials_for(credential_id, resource: /.*/, &provider) ⇒ Object
Define a credentials provider.
-
#init_credentials_config ⇒ Object
Mixin initializer.
Instance Attribute Details
#credentials ⇒ Object (readonly)
List of credentials. Each info has the following properties:
-
credential_id (Symbol): Credential ID this rule applies to
-
resource (Regexp): Resource filtering for this rule
-
provider (Proc): The code providing the credentials:
- Parameters
-
resource (String or nil): The resource for which we want credentials, or nil if none
-
requester (Proc): Code to be called to give credentials to:
- Parameters
-
user (String or nil): The user name, or nil if none
-
password (String or nil): The password, or nil if none
29 30 31 |
# File 'lib/hybrid_platforms_conductor/credentials.rb', line 29 def credentials @credentials end |
Instance Method Details
#credentials_for(credential_id, resource: /.*/, &provider) ⇒ Object
Define a credentials provider
- Parameters
-
credential_id (Symbol): Credential ID this rule applies to
-
resource (String or Regexp): Resource filtering for this rule [default: /.*/]
-
provider (Proc): The code providing the credentials:
- Parameters
-
resource (String or nil): The resource for which we want credentials, or nil if none
-
requester (Proc): Code to be called to give credentials to:
- Parameters
-
user (String or nil): The user name, or nil if none
-
password (String or nil): The password, or nil if none
48 49 50 51 52 53 54 |
# File 'lib/hybrid_platforms_conductor/credentials.rb', line 48 def credentials_for(credential_id, resource: /.*/, &provider) @credentials << { credential_id: credential_id, resource: resource.is_a?(String) ? /^#{Regexp.escape(resource)}$/ : resource, provider: provider } end |
#init_credentials_config ⇒ Object
Mixin initializer
32 33 34 |
# File 'lib/hybrid_platforms_conductor/credentials.rb', line 32 def init_credentials_config @credentials = [] end |