Class: OvirtSDK4::MacPoolService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::MacPoolService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (MacPool) get(opts = {})
Returns the representation of the object managed by this service.
-
- (Object) remove(opts = {})
Deletes the object managed by this service.
-
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (String) to_s
Returns an string representation of this service.
-
- (Object) update(pool)
Updates the object managed by this service.
Instance Method Details
- (MacPool) get(opts = {})
Returns the representation of the object managed by this service.
11995 11996 11997 11998 11999 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 |
# File 'lib/ovirtsdk4/services.rb', line 11995 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 MacPoolReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Object) remove(opts = {})
Deletes the object managed by this service.
12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 |
# File 'lib/ovirtsdk4/services.rb', line 12019 def remove(opts = {}) query = {} value = opts[:async] unless value.nil? value = Writer.render_boolean(value) query['async'] = value end request = Request.new(:method => :DELETE, :path => @path, :query => query) response = @connection.send(request) unless response.code == 200 check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
12070 12071 12072 12073 12074 12075 |
# File 'lib/ovirtsdk4/services.rb', line 12070 def service(path) if path.nil? || path == '' return self end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |
- (String) to_s
Returns an string representation of this service.
12082 12083 12084 |
# File 'lib/ovirtsdk4/services.rb', line 12082 def to_s return "#<#{MacPoolService}:#{@path}>" end |
- (Object) update(pool)
Updates the object managed by this service.
12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 |
# File 'lib/ovirtsdk4/services.rb', line 12036 def update(pool) if pool.is_a?(Hash) pool = OvirtSDK4::MacPool.new(pool) end request = Request.new(:method => :PUT, :path => @path) begin writer = XmlWriter.new(nil, true) MacPoolWriter.write_one(pool, writer, 'pool') request.body = writer.string ensure writer.close end response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return MacPoolReader.read_one(reader) ensure reader.close end return result else check_fault(response) end end |