Skip to content

Commit ddb1ade

Browse files
committed
Rephrase signUrl javadoc for better clarity
1 parent ac1ba66 commit ddb1ade

2 files changed

Lines changed: 23 additions & 14 deletions

File tree

gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -454,16 +454,21 @@ public WriteChannel writer(BlobWriteOption... options) {
454454
}
455455

456456
/**
457-
* Generates a signed URL for this blob. If you want to allow access to for a fixed amount of time
458-
* for this blob, you can use this method to generate a URL that is only valid within a certain
459-
* time period. This is particularly useful if you don't want publicly accessible blobs, but don't
460-
* want to require users to explicitly log in. Signing a URL requires a service account
461-
* and its associated key. If a {@link AuthCredentials.ServiceAccountAuthCredentials} was passed
462-
* to {@link StorageOptions.Builder#authCredentials(AuthCredentials)} or the default credentials
463-
* are being used and the environment variable {@code GOOGLE_APPLICATION_CREDENTIALS} is set, then
464-
* {@code signUrl} will use that service account and associated key to sign the URL. If this
465-
* is not the case, a service account with associated key can be passed to {@code signUrl} using
466-
* the {@link SignUrlOption#serviceAccount(AuthCredentials.ServiceAccountAuthCredentials)} option.
457+
* Generates a signed URL for this blob. If you want to allow access for a fixed amount of time to
458+
* this blob, you can use this method to generate a URL that is only valid within a certain time
459+
* period. This is particularly useful if you don't want publicly accessible blobs, but don't want
460+
* to require users to explicitly log in. Signing a URL requires a service account
461+
* and its associated private key. If a {@link AuthCredentials.ServiceAccountAuthCredentials} was
462+
* passed to {@link StorageOptions.Builder#authCredentials(AuthCredentials)} or the default
463+
* credentials are being used and the environment variable {@code GOOGLE_APPLICATION_CREDENTIALS}
464+
* is set, then {@code signUrl} will use that service account and associated key to sign the URL.
465+
* If the credentials passed to {@link StorageOptions} do not expose a private key (this is the
466+
* case for App Engine credentials, Compute Engine credentials and Google Cloud SDK credentials)
467+
* then {@code signUrl} will throw an {@link IllegalArgumentException} unless a service account
468+
* with associated key is passed using the {@code SignUrlOption.serviceAccount()} option. The
469+
* service account and private key passed with {@code SignUrlOption.serviceAccount()} have
470+
* priority over any credentials set with
471+
* {@link StorageOptions.Builder#authCredentials(AuthCredentials)}.
467472
*
468473
* <p>Example usage of creating a signed URL that is valid for 2 weeks:
469474
* <pre> {@code

gcloud-java-storage/src/main/java/com/google/gcloud/storage/Storage.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,12 +1481,16 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
14811481
* fixed amount of time, you can use this method to generate a URL that is only valid within a
14821482
* certain time period. This is particularly useful if you don't want publicly accessible blobs,
14831483
* but don't want to require users to explicitly log in. Signing a URL requires a service account
1484-
* and its associated key. If a {@link ServiceAccountAuthCredentials} was passed to
1484+
* and its associated private key. If a {@link ServiceAccountAuthCredentials} was passed to
14851485
* {@link StorageOptions.Builder#authCredentials(AuthCredentials)} or the default credentials are
14861486
* being used and the environment variable {@code GOOGLE_APPLICATION_CREDENTIALS} is set, then
1487-
* {@code signUrl} will use that service account and associated key to sign the URL. If this
1488-
* is not the case, a service account with associated key can be passed to {@code signUrl} using
1489-
* the {@code SignUrlOption.serviceAccount()} option.
1487+
* {@code signUrl} will use that service account and associated key to sign the URL. If the
1488+
* credentials passed to {@link StorageOptions} do not expose a private key (this is the case for
1489+
* App Engine credentials, Compute Engine credentials and Google Cloud SDK credentials) then
1490+
* {@code signUrl} will throw an {@link IllegalArgumentException} unless a service account with
1491+
* associated key is passed using the {@code SignUrlOption.serviceAccount()} option. The service
1492+
* account and private key passed with {@code SignUrlOption.serviceAccount()} have priority over
1493+
* any credentials set with {@link StorageOptions.Builder#authCredentials(AuthCredentials)}.
14901494
*
14911495
* <p>Example usage of creating a signed URL that is valid for 2 weeks:
14921496
* <pre> {@code

0 commit comments

Comments
 (0)