建立新的執行掛鉤
POST /accounts/{account_id}/core/v1/executionHooks
指示要建立的 Execution Hook API 資源的期望值。
參數
| Name | 類型 | 在 | 必要 | 說明 |
|---|---|---|---|---|
account_id |
字串 |
路徑 |
True |
包含帳戶資源的 ID
|
請求本文
指示要建立的 Execution Hook API 資源的期望值。
| Name | 類型 | 必要 | 說明 |
|---|---|---|---|
類型 |
字串 |
True |
資源的媒體類型。定義的值為:
|
版本 |
字串 |
True |
資源版本。定義的值為:
|
姓名 |
字串 |
True |
包含使用者指定資源名稱的 JSON 字串。定義的值為:
|
hookType |
字串 |
True |
定義勾點類型的 JSON 字串。定義的值為:
|
matchingCriteria |
錯誤 |
描述執行鉤子匹配條件的 JSON 物件 JSON 陣列。當指定多個 matchingCriteria 時,會對條件套用邏輯 AND。定義的值為:
|
|
動作 |
字串 |
True |
JSON 字串,指示在符合條件的情況下,執行掛鉤將執行哪個動作。定義的值為:
|
階段 |
字串 |
True |
JSON 字串,指示掛鉤將在動作的哪個階段執行。定義的值為:
|
hookSourceID |
字串 |
True |
包含透過此執行掛鉤執行的掛鉤來源 ID 的 JSON 字串。定義的值為:
|
引數 |
陣列[string] |
錯誤 |
來源引數的 JSON 字串 JSON 陣列。定義的值為:
|
appID |
字串 |
True |
包含此鉤子所關聯應用程式 ID 的 JSON 字串。本質上,其他匹配條件(如果已設定)。定義的值為:
|
已啟用 |
字串 |
錯誤 |
指示執行掛鉤是否已啟用的 JSON 字串。定義的值為:
|
描述 |
字串 |
錯誤 |
包含使用者指定的 hook 來源描述的 JSON 字串。定義的值為:
|
中繼資料 |
錯誤 |
與資源相關聯的用戶端和服務指定中繼資料。定義的值為:
|
範例請求
{
"type": "application/astra-executionHook",
"version": "1.2",
"name": "Payroll",
"hookType": "custom",
"action": "snapshot",
"stage": "pre",
"hookSourceID": "50e89023-ba84-435d-bb47-1833f4c250ff",
"arguments": [
"freeze"
],
"appID": "7be5ae7c-151d-4230-ac39-ac1d0b33c2a9",
"enabled": "true",
"description": "Payroll production hook"
}
回應
Status: 201, Returns the newly created executionHook resource in the JSON response body.
| Name | 類型 | 必要 | 說明 |
|---|---|---|---|
類型 |
字串 |
True |
資源的媒體類型。定義的值為:
|
版本 |
字串 |
True |
資源版本。定義的值為:
|
ID |
字串 |
True |
資源的全域唯一識別碼。定義的值為:
|
姓名 |
字串 |
True |
包含使用者指定資源名稱的 JSON 字串。定義的值為:
|
hookType |
字串 |
True |
定義勾點類型的 JSON 字串。定義的值為:
|
matchingCriteria |
True |
描述執行鉤子匹配條件的 JSON 物件 JSON 陣列。當指定多個 matchingCriteria 時,會對條件套用邏輯 AND。定義的值為:
|
|
matchingContainers |
錯誤 |
JSON 陣列,其中包含定義應用程式中符合已設定比對條件的每個容器的 JSON 物件。 |
|
matchingImages |
陣列[string] |
錯誤 |
符合容器映像的 JSON 字串 JSON 陣列。定義的值為:
|
動作 |
字串 |
True |
JSON 字串,指示在符合條件的情況下,執行掛鉤將執行哪個動作。定義的值為:
|
階段 |
字串 |
True |
JSON 字串,指示掛鉤將在動作的哪個階段執行。定義的值為:
|
hookSourceID |
字串 |
True |
包含透過此執行掛鉤執行的掛鉤來源 ID 的 JSON 字串。定義的值為:
|
引數 |
陣列[string] |
錯誤 |
來源引數的 JSON 字串 JSON 陣列。定義的值為:
|
appID |
字串 |
錯誤 |
包含此鉤子所關聯應用程式 ID 的 JSON 字串。本質上,其他匹配條件(如果已設定)。定義的值為:
|
已啟用 |
字串 |
True |
指示執行掛鉤是否已啟用的 JSON 字串。定義的值為:
|
描述 |
字串 |
錯誤 |
包含使用者指定的 hook 來源描述的 JSON 字串。定義的值為:
|
中繼資料 |
True |
與資源相關聯的用戶端和服務指定中繼資料。定義的值為:
|
範例回應
{
"type": "application/astra-executionHook",
"version": "1.2",
"id": "946e60cb-980b-5374-9e6e-9fe1f6780352",
"name": "Payroll",
"hookType": "custom",
"matchingCriteria": [],
"action": "snapshot",
"stage": "pre",
"hookSourceID": "50e89023-ba84-435d-bb47-1833f4c250ff",
"arguments": [
"freeze"
],
"appID": "7be5ae7c-151d-4230-ac39-ac1d0b33c2a9",
"enabled": "true",
"description": "Payroll production hook",
"metadata": {
"labels": [],
"creationTimestamp": "2022-10-06T20:58:16.305662Z",
"modificationTimestamp": "2022-10-06T20:58:16.305662Z",
"createdBy": "8f84cf09-8036-51e4-b579-bd30cb07b269"
}
}
回應
Status: 401, Unauthorized
| Name | 類型 | 必要 | 說明 |
|---|---|---|---|
類型 |
字串 |
True |
|
標題 |
字串 |
True |
|
詳細資料 |
字串 |
True |
|
狀態 |
字串 |
True |
|
correlationID |
字串 |
錯誤 |
範例回應
{
"type": "https://astra.netapp.io/problems/3",
"title": "Missing bearer token",
"detail": "The request is missing the required bearer token.",
"status": "401"
}
回應
Status: 400, Bad request
| Name | 類型 | 必要 | 說明 |
|---|---|---|---|
類型 |
字串 |
True |
|
標題 |
字串 |
True |
|
詳細資料 |
字串 |
True |
|
狀態 |
字串 |
True |
|
correlationID |
字串 |
錯誤 |
|
invalidFields |
陣列["invalidFields"] |
錯誤 |
無效請求本文欄位清單 |
範例回應
{
"type": "https://astra.netapp.io/problems/5",
"title": "Invalid query parameters",
"detail": "The supplied query parameters are invalid.",
"status": "400"
}
回應
Status: 409, Conflict
| Name | 類型 | 必要 | 說明 |
|---|---|---|---|
類型 |
字串 |
True |
|
標題 |
字串 |
True |
|
詳細資料 |
字串 |
True |
|
狀態 |
字串 |
True |
|
correlationID |
字串 |
錯誤 |
範例回應
{
"type": "https://astra.netapp.io/problems/10",
"title": "JSON resource conflict",
"detail": "The request body JSON contains a field that conflicts with an idempotent value.",
"status": "409"
}
回應
Status: 403, Forbidden
| Name | 類型 | 必要 | 說明 |
|---|---|---|---|
類型 |
字串 |
True |
|
標題 |
字串 |
True |
|
詳細資料 |
字串 |
True |
|
狀態 |
字串 |
True |
|
correlationID |
字串 |
錯誤 |
範例回應
{
"type": "https://astra.netapp.io/problems/11",
"title": "Operation not permitted",
"detail": "The requested operation isn't permitted.",
"status": "403"
}
錯誤
Status: 404, Not found
| Name | 類型 | 必要 | 說明 |
|---|---|---|---|
類型 |
字串 |
True |
|
標題 |
字串 |
True |
|
詳細資料 |
字串 |
True |
|
狀態 |
字串 |
True |
|
correlationID |
字串 |
錯誤 |
範例錯誤回應
{
"type": "https://astra.netapp.io/problems/2",
"title": "Collection not found",
"detail": "The collection specified in the request URI wasn't found.",
"status": "404"
}
定義
請參閱定義
matchingCriteria
| Name | 類型 | 必要 | 說明 |
|---|---|---|---|
類型 |
字串 |
錯誤 |
識別比對條件類型的 JSON 字串。 |
值 |
字串 |
錯誤 |
包含用於比對指定比對類型的正規表示式的 JSON 字串。正規表示式語法: https://github.com/google/re2/wiki/Syntax |
type_astra_label
| Name | 類型 | 必要 | 說明 |
|---|---|---|---|
姓名 |
字串 |
True |
|
值 |
字串 |
True |
type_astra_metadata_update
與資源相關聯的用戶端和服務指定中繼資料。定義的值為:
-
符合 Astra Metadata Schema。如果在建立時未指定、則會建立沒有標籤的中繼資料物件。如果在更新時未指定,元資料物件的標籤、creationTimestamp 和 createdBy 將保持不變。
| Name | 類型 | 必要 | 說明 |
|---|---|---|---|
標籤 |
錯誤 |
||
建立時間戳記 |
字串 |
錯誤 |
|
修改時間戳記 |
字串 |
錯誤 |
|
建立者 |
字串 |
錯誤 |
|
modifiedBy |
字串 |
錯誤 |
matchingCriteria
| Name | 類型 | 必要 | 說明 |
|---|---|---|---|
類型 |
字串 |
True |
識別比對條件類型的 JSON 字串。 |
值 |
字串 |
True |
包含用於比對指定比對類型的正規表示式的 JSON 字串。正規表示式語法: https://github.com/google/re2/wiki/Syntax |
type_k8s_label
| Name | 類型 | 必要 | 說明 |
|---|---|---|---|
姓名 |
字串 |
True |
|
值 |
字串 |
True |
matchingContainers
| Name | 類型 | 必要 | 說明 |
|---|---|---|---|
podName |
字串 |
錯誤 |
符合容器 pod 名稱的 JSON 字串。 |
podLabels |
陣列["type_k8s_label"] |
錯誤 |
符合容器 pod 標籤的標籤物件 JSON 陣列。 |
containerImage |
字串 |
錯誤 |
相符容器映像的 JSON 字串。 |
containerName |
字串 |
錯誤 |
符合容器名稱的 JSON 字串。 |
namespaceName |
字串 |
錯誤 |
符合容器的 Pod 命名空間名稱的 JSON 字串。 |
invalidParams
| Name | 類型 | 必要 | 說明 |
|---|---|---|---|
姓名 |
字串 |
True |
無效查詢參數的名稱 |
原因 |
字串 |
True |
查詢參數無效的原因 |
invalidFields
| Name | 類型 | 必要 | 說明 |
|---|---|---|---|
姓名 |
字串 |
True |
無效請求內文欄位的名稱 |
原因 |
字串 |
True |
請求本文欄位無效的原因 |