Class: Fog::OpenStack::NFV::Real

Inherits:
Object
  • Object
show all
Includes:
Core
Defined in:
lib/fog/openstack/nfv.rb,
lib/fog/openstack/nfv/requests/get_vnf.rb,
lib/fog/openstack/nfv/requests/get_vnfd.rb,
lib/fog/openstack/nfv/requests/list_vnfs.rb,
lib/fog/openstack/nfv/requests/create_vnf.rb,
lib/fog/openstack/nfv/requests/delete_vnf.rb,
lib/fog/openstack/nfv/requests/list_vnfds.rb,
lib/fog/openstack/nfv/requests/update_vnf.rb,
lib/fog/openstack/nfv/requests/create_vnfd.rb,
lib/fog/openstack/nfv/requests/delete_vnfd.rb

Instance Attribute Summary

Attributes included from Core

#auth_token, #auth_token_expiration, #current_tenant, #current_user, #current_user_id, #openstack_cache_ttl, #openstack_domain_id, #openstack_domain_name, #openstack_identity_api_version, #openstack_project_domain, #openstack_project_domain_id, #openstack_project_id, #openstack_user_domain, #openstack_user_domain_id, #unscoped_token

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Core

#credentials, #initialize, #reload

Class Method Details

.not_found_classObject



100
101
102
# File 'lib/fog/openstack/nfv.rb', line 100

def self.not_found_class
  Fog::OpenStack::NFV::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/openstack/nfv/requests/create_vnf.rb', line 5

def create_vnf(options)
  options_valid = [
    :auth,
    :vnf,
  ]

  # Filter only allowed creation attributes
  data = options.select do |key, _|
    options_valid.include?(key.to_sym) || options_valid.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/openstack/nfv/requests/create_vnfd.rb', line 5

def create_vnfd(options)
  options_valid = [
    :auth,
    :vnfd,
  ]

  # Filter only allowed creation attributes
  data = options.select do |key, _|
    options_valid.include?(key.to_sym) || options_valid.include?(key.to_s)
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 201,
    :method  => "POST",
    :path    => "vnfds"
  )
end

#default_path_prefixObject



104
105
106
# File 'lib/fog/openstack/nfv.rb', line 104

def default_path_prefix
  'v1.0'
end

#default_service_typeObject



108
109
110
# File 'lib/fog/openstack/nfv.rb', line 108

def default_service_type
  %w[servicevm]
end

#delete_vnf(vnf_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/nfv/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/openstack/nfv/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/openstack/nfv/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/openstack/nfv/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/openstack/nfv/requests/list_vnfds.rb', line 5

def list_vnfds(options = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => "vnfds",
    :query   => options
  )
end

#list_vnfs(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/nfv/requests/list_vnfs.rb', line 5

def list_vnfs(options = {})
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => "vnfs",
    :query   => options
  )
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/openstack/nfv/requests/update_vnf.rb', line 5

def update_vnf(id, options)
  options_valid = [
    :auth,
    :vnf,
  ]

  # Filter only allowed creation attributes
  data = options.select do |key, _|
    options_valid.include?(key.to_sym) || options_valid.include?(key.to_s)
  end

  request(
    :body    => Fog::JSON.encode(data),
    :expects => 200,
    :method  => "PUT",
    :path    => "vnfs/#{id}"
  )
end