All Products
Search
Document Center

Database Autonomy Service:GetAutoResourceOptimizeRules

Last Updated:Dec 23, 2024

Queries the automatic fragment recycling rules of database instances.

Operation description

Before you call this operation, take note of the following items:

  • If you use an SDK to call API operations of Database Autonomy Service (DAS), you must set the region ID to cn-shanghai.
  • The database instance is an ApsaraDB RDS for MySQL instance of High-availability Edition.
  • The database instance has four or more cores, and innodb_file_per_table is set to ON.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
hdm:GetAutoResourceOptimizeRulesnone
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ConsoleContextstringNo

The reserved parameter.

None
InstanceIdsstringNo

The database instance IDs.

  • Specify the parameter value as a JSON array, such as ['Database account 1','Database account 2']. Separate database instance IDs with commas (,).

  • By default, if you leave this parameter empty, all database instances for which the automatic fragment recycling feature has been enabled within the current Alibaba Cloud account are returned. The following types of database instances are returned:

    • Database instances for which the automatic fragment recycling feature is currently enabled.
    • Database instances for which the automatic fragment recycling feature was once enabled but is currently disabled, including those for which DAS Enterprise Edition has been disabled but excluding those that have been released.
['rm-2ze8g2am97624****','rm-2vc54m2a6pd6p****','rm-2ze9xrhze0709****','rm-2ze8g2am97627****']

Response parameters

ParameterTypeDescriptionExample
object
Codelong

The HTTP status code returned.

200
Messagestring

The returned message.

Note If the request was successful, Successful is returned. If the request failed, an error message such as an error code is returned.
Successful
Dataobject

The data returned.

TotalAutoResourceOptimizeRulesCountlong

The number of database instances for which the automatic fragment recycling feature has been enabled.

3
EnableAutoResourceOptimizeCountlong

The number of database instances for which the automatic fragment recycling feature is currently enabled.

1
TurnOffAutoResourceOptimizeCountlong

The number of database instances for which the automatic fragment recycling feature was once enabled but is currently disabled.

1
HasEnableRuleButNotDasProCountlong

The number of database instances for which the automatic fragment recycling feature is enabled and DAS Enterprise Edition is disabled.

1
EnableAutoResourceOptimizeListarray<object>

The database instances for which the automatic fragment recycling feature is currently enabled.

enableAutoResourceOptimizeListobject
InstanceIdstring

The database instance ID.

rm-2ze8g2am97624****
AutoDefragmentboolean

Indicates whether the automatic fragment recycling feature is enabled. Valid values:

  • true
  • false
true
TableSpaceSizedouble

The minimum storage usage of a single physical table for which the automatic fragment recycling feature is enabled. Unit: GB.

10
DasProOnboolean

Indicates whether DAS Enterprise Edition is enabled. Valid values:

  • true
  • false
true
TableFragmentationRatiodouble

The fragmentation rate of a single physical table for which the automatic fragment recycling feature is enabled.

0.2
UserIdstring

The ID of the Alibaba Cloud account that is used to create the database instance.

140692647406****
TurnOffAutoResourceOptimizeListarray<object>

The database instances for which the automatic fragment recycling feature was once enabled but is currently disabled.

turnOffAutoResourceOptimizeListobject
InstanceIdstring

The database instance ID.

rm-2vc54m2a6pd6p****
AutoDefragmentboolean

Indicates whether the automatic fragment recycling feature is enabled. Valid values:

  • true:
  • false
false
TableSpaceSizedouble

The minimum storage usage of a single physical table for which the automatic fragment recycling feature is enabled. Unit: GB.

10
DasProOnboolean

Indicates whether DAS Enterprise Edition is enabled. Valid values:

  • true
  • false
true
TableFragmentationRatiodouble

The fragmentation rate of a single physical table for which the automatic fragment recycling feature is enabled.

0.2
UserIdstring

The ID of the Alibaba Cloud account that is used to create the database instance.

140692647406****
HasEnableRuleButNotDasProListarray<object>

The database instances for which the automatic fragment recycling feature is enabled and DAS Enterprise Edition is disabled.

Note Automatic fragment recycling tasks are run on this type of database instances only if DAS Enterprise Edition is enabled for the database instances again.
hasEnableRuleButNotDasProListobject
InstanceIdstring

The database instance ID.

rm-2ze9xrhze0709****
AutoDefragmentboolean

Indicates whether the automatic fragment recycling feature is enabled. Valid values:

  • true
  • false
true
TableSpaceSizedouble

The minimum storage usage of a single physical table for which the automatic fragment recycling feature is enabled. Unit: GB.

10
DasProOnboolean

Indicates whether DAS Enterprise Edition is enabled. Valid values:

  • true
  • false
false
TableFragmentationRatiodouble

The fragmentation rate of a single physical table for which the automatic fragment recycling feature is enabled.

0.2
UserIdstring

The ID of the Alibaba Cloud account that is used to create the database instance.

140692647406****
NeverEnableAutoResourceOptimizeOrReleasedInstanceCountlong

The number of database instances that do not exist or for which the automatic fragment recycling feature has never been enabled.

Note If a database instance does not exist, the instance has been released or the specified instance ID is invalid.
1
NeverEnableAutoResourceOptimizeOrReleasedInstanceIdListarray

The database instances that do not exist or for which the automatic fragment recycling feature has never been enabled.

neverEnableAutoResourceOptimizeOrReleasedInstanceIdListstring

The database instance ID.

rm-2ze8g2am97624****
RequestIdstring

The request ID.

B6D17591-B48B-4D31-9CD6-9B9796B2****
Successboolean

Indicates whether the request was successful. Valid values:

  • true
  • false
true

Examples

Sample success responses

JSONformat

{
  "Code": 200,
  "Message": "Successful",
  "Data": {
    "TotalAutoResourceOptimizeRulesCount": 3,
    "EnableAutoResourceOptimizeCount": 1,
    "TurnOffAutoResourceOptimizeCount": 1,
    "HasEnableRuleButNotDasProCount": 1,
    "EnableAutoResourceOptimizeList": [
      {
        "InstanceId": "rm-2ze8g2am97624****",
        "AutoDefragment": true,
        "TableSpaceSize": 10,
        "DasProOn": true,
        "TableFragmentationRatio": 0.2,
        "UserId": "140692647406****"
      }
    ],
    "TurnOffAutoResourceOptimizeList": [
      {
        "InstanceId": "rm-2vc54m2a6pd6p****",
        "AutoDefragment": false,
        "TableSpaceSize": 10,
        "DasProOn": true,
        "TableFragmentationRatio": 0.2,
        "UserId": "140692647406****"
      }
    ],
    "HasEnableRuleButNotDasProList": [
      {
        "InstanceId": "rm-2ze9xrhze0709****",
        "AutoDefragment": true,
        "TableSpaceSize": 10,
        "DasProOn": false,
        "TableFragmentationRatio": 0.2,
        "UserId": "140692647406****"
      }
    ],
    "NeverEnableAutoResourceOptimizeOrReleasedInstanceCount": 1,
    "NeverEnableAutoResourceOptimizeOrReleasedInstanceIdList": [
      "rm-2ze8g2am97624****"
    ]
  },
  "RequestId": "B6D17591-B48B-4D31-9CD6-9B9796B2****",
  "Success": true
}

Error codes

HTTP status codeError codeError message
400InvalidParamsThe request parameters are invalid.
403NoPermissionYou are not authorized to do this action.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-11-17The internal configuration of the API is changed, but the call is not affectedView Change Details
2023-11-17The Error code has changedView Change Details