Class: Harbor2Client::RepositoryApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ RepositoryApi

Returns a new instance of RepositoryApi.



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

def api_client
  @api_client
end

Instance Method Details

#delete_repository(project_name, repository_name, opts = {}) ⇒ nil

Delete repository Delete the repository specified by name

Parameters:

  • project_name

    The name of the project

  • repository_name

    The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


29
30
31
32
# File 'lib/harbor2_client/api/repository_api.rb', line 29

def delete_repository(project_name, repository_name, opts = {})
  delete_repository_with_http_info(project_name, repository_name, opts)
  nil
end

#delete_repository_with_http_info(project_name, repository_name, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete repository Delete the repository specified by name

Parameters:

  • project_name

    The name of the project

  • repository_name

    The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb

  • 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



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
83
84
85
86
87
# File 'lib/harbor2_client/api/repository_api.rb', line 41

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

  # resource path
  local_var_path = '/projects/{project_name}/repositories/{repository_name}'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.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: RepositoryApi#delete_repository\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_repository(project_name, repository_name, opts = {}) ⇒ Repository

Get repository Get the repository specified by name

Parameters:

  • project_name

    The name of the project

  • repository_name

    The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:



95
96
97
98
# File 'lib/harbor2_client/api/repository_api.rb', line 95

def get_repository(project_name, repository_name, opts = {})
  data, _status_code, _headers = get_repository_with_http_info(project_name, repository_name, opts)
  data
end

#get_repository_with_http_info(project_name, repository_name, opts = {}) ⇒ Array<(Repository, Fixnum, Hash)>

Get repository Get the repository specified by name

Parameters:

  • project_name

    The name of the project

  • repository_name

    The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

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

    Repository data, response status code and response headers



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
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/harbor2_client/api/repository_api.rb', line 107

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

  # resource path
  local_var_path = '/projects/{project_name}/repositories/{repository_name}'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.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 => 'Repository')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RepositoryApi#get_repository\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_all_repositories(opts = {}) ⇒ Array<Repository>

List all authorized repositories List all authorized repositories

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:



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

def list_all_repositories(opts = {})
  data, _status_code, _headers = list_all_repositories_with_http_info(opts)
  data
end

#list_all_repositories_with_http_info(opts = {}) ⇒ Array<(Array<Repository>, Fixnum, Hash)>

List all authorized repositories List all authorized repositories

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

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



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

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

  # resource path
  local_var_path = '/repositories'

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

#list_repositories(project_name, opts = {}) ⇒ Array<Repository>

List repositories List repositories of the specified project

Parameters:

  • project_name

    The name of the project

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



236
237
238
239
# File 'lib/harbor2_client/api/repository_api.rb', line 236

def list_repositories(project_name, opts = {})
  data, _status_code, _headers = list_repositories_with_http_info(project_name, opts)
  data
end

#list_repositories_with_http_info(project_name, opts = {}) ⇒ Array<(Array<Repository>, Fixnum, Hash)>

List repositories List repositories of the specified project

Parameters:

  • project_name

    The name of the project

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

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



251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/harbor2_client/api/repository_api.rb', line 251

def list_repositories_with_http_info(project_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RepositoryApi.list_repositories ...'
  end
  # verify the required parameter 'project_name' is set
  if @api_client.config.client_side_validation && project_name.nil?
    fail ArgumentError, "Missing the required parameter 'project_name' when calling RepositoryApi.list_repositories"
  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 RepositoryApi.list_repositories, 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 RepositoryApi.list_repositories, must be smaller than or equal to 100.'
  end

  # resource path
  local_var_path = '/projects/{project_name}/repositories'.sub('{' + 'project_name' + '}', project_name.to_s)

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

#update_repository(project_name, repository_name, repository, opts = {}) ⇒ nil

Update repository Update the repository specified by name

Parameters:

  • project_name

    The name of the project

  • repository_name

    The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb

  • repository

    The JSON object of repository.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


311
312
313
314
# File 'lib/harbor2_client/api/repository_api.rb', line 311

def update_repository(project_name, repository_name, repository, opts = {})
  update_repository_with_http_info(project_name, repository_name, repository, opts)
  nil
end

#update_repository_with_http_info(project_name, repository_name, repository, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update repository Update the repository specified by name

Parameters:

  • project_name

    The name of the project

  • repository_name

    The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb

  • repository

    The JSON object of repository.

  • 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



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
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
# File 'lib/harbor2_client/api/repository_api.rb', line 324

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

  # resource path
  local_var_path = '/projects/{project_name}/repositories/{repository_name}'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.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(repository)
  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: RepositoryApi#update_repository\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end