Class: OCI::Auth::Signers::RptPathProvider::DefaultRptPathProvider
- Inherits:
-
RptPathProvider
- Object
- RptPathProvider
- OCI::Auth::Signers::RptPathProvider::DefaultRptPathProvider
- Defined in:
- lib/oci/auth/signers/resource_principal_token_path_provider/default_rpt_path_provider.rb
Overview
This path provider makes sure the behavior happens with the correct fallback. For the path, Use the contents of the OCI_RESOURCE_PRINCIPAL_RPT_PATH environment variable, if set. Otherwise, use the current path: “/20180711/resourcePrincipalToken/id” For the resource id, Use the contents of the OCI_RESOURCE_PRINCIPAL_RPT_ID environment variable, if set. Otherwise, use IMDS to get the instance id This path provider is used when the caller doesn't provide a specific path provider to the resource principals signer
Instance Method Summary collapse
-
#initialize(metadata_url: nil) ⇒ DefaultRptPathProvider
constructor
A new instance of DefaultRptPathProvider.
- #replacement_dict ⇒ Object
Methods inherited from RptPathProvider
Constructor Details
#initialize(metadata_url: nil) ⇒ DefaultRptPathProvider
Returns a new instance of DefaultRptPathProvider.
15 16 17 18 19 20 21 22 |
# File 'lib/oci/auth/signers/resource_principal_token_path_provider/default_rpt_path_provider.rb', line 15 def initialize(metadata_url: nil) @id = ENV[OCI_RESOURCE_PRINCIPAL_RPT_ID] unless ENV[OCI_RESOURCE_PRINCIPAL_RPT_ID].nil? @id ||= OCI::Auth::Signers::RptPathProvider.instance_id_from_imds() unless .nil? raise 'Unable to get OCI_RESOURCE_PRINCIPAL_RPT_ID from env or IMDS service' if @id.nil? template = ENV[OCI_RESOURCE_PRINCIPAL_RPT_PATH] || '/20180711/resourcePrincipalToken/{id}' super(template) end |
Instance Method Details
#replacement_dict ⇒ Object
24 25 26 |
# File 'lib/oci/auth/signers/resource_principal_token_path_provider/default_rpt_path_provider.rb', line 24 def replacement_dict { 'id' => @id } end |