Skip to content

Commit

Permalink
add force to put credentials (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelmaliy authored Jun 26, 2021
1 parent 850e962 commit be01a7e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/sm/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,17 @@ func (c *ServiceManagerClient) PutCredentials(ctx context.Context, credentials *
return nil, err
}

req, err := http.NewRequest(http.MethodPut, c.getURL(web.BrokerPlatformCredentialsURL), bytes.NewBuffer(body))
reqURL := c.getURL(web.BrokerPlatformCredentialsURL)
if force {
log.C(ctx).Debugf("forcing credential rotation")
reqURL += "?force=true"
}
req, err := http.NewRequest(http.MethodPut, reqURL, bytes.NewBuffer(body))
if err != nil {
return nil, err
}

req.Header.Add("Content-Type", "application/json")
if force {
values := req.URL.Query()
values.Set("force", "true")
req.URL.RawQuery = values.Encode()
}

response, err := c.httpClient.Do(req)
if err != nil {
Expand Down

0 comments on commit be01a7e

Please sign in to comment.