Class: OvirtSDK4::QuotaClusterLimitsService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::QuotaClusterLimitsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (QuotaClusterLimit) add(limit, opts = {})
Adds a new
limit
. -
- (QuotaClusterLimitService) limit_service(id)
Locates the
limit
service. -
- (Array<QuotaClusterLimit>) 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
- (QuotaClusterLimit) add(limit, opts = {})
Adds a new limit
.
16059 16060 16061 16062 16063 16064 16065 16066 16067 16068 16069 16070 16071 16072 16073 16074 16075 16076 16077 16078 16079 16080 16081 16082 16083 |
# File 'lib/ovirtsdk4/services.rb', line 16059 def add(limit, opts = {}) if limit.is_a?(Hash) limit = OvirtSDK4::QuotaClusterLimit.new(limit) end request = Request.new(:method => :POST, :path => @path) begin writer = XmlWriter.new(nil, true) QuotaClusterLimitWriter.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 QuotaClusterLimitReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (QuotaClusterLimitService) limit_service(id)
Locates the limit
service.
16123 16124 16125 |
# File 'lib/ovirtsdk4/services.rb', line 16123 def limit_service(id) return QuotaClusterLimitService.new(@connection, "#{@path}/#{id}") end |
- (Array<QuotaClusterLimit>) list(opts = {})
Returns the representation of the object managed by this service.
16094 16095 16096 16097 16098 16099 16100 16101 16102 16103 16104 16105 16106 16107 16108 16109 16110 16111 16112 16113 16114 |
# File 'lib/ovirtsdk4/services.rb', line 16094 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 QuotaClusterLimitReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
16134 16135 16136 16137 16138 16139 16140 16141 16142 16143 |
# File 'lib/ovirtsdk4/services.rb', line 16134 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.
16150 16151 16152 |
# File 'lib/ovirtsdk4/services.rb', line 16150 def to_s return "#<#{QuotaClusterLimitsService}:#{@path}>" end |