Skip to content

Fix #26: Implement application keys#27

Merged
certainmagic merged 14 commits intomasterfrom
application_keys
May 4, 2018
Merged

Fix #26: Implement application keys#27
certainmagic merged 14 commits intomasterfrom
application_keys

Conversation

@bwbeach
Copy link
Contributor

@bwbeach bwbeach commented Mar 30, 2018

No description provided.

bwbeach added 8 commits March 27, 2018 10:32
Testing:
- unit tests
Testing:
- unit tests
This avoids overloading B2ApplicationKey.

Testing:
- unit tests
Testing:
- unit tests
Add example to B2Sample.

Testing:
- ran B2Sample against staging
Testing:
- unit tests
- B2Sample (staging)
Testing:
- unit tests
- B2Sample (staging)
Copy link
Contributor

@certainmagic certainmagic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the change, BrianB.
i've made a few minor nitpicks.

i think there are two things we should discuss:

  • the compatibility implications of using an enum for the Capabilities.

  • when to merge this PR. generally, i wait until the features are supported by the server before putting the changes into master.

we can chat outside the review system. :)

import java.util.Iterator;

/**
* This interface collects the APIs we provide on our B2FileVersion iterables.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"B2FileVersion"? :)

import java.util.TreeSet;

/**
* Response from b2_create_key and b2_delete_key. Included in response from b2_list_keys.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Response from b2_create_key". i think that comment is a little out-of-date. I think you're returning a B2CreatedApplicationKey from b2_create_key now. :)

import java.util.HashMap;
import java.util.Map;

public enum B2Capability {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm a big fan of having strong typing when we can and enums are better for that than strings. With that said...please read the "DESIGN NOTE" comment about compatibility in B2BucketTypes.java and then let's talk. :)

private final String bucketId;
private final String namePrefix;

private B2CreateKeyRequest(Set<B2Capability> capabilies,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"capabilies" :)

import java.util.Objects;
import java.util.TreeSet;

public class B2CreatedApplicationKey {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe comment that this is what's returned from b2_create_key and that it differs from the other version in that it has the secret (like your nice comment below for toApplicationKey()).


bigHeader(writer, "delete application key");
{
client.deleteKey(B2DeleteKeyRequest.builder(applicationKeyId).build());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're welcome to add a convenience "deleteKey(String appKeyId)" method to the storage client interface which would create the request and call the real method in the interface.

@bwbeach
Copy link
Contributor Author

bwbeach commented Mar 30, 2018 via email

@certainmagic
Copy link
Contributor

certainmagic commented Mar 30, 2018 via email

bwbeach and others added 6 commits March 30, 2018 09:41
This is everything except converting the B2Capability enum to string constants.
This is for compatibility with future extensions.

Testing:
- unit tests
- B2Sample (staging)
.. and IDEA had the comment collapsed so it wasn't visible.  :-(
it was missing the "In".

i also fixed a similarish misspelling in a local variable for get_download_authorization.
i also added a call to setup the clock as a simulator in a test.  without that change the
clock was being created as a real clock, not a simulator by that test and it was messing
up other tests that expected it to be a clock simulator.  (there could be more of these,
but this is the one i found.)

built & tested with "./gradlew build javadoc writeNewPom".

i also ran the sample.  as expected, it failed because the servers are
currently expecting the misspelling.  i commented that section of the sample
out and everything else succeeded.
Keep branch up-to-date, so this PR is ready when the
app keys feature goes live.
@certainmagic
Copy link
Contributor

I'm going to merge this to master even though the API isn't fully supported in the service yet. I'll add a note to the README.

@certainmagic certainmagic reopened this May 4, 2018
@certainmagic certainmagic merged commit 791c4fb into master May 4, 2018
@bwbeach bwbeach deleted the application_keys branch July 12, 2018 23:40
ericjding added a commit that referenced this pull request May 10, 2021
* add B2StoreLargeFileRequest class

* add SSE capability to large file uploads

* clean up IntelliJ IDEA warnings

Co-authored-by: Eric Ding <eding@backblaze.com>
fmbz added a commit that referenced this pull request Aug 24, 2022
This PR adds fileLockEnabled parameter to B2UpdateBucketRequest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants