Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: examples of creating a signed url for a blob with generation #140

Merged
merged 2 commits into from Feb 26, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -779,6 +779,13 @@ public WriteChannel writer(BlobWriteOption... options) {
* ServiceAccountCredentials.fromStream(new FileInputStream(keyPath))));
* }</pre>
*
* <p>Example of creating a signed URL for a blob generation.
dmitry-fa marked this conversation as resolved.
Show resolved Hide resolved
*
* <pre>{@code
* URL signedUrl = blob.signUrl(1, TimeUnit.HOURS,
* SignUrlOption.withQueryParams(ImmutableMap.of("generation", "1576656755290328")));
* }</pre>
*
* @param duration time until the signed URL expires, expressed in {@code unit}. The finer
* granularity supported is 1 second, finer granularities will be truncated
* @param unit time unit of the {@code duration} parameter
Expand Down
Expand Up @@ -2498,6 +2498,19 @@ Blob create(
* <p>Note that the {@link ServiceAccountSigner} may require additional configuration to enable
* URL signing. See the documentation for the implementation for more details.
*
* <p>Example of creating a signed URL for a blob with generation.
dmitry-fa marked this conversation as resolved.
Show resolved Hide resolved
*
* <pre>{@code
* String bucketName = "my-unique-bucket";
* String blobName = "my-blob-name";
* long generation = 1576656755290328L;
*
* URL signedUrl = storage.signUrl(
* BlobInfo.newBuilder(bucketName, blobName, generation).build(),
* 7, TimeUnit.DAYS,
* SignUrlOption.withQueryParams(ImmutableMap.of("generation", String.valueOf(generation))));
* }</pre>
*
* @param blobInfo the blob associated with the signed URL
* @param duration time until the signed URL expires, expressed in {@code unit}. The finest
* granularity supported is 1 second, finer granularities will be truncated
Expand Down