Class: Fog::NFV::HuaweiCloud::Real
- Inherits:
-
Object
- Object
- Fog::NFV::HuaweiCloud::Real
- Includes:
- HuaweiCloud::Core
- Defined in:
- lib/fog/nfv/huaweicloud.rb,
lib/fog/nfv/huaweicloud/requests/get_vnf.rb,
lib/fog/nfv/huaweicloud/requests/get_vnfd.rb,
lib/fog/nfv/huaweicloud/requests/list_vnfs.rb,
lib/fog/nfv/huaweicloud/requests/create_vnf.rb,
lib/fog/nfv/huaweicloud/requests/delete_vnf.rb,
lib/fog/nfv/huaweicloud/requests/list_vnfds.rb,
lib/fog/nfv/huaweicloud/requests/update_vnf.rb,
lib/fog/nfv/huaweicloud/requests/create_vnfd.rb,
lib/fog/nfv/huaweicloud/requests/delete_vnfd.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_vnf(options) ⇒ Object
- #create_vnfd(options) ⇒ Object
- #delete_vnf(vnf_id) ⇒ Object
- #delete_vnfd(vnfd_id) ⇒ Object
- #get_vnf(vnf_id) ⇒ Object
- #get_vnfd(vnfd_id) ⇒ Object
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
- #list_vnfds(options = {}) ⇒ Object
- #list_vnfs(options = {}) ⇒ Object
- #set_api_path ⇒ Object
- #update_vnf(id, options) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/fog/nfv/huaweicloud.rb', line 105 def initialize( = {}) initialize_identity @huaweicloud_service_type = [:huaweicloud_service_type] || ['servicevm'] @huaweicloud_service_name = [:huaweicloud_service_name] = [:connection_options] || {} authenticate set_api_path @persistent = [:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, ) end |
Class Method Details
.not_found_class ⇒ Object
101 102 103 |
# File 'lib/fog/nfv/huaweicloud.rb', line 101 def self.not_found_class Fog::NFV::HuaweiCloud::NotFound end |
Instance Method Details
#create_vnf(options) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fog/nfv/huaweicloud/requests/create_vnf.rb', line 5 def create_vnf() = [ :auth, :vnf, ] # Filter only allowed creation attributes data = .select do |key, _| .include?(key.to_sym) || .include?(key.to_s) end request( :body => Fog::JSON.encode(data), :expects => 201, :method => "POST", :path => "vnfs" ) end |
#create_vnfd(options) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fog/nfv/huaweicloud/requests/create_vnfd.rb', line 5 def create_vnfd() = [ :auth, :vnfd, ] # Filter only allowed creation attributes data = .select do |key, _| .include?(key.to_sym) || .include?(key.to_s) end request( :body => Fog::JSON.encode(data), :expects => 201, :method => "POST", :path => "vnfds" ) end |
#delete_vnf(vnf_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/nfv/huaweicloud/requests/delete_vnf.rb', line 5 def delete_vnf(vnf_id) request( :expects => 204, :method => "DELETE", :path => "vnfs/#{vnf_id}" ) end |
#delete_vnfd(vnfd_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/nfv/huaweicloud/requests/delete_vnfd.rb', line 5 def delete_vnfd(vnfd_id) request( :expects => 204, :method => "DELETE", :path => "vnfds/#{vnfd_id}" ) end |
#get_vnf(vnf_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/nfv/huaweicloud/requests/get_vnf.rb', line 5 def get_vnf(vnf_id) request( :expects => 200, :method => 'GET', :path => "vnfs/#{vnf_id}" ) end |
#get_vnfd(vnfd_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/nfv/huaweicloud/requests/get_vnfd.rb', line 5 def get_vnfd(vnfd_id) request( :expects => 200, :method => 'GET', :path => "vnfds/#{vnfd_id}" ) end |
#list_vnfds(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/nfv/huaweicloud/requests/list_vnfds.rb', line 5 def list_vnfds( = {}) request( :expects => 200, :method => 'GET', :path => "vnfds", :query => ) end |
#list_vnfs(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/nfv/huaweicloud/requests/list_vnfs.rb', line 5 def list_vnfs( = {}) request( :expects => 200, :method => 'GET', :path => "vnfs", :query => ) end |
#set_api_path ⇒ Object
120 121 122 123 124 125 126 127 128 129 |
# File 'lib/fog/nfv/huaweicloud.rb', line 120 def set_api_path unless @path.match(SUPPORTED_VERSIONS) @path = "/" + Fog::HuaweiCloud.get_supported_version( SUPPORTED_VERSIONS, @huaweicloud_management_uri, @auth_token, ) end end |
#update_vnf(id, options) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fog/nfv/huaweicloud/requests/update_vnf.rb', line 5 def update_vnf(id, ) = [ :auth, :vnf, ] # Filter only allowed creation attributes data = .select do |key, _| .include?(key.to_sym) || .include?(key.to_s) end request( :body => Fog::JSON.encode(data), :expects => 200, :method => "PUT", :path => "vnfs/#{id}" ) end |