parameters: (self, url)
docstring: Applies the changes in self.changes to the provided URL.
docstring_summary: Applies the changes in self.changes to the provided URL.
docstring_tokens: Applies the changes in self . changes to the provided URL .
function: def ApplyAclChanges(self, url):
      """Applies the changes in self.changes to the provided URL."""
      bucket = self.gsutil_api.GetBucket(
          url.bucket_name, provider=url.scheme,
          fields=['defaultObjectAcl', 'metageneration'])
  
      # Default object ACLs can be blank if the ACL was set to private, or
      # if the user doesn't have permission. We warn about this with defacl get,
      # so just try the modification here and if the user doesn't have
      # permission they'll get an AccessDeniedException.
      current_acl = bucket.defaultObjectAcl
  
      modification_count = 0
      for change in self.changes:
        modification_count += change.Execute(
            url, current_acl, 'defacl', self.logger)
      if modification_count == 0:
        self.logger.info('No changes to %s', url)
        return
  
      if not current_acl:
        # Use a sentinel value to indicate a private (no entries) default
        # object ACL.
        current_acl.append(PRIVATE_DEFAULT_OBJ_ACL)
  
      try:
        preconditions = Preconditions(meta_gen_match=bucket.metageneration)
        bucket_metadata = apitools_messages.Bucket(defaultObjectAcl=current_acl)
        self.gsutil_api.PatchBucket(url.bucket_name, bucket_metadata,
                                    preconditions=preconditions,
                                    provider=url.scheme, fields=['id'])
      except BadRequestException as e:
        # Don't retry on bad requests, e.g. invalid email address.
        raise CommandException('Received bad request from server: %s' % str(e))
      except AccessDeniedException:
        self._WarnServiceAccounts()
        raise CommandException('Failed to set acl for %s. Please ensure you have '
                               'OWNER-role access to this resource.' % url)
  
      self.logger.info('Updated default ACL on %s', url)
function_tokens: def ApplyAclChanges ( self , url ) : bucket = self . gsutil_api . GetBucket ( url . bucket_name , provider = url . scheme , fields = [ 'defaultObjectAcl' , 'metageneration' ] ) # Default object ACLs can be blank if the ACL was set to private, or # if the user doesn't have permission. We warn about this with defacl get, # so just try the modification here and if the user doesn't have # permission they'll get an AccessDeniedException. current_acl = bucket . defaultObjectAcl modification_count = 0 for change in self . changes : modification_count += change . Execute ( url , current_acl , 'defacl' , self . logger ) if modification_count == 0 : self . logger . info ( 'No changes to %s' , url ) return if not current_acl : # Use a sentinel value to indicate a private (no entries) default # object ACL. current_acl . append ( PRIVATE_DEFAULT_OBJ_ACL ) try : preconditions = Preconditions ( meta_gen_match = bucket . metageneration ) bucket_metadata = apitools_messages . Bucket ( defaultObjectAcl = current_acl ) self . gsutil_api . PatchBucket ( url . bucket_name , bucket_metadata , preconditions = preconditions , provider = url . scheme , fields = [ 'id' ] ) except BadRequestException as e : # Don't retry on bad requests, e.g. invalid email address. raise CommandException ( 'Received bad request from server: %s' % str ( e ) ) except AccessDeniedException : self . _WarnServiceAccounts ( ) raise CommandException ( 'Failed to set acl for %s. Please ensure you have ' 'OWNER-role access to this resource.' % url ) self . logger . info ( 'Updated default ACL on %s' , url )