tencent cloud

Feedback

CreateProductSecret

Last updated: 2023-09-18 17:15:30

1. API Description

Domain name for API request: ssm.tencentcloudapi.com.

This API is used to create a Tencent Cloud service credential.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

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: CreateProductSecret.
Version Yes String Common Params. The value used for this API: 2019-09-23.
Region No String Common Params. This parameter is not required for this API.
SecretName Yes String Credential name, which must be unique in the same region. It can contain 128 bytes of letters, digits, hyphens, and underscores and must begin with a letter or digit.
UserNamePrefix Yes String Prefix of the user account name, which is specified by you and can contain up to 8 characters.
Supported character sets include:
Digits: [0, 9].
Lowercase letters: [a, z].
Uppercase letters: [A, Z].
Special symbols: underscore.
The prefix must begin with a letter.
ProductName Yes String Name of the Tencent Cloud service bound to the credential, such as Mysql. The DescribeSupportedProducts API can be used to get the names of the supported Tencent Cloud services.
InstanceID Yes String Tencent Cloud service instance ID.
Domains.N Yes Array of String Domain name of the account in the form of IP. You can enter %.
PrivilegesList.N Yes Array of ProductPrivilegeUnit List of permissions that need to be granted when the credential is bound to a Tencent Cloud service.
Description No String Description, which is used to describe the purpose in detail and can contain up to 2,048 bytes.
KmsKeyId No String Specifies the KMS CMK that encrypts the credential.
If this parameter is left empty, the CMK created by Secrets Manager by default will be used for encryption.
You can also specify a custom KMS CMK created in the same region for encryption.
Tags.N No Array of Tag List of tags.
RotationBeginTime No String User-Defined rotation start time in the format of 2006-01-02 15:04:05.
When EnableRotation is True, this parameter is required.
EnableRotation No Boolean Specifies whether to enable rotation
True - enable
False - do not enable
If this parameter is not specified, False will be used by default.
RotationFrequency No Integer Rotation frequency in days. Default value: 1 day.

3. Output Parameters

Parameter Name Type Description
SecretName String Name of the created credential.
TagCode Integer Tag operation return code. 0: success; 1: internal error; 2: business processing error.
Note: this field may return null, indicating that no valid values can be obtained.
Note: this field may return null, indicating that no valid values can be obtained.
TagMsg String Tag operation return message.
Note: this field may return null, indicating that no valid values can be obtained.
FlowID Integer ID of the created Tencent Cloud service credential async task.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Creating Tencent Cloud service credential

Input Example

https://ssm.tencentcloudapi.com/?Action=CreateProductSecret
&SecretName=testName
&UserNamePrefix=testPrefix
&ProductName=Mysql
&InstanceID=cdb-vosgis
&Description=test
&KmsKeyId=2609a8fd-4584-4f89-98be-8c7ae1b81ef4
&RotationBeginTime=2006-01-02 15:04:05
&EnableRotation=true
&RotationFrequency=35
&Domains.0=%
&Tags.0.TagKey=tagKey
&Tags.0.TagValue=tagVal
&PrivilegesList.0.PrivilegeName=object
&PrivilegesList.0.Privileges.0=read
&PrivilegesList.0.Database=testdb
&PrivilegesList.0.TableName=testtable
&PrivilegesList.0.ColumnName=testColumn
&<Common request parameters>

Output Example

{
    "Response": {
        "RequestId": "2609a8fd-4584-4f89-98be-8c7ae1b81ef4",
        "SecretName": "testName",
        "TagCode": 0,
        "TagMsg": "success",
        "FlowID": 123
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

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 Operation failed.
FailedOperation.AccessKmsError KMS operation failed.
InternalError An internal error occurred.
InvalidParameter Incorrect parameter.
InvalidParameterValue The parameter value is invalid.
InvalidParameterValue.TagKeysDuplicated The tag keys are duplicated.
InvalidParameterValue.TagsNotExisted The tag key or tag value does not exist.
LimitExceeded The quota limit is exceeded.
MissingParameter Missing parameter.
OperationDenied Operation denied.
OperationDenied.AutoRotatedResource It is not allowed to manually update credentials with automatic rotation enabled.
RequestLimitExceeded The number of requests exceeds the frequency limit.
ResourceInUse The resource is in use.
ResourceInUse.SecretExists The Secret name already exists.
ResourceInUse.VersionIdExists The Version ID already exists.
ResourceInsufficient Insufficient resource.
ResourceNotFound The resource does not exist.
ResourceUnavailable The resource is unavailable.
ResourceUnavailable.NotPurchased The service is not purchased.
ResourceUnavailable.ResourceDisabled The Secret is disabled.
ResourceUnavailable.ResourcePendingDeleted The Secret is in PendingDelete status.
ResourceUnavailable.ResourceUninitialized The credential has not been initialized.
ResourcesSoldOut The resources have been sold out.
UnauthorizedOperation The operation is unauthorized.
UnauthorizedOperation.AccessKmsError Failed to access KMS.
UnknownParameter Unknown parameter.
UnsupportedOperation Unsupported operation.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support