FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: Adds Universe Domain support by JesseLovelace · Pull Request #2362 · googleapis/java-storage · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (2) .md  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ If you are using Maven without the BOM, add this to your dependencies:
If you are using Gradle 5.x or later, add this to your dependencies:

```Groovy
implementation platform('com.google.cloud:libraries-bom:26.30.0')
implementation platform('com.google.cloud:libraries-bom:26.31.0')

implementation 'com.google.cloud:google-cloud-storage'
```
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,17 @@ public HttpStorageRpcFactory() {}
public ServiceRpc create(StorageOptions options) {
if (options instanceof HttpStorageOptions) {
HttpStorageOptions httpStorageOptions = (HttpStorageOptions) options;
// todo: In the future, this step will be done automatically, and the getResolvedApiaryHost

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Is there a tracking bug to know when this will be addressed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Added!

// helper method will
// be removed. When that happens, delete the following block.
// https://github.com/googleapis/google-api-java-client-services/issues/19286
if (httpStorageOptions.getUniverseDomain() != null) {
httpStorageOptions =
httpStorageOptions
.toBuilder()
.setHost(httpStorageOptions.getResolvedApiaryHost("storage"))
.build();
}
return new HttpStorageRpc(httpStorageOptions);
} else {
throw new IllegalArgumentException("Only HttpStorageOptions supported");
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ final class StorageImpl extends BaseService<StorageOptions> implements Storage {
/** Signed URLs are only supported through the GCS XML API endpoint. */
private static final String STORAGE_XML_URI_SCHEME = "https";

private static final String STORAGE_XML_URI_HOST_NAME = "storage.googleapis.com";
// TODO: in the future, this can be replaced by getOptions().getHost()
private final String STORAGE_XML_URI_HOST_NAME =
getOptions()
.getResolvedApiaryHost("storage")
.replaceFirst("http(s)?://", "")
.replace("/", "");

private static final int DEFAULT_BUFFER_SIZE = 15 * 1024 * 1024;
private static final int MIN_BUFFER_SIZE = 256 * 1024;
Expand Down Expand Up @@ -1048,7 +1053,8 @@ private SignatureInfo buildSignatureInfo(
"host",
slashlessBucketNameFromBlobInfo(blobInfo) + "." + getBaseStorageHostName(optionMap));
} else if (optionMap.containsKey(SignUrlOption.Option.HOST_NAME)
|| optionMap.containsKey(SignUrlOption.Option.BUCKET_BOUND_HOST_NAME)) {
|| optionMap.containsKey(SignUrlOption.Option.BUCKET_BOUND_HOST_NAME)
|| getOptions().getUniverseDomain() != null) {
extHeadersBuilder.put("host", getBaseStorageHostName(optionMap));
}
}
Expand Down Expand Up @@ -1576,7 +1582,16 @@ public boolean deleteNotification(final String bucket, final String notification

@Override
public HttpStorageOptions getOptions() {
return (HttpStorageOptions) super.getOptions();
HttpStorageOptions options = (HttpStorageOptions) super.getOptions();
/**
* TODO: In the future, this should happen automatically, and this block will be deleted
* https://github.com/googleapis/google-api-java-client-services/issues/19286
*/
if (options.getUniverseDomain() != null) {

return options.toBuilder().setHost(options.getResolvedApiaryHost("storage")).build();
}
return options;
}

private Blob internalGetBlob(BlobId blob, Map<StorageRpc.Option, ?> optionsMap) {
Expand Down

Back | FazBrowse Home | New Git URL