github.com/wtfutil/wtf@v0.43.0/modules/newrelic/client/application_deployments.go (about) 1 package newrelic 2 3 import ( 4 "strconv" 5 "time" 6 ) 7 8 // ApplicationDeploymentLinks represents links that apply to an 9 // ApplicationDeployment. 10 type ApplicationDeploymentLinks struct { 11 Application int `json:"application,omitempty"` 12 } 13 14 // ApplicationDeploymentOptions provide a means to filter when calling 15 // GetApplicationDeployments. 16 type ApplicationDeploymentOptions struct { 17 Page int 18 } 19 20 // ApplicationDeployment contains information about a New Relic Application 21 // Deployment. 22 type ApplicationDeployment struct { 23 ID int `json:"id,omitempty"` 24 Revision string `json:"revision,omitempty"` 25 Changelog string `json:"changelog,omitempty"` 26 Description string `json:"description,omitempty"` 27 User string `json:"user,omitempty"` 28 Timestamp time.Time `json:"timestamp,omitempty"` 29 Links ApplicationDeploymentLinks `json:"links,omitempty"` 30 } 31 32 // GetApplicationDeployments returns a slice of New Relic Application 33 // Deployments. 34 func (c *Client) GetApplicationDeployments(id int, opt *ApplicationDeploymentOptions) ([]ApplicationDeployment, error) { 35 resp := &struct { 36 Deployments []ApplicationDeployment `json:"deployments,omitempty"` 37 }{} 38 path := "applications/" + strconv.Itoa(id) + "/deployments.json" 39 err := c.doGet(path, opt, resp) 40 if err != nil { 41 return nil, err 42 } 43 return resp.Deployments, nil 44 } 45 46 func (o *ApplicationDeploymentOptions) String() string { 47 if o == nil { 48 return "" 49 } 50 return encodeGetParams(map[string]interface{}{ 51 "page": o.Page, 52 }) 53 }