github.com/uber/kraken@v0.1.4/lib/backend/s3backend/s3.go (about)

     1  // Copyright (c) 2016-2019 Uber Technologies, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  package s3backend
    15  
    16  import (
    17  	"io"
    18  
    19  	"github.com/aws/aws-sdk-go/service/s3"
    20  	"github.com/aws/aws-sdk-go/service/s3/s3iface"
    21  	"github.com/aws/aws-sdk-go/service/s3/s3manager"
    22  )
    23  
    24  // S3 defines the operations we use in the s3 api. Useful for mocking.
    25  type S3 interface {
    26  	HeadObject(input *s3.HeadObjectInput) (*s3.HeadObjectOutput, error)
    27  
    28  	Download(
    29  		w io.WriterAt,
    30  		input *s3.GetObjectInput,
    31  		options ...func(*s3manager.Downloader)) (n int64, err error)
    32  
    33  	Upload(
    34  		input *s3manager.UploadInput,
    35  		options ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error)
    36  
    37  	ListObjectsV2Pages(input *s3.ListObjectsV2Input, fn func(*s3.ListObjectsV2Output, bool) bool) error
    38  }
    39  
    40  type join struct {
    41  	s3iface.S3API
    42  	*s3manager.Downloader
    43  	*s3manager.Uploader
    44  }
    45  
    46  var _ S3 = (*join)(nil)