-
Notifications
You must be signed in to change notification settings - Fork 0
/
application_deployments.go
53 lines (47 loc) · 1.58 KB
/
application_deployments.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
package newrelic
import (
"strconv"
"time"
)
// ApplicationDeploymentLinks represents links that apply to an
// ApplicationDeployment.
type ApplicationDeploymentLinks struct {
Application int `json:"application,omitempty"`
}
// ApplicationDeploymentOptions provide a means to filter when calling
// GetApplicationDeployments.
type ApplicationDeploymentOptions struct {
Page int
}
// ApplicationDeployment contains information about a New Relic Application
// Deployment.
type ApplicationDeployment struct {
ID int `json:"id,omitempty"`
Revision string `json:"revision,omitempty"`
Changelog string `json:"changelog,omitempty"`
Description string `json:"description,omitempty"`
User string `json:"user,omitemtpy"`
Timestamp time.Time `json:"timestamp,omitempty"`
Links ApplicationDeploymentLinks `json:"links,omitempty"`
}
// GetApplicationDeployments returns a slice of New Relic Application
// Deployments.
func (c *Client) GetApplicationDeployments(id int, opt *ApplicationDeploymentOptions) ([]ApplicationDeployment, error) {
resp := &struct {
Deployments []ApplicationDeployment `json:"deployments,omitempty"`
}{}
path := "applications/" + strconv.Itoa(id) + "/deployments.json"
err := c.doGet(path, opt, resp)
if err != nil {
return nil, err
}
return resp.Deployments, nil
}
func (o *ApplicationDeploymentOptions) String() string {
if o == nil {
return ""
}
return encodeGetParams(map[string]interface{}{
"page": o.Page,
})
}