Class: Harbor2Client::ReplicationApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ReplicationApi

Returns a new instance of ReplicationApi.



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

def api_client
  @api_client
end

Instance Method Details

#create_replication_policy(policy, opts = {}) ⇒ nil

Create a replication policy Create a replication policy

Parameters:

  • policy

    The replication policy

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

def create_replication_policy(policy, opts = {})
  create_replication_policy_with_http_info(policy, opts)
  nil
end

#create_replication_policy_with_http_info(policy, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Create a replication policy Create a replication policy

Parameters:

  • policy

    The replication policy

  • 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/replication_api.rb', line 39

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

  # resource path
  local_var_path = '/replication/policies'

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

#delete_replication_policy(id, opts = {}) ⇒ nil

Delete the specific replication policy Delete the specific replication policy

Parameters:

  • id

    Replication policy ID

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


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

def delete_replication_policy(id, opts = {})
  delete_replication_policy_with_http_info(id, opts)
  nil
end

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

Delete the specific replication policy Delete the specific replication policy

Parameters:

  • id

    Replication policy 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



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

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

  # resource path
  local_var_path = '/replication/policies/{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(: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: ReplicationApi#delete_replication_policy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_replication_execution(id, opts = {}) ⇒ ReplicationExecution

Get the specific replication execution Get the replication execution specified by ID

Parameters:

  • id

    The ID of the execution.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:



148
149
150
151
# File 'lib/harbor2_client/api/replication_api.rb', line 148

def get_replication_execution(id, opts = {})
  data, _status_code, _headers = get_replication_execution_with_http_info(id, opts)
  data
end

#get_replication_execution_with_http_info(id, opts = {}) ⇒ Array<(ReplicationExecution, Fixnum, Hash)>

Get the specific replication execution Get the replication execution specified by ID

Parameters:

  • id

    The ID of the execution.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

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

    ReplicationExecution data, response status code and response headers



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

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

  # resource path
  local_var_path = '/replication/executions/{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 => 'ReplicationExecution')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReplicationApi#get_replication_execution\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_replication_log(id, task_id, opts = {}) ⇒ String

Get the log of the specific replication task Get the log of the specific replication task

Parameters:

  • id

    The ID of the execution that the tasks belongs to.

  • task_id

    The ID of the task.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (String)


210
211
212
213
# File 'lib/harbor2_client/api/replication_api.rb', line 210

def get_replication_log(id, task_id, opts = {})
  data, _status_code, _headers = get_replication_log_with_http_info(id, task_id, opts)
  data
end

#get_replication_log_with_http_info(id, task_id, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Get the log of the specific replication task Get the log of the specific replication task

Parameters:

  • id

    The ID of the execution that the tasks belongs to.

  • task_id

    The ID of the task.

  • 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



222
223
224
225
226
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
# File 'lib/harbor2_client/api/replication_api.rb', line 222

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

  # resource path
  local_var_path = '/replication/executions/{id}/tasks/{task_id}/log'.sub('{' + 'id' + '}', id.to_s).sub('{' + 'task_id' + '}', task_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: ReplicationApi#get_replication_log\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_replication_policy(id, opts = {}) ⇒ ReplicationPolicy

Get the specific replication policy Get the specific replication policy

Parameters:

  • id

    Policy ID

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:



276
277
278
279
# File 'lib/harbor2_client/api/replication_api.rb', line 276

def get_replication_policy(id, opts = {})
  data, _status_code, _headers = get_replication_policy_with_http_info(id, opts)
  data
end

#get_replication_policy_with_http_info(id, opts = {}) ⇒ Array<(ReplicationPolicy, Fixnum, Hash)>

Get the specific replication policy Get the specific replication policy

Parameters:

  • id

    Policy ID

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

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

    ReplicationPolicy data, response status code and response headers



287
288
289
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
330
# File 'lib/harbor2_client/api/replication_api.rb', line 287

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

  # resource path
  local_var_path = '/replication/policies/{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 => 'ReplicationPolicy')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReplicationApi#get_replication_policy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_replication_executions(opts = {}) ⇒ Array<ReplicationExecution>

List replication executions List replication executions

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :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)

  • :policy_id (Integer)

    The ID of the policy that the executions belong to.

  • :status (String)

    The execution status.

  • :trigger (String)

    The trigger mode.

Returns:



342
343
344
345
# File 'lib/harbor2_client/api/replication_api.rb', line 342

def list_replication_executions(opts = {})
  data, _status_code, _headers = list_replication_executions_with_http_info(opts)
  data
end

#list_replication_executions_with_http_info(opts = {}) ⇒ Array<(Array<ReplicationExecution>, Fixnum, Hash)>

