github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/tms/v1/providers/results.go (about) 1 package providers 2 3 import "github.com/chnsz/golangsdk/pagination" 4 5 // Provider is the structure that represents the resources detail of the tags supported providers. 6 type Provider struct { 7 // Specifies the cloud service name. 8 Provider string `json:"provider"` 9 // Specifies the display name of the resource. You can configure the language by setting the locale parameter. 10 ProviderI18nDisplayName string `json:"provider_i18n_display_name"` 11 // Specifies the resource type list. 12 Resources []ResourceDetail `json:"resource_types"` 13 } 14 15 // ResourceDetail is the strucutre that represents the resource detail. 16 type ResourceDetail struct { 17 // Specifies the resource type. 18 ResourceType string `json:"resource_type"` 19 // Specifies the display name of the resource type. You can configure the language by setting the locale parameter. 20 ResourceTypeI18nDisplayName string `json:"resource_type_i18n_display_name"` 21 // Specifies supported regions. 22 Regions []string `json:"regions"` 23 // Specifies whether the resources is a global resource. 24 Global bool `json:"global"` 25 } 26 27 // ProviderPage is a single page maximum result representing a query by offset page. 28 type ProviderPage struct { 29 pagination.OffsetPageBase 30 } 31 32 // IsEmpty checks whether a ProviderPage struct is empty. 33 func (b ProviderPage) IsEmpty() (bool, error) { 34 arr, err := extractProviders(b) 35 return len(arr) == 0, err 36 } 37 38 // extractProviders is a method to extract the list of tags supported providers. 39 func extractProviders(r pagination.Page) ([]Provider, error) { 40 var s []Provider 41 err := r.(ProviderPage).Result.ExtractIntoSlicePtr(&s, "providers") 42 return s, err 43 }