Class: Misty::Cloud
- Inherits:
-
Object
- Object
- Misty::Cloud
- Defined in:
- lib/misty/cloud.rb
Defined Under Namespace
Classes: Config
Class Method Summary collapse
Instance Method Summary collapse
- #alarming ⇒ Object
- #baremetal ⇒ Object
- #block_storage ⇒ Object (also: #volume)
- #build_service(service_name) ⇒ Object
- #clustering ⇒ Object
- #compute ⇒ Object
- #container ⇒ Object
- #data_processing ⇒ Object
- #data_protection ⇒ Object
- #database ⇒ Object
- #dns ⇒ Object
- #identity ⇒ Object
- #image ⇒ Object
-
#initialize(params) ⇒ Cloud
constructor
=> {}).
- #messaging ⇒ Object
- #metering ⇒ Object
- #network ⇒ Object
- #object_storage ⇒ Object
- #orchestration ⇒ Object
- #search ⇒ Object
- #shared_file_systems ⇒ Object
Constructor Details
#initialize(params) ⇒ Cloud
=> {})
14 15 16 17 18 19 |
# File 'lib/misty/cloud.rb', line 14 def initialize(params)# = {:auth => {}}) @params = params @config = self.class.set_configuration(params) @services = Misty.services @auth = Misty::Auth.factory(params[:auth], @config) end |
Class Method Details
.dot_to_underscore(val) ⇒ Object
10 11 12 |
# File 'lib/misty/cloud.rb', line 10 def self.dot_to_underscore(val) val.gsub(/\./,'_') end |
.set_configuration(params) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/misty/cloud.rb', line 21 def self.set_configuration(params) config = Config.new config.content_type = params[:content_type] ? params[:content_type] : Misty::CONTENT_TYPE config.interface = params[:interface] ? params[:interface] : Misty::INTERFACE config.log = Logger.new(params[:log_file] ? params[:log_file] : Misty::LOG_FILE) config.log.level = params[:log_level] ? params[:log_level] : Misty::LOG_LEVEL config.region_id = params[:region_id] ? params[:region_id] : Misty::REGION_ID config.ssl_verify_mode = params.key?(:ssl_verify_mode) ? params[:ssl_verify_mode] : Misty::SSL_VERIFY_MODE config end |
Instance Method Details
#alarming ⇒ Object
41 42 43 |
# File 'lib/misty/cloud.rb', line 41 def alarming @alarming ||= build_service(:alarming) end |
#baremetal ⇒ Object
45 46 47 |
# File 'lib/misty/cloud.rb', line 45 def ||= build_service(:baremetal) end |
#block_storage ⇒ Object Also known as: volume
49 50 51 |
# File 'lib/misty/cloud.rb', line 49 def block_storage @block_storage ||= build_service(:block_storage) end |
#build_service(service_name) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/misty/cloud.rb', line 32 def build_service(service_name) service = @services.find {|service| service.name == service_name} service. = @params[service.name] if @params[service.name] service.version = service.[:api_version] version = self.class.dot_to_underscore(service.version) klass = Object.const_get("Misty::Openstack::#{service.project.capitalize}::#{version.capitalize}") klass.new(@auth, @config, service.) end |
#clustering ⇒ Object
55 56 57 |
# File 'lib/misty/cloud.rb', line 55 def clustering @clustering ||= build_service(:clustering) end |
#compute ⇒ Object
59 60 61 |
# File 'lib/misty/cloud.rb', line 59 def compute @compute ||= build_service(:compute) end |
#container ⇒ Object
63 64 65 |
# File 'lib/misty/cloud.rb', line 63 def container @container ||= build_service(:container) end |
#data_processing ⇒ Object
67 68 69 |
# File 'lib/misty/cloud.rb', line 67 def data_processing @data_processing ||= build_service(:data_processing) end |
#data_protection ⇒ Object
71 72 73 |
# File 'lib/misty/cloud.rb', line 71 def data_protection @data_protection ||= build_service(:data_protection) end |
#database ⇒ Object
75 76 77 |
# File 'lib/misty/cloud.rb', line 75 def database @database ||= build_service(:database) end |
#dns ⇒ Object
79 80 81 |
# File 'lib/misty/cloud.rb', line 79 def dns @dns ||= build_service(:dns) end |
#identity ⇒ Object
83 84 85 |
# File 'lib/misty/cloud.rb', line 83 def identity @identity ||= build_service(:identity) end |
#image ⇒ Object
87 88 89 |
# File 'lib/misty/cloud.rb', line 87 def image @image ||= build_service(:image) end |
#messaging ⇒ Object
91 92 93 |
# File 'lib/misty/cloud.rb', line 91 def messaging @messaging ||= build_service(:messaging) end |
#metering ⇒ Object
95 96 97 |
# File 'lib/misty/cloud.rb', line 95 def metering @metering ||= build_service(:metering) end |
#network ⇒ Object
99 100 101 |
# File 'lib/misty/cloud.rb', line 99 def network @network ||= build_service(:network) end |
#object_storage ⇒ Object
103 104 105 |
# File 'lib/misty/cloud.rb', line 103 def object_storage @object_storage ||= build_service(:object_storage) end |
#orchestration ⇒ Object
107 108 109 |
# File 'lib/misty/cloud.rb', line 107 def orchestration @orchestration ||= build_service(:orchestration) end |
#search ⇒ Object
111 112 113 |
# File 'lib/misty/cloud.rb', line 111 def search @search ||= build_service(:search) end |
#shared_file_systems ⇒ Object
115 116 117 |
# File 'lib/misty/cloud.rb', line 115 def shared_file_systems @shared_file_systems ||= build_service(:shared_file_systems) end |