-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add create & delete commands for R2 event notifications (#5294)
* Add command for adding event notification configs * Add command for deleting event-notification cfgs * Add changeset for event notification commands * Expose event-types instead of actions. For beta of this feature, we'll only expose the categories of actions we want to support. * Add test coverage for eventNotificationHeaders fn * Simplify eventNotificationHeaders unit test Co-authored-by: Pete Bacon Darwin <[email protected]> * Fix typo in argument description * Update event notif. request body EWC no longer supports including `bucketName` and `queue` in the request body, since these values are already present in the URL. --------- Co-authored-by: Pete Bacon Darwin <[email protected]>
- Loading branch information
1 parent
a9b8f4a
commit bdc121d
Showing
5 changed files
with
400 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"wrangler": minor | ||
--- | ||
|
||
Add `event-notification` commands in support of event notifications for Cloudflare R2. | ||
|
||
Included are commands for creating and deleting event notification configurations for individual buckets. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { eventNotificationHeaders } from "../../r2/helpers"; | ||
import type { ApiCredentials } from "../../user"; | ||
|
||
describe("event notifications", () => { | ||
test("auth email eventNotificationHeaders", () => { | ||
const creds: ApiCredentials = { | ||
authEmail: "[email protected]", | ||
authKey: "some-big-secret", | ||
}; | ||
const result = eventNotificationHeaders(creds); | ||
expect(result).toMatchObject({ | ||
"X-Auth-Key": creds.authKey, | ||
"X-Auth-Email": creds.authEmail, | ||
}); | ||
}); | ||
|
||
test("API token eventNotificationHeaders", () => { | ||
const creds: ApiCredentials = { apiToken: "some-api-token" }; | ||
const result = eventNotificationHeaders(creds); | ||
expect(result).toMatchObject({ | ||
Authorization: `Bearer ${creds.apiToken}`, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.