streams

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2023 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePolicyRule

func CreatePolicyRule(client *golangsdk.ServiceClient, opts CreatePolicyRuleOpts) error

func CreateStream

func CreateStream(client *golangsdk.ServiceClient, opts CreateStreamOpts) error

func DeleteStream

func DeleteStream(client *golangsdk.ServiceClient, streamName string) (err error)

func UpdatePartitionCount

func UpdatePartitionCount(client *golangsdk.ServiceClient, opts UpdatePartitionCountOpts) error

func UpdateStream

func UpdateStream(client *golangsdk.ServiceClient, opts UpdateStreamOpts) error

Types

type CreatePolicyRuleOpts

type CreatePolicyRuleOpts struct {
	// Name of the stream for which you want to add an authorization policy.
	// Maximum: 64
	StreamName string `json:"stream_name" required:"true"`
	// Unique ID of the stream.
	StreamId string `json:"stream_id"`
	// Authorized users.
	// If the permission is granted to a specified tenant, the format is domainName.*.
	// If the permission is granted to a specified sub-user of a tenant, the format is domainName.userName.
	// Multiple accounts can be added and separated by commas (,),
	// for example, domainName1.userName1,do mainName2.userName2.
	PrincipalName string `json:"principal_name"`
	// Authorization operation type.
	// - putRecords: upload data.
	// - getRecords: download data.
	// Enumeration values:
	// putRecords
	// getRecords
	ActionType string `json:"action_type"`
	// Authorization impact type.
	// - accept: The authorization operation is allowed.
	// Enumeration values:
	// - accept
	Effect string `json:"effect"`
}

type CreateStreamOpts

type CreateStreamOpts struct {
	// Name of the stream.
	// The stream name can contain 1 to 64 characters, including letters, digits, underscores (_), and hyphens (-).
	// Maximum: 64
	StreamName string `json:"stream_name"`
	// Number of partitions. Partitions are the base throughput unit of a DIS stream.
	PartitionCount int `json:"partition_count"`
	// Stream type.
	// COMMON: a common stream. The bandwidth is 1 MB/s.
	// ADVANCED: an advanced stream. The bandwidth is 5 MB/s.
	// Enumeration values:
	// COMMON
	// ADVANCED
	StreamType string `json:"stream_type,omitempty"`
	// Source data type.
	// BLOB: a set of binary data stored in a database management system.
	// Default value: BLOB
	// Enumeration values:
	// BLOB
	DataType string `json:"data_type,omitempty"`
	// Period of time for which data is retained in the stream.
	// Value range: 24-72
	// Unit: hour
	// Default value: 24
	// If this parameter is left blank, the default value is used.
	// Maximum: 7
	// Default: 24
	DataDuration *int `json:"data_duration,omitempty"`
	// Specifies whether to enable auto-scaling.
	// true: Auto scaling is enabled.
	// false: Auto scaling is disabled.
	// This function is disabled by default.
	// Default: false
	AutoScaleEnabled *bool `json:"auto_scale_enabled,omitempty"`
	// Minimum number of partitions for automatic scale-down when auto-scaling is enabled.
	// Minimum: 1
	AutoScaleMinPartitionCount *int `json:"auto_scale_min_partition_count,omitempty"`
	// Maximum number of partitions for automatic scale-up when auto-scaling is enabled.
	AutoScaleMaxPartitionCount *int `json:"auto_scale_max_partition_count,omitempty"`
	// Source data structure that defines JSON and CSV formats.
	// It is described in the syntax of the Avro schema.
	DataSchema string `json:"data_schema,omitempty"`
	// Attributes of data in CSV format, such as delimiter.
	CsvProperties CsvProperties `json:"csv_properties,omitempty"`
	// Compression type of data. Currently, the value can be:
	// snappy
	// gzip
	// zip
	// Data is not compressed by default.
	// Enumeration values:
	// snappy
	// gzip
	// zip
	CompressionFormat string `json:"compression_format,omitempty"`
	// List of stream tags.
	Tags []tags.ResourceTag `json:"tags,omitempty"`
}

type CsvProperties

type CsvProperties struct {
	// Data separator.
	Delimiter string `json:"delimiter,omitempty"`
}

type DescribeStreamResponse

