harbor_client.WebhookApi

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

MethodHTTP requestDescription
create_webhook_policy_of_projectPOST /projects/{project_name_or_id}/webhook/policiesCreate project webhook policy.
delete_webhook_policy_of_projectDELETE /projects/{project_name_or_id}/webhook/policies/{webhook_policy_id}Delete webhook policy of a project
get_supported_event_typesGET /projects/{project_name_or_id}/webhook/eventsGet supported event types and notify types.
get_webhook_policy_of_projectGET /projects/{project_name_or_id}/webhook/policies/{webhook_policy_id}Get project webhook policy
last_triggerGET /projects/{project_name_or_id}/webhook/lasttriggerGet project webhook policy last trigger info
list_webhook_policies_of_projectGET /projects/{project_name_or_id}/webhook/policiesList project webhook policies.
update_webhook_policy_of_projectPUT /projects/{project_name_or_id}/webhook/policies/{webhook_policy_id}Update webhook policy of a project.

create_webhook_policy_of_project

Signature

create_webhook_policy_of_project(project_name_or_id: str, policy: WebhookPolicy, x_request_id: Optional[str], x_is_resource_name: Optional[bool])-> None

Create project webhook policy.

This endpoint create a webhook policy if the project does not have one.

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.WebhookApi(harbor_client.ApiClient(configuration))
project_name_or_id = 'project_name_or_id_example' # str | The name or id of the project
policy = harbor_client.WebhookPolicy() # WebhookPolicy | Properties \"targets\" and \"event_types\" needed.
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:
    # Create project webhook policy.
    api_instance.create_webhook_policy_of_project(project_name_or_id, policy, x_request_id=x_request_id, x_is_resource_name=x_is_resource_name)
except ApiException as e:
    print("Exception when calling WebhookApi->create_webhook_policy_of_project: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_name_or_idstrThe name or id of the project
policyWebhookPolicyProperties "targets" and "event_types" needed.
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]

delete_webhook_policy_of_project

Signature

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

Delete webhook policy of a project

This endpoint is aimed to delete webhookpolicy of a project.

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.WebhookApi(harbor_client.ApiClient(configuration))
project_name_or_id = 'project_name_or_id_example' # str | The name or id of the project
webhook_policy_id = 789 # int | The ID of the webhook policy
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 webhook policy of a project
    api_instance.delete_webhook_policy_of_project(project_name_or_id, webhook_policy_id, x_request_id=x_request_id, x_is_resource_name=x_is_resource_name)
