Open z0mb1ek opened 4 years ago
Hi Dmitry --
Sorry for the delay in responding. I was backpacking last week.
I see that I have the following comment in B2UpdateBucketRequest.Builder:
// XXX: should i let people opt-out of using ifRevisionIs? let's see if anyone needs it!
Congrats on being the first person to ask about it. :)
Can you tell us more about your use case? What are you changing about a bucket that you don't already have a bucket object from the service to start from? Or is it just that you don't want ifRevisionIs to be set? Or...?
thanks, ab
Hi. I want programmaticaly change cors for example on bucket
The intention is that you fetch the current version of the bucket and use that as input to the request. It sounds like maybe you don't have the current version of the bucket to start with?
On Wed, Sep 9, 2020 at 3:01 PM Dmitry Fedorov notifications@github.com wrote:
Hi. I want programmaticaly change cors for example on bucket
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Backblaze/b2-sdk-java/issues/125#issuecomment-689620820, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHJFCX3LJVJZZZEAQOBE3LSE6KEDANCNFSM4QPP7MWQ .
Yes, i don't have version, I want just +1
So today your code calls new B2Bucket(....) from scratch and then passes that to B2UpdateBucketRequest.builder()?
On Wed, Sep 9, 2020 at 3:08 PM Dmitry Fedorov notifications@github.com wrote:
Yes, i don't have version, I want just +1
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Backblaze/b2-sdk-java/issues/125#issuecomment-689625508, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHJFCSCOHNHUUTJ5GTU4EDSE6K7TANCNFSM4QPP7MWQ .
No, I have a created bucket. And than I want just update it
I'm still trying to understand the core of the issue you're having. Does either of these work for you?
Is it a bucket you have just created? If so, do you know you want the CORS rules at the time you've created it? Could you just set them then? Something like this: final B2Bucket newBucket = client.createBucket(B2CreateBucketRequest.builder(name, type).setCorsRules(...).build())
Usually people would just do something like this: final B2Bucket bucket = ...; client.updateBucket(B2UpdateBucketRequest.builder(bucket).setCorsRules(...).build())
Do you have a B2Bucket object for the previously created bucket, or just the accountId and bucketId? (The B2Bucket object in the SDK isn't currently intended to be created by SDK clients -- that's why there's no Builder class for it.)
thanks, ab
I have just the accountId and bucketId
As mentioned in the documentation, the ifRevisionIs parameter is used to detect conflicting updates to a bucket. It sounds like you don't care about that and that you want to make the change unconditionally.
I would propose adding this to B2UpdateBucketRequest.Builder:
private Builder(String accountId, String bucketId) { this. accountId = accountId; this.bucketId = bucketId; }
and adding this to B2UpdateBucketRequest:
public static Builder builder(String accountId, String bucketId) { return new Builder(accountId, bucketId); }
and updating the comment at the start of the Builder class.
And then you'll be able to create the request directly without specifying a version and without having to make a dummy bucket object.
How does that sound? Are you willing to make a PR?
thanks, ab
On Wed, Sep 9, 2020 at 3:44 PM Dmitry Fedorov notifications@github.com wrote:
I have just the accountId and bucketId
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Backblaze/b2-sdk-java/issues/125#issuecomment-689648059, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHJFCTC6J3T6BOZ4GRWTZ3SE6PHFANCNFSM4QPP7MWQ .
Hi. We need B2Bucket to construct B2UpdateBucketRequest, but in B2Bucket revision is not optional field
@B2Json.required private final int revision;