type DescribeStreamResponse struct {
	// Name of the stream.
	StreamName string `json:"stream_name,omitempty"`
	// Time when a stream is created. The value is a 13-bit timestamp.
	CreatedAt *int64 `json:"create_time,omitempty"`
	// Time when a stream is the most recently modified. The value is a 13-bit timestamp.
	LastModifiedTime *int64 `json:"last_modified_time,omitempty"`
	// Current status of the stream. Possible values:
	// CREATING: The stream is being created.
	// RUNNING: The stream is running.
	// TERMINATING: The stream is being deleted.
	// TERMINATED: The stream has been deleted.
	// Enumeration values:
	// CREATING
	// RUNNING
	// TERMINATING
	// FROZEN
	Status string `json:"status,omitempty"`
	// Stream type.
	// COMMON: a common stream. The bandwidth is 1 MB/s.
	// ADVANCED: an advanced stream. The bandwidth is 5 MB/s.
	// Enumeration values:
	// COMMON
	// ADVANCED
	StreamType string `json:"stream_type,omitempty"`
	// A list of partitions that comprise the DIS stream.
	Partitions []PartitionResult `json:"partitions,omitempty"`
	// Specifies whether there are more matching partitions of the DIS stream to list.
	// true: yes
	// false: no
	HasMorePartitions *bool `json:"has_more_partitions,omitempty"`
	// Period for storing data in units of hours.
	RetentionPeriod *int `json:"retention_period,omitempty"`
	// Unique identifier of the stream.
	StreamId string `json:"stream_id,omitempty"`
	// Source data type
	// BLOB: a set of binary data stored in a database management system.
	// Default value: BLOB
	// Enumeration values:
	// BLOB
	DataType string `json:"data_type,omitempty"`
	// Source data structure that defines JSON and CSV formats.
	// It is described in the syntax of the Avro schema.
	// For details about Avro,
	// go to http://avro.apache.org/docs/current/
	DataSchema string `json:"data_schema,omitempty"`
	// Compression type of data. Currently, the value can be:
	// snappy
	// gzip
	// zip
	// Data is not compressed by default.
	// Enumeration values:
	// snappy
	// gzip
	// zip
	CompressionFormat string `json:"compression_format,omitempty"`
	// Attributes of data in CSV format, such as delimiter.
	CsvProperties CsvProperties `json:"csv_properties,omitempty"`
	// Total number of writable partitions (including partitions in ACTIVE state only).
	WritablePartitionCount *int `json:"writable_partition_count,omitempty"`
	// Total number of readable partitions (including partitions in ACTIVE and DELETED state).
	ReadablePartitionCount *int `json:"readable_partition_count,omitempty"`
	// List of scaling operation records.
	UpdatePartitionCounts []UpdatePartitionCountResponse `json:"update_partition_counts,omitempty"`
	// List of stream tags.
	Tags []tags.ResourceTag `json:"tags,omitempty"`
	// Specifies whether to enable auto-scaling.
	// true: auto-scaling is enabled.
	// false: auto-scaling is disabled.
	// This function is disabled by default.
	AutoScaleEnabled *bool `json:"auto_scale_enabled,omitempty"`
	// Minimum number of partitions for automatic scale-down when auto-scaling is enabled.
	AutoScaleMinPartitionCount *int `json:"auto_scale_min_partition_count,omitempty"`
	// Maximum number of partitions for automatic scale-up when auto-scaling is enabled.
	AutoScaleMaxPartitionCount *int `json:"auto_scale_max_partition_count,omitempty"`
}

type GetPolicyRuleResponse

type GetPolicyRuleResponse struct {
	// Unique ID of the stream.
	StreamId string `json:"stream_id,omitempty"`
	// List of authorization information records.
	Rules []PrincipalRule `json:"rules,omitempty"`
}

func GetPolicyRule

func GetPolicyRule(client *golangsdk.ServiceClient, streamName string) (*GetPolicyRuleResponse, error)

type GetStreamOpts

type GetStreamOpts struct {
	// Stream to be queried.
	// Maximum: 60
	StreamName string
	// Name of the partition to start the partition list with. The returned partition list does not contain this partition.
	StartPartitionId string `q:"start_partitionId,omitempty"`
	// Maximum number of partitions to list in a single API call. Value range: 1-1,000 Default value: 100
	// Minimum: 1
	// Maximum: 1000
	// Default: 100
	LimitPartitions *int `q:"limit_partitions,omitempty"`
}

