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

Skip to content

Conversation

frankyn
Copy link
Contributor

@frankyn frankyn commented Aug 13, 2019

Storage feature request to support the rename of Bucket Policy Only to Uniform Bucket Level Access.

  • Update integration tests to use uniform bucket-level access instead.
  • Update documentation.
  • Review from GCS eng team(@thanhld94).
  • Fix pending for backend bug: 134695162. Remove workaround.

@frankyn frankyn added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. api: storage Issues related to the Cloud Storage API. needs work This is a pull request that needs a little love. labels Aug 13, 2019
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 13, 2019
:params uniform_bucket_level_locked_time: (optional) When the bucket's IAM-only policy was ehabled. This value should normally only be set by the back-end API.
:type bucket_policy_only_enabled: bool
:params bucket_policy_only_enabled: (optional) whether the IAM-only policy is enabled for the bucket.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should bucket_policy_only_enabled and bucket_policy_only_locked_time be documented as deprecated?

bucket_policy_only_enabled=False,
bucket_policy_only_locked_time=None,
uniform_bucket_level_access_enabled=False,
uniform_bucket_level_access_locked_time=None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Ordering should match the order documented above. The constructor probably needs to check for / resolve conflicts between uniform_bucket_level_access_enabled / bucket_policy_only_enabled and uniform_bucket_level_access_locked_time / bucket_policy_only_locked_time first, which would simplify the code setting up data.

:rtype: :class:`IAMConfiguration`
:returns: Instance created from resource.
"""

Copy link
Contributor

Choose a reason for hiding this comment

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

Stray line.

def bucket_policy_only_locked_time(self):
"""Deadline for changing :attr:`bucket_policy_only_enabled` from true to false.
"""Alias for uniform_bucket_level_access."""
return self.uniform_bucket_level_access_locked_time()
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't call the property, just return it, e.g.:

Suggested change
return self.uniform_bucket_level_access_locked_time()
return self.uniform_bucket_level_access_locked_time

self.assertFalse(config.bucket_policy_only_enabled)
self.assertIsNone(config.bucket_policy_only_locked_time)
self.assertFalse(config.uniform_bucket_level_access_enabled)
self.assertIsNone(config.uniform_bucket_level_access_locked_time)
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to retain tests for the deprecated properties (which would have exposed the "can't call properties" bugs I noted above).

self.assertFalse(config.bucket_policy_only_enabled)
self.assertIsNone(config.bucket_policy_only_locked_time)
self.assertFalse(config.uniform_bucket_level_access_enabled)
self.assertIsNone(config.uniform_bucket_level_access_locked_time)
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to retain the assertions about the deprecated properties here.

Also, do we need a separate testcase for a resource which contains only an empty bucketPolicyOnly mapping? I.e., can we guarantee that the back-end won't return such a resource?

self.assertFalse(config.bucket_policy_only_enabled)
self.assertIsNone(config.bucket_policy_only_locked_time)
self.assertFalse(config.uniform_bucket_level_access_enabled)
self.assertIsNone(config.uniform_bucket_level_access_locked_time)
Copy link
Contributor

Choose a reason for hiding this comment

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

Preserve the assertions about the deprecated properties here, too.

Also, do we need a separate testcase for a resource which contains only a populated bucketPolicyOnly mapping? I.e., can we guarantee that the back-end won't return such a resource?

self.assertTrue(config.bucket_policy_only_enabled)
self.assertEqual(config.bucket_policy_only_locked_time, now)
self.assertTrue(config.uniform_bucket_level_access_enabled)
self.assertEqual(config.uniform_bucket_level_access_locked_time, now)
Copy link
Contributor

Choose a reason for hiding this comment

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

Preserve the assertions about the deprecated properties here, too.

Also, do we need a separate testcase for a resource which contains only a populated bucketPolicyOnly mapping? I.e., can we guarantee that the back-end won't return such a resource?

self.assertEqual(config.uniform_bucket_level_access_locked_time, now)

def test_bucket_policy_only_enabled_setter(self):
def test_uniform_bucket_level_access_enabled_setter(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to preserve separate test cases for the deprecated properties' setters.

config.uniform_bucket_level_access_enabled = True

self.assertTrue(config["bucketPolicyOnly"]["enabled"])
self.assertTrue(config["uniformBucketLevelAccess"]["enabled"])
Copy link
Contributor

Choose a reason for hiding this comment

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

Preserve the assertion about the deprecated prroperty here, too.

@JesseLovelace
Copy link
Contributor

Hi @tseaver, thank you for reviewing. Moving forward with this, we actually need you to take over this PR, and I will review it. Can you update it with the changes you've suggested, as well as removing the workaround? (That should work now). I'm working on getting you access to the one-pager in case you need that

@tseaver
Copy link
Contributor

tseaver commented Oct 15, 2019

Superseded by #9475.

@tseaver tseaver closed this Oct 15, 2019
@tseaver tseaver deleted the ubla branch October 15, 2019 15:42
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. needs work This is a pull request that needs a little love. 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.

5 participants