Class: OvirtSDK4::OpenstackNetworkService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::OpenstackNetworkService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (OpenStackNetwork) get(opts = {})
Returns the representation of the object managed by this service.
-
- (Object) import(opts = {})
This operation imports an external network into oVirt.
-
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (OpenstackSubnetsService) subnets_service
Locates the
subnets
service. -
- (String) to_s
Returns an string representation of this service.
Instance Method Details
- (OpenStackNetwork) get(opts = {})
Returns the representation of the object managed by this service.
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.
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.
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.
13789 13790 13791 |
# File 'lib/ovirtsdk4/services.rb', line 13789 def to_s return "#<#{OpenstackNetworkService}:#{@path}>" end |