-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproviders.go
72 lines (54 loc) · 1.83 KB
/
providers.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package clccam
import uuid "github.com/satori/go.uuid"
type Provider struct {
// ID of the provider account in Cloud Application Manager
ID uuid.UUID `json:"id"`
// Name used to identify the provider account in Cloud Application Manager.
Name string `json:"name"`
// Provider account owner in Cloud Application Manager
Owner string `json:"owner"`
// Users with whom the provider is shared
Members []interface{} `json:"members"`
// Date the provider was added
Created Timestamp `json:"created"`
// Date the provider was updated
Updated Timestamp `json:"updated"`
// Description of the provider
Description string `json:"description"`
Credentials struct{} `json:"credentials"`
// Icon used for the provider account.
Icon URI `json:"icon"`
Services []struct {
Locations []struct {
Clusters []interface{} `json:"clusters"`
} `json:"locations"`
Name string `json:"name"`
} `json:"services"`
// E.g. "ready"
State string `json:"state"`
// Identifies the provider as one of the following:
// - Amazon Web Services
// - Rackspace, Openstack
// - VMware vSphere
// - Google Compute
// - Microsoft Azure
// - Cloudstack
// - SoftLayer
Type string `json:"type"`
// Unique resource identifier path to the provider account
URI URI `json:"uri"`
// Schema URI
Schema URI `json:"schema"`
}
// GetProviders lists all providers.
func (c *Client) GetProviders() (res []Provider, err error) {
return res, c.Get("/services/providers", &res)
}
// GetProvider retrieves a single provider by @providerId.
func (c *Client) GetProvider(providerId string) (res Provider, err error) {
return res, c.Get("/services/providers/"+providerId, &res)
}
// DeleteProvider attempts to remove provider @providerId.
func (c *Client) DeleteProvider(providerId string) error {
return c.getResponse("/services/providers/"+providerId, "DELETE", nil, nil)
}