github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dis/v2/checkpoints/CommitCheckpoint.go (about) 1 package checkpoints 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 ) 7 8 type CommitCheckpointOpts struct { 9 // Name of the app, which is the unique identifier of a user data consumption program. 10 AppName string `json:"app_name"` 11 // Type of the checkpoint. 12 // LAST_READ: Only sequence numbers are recorded in databases. 13 // Enumeration values: 14 // LAST_READ 15 CheckpointType string `json:"checkpoint_type"` 16 // Name of the stream. 17 StreamName string `json:"stream_name"` 18 // Partition identifier of the stream. The value can be in either of the following formats: 19 // shardId-0000000000 20 // 0 21 // For example, if a stream has three partitions, the partition identifiers are 0, 1, and 2, or shardId-0000000000, shardId-0000000001, and shardId-0000000002, respectively. 22 PartitionId string `json:"partition_id"` 23 // Sequence number to be submitted, which is used to record the consumption checkpoint of the stream. 24 // Ensure that the sequence number is within the valid range. 25 SequenceNumber string `json:"sequence_number"` 26 // Metadata information of the consumer application. 27 // The metadata information can contain a maximum of 1,000 characters. 28 // Maximum: 1000 29 Metadata string `json:"metadata,omitempty"` 30 } 31 32 func CommitCheckpoint(client *golangsdk.ServiceClient, opts CommitCheckpointOpts) error { 33 b, err := build.RequestBody(opts, "") 34 if err != nil { 35 return err 36 } 37 38 // POST /v2/{project_id}/checkpoints 39 _, err = client.Post(client.ServiceURL("checkpoints"), b, nil, &golangsdk.RequestOpts{ 40 OkCodes: []int{201}, 41 }) 42 return err 43 }