harbor_client.LdapApi

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

MethodHTTP requestDescription
import_ldap_userPOST /ldap/users/importImport selected available ldap users.
ping_ldapPOST /ldap/pingPing available ldap service.
search_ldap_groupGET /ldap/groups/searchSearch available ldap groups.
search_ldap_userGET /ldap/users/searchSearch available ldap users.

import_ldap_user

Signature

import_ldap_user(uid_list: LdapImportUsers, x_request_id: Optional[str])-> None

Import selected available ldap users.

This endpoint adds the selected available ldap users to harbor based on related configuration parameters from the system. System will try to guess the user email address and realname, add to harbor user information. If have errors when import user, will return the list of importing failed uid and the failed reason.

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.LdapApi(harbor_client.ApiClient(configuration))
uid_list = harbor_client.LdapImportUsers() # LdapImportUsers | The uid listed for importing. This list will check users validity of ldap service based on configuration from the system.
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)

try:
    # Import selected available ldap users.
    api_instance.import_ldap_user(uid_list, x_request_id=x_request_id)
except ApiException as e:
    print("Exception when calling LdapApi->import_ldap_user: %s\n" % e)

Parameters

NameTypeDescriptionNotes
uid_listLdapImportUsersThe uid listed for importing. This list will check users validity of ldap service based on configuration from the system.
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]

ping_ldap

Signature

ping_ldap(x_request_id: Optional[str], ldapconf: Optional[LdapConf])-> LdapPingResult

Ping available ldap service.

This endpoint ping the available ldap service for test related configuration parameters.

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.LdapApi(harbor_client.ApiClient(configuration))
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
ldapconf = harbor_client.LdapConf() # LdapConf | ldap configuration. support input ldap service configuration. If it is a empty request, will load current configuration from the system. (optional)

try:
    # Ping available ldap service.
    api_response = api_instance.ping_ldap(x_request_id=x_request_id, ldapconf=ldapconf)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling LdapApi->ping_ldap: %s\n" % e)

Parameters

NameTypeDescriptionNotes
x_request_idstrAn unique ID for the request[optional]
ldapconfLdapConfldap configuration. support input ldap service configuration. If it is a empty request, will load current configuration from the system.[optional]

Return type

LdapPingResult

Authorization

basic

HTTP request headers

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

[Back to top]

search_ldap_group

Signature

search_ldap_group(x_request_id: Optional[str], groupname: Optional[str], groupdn: Optional[str])-> list[UserGroup]

Search available ldap groups.

This endpoint searches the available ldap groups based on related configuration parameters. support to search by groupname or groupdn.

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.LdapApi(harbor_client.ApiClient(configuration))
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
groupname = 'groupname_example' # str | Ldap group name (optional)
groupdn = 'groupdn_example' # str | The LDAP group DN (optional)

try:
    # Search available ldap groups.
    api_response = api_instance.search_ldap_group(x_request_id=x_request_id, groupname=groupname, groupdn=groupdn)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling LdapApi->search_ldap_group: %s\n" % e)

Parameters

NameTypeDescriptionNotes
x_request_idstrAn unique ID for the request[optional]
groupnamestrLdap group name[optional]
groupdnstrThe LDAP group DN[optional]

Return type

list[UserGroup]

Authorization

basic

HTTP request headers

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

[Back to top]

search_ldap_user

Signature

search_ldap_user(x_request_id: Optional[str], username: Optional[str])-> list[LdapUser]

Search available ldap users.

This endpoint searches the available ldap users based on related configuration parameters. Support searched by input ladp configuration, load configuration from the system and specific filter.

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.LdapApi(harbor_client.ApiClient(configuration))
x_request_id = 'x_request_id_example' # str | An unique ID for the request (optional)
username = 'username_example' # str | Registered user ID (optional)

try:
    # Search available ldap users.
    api_response = api_instance.search_ldap_user(x_request_id=x_request_id, username=username)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling LdapApi->search_ldap_user: %s\n" % e)

Parameters

NameTypeDescriptionNotes
x_request_idstrAn unique ID for the request[optional]
usernamestrRegistered user ID[optional]

Return type

list[LdapUser]

Authorization

basic

HTTP request headers

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

[Back to top]