Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Setting userProject from NIO FileSystemProvider #3475

@ryan-williams

Description

@ryan-williams

I'm happy to see that requester-pays support was just added!

afaict, I can't set the userProject in a CloudStorageFileSystemProvider that gets instantiated via the Java NIO FileSystemProvider machinery, which uses Class.newInstance() to invoke the nullary constructor:

import java.net.URI;
import java.nio.file.Paths;
import java.nio.file.Files;
Files.newDirectoryStream(Paths.get(new URI("gs://<bucket>")))

throws:

com.google.cloud.storage.StorageException: Bucket is requester pays bucket but no user project provided.
  at com.google.cloud.storage.spi.v1.HttpStorageRpc.translate(HttpStorageRpc.java:220)
  at com.google.cloud.storage.spi.v1.HttpStorageRpc.list(HttpStorageRpc.java:347)
  at com.google.cloud.storage.StorageImpl$8.call(StorageImpl.java:299)
  …

Is there a way to set the user-project, other than as a ctor param?

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the Cloud Storage API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions