# hooks

Hook scripts for specific events.
Set management node URL:

# GET /events/hooks/hook-points

List of all available hook points.

# Parameters

  • AuthorizationstringOAuth bearer token authorization header.

# Endpoint

curl -X GET http://mgmt-node:8080/api/events/hooks/hook-points 

# Response 200

  • namestring-
  • canChooseServerbooleanTrue for hook points running on Ceph nodes. False for hook points running on the management node.

# Example response

[
  {
    "name": "string",
    "canChooseServer": true
  }
]

# GET /events/hooks

List of all installed hook scripts.

# Parameters

  • AuthorizationstringOAuth bearer token authorization header.

# Endpoint

curl -X GET http://mgmt-node:8080/api/events/hooks 

# Response 200

  • idinteger-
  • scriptIdinteger-
  • scriptNamestring-
  • eventstring[PreNetworkConfig, PostNetworkConfig, PreDaemonStart, PostDaemonStart, PreFormatDisk, PostFormatDisk, PostCephDaemonStart, OnHealthDegrade, OnHealthRecover, PreCrushMapChange, PostCrushMapChange, PostConfigChanged]
  • allServersboolean-
  • serverIdsarray-
  • serverNamesarray-

# Example response

[
  {
    "id": 0,
    "scriptId": 0,
    "scriptName": "string",
    "event": "PreNetworkConfig",
    "allServers": true,
    "serverIds": [
      0
    ],
    "serverNames": [
      "string"
    ]
  }
]

# POST /events/hooks

Install a hook script at a given hook point.

# Parameters

  • bodyobject-
    • scriptIdinteger-
    • eventstring[PreNetworkConfig, PostNetworkConfig, PreDaemonStart, PostDaemonStart, PreFormatDisk, PostFormatDisk, PostCephDaemonStart, OnHealthDegrade, OnHealthRecover, PreCrushMapChange, PostCrushMapChange, PostConfigChanged]
    • allServersboolean-
    • serverIdsarray-
  • AuthorizationstringOAuth bearer token authorization header.

# Endpoint

curl -X POST http://mgmt-node:8080/api/events/hooks 

# Example body

{
  "scriptId": 0,
  "event": "PreNetworkConfig",
  "allServers": true,
  "serverIds": [
    0
  ]
}

# DELETE /events/hooks/{id}

Delete a hook event.

# Parameters

  • idinteger-
  • AuthorizationstringOAuth bearer token authorization header.

# Endpoint

curl -X DELETE http://mgmt-node:8080/api/events/hooks/{id} 

# PATCH /events/hooks/{id}

Install a hook script at a given hook point.

# Parameters

  • idinteger-
  • bodyobject-
    • scriptIdinteger-
    • eventstring[PreNetworkConfig, PostNetworkConfig, PreDaemonStart, PostDaemonStart, PreFormatDisk, PostFormatDisk, PostCephDaemonStart, OnHealthDegrade, OnHealthRecover, PreCrushMapChange, PostCrushMapChange, PostConfigChanged]
    • allServersboolean-
    • serverIdsarray-
  • AuthorizationstringOAuth bearer token authorization header.

# Endpoint

curl -X PATCH http://mgmt-node:8080/api/events/hooks/{id} 

# Example body

{
  "scriptId": 0,
  "event": "PreNetworkConfig",
  "allServers": true,
  "serverIds": [
    0
  ]
}

# POST /events/hooks/{id}/execute

Run a hook script now.

# Parameters

  • idinteger-
  • AuthorizationstringOAuth bearer token authorization header.

# Endpoint

curl -X POST http://mgmt-node:8080/api/events/hooks/{id}/execute 

# GET /events/scripts/{id}

Get the script file contents.

# Parameters

  • idinteger-
  • AuthorizationstringOAuth bearer token authorization header.

# Endpoint

curl -X GET http://mgmt-node:8080/api/events/scripts/{id} 

# Response 200

# Example response

"string"

# DELETE /events/scripts/{id}

Delete a script file.

# Parameters

  • idinteger-
  • AuthorizationstringOAuth bearer token authorization header.

# Endpoint

curl -X DELETE http://mgmt-node:8080/api/events/scripts/{id} 

# PATCH /events/scripts/{id}

Update or rename a script file.

# Parameters

  • idinteger-
  • bodyobject-
    • namestring-
    • contentsstring-
  • AuthorizationstringOAuth bearer token authorization header.

# Endpoint

curl -X PATCH http://mgmt-node:8080/api/events/scripts/{id} 

# Example body

{
  "name": "string",
  "contents": "string"
}

# GET /events/scripts

List of all script files.

# Parameters

  • AuthorizationstringOAuth bearer token authorization header.

# Endpoint

curl -X GET http://mgmt-node:8080/api/events/scripts 

# Response 200

  • idinteger-
  • namestring-

# Example response

[
  {
    "id": 0,
    "name": "string"
  }
]

# POST /events/scripts

Create a script file.

# Parameters

  • bodyobject-
    • namestring-
    • contentsstring-
  • AuthorizationstringOAuth bearer token authorization header.

# Endpoint

curl -X POST http://mgmt-node:8080/api/events/scripts 

# Example body

{
  "name": "string",
  "contents": "string"
}

# Response 200

  • idobject-

# Example response

{
  "id": {}
}