Skip to main content

cost_anomaly_monitors

Creates, updates, deletes, gets or lists a cost_anomaly_monitors resource.

Overview​

Namecost_anomaly_monitors
TypeResource
Idoci.budgets.cost_anomaly_monitors

Fields​

The following fields are returned by SELECT queries:

Retrieves the CostAnomalyMonitor with the given OCID.

NameDatatypeDescription
idstringThe OCID of the Cost Anomaly Monitor.
namestringThe name of the cost anomaly monitor. Avoid entering confidential information.
compartmentIdstringThe OCID of the compartment.
costAlertSubscriptionMapobjectThe mapping of cost monitor to alert subscription along with thresholds.
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 budget.
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"}
lifecycleDetailsstringThe current state details of the cost monitor.
lifecycleStatestringThe current state of the cost monitor. (ACTIVE, INACTIVE, DELETED)
systemTagsobjectSystem 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"}}
targetResourceFilterobjectThe filter object to target resources for cost monitor. Cost generated by one or more resources identified by this filter is monitored for anomalous deviations.
timeCreatedstring (date-time)The time that the cost monitor was created.
timeUpdatedstring (date-time)The time that the cost monitor was last updated.
typestringType of cost monitor (DEFAULT, CUSTOM) (x-obmcs-top-level-enum: #/definitions/MonitorType)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectcostAnomalyMonitorId, regionopc-request-idGets a CostAnomalyMonitor by the identifier.
listselectcompartmentId, regionlimit, page, sortOrder, sortBy, lifecycleState, name, targetTenantId, opc-request-idGets a list of Cost Anomaly Monitors in a compartment.<br />
createinsertregion, compartmentId, name, targetResourceFilteropc-retry-token, opc-request-idCreates a new costAnomaly Monitor.<br />
updateupdatecostAnomalyMonitorId, regionif-match, opc-request-idUpdate a CostAnomalyMonitor identified by the OCID.
deletedeletecostAnomalyMonitorId, regionif-match, opc-request-idDeletes a specified CostAnomalyMonitor resource.
disable_cost_anomaly_monitorexeccostAnomalyMonitorId, regionif-match, opc-request-id, opc-retry-tokenDisables the cost anomaly monitor. This stops cost anomaly detection for targeted resource(s).
enable_cost_anomaly_monitorexeccostAnomalyMonitorId, regionif-match, opc-request-id, opc-retry-tokenEnables 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.

NameDatatypeDescription
compartmentIdstringThe ID of the compartment in which to list resources.
costAnomalyMonitorIdstringThe unique costAnomalyMonitor 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)
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 cost monitor.
limitintegerThe maximum number of items to return.
namestringUnique, non-changeable resource name.
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'.
targetTenantIdstringThe target tenantId ocid filter param.

SELECT examples​

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 }}'
;

INSERT examples​

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
;

UPDATE examples​

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​

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​

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 }}'
;