-
Notifications
You must be signed in to change notification settings - Fork 1
/
location.go
44 lines (38 loc) · 1.08 KB
/
location.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package iland
import "fmt"
type Location struct {
ID string `json:"location_id"`
}
type locationService struct {
client *client
}
func (s *locationService) GetPublicCatalogs(locationID string) ([]Catalog, error) {
schema := struct {
Catalogs []Catalog `json:"data"`
}{}
err := s.client.getObject(fmt.Sprintf("/v1/locations/%s/public-catalogs", locationID), &schema)
if err != nil {
return []Catalog{}, err
}
return schema.Catalogs, nil
}
func (s *locationService) GetPublicVAppTemplates(locationID string) ([]VAppTemplate, error) {
schema := struct {
VAppTemplates []VAppTemplate `json:"data"`
}{}
err := s.client.getObject(fmt.Sprintf("/v1/locations/%s/public-vapp-templates", locationID), &schema)
if err != nil {
return []VAppTemplate{}, err
}
return schema.VAppTemplates, nil
}
func (s *locationService) GetPublicMedia(locationID string) ([]Media, error) {
schema := struct {
Media []Media `json:"data"`
}{}
err := s.client.getObject(fmt.Sprintf("/v1/locations/%s/public-media", locationID), &schema)
if err != nil {
return []Media{}, err
}
return schema.Media, nil
}