harbor_client.MemberApi

All URIs are relative to http://localhost/api/v2.0

MethodHTTP requestDescription
create_project_memberPOST /projects/{project_name_or_id}/membersCreate project member
delete_project_memberDELETE /projects/{project_name_or_id}/members/{mid}Delete project member
get_project_memberGET /projects/{project_name_or_id}/members/{mid}Get the project member information
list_project_membersGET /projects/{project_name_or_id}/membersGet all project member information
update_project_memberPUT /projects/{project_name_or_id}/members/{mid}Update project member

create_project_member

Signature

create_project_member(project_name_or_id: str, x_request_id: Optional[str], x_is_resource_name: Optional[bool], project_member: Optional[ProjectMember])-> None

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.

Example

from __future__ import print_function
import time
import harbor_client
from harbor_client.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basic
configuration = harbor_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = harbor_client.MemberApi(harbor_client.ApiClient(configuration))
project_name_or_id = 'project_name_or_id_example' # str | The name or id of the project
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
x_is_resource_name = false # bool | 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. (optional) (default to false)
project_member = harbor_client.ProjectMember() # ProjectMember |  (optional)

try:
    # Create project member
    api_instance.create_project_member(project_name_or_id, x_request_id=x_request_id, x_is_resource_name=x_is_resource_name, project_member=project_member)
except ApiException as e:
    print("Exception when calling MemberApi->create_project_member: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_name_or_idstrThe name or id of the project
x_request_idstrAn unique ID for the request[optional]
x_is_resource_nameboolThe 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.[optional] [default to false]
project_memberProjectMember[optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top]

delete_project_member

Signature

delete_project_member(project_name_or_id: str, mid: int, x_request_id: Optional[str], x_is_resource_name: Optional[bool])-> None

Delete project member

Example

from __future__ import print_function
import time
import harbor_client
from harbor_client.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basic
configuration = harbor_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = harbor_client.MemberApi(harbor_client.ApiClient(configuration))
project_name_or_id = 'project_name_or_id_example' # str | The name or id of the project
mid = 789 # int | Member ID.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
x_is_resource_name = false # bool | 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. (optional) (default to false)

try:
    # Delete project member
    api_instance.delete_project_member(project_name_or_id, mid, x_request_id=x_request_id, x_is_resource_name=x_is_resource_name)
except ApiException as e:
    print("Exception when calling MemberApi->delete_project_member: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_name_or_idstrThe name or id of the project
midintMember ID.
x_request_idstrAn unique ID for the request[optional]
x_is_resource_nameboolThe 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.[optional] [default to false]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top]

get_project_member

Signature

get_project_member(project_name_or_id: str, mid: int, x_request_id: Optional[str], x_is_resource_name: Optional[bool])-> ProjectMemberEntity

Get the project member information

Get the project member information

Example

from __future__ import print_function
import time
import harbor_client
from harbor_client.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basic
configuration = harbor_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = harbor_client.MemberApi(harbor_client.ApiClient(configuration))
project_name_or_id = 'project_name_or_id_example' # str | The name or id of the project
mid = 789 # int | The member ID
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
x_is_resource_name = false # bool | 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. (optional) (default to false)

try:
    # Get the project member information
    api_response = api_instance.get_project_member(project_name_or_id, mid, x_request_id=x_request_id, x_is_resource_name=x_is_resource_name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling MemberApi->get_project_member: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_name_or_idstrThe name or id of the project
midintThe member ID
x_request_idstrAn unique ID for the request[optional]
x_is_resource_nameboolThe 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.[optional] [default to false]

Return type

ProjectMemberEntity

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top]

list_project_members

Signature

list_project_members(project_name_or_id: str, x_request_id: Optional[str], x_is_resource_name: Optional[bool], page: Optional[int], page_size: Optional[int], entityname: Optional[str])-> list[ProjectMemberEntity]

Get all project member information

Get all project member information

Example

from __future__ import print_function
import time
import harbor_client
from harbor_client.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basic
configuration = harbor_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = harbor_client.MemberApi(harbor_client.ApiClient(configuration))
project_name_or_id = 'project_name_or_id_example' # str | The name or id of the project
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
x_is_resource_name = false # bool | 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. (optional) (default to false)
page = 1 # int | The page number (optional) (default to 1)
page_size = 10 # int | The size of per page (optional) (default to 10)
entityname = 'entityname_example' # str | The entity name to search. (optional)

try:
    # Get all project member information
    api_response = api_instance.list_project_members(project_name_or_id, x_request_id=x_request_id, x_is_resource_name=x_is_resource_name, page=page, page_size=page_size, entityname=entityname)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling MemberApi->list_project_members: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_name_or_idstrThe name or id of the project
x_request_idstrAn unique ID for the request[optional]
x_is_resource_nameboolThe 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.[optional] [default to false]
pageintThe page number[optional] [default to 1]
page_sizeintThe size of per page[optional] [default to 10]
entitynamestrThe entity name to search.[optional]

Return type

list[ProjectMemberEntity]

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top]

update_project_member

Signature

update_project_member(project_name_or_id: str, mid: int, x_request_id: Optional[str], x_is_resource_name: Optional[bool], role: Optional[RoleRequest])-> None

Update project member

Update project member relationship

Example

from __future__ import print_function
import time
import harbor_client
from harbor_client.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basic
configuration = harbor_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = harbor_client.MemberApi(harbor_client.ApiClient(configuration))
project_name_or_id = 'project_name_or_id_example' # str | The name or id of the project
mid = 789 # int | Member ID.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
x_is_resource_name = false # bool | 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. (optional) (default to false)
role = harbor_client.RoleRequest() # RoleRequest |  (optional)

try:
    # Update project member
    api_instance.update_project_member(project_name_or_id, mid, x_request_id=x_request_id, x_is_resource_name=x_is_resource_name, role=role)
except ApiException as e:
    print("Exception when calling MemberApi->update_project_member: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_name_or_idstrThe name or id of the project
midintMember ID.
x_request_idstrAn unique ID for the request[optional]
x_is_resource_nameboolThe 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.[optional] [default to false]
roleRoleRequest[optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top]