コード例 #1
0
    def test_get_bucket_with_limited_access(self, mock_get_bucket):
        import boto.s3.bucket

        def reject_validated_get_bucket(*args, **kwargs):
            if kwargs.get('validate', True):
                raise boto.exception.S3ResponseError("Fake Error", "Permission Denied")

            bucket = mock.Mock(spec=boto.s3.bucket.Bucket)
            bucket.name = 'bucket_name'
            return bucket

        mock_get_bucket.side_effect = reject_validated_get_bucket

        get_bucket('some_bucket', 'fake-access-key', 'fake-secret-key')
コード例 #2
0
ファイル: test_readers_s3.py プロジェクト: bbotella/fluxo
    def test_get_bucket_with_limited_access(self, mock_get_bucket):
        import boto.s3.bucket

        def reject_validated_get_bucket(*args, **kwargs):
            if kwargs.get('validate', True):
                raise boto.exception.S3ResponseError("Fake Error",
                                                     "Permission Denied")

            bucket = mock.Mock(spec=boto.s3.bucket.Bucket)
            bucket.name = 'bucket_name'
            return bucket

        mock_get_bucket.side_effect = reject_validated_get_bucket

        get_bucket('some_bucket', 'fake-access-key', 'fake-secret-key')
コード例 #3
0
ファイル: s3_to_s3_bypass.py プロジェクト: bbotella/fluxo
 def execute(self):
     writer_aws_key = self.read_option('writer', 'aws_access_key_id')
     writer_aws_secret = self.read_option('writer', 'aws_secret_access_key')
     writer_options = self.config.writer_options['options']
     self.dest_bucket = get_bucket(
         self.read_option('writer', 'bucket'), writer_aws_key, writer_aws_secret)
     self.dest_filebase = self._get_filebase(writer_options)
     super(S3Bypass, self).execute()
     if writer_options.get('save_pointer'):
         self._update_last_pointer(
             self.dest_bucket, writer_options.get(
                 'save_pointer'), writer_options.get('filebase'))
コード例 #4
0
 def execute(self):
     writer_aws_key = self.read_option('writer', 'aws_access_key_id')
     writer_aws_secret = self.read_option('writer', 'aws_secret_access_key')
     writer_options = self.config.writer_options['options']
     self.dest_bucket = get_bucket(
         self.read_option('writer', 'bucket'), writer_aws_key, writer_aws_secret)
     self.dest_filebase = self._get_filebase(writer_options)
     super(S3Bypass, self).execute()
     if writer_options.get('save_pointer'):
         self._update_last_pointer(
             self.dest_bucket, writer_options.get(
                         'save_pointer'), writer_options.get('filebase'))
コード例 #5
0
ファイル: base_s3_bypass.py プロジェクト: bbotella/fluxo
 def execute(self):
     reader_aws_key = self.read_option('reader', 'aws_access_key_id')
     reader_aws_secret = self.read_option('reader', 'aws_secret_access_key')
     self.bypass_state = S3BypassState(self.config, self.metadata,
                                       reader_aws_key, reader_aws_secret)
     self.total_items = self.bypass_state.stats['total_count']
     source_bucket = get_bucket(self.read_option('reader', 'bucket'),
                                reader_aws_key, reader_aws_secret)
     keys_to_copy = deepcopy(self.bypass_state.pending_keys())
     for key in keys_to_copy:
         self._copy_key(source_bucket, key)
         self.bypass_state.commit_copied_key(key)
         logging.log(logging.INFO, 'Copied key {}'.format(key))
コード例 #6
0
 def execute(self):
     reader_aws_key = self.read_option('reader', 'aws_access_key_id')
     reader_aws_secret = self.read_option('reader', 'aws_secret_access_key')
     self.bypass_state = S3BypassState(
         self.config, self.metadata,
         reader_aws_key,
         reader_aws_secret)
     self.total_items = self.bypass_state.stats['total_count']
     source_bucket = get_bucket(
         self.read_option('reader', 'bucket'), reader_aws_key, reader_aws_secret)
     keys_to_copy = deepcopy(self.bypass_state.pending_keys())
     for key in keys_to_copy:
         self._copy_key(source_bucket, key)
         self.bypass_state.commit_copied_key(key)
         logging.log(logging.INFO, 'Copied key {}'.format(key))