Overview
You can call this API to create a tenant.
Note
To create a tenant of a specified specification, the cluster must have sufficient available resources.
API details
Constraints
The caller must have an AccessKey for accessing the multi-cloud API. For information about how to obtain the AccessKey ID and AccessKey secret, see Manage AccessKeys.
Request path
POST /api/v2/instances/{instanceId}/tenants
Request parameters
Query
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| instanceId | String | Yes | The ID of the OceanBase cluster. | ob317v4uif**** |
Body
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| createParams | map | No | Some parameters for creating a tenant, including whether the table names are case-sensitive. The value is a hash map. Example: createParams":{"lower_case_table_names":"1"} |
{"lower_case_table_names":"1"} |
| enablePublicLink | Boolean | No | Specifies whether to create a public endpoint.
|
false |
| tenantName | String | Yes | The name of the tenant. The name of a tenant can be partially matched when you search for tenants. |
pay_**** |
| description | String | No | The description of the database. | this is a test database |
| cpu | Integer | Yes | The number of CPU cores of the tenant. | 2 |
| memory | Integer | Yes | The size of the memory of the tenant, in GiB. | 10 |
| unitNum | Integer | No | The number of resource distribution nodes of the tenant. This parameter is related to the deployment mode of the cluster. For example, if the deployment mode is 2-2-2, the number of distribution nodes can be at most 2. | 2 |
| primaryZone | String | Yes | The primary zone of the tenant. This zone must be one of the zones in which the cluster is deployed. | cn-hangzhou-h |
| tenantMode | String | Yes | The mode of the tenant. Valid values: Oracle and MySQL. If the database version is V4.2.1.8, V4.2.5, or V4.3.3, the value can be only HBase/Table. In this case, the tenant can use only the HBase API or the Table API. | Oracle |
| timeZone | String | Yes | The time zone of the tenant. For more information, see DescribeTimeZones. | Asia/Shanghai |
| charset | String | Yes | The character set.
Notice
|
utf8mb4 |
Response parameters
| Name | Type | Description | Example value |
|---|---|---|---|
| data | object | The information about the tenant. | |
| tenantId | String | The ID of the tenant. | t33h8y08k**** |
Examples
Request example
curl --request POST 'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants' \
--digest -u 'ak:sk' \
-H 'X-Ob-Project-Id: <Project ID>'
--data \ '{"memory":5,"cpu":2,"unitNum":1,"primaryZone":"us-east-1a","tenantName":"testAPI","tenantMode":"MySQL","charset":"utf8mb4","timeZone":"Asia/Shanghai","description":"12345"}'
Note
- A project ID uniquely identifies a project. For information about how to obtain the project ID of an instance, see Manage projects.
- Make sure that the project ID corresponding to the specified instanceId is consistent with the specified project ID.
Response example
JSON format
{
"success":true,
"data":{
"tenantId":"Tenant ID"
},
"requestId":"uuid"
}