Creating Streams¶
Function¶
This API is used to create a stream.
When creating a stream, specify a stream type (common or advanced) and the number of partitions.
A maximum of 10 advanced stream partitions and 50 common stream partitions can be created for an account by default. You can submit a work order to increase the quota.
URI¶
POST /v2/{project_id}/streams
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID. |
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
X-Auth-Token | Yes | String | User token The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
stream_name | Yes | String | Stream name The stream name can contain 1 to 64 characters, including letters, digits, underscores (_), and hyphens (-). Maximum: 64 |
partition_count | Yes | Integer | Number of partitions Partitions are the base throughput unit of the DIS stream. |
stream_type | No | String | Stream type
Enumeration values:
|
data_type | No | String | Source data type
Default value: BLOB Enumeration values:
|
data_duration | No | Integer | Data retention period Value range: 24-72 Unit: hour Default value: 24 If this parameter is left unspecified, the default value will be used. Maximum: 72 Default: 24 |
auto_scale_enabled | No | Boolean | Whether to enable auto scaling
By default, this function is disabled. Default: false |
auto_scale_min_partition_count | No | Long | Minimum number of partitions for automatic scale-down when auto scaling is enabled. Minimum: 1 |
auto_scale_max_partition_count | No | Integer | Maximum number of partitions for automatic scale-up when auto scaling is enabled. |
compression_format | No | String | Data compression type. The following types are available:
Data is not compressed by default. Enumeration values:
|
tags | No | Array of Tag objects | List of stream tags. |
sys_tags | No | Array of SysTag objects | Stream enterprise projects. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
key | No | String | Key
Minimum: 1 Maximum: 36 |
value | No | String | Value
Minimum: 0 Maximum: 43 |
Parameter | Mandatory | Type | Description |
---|---|---|---|
key | No | String | Key
Enumeration values:
|
value | No | String | Value. The value is the enterprise project ID, which needs to be obtained on the enterprise management page.
|
Response Parameters¶
None
Example Requests¶
Creating Streams
POST https://{Endpoint}/v2/{project_id}/streams
{
"stream_name" : "newstream",
"partition_count" : 3,
"data_duration" : 24
}
Example Responses¶
None
Status Codes¶
Status Code | Description |
---|---|
201 | Created |
Error Codes¶
See Error Codes.