type ListStreamsOpts

type ListStreamsOpts struct {
	// The maximum number of DIS streams to list in a single API call.
	// Value range: 1-100 Default value: 10
	// Minimum: 1
	// Maximum: 100
	// Default: 10
	Limit *int `q:"limit,omitempty"`
	// Name of the DIS stream to start the stream list with. The returned stream list does not contain this DIS stream name.
	// If pagination query is required, this parameter is not transferred for query on the first page.
	// If the value of has_more_streams is true, the query is performed on the next page.
	// The value of start_stream_name is the name of the last stream in the query result of the first page.
	StartStreamName string `q:"start_stream_name,omitempty"`
}

type ListStreamsResponse

type ListStreamsResponse struct {
	// Total number of all the DIS streams created by the current tenant.
	TotalNumber *int `json:"total_number,omitempty"`
	// List of the streams meeting the current requests.
	StreamNames []string `json:"stream_names,omitempty"`
	// Specify whether there are more matching DIS streams to list. Possible values:
	// true: yes
	// false: no
	// Default: false
	HasMoreStreams *bool `json:"has_more_streams,omitempty"`
	// Stream details.
	StreamInfoList []StreamInfo `json:"stream_info_list,omitempty"`
}

type PartitionResult

type PartitionResult struct {
	// Current status of the partition. Possible values:
	// CREATING: The stream is being created.
	// ACTIVE: The stream is available.
	// DELETED: The stream is being deleted.
	// EXPIRED: The stream has expired.
	// Enumeration values:
	// CREATING
	// ACTIVE
	// DELETED
	// EXPIRED
	Status string `json:"status,omitempty"`
	// Unique identifier of the partition.
	PartitionId string `json:"partition_id,omitempty"`
	// Possible value range of the hash key used by the partition.
	HashRange string `json:"hash_range,omitempty"`
	// Sequence number range of the partition.
	SequenceNumberRange string `json:"sequence_number_range,omitempty"`
	// Parent partition.
	ParentPartitions string `json:"parent_partitions,omitempty"`
}

type PrincipalRule

type PrincipalRule struct {
	// ID of the authorized user.
	Principal string `json:"principal,omitempty"`
	// Name of the authorized user.
	// If the permission is granted to all sub-users of a tenant, the format is domainName.*.
	// If the permission is granted to a specified sub-user of a tenant, the format is domainName.userName.
	PrincipalName string `json:"principal_name,omitempty"`
	// Authorization operation type.
	// - putRecords: the data to be uploaded.
	// - getRecords: Download data.
	// Enumeration values:
	// putRecords
	// getRecords
	ActionType string `json:"action_type,omitempty"`
	// Authorization impact type.
	// - accept: The authorization operation is allowed.
	// Enumeration values:
	// accept
	Effect string `json:"effect,omitempty"`
}

type StreamInfo

