Skip to content

Commit

Permalink
feat(r2_bucket): add cors support (#2196)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Nov 21, 2024
1 parent 2de0fb0 commit 8ed5f71
Show file tree
Hide file tree
Showing 9 changed files with 1,029 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1448
configured_endpoints: 1451
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-4acaaed718bd08d16e3866d5ad032fbf2bbfeb978df2cf5164edb81fe41e4f89.yml
14 changes: 14 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4586,6 +4586,20 @@ Methods:
- <code title="put /accounts/{account_id}/r2/buckets/{bucket_name}/lifecycle">client.r2.buckets.lifecycle.<a href="./src/cloudflare/resources/r2/buckets/lifecycle.py">update</a>(bucket_name, \*, account_id, \*\*<a href="src/cloudflare/types/r2/buckets/lifecycle_update_params.py">params</a>) -> <a href="./src/cloudflare/types/r2/buckets/lifecycle_update_response.py">object</a></code>
- <code title="get /accounts/{account_id}/r2/buckets/{bucket_name}/lifecycle">client.r2.buckets.lifecycle.<a href="./src/cloudflare/resources/r2/buckets/lifecycle.py">get</a>(bucket_name, \*, account_id) -> <a href="./src/cloudflare/types/r2/buckets/lifecycle_get_response.py">LifecycleGetResponse</a></code>

### CORS

Types:

```python
from cloudflare.types.r2.buckets import CORSUpdateResponse, CORSDeleteResponse, CORSGetResponse
```

Methods:

- <code title="put /accounts/{account_id}/r2/buckets/{bucket_name}/cors">client.r2.buckets.cors.<a href="./src/cloudflare/resources/r2/buckets/cors.py">update</a>(bucket_name, \*, account_id, \*\*<a href="src/cloudflare/types/r2/buckets/cors_update_params.py">params</a>) -> <a href="./src/cloudflare/types/r2/buckets/cors_update_response.py">object</a></code>
- <code title="delete /accounts/{account_id}/r2/buckets/{bucket_name}/cors">client.r2.buckets.cors.<a href="./src/cloudflare/resources/r2/buckets/cors.py">delete</a>(bucket_name, \*, account_id) -> <a href="./src/cloudflare/types/r2/buckets/cors_delete_response.py">object</a></code>
- <code title="get /accounts/{account_id}/r2/buckets/{bucket_name}/cors">client.r2.buckets.cors.<a href="./src/cloudflare/resources/r2/buckets/cors.py">get</a>(bucket_name, \*, account_id) -> <a href="./src/cloudflare/types/r2/buckets/cors_get_response.py">CORSGetResponse</a></code>

### Domains

#### Custom
Expand Down
14 changes: 14 additions & 0 deletions src/cloudflare/resources/r2/buckets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .cors import (
CORSResource,
AsyncCORSResource,
CORSResourceWithRawResponse,
AsyncCORSResourceWithRawResponse,
CORSResourceWithStreamingResponse,
AsyncCORSResourceWithStreamingResponse,
)
from .sippy import (
SippyResource,
AsyncSippyResource,
Expand Down Expand Up @@ -48,6 +56,12 @@
"AsyncLifecycleResourceWithRawResponse",
"LifecycleResourceWithStreamingResponse",
"AsyncLifecycleResourceWithStreamingResponse",
"CORSResource",
"AsyncCORSResource",
"CORSResourceWithRawResponse",
"AsyncCORSResourceWithRawResponse",
"CORSResourceWithStreamingResponse",
"AsyncCORSResourceWithStreamingResponse",
"DomainsResource",
"AsyncDomainsResource",
"DomainsResourceWithRawResponse",
Expand Down
32 changes: 32 additions & 0 deletions src/cloudflare/resources/r2/buckets/buckets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@

import httpx

from .cors import (
CORSResource,
AsyncCORSResource,
CORSResourceWithRawResponse,
AsyncCORSResourceWithRawResponse,
CORSResourceWithStreamingResponse,
AsyncCORSResourceWithStreamingResponse,
)
from .sippy import (
SippyResource,
AsyncSippyResource,
Expand Down Expand Up @@ -70,6 +78,10 @@ class BucketsResource(SyncAPIResource):
def lifecycle(self) -> LifecycleResource:
return LifecycleResource(self._client)

@cached_property
def cors(self) -> CORSResource:
return CORSResource(self._client)

@cached_property
def domains(self) -> DomainsResource:
return DomainsResource(self._client)
Expand Down Expand Up @@ -357,6 +369,10 @@ class AsyncBucketsResource(AsyncAPIResource):
def lifecycle(self) -> AsyncLifecycleResource:
return AsyncLifecycleResource(self._client)

@cached_property
def cors(self) -> AsyncCORSResource:
return AsyncCORSResource(self._client)

@cached_property
def domains(self) -> AsyncDomainsResource:
return AsyncDomainsResource(self._client)
Expand Down Expand Up @@ -660,6 +676,10 @@ def __init__(self, buckets: BucketsResource) -> None:
def lifecycle(self) -> LifecycleResourceWithRawResponse:
return LifecycleResourceWithRawResponse(self._buckets.lifecycle)

@cached_property
def cors(self) -> CORSResourceWithRawResponse:
return CORSResourceWithRawResponse(self._buckets.cors)

@cached_property
def domains(self) -> DomainsResourceWithRawResponse:
return DomainsResourceWithRawResponse(self._buckets.domains)
Expand Down Expand Up @@ -694,6 +714,10 @@ def __init__(self, buckets: AsyncBucketsResource) -> None:
def lifecycle(self) -> AsyncLifecycleResourceWithRawResponse:
return AsyncLifecycleResourceWithRawResponse(self._buckets.lifecycle)

@cached_property
def cors(self) -> AsyncCORSResourceWithRawResponse:
return AsyncCORSResourceWithRawResponse(self._buckets.cors)

@cached_property
def domains(self) -> AsyncDomainsResourceWithRawResponse:
return AsyncDomainsResourceWithRawResponse(self._buckets.domains)
Expand Down Expand Up @@ -728,6 +752,10 @@ def __init__(self, buckets: BucketsResource) -> None:
def lifecycle(self) -> LifecycleResourceWithStreamingResponse:
return LifecycleResourceWithStreamingResponse(self._buckets.lifecycle)

@cached_property
def cors(self) -> CORSResourceWithStreamingResponse:
return CORSResourceWithStreamingResponse(self._buckets.cors)

@cached_property
def domains(self) -> DomainsResourceWithStreamingResponse:
return DomainsResourceWithStreamingResponse(self._buckets.domains)
Expand Down Expand Up @@ -762,6 +790,10 @@ def __init__(self, buckets: AsyncBucketsResource) -> None:
def lifecycle(self) -> AsyncLifecycleResourceWithStreamingResponse:
return AsyncLifecycleResourceWithStreamingResponse(self._buckets.lifecycle)

@cached_property
def cors(self) -> AsyncCORSResourceWithStreamingResponse:
return AsyncCORSResourceWithStreamingResponse(self._buckets.cors)

@cached_property
def domains(self) -> AsyncDomainsResourceWithStreamingResponse:
return AsyncDomainsResourceWithStreamingResponse(self._buckets.domains)
Expand Down
Loading

0 comments on commit 8ed5f71

Please sign in to comment.