List replication executions List replication executions

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :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

  • :policy_id (Integer)

    The ID of the policy that the executions belong to.

  • :status (String)

    The execution status.

  • :trigger (String)

    The trigger mode.

Returns:

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

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



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

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

  # resource path
  local_var_path = '/replication/executions'

  # query parameters
  query_params = {}
  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?
  query_params[:'policy_id'] = opts[:'policy_id'] if !opts[:'policy_id'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'trigger'] = opts[:'trigger'] if !opts[:'trigger'].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<ReplicationExecution>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReplicationApi#list_replication_executions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_replication_policies(opts = {}) ⇒ Array<ReplicationPolicy>

List replication policies List replication policies

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)

  • :name (String)

    Deprecated, use &quot;query&quot; instead. The policy name.

Returns:



418
419
420
421
# File 'lib/harbor2_client/api/replication_api.rb', line 418

def list_replication_policies(opts = {})
  data, _status_code, _headers = list_replication_policies_with_http_info(opts)
  data
end

#list_replication_policies_with_http_info(opts = {}) ⇒ Array<(Array<ReplicationPolicy>, Fixnum, Hash)>

List replication policies List replication policies

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

  • :name (String)

    Deprecated, use &quot;query&quot; instead. The policy name.

Returns:

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

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



433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
# File 'lib/harbor2_client/api/replication_api.rb', line 433

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

  # resource path
  local_var_path = '/replication/policies'

  # 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?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].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<ReplicationPolicy>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReplicationApi#list_replication_policies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_replication_tasks(id, opts = {}) ⇒ Array<ReplicationTask>

List replication tasks for a specific execution List replication tasks for a specific execution

Parameters:

  • id

    The ID of the execution that the tasks belongs to.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :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)

  • :status (String)

    The task status.

  • :resource_type (String)

    The resource type.

Returns:



493
494
495
496
# File 'lib/harbor2_client/api/replication_api.rb', line 493

def list_replication_tasks(id, opts = {})
  data, _status_code, _headers = list_replication_tasks_with_http_info(id, opts)
  data
end

#list_replication_tasks_with_http_info(id, opts = {}) ⇒ Array<(Array<ReplicationTask>, Fixnum, Hash)>

List replication tasks for a specific execution List replication tasks for a specific execution

Parameters:

  • id

    The ID of the execution that the tasks belongs to.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :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

  • :status (String)

    The task status.

  • :resource_type (String)

    The resource type.

Returns:

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

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



509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
# File 'lib/harbor2_client/api/replication_api.rb', line 509

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

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

  # query parameters
  query_params = {}
  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?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'resource_type'] = opts[:'resource_type'] if !opts[:'resource_type'].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<ReplicationTask>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReplicationApi#list_replication_tasks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#start_replication(execution, opts = {}) ⇒ nil

Start one replication execution Start one replication execution according to the policy

Parameters:

  • execution

    The ID of policy that the execution belongs to

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


568
569
570
571
# File 'lib/harbor2_client/api/replication_api.rb', line 568

def start_replication(execution, opts = {})
  start_replication_with_http_info(execution, opts)
  nil
end

#start_replication_with_http_info(execution, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Start one replication execution Start one replication execution according to the policy

Parameters:

  • execution

    The ID of policy that the execution belongs to

  • 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



579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
# File 'lib/harbor2_client/api/replication_api.rb', line 579

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

  # resource path
  local_var_path = '/replication/executions'

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

#stop_replication(id, opts = {}) ⇒ nil

Stop the specific replication execution Stop the replication execution specified by ID

Parameters:

  • id

    The ID of the execution.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


628
629
630
631
# File 'lib/harbor2_client/api/replication_api.rb', line 628

def stop_replication(id, opts = {})
  stop_replication_with_http_info(id, opts)
  nil
end

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

Stop the specific replication execution Stop the replication execution specified by ID

Parameters:

  • id

    The ID of the execution.

  • 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



639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
# File 'lib/harbor2_client/api/replication_api.rb', line 639

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

  # resource path
  local_var_path = '/replication/executions/{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(: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: ReplicationApi#stop_replication\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_replication_policy(id, policy, opts = {}) ⇒ nil

Update the replication policy Update the replication policy

Parameters:

  • id

    The policy ID

  • policy

    The replication policy

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


689
690
691
692
# File 'lib/harbor2_client/api/replication_api.rb', line 689

def update_replication_policy(id, policy, opts = {})
  update_replication_policy_with_http_info(id, policy, opts)
  nil
end

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

Update the replication policy Update the replication policy

Parameters:

  • id

    The policy ID

  • policy

    The replication policy

  • 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



701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
# File 'lib/harbor2_client/api/replication_api.rb', line 701

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

  # resource path
  local_var_path = '/replication/policies/{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(policy)
  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: ReplicationApi#update_replication_policy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end