type StreamInfo struct {
	// Name of the stream.
	StreamName string `json:"stream_name,omitempty"`
	// Time when the stream is created. The value is a 13-bit timestamp.
	CreatedAt *int64 `json:"create_time,omitempty"`
	// Period for storing data in units of hours.
	RetentionPeriod *int `json:"retention_period,omitempty"`
	// Current status of the stream. Possible values:
	// CREATING: The stream is being created.
	// RUNNING: The stream is running.
	// TERMINATING: The stream is being deleted.
	// TERMINATED: The stream has been deleted.
	// Enumeration values:
	// CREATING
	// RUNNING
	// TERMINATING
	// FROZEN
	Status string `json:"status,omitempty"`
	// Stream type.
	// COMMON: a common stream. The bandwidth is 1 MB/s.
	// ADVANCED: an advanced stream. The bandwidth is 5 MB/s.
	// Enumeration values:
	// COMMON
	// ADVANCED
	StreamType string `json:"stream_type,omitempty"`
	// Source data type.
	// BLOB: a collection of binary data stored as a single entity in a database management system.
	// JSON: an open-standard file format that uses human-readable text to transmit data objects
	// consisting of attribute-value pairs and array data types.
	// CSV: a simple text format for storing tabular data in a plain text file. Commas are used as delimiters.
	// Default value: BLOB
	// Enumeration values:
	// BLOB
	// JSON
	// CSV
	DataType string `json:"data_type,omitempty"`
	// Quantity of partitions. Partitions are the base throughput unit of a DIS stream.
	PartitionCount *int `json:"partition_count,omitempty"`
	// Specifies whether to enable auto-scaling.
	// true: auto-scaling is enabled.
	// false: auto-scaling is disabled.
	// This function is disabled by default.
	// Default: false
	AutoScaleEnabled *bool `json:"auto_scale_enabled,omitempty"`
	// Minimum number of partitions for automatic scale-down when auto scaling is enabled.
	// Minimum: 1
	AutoScaleMinPartitionCount *int `json:"auto_scale_min_partition_count,omitempty"`
	// Maximum number of partitions for automatic scale-up when auto scaling is enabled.
	AutoScaleMaxPartitionCount *int `json:"auto_scale_max_partition_count,omitempty"`
	// List of tags for the newly created DIS stream.
	Tags []tags.ResourceTag `json:"tags,omitempty"`
}

type UpdatePartitionCountOpts

type UpdatePartitionCountOpts struct {
	// Name of the stream whose partition quantity needs to be changed.
	// Maximum: 64
	StreamName string `json:"stream_name" required:"true"`
	// Number of the target partitions.
	// The value is an integer greater than 0.
	// If the value is greater than the number of current partitions, scaling-up is required.
	// If the value is less than the number of current partitions, scale-down is required.
	// Note: A maximum of five scale-up/down operations can be performed for each stream within one hour.
	// If a scale-up/down operation is successfully performed, you cannot perform one more scale-up/down operation within the next one hour.
	// Minimum: 0
	TargetPartitionCount int `json:"target_partition_count"`
}

type UpdatePartitionCountResponse

type UpdatePartitionCountResponse struct {
	// Scaling execution timestamp, which is a 13-digit timestamp.
	CreatedAt *int64 `json:"create_timestamp,omitempty"`
	// Number of partitions before scaling.
	SrcPartitionCount *int `json:"src_partition_count,omitempty"`
	// Number of partitions after scaling.
	TargetPartitionCount *int `json:"target_partition_count,omitempty"`
	// Response code of the scaling operation.
	ResultCode *int `json:"result_code,omitempty"`
	// Response to the scaling operation.
	ResultMsg *int `json:"result_msg,omitempty"`
	// Specifies whether the scaling operation is automatic.
	// true: Auto scaling is enabled.
	// false: Manual scaling is enabled.
	AutoScale *bool `json:"auto_scale,omitempty"`
}

type UpdateStreamOpts

type UpdateStreamOpts struct {
	// Name of the stream whose partition quantity needs to be changed.
	StreamName string `json:"stream_name" required:"true"`
	// Period of time for which data is retained in the stream.
	// Value range: 24-72 Unit: hour
	// Default value: 24 If this parameter is left blank, the default value is used.
	// Maximum: 168
	// Default: 24
	DataDuration *int `json:"data_duration,omitempty"`
	// Source data type.
	// - BLOB: a collection of binary data stored as a single entity in a database management system.
	// Default value: BLOB.
	// Enumeration values:
	// BLOB
	DataType string `json:"data_type,omitempty"`
	// Source data structure that define JSON and CSV formats.
	// It is described in the syntax of the Avro schema.
	DataSchema string `json:"data_schema,omitempty"`
	// Specifies whether to enable auto-scaling.
	// - true: auto scaling is enabled.
	// - false:  auto-scaling is disabled. This function is disabled by default.
	// Default: false
	// Enumeration values:
	// true
	// false
	AutoScaleEnabled *bool `json:"auto_scale_enabled,omitempty"`
	// Minimum number of partitions for automatic scale-down when auto-scaling is enabled.
	// Minimum: 1
	AutoScaleMinPartitionCount *int `json:"auto_scale_min_partition_count,omitempty"`
	// Maximum number of partitions for automatic scale-up when auto-scaling is enabled.
	AutoScaleMaxPartitionCount *int `json:"auto_scale_max_partition_count,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL