GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Add '{Bucket,Blob}.user_project' properties. by tseaver · Pull Request #3490 · googleapis/google-cloud-python Conversation
|
|
Rebased against master after the merge of #3488. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Pretty straightforward, mostly (totally?) just nits
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # Pass only '?projection=noAcl' here because 'acl' and related | ||
| # are handled via custom endpoints. | ||
| query_params = {'projection': 'noAcl'} | ||
| if self.user_project is not None: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @property | ||
| def user_project(self): | ||
| """Project ID used for API requests made via this blob. | ||
|
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| :type user_project: str | ||
| :param user_project: (Optional) the project ID to be billed for API | ||
| requests made via this instance. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| def user_project(self): | ||
| """Project ID to be billed for API requests made via this bucket. | ||
|
|
||
| If unset, API requests are billed to the bucket owner. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| mixin = self._make_one() | ||
| self.assertRaises(NotImplementedError, lambda: mixin.path) | ||
| with self.assertRaises(NotImplementedError): | ||
| mixin.path |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| connection = _Connection({'foo': 'Foo'}) | ||
| client = _Client(connection) | ||
| derived = self._derivedClass('/path', user_project)() | ||
| # Make sure changes is not a set, so we can observe a change. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| self.assertEqual(kw[0]['path'], '/path') | ||
| self.assertEqual( | ||
| kw[0]['query_params'], | ||
| {'projection': 'noAcl', 'userProject': user_project}) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| bucket = klass(client, name=NAME, user_project=USER_PROJECT) | ||
| self.assertEqual(bucket.name, NAME) | ||
| self.assertEqual(bucket._properties, {}) | ||
| self.assertEqual(bucket.user_project, USER_PROJECT) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| kw[0]['query_params'], | ||
| {'projection': 'full', 'userProject': user_project}) | ||
| # Since changes does not include `baz`, we don't see it sent. | ||
| self.assertEqual(kw[0]['data'], {'bar': BAR}) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
LGTM after your comment update |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.
* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.
* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.
* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.
* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.
* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.
* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.
* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.
* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.