cost_anomaly_monitors
Creates, updates, deletes, gets or lists a cost_anomaly_monitors resource.
Overview​
| Name | cost_anomaly_monitors |
| Type | Resource |
| Id | oci.budgets.cost_anomaly_monitors |
Fields​
The following fields are returned by SELECT queries:
- get
- list
Retrieves the CostAnomalyMonitor with the given OCID.
| Name | Datatype | Description |
|---|---|---|
id | string | The OCID of the Cost Anomaly Monitor. |
name | string | The name of the cost anomaly monitor. Avoid entering confidential information. |
compartmentId | string | The OCID of the compartment. |
costAlertSubscriptionMap | object | The mapping of cost monitor to alert subscription along with thresholds. |
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 budget. |
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"} |
lifecycleDetails | string | The current state details of the cost monitor. |
lifecycleState | string | The current state of the cost monitor. (ACTIVE, INACTIVE, DELETED) |
systemTags | object | System tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm). System tags can be viewed by users, but can only be created by the system. Example: {"orcl-cloud": {"free-tier-retained": "true"}} |
targetResourceFilter | object | The filter object to target resources for cost monitor. Cost generated by one or more resources identified by this filter is monitored for anomalous deviations. |
timeCreated | string (date-time) | The time that the cost monitor was created. |
timeUpdated | string (date-time) | The time that the cost monitor was last updated. |
type | string | Type of cost monitor (DEFAULT, CUSTOM) (x-obmcs-top-level-enum: #/definitions/MonitorType) |
A page of CostAnomalyMonitorSummary objects.
| Name | Datatype | Description |
|---|---|---|
id | string | The OCID of the Cost Anomaly Monitor. |
name | string | The name of the cost anomaly monitor. Avoid entering confidential information. |
compartmentId | string | The OCID of the compartment. |
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 budget. |
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 cost monitor. (x-obmcs-enumref: #/definitions/CostAnomalyMonitor/lifecycleState) |
systemTags | object | System tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm). System tags can be viewed by users, but can only be created by the system. Example: {"orcl-cloud": {"free-tier-retained": "true"}} |
targetResourceFilter | object | The filter object to target resources for cost monitor. Cost generated by one or more resources identified by this filter is monitored for anomalous deviations. |
timeCreated | string (date-time) | The time that the cost monitor was created. |
timeUpdated | string (date-time) | The time that the cost monitor was last updated. |
type | string | Type of cost monitor (DEFAULT, CUSTOM) (x-obmcs-top-level-enum: #/definitions/MonitorType) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | costAnomalyMonitorId, region | opc-request-id | Gets a CostAnomalyMonitor by the identifier. |
list | select | compartmentId, region | limit, page, sortOrder, sortBy, lifecycleState, name, targetTenantId, opc-request-id | Gets a list of Cost Anomaly Monitors in a compartment.<br /> |
create | insert | region, compartmentId, name, targetResourceFilter | opc-retry-token, opc-request-id | Creates a new costAnomaly Monitor.<br /> |
update | update | costAnomalyMonitorId, region | if-match, opc-request-id | Update a CostAnomalyMonitor identified by the OCID. |
delete | delete | costAnomalyMonitorId, region | if-match, opc-request-id | Deletes a specified CostAnomalyMonitor resource. |
disable_cost_anomaly_monitor | exec | costAnomalyMonitorId, region | if-match, opc-request-id, opc-retry-token | Disables the cost anomaly monitor. This stops cost anomaly detection for targeted resource(s). |
enable_cost_anomaly_monitor | exec | costAnomalyMonitorId, region | if-match, opc-request-id, opc-retry-token | Enables the cost anomaly monitor. This (re)starts the cost anomaly detection for targeted resource(s). |
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 |
|---|---|---|
compartmentId | string | The ID of the compartment in which to list resources. |
costAnomalyMonitorId | string | The unique costAnomalyMonitor 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) |
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 cost monitor. |
limit | integer | The maximum number of items to return. |
name | string | Unique, non-changeable resource name. |
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'. |
targetTenantId | string | The target tenantId ocid filter param. |
SELECT examples​
- get
- list
Gets a CostAnomalyMonitor by the identifier.
SELECT
id,
name,
compartmentId,
costAlertSubscriptionMap,
definedTags,
description,
freeformTags,
lifecycleDetails,
lifecycleState,
systemTags,
targetResourceFilter,
timeCreated,
timeUpdated,
type
FROM oci.budgets.cost_anomaly_monitors
WHERE costAnomalyMonitorId = '{{ costAnomalyMonitorId }}' -- required
AND region = '{{ region }}' -- required
AND opc-request-id = '{{ opc-request-id }}'
;
Gets a list of Cost Anomaly Monitors in a compartment.<br />
SELECT
id,
name,
compartmentId,
definedTags,
description,
freeformTags,
lifecycleState,
systemTags,
targetResourceFilter,
timeCreated,
timeUpdated,
type
FROM oci.budgets.cost_anomaly_monitors
WHERE compartmentId = '{{ compartmentId }}' -- required
AND region = '{{ region }}' -- required
AND limit = '{{ limit }}'
AND page = '{{ page }}'
AND sortOrder = '{{ sortOrder }}'
AND sortBy = '{{ sortBy }}'
AND lifecycleState = '{{ lifecycleState }}'
AND name = '{{ name }}'
AND targetTenantId = '{{ targetTenantId }}'
AND opc-request-id = '{{ opc-request-id }}'
;
INSERT examples​
- create
- Manifest
Creates a new costAnomaly Monitor.<br />
INSERT INTO oci.budgets.cost_anomaly_monitors (
compartmentId,
costAlertSubscriptionMap,
definedTags,
description,
freeformTags,
name,
targetResourceFilter,
region,
opc-retry-token,
opc-request-id
)
SELECT
'{{ compartmentId }}' /* required */,
'{{ costAlertSubscriptionMap }}',
'{{ definedTags }}',
'{{ description }}',
'{{ freeformTags }}',
'{{ name }}' /* required */,
'{{ targetResourceFilter }}' /* required */,
'{{ region }}',
'{{ opc-retry-token }}',
'{{ opc-request-id }}'
RETURNING
id,
name,
compartmentId,
costAlertSubscriptionMap,
definedTags,
description,
freeformTags,
lifecycleDetails,
lifecycleState,
systemTags,
targetResourceFilter,
timeCreated,
timeUpdated,
type
;
# Description fields are for documentation purposes
- name: cost_anomaly_monitors
props:
- name: region
value: "{{ region }}"
description: Required parameter for the cost_anomaly_monitors resource.
- name: compartmentId
value: "{{ compartmentId }}"
description: |
The OCID of the compartment.
- name: costAlertSubscriptionMap
description: |
The mapping of cost monitor to alert subscription along with thresholds.
value:
costAlertSubscriptionId: "{{ costAlertSubscriptionId }}"
operator: "{{ operator }}"
thresholdAbsoluteValue: {{ thresholdAbsoluteValue }}
thresholdRelativePercent: {{ thresholdRelativePercent }}
- 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 cost anomaly monitor.
- 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: name
value: "{{ name }}"
description: |
The name of the cost anomaly monitor. Avoid entering confidential information.
- name: targetResourceFilter
description: |
The filter object to target resources for cost monitor.
Cost generated by one or more resources identified by this
filter is monitored for anomalous deviations.
value:
dimensions:
- key: "{{ key }}"
value: "{{ value }}"
filters:
- dimensions: "{{ dimensions }}"
filters: "{{ filters }}"
operator: "{{ operator }}"
tags: "{{ tags }}"
operator: "{{ operator }}"
tags:
- key: "{{ key }}"
namespace: "{{ namespace }}"
value: "{{ value }}"
- 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 a CostAnomalyMonitor identified by the OCID.
UPDATE oci.budgets.cost_anomaly_monitors
SET
costAlertSubscriptionMap = '{{ costAlertSubscriptionMap }}',
definedTags = '{{ definedTags }}',
description = '{{ description }}',
freeformTags = '{{ freeformTags }}'
WHERE
costAnomalyMonitorId = '{{ costAnomalyMonitorId }}' --required
AND region = '{{ region }}' --required
AND if-match = '{{ if-match}}'
AND opc-request-id = '{{ opc-request-id}}'
RETURNING
id,
name,
compartmentId,
costAlertSubscriptionMap,
definedTags,
description,
freeformTags,
lifecycleDetails,
lifecycleState,
systemTags,
targetResourceFilter,
timeCreated,
timeUpdated,
type;
DELETE examples​
- delete
Deletes a specified CostAnomalyMonitor resource.
DELETE FROM oci.budgets.cost_anomaly_monitors
WHERE costAnomalyMonitorId = '{{ costAnomalyMonitorId }}' --required
AND region = '{{ region }}' --required
AND if-match = '{{ if-match }}'
AND opc-request-id = '{{ opc-request-id }}'
;
Lifecycle Methods​
- disable_cost_anomaly_monitor
- enable_cost_anomaly_monitor
Disables the cost anomaly monitor. This stops cost anomaly detection for targeted resource(s).
EXEC oci.budgets.cost_anomaly_monitors.disable_cost_anomaly_monitor
@costAnomalyMonitorId='{{ costAnomalyMonitorId }}' --required,
@region='{{ region }}' --required,
@if-match='{{ if-match }}',
@opc-request-id='{{ opc-request-id }}',
@opc-retry-token='{{ opc-retry-token }}'
;
Enables the cost anomaly monitor. This (re)starts the cost anomaly detection for targeted resource(s).
EXEC oci.budgets.cost_anomaly_monitors.enable_cost_anomaly_monitor
@costAnomalyMonitorId='{{ costAnomalyMonitorId }}' --required,
@region='{{ region }}' --required,
@if-match='{{ if-match }}',
@opc-request-id='{{ opc-request-id }}',
@opc-retry-token='{{ opc-retry-token }}'
;