get_system_alert_prefs

UsersApi.get_system_alert_prefs(role_id=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Get system alert subscription status

Returns the caller’s SNS email subscription for system alerts. Requires users.manage and system-settings.view. May update the user record when a pending confirmation has completed, or when the SNS subscription no longer exists.

Parameters:
  • role_id (str) – Amorphic role ID the request is authorized against. Must be a role the user belongs to. Also recorded in audit logs.

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

SystemAlertsInfo

Returns:

Returns the result object.

Request and Response Examples

HTTP: GET /system-alert-prefs

Success (HTTP 200)

SubscriptionStatus is no, pending, or yes. SubscriptionArn is present when status is pending or yes. Default when unset is no with no ARN. SNS missing the ARN returns no only.

Not subscribed

{
  "SubscriptionStatus": "no"
}

Waiting for email confirmation

{
  "SubscriptionStatus": "pending",
  "SubscriptionArn": "arn:aws:sns:us-east-1:123456789012:alerts:uuid",
  "SubscriptionRequestTime": "2024-06-01 12:00:00"
}

Confirmed

{
  "SubscriptionStatus": "yes",
  "SubscriptionArn": "arn:aws:sns:us-east-1:123456789012:alerts:uuid"
}

Errors

Documented error codes: AUTH-1001, AUTH-1003, AUTH-1030, IPV-1002, GE-1020, RTE-1001.

HTTP 400

Validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Codes: AUTH-1001, AUTH-1003, AUTH-1030 (users.manage and system-settings.view), IPV-1002 (user not found), GE-1020 (USER table update failed). GenericFailure is HTTP 400 on this Lambda.

Missing users.manage or system-settings.view

{
  "Message": "AUTH-1030 - User is not authorized to get system alert subscription status due to the following missing permission(s) - {'Users': ['manage'], 'System Settings': ['view']}"
}

Caller user record missing

{
  "Message": "IPV-1002 - Invalid UserId - user1, resource not found."
}

HTTP 500

InconsistentMetadataException uses {“Message”: “<CODE> - <text>”}. Other uncaught errors use {“Message”: “RTE-1001 - <exception>.”}.

Uncaught handler failure

{
  "Message": "RTE-1001 - 'NoneType' object is not subscriptable."
}