github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dis/v2/streams/ListStreams.go (about) 1 package streams 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 "github.com/opentelekomcloud/gophertelekomcloud/openstack/common/tags" 7 ) 8 9 type ListStreamsOpts struct { 10 // The maximum number of DIS streams to list in a single API call. 11 // Value range: 1-100 Default value: 10 12 // Minimum: 1 13 // Maximum: 100 14 // Default: 10 15 Limit *int `q:"limit,omitempty"` 16 // Name of the DIS stream to start the stream list with. The returned stream list does not contain this DIS stream name. 17 // If pagination query is required, this parameter is not transferred for query on the first page. 18 // If the value of has_more_streams is true, the query is performed on the next page. 19 // The value of start_stream_name is the name of the last stream in the query result of the first page. 20 StartStreamName string `q:"start_stream_name,omitempty"` 21 } 22 23 func ListStreams(client *golangsdk.ServiceClient, opts ListStreamsOpts) (*ListStreamsResponse, error) { 24 url, err := golangsdk.NewURLBuilder().WithEndpoints("streams").WithQueryParams(&opts).Build() 25 if err != nil { 26 return nil, err 27 } 28 29 // GET /v2/{project_id}/streams 30 raw, err := client.Get(client.ServiceURL(url.String()), nil, &golangsdk.RequestOpts{ 31 MoreHeaders: map[string]string{"Content-Type": "application/json"}, JSONBody: nil, 32 }) 33 if err != nil { 34 return nil, err 35 } 36 37 var res ListStreamsResponse 38 err = extract.Into(raw.Body, &res) 39 return &res, err 40 } 41 42 type ListStreamsResponse struct { 43 // Total number of all the DIS streams created by the current tenant. 44 TotalNumber *int `json:"total_number,omitempty"` 45 // List of the streams meeting the current requests. 46 StreamNames []string `json:"stream_names,omitempty"` 47 // Specify whether there are more matching DIS streams to list. Possible values: 48 // true: yes 49 // false: no 50 // Default: false 51 HasMoreStreams *bool `json:"has_more_streams,omitempty"` 52 // Stream details. 53 StreamInfoList []StreamInfo `json:"stream_info_list,omitempty"` 54 } 55 56 type StreamInfo struct { 57 // Name of the stream. 58 StreamName string `json:"stream_name,omitempty"` 59 // Time when the stream is created. The value is a 13-bit timestamp. 60 CreatedAt *int64 `json:"create_time,omitempty"` 61 // Period for storing data in units of hours. 62 RetentionPeriod *int `json:"retention_period,omitempty"` 63 // Current status of the stream. Possible values: 64 // CREATING: The stream is being created. 65 // RUNNING: The stream is running. 66 // TERMINATING: The stream is being deleted. 67 // TERMINATED: The stream has been deleted. 68 // Enumeration values: 69 // CREATING 70 // RUNNING 71 // TERMINATING 72 // FROZEN 73 Status string `json:"status,omitempty"` 74 // Stream type. 75 // COMMON: a common stream. The bandwidth is 1 MB/s. 76 // ADVANCED: an advanced stream. The bandwidth is 5 MB/s. 77 // Enumeration values: 78 // COMMON 79 // ADVANCED 80 StreamType string `json:"stream_type,omitempty"` 81 // Source data type. 82 // BLOB: a collection of binary data stored as a single entity in a database management system. 83 // JSON: an open-standard file format that uses human-readable text to transmit data objects 84 // consisting of attribute-value pairs and array data types. 85 // CSV: a simple text format for storing tabular data in a plain text file. Commas are used as delimiters. 86 // Default value: BLOB 87 // Enumeration values: 88 // BLOB 89 // JSON 90 // CSV 91 DataType string `json:"data_type,omitempty"` 92 // Quantity of partitions. Partitions are the base throughput unit of a DIS stream. 93 PartitionCount *int `json:"partition_count,omitempty"` 94 // Specifies whether to enable auto-scaling. 95 // true: auto-scaling is enabled. 96 // false: auto-scaling is disabled. 97 // This function is disabled by default. 98 // Default: false 99 AutoScaleEnabled *bool `json:"auto_scale_enabled,omitempty"` 100 // Minimum number of partitions for automatic scale-down when auto scaling is enabled. 101 // Minimum: 1 102 AutoScaleMinPartitionCount *int `json:"auto_scale_min_partition_count,omitempty"` 103 // Maximum number of partitions for automatic scale-up when auto scaling is enabled. 104 AutoScaleMaxPartitionCount *int `json:"auto_scale_max_partition_count,omitempty"` 105 // List of tags for the newly created DIS stream. 106 Tags []tags.ResourceTag `json:"tags,omitempty"` 107 }