Skip to content

Commit

Permalink
Merge pull request #322 from PagerDuty/missing_context
Browse files Browse the repository at this point in the history
Add missing context.Context support and propagation
  • Loading branch information
Scott McAllister authored Apr 21, 2021
2 parents 4c4849d + ae19224 commit c3b74f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion service_dependency.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (c *Client) AssociateServiceDependenciesWithContext(ctx context.Context, de
}

func (c *Client) associateServiceDependenciesWithContext(ctx context.Context, dependencies *ListServiceDependencies) (*ListServiceDependencies, *http.Response, error) {
resp, err := c.post(context.TODO(), "/service_dependencies/associate", dependencies, nil)
resp, err := c.post(ctx, "/service_dependencies/associate", dependencies, nil)
if err != nil {
return nil, nil, err
}
Expand Down
10 changes: 8 additions & 2 deletions tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,15 @@ func (c *Client) GetTagWithContext(ctx context.Context, id string) (*Tag, *http.
return getTagFromResponse(c, resp, err)
}

// AssignTags adds and removes tag assignments with entities
// AssignTags adds and removes tag assignments with entities. It's recommended
// to use AssignTagsWithContext instead.
func (c *Client) AssignTags(e, eid string, a *TagAssignments) (*http.Response, error) {
resp, err := c.post(context.TODO(), "/"+e+"/"+eid+"/change_tags", a, nil)
return c.AssignTagsWithContext(context.Background(), e, eid, a)
}

// AssignTagsWithContext adds and removes tag assignments with entities.
func (c *Client) AssignTagsWithContext(ctx context.Context, e, eid string, a *TagAssignments) (*http.Response, error) {
resp, err := c.post(ctx, "/"+e+"/"+eid+"/change_tags", a, nil)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit c3b74f5

Please sign in to comment.