mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Updated the BlockStorage namespace to be Fog::HP::BlockStorage.
This commit is contained in:
parent
0eee1b4361
commit
224d85565a
18 changed files with 49 additions and 75 deletions
|
@ -3,14 +3,14 @@ class HP < Fog::Bin
|
|||
|
||||
def class_for(key)
|
||||
case key
|
||||
when :block_storage
|
||||
Fog::HP::BlockStorage
|
||||
when :cdn
|
||||
Fog::CDN::HP
|
||||
when :compute
|
||||
Fog::Compute::HP
|
||||
when :storage
|
||||
Fog::Storage::HP
|
||||
when :block_storage
|
||||
Fog::BlockStorage::HP
|
||||
else
|
||||
# @todo Replace most instances of ArgumentError with NotImplementedError
|
||||
# @todo For a list of widely supported Exceptions, see:
|
||||
|
@ -22,6 +22,8 @@ class HP < Fog::Bin
|
|||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
hash[key] = case key
|
||||
when :block_storage
|
||||
Fog::HP::BlockStorage.new
|
||||
when :cdn
|
||||
Fog::Logger.warning("HP[:cdn] is deprecated, use CDN[:hp] instead")
|
||||
Fog::CDN.new(:provider => 'HP')
|
||||
|
@ -31,9 +33,6 @@ class HP < Fog::Bin
|
|||
when :storage
|
||||
Fog::Logger.warning("HP[:storage] is deprecated, use Storage[:hp] instead")
|
||||
Fog::Storage.new(:provider => 'HP')
|
||||
when :block_storage
|
||||
Fog::Logger.warning("HP[:block_storage] is deprecated, use BlockStorage[:hp] instead")
|
||||
Fog::BlockStorage.new(:provider => 'HP')
|
||||
else
|
||||
raise ArgumentError, "Unrecognized service: #{key.inspect}"
|
||||
end
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
|
||||
def self.[](provider)
|
||||
self.new(:provider => provider)
|
||||
end
|
||||
|
||||
def self.new(attributes)
|
||||
attributes = attributes.dup # Prevent delete from having side effects
|
||||
case provider = attributes.delete(:provider).to_s.downcase.to_sym
|
||||
when :hp
|
||||
require 'fog/hp/block_storage'
|
||||
Fog::BlockStorage::HP.new(attributes)
|
||||
else
|
||||
raise ArgumentError.new("#{provider} is not a recognized block storage provider")
|
||||
end
|
||||
end
|
||||
|
||||
def self.providers
|
||||
Fog.services[:block_storage]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,9 +1,8 @@
|
|||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'hp'))
|
||||
require 'fog/block_storage'
|
||||
|
||||
module Fog
|
||||
module BlockStorage
|
||||
class HP < Fog::Service
|
||||
module HP
|
||||
class BlockStorage < Fog::Service
|
||||
|
||||
requires :hp_secret_key, :hp_account_id, :hp_tenant_id, :hp_avl_zone
|
||||
recognizes :hp_auth_uri, :persistent, :connection_options, :hp_use_upass_auth_style, :hp_auth_version, :user_agent
|
||||
|
@ -133,7 +132,7 @@ module Fog
|
|||
rescue Excon::Errors::HTTPStatusError => error
|
||||
raise case error
|
||||
when Excon::Errors::NotFound
|
||||
Fog::BlockStorage::HP::NotFound.slurp(error)
|
||||
Fog::HP::BlockStorage::NotFound.slurp(error)
|
||||
else
|
||||
error
|
||||
end
|
||||
|
|
|
@ -2,12 +2,12 @@ require 'fog/core/collection'
|
|||
require 'fog/hp/models/block_storage/volume'
|
||||
|
||||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
|
||||
class BootableVolumes < Fog::Collection
|
||||
|
||||
model Fog::BlockStorage::HP::Volume
|
||||
model Fog::HP::BlockStorage::Volume
|
||||
|
||||
def all
|
||||
data = connection.list_bootable_volumes.body['volumes']
|
||||
|
@ -17,7 +17,7 @@ module Fog
|
|||
def get(volume_id)
|
||||
volume = connection.get_bootable_volume_details(volume_id).body['volume']
|
||||
new(volume)
|
||||
rescue Fog::BlockStorage::HP::NotFound
|
||||
rescue Fog::HP::BlockStorage::NotFound
|
||||
nil
|
||||
end
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
require 'fog/core/model'
|
||||
|
||||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
|
||||
class Snapshot < Fog::Model
|
||||
|
||||
|
|
|
@ -2,12 +2,12 @@ require 'fog/core/collection'
|
|||
require 'fog/hp/models/block_storage/snapshot'
|
||||
|
||||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
|
||||
class Snapshots < Fog::Collection
|
||||
|
||||
model Fog::BlockStorage::HP::Snapshot
|
||||
model Fog::HP::BlockStorage::Snapshot
|
||||
|
||||
def all
|
||||
data = connection.list_snapshots.body['snapshots']
|
||||
|
@ -18,7 +18,7 @@ module Fog
|
|||
if snapshot = connection.get_snapshot_details(snapshot_id).body['snapshot']
|
||||
new(snapshot)
|
||||
end
|
||||
rescue Fog::BlockStorage::HP::NotFound
|
||||
rescue Fog::HP::BlockStorage::NotFound
|
||||
nil
|
||||
end
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
require 'fog/core/model'
|
||||
|
||||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
|
||||
class Volume < Fog::Model
|
||||
|
||||
|
|
|
@ -2,12 +2,12 @@ require 'fog/core/collection'
|
|||
require 'fog/hp/models/block_storage/volume'
|
||||
|
||||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
|
||||
class Volumes < Fog::Collection
|
||||
|
||||
model Fog::BlockStorage::HP::Volume
|
||||
model Fog::HP::BlockStorage::Volume
|
||||
|
||||
def all
|
||||
data = connection.list_volumes.body['volumes']
|
||||
|
@ -17,7 +17,7 @@ module Fog
|
|||
def get(volume_id)
|
||||
volume = connection.get_volume_details(volume_id).body['volume']
|
||||
new(volume)
|
||||
rescue Fog::BlockStorage::HP::NotFound
|
||||
rescue Fog::HP::BlockStorage::NotFound
|
||||
nil
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
class Real
|
||||
|
||||
# Create a new block storage snapshot
|
||||
|
@ -65,7 +65,7 @@ module Fog
|
|||
self.data[:snapshots][data['id']] = data
|
||||
response.body = { 'snapshot' => data }
|
||||
else
|
||||
raise Fog::BlockStorage::HP::NotFound
|
||||
raise Fog::HP::BlockStorage::NotFound
|
||||
end
|
||||
response
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
class Real
|
||||
|
||||
# Create a new block storage volume
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
class Real
|
||||
|
||||
# Delete an existing block storage snapshot
|
||||
|
@ -27,7 +27,7 @@ module Fog
|
|||
self.data[:snapshots].delete(snapshot_id)
|
||||
response.status = 202
|
||||
else
|
||||
raise Fog::BlockStorage::HP::NotFound
|
||||
raise Fog::HP::BlockStorage::NotFound
|
||||
end
|
||||
response
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
class Real
|
||||
|
||||
# Delete an existing block storage volume
|
||||
|
@ -27,7 +27,7 @@ module Fog
|
|||
self.data[:volumes].delete(volume_id)
|
||||
response.status = 202
|
||||
else
|
||||
raise Fog::BlockStorage::HP::NotFound
|
||||
raise Fog::HP::BlockStorage::NotFound
|
||||
end
|
||||
response
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
class Real
|
||||
|
||||
# Get details for existing block storage bootable volume
|
||||
|
@ -48,7 +48,7 @@ module Fog
|
|||
response.body = { 'volume' => volume }
|
||||
response
|
||||
else
|
||||
raise Fog::BlockStorage::HP::NotFound
|
||||
raise Fog::HP::BlockStorage::NotFound
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
class Real
|
||||
|
||||
# Get details for existing block storage snapshot
|
||||
|
@ -43,7 +43,7 @@ module Fog
|
|||
response.body = { 'snapshot' => snapshot }
|
||||
response
|
||||
else
|
||||
raise Fog::BlockStorage::HP::NotFound
|
||||
raise Fog::HP::BlockStorage::NotFound
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
class Real
|
||||
|
||||
# Get details for existing block storage volume
|
||||
|
@ -47,7 +47,7 @@ module Fog
|
|||
response.body = { 'volume' => volume }
|
||||
response
|
||||
else
|
||||
raise Fog::BlockStorage::HP::NotFound
|
||||
raise Fog::HP::BlockStorage::NotFound
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
class Real
|
||||
|
||||
# List existing block storage bootbale volumes
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
class Real
|
||||
|
||||
# List existing block storage snapshots
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
class Real
|
||||
|
||||
# List existing block storage volumes
|
||||
|
|
Loading…
Reference in a new issue