Skip to content

Commit

Permalink
feat(r2)!: rename cf-r2-jurisdiction to more usable jurisdiction
Browse files Browse the repository at this point in the history
…parameter (#2308)
  • Loading branch information
stainless-app[bot] committed Jan 3, 2025
1 parent 8edd6d6 commit 5dfdcbd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1490
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-f9dc65d353b377858f3d63d594de47559ed3a9d562295719690867315b8ec2fe.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-d7f8b3901624cc79465181c32dea2901c658e382a5ed3acada4692760b77f9c0.yml
16 changes: 6 additions & 10 deletions src/cloudflare/resources/r2/buckets/buckets.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def create(
name: str,
location_hint: Literal["apac", "eeur", "enam", "weur", "wnam"] | NotGiven = NOT_GIVEN,
storage_class: Literal["Standard", "InfrequentAccess"] | NotGiven = NOT_GIVEN,
cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN,
jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -138,7 +138,7 @@ def create(
storage_class: Storage class for newly uploaded objects, unless specified otherwise.
cf_r2_jurisdiction: Creates the bucket in the provided jurisdiction
jurisdiction: Creates the bucket in the provided jurisdiction
extra_headers: Send extra headers
Expand All @@ -151,9 +151,7 @@ def create(
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
extra_headers = {
**strip_not_given(
{"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN}
),
**strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}),
**(extra_headers or {}),
}
return self._post(
Expand Down Expand Up @@ -409,7 +407,7 @@ async def create(
name: str,
location_hint: Literal["apac", "eeur", "enam", "weur", "wnam"] | NotGiven = NOT_GIVEN,
storage_class: Literal["Standard", "InfrequentAccess"] | NotGiven = NOT_GIVEN,
cf_r2_jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN,
jurisdiction: Literal["default", "eu", "fedramp"] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -429,7 +427,7 @@ async def create(
storage_class: Storage class for newly uploaded objects, unless specified otherwise.
cf_r2_jurisdiction: Creates the bucket in the provided jurisdiction
jurisdiction: Creates the bucket in the provided jurisdiction
extra_headers: Send extra headers
Expand All @@ -442,9 +440,7 @@ async def create(
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
extra_headers = {
**strip_not_given(
{"cf-r2-jurisdiction": str(cf_r2_jurisdiction) if is_given(cf_r2_jurisdiction) else NOT_GIVEN}
),
**strip_not_given({"cf-r2-jurisdiction": str(jurisdiction) if is_given(jurisdiction) else NOT_GIVEN}),
**(extra_headers or {}),
}
return await self._post(
Expand Down
2 changes: 1 addition & 1 deletion src/cloudflare/types/r2/bucket_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ class BucketCreateParams(TypedDict, total=False):
storage_class: Annotated[Literal["Standard", "InfrequentAccess"], PropertyInfo(alias="storageClass")]
"""Storage class for newly uploaded objects, unless specified otherwise."""

cf_r2_jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")]
jurisdiction: Annotated[Literal["default", "eu", "fedramp"], PropertyInfo(alias="cf-r2-jurisdiction")]
"""Creates the bucket in the provided jurisdiction"""
4 changes: 2 additions & 2 deletions tests/api_resources/r2/test_buckets.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
name="example-bucket",
location_hint="apac",
storage_class="Standard",
cf_r2_jurisdiction="default",
jurisdiction="default",
)
assert_matches_type(Bucket, bucket, path=["response"])

Expand Down Expand Up @@ -277,7 +277,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare
name="example-bucket",
location_hint="apac",
storage_class="Standard",
cf_r2_jurisdiction="default",
jurisdiction="default",
)
assert_matches_type(Bucket, bucket, path=["response"])

Expand Down

0 comments on commit 5dfdcbd

Please sign in to comment.