Skip to content

Conversation

@tseaver
Copy link
Contributor

@tseaver tseaver commented Jun 8, 2017

Uses #3489 as a base.

@tseaver tseaver added api: storage Issues related to the Cloud Storage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Jun 8, 2017
@tseaver tseaver requested review from dhermes and lukesneeringer June 8, 2017 20:16
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 8, 2017
@tseaver
Copy link
Contributor Author

tseaver commented Jun 9, 2017

Rebased against master after the merge of #3488.

Copy link
Contributor

@dhermes dhermes left a comment

Choose a reason for hiding this comment

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

Pretty straightforward, mostly (totally?) just nits

# 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:

This comment was marked as spam.

This comment was marked as spam.

@property
def user_project(self):
"""Project ID used for API requests made via this blob.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

:type user_project: str
:param user_project: (Optional) the project ID to be billed for API
requests made via this instance.

This comment was marked as spam.

This comment was marked as spam.

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.

This comment was marked as spam.

This comment was marked as spam.

mixin = self._make_one()
self.assertRaises(NotImplementedError, lambda: mixin.path)
with self.assertRaises(NotImplementedError):
mixin.path

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

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.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

self.assertEqual(kw[0]['path'], '/path')
self.assertEqual(
kw[0]['query_params'],
{'projection': 'noAcl', 'userProject': user_project})

This comment was marked as spam.

This comment was marked as spam.

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)

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

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})

This comment was marked as spam.

This comment was marked as spam.

@dhermes
Copy link
Contributor

dhermes commented Jun 12, 2017

LGTM after your comment update

@tseaver tseaver merged commit 60832b8 into googleapis:master Jun 13, 2017
@tseaver tseaver deleted the 3474-storage-bucket-requester_pays-user_project-property branch June 13, 2017 13:55
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 21, 2017
* 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.
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 22, 2017
* 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.
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 22, 2017
* 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.
tseaver added a commit that referenced this pull request Sep 22, 2017
* 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.
tseaver added a commit that referenced this pull request Oct 2, 2017
* 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.
tseaver added a commit that referenced this pull request Oct 5, 2017
* 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.
tseaver added a commit that referenced this pull request Oct 10, 2017
* 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.
tseaver added a commit that referenced this pull request Oct 10, 2017
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API. cla: yes This human has signed the Contributor License Agreement. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants