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 (#3772)
  • Loading branch information
stainless-app[bot] authored Jan 3, 2025
1 parent e5b0260 commit 64dd81f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 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
6 changes: 3 additions & 3 deletions r2/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ func NewBucketService(opts ...option.RequestOption) (r *BucketService) {
// Creates a new R2 bucket.
func (r *BucketService) New(ctx context.Context, params BucketNewParams, opts ...option.RequestOption) (res *Bucket, err error) {
var env BucketNewResponseEnvelope
if params.CfR2Jurisdiction.Present {
opts = append(opts, option.WithHeader("cf-r2-jurisdiction", fmt.Sprintf("%s", params.CfR2Jurisdiction)))
if params.Jurisdiction.Present {
opts = append(opts, option.WithHeader("jurisdiction", fmt.Sprintf("%s", params.Jurisdiction)))
}
opts = append(r.Options[:], opts...)
if params.AccountID.Value == "" {
Expand Down Expand Up @@ -233,7 +233,7 @@ type BucketNewParams struct {
// Storage class for newly uploaded objects, unless specified otherwise.
StorageClass param.Field[BucketNewParamsStorageClass] `json:"storageClass"`
// Creates the bucket in the provided jurisdiction
CfR2Jurisdiction param.Field[BucketNewParamsCfR2Jurisdiction] `header:"cf-r2-jurisdiction"`
Jurisdiction param.Field[BucketNewParamsCfR2Jurisdiction] `header:"cf-r2-jurisdiction"`
}

func (r BucketNewParams) MarshalJSON() (data []byte, err error) {
Expand Down
10 changes: 5 additions & 5 deletions r2/bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ func TestBucketNewWithOptionalParams(t *testing.T) {
option.WithAPIEmail("[email protected]"),
)
_, err := client.R2.Buckets.New(context.TODO(), r2.BucketNewParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Name: cloudflare.F("example-bucket"),
LocationHint: cloudflare.F(r2.BucketNewParamsLocationHintApac),
StorageClass: cloudflare.F(r2.BucketNewParamsStorageClassStandard),
CfR2Jurisdiction: cloudflare.F(r2.BucketNewParamsCfR2JurisdictionDefault),
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Name: cloudflare.F("example-bucket"),
LocationHint: cloudflare.F(r2.BucketNewParamsLocationHintApac),
StorageClass: cloudflare.F(r2.BucketNewParamsStorageClassStandard),
Jurisdiction: cloudflare.F(r2.BucketNewParamsCfR2JurisdictionDefault),
})
if err != nil {
var apierr *cloudflare.Error
Expand Down

0 comments on commit 64dd81f

Please sign in to comment.