Class: Harbor2Client::QuotaApi

Inherits:
Object
  • Object
show all
Defined in:
lib/harbor2_client/api/quota_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ QuotaApi

Returns a new instance of QuotaApi.



19
20
21
# File 'lib/harbor2_client/api/quota_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/harbor2_client/api/quota_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_quota(id, opts = {}) ⇒ Quota

Get the specified quota Get the specified quota

Parameters:

  • id

    Quota ID

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:



28
29
30
31
# File 'lib/harbor2_client/api/quota_api.rb', line 28

def get_quota(id, opts = {})
  data, _status_code, _headers = get_quota_with_http_info(id, opts)
  data
end

#get_quota_with_http_info(id, opts = {}) ⇒ Array<(Quota, Fixnum, Hash)>

Get the specified quota Get the specified quota

Parameters:

  • id

    Quota ID

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (Array<(Quota, Fixnum, Hash)>)

    Quota data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/harbor2_client/api/quota_api.rb', line 39

def get_quota_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: QuotaApi.get_quota ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling QuotaApi.get_quota"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling QuotaApi.get_quota, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/quotas/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Quota')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: QuotaApi#get_quota\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_quotas(opts = {}) ⇒ Array<Quota>

List quotas List quotas

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :page (Integer)

    The page number (default to 1)

  • :page_size (Integer)

    The size of per page (default to 10)

  • :reference (String)

    The reference type of quota.

  • :reference_id (String)

    The reference id of quota.

  • :sort (String)

    Sort method, valid values include: &#39;hard.resource_name&#39;, &#39;-hard.resource_name&#39;, &#39;used.resource_name&#39;, &#39;-used.resource_name&#39;. Here &#39;-&#39; stands for descending order, resource_name should be the real resource name of the quota.

Returns:



93
94
95
96
# File 'lib/harbor2_client/api/quota_api.rb', line 93

def list_quotas(opts = {})
  data, _status_code, _headers = list_quotas_with_http_info(opts)
  data
end

#list_quotas_with_http_info(opts = {}) ⇒ Array<(Array<Quota>, Fixnum, Hash)>

List quotas List quotas

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :page (Integer)

    The page number

  • :page_size (Integer)

    The size of per page

  • :reference (String)

    The reference type of quota.

  • :reference_id (String)

    The reference id of quota.

  • :sort (String)

    Sort method, valid values include: &#39;hard.resource_name&#39;, &#39;-hard.resource_name&#39;, &#39;used.resource_name&#39;, &#39;-used.resource_name&#39;. Here &#39;-&#39; stands for descending order, resource_name should be the real resource name of the quota.

Returns:

  • (Array<(Array<Quota>, Fixnum, Hash)>)

    Array<Quota> data, response status code and response headers



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/harbor2_client/api/quota_api.rb', line 108

def list_quotas_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: QuotaApi.list_quotas ...'
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling QuotaApi.list_quotas, the character length must be great than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling QuotaApi.list_quotas, must be smaller than or equal to 100.'
  end

  # resource path
  local_var_path = '/quotas'

  # query parameters
  query_params = {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'reference'] = opts[:'reference'] if !opts[:'reference'].nil?
  query_params[:'reference_id'] = opts[:'reference_id'] if !opts[:'reference_id'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<Quota>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: QuotaApi#list_quotas\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_quota(id, hard, opts = {}) ⇒ nil

Update the specified quota Update hard limits of the specified quota

Parameters:

  • id

    Quota ID

  • hard

    The new hard limits for the quota

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


164
165
166
167
# File 'lib/harbor2_client/api/quota_api.rb', line 164

def update_quota(id, hard, opts = {})
  update_quota_with_http_info(id, hard, opts)
  nil
end

#update_quota_with_http_info(id, hard, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update the specified quota Update hard limits of the specified quota

Parameters:

  • id

    Quota ID

  • hard

    The new hard limits for the quota

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/harbor2_client/api/quota_api.rb', line 176

def update_quota_with_http_info(id, hard, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: QuotaApi.update_quota ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling QuotaApi.update_quota"
  end
  # verify the required parameter 'hard' is set
  if @api_client.config.client_side_validation && hard.nil?
    fail ArgumentError, "Missing the required parameter 'hard' when calling QuotaApi.update_quota"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling QuotaApi.update_quota, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/quotas/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(hard)
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: QuotaApi#update_quota\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end