alert_rules
Creates, updates, deletes, gets or lists an alert_rules resource.
Overview​
| Name | alert_rules |
| Type | Resource |
| Id | oci.budgets.alert_rules |
Fields​
The following fields are returned by SELECT queries:
- get
- list
Retrieves the Alert Rule with the given OCID.
| Name | Datatype | Description |
|---|---|---|
id | string | The OCID of the alert rule. |
budgetId | string | The OCID of the budget. |
definedTags | object | Defined 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"}} |
description | string | The description of the alert rule. |
displayName | string | The name of the alert rule. Avoid entering confidential information. |
freeformTags | object | Free-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"} |
lifecycleState | string | The current state of the alert rule. (ACTIVE, INACTIVE) (x-obmcs-top-level-enum: #/definitions/LifecycleState) |
message | string | Custom message sent when an alert is triggered. |
recipients | string | The delimited list of email addresses to receive the alert when it triggers. Delimiter characters can be a comma, space, TAB, or semicolon. |
threshold | number | The threshold for triggering the alert. If the thresholdType is PERCENTAGE, the maximum value is 10000. |
thresholdType | string | The type of threshold. (PERCENTAGE, ABSOLUTE) (x-obmcs-top-level-enum: #/definitions/ThresholdType) |
timeCreated | string (date-time) | The time the budget was created. |
timeUpdated | string (date-time) | The time the budget was updated. |
type | string | The 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) |
version | integer | The version of the alert rule. Starts from 1 and increments by 1. |
The alert rule.
| Name | Datatype | Description |
|---|---|---|
id | string | The OCID of the alert rule. |
budgetId | string | The OCID of the budget. |
definedTags | object | Defined 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"}} |
description | string | The description of the alert rule. |
displayName | string | The name of the alert rule. Avoid entering confidential information. |
freeformTags | object | Free-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"} |
lifecycleState | string | The current state of the alert rule. (ACTIVE, INACTIVE) (x-obmcs-top-level-enum: #/definitions/LifecycleState) |
message | string | The custom message that will be sent when the alert is triggered. |
recipients | string | The audience that receives the alert when it triggers. |
threshold | number | The threshold for triggering the alert. If the thresholdType is PERCENTAGE, the maximum value is 10000. |
thresholdType | string | The type of threshold. (PERCENTAGE, ABSOLUTE) (x-obmcs-top-level-enum: #/definitions/ThresholdType) |
timeCreated | string (date-time) | The time when the budget was created. |
timeUpdated | string (date-time) | The time when the budget was updated. |
type | string | ACTUAL means the alert triggers based on actual usage. FORECAST means the alert triggers based on predicted usage. (ACTUAL, FORECAST) (x-obmcs-top-level-enum: #/definitions/AlertType) |
version | integer | The version of the alert rule. Starts from 1 and increments by 1. |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | budgetId, alertRuleId, region | opc-request-id | Gets an Alert Rule for a specified budget. |
list | select | budgetId, region | limit, page, sortOrder, sortBy, lifecycleState, displayName, opc-request-id | Returns a list of Alert Rules for a specified budget.<br /> |
create | insert | budgetId, region, type, threshold, thresholdType | opc-retry-token, opc-request-id | Creates a new Alert Rule.<br /> |
update | update | budgetId, alertRuleId, region | if-match, opc-request-id | Update an Alert Rule for the budget identified by the OCID. |
delete | delete | budgetId, alertRuleId, region | if-match, opc-request-id | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
alertRuleId | string | The unique Alert Rule OCID. |
budgetId | string | The unique budget OCID. |
region | string | OCI 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) |
displayName | string | A user-friendly name. This does not have to be unique, and it's changeable. Example: My new resource |
if-match | string | For 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. |
lifecycleState | string | The current state of the resource to filter by. |
limit | integer | The maximum number of items to return. |
opc-request-id | string | The client request ID for tracing. |
opc-retry-token | string | A 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. |
page | string | The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call. |
sortBy | string | The 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. |
sortOrder | string | The sort order to use, either 'asc' or 'desc'. |
SELECT examples​
- get
- list
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 }}'
;
Returns a list of Alert Rules for a specified budget.<br />
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 region = '{{ region }}' -- required
AND limit = '{{ limit }}'
AND page = '{{ page }}'
AND sortOrder = '{{ sortOrder }}'
AND sortBy = '{{ sortBy }}'
AND lifecycleState = '{{ lifecycleState }}'
AND displayName = '{{ displayName }}'
AND opc-request-id = '{{ opc-request-id }}'
;
INSERT examples​
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: alert_rules
props:
- name: budgetId
value: "{{ budgetId }}"
description: Required parameter for the alert_rules resource.
- name: region
value: "{{ region }}"
description: Required parameter for the alert_rules resource.
- name: definedTags
value: "{{ definedTags }}"
description: |
Defined 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"}}`
- name: description
value: "{{ description }}"
description: |
The description of the alert rule.
- name: displayName
value: "{{ displayName }}"
description: |
The name of the alert rule. Avoid entering confidential information.
- name: freeformTags
value: "{{ freeformTags }}"
description: |
Free-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"}`
- name: message
value: "{{ message }}"
description: |
The message to be sent to the recipients when the alert rule is triggered.
- name: recipients
value: "{{ recipients }}"
description: |
The audience that receives the alert when it triggers. An empty string is interpreted as null.
- name: threshold
value: {{ threshold }}
description: |
The threshold for triggering the alert, expressed as a whole number or decimal value.
If the thresholdType is ABSOLUTE, the threshold can have at most 12 digits before the decimal point, and up to two digits after the decimal point.
If the thresholdType is PERCENTAGE, the maximum value is 10000 and can have up to two digits after the decimal point.
- name: thresholdType
value: "{{ thresholdType }}"
description: |
The type of threshold.
valid_values: ['PERCENTAGE', 'ABSOLUTE']
- name: type
value: "{{ type }}"
description: |
The type of the alert. Valid values are ACTUAL (the alert triggers based on actual usage), or
FORECAST (the alert triggers based on predicted usage).
valid_values: ['ACTUAL', 'FORECAST']
- name: opc-retry-token
value: "{{ opc-retry-token }}"
description: A 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.
description: A 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.
- name: opc-request-id
value: "{{ opc-request-id }}"
description: The client request ID for tracing.
description: The client request ID for tracing.
UPDATE examples​
- update
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​
- delete
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 }}'
;