DIS provides efficient collection, transmission, and distribution capabilities for real-time data and provides a variety of APIs to help you quickly build real-time data applications.
The token obtained on IAM is valid for only 24 hours. If you want to use one token for authentication, you can cache it to avoid frequent calling.
If you use a token for authentication, you must obtain the token and add X-Auth-Token to the request header of the API request.
You have planned the region where DIS is located and determined the endpoint for calling an API based on the region.
An endpoint is the request address for calling an API. Endpoints vary depending on services and regions. You can obtain endpoints from Regions and Endpoints.
The following is an example of creating a stream with the simplest configuration.
{ "stream_name": "dis-DLpR", "partition_count": 1, "stream_type": "COMMON", "data_duration": 24 }
If the request is successful, 201 Created is returned.
If the request fails, an error code and error information are returned. For details, see Error Codes.
You can also create a stream that supports auto scaling. The number of partitions can be automatically increased or decreased based on the stream traffic. The following is an example configuration:
{ "stream_name": "dis-DLpR", "partition_count": 1, "stream_type": "COMMON", "data_duration": 24 "auto_scale_enabled": true, "auto_scale_min_partition_count": 2, "auto_scale_max_partition_count": 10 }
In this example, a stream that supports auto scaling is created. The number of partitions to scale ranges from 2 to 10. If the stream has 10 partitions, auto scaling-out will not be triggered.
If the request is successful, 201 Created is returned.
If the request fails, an error code and error information are returned. For details, see Error Codes.
You can also configure a schema for the stream. When using DIS to dump data to other services, you can map data based on the schema configured for the stream. The following is an example configuration:
{ "stream_name": "dis-DLpR", "partition_count": 1, "stream_type": "COMMON", "data_duration": 24 "auto_scale_enabled": true, "auto_scale_min_partition_count": 1, "auto_scale_max_partition_count": 10 "data_type": "JSON", "data_schema": "{\"type\":\"record\",\"name\":\"RecordName\",\"fields\":[{\"name\":\"key1\",\"type\":\"string\"},{\"name\":\"key2\",\"type\":\"string\"}]}" }
In this example, a stream whose source data type is JSON and that contains the key1 and key2 attributes is created.
If the request is successful, 201 Created is returned.
If the request fails, an error code and error information are returned. For details, see Error Codes.