Class: Harbor2Client::RobotApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ RobotApi

Returns a new instance of RobotApi.



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

def api_client
  @api_client
end

Instance Method Details

#create_robot(robot, opts = {}) ⇒ RobotCreated

Create a robot account Create a robot account

Parameters:

  • robot

    The JSON object of a robot account.

  • 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/robot_api.rb', line 28

def create_robot(robot, opts = {})
  data, _status_code, _headers = create_robot_with_http_info(robot, opts)
  data
end

#create_robot_with_http_info(robot, opts = {}) ⇒ Array<(RobotCreated, Fixnum, Hash)>

Create a robot account Create a robot account

Parameters:

  • robot

    The JSON object of a robot account.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

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

    RobotCreated 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/robot_api.rb', line 39

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

  # resource path
  local_var_path = '/robots'

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

#delete_robot(robot_id, opts = {}) ⇒ nil

Delete a robot account This endpoint deletes specific robot account information by robot ID.

Parameters:

  • robot_id

    Robot ID

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


89
90
91
92
# File 'lib/harbor2_client/api/robot_api.rb', line 89

def delete_robot(robot_id, opts = {})
  delete_robot_with_http_info(robot_id, opts)
  nil
end

#delete_robot_with_http_info(robot_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete a robot account This endpoint deletes specific robot account information by robot ID.

Parameters:

  • robot_id

    Robot ID

  • 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



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/robot_api.rb', line 100

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

  # resource path
  local_var_path = '/robots/{robot_id}'.sub('{' + 'robot_id' + '}', robot_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(:DELETE, 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: RobotApi#delete_robot\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_robot_by_id(robot_id, opts = {}) ⇒ Robot

Get a robot account This endpoint returns specific robot account information by robot ID.

Parameters:

  • robot_id

    Robot ID

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:



149
150
151
152
# File 'lib/harbor2_client/api/robot_api.rb', line 149

def get_robot_by_id(robot_id, opts = {})
  data, _status_code, _headers = get_robot_by_id_with_http_info(robot_id, opts)
  data
end

#get_robot_by_id_with_http_info(robot_id, opts = {}) ⇒ Array<(Robot, Fixnum, Hash)>

Get a robot account This endpoint returns specific robot account information by robot ID.

Parameters:

  • robot_id

    Robot ID

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

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

    Robot data, response status code and response headers



160
161
162
163
164
165
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
# File 'lib/harbor2_client/api/robot_api.rb', line 160

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

  # resource path
  local_var_path = '/robots/{robot_id}'.sub('{' + 'robot_id' + '}', robot_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 => 'Robot')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RobotApi#get_robot_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_robot(opts = {}) ⇒ Array<Robot>

Get robot account List the robot accounts with the specified level and project.

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:



213
214
215
216
# File 'lib/harbor2_client/api/robot_api.rb', line 213

def list_robot(opts = {})
  data, _status_code, _headers = list_robot_with_http_info(opts)
  data
end

#list_robot_with_http_info(opts = {}) ⇒ Array<(Array<Robot>, Fixnum, Hash)>

Get robot account List the robot accounts with the specified level and project.

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<Robot>, Fixnum, Hash)>)

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



227
228
229
230
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/robot_api.rb', line 227

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

  # resource path
  local_var_path = '/robots'

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

#refresh_sec(robot_id, robot_sec, opts = {}) ⇒ RobotSec

Refresh the robot secret Refresh the robot secret

Parameters:

  • robot_id

    Robot ID

  • robot_sec

    The JSON object of a robot account.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:



282
283
284
285
# File 'lib/harbor2_client/api/robot_api.rb', line 282

def refresh_sec(robot_id, robot_sec, opts = {})
  data, _status_code, _headers = refresh_sec_with_http_info(robot_id, robot_sec, opts)
  data
end

#refresh_sec_with_http_info(robot_id, robot_sec, opts = {}) ⇒ Array<(RobotSec, Fixnum, Hash)>

Refresh the robot secret Refresh the robot secret

Parameters:

  • robot_id

    Robot ID

  • robot_sec

    The JSON object of a robot account.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

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

    RobotSec data, response status code and response headers



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
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/harbor2_client/api/robot_api.rb', line 294

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

  # resource path
  local_var_path = '/robots/{robot_id}'.sub('{' + 'robot_id' + '}', robot_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(robot_sec)
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'RobotSec')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RobotApi#refresh_sec\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_robot(robot_id, robot, opts = {}) ⇒ nil

Update a robot account This endpoint updates specific robot account information by robot ID.

Parameters:

  • robot_id

    Robot ID

  • robot

    The JSON object of a robot account.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


349
350
351
352
# File 'lib/harbor2_client/api/robot_api.rb', line 349

def update_robot(robot_id, robot, opts = {})
  update_robot_with_http_info(robot_id, robot, opts)
  nil
end

#update_robot_with_http_info(robot_id, robot, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update a robot account This endpoint updates specific robot account information by robot ID.

Parameters:

  • robot_id

    Robot ID

  • robot

    The JSON object of a robot account.

  • 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



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
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# File 'lib/harbor2_client/api/robot_api.rb', line 361

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

  # resource path
  local_var_path = '/robots/{robot_id}'.sub('{' + 'robot_id' + '}', robot_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(robot)
  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: RobotApi#update_robot\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end