Class: Harbor2Client::GcApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ GcApi

Returns a new instance of GcApi.



19
20
21
# File 'lib/harbor2_client/api/gc_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/gc_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_gc_schedule(schedule, opts = {}) ⇒ nil

Create a gc schedule. This endpoint is for update gc schedule.

Parameters:

  • schedule

    Updates of gc's schedule.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


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

def create_gc_schedule(schedule, opts = {})
  create_gc_schedule_with_http_info(schedule, opts)
  nil
end

#create_gc_schedule_with_http_info(schedule, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Create a gc schedule. This endpoint is for update gc schedule.

Parameters:

  • schedule

    Updates of gc&#39;s schedule.

  • 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



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
# File 'lib/harbor2_client/api/gc_api.rb', line 39

def create_gc_schedule_with_http_info(schedule, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GcApi.create_gc_schedule ...'
  end
  # verify the required parameter 'schedule' is set
  if @api_client.config.client_side_validation && schedule.nil?
    fail ArgumentError, "Missing the required parameter 'schedule' when calling GcApi.create_gc_schedule"
  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 GcApi.create_gc_schedule, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/system/gc/schedule'

  # 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(schedule)
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:POST, 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: GcApi#create_gc_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_gc(gc_id, opts = {}) ⇒ GCHistory

Get gc status. This endpoint let user get gc status filtered by specific ID.

Parameters:

  • gc_id

    The ID of the gc log

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:



88
89
90
91
# File 'lib/harbor2_client/api/gc_api.rb', line 88

def get_gc(gc_id, opts = {})
  data, _status_code, _headers = get_gc_with_http_info(gc_id, opts)
  data
end

#get_gc_history(opts = {}) ⇒ Array<GCHistory>

Get gc results. This endpoint let user get gc execution history.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :q (String)

    Query string to query resources. Supported query patterns are &quot;exact match(k&#x3D;v)&quot;, &quot;fuzzy match(k&#x3D;~v)&quot;, &quot;range(k&#x3D;)&quot;, &quot;list with union releationship(k&#x3D;v2 v3)&quot; and &quot;list with intersetion relationship(k&#x3D;(v1 v2 v3))&quot;. The value of range and list can be string(enclosed by &quot; or &#39;), integer or time(in format &quot;2020-04-09 02:36:00&quot;). All of these query patterns should be put in the query string &quot;q&#x3D;xxx&quot; and splitted by &quot;,&quot;. e.g. q&#x3D;k1&#x3D;v1,k2&#x3D;~v2,k3&#x3D;

  • :sort (String)

    Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with &quot;sort&#x3D;field1,-field2&quot;

  • :page (Integer)

    The page number (default to 1)

  • :page_size (Integer)

    The size of per page (default to 10)

Returns:



152
153
154
155
# File 'lib/harbor2_client/api/gc_api.rb', line 152

def get_gc_history(opts = {})
  data, _status_code, _headers = get_gc_history_with_http_info(opts)
  data
end

#get_gc_history_with_http_info(opts = {}) ⇒ Array<(Array<GCHistory>, Fixnum, Hash)>

Get gc results. This endpoint let user get gc execution history.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :q (String)

    Query string to query resources. Supported query patterns are &quot;exact match(k&#x3D;v)&quot;, &quot;fuzzy match(k&#x3D;~v)&quot;, &quot;range(k&#x3D;)&quot;, &quot;list with union releationship(k&#x3D;v2 v3)&quot; and &quot;list with intersetion relationship(k&#x3D;(v1 v2 v3))&quot;. The value of range and list can be string(enclosed by &quot; or &#39;), integer or time(in format &quot;2020-04-09 02:36:00&quot;). All of these query patterns should be put in the query string &quot;q&#x3D;xxx&quot; and splitted by &quot;,&quot;. e.g. q&#x3D;k1&#x3D;v1,k2&#x3D;~v2,k3&#x3D;

  • :sort (String)

    Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with &quot;sort&#x3D;field1,-field2&quot;

  • :page (Integer)

    The page number

  • :page_size (Integer)

    The size of per page

Returns:

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

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



166
167
168
169
170
171
172
173
174
175
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
# File 'lib/harbor2_client/api/gc_api.rb', line 166

def get_gc_history_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GcApi.get_gc_history ...'
  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 GcApi.get_gc_history, 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 GcApi.get_gc_history, must be smaller than or equal to 100.'
  end

  # resource path
  local_var_path = '/system/gc'

  # query parameters
  query_params = {}
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].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<GCHistory>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GcApi#get_gc_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_gc_log(gc_id, opts = {}) ⇒ String

Get gc job log. This endpoint let user get gc job logs filtered by specific ID.

Parameters:

  • gc_id

    The ID of the gc log

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (String)


220
221
222
223
# File 'lib/harbor2_client/api/gc_api.rb', line 220

def get_gc_log(gc_id, opts = {})
  data, _status_code, _headers = get_gc_log_with_http_info(gc_id, opts)
  data
end

#get_gc_log_with_http_info(gc_id, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Get gc job log. This endpoint let user get gc job logs filtered by specific ID.

Parameters:

  • gc_id

    The ID of the gc log

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

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

    String data, response status code and response headers



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/harbor2_client/api/gc_api.rb', line 231

def get_gc_log_with_http_info(gc_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GcApi.get_gc_log ...'
  end
  # verify the required parameter 'gc_id' is set
  if @api_client.config.client_side_validation && gc_id.nil?
    fail ArgumentError, "Missing the required parameter 'gc_id' when calling GcApi.get_gc_log"
  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 GcApi.get_gc_log, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/system/gc/{gc_id}/log'.sub('{' + 'gc_id' + '}', gc_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/plain'])
  # 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 => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GcApi#get_gc_log\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_gc_schedule(opts = {}) ⇒ GCHistory

Get gc’s schedule. This endpoint is for get schedule of gc job.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:



280
281
282
283
# File 'lib/harbor2_client/api/gc_api.rb', line 280

def get_gc_schedule(opts = {})
  data, _status_code, _headers = get_gc_schedule_with_http_info(opts)
  data
end

#get_gc_schedule_with_http_info(opts = {}) ⇒ Array<(GCHistory, Fixnum, Hash)>

Get gc&#39;s schedule. This endpoint is for get schedule of gc job.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

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

    GCHistory data, response status code and response headers



290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/harbor2_client/api/gc_api.rb', line 290

def get_gc_schedule_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GcApi.get_gc_schedule ...'
  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 GcApi.get_gc_schedule, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/system/gc/schedule'

  # 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 => 'GCHistory')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GcApi#get_gc_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_gc_with_http_info(gc_id, opts = {}) ⇒ Array<(GCHistory, Fixnum, Hash)>

Get gc status. This endpoint let user get gc status filtered by specific ID.

Parameters:

  • gc_id

    The ID of the gc log

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

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

    GCHistory data, response status code and response headers



99
100
101
102
103
104
105
106
107
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
# File 'lib/harbor2_client/api/gc_api.rb', line 99

def get_gc_with_http_info(gc_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GcApi.get_gc ...'
  end
  # verify the required parameter 'gc_id' is set
  if @api_client.config.client_side_validation && gc_id.nil?
    fail ArgumentError, "Missing the required parameter 'gc_id' when calling GcApi.get_gc"
  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 GcApi.get_gc, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/system/gc/{gc_id}'.sub('{' + 'gc_id' + '}', gc_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 => 'GCHistory')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GcApi#get_gc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_gc_schedule(schedule, opts = {}) ⇒ nil

Update gc’s schedule. This endpoint is for update gc schedule.

Parameters:

  • schedule

    Updates of gc&#39;s schedule.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


336
337
338
339
# File 'lib/harbor2_client/api/gc_api.rb', line 336

def update_gc_schedule(schedule, opts = {})
  update_gc_schedule_with_http_info(schedule, opts)
  nil
end

#update_gc_schedule_with_http_info(schedule, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update gc&#39;s schedule. This endpoint is for update gc schedule.

Parameters:

  • schedule

    Updates of gc&#39;s schedule.

  • 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



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/harbor2_client/api/gc_api.rb', line 347

def update_gc_schedule_with_http_info(schedule, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GcApi.update_gc_schedule ...'
  end
  # verify the required parameter 'schedule' is set
  if @api_client.config.client_side_validation && schedule.nil?
    fail ArgumentError, "Missing the required parameter 'schedule' when calling GcApi.update_gc_schedule"
  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 GcApi.update_gc_schedule, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/system/gc/schedule'

  # 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(schedule)
  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: GcApi#update_gc_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end