class Openstack::QuantumClient::Network

Public Class Methods

new(quantum_url) click to toggle source
# File lib/openstack-quantum-client/l2l3/network.rb, line 4
def initialize(quantum_url)
  @quantum_url = quantum_url
end

Public Instance Methods

create(name) click to toggle source
# File lib/openstack-quantum-client/l2l3/network.rb, line 8
def create(name)
  full_url = "#{@quantum_url}/networks.json"
  post_to_quantum(full_url, {"network" => {"name" => name}})
end
find_or_create_by_name(network_name) click to toggle source
# File lib/openstack-quantum-client/l2l3/network.rb, line 21
def find_or_create_by_name(network_name)
  networks = list(:name => network_name)["networks"]
  if networks.empty?
    create(network_name)
  end
  list(:name => network_name)["networks"].last
end
list(filters={}) click to toggle source
# File lib/openstack-quantum-client/l2l3/network.rb, line 13
def list(filters={})
  HTTParty.get("#{@quantum_url}/networks.json", :query => filters)
end
show(id) click to toggle source
# File lib/openstack-quantum-client/l2l3/network.rb, line 17
def show(id)
  HTTParty.get("#{@quantum_url}/networks/#{id}.json")
end