Reviewed-by: Ziuzko, Alevtina <alevtina.ziuzko@t-systems.com> Co-authored-by: Wei, Hongmin <weihongmin1@huawei.com> Co-committed-by: Wei, Hongmin <weihongmin1@huawei.com>
25 KiB
Updating an Advanced Query
Function
This API is used to update a custom query.
Calling Method
For details, see Calling APIs.
URI
PUT /v1/resource-manager/domains/{domain_id}/stored-queries/{query_id}
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
domain_id |
Yes |
String |
Specifies tags. Maximum: 36 |
query_id |
Yes |
String |
Specifies the query ID. Maximum: 36 |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
No |
String |
Specifies the invoker's token. |
X-Security-Token |
No |
String |
Security token (session token) for temporary security credentials. This parameter is mandatory when you make an API call using temporary security credentials. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Specifies the ResourceQL name. Minimum: 1 Maximum: 64 |
description |
No |
String |
Specifies the ResourceQL description. Minimum: 0 Maximum: 512 |
expression |
Yes |
String |
Specifies the ResourceQL expression. Minimum: 1 Maximum: 4096 |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
id |
String |
ResourceQL ID. Maximum: 256 |
name |
String |
Specifies the ResourceQL name. Minimum: 1 Maximum: 64 |
type |
String |
Indicates a customized query type. The options are account and aggregator. account: customized query statement for a single account; If the value is aggregator, it indicates the customized query statement of the aggregator. The default value is account. |
description |
String |
Specifies the ResourceQL description. Minimum: 0 Maximum: 512 |
expression |
String |
Specifies the ResourceQL expression. Minimum: 1 Maximum: 4096 |
created |
String |
Specifies when ResourceQL was created. Minimum: 1 Maximum: 64 |
updated |
String |
Specifies when ResourceQL was updated. Minimum: 1 Maximum: 64 |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the error code. |
error_msg |
String |
Specifies the error message. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the error code. |
error_msg |
String |
Specifies the error message. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the error code. |
error_msg |
String |
Specifies the error message. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the error code. |
error_msg |
String |
Specifies the error message. |
Example Requests
Updating the advanced query to query running ECSs
PUT https://{endpoint}/v1/resource-manager/domains/{domain_id}/stored-queries/{query_id} { "name" : "running-ecs", "description" : "Querying running ECSs", "expression" : "SELECT id, name FROM resources WHERE provider = 'ecs' AND type = 'cloudservers' AND properties.status = 'ACTIVE'" }
Example Responses
Status code: 200
Operation succeeded.
{ "id" : "62b9126566d400721efceffa", "name" : "running-ecs", "type" : "account", "description" : "Querying running ECSs", "expression" : "SELECT id, name FROM resources WHERE provider = 'ecs' AND type = 'cloudservers' AND properties.status = 'ACTIVE'", "created" : "2022-06-27T02:13:57.107Z", "updated" : "2022-07-09T09:12:00.007Z" }
Status Codes
Status Code |
Description |
---|---|
200 |
Operation succeeded. |
400 |
Invalid parameters. |
403 |
User authentication failed. |
404 |
No resource found. |
500 |
Server error. |
Error Codes
See Error Codes.