Skip to main content
Astra Automation
此產品有較新版本可以使用。
本繁體中文版使用機器翻譯,譯文僅供參考,若與英文版本牴觸,應以英文版本為準。

列出所有執行掛鉤

GET /accounts/{account_id}/core/v1/executionHooks

傳回集合中所有符合資源的 JSON 陣列。如果在請求中指定了個別欄位,則項目 JSON 陣列將按指定順序包含每個相符資源所請求的欄位。

參數

Name 類型 必要 說明

account_id

字串

路徑

True

包含帳戶資源的 ID

  • 範例:{{.Account}}

包括

字串

查詢

錯誤

指示列出集合時應傳回哪些欄位。

URL 範例:「include=id」、「include=id,name」

OpenAPI 範例:"id"

限制

字串

查詢

錯誤

表示列出集合時要傳回的資源數量上限。

URL 範例:「limit=2」

OpenAPI 範例:「2」

篩選器

字串

查詢

錯誤

指示在列出集合時,為了傳回資源而應符合哪些欄位。

支援的運算子包括:

  • eq - 等式

  • lt/gt - 小於/大於

  • lte/gte - 小於或等於/大於或等於

URL 範例:「filter=field%20eq%20%27value%27」

OpenAPI 範例:"field eq 'value'"

回應

Status: 200, Returns a JSON array of all matching resources in the collection. If individual fields are specified in the request, the items JSON array will contain the fields requested for each matching resource in the order specified.
Name 類型 必要 說明

項目

array[任何: "executionHook_1.3_get_response_body"、array[]]

True

中繼資料

"type_astra_metadata_list"

True

範例回應
{
  "type": "application/astra-executionHooks",
  "version": "1.3",
  "items": [
    {
      "type": "application/astra-executionHook",
      "version": "1.1",
      "id": "4c64792c-806b-4457-938d-8e325a37c593",
      "name": "Payroll",
      "hookType": "custom",
      "matchingCriteria": [
        {
          "type": "containerImage",
          "value": "payroll"
        },
        {
          "type": "podName",
          "value": "^payroll-master"
        }
      ],
      "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": "2020-08-06T12:24:52.256624Z",
        "modificationTimestamp": "2020-08-06T12:24:52.256624Z",
        "createdBy": "64182074-ddb6-42eb-b7f4-b6a02cf9ba7c"
      }
    },
    {
      "type": "application/astra-executionHook",
      "version": "1.1",
      "id": "6659892c-c621-44e8-a0bb-8dbdf378a2dd",
      "name": "Order Processing",
      "hookType": "custom",
      "matchingCriteria": [
        {
          "type": "containerName",
          "value": "^order-processing$"
        },
        {
          "type": "podLabel",
          "value": "^app=master$|^app=data$"
        }
      ],
      "action": "snapshot",
      "stage": "pre",
      "hookSourceID": "63f4d6fd-b7f0-4eaa-9890-0b11123604b1",
      "arguments": [
        "freeze"
      ],
      "appID": "7be5ae7c-151d-4230-ac39-ac1d0b33c2a9",
      "enabled": "true",
      "description": "Order processing hook",
      "metadata": {
        "labels": [],
        "creationTimestamp": "2020-08-06T12:24:52.256624Z",
        "modificationTimestamp": "2020-08-06T12:24:52.256624Z",
        "createdBy": "64182074-ddb6-42eb-b7f4-b6a02cf9ba7c"
      }
    },
    {
      "type": "application/astra-executionHook",
      "version": "1.1",
      "id": "6659892c-c621-44e8-a0bb-8dbdf378a2dd",
      "name": "NetApp Postgres Hook",
      "hookType": "netapp",
      "matchingCriteria": [
        {
          "type": "podName",
          "value": "^postgres"
        },
        {
          "type": "containerImage",
          "value": "3.8"
        }
      ],
      "action": "snapshot",
      "stage": "pre",
      "hookSourceID": "3601ed09-1a74-4156-a1bd-9cb7144bac0e",
      "arguments": [
        "freeze"
      ],
      "enabled": "true",
      "description": "Order processing hook",
      "metadata": {
        "labels": [],
        "creationTimestamp": "2020-08-06T12:24:52.256624Z",
        "modificationTimestamp": "2020-08-06T12:24:52.256624Z",
        "createdBy": "64182074-ddb6-42eb-b7f4-b6a02cf9ba7c"
      }
    },
    {
      "type": "application/astra-executionHook",
      "version": "1.1",
      "id": "6659892c-c621-44e8-a0bb-8dbdf378a2dd",
      "name": "Redis Hook",
      "hookType": "custom",
      "matchingCriteria": [
        {
          "type": "containerName",
          "value": "^redis-01$"
        }
      ],
      "action": "snapshot",
      "stage": "pre",
      "hookSourceID": "3601ed09-1a74-4156-a1bd-9cb7144bac0e",
      "arguments": [
        "freeze"
      ],
      "enabled": "true",
      "description": "Order processing hook",
      "metadata": {
        "labels": [],
        "creationTimestamp": "2020-08-06T12:24:52.256624Z",
        "modificationTimestamp": "2020-08-06T12:24:52.256624Z",
        "createdBy": "64182074-ddb6-42eb-b7f4-b6a02cf9ba7c"
      }
    }
  ],
  "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

