pydo.apps.assign_alert_destinations()

Description

Updates the emails and slack webhook destinations for app alerts. Emails must be associated to a user with access to the app.

Parameters

Name Type Required Description Default Value
app_id string True The app ID
alert_id string True The alert ID
body JSON or IO[bytes] True

Request Sample

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
    "emails": ["[email protected]"],
    "slack_webhooks": [
        {
            "url": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX",
            "channel": "Channel Name",
        }
    ],
}

post_resp = client.apps.assign_alert_destinations("12345", "24556", req)

Responses

See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.

A JSON object with an alert key. This is an object of type alert.

Click to expand an example response for apps.
{
  "value": {
    "alert": {
      "id": "e552e1f9-c1b0-4e6d-8777-ad6f27767306",
      "spec": {
        "rule": "DEPLOYMENT_FAILED"
      },
      "emails": [
        "[email protected]"
      ],
      "phase": "ACTIVE",
      "progress": {
        "steps": [
          {
            "name": "alert-configure-insight-alert",
            "status": "SUCCESS",
            "started_at": "2020-07-28T18:00:00Z",
            "ended_at": "2020-07-28T18:00:00Z"
          }
        ]
      }
    }
  }
}

Unauthorized

Click to expand an example response.
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}

The resource was not found.

Click to expand an example response.
{
  "id": "not_found",
  "message": "The resource you requested could not be found."
}

API Rate limit exceeded

Click to expand an example response.
{
  "id": "too_many_requests",
  "message": "API Rate limit exceeded."
}

Server error.

Click to expand an example response.
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}

Unexpected error

Click to expand an example response.
{
  "id": "example_error",
  "message": "some error message"
}