Class: CORL::Node::Fog
- Inherits:
-
Object
- Object
- CORL::Node::Fog
- Defined in:
- lib/core/plugin/fog_node.rb
Instance Method Summary collapse
- #api_key ⇒ Object
-
#api_key=(api_key) ⇒ Object
—.
- #api_user ⇒ Object
-
#api_user=(api_user) ⇒ Object
—————————————————————————– Property accessors / modifiers.
- #auth_url ⇒ Object
-
#auth_url=(auth_url) ⇒ Object
—.
- #connection_options ⇒ Object
-
#connection_options=(options) ⇒ Object
—.
-
#create(options = {}) ⇒ Object
—————————————————————————– Node operations.
-
#create_image(options = {}) ⇒ Object
—.
-
#destroy(options = {}) ⇒ Object
—.
-
#download(remote_path, local_path, options = {}) ⇒ Object
—.
-
#exec(options = {}) ⇒ Object
—.
-
#exec_options(name, options = {}) ⇒ Object
—.
-
#filter_output(type, data) ⇒ Object
—————————————————————————– Utilities.
-
#key_config ⇒ Object
—.
-
#machine_config ⇒ Object
—————————————————————————– Settings groups.
-
#normalize(reload) ⇒ Object
—————————————————————————– Node plugin interface.
- #region ⇒ Object
- #region=(region) ⇒ Object
-
#regions ⇒ Object
—.
-
#reload(options = {}) ⇒ Object
—.
-
#start(options = {}) ⇒ Object
—.
-
#stop(options = {}) ⇒ Object
—.
-
#upload(local_path, remote_path, options = {}) ⇒ Object
—.
Instance Method Details
#api_key ⇒ Object
46 47 48 |
# File 'lib/core/plugin/fog_node.rb', line 46 def api_key myself[:api_key] end |
#api_key=(api_key) ⇒ Object
42 43 44 |
# File 'lib/core/plugin/fog_node.rb', line 42 def api_key=api_key myself[:api_key] = api_key end |
#api_user ⇒ Object
36 37 38 |
# File 'lib/core/plugin/fog_node.rb', line 36 def api_user myself[:api_user] end |
#api_user=(api_user) ⇒ Object
Property accessors / modifiers
32 33 34 |
# File 'lib/core/plugin/fog_node.rb', line 32 def api_user=api_user myself[:api_user] = api_user end |
#auth_url ⇒ Object
56 57 58 |
# File 'lib/core/plugin/fog_node.rb', line 56 def auth_url myself[:auth_url] end |
#auth_url=(auth_url) ⇒ Object
52 53 54 |
# File 'lib/core/plugin/fog_node.rb', line 52 def auth_url=auth_url myself[:auth_url] = auth_url end |
#connection_options ⇒ Object
66 67 68 |
# File 'lib/core/plugin/fog_node.rb', line 66 def myself[:connection_options] end |
#connection_options=(options) ⇒ Object
62 63 64 |
# File 'lib/core/plugin/fog_node.rb', line 62 def myself[:connection_options] = end |
#create(options = {}) ⇒ Object
Node operations
115 116 117 118 119 120 121 122 123 |
# File 'lib/core/plugin/fog_node.rb', line 115 def create( = {}) super do |op, config| if op == :config config.import((:create)) config.defaults(key_config) end yield(op, config) if block_given? end end |
#create_image(options = {}) ⇒ Object
183 184 185 186 187 188 189 190 |
# File 'lib/core/plugin/fog_node.rb', line 183 def create_image( = {}) super do |op, config| if op == :config config.import((:image)) end yield(op, config) if block_given? end end |
#destroy(options = {}) ⇒ Object
205 206 207 208 209 210 211 212 |
# File 'lib/core/plugin/fog_node.rb', line 205 def destroy( = {}) super do |op, config| if op == :config config.import((:destroy)) end yield(op, config) if block_given? end end |
#download(remote_path, local_path, options = {}) ⇒ Object
127 128 129 130 131 132 133 134 |
# File 'lib/core/plugin/fog_node.rb', line 127 def download(remote_path, local_path, = {}) super do |op, config| if op == :config config.import((:download)) end yield(op, config) if block_given? end end |
#exec(options = {}) ⇒ Object
149 150 151 152 153 154 155 156 |
# File 'lib/core/plugin/fog_node.rb', line 149 def exec( = {}) super do |op, config| if op == :config config.import((:exec)) end yield(op, config) if block_given? end end |
#exec_options(name, options = {}) ⇒ Object
108 109 110 |
# File 'lib/core/plugin/fog_node.rb', line 108 def (name, = {}) extended_config(name, ).export end |
#filter_output(type, data) ⇒ Object
Utilities
217 218 219 |
# File 'lib/core/plugin/fog_node.rb', line 217 def filter_output(type, data) super end |
#key_config ⇒ Object
102 103 104 |
# File 'lib/core/plugin/fog_node.rb', line 102 def key_config { :private_key_path => private_key, :public_key_path => public_key } end |
#machine_config ⇒ Object
Settings groups
93 94 95 96 97 98 |
# File 'lib/core/plugin/fog_node.rb', line 93 def machine_config super do |config| config[:connection_options] = if yield(config) if block_given? end end |
#normalize(reload) ⇒ Object
Node plugin interface
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/core/plugin/fog_node.rb', line 13 def normalize(reload) super myself.region = region unless reload machine_provider = :fog machine_provider = yield if block_given? myself.machine = create_machine(:machine, machine_provider, machine_config) end end |
#region ⇒ Object
80 81 82 83 84 85 86 87 88 |
# File 'lib/core/plugin/fog_node.rb', line 80 def region if region = myself[:region] region else first_region = regions.first myself.region = first_region first_region end end |
#region=(region) ⇒ Object
76 77 78 |
# File 'lib/core/plugin/fog_node.rb', line 76 def region=region myself[:region] = region end |
#regions ⇒ Object
72 73 74 |
# File 'lib/core/plugin/fog_node.rb', line 72 def regions [] end |
#reload(options = {}) ⇒ Object
172 173 174 175 176 177 178 179 |
# File 'lib/core/plugin/fog_node.rb', line 172 def reload( = {}) super do |op, config| if op == :config config.import((:reload)) end yield(op, config) if block_given? end end |
#start(options = {}) ⇒ Object
160 161 162 163 164 165 166 167 168 |
# File 'lib/core/plugin/fog_node.rb', line 160 def start( = {}) super do |op, config| if op == :config config.import((:start)) config.defaults(key_config) end yield(op, config) if block_given? end end |
#stop(options = {}) ⇒ Object
194 195 196 197 198 199 200 201 |
# File 'lib/core/plugin/fog_node.rb', line 194 def stop( = {}) super do |op, config| if op == :config config.import((:stop)) end yield(op, config) if block_given? end end |
#upload(local_path, remote_path, options = {}) ⇒ Object
138 139 140 141 142 143 144 145 |
# File 'lib/core/plugin/fog_node.rb', line 138 def upload(local_path, remote_path, = {}) super do |op, config| if op == :config config.import((:upload)) end yield(op, config) if block_given? end end |