except ApiException as e:
    print("Exception when calling WebhookApi->delete_webhook_policy_of_project: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_name_or_idstrThe name or id of the project
webhook_policy_idintThe ID of the webhook policy
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_supported_event_types

Signature

get_supported_event_types(project_name_or_id: str, x_request_id: Optional[str], x_is_resource_name: Optional[bool])-> SupportedWebhookEventTypes

Get supported event types and notify types.

Get supportted event types and notify types.

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.WebhookApi(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)

try:
    # Get supported event types and notify types.
    api_response = api_instance.get_supported_event_types(project_name_or_id, 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 WebhookApi->get_supported_event_types: %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]

Return type

SupportedWebhookEventTypes

Authorization

basic

HTTP request headers

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

[Back to top]

get_webhook_policy_of_project

Signature

get_webhook_policy_of_project(project_name_or_id: str, webhook_policy_id: int, x_request_id: Optional[str], x_is_resource_name: Optional[bool])-> WebhookPolicy

Get project webhook policy

This endpoint returns specified webhook policy of a project.

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.WebhookApi(harbor_client.ApiClient(configuration))
project_name_or_id = 'project_name_or_id_example' # str | The name or id of the project
webhook_policy_id = 789 # int | The ID of the webhook policy
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 project webhook policy
    api_response = api_instance.get_webhook_policy_of_project(project_name_or_id, webhook_policy_id, 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 WebhookApi->get_webhook_policy_of_project: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_name_or_idstrThe name or id of the project
webhook_policy_idintThe ID of the webhook policy
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

WebhookPolicy

Authorization

basic

HTTP request headers

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

[Back to top]

last_trigger

Signature

last_trigger(project_name_or_id: str, x_request_id: Optional[str], x_is_resource_name: Optional[bool])-> list[WebhookLastTrigger]

Get project webhook policy last trigger info

This endpoint returns last trigger information of project webhook policy.

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.WebhookApi(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)

try:
    # Get project webhook policy last trigger info
    api_response = api_instance.last_trigger(project_name_or_id, 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 WebhookApi->last_trigger: %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]

Return type

list[WebhookLastTrigger]

Authorization

basic

HTTP request headers

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

[Back to top]

list_webhook_policies_of_project

Signature

list_webhook_policies_of_project(project_name_or_id: str, x_request_id: Optional[str], x_is_resource_name: Optional[bool], sort: Optional[str], q: Optional[str], page: Optional[int], page_size: Optional[int])-> list[WebhookPolicy]

List project webhook policies.

This endpoint returns webhook policies of a project.

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.WebhookApi(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)
sort = 'sort_example' # str | Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with \"sort=field1,-field2\" (optional)
q = 'q_example' # str | Query string to query resources. Supported query patterns are \"exact match(k=v)\", \"fuzzy match(k=~v)\", \"range(k=[min~max])\", \"list with union releationship(k={v1 v2 v3})\" and \"list with intersetion relationship(k=(v1 v2 v3))\". The value of range and list can be string(enclosed by \" or '), integer or time(in format \"2020-04-09 02:36:00\"). All of these query patterns should be put in the query string \"q=xxx\" and splitted by \",\". e.g. q=k1=v1,k2=~v2,k3=[min~max] (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:
    # List project webhook policies.
    api_response = api_instance.list_webhook_policies_of_project(project_name_or_id, x_request_id=x_request_id, x_is_resource_name=x_is_resource_name, sort=sort, q=q, page=page, page_size=page_size)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling WebhookApi->list_webhook_policies_of_project: %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]
sortstrSort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with "sort=field1,-field2"[optional]
qstrQuery string to query resources. Supported query patterns are "exact match(k=v)", "fuzzy match(k=~v)", "range(k=[min~max])", "list with union releationship(k={v1 v2 v3})" and "list with intersetion relationship(k=(v1 v2 v3))". The value of range and list can be string(enclosed by " or '), integer or time(in format "2020-04-09 02:36:00"). All of these query patterns should be put in the query string "q=xxx" and splitted by ",". e.g. q=k1=v1,k2=~v2,k3=[min~max][optional]
pageintThe page number[optional] [default to 1]
page_sizeintThe size of per page[optional] [default to 10]

Return type

list[WebhookPolicy]

Authorization

basic

HTTP request headers

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

[Back to top]

update_webhook_policy_of_project

Signature

update_webhook_policy_of_project(project_name_or_id: str, webhook_policy_id: int, policy: WebhookPolicy, x_request_id: Optional[str], x_is_resource_name: Optional[bool])-> None

Update webhook policy of a project.

This endpoint is aimed to update the webhook policy of a project.

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.WebhookApi(harbor_client.ApiClient(configuration))
project_name_or_id = 'project_name_or_id_example' # str | The name or id of the project
webhook_policy_id = 789 # int | The ID of the webhook policy
policy = harbor_client.WebhookPolicy() # WebhookPolicy | All properties needed except \"id\", \"project_id\", \"creation_time\", \"update_time\".
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:
    # Update webhook policy of a project.
    api_instance.update_webhook_policy_of_project(project_name_or_id, webhook_policy_id, policy, x_request_id=x_request_id, x_is_resource_name=x_is_resource_name)
except ApiException as e:
    print("Exception when calling WebhookApi->update_webhook_policy_of_project: %s\n" % e)

Parameters

NameTypeDescriptionNotes
project_name_or_idstrThe name or id of the project
webhook_policy_idintThe ID of the webhook policy
policyWebhookPolicyAll properties needed except "id", "project_id", "creation_time", "update_time".
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]