字串

錯誤

invalidParams

陣列["invalidParams"]

錯誤

無效查詢參數清單

範例回應
{
  "type": "https://astra.netapp.io/problems/5",
  "title": "Invalid query parameters",
  "detail": "The supplied query parameters are invalid.",
  "status": "400"
}

回應

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 類型 必要 說明

類型

字串

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 字串。

type_astra_label

Name 類型 必要 說明

姓名

字串

True

字串

True

type_astra_metadata_update

與資源相關聯的用戶端和服務指定中繼資料。定義的值為:

  • 符合 Astra Metadata Schema。如果在建立時未指定、則會建立沒有標籤的中繼資料物件。如果在更新時未指定,元資料物件的標籤、creationTimestamp 和 createdBy 將保持不變。

Name 類型 必要 說明

標籤

陣列["type_astra_label"]

錯誤

建立時間戳記

字串

錯誤

修改時間戳記

字串

錯誤

建立者

字串

錯誤

modifiedBy

字串

錯誤

executionHook_1.3_get_response_body

Name 類型 必要 說明

類型

字串

True

資源的媒體類型。定義的值為:

  • "應用程式/astra-executionHook"

版本

字串

True

資源版本。定義的值為:

  • "1.0"

  • "1.1"

  • "1.2"

  • "1.3"

ID

字串

True

資源的全域唯一識別碼。定義的值為:

  • 符合 UUIDv4 架構

姓名

字串

True

包含使用者指定資源名稱的 JSON 字串。定義的值為:

  • 最短長度:1

  • 最大長度:63 名稱在所有執行掛鉤資源中必須是唯一的。

hookType

字串

True

定義勾點類型的 JSON 字串。定義的值為:

  • "netapp" - NetApp 提供的執行鉤子。

  • 「custom」- 與特定的應用程式 ID 綁定。具有 hookType 「netapp」的執行鉤子資源為唯讀。

matchingCriteria

陣列["matchingCriteria"]

True

描述執行鉤子匹配條件的 JSON 物件 JSON 陣列。當指定多個 matchingCriteria 時,會對條件套用邏輯 AND。定義的值為:

  • 最少項目數:0

  • 項目上限:10

matchingContainers

陣列["matchingContainers"]

錯誤

JSON 陣列,其中包含定義應用程式中符合已設定比對條件的每個容器的 JSON 物件。

matchingImages

陣列[string]

錯誤

符合容器映像的 JSON 字串 JSON 陣列。定義的值為:

  • 最少項目數:0

  • 項目上限:4095

  • 最短長度:1

  • 最大長度:255

動作

字串

True

JSON 字串,指示在符合條件的情況下,執行掛鉤將執行哪個動作。定義的值為:

  • 「Snapshot」

  • 「備份」

  • 「還原」

  • 「容錯移轉」

階段

字串

True

JSON 字串,指示掛鉤將在動作的哪個階段執行。定義的值為:

  • "pre" - 執行鉤子將在指定操作之前執行。

  • "post" - 執行掛鉤將在指定動作之後執行。動作 "snapshot" 的值為 "pre" 和 "post"。動作 "backup" 的值為 "pre" 和 "post"。動作 "restore" 的值為 "post"。動作 "failover" 的值為 "post"。

hookSourceID

字串

True

包含透過此執行掛鉤執行的掛鉤來源 ID 的 JSON 字串。定義的值為:

  • 符合 Astra 識別符架構

引數

陣列[string]

錯誤

來源引數的 JSON 字串 JSON 陣列。定義的值為:

  • 最少項目數:0

  • 項目上限:16

  • 最短長度:0

  • 最大長度:127

appID

字串

錯誤

包含此鉤子所關聯應用程式 ID 的 JSON 字串。本質上,其他匹配條件(如果已設定)。定義的值為:

  • 符合 Astra 識別符架構

已啟用

字串

True

指示執行掛鉤是否已啟用的 JSON 字串。定義的值為:

  • "true" - 執行鉤子已啟用,並將按指定方式執行。

  • 「false」-執行鉤子已停用,永遠無法運作。預設值為「true」。

描述

字串

錯誤

包含使用者指定的 hook 來源描述的 JSON 字串。定義的值為:

  • 最短長度:0

  • 最大長度:511

中繼資料

"type_astra_metadata_update"

True

與資源相關聯的用戶端和服務指定中繼資料。定義的值為:

  • 符合 Astra Metadata Schema。如果在建立時未指定、則會建立沒有標籤的中繼資料物件。如果在更新時未指定,元資料物件的標籤、creationTimestamp 和 createdBy 將保持不變。

type_astra_metadata_list

Name 類型 必要 說明

繼續

字串

錯誤

數字

錯誤

標籤

陣列["type_astra_label"]

錯誤

建立時間戳記

字串

錯誤

修改時間戳記

字串

錯誤

建立者

字串

錯誤

modifiedBy

字串

錯誤

invalidParams

Name 類型 必要 說明

姓名

字串

True

無效查詢參數的名稱

原因

字串

True

查詢參數無效的原因