Module: OCI::Auth::Signers::RptPathProvider

Defined in:
lib/oci/auth/signers/resource_principal_token_path_provider/rpt_path_provider.rb,
lib/oci/auth/signers/resource_principal_token_path_provider/env_rpt_path_provider.rb,
lib/oci/auth/signers/resource_principal_token_path_provider/imds_rpt_path_provider.rb,
lib/oci/auth/signers/resource_principal_token_path_provider/string_rpt_path_provider.rb,
lib/oci/auth/signers/resource_principal_token_path_provider/default_rpt_path_provider.rb

Overview

Resource Principal Path Provider Classes under this module will provide the complete path for getting the Resource Principal Token

Defined Under Namespace

Classes: DefaultRptPathProvider, EnvRptPathProvider, ImdsRptPathProvider, RptPathProvider, StringRptPathProvider

Constant Summary collapse

OCI_RESOURCE_PRINCIPAL_RPT_ID =
'OCI_RESOURCE_PRINCIPAL_RPT_ID'.freeze
OCI_RESOURCE_PRINCIPAL_RPT_PATH =
'OCI_RESOURCE_PRINCIPAL_RPT_PATH'.freeze

Class Method Summary collapse

Class Method Details

.instance_id_from_imds(metadata_url_base) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/oci/auth/signers/resource_principal_token_path_provider/rpt_path_provider.rb', line 34

def self.instance_id_from_imds()
  # Get the instance id from the metadata service
  instance_id_endpoint = "#{}/instance/id"
  uri = URI(instance_id_endpoint)
  raw_client = Net::HTTP.new(uri.hostname, uri.port)
  raw_response = nil
  raw_client.request(OCI::Auth::Util.(instance_id_endpoint, 'get')) do |response|
    raw_response = response.body.strip.downcase
    raise 'Get Metadata request failed, response code is: ' + response.code if response.code != '200'
  end
  raw_response
end