github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dis/v2/streams/UpdateStream.go (about)

     1  package streams
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type UpdateStreamOpts struct {
     9  	// Name of the stream whose partition quantity needs to be changed.
    10  	StreamName string `json:"stream_name" required:"true"`
    11  	// Period of time for which data is retained in the stream.
    12  	// Value range: 24-72 Unit: hour
    13  	// Default value: 24 If this parameter is left blank, the default value is used.
    14  	// Maximum: 168
    15  	// Default: 24
    16  	DataDuration *int `json:"data_duration,omitempty"`
    17  	// Source data type.
    18  	// - BLOB: a collection of binary data stored as a single entity in a database management system.
    19  	// Default value: BLOB.
    20  	// Enumeration values:
    21  	// BLOB
    22  	DataType string `json:"data_type,omitempty"`
    23  	// Source data structure that define JSON and CSV formats.
    24  	// It is described in the syntax of the Avro schema.
    25  	DataSchema string `json:"data_schema,omitempty"`
    26  	// Specifies whether to enable auto-scaling.
    27  	// - true: auto scaling is enabled.
    28  	// - false:  auto-scaling is disabled. This function is disabled by default.
    29  	// Default: false
    30  	// Enumeration values:
    31  	// true
    32  	// false
    33  	AutoScaleEnabled *bool `json:"auto_scale_enabled,omitempty"`
    34  	// Minimum number of partitions for automatic scale-down when auto-scaling is enabled.
    35  	// Minimum: 1
    36  	AutoScaleMinPartitionCount *int `json:"auto_scale_min_partition_count,omitempty"`
    37  	// Maximum number of partitions for automatic scale-up when auto-scaling is enabled.
    38  	AutoScaleMaxPartitionCount *int `json:"auto_scale_max_partition_count,omitempty"`
    39  }
    40  
    41  func UpdateStream(client *golangsdk.ServiceClient, opts UpdateStreamOpts) error {
    42  	body, err := build.RequestBody(opts, "")
    43  	if err != nil {
    44  		return err
    45  	}
    46  
    47  	// PUT /v3/{project_id}/streams/{stream_name}
    48  	_, err = client.Put(client.ServiceURL("streams", opts.StreamName), body, nil, &golangsdk.RequestOpts{
    49  		OkCodes: []int{200},
    50  	})
    51  	return err
    52  }