class Pvcglue::CloudProviders
Public Class Methods
init(provider_options)
click to toggle source
REQUIRED_OPTIONS = []
# File lib/pvcglue/cloud_providers.rb, line 6 def self.init(provider_options) @options = provider_options @name = provider_options.name if provider_options.name == 'digital-ocean' Pvcglue.logger.debug("Digital Ocean provider initialized for '#{provider_options.name}'.") Pvcglue::CloudProviders::DigitalOcean.new(provider_options) elsif provider_options.name == 'linode' Pvcglue.logger.debug("Linode provider initialized for '#{provider_options.name}'.") Pvcglue::CloudProviders::Linode.new(provider_options) else raise(Thor::Error, "Cloud Provider '#{provider_options.name}' not supported, use 'manual' mode.") end end
Public Instance Methods
name()
click to toggle source
# File lib/pvcglue/cloud_providers.rb, line 21 def name @name end
options()
click to toggle source
# File lib/pvcglue/cloud_providers.rb, line 25 def options @options end
validate_options!(options, required)
click to toggle source
# File lib/pvcglue/cloud_providers.rb, line 29 def validate_options!(options, required) errors = [] required.each { |option_name| errors << "#{option_name} required" unless options[option_name] } raise("Errors: #{errors.join(', ')}.") if errors.any? end