Domain name for API request: cdb.tencentcloudapi.com.
This API is used to create an audit policy for a TencentDB instance by associating an audit rule with the TencentDB instance.
A maximum of 20 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
Parameter Name | Required | Type | Description |
---|---|---|---|
Action | Yes | String | Common Params. The value used for this API: CreateAuditPolicy. |
Version | Yes | String | Common Params. The value used for this API: 2017-03-20. |
Region | No | String | Common Params. This parameter is not required for this API. |
Name | Yes | String | Audit policy name. |
RuleId | Yes | String | Audit rule ID. |
InstanceId | Yes | String | Instance ID in the format of cdb-c1nl9rpv or cdbro-c1nl9rpv. It is the same as the instance ID displayed in the TencentDB console. |
LogExpireDay | No | Integer | Retention period of audit logs. Valid values: 7: seven days (a week); 30: 30 days (a month); 180: 180 days (six months); 365: 365 days (a year); 1095: 1095 days (three years); 1825: 1825 days (five years). This parameter specifies the retention period (30 days by default) of audit logs, which is valid when you create the first audit policy for an instance. If the instance already has audit policies, this parameter is invalid, but you can use the ModifyAuditConfig API to modify the retention period. |
Parameter Name | Type | Description |
---|---|---|
PolicyId | String | Audit policy ID. |
RequestId | String | The unique request ID, which is returned for each request. RequestId is required for locating a problem. |
https://cdb.tencentcloudapi.com/?Action=CreateAuditPolicy
&Name=audit_policy_1
&RuleId=cdbrule-asdfghjk
&InstanceId=cdb-qwerasdf
&<Common request parameters>
{
"Response": {
"RequestId": "6EF60BEC-0242-43AF-BB20-270359FB54A7",
"PolicyId": "cdbpolicy-asdfqwer"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
FailedOperation.CreateAuditFailError | Failed to create the audit rule. |
FailedOperation.TypeInConflict | This type of operations cannot be performed. |
InternalError.AuditError | An error occurred in the internal service of the audit service. |
InternalError.AuditOssLogicError | Internal exception of the audit service. |
InternalError.DBError | Database exception |
InternalError.DBOperationError | Database operation failed. |
InternalError.DatabaseAccessError | Internal database error. |
InternalError.HttpError | Exceptional HTTP request |
InternalError.InternalHttpServerError | An exception occurred while executing the request. |
InternalError.ServerError | Internal error of the system. |
InternalError.ServiceError | An exception occurred in the internal service. |
InternalError.TransactionBeginError | Operation failed |
InternalError.UnknownError | Unknown error |
InvalidParameter | Parameter error. |
InvalidParameter.InvalidParameterError | Invalid parameter value |
InvalidParameterValue.InvalidParameterValueError | Invalid parameter value |
LimitExceeded | The quota limit has been reached. |
OperationDenied | Operation denied. |
OperationDenied.AuditPolicyConflictError | The audit policies conflict. |
OperationDenied.AuditPolicyExistError | The audit policy already exists. |
OperationDenied.AuditPolicyOverQuotaError | The number of audit policies exceeds the limit. |
OperationDenied.AuditRuleHasBind | The audit rule has been associated. |
OperationDenied.AuditRuleNotExistError | The audit rule does not exist. |
OperationDenied.AuditStatusError | Exceptional audit status. |
OperationDenied.AuditTaskConflictError | The audit tasks conflict. |
OperationDenied.DBBrainPolicyConflict | You have enabled the compliance audit feature of DBbrain, so you cannot enable the rule-based audit. |
OperationDenied.InstanceStatusError | Exceptional instance status |
OperationDenied.UnsupportOpenAuditError | The audit feature cannot be enabled. |
ResourceInUse | The resource is occupied. |
ResourceInsufficient | Insufficient resource. |
ResourceNotFound | The resource does not exist. |
ResourceNotFound.InstanceNotFundError | The instance does not exist. |
ResourceUnavailable | The resource is unavailable. |
UnsupportedOperation | Unsupported operation. |
Was this page helpful?