Skip to content

Commit 5320df9

Browse files
authored
chore(events): change event interface
1 parent cf49cbc commit 5320df9

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

events/events.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
// List events of an app process.
1313
func ListPodEvents(c *drycc.Client, appID string, podName string, results int) (api.AppEvents, int, error) {
14-
u := fmt.Sprintf("/v2/apps/%s/pods/%s/events/", appID, podName)
14+
u := fmt.Sprintf("/v2/apps/%s/events/?pod_name=%s", appID, podName)
1515
body, count, reqErr := c.LimitedRequest(u, results)
1616
if reqErr != nil && !drycc.IsErrAPIMismatch(reqErr) {
1717
return []api.AppEvent{}, -1, reqErr
@@ -27,7 +27,7 @@ func ListPodEvents(c *drycc.Client, appID string, podName string, results int) (
2727

2828
// List events of an app ptype.
2929
func ListPtypeEvents(c *drycc.Client, appID string, ptype string, results int) (api.AppEvents, int, error) {
30-
u := fmt.Sprintf("/v2/apps/%s/ptypes/%s-%s/events/", appID, appID, ptype)
30+
u := fmt.Sprintf("/v2/apps/%s/events/?ptype_name=%s-%s", appID, appID, ptype)
3131
body, count, reqErr := c.LimitedRequest(u, results)
3232
if reqErr != nil && !drycc.IsErrAPIMismatch(reqErr) {
3333
return []api.AppEvent{}, -1, reqErr

events/events_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ type fakeHTTPServer struct{}
4444

4545
func (fakeHTTPServer) ServeHTTP(res http.ResponseWriter, req *http.Request) {
4646
res.Header().Add("DRYCC_API_VERSION", drycc.APIVersion)
47-
if req.URL.Path == "/v2/apps/example-go/ptypes/example-go-web/events/" && req.Method == "GET" {
47+
if req.URL.Path == "/v2/apps/example-go/events/" && req.Method == "GET" && req.URL.RawQuery == "ptype_name=example-go-web" {
4848
res.Write([]byte(ptypeEventsFixture))
4949
return
5050
}
51-
if req.URL.Path == "/v2/apps/example-go/pods/example-go-web-6b44dbd6c8-h89cg/events/" && req.Method == "GET" {
51+
if req.URL.Path == "/v2/apps/example-go/events/" && req.Method == "GET" && req.URL.RawQuery == "pod_name=example-go-web-6b44dbd6c8-h89cg" {
5252
res.Write([]byte(podEventsFixture))
5353
return
5454
}

0 commit comments

Comments
 (0)