class OCI::Auth::Signers::RptPathProvider::DefaultRptPathProvider

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

Public Class Methods

new(metadata_url: nil) click to toggle source
# File lib/oci/auth/signers/resource_principal_token_path_provider/default_rpt_path_provider.rb, line 17
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(metadata_url) unless metadata_url.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

Public Instance Methods

replacement_dict() click to toggle source
# File lib/oci/auth/signers/resource_principal_token_path_provider/default_rpt_path_provider.rb, line 26
def replacement_dict
  { 'id' => @id }
end