Title: Setting userProject from NIO FileSystemProvider · Issue #3475 · googleapis/google-cloud-java · GitHub
Open Graph Title: Setting userProject from NIO FileSystemProvider · Issue #3475 · googleapis/google-cloud-java
X Title: Setting userProject from NIO FileSystemProvider · Issue #3475 · googleapis/google-cloud-java
Description: 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 ...
Open Graph Description: 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 machi...
X Description: 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 FileSystemProvid...
Opengraph URL: https://github.com/googleapis/google-cloud-java/issues/3475
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Setting userProject from NIO FileSystemProvider","articleBody":"I'm happy to see that [requester-pays support was just added](https://github.com/GoogleCloudPlatform/google-cloud-java/issues/3221)!\r\n\r\nafaict, 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:\r\n\r\n```java\r\nimport java.net.URI;\r\nimport java.nio.file.Paths;\r\nimport java.nio.file.Files;\r\nFiles.newDirectoryStream(Paths.get(new URI(\"gs://\u003cbucket\u003e\")))\r\n```\r\n\r\nthrows:\r\n```\r\ncom.google.cloud.storage.StorageException: Bucket is requester pays bucket but no user project provided.\r\n at com.google.cloud.storage.spi.v1.HttpStorageRpc.translate(HttpStorageRpc.java:220)\r\n at com.google.cloud.storage.spi.v1.HttpStorageRpc.list(HttpStorageRpc.java:347)\r\n at com.google.cloud.storage.StorageImpl$8.call(StorageImpl.java:299)\r\n …\r\n```\r\n\r\nIs there a way to set the user-project, other than as a ctor param?\r\n- an environment variable would seem easiest\r\n - afaict there's no standard mechanism for doing that across GCS libraries in various languages\r\n - perhaps it's still ok to add one here\r\n- a setter would help a bit\r\n - I'll be mainly using it from [hammerlab/path-utils](https://github.com/hammerlab/path-utils), where I (unfortunately) have code to [reach into the `installedProviders` and modify the providers for a given URI scheme](https://github.com/hammerlab/path-utils/blob/1.5.0/src/main/scala/org/hammerlab/paths/FileSystems.scala#L128-L145)\r\n - a setter would at least save me from a second reflection hack to reach ","author":{"url":"https://github.com/ryan-williams","@type":"Person","name":"ryan-williams"},"datePublished":"2018-07-17T15:28:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/3475/google-cloud-java/issues/3475"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:21c28d74-47dd-0cbf-1f79-b8fdfe11da8c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C034:53D51:1B72D85:277A194:6A4CE0DE |
| html-safe-nonce | b16b5ef8b71987c7c7c1148bb964323ed87a817475ad672a8a880c46523c53fc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDM0OjUzRDUxOjFCNzJEODU6Mjc3QTE5NDo2QTRDRTBERSIsInZpc2l0b3JfaWQiOiI0NzcyNzIzMzk2NjEyNzc2MTU4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 33e2146d4a40dacdc4f380cf5039044ef337dceeb1bfd3d85293ae1b83b10ad8 |
| hovercard-subject-tag | issue:341970498 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-java/3475/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3b718fa27aca0f3f601aa5946c5a63ae769351b7e302791cae9ef2373890c0f8/googleapis/google-cloud-java/issues/3475 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3b718fa27aca0f3f601aa5946c5a63ae769351b7e302791cae9ef2373890c0f8/googleapis/google-cloud-java/issues/3475 |
| og:image:alt | 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 machi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ryan-williams |
| hostname | github.com |
| expected-hostname | github.com |
| None | 299b43bca6e02ad35197ffeba30d2466846d5fb02ab96fbced5b5e6cec589fb8 |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/google-cloud-java git https://github.com/googleapis/google-cloud-java.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 26181278 |
| octolytics-dimension-repository_nwo | googleapis/google-cloud-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 26181278 |
| octolytics-dimension-repository_network_root_nwo | googleapis/google-cloud-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c5a57f04eeb310f57c73fd6d751d957e2ca27ed2 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width