Class: Harbor2Client::MemberApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MemberApi

Returns a new instance of MemberApi.



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

def api_client
  @api_client
end

Instance Method Details

#create_project_member(project_name_or_id, opts = {}) ⇒ nil

Create project member Create project member relationship, the member can be one of the user_member and group_member, The user_member need to specify user_id or username. If the user already exist in harbor DB, specify the user_id, If does not exist in harbor DB, it will SearchAndOnBoard the user. The group_member need to specify id or ldap_group_dn. If the group already exist in harbor DB. specify the user group’s id, If does not exist, it will SearchAndOnBoard the group.

Parameters:

  • project_name_or_id

    The name or id of the project

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (default to false)

  • :project_member (ProjectMember)

Returns:

  • (nil)


30
31
32
33
# File 'lib/harbor2_client/api/member_api.rb', line 30

def create_project_member(project_name_or_id, opts = {})
  create_project_member_with_http_info(project_name_or_id, opts)
  nil
end

#create_project_member_with_http_info(project_name_or_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Create project member Create project member relationship, the member can be one of the user_member and group_member, The user_member need to specify user_id or username. If the user already exist in harbor DB, specify the user_id, If does not exist in harbor DB, it will SearchAndOnBoard the user. The group_member need to specify id or ldap_group_dn. If the group already exist in harbor DB. specify the user group&#39;s id, If does not exist, it will SearchAndOnBoard the group.

Parameters:

  • project_name_or_id

    The name or id of the project

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.

  • :project_member (ProjectMember)

Returns:

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

    nil, response status code and response headers



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

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

  # resource path
  local_var_path = '/projects/{project_name_or_id}/members'.sub('{' + 'project_name_or_id' + '}', project_name_or_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?
  header_params[:'X-Is-Resource-Name'] = opts[:'x_is_resource_name'] if !opts[:'x_is_resource_name'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'project_member'])
  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: MemberApi#create_project_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_project_member(project_name_or_id, mid, opts = {}) ⇒ nil

Delete project member

Parameters:

  • project_name_or_id

    The name or id of the project

  • mid

    Member ID.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (default to false)

Returns:

  • (nil)


94
95
96
97
# File 'lib/harbor2_client/api/member_api.rb', line 94

def delete_project_member(project_name_or_id, mid, opts = {})
  delete_project_member_with_http_info(project_name_or_id, mid, opts)
  nil
end

#delete_project_member_with_http_info(project_name_or_id, mid, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete project member

Parameters:

  • project_name_or_id

    The name or id of the project

  • mid

    Member ID.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.

Returns:

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

    nil, response status code and response headers



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

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

  # resource path
  local_var_path = '/projects/{project_name_or_id}/members/{mid}'.sub('{' + 'project_name_or_id' + '}', project_name_or_id.to_s).sub('{' + 'mid' + '}', mid.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?
  header_params[:'X-Is-Resource-Name'] = opts[:'x_is_resource_name'] if !opts[:'x_is_resource_name'].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: MemberApi#delete_project_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_project_member(project_name_or_id, mid, opts = {}) ⇒ ProjectMemberEntity

Get the project member information Get the project member information

Parameters:

  • project_name_or_id

    The name or id of the project

  • mid

    The member ID

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (default to false)

Returns:



162
163
164
165
# File 'lib/harbor2_client/api/member_api.rb', line 162

def get_project_member(project_name_or_id, mid, opts = {})
  data, _status_code, _headers = get_project_member_with_http_info(project_name_or_id, mid, opts)
  data
end

#get_project_member_with_http_info(project_name_or_id, mid, opts = {}) ⇒ Array<(ProjectMemberEntity, Fixnum, Hash)>

Get the project member information Get the project member information

Parameters:

  • project_name_or_id

    The name or id of the project

  • mid

    The member ID

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.

Returns:

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

    ProjectMemberEntity data, response status code and response headers



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
214
215
216
217
218
219
220
221
222
223
# File 'lib/harbor2_client/api/member_api.rb', line 175

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

  # resource path
  local_var_path = '/projects/{project_name_or_id}/members/{mid}'.sub('{' + 'project_name_or_id' + '}', project_name_or_id.to_s).sub('{' + 'mid' + '}', mid.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?
  header_params[:'X-Is-Resource-Name'] = opts[:'x_is_resource_name'] if !opts[:'x_is_resource_name'].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 => 'ProjectMemberEntity')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MemberApi#get_project_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_project_members(project_name_or_id, opts = {}) ⇒ Array<ProjectMemberEntity>

Get all project member information Get all project member information

Parameters:

  • project_name_or_id

    The name or id of the project

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (default to false)

  • :page (Integer)

    The page number (default to 1)

  • :page_size (Integer)

    The size of per page (default to 10)

  • :entityname (String)

    The entity name to search.

Returns:



234
235
236
237
# File 'lib/harbor2_client/api/member_api.rb', line 234

def list_project_members(project_name_or_id, opts = {})
  data, _status_code, _headers = list_project_members_with_http_info(project_name_or_id, opts)
  data
end

#list_project_members_with_http_info(project_name_or_id, opts = {}) ⇒ Array<(Array<ProjectMemberEntity>, Fixnum, Hash)>

Get all project member information Get all project member information

Parameters:

  • project_name_or_id

    The name or id of the project

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.

  • :page (Integer)

    The page number

  • :page_size (Integer)

    The size of per page

  • :entityname (String)

    The entity name to search.

Returns:

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

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



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

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

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

  # query parameters
  query_params = {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'entityname'] = opts[:'entityname'] if !opts[:'entityname'].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?
  header_params[:'X-Is-Resource-Name'] = opts[:'x_is_resource_name'] if !opts[:'x_is_resource_name'].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<ProjectMemberEntity>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MemberApi#list_project_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_project_member(project_name_or_id, mid, opts = {}) ⇒ nil

Update project member Update project member relationship

Parameters:

  • project_name_or_id

    The name or id of the project

  • mid

    Member ID.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (default to false)

  • :role (RoleRequest)

Returns:

  • (nil)


310
311
312
313
# File 'lib/harbor2_client/api/member_api.rb', line 310

def update_project_member(project_name_or_id, mid, opts = {})
  update_project_member_with_http_info(project_name_or_id, mid, opts)
  nil
end

#update_project_member_with_http_info(project_name_or_id, mid, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update project member Update project member relationship

Parameters:

  • project_name_or_id

    The name or id of the project

  • mid

    Member ID.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.

  • :role (RoleRequest)

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

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

  # resource path
  local_var_path = '/projects/{project_name_or_id}/members/{mid}'.sub('{' + 'project_name_or_id' + '}', project_name_or_id.to_s).sub('{' + 'mid' + '}', mid.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?
  header_params[:'X-Is-Resource-Name'] = opts[:'x_is_resource_name'] if !opts[:'x_is_resource_name'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'role'])
  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: MemberApi#update_project_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end