github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dis/v2/apps/ListApp.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 ListAppOpts struct { 9 // Maximum number of apps to list in a single API call. Value range: 1-100 Default value: 10 10 // Minimum: 1 11 // Maximum: 1000 12 // Default: 10 13 Limit *int `q:"limit,omitempty"` 14 // Name of the app to start the list with. The returned app list does not contain this app name. 15 StartAppName string `q:"start_app_name,omitempty"` 16 // Name of the stream whose apps will be returned. 17 StreamName string `q:"stream_name,omitempty"` 18 } 19 20 func ListApps(client *golangsdk.ServiceClient, opts ListAppOpts) (*ListAppResponse, error) { 21 url, err := golangsdk.NewURLBuilder().WithEndpoints("apps").WithQueryParams(&opts).Build() 22 if err != nil { 23 return nil, err 24 } 25 26 // GET /v2/{project_id}/apps 27 raw, err := client.Get(client.ServiceURL(url.String()), nil, nil) 28 if err != nil { 29 return nil, err 30 } 31 32 var res ListAppResponse 33 err = extract.Into(raw.Body, &res) 34 return &res, err 35 } 36 37 type ListAppResponse struct { 38 // Specifies whether there are more matching consumer applications to list. 39 // true: yes 40 // false: no 41 HasMoreApp *bool `json:"has_more_app,omitempty"` 42 // AppEntry list that meets the current request. 43 Apps []DescribeAppResult `json:"apps,omitempty"` 44 // Total number of apps that meet criteria. 45 TotalNumber *int `json:"total_number,omitempty"` 46 } 47 48 type DescribeAppResult struct { 49 // Name of the app. 50 AppName string `json:"app_name,omitempty"` 51 // Unique identifier of the app. 52 AppId string `json:"app_id,omitempty"` 53 // Time when the app is created, in milliseconds. 54 CreateTime *int64 `json:"create_time,omitempty"` 55 // List of associated streams. 56 CommitCheckPointStreamNames []string `json:"commit_checkpoint_stream_names,omitempty"` 57 }