streams

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StreamTypeCommon   = "COMMON"
	StreamTypeAdvanced = "ADVANCED"

	DataTypeBlob = "BLOB"
	DataTypeJson = "JSON"
	DataTypeCsv  = "CSV"

	CompressionTypeSnappy = "snappy"
	CompressionTypeGzip   = "gzip"
	CompressionTypeZip    = "zip"

	StatusCreating    = "CREATING"
	StatusRunning     = "RUNNING"
	StatusTerminating = "TERMINATING"
	StatusTerminated  = "TERMINATED"
	StatusFrozen      = "FROZEN"
)

Variables

This section is empty.

Functions

func Create

func Create(c *golangsdk.ServiceClient, opts CreateOpts) (*golangsdk.Result, error)

func CreatePolicy

func CreatePolicy(c *golangsdk.ServiceClient, streamName string, opts CreatePolicyOpt) (*golangsdk.Result, error)

func Delete

func Delete(c *golangsdk.ServiceClient, streamName string) *golangsdk.ErrResult

func UpdatePartition

func UpdatePartition(c *golangsdk.ServiceClient, name string, opts UpdatePartitionOpt) (*golangsdk.Result, error)

Types

type CreateOpts

type CreateOpts struct {
	// Each DIS stream has a unique name. A stream name is 1 to 64 characters in length. Only letters, digits,
	// hyphens (-), and underscores (_) are allowed.
	StreamName string `json:"stream_name" required:"true"`
	// Quantity of the partitions into which data records in the newly created DIS stream will be distributed.
	// Partitions are the base throughput unit of a DIS stream.
	// The value range varies depending on the value of stream_type.
	// If stream_type is not specified or set to COMMON, the value of partition_count is an int from 1 to 50.
	// If the tenant has created N common partitions, the maximum value of partition_count is 50-N.
	// If stream_type is set to ADVANCED, the value of partition_count is an int from 1 to 10.
	// If the tenant has created N advanced partitions, the maximum value of partition_count is 10-N.
	PartitionCount int `json:"partition_count" required:"true"`
	// Stream type. Possible values:
	// COMMON: a common stream. The bandwidth is 1 MB/s.
	// ADVANCED: an advanced stream. The bandwidth is 5 MB/s.
	// Default value: COMMON
	StreamType string `json:"stream_type,omitempty"`
	// Source data type.
	// Possible values:
	// 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.
	// Default value: BLOB
	DataType string `json:"data_type,omitempty"`
	// Period of time for which data is retained in the DIS stream.
	// Value range: 24 to 72
	// Unit: hour
	// Default value: 24
	// If this parameter is left unspecified, the default value will be used.
	DataDuration int `json:"data_duration,omitempty"`
	// Whether to enable automatic Scaling
	// true: Turn on automatic scale out.
	// false: Turn off automatic scale in.
	// Disabled by default.
	// Default value: false
	AutoScaleEnabled *bool `json:"auto_scale_enabled,omitempty"`
	// When auto scaling is enabled, the minimum number of slices for auto scaling.
	// Minimum value: 1
	AutoScaleMinPartitionCount *int `json:"auto_scale_min_partition_count,omitempty"`
	// When auto scaling is enabled, the maximum number of slices for auto scaling.
	AutoScaleMaxPartitionCount *int `json:"auto_scale_max_partition_count,omitempty"`
	// Source data structure that defines JOSN and CSV formats. It is described in the syntax of Avro.
	// For details about Avro, see http://avro.apache.org/docs/current/#schemas.
	// NOTE:
	// This parameter is mandatory when Dump File Format is Parquet or CarbonData.
	DataSchema string `json:"data_schema,omitempty"`
	// Related attributes of CSV format data, such as delimiter
	CsvProperties *CsvProperty `json:"csv_properties,omitempty"`
	// Data compression type, currently supports:
	// snappy
	// gzip
	// zip
	// No compression by default
	CompressionFormat string             `json:"compression_format,omitempty"`
	Tags              []tags.ResourceTag `json:"tags,omitempty"`
	//the key must be:"_sys_enterprise_project_id"
	SysTags []tags.ResourceTag `json:"sys_tags,omitempty"`
}

type CreatePolicyOpt

type CreatePolicyOpt struct {
	StreamId string `json:"stream_id" required:"true"`
	// Authorized users.
	// If authorized to the specified tenant, the format is: domainName.*;
	// if authorized to the specified sub-user under the tenant, the format is: domainName.userName;
	//Support for adding multiple accounts, separated by ",", for example: domainName1.userName1,domainName2.userName2;
	PrincipalName string `json:"principal_name" required:"true"`
	// Authorized operation type: putRecords,getRecords
	ActionType string `json:"action_type" required:"true"`
	//Authorization impact type: accept,
	Effect string `json:"effect" required:"true"`
}

type CsvProperty

type CsvProperty struct {
	Delimiter string `json:"delimiter"`
}

type GetOpts

type GetOpts struct {
	StartPartitionId string `q:"start_partitionId"`
	// maximum number of partitions per request
	//   value range:1~1000。
	//   default:100。
	LimitPartitions int `q:"limit_partitions"`
}

type ListPolicyResult

type ListPolicyResult struct {
	StreamId string   `json:"stream_id"`
	Rules    []Policy `json:"rules"`
}

func ListPolicies

