Class: OvirtSDK4::QuotaStorageLimitsService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::QuotaStorageLimitsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (QuotaStorageLimit) add(limit, opts = {})
Adds a new
limit
. -
- (QuotaStorageLimitService) limit_service(id)
Locates the
limit
service. -
- (Array<QuotaStorageLimit>) list(opts = {})
Returns the representation of 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.
Instance Method Details
- (QuotaStorageLimit) add(limit, opts = {})
Adds a new limit
.
16265 16266 16267 16268 16269 16270 16271 16272 16273 16274 16275 16276 16277 16278 16279 16280 16281 16282 16283 16284 16285 16286 16287 16288 16289 |
# File 'lib/ovirtsdk4/services.rb', line 16265 def add(limit, opts = {}) if limit.is_a?(Hash) limit = OvirtSDK4::QuotaStorageLimit.new(limit) end request = Request.new(:method => :POST, :path => @path) begin writer = XmlWriter.new(nil, true) QuotaStorageLimitWriter.write_one(limit, writer, 'limit') request.body = writer.string ensure writer.close end response = @connection.send(request) case response.code when 201, 202 begin reader = XmlReader.new(response.body) return QuotaStorageLimitReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (QuotaStorageLimitService) limit_service(id)
Locates the limit
service.
16329 16330 16331 |
# File 'lib/ovirtsdk4/services.rb', line 16329 def limit_service(id) return QuotaStorageLimitService.new(@connection, "#{@path}/#{id}") end |
- (Array<QuotaStorageLimit>) list(opts = {})
Returns the representation of the object managed by this service.
16300 16301 16302 16303 16304 16305 16306 16307 16308 16309 16310 16311 16312 16313 16314 16315 16316 16317 16318 16319 16320 |
# File 'lib/ovirtsdk4/services.rb', line 16300 def list(opts = {}) query = {} value = opts[:max] unless value.nil? value = Writer.render_integer(value) query['max'] = value end 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 QuotaStorageLimitReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
16340 16341 16342 16343 16344 16345 16346 16347 16348 16349 |
# File 'lib/ovirtsdk4/services.rb', line 16340 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return limit_service(path) end return limit_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (String) to_s
Returns an string representation of this service.
16356 16357 16358 |
# File 'lib/ovirtsdk4/services.rb', line 16356 def to_s return "#<#{QuotaStorageLimitsService}:#{@path}>" end |