github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dis/v2/apps/GetAppStatus.go (about) 1 package apps 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 type GetAppStatusOpts struct { 9 // Name of the app to be queried. 10 AppName string 11 // Name of the stream to be queried. 12 // Maximum: 60 13 StreamName string 14 // Max. number of partitions to list in a single API call. 15 // The minimum value is 1 and the maximum value is 1,000. 16 // The default value is 100. 17 // Minimum: 1 18 // Maximum: 1000 19 // Default: 100 20 Limit *int `q:"limit,omitempty"` 21 // Name of the partition to start the partition list with. 22 // The returned partition list does not contain this partition. 23 StartPartitionId string `q:"start_partition_id,omitempty"` 24 // Type of the checkpoint. 25 // - LAST_READ: Only sequence numbers are recorded in databases. 26 // Enumeration values: 27 // LAST_READ 28 CheckpointType string `q:"checkpoint_type"` 29 } 30 31 func GetAppStatus(client *golangsdk.ServiceClient, opts GetAppStatusOpts) (*GetAppStatusResponse, error) { 32 url, err := golangsdk.NewURLBuilder().WithEndpoints("apps", opts.AppName, "streams", opts.StreamName).WithQueryParams(&opts).Build() 33 if err != nil { 34 return nil, err 35 } 36 37 // GET /v2/{project_id}/apps/{app_name}/streams/{stream_name} 38 raw, err := client.Get(client.ServiceURL(url.String()), nil, nil) 39 if err != nil { 40 return nil, err 41 } 42 43 var res GetAppStatusResponse 44 err = extract.Into(raw.Body, &res) 45 return &res, err 46 } 47 48 type GetAppStatusResponse struct { 49 // Specify whether there are more matching DIS streams to list. Possible values: 50 // true: yes 51 // false: no 52 // Default: false. 53 HasMore bool `json:"has_more"` 54 // Stream Name 55 StreamName string `json:"stream_name"` 56 // App name 57 AppName string `json:"app_name"` 58 // Partition consuming state list 59 PartitionConsumingStates []struct { 60 // Partition Id 61 PartitionId string `json:"partition_id"` 62 // Partition Sequence Number 63 SequenceNumber string `json:"sequence_number"` 64 // Partition data latest offset 65 LatestOffset int `json:"latest_offset"` 66 // Partition data earliest offset 67 EarliestOffset int `json:"earliest_offset"` 68 // Type of the checkpoint. 69 // LAST_READ: Only sequence numbers are recorded in databases. 70 // Enumeration values: 71 // LAST_READ 72 CheckpointType string `json:"checkpoint_type"` 73 // Partition Status: 74 // CREATING 75 // ACTIVE 76 // DELETED 77 // EXPIRED 78 Status string `json:"status"` 79 } `json:"partition_consuming_states"` 80 }