/
organization.go
40 lines (33 loc) · 1.16 KB
/
organization.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
// Package aiven provides a client for using the Aiven API.
package aiven
type (
// OrganizationHandler is the client which interacts with the Organizations API on Aiven.
OrganizationHandler struct {
// client is the API client to use.
client *Client
}
// OrganizationInfo is a response from Aiven for a single organization.
OrganizationInfo struct {
APIResponse
// ID is the unique identifier of the organization.
ID string `json:"organization_id"`
// Name is the name of the organization.
Name string `json:"organization_name"`
// AccountID is the unique identifier of the account.
AccountID string `json:"account_id"`
// CreateTime is the time when the organization was created.
CreateTime string `json:"create_time"`
// UpdateTime is the time when the organization was last updated.
UpdateTime string `json:"update_time"`
}
)
// Get returns information about the specified organization.
func (h *OrganizationHandler) Get(id string) (*OrganizationInfo, error) {
path := buildPath("organization", id)
bts, err := h.client.doGetRequest(path, nil)
if err != nil {
return nil, err
}
var r OrganizationInfo
return &r, checkAPIResponse(bts, &r)
}