Class: OvirtSDK4::OpenstackNetworkService

Inherits:
Service
  • Object
show all
Defined in:
lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb

Instance Method Summary (collapse)

Instance Method Details

- (OpenStackNetwork) get(opts = {})

Returns the representation of the object managed by this service.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Returns:



13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
# File 'lib/ovirtsdk4/services.rb', line 13715

def get(opts = {})
  query = {}
  request = Request.new(:method => :GET, :path => @path, :query => query)
  response = @connection.send(request)
  case response.code
  when 200
    begin
      reader = XmlReader.new(response.body)
      return OpenStackNetworkReader.read_one(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (Object) import(opts = {})

This operation imports an external network into oVirt. The network will be added to the data center specified.



13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
# File 'lib/ovirtsdk4/services.rb', line 13736

def import(opts = {})
  action = Action.new(opts)
  writer = XmlWriter.new(nil, true)
  ActionWriter.write_one(action, writer)
  body = writer.string
  writer.close
  request = Request.new({
  :method => :POST,
  :path => "#{@path}/import",
  :body => body,
  })
  response = @connection.send(request)
  case response.code
  when 200
    action = check_action(response)
  else
    check_fault(response)
  end
end

- (Service) service(path)

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.

Raises:

  • (Error)


13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
# File 'lib/ovirtsdk4/services.rb', line 13771

def service(path)
  if path.nil? || path == ''
    return self
  end
  if path == 'subnets'
    return subnets_service
  end
  if path.start_with?('subnets/')
    return subnets_service.service(path[8..-1])
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end

- (OpenstackSubnetsService) subnets_service

Locates the subnets service.

Returns:



13760
13761
13762
# File 'lib/ovirtsdk4/services.rb', line 13760

def subnets_service
  return OpenstackSubnetsService.new(@connection, "#{@path}/subnets")
end

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


13789
13790
13791
# File 'lib/ovirtsdk4/services.rb', line 13789

def to_s
  return "#<#{OpenstackNetworkService}:#{@path}>"
end