harbor_client.UsergroupApi

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

MethodHTTP requestDescription
create_user_groupPOST /usergroupsCreate user group
delete_user_groupDELETE /usergroups/{group_id}Delete user group
get_user_groupGET /usergroups/{group_id}Get user group information
list_user_groupsGET /usergroupsGet all user groups information
search_user_groupsGET /usergroups/searchSearch groups by groupname
update_user_groupPUT /usergroups/{group_id}Update group information

create_user_group

Signature

create_user_group(x_request_id: Optional[str], usergroup: Optional[UserGroup])-> None

Create user group

Create user group 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.UsergroupApi(harbor_client.ApiClient(configuration))
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
usergroup = harbor_client.UserGroup() # UserGroup |  (optional)

try:
    # Create user group
    api_instance.create_user_group(x_request_id=x_request_id, usergroup=usergroup)
except ApiException as e:
    print("Exception when calling UsergroupApi->create_user_group: %s\n" % e)

Parameters

NameTypeDescriptionNotes
x_request_idstrAn unique ID for the request[optional]
usergroupUserGroup[optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

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

[Back to top]

delete_user_group

Signature

delete_user_group(group_id: int, x_request_id: Optional[str])-> None

Delete user group

Delete user 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.UsergroupApi(harbor_client.ApiClient(configuration))
group_id = 56 # int | 
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Delete user group
    api_instance.delete_user_group(group_id, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling UsergroupApi->delete_user_group: %s\n" % e)

Parameters

NameTypeDescriptionNotes
group_idint
x_request_idstrAn unique ID for the request[optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

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

[Back to top]

get_user_group

Signature

get_user_group(group_id: int, x_request_id: Optional[str])-> UserGroup

Get user group information

Get user group 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.UsergroupApi(harbor_client.ApiClient(configuration))
group_id = 789 # int | Group ID
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Get user group information
    api_response = api_instance.get_user_group(group_id, x_request_id=x_request_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UsergroupApi->get_user_group: %s\n" % e)

Parameters

NameTypeDescriptionNotes
group_idintGroup ID
x_request_idstrAn unique ID for the request[optional]

Return type

UserGroup

Authorization

basic

HTTP request headers

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

[Back to top]

list_user_groups

Signature

list_user_groups(x_request_id: Optional[str], page: Optional[int], page_size: Optional[int], ldap_group_dn: Optional[str], group_name: Optional[str])-> list[UserGroup]

Get all user groups information

Get all user groups information, it is open for system admin

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.UsergroupApi(harbor_client.ApiClient(configuration))
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
page = 1 # int | The page number (optional) (default to 1)
page_size = 10 # int | The size of per page (optional) (default to 10)
ldap_group_dn = 'ldap_group_dn_example' # str | search with ldap group DN (optional)
group_name = 'group_name_example' # str | group name need to search, fuzzy matches (optional)

try:
    # Get all user groups information
    api_response = api_instance.list_user_groups(x_request_id=x_request_id, page=page, page_size=page_size, ldap_group_dn=ldap_group_dn, group_name=group_name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UsergroupApi->list_user_groups: %s\n" % e)

Parameters

NameTypeDescriptionNotes
x_request_idstrAn unique ID for the request[optional]
pageintThe page number[optional] [default to 1]
page_sizeintThe size of per page[optional] [default to 10]
ldap_group_dnstrsearch with ldap group DN[optional]
group_namestrgroup name need to search, fuzzy matches[optional]

Return type

list[UserGroup]

Authorization

basic

HTTP request headers

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

[Back to top]

search_user_groups

Signature

search_user_groups(groupname: str, x_request_id: Optional[str], page: Optional[int], page_size: Optional[int])-> list[UserGroupSearchItem]

Search groups by groupname

This endpoint is to search groups by group name. It’s open for all authenticated requests.

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.UsergroupApi(harbor_client.ApiClient(configuration))
groupname = 'groupname_example' # str | Group name for filtering results.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
page = 1 # int | The page number (optional) (default to 1)
page_size = 10 # int | The size of per page (optional) (default to 10)

try:
    # Search groups by groupname
    api_response = api_instance.search_user_groups(groupname, x_request_id=x_request_id, page=page, page_size=page_size)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UsergroupApi->search_user_groups: %s\n" % e)

Parameters

NameTypeDescriptionNotes
groupnamestrGroup name for filtering results.
x_request_idstrAn unique ID for the request[optional]
pageintThe page number[optional] [default to 1]
page_sizeintThe size of per page[optional] [default to 10]

Return type

list[UserGroupSearchItem]

Authorization

basic

HTTP request headers

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

[Back to top]

update_user_group

Signature

update_user_group(group_id: int, x_request_id: Optional[str], usergroup: Optional[UserGroup])-> None

Update group information

Update user group 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.UsergroupApi(harbor_client.ApiClient(configuration))
group_id = 789 # int | Group ID
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
usergroup = harbor_client.UserGroup() # UserGroup |  (optional)

try:
    # Update group information
    api_instance.update_user_group(group_id, x_request_id=x_request_id, usergroup=usergroup)
except ApiException as e:
    print("Exception when calling UsergroupApi->update_user_group: %s\n" % e)

Parameters

NameTypeDescriptionNotes
group_idintGroup ID
x_request_idstrAn unique ID for the request[optional]
usergroupUserGroup[optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

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

[Back to top]