Skip to content

Commit 5619c66

Browse files
authored
Merge pull request #505 from jcvrabo/add-clear-app-buildpack-cache
implement clear buildpack cache per app
2 parents af4d947 + 8c04dd4 commit 5619c66

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

client/app.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,3 +304,8 @@ func (c *AppClient) SSHEnabled(ctx context.Context, guid string) (*resource.AppS
304304
}
305305
return &appSSH, nil
306306
}
307+
308+
// ClearBuildpackCache clears the buildpack cache for a specific application.
309+
func (c *AppClient) ClearBuildpackCache(ctx context.Context, guid string) (string, error) {
310+
return c.client.post(ctx, path.Format("/v3/apps/%s/actions/clear_buildpack_cache", guid), nil, nil)
311+
}

client/app_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,19 @@ func TestApps(t *testing.T) {
298298
return c.Applications.Restart(context.Background(), "1cb006ee-fb05-47e1-b541-c34179ddc446")
299299
},
300300
},
301+
{
302+
Description: "Clear app buildpack cache",
303+
Route: testutil.MockRoute{
304+
Method: "POST",
305+
Endpoint: "/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/actions/clear_buildpack_cache",
306+
Status: http.StatusAccepted,
307+
RedirectLocation: "https://api.example.org/api/v3/jobs/c33a5caf-77e0-4d6e-b587-5555d339bc9a",
308+
},
309+
Expected: "c33a5caf-77e0-4d6e-b587-5555d339bc9a",
310+
Action: func(c *Client, t *testing.T) (any, error) {
311+
return c.Applications.ClearBuildpackCache(context.Background(), "1cb006ee-fb05-47e1-b541-c34179ddc446")
312+
},
313+
},
301314
{
302315
Description: "Update app",
303316
Route: testutil.MockRoute{

0 commit comments

Comments
 (0)