Class: OvirtSDK4::QuotaService

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

Instance Method Summary collapse

Methods inherited from Service

#inspect, #to_s

Instance Method Details

#get(opts = {}) ⇒ Quota

Retrieves a quota.

An example of retrieving a quota:

GET /ovirt-engine/api/datacenters/123/quotas/456
<quota id="456">
  <name>myquota</name>
  <description>My new quota for virtual machines</description>
  <cluster_hard_limit_pct>20</cluster_hard_limit_pct>
  <cluster_soft_limit_pct>80</cluster_soft_limit_pct>
  <storage_hard_limit_pct>20</storage_hard_limit_pct>
  <storage_soft_limit_pct>80</storage_soft_limit_pct>
</quota>

Parameters:

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

    Additional options.

Options Hash (opts):

  • :follow (String)

    Indicates which inner links should be followed. The objects referenced by these links will be fetched as part of the current request. See here for details.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



18058
18059
18060
# File 'lib/ovirtsdk4/services.rb', line 18058

def get(opts = {})
  internal_get(GET, opts)
end

#permissions_serviceAssignedPermissionsService

Locates the permissions service.

Returns:



18148
18149
18150
# File 'lib/ovirtsdk4/services.rb', line 18148

def permissions_service
  @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')
end

#quota_cluster_limits_serviceQuotaClusterLimitsService

Locates the quota_cluster_limits service.

Returns:



18157
18158
18159
# File 'lib/ovirtsdk4/services.rb', line 18157

def quota_cluster_limits_service
  @quota_cluster_limits_service ||= QuotaClusterLimitsService.new(self, 'quotaclusterlimits')
end

#quota_storage_limits_serviceQuotaStorageLimitsService

Locates the quota_storage_limits service.

Returns:



18166
18167
18168
# File 'lib/ovirtsdk4/services.rb', line 18166

def quota_storage_limits_service
  @quota_storage_limits_service ||= QuotaStorageLimitsService.new(self, 'quotastoragelimits')
end

#remove(opts = {}) ⇒ Object

Delete a quota.

An example of deleting a quota:

DELETE /ovirt-engine/api/datacenters/123-456/quotas/654-321
-0472718ab224 HTTP/1.1
Accept: application/xml
Content-type: application/xml

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the remove should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.



18093
18094
18095
# File 'lib/ovirtsdk4/services.rb', line 18093

def remove(opts = {})
  internal_remove(REMOVE, opts)
end

#service(path) ⇒ Service

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.

Raises:



18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
# File 'lib/ovirtsdk4/services.rb', line 18177

def service(path)
  if path.nil? || path == ''
    return self
  end
  if path == 'permissions'
    return permissions_service
  end
  if path.start_with?('permissions/')
    return permissions_service.service(path[12..-1])
  end
  if path == 'quotaclusterlimits'
    return quota_cluster_limits_service
  end
  if path.start_with?('quotaclusterlimits/')
    return quota_cluster_limits_service.service(path[19..-1])
  end
  if path == 'quotastoragelimits'
    return quota_storage_limits_service
  end
  if path.start_with?('quotastoragelimits/')
    return quota_storage_limits_service.service(path[19..-1])
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end

#update(quota, opts = {}) ⇒ Quota

Updates a quota.

An example of updating a quota:

PUT /ovirt-engine/api/datacenters/123/quotas/456
<quota>
  <cluster_hard_limit_pct>30</cluster_hard_limit_pct>
  <cluster_soft_limit_pct>70</cluster_soft_limit_pct>
  <storage_hard_limit_pct>20</storage_hard_limit_pct>
  <storage_soft_limit_pct>80</storage_soft_limit_pct>
</quota>

Parameters:

  • quota (Quota)

    The quota to update.

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the update should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



18139
18140
18141
# File 'lib/ovirtsdk4/services.rb', line 18139

def update(quota, opts = {})
  internal_update(quota, Quota, UPDATE, opts)
end