func ListPolicies(c *golangsdk.ServiceClient, streamName string) (*ListPolicyResult, error)

type ListResult

type ListResult struct {
	HasMoreStreams bool     `json:"has_more_streams"`
	StreamList     []Stream `json:"stream_info_list"`
	StreamNames    []string `json:"stream_names"`
	TotalNumber    int      `json:"total_number"`
}

func List

func List(c *golangsdk.ServiceClient, opts ListStreamsOpts) (*ListResult, error)

type ListStreamsOpts

type ListStreamsOpts struct {
	// maximum number of stream per request
	// value range:1~100。
	// default:10。
	Limit int `q:"limit"`
	// Return the stream list from this stream, the returned stream list does not include this stream name.
	// do not pass this field when querying on the first page. When the returned result has_more_streams is true,
	// the next page query is performed, and start_stream_name is the last stream name of the first page query result.
	StartStreamName string `q:"start_stream_name"`
}

type Partition

type Partition struct {
	// Current status of each partition. CREATING,ACTIVE, DELETED, EXPIRED
	Status string `json:"status"`
	// Unique identifier of the partition.
	PartitionId string `json:"partition_id"`
	// Possible value range of the hash key used by each partition.
	HashRange string `json:"hash_range"`
	// Sequence number range of each partition.
	SequenceNumberRange string `json:"sequence_number_range"`
}

type Policy

type Policy struct {
	Principal     string `json:"principal"`
	PrincipalName string `json:"principal_name"`
	ActionType    string `json:"action_type"`
	Effect        string `json:"effect"`
}

type Stream

type Stream struct {
	StreamName                 string             `json:"stream_name"`
	CreateTime                 int                `json:"create_time"`
	RetentionPeriod            int                `json:"retention_period"`
	Status                     string             `json:"status"`
	StreamType                 string             `json:"stream_type"`
	DataType                   string             `json:"data_type"`
	PartitionCount             int                `json:"partition_count"`
	AutoScaleEnabled           bool               `json:"auto_scale_enabled"`
	AutoScaleMinPartitionCount int                `json:"auto_scale_min_partition_count"`
	AutoScaleMaxPartitionCount int                `json:"auto_scale_max_partition_count"`
	Tags                       []tags.ResourceTag `json:"tags"`
	SysTags                    []tags.ResourceTag `json:"sys_tags"`
}

type StreamDetail

type StreamDetail struct {
	AutoScaleEnabled           bool               `json:"auto_scale_enabled"`
	AutoScaleMaxPartitionCount int                `json:"auto_scale_max_partition_count"`
	AutoScaleMinPartitionCount int                `json:"auto_scale_min_partition_count"`
	CompressionFormat          string             `json:"compression_format"`
	CreateTime                 int                `json:"create_time"`
	CsvProperties              CsvProperty        `json:"csv_properties"`
	DataSchema                 string             `json:"data_schema"`
	DataType                   string             `json:"data_type"`
	LastModifiedTime           int                `json:"last_modified_time"`
	RetentionPeriod            int                `json:"retention_period"`
	Status                     string             `json:"status"` //status: CREATING,RUNNING,TERMINATING,TERMINATED
	StreamId                   string             `json:"stream_id"`
	StreamName                 string             `json:"stream_name"`
	StreamType                 string             `json:"stream_type"` //COMMON:1MB bandwidth- ADVANCED:5MB bandwidth
	Tags                       []tags.ResourceTag `json:"tags"`
	SysTags                    []tags.ResourceTag `json:"sys_tags"`
	// scaling operation record list.
	UpdatePartitionCounts []UpdatePartitionLog `json:"update_partition_counts"`
	// Total number of writable partitions (including partitions in ACTIVE state only).
	WritablePartitionCount int `json:"writable_partition_count"`
	// Total number of readable partitions (including partitions in ACTIVE and DELETED state).
	ReadablePartitionCount int `json:"readable_partition_count"`
	// A list of partitions that comprise the DIS stream.
	Partitions []Partition `json:"partitions"`
	// Specify whether there are more matching partitions of the DIS stream to list.
	HasMorePartitions bool `json:"has_more_partitions"`
}

func Get

func Get(c *golangsdk.ServiceClient, streamName string, opts GetOpts) (*StreamDetail, error)

type UpdatePartitionLog

type UpdatePartitionLog struct {
	CreateTimestamp      int  `json:"create_timestamp"`
	SrcPartitionCount    int  `json:"src_partition_count"`
	TargetPartitionCount int  `json:"target_partition_count"`
	ResultCode           int  `json:"result_code"`
	ResultMsg            int  `json:"result_msg"`
	AutoScale            bool `json:"auto_scale"`
}

type UpdatePartitionOpt

type UpdatePartitionOpt struct {
	StreamName string `json:"stream_name" required:"true"`
	// The number of target partitions to be changed.
	// The value is an integer greater than 0.
	// The set value greater than the current number of partitions means expansion,
	// and less than the current number of partitions means shrinking.
	//Notice:
	// The total number of expansion and contraction times for each channel in an hour is up to 5 times,
	// and if the expansion or contraction operation succeeds once within an hour, the expansion or contraction
	// operation is not allowed in the last hour.
	// Minimum value: 0
	TargetPartitionCount int `json:"target_partition_count" required:"true"`
}

Jump to

Keyboard shortcuts

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