queries
Creates, updates, deletes, gets or lists a queries resource.
Overview​
| Name | queries |
| Type | Resource |
| Id | oci.usage.queries |
Fields​
The following fields are returned by SELECT queries:
- get
- list
The saved query.
| Name | Datatype | Description |
|---|---|---|
id | string | The query OCID. |
compartmentId | string | The compartment OCID. |
queryDefinition | object | The common fields for queries. |
The saved queries list.
| Name | Datatype | Description |
|---|---|---|
id | string | The query OCID. |
queryDefinition | object | The common fields for queries. |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | queryId, region | opc-request-id | Returns the saved query.<br /> |
list | select | compartmentId, region | opc-request-id, limit, page, sortBy, sortOrder | Returns the saved query list.<br /> |
create | insert | region, compartmentId, queryDefinition | opc-request-id, opc-retry-token | Returns the created query.<br /> |
update | update | queryId, region, queryDefinition | opc-request-id, if-match | Update a saved query by the OCID.<br /> |
delete | delete | queryId, region | opc-request-id, if-match | Delete a saved query by the OCID.<br /> |
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 compartment ID in which to list resources. |
queryId | string | The query unique 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. |
limit | integer | The maximum number of items to return. |
opc-request-id | string | Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID. |
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 displayName. |
sortOrder | string | The sort order to use, whether 'asc' or 'desc'. |
SELECT examples​
- get
- list
Returns the saved query.<br />
SELECT
id,
compartmentId,
queryDefinition
FROM oci.usage.queries
WHERE queryId = '{{ queryId }}' -- required
AND region = '{{ region }}' -- required
AND opc-request-id = '{{ opc-request-id }}'
;
Returns the saved query list.<br />
SELECT
id,
queryDefinition
FROM oci.usage.queries
WHERE compartmentId = '{{ compartmentId }}' -- required
AND region = '{{ region }}' -- required
AND opc-request-id = '{{ opc-request-id }}'
AND limit = '{{ limit }}'
AND page = '{{ page }}'
AND sortBy = '{{ sortBy }}'
AND sortOrder = '{{ sortOrder }}'
;
INSERT examples​
- create
- Manifest
Returns the created query.<br />
INSERT INTO oci.usage.queries (
compartmentId,
queryDefinition,
region,
opc-request-id,
opc-retry-token
)
SELECT
'{{ compartmentId }}' /* required */,
'{{ queryDefinition }}' /* required */,
'{{ region }}',
'{{ opc-request-id }}',
'{{ opc-retry-token }}'
RETURNING
id,
compartmentId,
queryDefinition
;
# Description fields are for documentation purposes
- name: queries
props:
- name: region
value: "{{ region }}"
description: Required parameter for the queries resource.
- name: compartmentId
value: "{{ compartmentId }}"
description: |
The compartment OCID.
- name: queryDefinition
description: |
The common fields for queries.
value:
costAnalysisUI:
graph: "{{ graph }}"
isCumulativeGraph: {{ isCumulativeGraph }}
displayName: "{{ displayName }}"
reportQuery:
compartmentDepth: {{ compartmentDepth }}
dateRangeName: "{{ dateRangeName }}"
filter:
dimensions:
- key: "{{ key }}"
value: "{{ value }}"
filters:
- dimensions: "{{ dimensions }}"
filters: "{{ filters }}"
operator: "{{ operator }}"
tags: "{{ tags }}"
operator: "{{ operator }}"
tags:
- key: "{{ key }}"
namespace: "{{ namespace }}"
value: "{{ value }}"
forecast:
forecastType: "{{ forecastType }}"
timeForecastEnded: "{{ timeForecastEnded }}"
timeForecastStarted: "{{ timeForecastStarted }}"
granularity: "{{ granularity }}"
groupBy:
- "{{ groupBy }}"
groupByTag:
- key: "{{ key }}"
namespace: "{{ namespace }}"
value: "{{ value }}"
isAggregateByTime: {{ isAggregateByTime }}
queryType: "{{ queryType }}"
tenantId: "{{ tenantId }}"
timeUsageEnded: "{{ timeUsageEnded }}"
timeUsageStarted: "{{ timeUsageStarted }}"
version: {{ version }}
- name: opc-request-id
value: "{{ opc-request-id }}"
description: Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
description: Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
- 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.
UPDATE examples​
- update
Update a saved query by the OCID.<br />
UPDATE oci.usage.queries
SET
queryDefinition = '{{ queryDefinition }}'
WHERE
queryId = '{{ queryId }}' --required
AND region = '{{ region }}' --required
AND queryDefinition = '{{ queryDefinition }}' --required
AND opc-request-id = '{{ opc-request-id}}'
AND if-match = '{{ if-match}}'
RETURNING
id,
compartmentId,
queryDefinition;
DELETE examples​
- delete
Delete a saved query by the OCID.<br />
DELETE FROM oci.usage.queries
WHERE queryId = '{{ queryId }}' --required
AND region = '{{ region }}' --required
AND opc-request-id = '{{ opc-request-id }}'
AND if-match = '{{ if-match }}'
;