Reviewed-by: Kacur, Michal <michal.kacur@t-systems.com> Co-authored-by: chenxiaoxiong <chenxiaoxiong@huawei.com> Co-committed-by: chenxiaoxiong <chenxiaoxiong@huawei.com>
27 KiB
Creating a Stream
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.
Calling Method
For details, see Calling APIs.
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. It 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 If this parameter is left unspecified, the default value will be used. Default: 24 |
auto_scale_enabled |
No |
Boolean |
Whether to enable auto scaling.
By default, auto scaling 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. |
data_schema |
No |
String |
Source data structure that defines JSON and CSV formats. It is described in the syntax of the Avro schema. |
csv_properties |
No |
CSVProperties object |
Attributes of data in CSV format, such as delimiter |
compression_format |
No |
String |
Data compression type. Currently, the following compression types are supported:
By default, data is not compressed. 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 |
Tag key.
Minimum: 1 Maximum: 36 |
value |
No |
String |
Value.
Minimum: 0 Maximum: 43 |
Response Parameters
None
Example Requests
Creating a Stream
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.