Documentation
¶
Index ¶
- type Client
- func (c *Client) AbortMultipartUploadRequest(input *s3.AbortMultipartUploadInput) (req *request.Request, output *s3.AbortMultipartUploadOutput)
- func (c *Client) AbortMultipartUploadWithContext(ctx aws.Context, input *s3.AbortMultipartUploadInput, opts ...request.Option) (*s3.AbortMultipartUploadOutput, error)
- func (c *Client) CompleteMultipartUploadRequest(input *s3.CompleteMultipartUploadInput) (req *request.Request, output *s3.CompleteMultipartUploadOutput)
- func (c *Client) CompleteMultipartUploadWithContext(ctx aws.Context, input *s3.CompleteMultipartUploadInput, ...) (*s3.CompleteMultipartUploadOutput, error)
- func (c *Client) CopyObject(input *s3.CopyObjectInput) (*s3.CopyObjectOutput, error)
- func (c *Client) CopyObjectRequest(input *s3.CopyObjectInput) (req *request.Request, output *s3.CopyObjectOutput)
- func (c *Client) CopyObjectWithContext(ctx aws.Context, input *s3.CopyObjectInput, opts ...request.Option) (*s3.CopyObjectOutput, error)
- func (c *Client) CreateMultipartUploadRequest(input *s3.CreateMultipartUploadInput) (req *request.Request, output *s3.CreateMultipartUploadOutput)
- func (c *Client) CreateMultipartUploadWithContext(ctx aws.Context, input *s3.CreateMultipartUploadInput, opts ...request.Option) (*s3.CreateMultipartUploadOutput, error)
- func (c *Client) DeleteObject(input *s3.DeleteObjectInput) (*s3.DeleteObjectOutput, error)
- func (c *Client) DeleteObjectRequest(input *s3.DeleteObjectInput) (req *request.Request, out *s3.DeleteObjectOutput)
- func (c *Client) DeleteObjectWithContext(ctx aws.Context, input *s3.DeleteObjectInput, opts ...request.Option) (*s3.DeleteObjectOutput, error)
- func (c *Client) DeleteObjects(input *s3.DeleteObjectsInput) (*s3.DeleteObjectsOutput, error)
- func (c *Client) DeleteObjectsWithContext(ctx aws.Context, input *s3.DeleteObjectsInput, opts ...request.Option) (*s3.DeleteObjectsOutput, error)
- func (c *Client) GetApiCount(api string) int
- func (c *Client) GetBucketLocationRequest(input *s3.GetBucketLocationInput) (req *request.Request, output *s3.GetBucketLocationOutput)
- func (c *Client) GetBucketLocationWithContext(ctx aws.Context, input *s3.GetBucketLocationInput, opts ...request.Option) (*s3.GetBucketLocationOutput, error)
- func (c *Client) GetFile(key string) (FileContent, bool)
- func (c *Client) GetFileContentBytes(key string) []byte
- func (c *Client) GetObject(input *s3.GetObjectInput) (*s3.GetObjectOutput, error)
- func (c *Client) GetObjectRequest(input *s3.GetObjectInput) (req *request.Request, output *s3.GetObjectOutput)
- func (c *Client) GetObjectWithContext(ctx aws.Context, input *s3.GetObjectInput, opts ...request.Option) (*s3.GetObjectOutput, error)
- func (c *Client) HeadObject(input *s3.HeadObjectInput) (output *s3.HeadObjectOutput, err error)
- func (c *Client) HeadObjectRequest(input *s3.HeadObjectInput) (req *request.Request, out *s3.HeadObjectOutput)
- func (c *Client) HeadObjectWithContext(ctx aws.Context, input *s3.HeadObjectInput, opts ...request.Option) (output *s3.HeadObjectOutput, err error)
- func (c *Client) ListObjectsV2(input *s3.ListObjectsV2Input) (*s3.ListObjectsV2Output, error)
- func (c *Client) ListObjectsV2Request(input *s3.ListObjectsV2Input) (req *request.Request, output *s3.ListObjectsV2Output)
- func (c *Client) ListObjectsV2WithContext(ctx aws.Context, input *s3.ListObjectsV2Input, opts ...request.Option) (*s3.ListObjectsV2Output, error)
- func (c *Client) MaxRetries() int
- func (c *Client) MustGetFile(key string) FileContent
- func (c *Client) PutObject(input *s3.PutObjectInput) (*s3.PutObjectOutput, error)
- func (c *Client) PutObjectAcl(input *s3.PutObjectAclInput) (*s3.PutObjectAclOutput, error)
- func (c *Client) PutObjectRequest(input *s3.PutObjectInput) (req *request.Request, output *s3.PutObjectOutput)
- func (c *Client) PutObjectWithContext(ctx aws.Context, input *s3.PutObjectInput, opts ...request.Option) (*s3.PutObjectOutput, error)
- func (c *Client) SetFile(key string, content []byte, sha256 string)
- func (c *Client) SetFileContentAt(key string, content testutil.ContentAt, SHA256 string)
- func (c *Client) UploadPartCopyRequest(input *s3.UploadPartCopyInput) (req *request.Request, output *s3.UploadPartCopyOutput)
- func (c *Client) UploadPartCopyWithContext(ctx aws.Context, input *s3.UploadPartCopyInput, opts ...request.Option) (*s3.UploadPartCopyOutput, error)
- func (c *Client) UploadPartRequest(input *s3.UploadPartInput) (req *request.Request, output *s3.UploadPartOutput)
- func (c *Client) UploadPartWithContext(ctx aws.Context, input *s3.UploadPartInput, opts ...request.Option) (*s3.UploadPartOutput, error)
- type FileContent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // Region holds the region of the bucket returned by // GetBucketLocationRequest. Region string // NumMaxRetries configures the maximum number of retries permitted // for operations involving this client. NumMaxRetries int // If Err!=nil, it is called when a request handler starts. "api" is the // request name, e.g., "GetObjectRequest", and "input" is the request object, // e.g., *s3.GetObjectInput. If the Err callback returns an error, the request // handler will return that error. Err func(api string, input interface{}) error s3iface.S3API // contains filtered or unexported fields }
Client implements s3iface.S3API by using an AWS SDK client and overriding methods under test: HeadObject, ListObjectsV2, PutObjectRequest, CreateMultipartUploadRequest, UploadPartRequest, AbortMultipartUploadRequest, CompleteMultipartUploadRequest, GetObjectRequest, CopyObject, and DeleteObject. (These methods are sufficient to use with the S3 upload and download managers.)
File contents (and their checksums) are provided by the user.
func NewClient ¶
NewClient constructs a new S3 client under test. The client reports errors to the given testing.T, and expects to receive requests for the given bucket.
func (*Client) AbortMultipartUploadRequest ¶
func (c *Client) AbortMultipartUploadRequest( input *s3.AbortMultipartUploadInput) (req *request.Request, output *s3.AbortMultipartUploadOutput)
AbortMultipartUploadRequest stubs the corresponding s3iface.API method.
func (*Client) AbortMultipartUploadWithContext ¶
func (c *Client) AbortMultipartUploadWithContext( ctx aws.Context, input *s3.AbortMultipartUploadInput, opts ...request.Option) (*s3.AbortMultipartUploadOutput, error)
AbortMultipartUploadWithContext implements the corresponding s3iface.API method.
func (*Client) CompleteMultipartUploadRequest ¶
func (c *Client) CompleteMultipartUploadRequest( input *s3.CompleteMultipartUploadInput) (req *request.Request, output *s3.CompleteMultipartUploadOutput)
CompleteMultipartUploadRequest stubs the corresponding s3iface.API method.
func (*Client) CompleteMultipartUploadWithContext ¶
func (c *Client) CompleteMultipartUploadWithContext( ctx aws.Context, input *s3.CompleteMultipartUploadInput, opts ...request.Option) ( *s3.CompleteMultipartUploadOutput, error)
CompleteMultipartUploadWithContext stubs the corresponding s3iface.API method.
func (*Client) CopyObject ¶
func (c *Client) CopyObject(input *s3.CopyObjectInput) (*s3.CopyObjectOutput, error)
CopyObject implements S3-side object copying.
func (*Client) CopyObjectRequest ¶
func (c *Client) CopyObjectRequest( input *s3.CopyObjectInput) (req *request.Request, output *s3.CopyObjectOutput)
CopyObjectRequest implements the Request model of server side object copying.
func (*Client) CopyObjectWithContext ¶
func (c *Client) CopyObjectWithContext(ctx aws.Context, input *s3.CopyObjectInput, opts ...request.Option) (*s3.CopyObjectOutput, error)
func (*Client) CreateMultipartUploadRequest ¶
func (c *Client) CreateMultipartUploadRequest( input *s3.CreateMultipartUploadInput) (req *request.Request, output *s3.CreateMultipartUploadOutput)
CreateMultipartUploadRequest stubs the corresponding s3iface.API method.
func (*Client) CreateMultipartUploadWithContext ¶
func (c *Client) CreateMultipartUploadWithContext( ctx aws.Context, input *s3.CreateMultipartUploadInput, opts ...request.Option) ( *s3.CreateMultipartUploadOutput, error)
CreateMultipartUploadWithContext stubs the corresponding s3iface.API method.
func (*Client) DeleteObject ¶
func (c *Client) DeleteObject(input *s3.DeleteObjectInput) (*s3.DeleteObjectOutput, error)
DeleteObject removes an object from the bucket.
func (*Client) DeleteObjectRequest ¶
func (c *Client) DeleteObjectRequest(input *s3.DeleteObjectInput) (req *request.Request, out *s3.DeleteObjectOutput)
DeleteObjectRequest creates an RPC request for DeleteObject.
func (*Client) DeleteObjectWithContext ¶
func (c *Client) DeleteObjectWithContext(ctx aws.Context, input *s3.DeleteObjectInput, opts ...request.Option) (*s3.DeleteObjectOutput, error)
DeleteObjectWithContext is the same as DeleteObject, but allows passing a context and options.
func (*Client) DeleteObjects ¶
func (c *Client) DeleteObjects(input *s3.DeleteObjectsInput) (*s3.DeleteObjectsOutput, error)
DeleteObjects removes a set of objects from the bucket
func (*Client) DeleteObjectsWithContext ¶
func (c *Client) DeleteObjectsWithContext(ctx aws.Context, input *s3.DeleteObjectsInput, opts ...request.Option) (*s3.DeleteObjectsOutput, error)
DeleteObjectWithContext is the same as DeleteObject, but allows passing a context and options.
func (*Client) GetApiCount ¶
GetApiCount returns the number of invocations for the given API GetApiCount returns call. counts only for methods that are under GetApiCount returns test.
func (*Client) GetBucketLocationRequest ¶
func (c *Client) GetBucketLocationRequest(input *s3.GetBucketLocationInput) (req *request.Request, output *s3.GetBucketLocationOutput)
GetBucketLocationRequest implements the bucket location (Client.Region) request.
func (*Client) GetBucketLocationWithContext ¶
func (c *Client) GetBucketLocationWithContext(ctx aws.Context, input *s3.GetBucketLocationInput, opts ...request.Option) (*s3.GetBucketLocationOutput, error)
func (*Client) GetFile ¶
func (c *Client) GetFile(key string) (FileContent, bool)
GetFile returns the file contents and its metadata. Returns false if the file is not found.
func (*Client) GetFileContentBytes ¶
GetFileContentBytes returns the byte slice representation of the contents for key.
func (*Client) GetObject ¶
func (c *Client) GetObject(input *s3.GetObjectInput) (*s3.GetObjectOutput, error)
GetObject retrieves an object from the bucket.
func (*Client) GetObjectRequest ¶
func (c *Client) GetObjectRequest( input *s3.GetObjectInput) (req *request.Request, output *s3.GetObjectOutput)
GetObjectRequest is used by by s3manager (aws-sdk < 1.8.0) to downoad files. GetObjectRequest is used by GetObjectWithContext by s3manager (aws-sdk >= 1.8.0) to downoad files.
func (*Client) GetObjectWithContext ¶
func (c *Client) GetObjectWithContext( ctx aws.Context, input *s3.GetObjectInput, opts ...request.Option) (*s3.GetObjectOutput, error)
GetObjectWithContext is used within s3manager (aws-sdk >= 1.8.0) to downoad files, we leverage GetObjectRequest (from above) internally to do the work.
func (*Client) HeadObject ¶
func (c *Client) HeadObject( input *s3.HeadObjectInput) (output *s3.HeadObjectOutput, err error)
HeadObject is used in s3-loader to determine if an object in S3 and the local matching object are identical.
func (*Client) HeadObjectRequest ¶
func (c *Client) HeadObjectRequest(input *s3.HeadObjectInput) (req *request.Request, out *s3.HeadObjectOutput)
HeadObjectRequest creates an RPC request for HeadObject.
func (*Client) HeadObjectWithContext ¶
func (c *Client) HeadObjectWithContext( ctx aws.Context, input *s3.HeadObjectInput, opts ...request.Option) (output *s3.HeadObjectOutput, err error)
HeadObjectWithContext is the same as HeadObject, but allows passing a context and options.
func (*Client) ListObjectsV2 ¶
func (c *Client) ListObjectsV2(input *s3.ListObjectsV2Input) (*s3.ListObjectsV2Output, error)
ListObjectsV2 is used by DownloadDirTree to detemine all the files to download.
func (*Client) ListObjectsV2Request ¶
func (c *Client) ListObjectsV2Request( input *s3.ListObjectsV2Input) (req *request.Request, output *s3.ListObjectsV2Output)
ListObjectsV2Request implements the request variant of ListObjectsV2.
func (*Client) ListObjectsV2WithContext ¶
func (c *Client) ListObjectsV2WithContext( ctx aws.Context, input *s3.ListObjectsV2Input, opts ...request.Option) (*s3.ListObjectsV2Output, error)
ListObjectsV2WithContext is used by DownloadDirTree to detemine all the files to download.
func (*Client) MaxRetries ¶
MaxRetries returns the maximum number of retries permitted for operations using this client.
func (*Client) MustGetFile ¶
func (c *Client) MustGetFile(key string) FileContent
MustGetFile returns the file contents and its metadata. Crashes the process if the file is not found.
func (*Client) PutObject ¶
func (c *Client) PutObject(input *s3.PutObjectInput) (*s3.PutObjectOutput, error)
PutObject implements the corresponding s3iface.API method.
func (*Client) PutObjectAcl ¶
func (c *Client) PutObjectAcl(input *s3.PutObjectAclInput) (*s3.PutObjectAclOutput, error)
PutObjectAcl sets the ACL of an object already in the bucket.
func (*Client) PutObjectRequest ¶
func (c *Client) PutObjectRequest( input *s3.PutObjectInput) (req *request.Request, output *s3.PutObjectOutput)
PutObjectRequest is used within s3manager to upload single part files.
func (*Client) PutObjectWithContext ¶
func (c *Client) PutObjectWithContext(ctx aws.Context, input *s3.PutObjectInput, opts ...request.Option) (*s3.PutObjectOutput, error)
PutObjectWithContext implements the corresponding s3iface.API method.
func (*Client) SetFile ¶
SetFile updates the file contents and adds sha256 to its metadata if non-empty. TODO(swami): Replace with setFile and change all callers.
func (*Client) SetFileContentAt ¶
SetFileContentAt sets the file with the given content and adds sha256 to its metadata if non-empty. TODO(swami): Replace with setFileContentAt and change all callers.
func (*Client) UploadPartCopyRequest ¶
func (c *Client) UploadPartCopyRequest( input *s3.UploadPartCopyInput) (req *request.Request, output *s3.UploadPartCopyOutput)
UploadPartCopyRequest stubs the corresponding s3iface.API method.
func (*Client) UploadPartCopyWithContext ¶
func (c *Client) UploadPartCopyWithContext( ctx aws.Context, input *s3.UploadPartCopyInput, opts ...request.Option) ( *s3.UploadPartCopyOutput, error)
UploadPartCopyWithContext stubs the corresponding s3iface.API method.
func (*Client) UploadPartRequest ¶
func (c *Client) UploadPartRequest( input *s3.UploadPartInput) (req *request.Request, output *s3.UploadPartOutput)
UploadPartRequest stubs the corresponding s3iface.API method.
func (*Client) UploadPartWithContext ¶
func (c *Client) UploadPartWithContext( ctx aws.Context, input *s3.UploadPartInput, opts ...request.Option) ( *s3.UploadPartOutput, error)
UploadPartWithContext stubs the corresponding s3iface.API method.