File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed
google-cloud-storage/src/main/java/com/google/cloud/storage Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -764,21 +764,28 @@ public WriteChannel writer(BlobWriteOption... options) {
764
764
* </ol>
765
765
*
766
766
* <p>Example of creating a signed URL for the blob that is valid for 2 weeks, using the default
767
- * credentials for signing the URL.
767
+ * credentials for signing the URL:
768
768
*
769
769
* <pre>{@code
770
770
* URL signedUrl = blob.signUrl(14, TimeUnit.DAYS);
771
771
* }</pre>
772
772
*
773
773
* <p>Example of creating a signed URL for the blob passing the {@link
774
- * SignUrlOption#signWith(ServiceAccountSigner)} option, that will be used to sign the URL.
774
+ * SignUrlOption#signWith(ServiceAccountSigner)} option, that will be used to sign the URL:
775
775
*
776
776
* <pre>{@code
777
777
* String keyPath = "/path/to/key.json";
778
778
* URL signedUrl = blob.signUrl(14, TimeUnit.DAYS, SignUrlOption.signWith(
779
779
* ServiceAccountCredentials.fromStream(new FileInputStream(keyPath))));
780
780
* }</pre>
781
781
*
782
+ * <p>Example of creating a signed URL for a blob generation:
783
+ *
784
+ * <pre>{@code
785
+ * URL signedUrl = blob.signUrl(1, TimeUnit.HOURS,
786
+ * SignUrlOption.withQueryParams(ImmutableMap.of("generation", "1576656755290328")));
787
+ * }</pre>
788
+ *
782
789
* @param duration time until the signed URL expires, expressed in {@code unit}. The finer
783
790
* granularity supported is 1 second, finer granularities will be truncated
784
791
* @param unit time unit of the {@code duration} parameter
Original file line number Diff line number Diff line change @@ -2483,7 +2483,7 @@ Blob create(
2483
2483
* }</pre>
2484
2484
*
2485
2485
* <p>Example of creating a signed URL passing the {@link
2486
- * SignUrlOption#signWith(ServiceAccountSigner)} option, that will be used for signing the URL.
2486
+ * SignUrlOption#signWith(ServiceAccountSigner)} option, that will be used for signing the URL:
2487
2487
*
2488
2488
* <pre>{@code
2489
2489
* String bucketName = "my-unique-bucket";
@@ -2498,6 +2498,19 @@ Blob create(
2498
2498
* <p>Note that the {@link ServiceAccountSigner} may require additional configuration to enable
2499
2499
* URL signing. See the documentation for the implementation for more details.
2500
2500
*
2501
+ * <p>Example of creating a signed URL for a blob with generation:
2502
+ *
2503
+ * <pre>{@code
2504
+ * String bucketName = "my-unique-bucket";
2505
+ * String blobName = "my-blob-name";
2506
+ * long generation = 1576656755290328L;
2507
+ *
2508
+ * URL signedUrl = storage.signUrl(
2509
+ * BlobInfo.newBuilder(bucketName, blobName, generation).build(),
2510
+ * 7, TimeUnit.DAYS,
2511
+ * SignUrlOption.withQueryParams(ImmutableMap.of("generation", String.valueOf(generation))));
2512
+ * }</pre>
2513
+ *
2501
2514
* @param blobInfo the blob associated with the signed URL
2502
2515
* @param duration time until the signed URL expires, expressed in {@code unit}. The finest
2503
2516
* granularity supported is 1 second, finer granularities will be truncated
You can’t perform that action at this time.
0 commit comments