Class: Grafana::Api::Orgs::Quotas

Inherits:
Object
  • Object
show all
Defined in:
lib/grafana-api/api/orgs/quotas.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Quotas

Returns a new instance of Quotas.



5
6
7
# File 'lib/grafana-api/api/orgs/quotas.rb', line 5

def initialize(connection)
  @connection = connection
end

Instance Method Details

#list(org_id:) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/grafana-api/api/orgs/quotas.rb', line 9

def list(org_id:)
  raise ArgumentError, 'org_id is required' if org_id.nil?

  @connection.call(
    :GET,
    '/orgs/{org_id}/quotas'
      .gsub('{org_id}', ERB::Util.url_encode(org_id.to_s)),
    type: [Grafana::Api::Models::QuotaDTO],
    auth: ['api_key', 'basic']
  )
end

#update(quota_target:, org_id:, update_quota_cmd:) ⇒ Object

Raises:

  • (ArgumentError)


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/grafana-api/api/orgs/quotas.rb', line 21

def update(quota_target:, org_id:, update_quota_cmd:)
  raise ArgumentError, 'quota_target is required' if quota_target.nil?
  raise ArgumentError, 'org_id is required' if org_id.nil?
  raise ArgumentError, 'update_quota_cmd is required' if update_quota_cmd.nil?

  @connection.call(
    :PUT,
    '/orgs/{org_id}/quotas/{quota_target}'
      .gsub('{quota_target}', ERB::Util.url_encode(quota_target.to_s))
      .gsub('{org_id}', ERB::Util.url_encode(org_id.to_s)),
    type: Grafana::Api::Models::SuccessResponseBody,
    auth: ['basic'],
    body: update_quota_cmd
  )
end