Skip to main content
Uma versão mais recente deste produto está disponível.
O português é fornecido por meio de tradução automática para sua conveniência. O inglês precede o português em caso de inconsistências.

Create a new hook source

Colaboradores

POST /accounts/{account_id}/core/v1/hookSources

Indicates the desired values for the Hook Source API resource to be created.

Parameters

Name Type In Required Description

account_id

string

path

True

ID of the containing account resource

  • example: {{.Account}}

Request Body

Indicates the desired values for the Hook Source API resource to be created.

Name Type Required Description

type

string

True

Media type of the resource. Defined values are:

  • "application/astra-hookSource"

version

string

True

Version of the resource. Defined values are:

  • "1.0"

name

string

True

JSON string containing a user-specified name for the resource. Defined values are:

  • Minimum length: 1

  • Maximum length: 63 The name is required to be unique within all hook source resources.

sourceType

string

True

JSON string defining the hook source type. Defined values are:

  • "script" - Shell script. The plaintext source must not contain binary data or carriage-return characters, otherwise, an error is returned.

source

string

True

JSON string containing the script to be run in base64 format. Defined values are:

  • Minimum length: 0

  • Maximum length: 131072

  • Conforms to the base64 Encoded Data Schema The maximum size of a source value is 128 KiB when encoded using base64.

description

string

False

JSON string containing a user-specified description of the hook source. Defined values are:

  • Minimum length: 0

  • Maximum length: 511

metadata

type_astra_metadata_update

False

Client and service-specified metadata associated with the resource. Defined values are:

  • Conforms to the Astra Metadata Schema If not specified on create, a metadata object will be created with no labels. If not specified on update, the metadata object's labels, creationTimestamp and createdBy, will be preserved without modification.

Example request
{
  "type": "application/astra-hookSource",
  "version": "1.0",
  "name": "Payroll script",
  "sourceType": "script",
  "source": "ZWNobyAiVkhKaGJuTWdVbWxuYUhSeklRPT0iIHwgYmFzZTY0IC1k",
  "description": "Pre and post hook script for payroll"
}

Response

Status: 201, Returns the newly created hookSource resource in the JSON response body.
Name Type Required Description

type

string

True

Media type of the resource. Defined values are:

  • "application/astra-hookSource"

version

string

True

Version of the resource. Defined values are:

  • "1.0"

id

string

True

Globally unique identifier of the resource. Defined values are:

  • Conforms to the UUIDv4 Schema

name

string

True

JSON string containing a user-specified name for the resource. Defined values are:

  • Minimum length: 1

  • Maximum length: 63 The name is required to be unique within all hook source resources.

private

string

True

JSON string indicating whether the source field will be exposed in APIs or be intentionally left blank. Defined values are:

  • "true" - The source value is private and will not be exposed through the API.

  • "false" - The source value is not private and will be exposed through the API.

preloaded

string

True

JSON string that indicates whether the source was preloaded. Defined values are:

  • "true" - The source was preloaded.

  • "false" - The source was not preloaded. Preloaded hook source resources are read only.

sourceType

string

True

JSON string defining the hook source type. Defined values are:

  • "script" - Shell script. The plaintext source must not contain binary data or carriage-return characters, otherwise, an error is returned.

source

string

False

JSON string containing the script to be run in base64 format. Defined values are:

  • Minimum length: 0

  • Maximum length: 131072

  • Conforms to the base64 Encoded Data Schema The maximum size of a source value is 128 KiB when encoded using base64.

sourceMD5Checksum

string

True

JSON string containing the MD5 checksum computed for the value of the "source" key. Defined values are:

  • Defined regex is: "^([0-9a-fA-F]){32}$"

description

string

False

JSON string containing a user-specified description of the hook source. Defined values are:

  • Minimum length: 0

  • Maximum length: 511

metadata

type_astra_metadata_update

True

Client and service-specified metadata associated with the resource. Defined values are:

  • Conforms to the Astra Metadata Schema If not specified on create, a metadata object will be created with no labels. If not specified on update, the metadata object's labels, creationTimestamp and createdBy, will be preserved without modification.

Example response
{
  "type": "application/astra-hookSource",
  "version": "1.0",
  "id": "fae6dfbb-ecb8-58ff-a116-6357eb7c956a",
  "name": "Payroll script",
  "private": "false",
  "preloaded": "false",
  "sourceType": "script",
  "source": "ZWNobyAiVkhKaGJuTWdVbWxuYUhSeklRPT0iIHwgYmFzZTY0IC1k",
  "sourceMD5Checksum": "b1a4b8b0144c3f6be553b626130ca145",
  "description": "Pre and post hook script for payroll",
  "metadata": {
    "labels": [],
    "creationTimestamp": "2022-10-06T20:58:16.305662Z",
    "modificationTimestamp": "2022-10-06T20:58:16.305662Z",
    "createdBy": "8f84cf09-8036-51e4-b579-bd30cb07b269"
  }
}

Response

Status: 401, Unauthorized
Name Type Required Description

type

string

True

title

string

True

detail

string

True

status

string

True

correlationID

string

False

Example response
{
  "type": "https://astra.netapp.io/problems/3",
  "title": "Missing bearer token",
  "detail": "The request is missing the required bearer token.",
  "status": "401"
}

Response

Status: 400, Bad request
Name Type Required Description

type

string

True

title

string

True

detail

string

True

status

string

True

correlationID

string

False

invalidFields

array[invalidFields]

False

List of invalid request body fields

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

Response

Status: 409, Conflict
Name Type Required Description

type

string

True

title

string

True

detail

string

True

status

string

True

correlationID

string

False

invalidFields

array[invalidFields]

False

List of invalid request body fields

Example response
{
  "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"
}

Response

Status: 403, Forbidden
Name Type Required Description

type

string

True

title

string

True

detail

string

True

status

string

True

correlationID

string

False

Example response
{
  "type": "https://astra.netapp.io/problems/11",
  "title": "Operation not permitted",
  "detail": "The requested operation isn't permitted.",
  "status": "403"
}

Error

Status: 404, Not found
Name Type Required Description

type

string

True

title

string

True

detail

string

True

status

string

True

correlationID

string

False

Example error response
{
  "type": "https://astra.netapp.io/problems/2",
  "title": "Collection not found",
  "detail": "The collection specified in the request URI wasn't found.",
  "status": "404"
}

Definitions

See Definitions

type_astra_label

Name Type Required Description

name

string

True

value

string

True

type_astra_metadata_update

Client and service-specified metadata associated with the resource. Defined values are:

  • Conforms to the Astra Metadata Schema If not specified on create, a metadata object will be created with no labels. If not specified on update, the metadata object's labels, creationTimestamp and createdBy, will be preserved without modification.

Name Type Required Description

labels

array[type_astra_label]

False

creationTimestamp

string

False

modificationTimestamp

string

False

createdBy

string

False

modifiedBy

string

False

invalidParams

Name Type Required Description

name

string

True

Name of the invalid query parameter

reason

string

True

Reason why the query parameter is invalid

invalidFields

Name Type Required Description

name

string

True

Name of the invalid request body field

reason

string

True

Reason why the request body field is invalid