Skip to main content

alertings

Creates, updates, deletes, gets or lists an alertings resource.

Overview​

Namealertings
TypeResource
Idovh.cloud.alertings

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)ID of the alert
namestringName of the alert
creation_datestring (date-time)Creation date (wire: creationDate)
delayintegerDelay of the alert in seconds
emailstringEmail. DEPRECATED: use emails
emailsarrayReceiver of the alert
formatted_monthly_thresholdobjectformatted monthly threshold (wire: formattedMonthlyThreshold)
monthly_thresholdintegerMonthly threshold (wire: monthlyThreshold)
servicestringService of the alert (ai_endpoint, all, block_storage, data_platform, instances, instances_gpu, instances_without_gpu, objet_storage, rancher, snapshot)
statusstringStatus of the alert (deleted, disabled, ok)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectid, service_nameReturns the configuration of the billing alert: threshold, service, receivers and status.
listselectservice_namex_pagination_modeReturns the IDs of the billing alerts configured on the project.
createinsertservice_name, delay, monthly_thresholdCreates a billing alert with a monthly threshold, for one service or for all services. Sends an email to the receivers when the monthly spend on the service exceeds the threshold. Use emails, as email is deprecated.
updateupdateid, service_nameUpdates the threshold, service, receivers, delay or status of the billing alert. Use emails, as email is deprecated.
deletedeleteid, service_nameDeletes the billing alert configuration.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
idstring (uuid)Id
service_namestringThe Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set.
x_pagination_modestringSent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode)

SELECT examples​

Returns the configuration of the billing alert: threshold, service, receivers and status.

SELECT
id,
name,
creation_date,
delay,
email,
emails,
formatted_monthly_threshold,
monthly_threshold,
service,
status
FROM ovh.cloud.alertings
WHERE id = '{{ id }}' -- required
AND service_name = '{{ service_name }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;

INSERT examples​

Creates a billing alert with a monthly threshold, for one service or for all services. Sends an email to the receivers when the monthly spend on the service exceeds the threshold. Use emails, as email is deprecated.

INSERT INTO ovh.cloud.alertings (
delay,
email,
emails,
monthly_threshold,
name,
service,
service_name
)
SELECT
{{ delay }} /* required */,
'{{ email }}',
'{{ emails }}',
{{ monthly_threshold }} /* required */,
'{{ name }}',
'{{ service }}',
'{{ service_name }}'
RETURNING
id,
name,
creation_date,
delay,
email,
emails,
formatted_monthly_threshold,
monthly_threshold,
service,
status
;

UPDATE examples​

Updates the threshold, service, receivers, delay or status of the billing alert. Use emails, as email is deprecated.

UPDATE ovh.cloud.alertings
SET
delay = {{ delay }},
email = '{{ email }}',
emails = '{{ emails }}',
monthly_threshold = {{ monthly_threshold }},
name = '{{ name }}',
service = '{{ service }}',
status = '{{ status }}'
WHERE
id = '{{ id }}' --required
AND service_name = '{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set;

DELETE examples​

Deletes the billing alert configuration.

DELETE FROM ovh.cloud.alertings
WHERE id = '{{ id }}' --required
AND service_name = '{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;