Skip to content
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 support for listing R2 buckets #1050

Closed
wants to merge 57 commits into from

Conversation

rgcostea
Copy link
Contributor

Description

Added the ability to list R2 buckets. A recent change (#1028) added support for creating and deleting R2 buckets but was missing the ability to list R2 buckets. This change adds support for listing R2 buckets.

Has your change been tested?

Enhanced r2_bucket_test.go with an additional test (TestR2_ListBuckets) to list R2 buckets. Also verified this against an active cloudflare account.

Types of changes

What sort of change does your code introduce/modify?

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • This change is using publicly documented (api.cloudflare.com or developers.cloudflare.com) and stable APIs.

Notes

I could not find the repo for the api definition at api.cloudflare.com in order to update the documentation myself. I'm happy to do that if someone can give me a pointer to it. Also, how does this API path become a publicly documented and stable API? Thanks.

Cyb3r-Jak3 and others added 5 commits August 10, 2022 22:51
Provide the ability to create the `RequestError`, etc types in other packages with the underlying
Error type. Useful in our code for mocking these error types.

Add the `InternalErrorCodeIs` to these errors as well to simplify checking the internal codes when
working with these types.
@github-actions
Copy link
Contributor

github-actions bot commented Aug 17, 2022

changelog detected ✅

@jacobbednarz
Copy link
Member

I could not find the repo for the api definition at api.cloudflare.com in order to update the documentation myself.

Also, how does this API path become a publicly documented and stable API?

once the API is stable, the service team document it and it ends up on api.cloudflare.com

@sodabrew
Copy link
Contributor

@jacobbednarz harping on this again. The API endpoints are "documented" right here in code: https://github.com/cloudflare/wrangler2/blob/main/packages/wrangler/src/r2.ts#L14-L24

Why are there ongoing delays between making an API endpoint public in code and making the documentation public? The blog proudly exclaims that you're going to stop doing that: https://blog.cloudflare.com/content-as-a-product/

Aligning content to the product development process means that when a new product is shipping, we have developer documentation ready to publish.

@jacobbednarz
Copy link
Member

@sodabrew this is your first and only warning that your comment is disrespectful and unacceptable. I highly recommend reviewing the project's code of conduct as violations can result in temporary or permanent exclusion from the project.

The wrangler2 codebase (and other tools released by the service teams) is not public documentation and is not suitable for determining an API contract for the SDKs. The team is usually controlling both sides (tool and API) so they can make sweeping changes without breaking integrations; that cannot be the same for the SDKs since we have customers relying on certain behaviours.

@sodabrew
Copy link
Contributor

I'm sorry, thank you, getting on the wrong side certainly does me no good towards sharing a goal of using a great product.

The wrangler2 codebase (and other tools released by the service teams) is not public documentation and is not suitable for determining an API contract for the SDKs. The team is usually controlling both sides (tool and API) so they can make sweeping changes without breaking integrations; that cannot be the same for the SDKs since we have customers relying on certain behaviours.

This is succinctly describing the situation. I appreciate being on the same page. I want to share that this is exactly my concern as a customer: if I build deployment tooling around wrangler2 and it changes suddenly with a coordinated release and API change, deployment workflows can be broken until an update is performed.

@jacobbednarz
Copy link
Member

i'm in the process of adding a document outlining the endpoint support policy since it's a fairly common question (both internally and externally). hopefully that will clarify things a bit for reference.

jacobbednarz and others added 28 commits August 22, 2022 09:27
This commit does two things:

1) Moves all tooling related dependencies and functionality into `internal/` to
mark the code as not intended to be used outside of the package (which I found
forks doing 🤦)
2) Reduces the dependency footprint for library-only use.

Fixes cloudflare#1057
Fixes cloudflare#1025
Co-authored-by: Jacob Bednarz <[email protected]>
@rgcostea rgcostea closed this Aug 26, 2022
@rgcostea rgcostea deleted the rgcostea/r2-list-buckets branch August 26, 2022 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants