Skip to main content

alert_rules

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

Overview​

Namealert_rules
TypeResource
Idoci.budgets.alert_rules

Fields​

The following fields are returned by SELECT queries:

Retrieves the Alert Rule with the given OCID.

NameDatatypeDescription
idstringThe OCID of the alert rule.
budgetIdstringThe OCID of the budget.
definedTagsobjectDefined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm). Example: {"Operations": {"CostCenter": "42"}}
descriptionstringThe description of the alert rule.
displayNamestringThe name of the alert rule. Avoid entering confidential information.
freeformTagsobjectFree-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm). Example: {"Department": "Finance"}
lifecycleStatestringThe current state of the alert rule. (ACTIVE, INACTIVE) (x-obmcs-top-level-enum: #/definitions/LifecycleState)
messagestringCustom message sent when an alert is triggered.
recipientsstringThe delimited list of email addresses to receive the alert when it triggers. Delimiter characters can be a comma, space, TAB, or semicolon.
thresholdnumberThe threshold for triggering the alert. If the thresholdType is PERCENTAGE, the maximum value is 10000.
thresholdTypestringThe type of threshold. (PERCENTAGE, ABSOLUTE) (x-obmcs-top-level-enum: #/definitions/ThresholdType)
timeCreatedstring (date-time)The time the budget was created.
timeUpdatedstring (date-time)The time the budget was updated.
typestringThe type of the alert. Valid values are ACTUAL (the alert triggers based on actual usage), or FORECAST (the alert triggers based on predicted usage). (ACTUAL, FORECAST) (x-obmcs-top-level-enum: #/definitions/AlertType)
versionintegerThe version of the alert rule. Starts from 1 and increments by 1.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectbudgetId, alertRuleId, regionopc-request-idGets an Alert Rule for a specified budget.
listselectbudgetId, regionlimit, page, sortOrder, sortBy, lifecycleState, displayName, opc-request-idReturns a list of Alert Rules for a specified budget.<br />
createinsertbudgetId, region, type, threshold, thresholdTypeopc-retry-token, opc-request-idCreates a new Alert Rule.<br />
updateupdatebudgetId, alertRuleId, regionif-match, opc-request-idUpdate an Alert Rule for the budget identified by the OCID.
deletedeletebudgetId, alertRuleId, regionif-match, opc-request-idDeletes a specified Alert Rule resource.

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
alertRuleIdstringThe unique Alert Rule OCID.
budgetIdstringThe unique budget OCID.
regionstringOCI region identifier (e.g. us-ashburn-1, ap-sydney-1); resolves from OCI_REGION when not supplied in the query. (default: us-ashburn-1, x-stackQL-envVar: OCI_REGION)
displayNamestringA user-friendly name. This does not have to be unique, and it's changeable. Example: My new resource
if-matchstringFor optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.
lifecycleStatestringThe current state of the resource to filter by.
limitintegerThe maximum number of items to return.
opc-request-idstringThe client request ID for tracing.
opc-retry-tokenstringA token that uniquely identifies a request so it can be retried, in case of a timeout or server error, without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations. For example, if a resource has been deleted and purged from the system, then a retry of the original creation request might be rejected.
pagestringThe page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.
sortBystringThe field to sort by. If not specified, the default is timeCreated. The default sort order for timeCreated is DESC. The default sort order for displayName is ASC in alphanumeric order.
sortOrderstringThe sort order to use, either 'asc' or 'desc'.

SELECT examples​

Gets an Alert Rule for a specified budget.

SELECT
id,
budgetId,
definedTags,
description,
displayName,
freeformTags,
lifecycleState,
message,
recipients,
threshold,
thresholdType,
timeCreated,
timeUpdated,
type,
version
FROM oci.budgets.alert_rules
WHERE budgetId = '{{ budgetId }}' -- required
AND alertRuleId = '{{ alertRuleId }}' -- required
AND region = '{{ region }}' -- required
AND opc-request-id = '{{ opc-request-id }}'
;

INSERT examples​

Creates a new Alert Rule.<br />

INSERT INTO oci.budgets.alert_rules (
definedTags,
description,
displayName,
freeformTags,
message,
recipients,
threshold,
thresholdType,
type,
budgetId,
region,
opc-retry-token,
opc-request-id
)
SELECT
'{{ definedTags }}',
'{{ description }}',
'{{ displayName }}',
'{{ freeformTags }}',
'{{ message }}',
'{{ recipients }}',
{{ threshold }} /* required */,
'{{ thresholdType }}' /* required */,
'{{ type }}' /* required */,
'{{ budgetId }}',
'{{ region }}',
'{{ opc-retry-token }}',
'{{ opc-request-id }}'
RETURNING
id,
budgetId,
definedTags,
description,
displayName,
freeformTags,
lifecycleState,
message,
recipients,
threshold,
thresholdType,
timeCreated,
timeUpdated,
type,
version
;

UPDATE examples​

Update an Alert Rule for the budget identified by the OCID.

UPDATE oci.budgets.alert_rules
SET
definedTags = '{{ definedTags }}',
description = '{{ description }}',
displayName = '{{ displayName }}',
freeformTags = '{{ freeformTags }}',
message = '{{ message }}',
recipients = '{{ recipients }}',
threshold = {{ threshold }},
thresholdType = '{{ thresholdType }}',
type = '{{ type }}'
WHERE
budgetId = '{{ budgetId }}' --required
AND alertRuleId = '{{ alertRuleId }}' --required
AND region = '{{ region }}' --required
AND if-match = '{{ if-match}}'
AND opc-request-id = '{{ opc-request-id}}'
RETURNING
id,
budgetId,
definedTags,
description,
displayName,
freeformTags,
lifecycleState,
message,
recipients,
threshold,
thresholdType,
timeCreated,
timeUpdated,
type,
version;

DELETE examples​

Deletes a specified Alert Rule resource.

DELETE FROM oci.budgets.alert_rules
WHERE budgetId = '{{ budgetId }}' --required
AND alertRuleId = '{{ alertRuleId }}' --required
AND region = '{{ region }}' --required
AND if-match = '{{ if-match }}'
AND opc-request-id = '{{ opc-request-id }}'
;