Skip to content

Commit 8ed5f71

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(r2_bucket): add cors support (#2196)
1 parent 2de0fb0 commit 8ed5f71

File tree

9 files changed

+1029
-1
lines changed

9 files changed

+1029
-1
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 1448
1+
configured_endpoints: 1451
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-4acaaed718bd08d16e3866d5ad032fbf2bbfeb978df2cf5164edb81fe41e4f89.yml

api.md

+14
Original file line numberDiff line numberDiff line change
@@ -4586,6 +4586,20 @@ Methods:
45864586
- <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>
45874587
- <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>
45884588

4589+
### CORS
4590+
4591+
Types:
4592+
4593+
```python
4594+
from cloudflare.types.r2.buckets import CORSUpdateResponse, CORSDeleteResponse, CORSGetResponse
4595+
```
4596+
4597+
Methods:
4598+
4599+
- <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>
4600+
- <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>
4601+
- <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>
4602+
45894603
### Domains
45904604

45914605
#### Custom

src/cloudflare/resources/r2/buckets/__init__.py

+14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
from .cors import (
4+
CORSResource,
5+
AsyncCORSResource,
6+
CORSResourceWithRawResponse,
7+
AsyncCORSResourceWithRawResponse,
8+
CORSResourceWithStreamingResponse,
9+
AsyncCORSResourceWithStreamingResponse,
10+
)
311
from .sippy import (
412
SippyResource,
513
AsyncSippyResource,
@@ -48,6 +56,12 @@
4856
"AsyncLifecycleResourceWithRawResponse",
4957
"LifecycleResourceWithStreamingResponse",
5058
"AsyncLifecycleResourceWithStreamingResponse",
59+
"CORSResource",
60+
"AsyncCORSResource",
61+
"CORSResourceWithRawResponse",
62+
"AsyncCORSResourceWithRawResponse",
63+
"CORSResourceWithStreamingResponse",
64+
"AsyncCORSResourceWithStreamingResponse",
5165
"DomainsResource",
5266
"AsyncDomainsResource",
5367
"DomainsResourceWithRawResponse",

src/cloudflare/resources/r2/buckets/buckets.py

+32
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77

88
import httpx
99

10+
from .cors import (
11+
CORSResource,
12+
AsyncCORSResource,
13+
CORSResourceWithRawResponse,
14+
AsyncCORSResourceWithRawResponse,
15+
CORSResourceWithStreamingResponse,
16+
AsyncCORSResourceWithStreamingResponse,
17+
)
1018
from .sippy import (
1119
SippyResource,
1220
AsyncSippyResource,
@@ -70,6 +78,10 @@ class BucketsResource(SyncAPIResource):
7078
def lifecycle(self) -> LifecycleResource:
7179
return LifecycleResource(self._client)
7280

81+
@cached_property
82+
def cors(self) -> CORSResource:
83+
return CORSResource(self._client)
84+
7385
@cached_property
7486
def domains(self) -> DomainsResource:
7587
return DomainsResource(self._client)
@@ -357,6 +369,10 @@ class AsyncBucketsResource(AsyncAPIResource):
357369
def lifecycle(self) -> AsyncLifecycleResource:
358370
return AsyncLifecycleResource(self._client)
359371

372+
@cached_property
373+
def cors(self) -> AsyncCORSResource:
374+
return AsyncCORSResource(self._client)
375+
360376
@cached_property
361377
def domains(self) -> AsyncDomainsResource:
362378
return AsyncDomainsResource(self._client)
@@ -660,6 +676,10 @@ def __init__(self, buckets: BucketsResource) -> None:
660676
def lifecycle(self) -> LifecycleResourceWithRawResponse:
661677
return LifecycleResourceWithRawResponse(self._buckets.lifecycle)
662678

679+
@cached_property
680+
def cors(self) -> CORSResourceWithRawResponse:
681+
return CORSResourceWithRawResponse(self._buckets.cors)
682+
663683
@cached_property
664684
def domains(self) -> DomainsResourceWithRawResponse:
665685
return DomainsResourceWithRawResponse(self._buckets.domains)
@@ -694,6 +714,10 @@ def __init__(self, buckets: AsyncBucketsResource) -> None:
694714
def lifecycle(self) -> AsyncLifecycleResourceWithRawResponse:
695715
return AsyncLifecycleResourceWithRawResponse(self._buckets.lifecycle)
696716

717+
@cached_property
718+
def cors(self) -> AsyncCORSResourceWithRawResponse:
719+
return AsyncCORSResourceWithRawResponse(self._buckets.cors)
720+
697721
@cached_property
698722
def domains(self) -> AsyncDomainsResourceWithRawResponse:
699723
return AsyncDomainsResourceWithRawResponse(self._buckets.domains)
@@ -728,6 +752,10 @@ def __init__(self, buckets: BucketsResource) -> None:
728752
def lifecycle(self) -> LifecycleResourceWithStreamingResponse:
729753
return LifecycleResourceWithStreamingResponse(self._buckets.lifecycle)
730754

755+
@cached_property
756+
def cors(self) -> CORSResourceWithStreamingResponse:
757+
return CORSResourceWithStreamingResponse(self._buckets.cors)
758+
731759
@cached_property
732760
def domains(self) -> DomainsResourceWithStreamingResponse:
733761
return DomainsResourceWithStreamingResponse(self._buckets.domains)
@@ -762,6 +790,10 @@ def __init__(self, buckets: AsyncBucketsResource) -> None:
762790
def lifecycle(self) -> AsyncLifecycleResourceWithStreamingResponse:
763791
return AsyncLifecycleResourceWithStreamingResponse(self._buckets.lifecycle)
764792

793+
@cached_property
794+
def cors(self) -> AsyncCORSResourceWithStreamingResponse:
795+
return AsyncCORSResourceWithStreamingResponse(self._buckets.cors)
796+
765797
@cached_property
766798
def domains(self) -> AsyncDomainsResourceWithStreamingResponse:
767799
return AsyncDomainsResourceWithStreamingResponse(self._buckets.domains)

0 commit comments

Comments
 (0)