Class: Kitchen::Driver::Oci::Config
- Inherits:
-
Object
- Object
- Kitchen::Driver::Oci::Config
- Defined in:
- lib/kitchen/driver/oci/config.rb
Overview
Config class that defines the oci config that will be used for the API calls
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #compartment ⇒ Object
-
#initialize(driver_config) ⇒ Config
constructor
A new instance of Config.
- #oci_config ⇒ Object
Constructor Details
#initialize(driver_config) ⇒ Config
Returns a new instance of Config.
29 30 31 32 |
# File 'lib/kitchen/driver/oci/config.rb', line 29 def initialize(driver_config) setup_driver_config(driver_config) @config = oci_config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
27 28 29 |
# File 'lib/kitchen/driver/oci/config.rb', line 27 def config @config end |
Instance Method Details
#compartment ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/kitchen/driver/oci/config.rb', line 44 def compartment @compartment ||= @compartment_id return @compartment if @compartment raise "must specify either compartment_id or compartment_name" unless [@compartment_id, @compartment_name].any? @compartment ||= compartment_id_by_name(@compartment_name) raise "compartment not found" unless @compartment end |
#oci_config ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/kitchen/driver/oci/config.rb', line 34 def oci_config # OCI::Config is missing this and we're definitely using compartment and security_token_file if specified in the config OCI::Config.class_eval { attr_accessor :security_token_file } if @driver_config[:use_token_auth] conf = config_loader(config_file_location: @driver_config[:oci_config_file], profile_name: @driver_config[:oci_profile_name]) @driver_config[:oci_config].each do |key, value| conf.send("#{key}=", value) unless value.nil? || value.empty? end conf end |