-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add R2 basic support #85
base: main
Are you sure you want to change the base?
Conversation
I you kindly approve the workflow, I'll add more tests |
Let me know when you'd like me to review the code. Testing is a bit tricky but you have access to a "test" sandbox account. |
@@ -60,7 +60,7 @@ end | |||
|
|||
### Using a Bearer Token | |||
|
|||
You can read more about [bearer tokens here](https://blog.cloudflare.com/api-tokens-general-availability/). This allows you to limit priviledges. | |||
You can read more about [bearer tokens here](https://blog.cloudflare.com/api-tokens-general-availability/). This allows you to limit privileges. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :p
@ioquatix what do you mean with "you have access to a "test" sandbox account"? I guess i have to put my credentials as secrets in my fork for the tests to work? BTW, do you want me to add those examples in the readme too? |
I have put my credentials into GitHub secrets so that the tests run in a sandbox account. You don't need to do anything, but what I intended to communicate was that the CI will run against Cloudflare's APIs.
Sure, if you think it's a good idea then feel free to do it. |
I see what you mean, unfortunately PR from external forks do not have access to secrets in your repository (that's understandable for security reason). If you give me write permission to your repo, I'll upload the branch in your repo and will make the PR from there. Thanks |
I think the tests are running correctly but something is wrong with the code. The CI runs with my test credentials. Do we need something else on my account for the tests to pass? How are you testing this locally? |
I do exactly as the examples in the description. As I needed to automate the bucket/CORS creation I was testing in my real Cloudflare account. But not with the test suite, on my script. I was trying to avoid having to create a dummy cloudflare account. Here is the info about the secrets not shared with PR from forks: |
I've ended adding my own secrets in my repository. It's passing in my fork. I've added some tests. It's a little bit difficult due the lack of documentation of the test suite and the sometimes poor documentation of error from Cloudflare. In any case, the features added work. Maybe some of the services would benefit from mocking the requests (using the OpenAPI defintion) instead of directly making connections. BTW; for the bucket related tests, the test account needs to have the R2 service enabled. Thanks for the project, if you want to review this go ahead. |
Okay, that may be why it's not paying here, let me check the test account. |
@jacobbednarz I am pulling you into this discussion, here is a brief summary:
Are you able to help us with enabling these tests? Thanks. |
what is your cloudflare email address? (email me if you don't want to paste it here). i can add you to our acceptance test account and you can run these tests there. |
@jacobbednarz I set up a test account using the email address |
i've shot you an invite to an account that you can use. |
I've updated my test account to use the invite sent out, so in theory we have access to R2 now? I'll try kicking off the tests again. |
Okay, I also totally missed this: https://github.com/orgs/community/discussions/26242 lol so yes, you are correct, I'll have to rebase this into a local branch to test it. |
This PR adds support for some actions regarding the R2 api in Cloudflare.
Allows to:
Examples:
Listing available buckets:
Obtaining a specific bucket
Creating a bucket:
Attaching a domain to a bucket:
Creating a cors policy:
Obtaining the current CORS (the API throws an exception if there's none yet):
Types of Changes
Contribution