All URIs are relative to http://localhost/api/v2.0
Method | HTTP request | Description |
---|---|---|
create_webhook_policy_of_project | POST /projects/{project_name_or_id}/webhook/policies | Create project webhook policy. |
delete_webhook_policy_of_project | DELETE /projects/{project_name_or_id}/webhook/policies/{webhook_policy_id} | Delete webhook policy of a project |
get_supported_event_types | GET /projects/{project_name_or_id}/webhook/events | Get supported event types and notify types. |
get_webhook_policy_of_project | GET /projects/{project_name_or_id}/webhook/policies/{webhook_policy_id} | Get project webhook policy |
last_trigger | GET /projects/{project_name_or_id}/webhook/lasttrigger | Get project webhook policy last trigger info |
list_webhook_policies_of_project | GET /projects/{project_name_or_id}/webhook/policies | List project webhook policies. |
update_webhook_policy_of_project | PUT /projects/{project_name_or_id}/webhook/policies/{webhook_policy_id} | Update webhook policy of a project. |
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.
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)
Name | Type | Description | Notes |
---|---|---|---|
project_name_or_id | str | The name or id of the project | |
policy | WebhookPolicy | Properties "targets" and "event_types" needed. | |
x_request_id | str | An unique ID for the request | [optional] |
x_is_resource_name | 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] |
void (empty response body)
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.
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)
Name | Type | Description | Notes |
---|---|---|---|
project_name_or_id | str | The name or id of the project | |
webhook_policy_id | int | The ID of the webhook policy | |
x_request_id | str | An unique ID for the request | [optional] |
x_is_resource_name | 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] |
void (empty response body)
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.
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)
Name | Type | Description | Notes |
---|---|---|---|
project_name_or_id | str | The name or id of the project | |
x_request_id | str | An unique ID for the request | [optional] |
x_is_resource_name | 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] |
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.
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)
Name | Type | Description | Notes |
---|---|---|---|
project_name_or_id | str | The name or id of the project | |
webhook_policy_id | int | The ID of the webhook policy | |
x_request_id | str | An unique ID for the request | [optional] |
x_is_resource_name | 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] |
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.
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)
Name | Type | Description | Notes |
---|---|---|---|
project_name_or_id | str | The name or id of the project | |
x_request_id | str | An unique ID for the request | [optional] |
x_is_resource_name | 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] |
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.
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)
Name | Type | Description | Notes |
---|---|---|---|
project_name_or_id | str | The name or id of the project | |
x_request_id | str | An unique ID for the request | [optional] |
x_is_resource_name | 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 | 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 | 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 | int | The page number | [optional] [default to 1] |
page_size | int | The size of per page | [optional] [default to 10] |
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.
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)
Name | Type | Description | Notes |
---|---|---|---|
project_name_or_id | str | The name or id of the project | |
webhook_policy_id | int | The ID of the webhook policy | |
policy | WebhookPolicy | All properties needed except "id", "project_id", "creation_time", "update_time". | |
x_request_id | str | An unique ID for the request | [optional] |
x_is_resource_name | 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] |
void (empty response body)