s3manager-web/internal/app/s3manager/mocks/s3.go

509 lines
16 KiB
Go
Raw Normal View History

2018-08-02 15:45:38 +02:00
// Code generated by moq; DO NOT EDIT.
2018-04-24 22:35:21 +02:00
// github.com/matryer/moq
2018-08-12 15:13:07 +02:00
package mocks
2017-05-08 23:07:07 +02:00
import (
2021-08-05 11:44:40 +02:00
"context"
"github.com/cloudlena/s3manager/internal/app/s3manager"
"github.com/minio/minio-go/v7"
2022-03-24 08:46:21 +01:00
"io"
2023-08-20 14:03:02 +02:00
"net/url"
2022-03-24 08:46:21 +01:00
"sync"
2023-08-20 14:03:02 +02:00
"time"
2018-04-24 22:35:21 +02:00
)
2017-05-08 23:07:07 +02:00
2020-08-12 00:30:18 +02:00
// Ensure, that S3Mock does implement s3manager.S3.
// If this is not the case, regenerate this file with moq.
var _ s3manager.S3 = &S3Mock{}
2017-05-08 23:07:07 +02:00
2020-08-12 00:30:18 +02:00
// S3Mock is a mock implementation of s3manager.S3.
2018-04-24 22:35:21 +02:00
//
2022-08-04 22:30:04 +02:00
// func TestSomethingThatUsesS3(t *testing.T) {
2018-04-24 22:35:21 +02:00
//
2022-08-04 22:30:04 +02:00
// // make and configure a mocked s3manager.S3
// mockedS3 := &S3Mock{
// GetObjectFunc: func(ctx context.Context, bucketName string, objectName string, opts minio.GetObjectOptions) (*minio.Object, error) {
// panic("mock out the GetObject method")
// },
// ListBucketsFunc: func(ctx context.Context) ([]minio.BucketInfo, error) {
// panic("mock out the ListBuckets method")
// },
// ListObjectsFunc: func(ctx context.Context, bucketName string, opts minio.ListObjectsOptions) <-chan minio.ObjectInfo {
// panic("mock out the ListObjects method")
// },
// MakeBucketFunc: func(ctx context.Context, bucketName string, opts minio.MakeBucketOptions) error {
// panic("mock out the MakeBucket method")
// },
2023-08-20 14:03:02 +02:00
// PresignedGetObjectFunc: func(ctx context.Context, bucketName string, objectName string, expiry time.Duration, reqParams url.Values) (*url.URL, error) {
// panic("mock out the PresignedGetObject method")
// },
2022-08-04 22:30:04 +02:00
// PutObjectFunc: func(ctx context.Context, bucketName string, objectName string, reader io.Reader, objectSize int64, opts minio.PutObjectOptions) (minio.UploadInfo, error) {
// panic("mock out the PutObject method")
// },
// RemoveBucketFunc: func(ctx context.Context, bucketName string) error {
// panic("mock out the RemoveBucket method")
// },
// RemoveObjectFunc: func(ctx context.Context, bucketName string, objectName string, opts minio.RemoveObjectOptions) error {
// panic("mock out the RemoveObject method")
// },
// }
2018-04-24 22:35:21 +02:00
//
2022-08-04 22:30:04 +02:00
// // use mockedS3 in code that requires s3manager.S3
// // and then make assertions.
2018-04-24 22:35:21 +02:00
//
2022-08-04 22:30:04 +02:00
// }
2018-04-24 22:35:21 +02:00
type S3Mock struct {
// GetObjectFunc mocks the GetObject method.
2021-08-05 11:44:40 +02:00
GetObjectFunc func(ctx context.Context, bucketName string, objectName string, opts minio.GetObjectOptions) (*minio.Object, error)
2018-04-24 22:35:21 +02:00
// ListBucketsFunc mocks the ListBuckets method.
2021-08-05 11:44:40 +02:00
ListBucketsFunc func(ctx context.Context) ([]minio.BucketInfo, error)
2018-04-24 22:35:21 +02:00
2021-08-05 11:44:40 +02:00
// ListObjectsFunc mocks the ListObjects method.
ListObjectsFunc func(ctx context.Context, bucketName string, opts minio.ListObjectsOptions) <-chan minio.ObjectInfo
2018-04-24 22:35:21 +02:00
// MakeBucketFunc mocks the MakeBucket method.
2021-08-05 11:44:40 +02:00
MakeBucketFunc func(ctx context.Context, bucketName string, opts minio.MakeBucketOptions) error
2018-04-24 22:35:21 +02:00
2023-08-20 14:03:02 +02:00
// PresignedGetObjectFunc mocks the PresignedGetObject method.
PresignedGetObjectFunc func(ctx context.Context, bucketName string, objectName string, expiry time.Duration, reqParams url.Values) (*url.URL, error)
2018-04-24 22:35:21 +02:00
// PutObjectFunc mocks the PutObject method.
2021-08-05 11:44:40 +02:00
PutObjectFunc func(ctx context.Context, bucketName string, objectName string, reader io.Reader, objectSize int64, opts minio.PutObjectOptions) (minio.UploadInfo, error)
2018-04-24 22:35:21 +02:00
// RemoveBucketFunc mocks the RemoveBucket method.
2021-08-05 11:44:40 +02:00
RemoveBucketFunc func(ctx context.Context, bucketName string) error
2018-04-24 22:35:21 +02:00
// RemoveObjectFunc mocks the RemoveObject method.
2021-08-05 11:44:40 +02:00
RemoveObjectFunc func(ctx context.Context, bucketName string, objectName string, opts minio.RemoveObjectOptions) error
2018-04-24 22:35:21 +02:00
// calls tracks calls to the methods.
calls struct {
// GetObject holds details about calls to the GetObject method.
GetObject []struct {
2021-08-05 11:44:40 +02:00
// Ctx is the ctx argument value.
Ctx context.Context
2018-08-02 15:45:38 +02:00
// BucketName is the bucketName argument value.
BucketName string
// ObjectName is the objectName argument value.
ObjectName string
// Opts is the opts argument value.
Opts minio.GetObjectOptions
2018-04-24 22:35:21 +02:00
}
// ListBuckets holds details about calls to the ListBuckets method.
ListBuckets []struct {
2021-08-05 11:44:40 +02:00
// Ctx is the ctx argument value.
Ctx context.Context
2018-04-24 22:35:21 +02:00
}
2021-08-05 11:44:40 +02:00
// ListObjects holds details about calls to the ListObjects method.
ListObjects []struct {
// Ctx is the ctx argument value.
Ctx context.Context
2018-08-02 15:45:38 +02:00
// BucketName is the bucketName argument value.
BucketName string
2021-08-05 11:44:40 +02:00
// Opts is the opts argument value.
Opts minio.ListObjectsOptions
2018-04-24 22:35:21 +02:00
}
// MakeBucket holds details about calls to the MakeBucket method.
MakeBucket []struct {
2021-08-05 11:44:40 +02:00
// Ctx is the ctx argument value.
Ctx context.Context
2018-08-02 15:45:38 +02:00
// BucketName is the bucketName argument value.
BucketName string
2021-08-05 11:44:40 +02:00
// Opts is the opts argument value.
Opts minio.MakeBucketOptions
2018-04-24 22:35:21 +02:00
}
2023-08-20 14:03:02 +02:00
// PresignedGetObject holds details about calls to the PresignedGetObject method.
PresignedGetObject []struct {
// Ctx is the ctx argument value.
Ctx context.Context
// BucketName is the bucketName argument value.
BucketName string
// ObjectName is the objectName argument value.
ObjectName string
// Expiry is the expiry argument value.
Expiry time.Duration
// ReqParams is the reqParams argument value.
ReqParams url.Values
}
2018-04-24 22:35:21 +02:00
// PutObject holds details about calls to the PutObject method.
PutObject []struct {
2021-08-05 11:44:40 +02:00
// Ctx is the ctx argument value.
Ctx context.Context
2018-08-02 15:45:38 +02:00
// BucketName is the bucketName argument value.
BucketName string
// ObjectName is the objectName argument value.
ObjectName string
// Reader is the reader argument value.
Reader io.Reader
// ObjectSize is the objectSize argument value.
ObjectSize int64
// Opts is the opts argument value.
Opts minio.PutObjectOptions
2018-04-24 22:35:21 +02:00
}
// RemoveBucket holds details about calls to the RemoveBucket method.
RemoveBucket []struct {
2021-08-05 11:44:40 +02:00
// Ctx is the ctx argument value.
Ctx context.Context
2018-08-02 15:45:38 +02:00
// BucketName is the bucketName argument value.
BucketName string
2018-04-24 22:35:21 +02:00
}
// RemoveObject holds details about calls to the RemoveObject method.
RemoveObject []struct {
2021-08-05 11:44:40 +02:00
// Ctx is the ctx argument value.
Ctx context.Context
2018-08-02 15:45:38 +02:00
// BucketName is the bucketName argument value.
BucketName string
// ObjectName is the objectName argument value.
ObjectName string
2021-08-05 11:44:40 +02:00
// Opts is the opts argument value.
Opts minio.RemoveObjectOptions
2018-04-24 22:35:21 +02:00
}
}
2023-08-20 14:03:02 +02:00
lockGetObject sync.RWMutex
lockListBuckets sync.RWMutex
lockListObjects sync.RWMutex
lockMakeBucket sync.RWMutex
lockPresignedGetObject sync.RWMutex
lockPutObject sync.RWMutex
lockRemoveBucket sync.RWMutex
lockRemoveObject sync.RWMutex
2018-04-24 22:35:21 +02:00
}
// GetObject calls GetObjectFunc.
2021-08-05 11:44:40 +02:00
func (mock *S3Mock) GetObject(ctx context.Context, bucketName string, objectName string, opts minio.GetObjectOptions) (*minio.Object, error) {
2018-04-24 22:35:21 +02:00
if mock.GetObjectFunc == nil {
2018-08-02 15:45:38 +02:00
panic("S3Mock.GetObjectFunc: method is nil but S3.GetObject was just called")
2018-04-24 22:35:21 +02:00
}
callInfo := struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-08-02 15:45:38 +02:00
BucketName string
ObjectName string
Opts minio.GetObjectOptions
2018-04-24 22:35:21 +02:00
}{
2021-08-05 11:44:40 +02:00
Ctx: ctx,
2018-08-02 15:45:38 +02:00
BucketName: bucketName,
ObjectName: objectName,
Opts: opts,
2018-04-24 22:35:21 +02:00
}
2020-08-12 00:30:18 +02:00
mock.lockGetObject.Lock()
2018-04-24 22:35:21 +02:00
mock.calls.GetObject = append(mock.calls.GetObject, callInfo)
2020-08-12 00:30:18 +02:00
mock.lockGetObject.Unlock()
2021-08-05 11:44:40 +02:00
return mock.GetObjectFunc(ctx, bucketName, objectName, opts)
2017-05-08 23:07:07 +02:00
}
2018-04-24 22:35:21 +02:00
// GetObjectCalls gets all the calls that were made to GetObject.
// Check the length with:
2022-08-04 22:30:04 +02:00
//
// len(mockedS3.GetObjectCalls())
2018-04-24 22:35:21 +02:00
func (mock *S3Mock) GetObjectCalls() []struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-08-02 15:45:38 +02:00
BucketName string
ObjectName string
Opts minio.GetObjectOptions
2018-04-24 22:35:21 +02:00
} {
var calls []struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-08-02 15:45:38 +02:00
BucketName string
ObjectName string
Opts minio.GetObjectOptions
2017-05-08 23:07:07 +02:00
}
2020-08-12 00:30:18 +02:00
mock.lockGetObject.RLock()
2018-04-24 22:35:21 +02:00
calls = mock.calls.GetObject
2020-08-12 00:30:18 +02:00
mock.lockGetObject.RUnlock()
2018-04-24 22:35:21 +02:00
return calls
}
2017-05-08 23:07:07 +02:00
2018-04-24 22:35:21 +02:00
// ListBuckets calls ListBucketsFunc.
2021-08-05 11:44:40 +02:00
func (mock *S3Mock) ListBuckets(ctx context.Context) ([]minio.BucketInfo, error) {
2018-04-24 22:35:21 +02:00
if mock.ListBucketsFunc == nil {
2018-08-02 15:45:38 +02:00
panic("S3Mock.ListBucketsFunc: method is nil but S3.ListBuckets was just called")
2018-04-24 22:35:21 +02:00
}
callInfo := struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
}{
Ctx: ctx,
}
2020-08-12 00:30:18 +02:00
mock.lockListBuckets.Lock()
2018-04-24 22:35:21 +02:00
mock.calls.ListBuckets = append(mock.calls.ListBuckets, callInfo)
2020-08-12 00:30:18 +02:00
mock.lockListBuckets.Unlock()
2021-08-05 11:44:40 +02:00
return mock.ListBucketsFunc(ctx)
2017-05-08 23:07:07 +02:00
}
2018-04-24 22:35:21 +02:00
// ListBucketsCalls gets all the calls that were made to ListBuckets.
// Check the length with:
2022-08-04 22:30:04 +02:00
//
// len(mockedS3.ListBucketsCalls())
2018-04-24 22:35:21 +02:00
func (mock *S3Mock) ListBucketsCalls() []struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-04-24 22:35:21 +02:00
} {
var calls []struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-04-24 22:35:21 +02:00
}
2020-08-12 00:30:18 +02:00
mock.lockListBuckets.RLock()
2018-04-24 22:35:21 +02:00
calls = mock.calls.ListBuckets
2020-08-12 00:30:18 +02:00
mock.lockListBuckets.RUnlock()
2018-04-24 22:35:21 +02:00
return calls
2017-05-08 23:07:07 +02:00
}
2021-08-05 11:44:40 +02:00
// ListObjects calls ListObjectsFunc.
func (mock *S3Mock) ListObjects(ctx context.Context, bucketName string, opts minio.ListObjectsOptions) <-chan minio.ObjectInfo {
if mock.ListObjectsFunc == nil {
panic("S3Mock.ListObjectsFunc: method is nil but S3.ListObjects was just called")
2018-04-24 22:35:21 +02:00
}
callInfo := struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
BucketName string
Opts minio.ListObjectsOptions
2018-04-24 22:35:21 +02:00
}{
2021-08-05 11:44:40 +02:00
Ctx: ctx,
BucketName: bucketName,
Opts: opts,
2017-05-08 23:07:07 +02:00
}
2021-08-05 11:44:40 +02:00
mock.lockListObjects.Lock()
mock.calls.ListObjects = append(mock.calls.ListObjects, callInfo)
mock.lockListObjects.Unlock()
return mock.ListObjectsFunc(ctx, bucketName, opts)
2018-04-24 22:35:21 +02:00
}
2017-05-08 23:07:07 +02:00
2021-08-05 11:44:40 +02:00
// ListObjectsCalls gets all the calls that were made to ListObjects.
2018-04-24 22:35:21 +02:00
// Check the length with:
2022-08-04 22:30:04 +02:00
//
// len(mockedS3.ListObjectsCalls())
2021-08-05 11:44:40 +02:00
func (mock *S3Mock) ListObjectsCalls() []struct {
Ctx context.Context
BucketName string
Opts minio.ListObjectsOptions
2018-04-24 22:35:21 +02:00
} {
var calls []struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
BucketName string
Opts minio.ListObjectsOptions
2017-05-08 23:07:07 +02:00
}
2021-08-05 11:44:40 +02:00
mock.lockListObjects.RLock()
calls = mock.calls.ListObjects
mock.lockListObjects.RUnlock()
2018-04-24 22:35:21 +02:00
return calls
}
2017-05-08 23:07:07 +02:00
2018-04-24 22:35:21 +02:00
// MakeBucket calls MakeBucketFunc.
2021-08-05 11:44:40 +02:00
func (mock *S3Mock) MakeBucket(ctx context.Context, bucketName string, opts minio.MakeBucketOptions) error {
2018-04-24 22:35:21 +02:00
if mock.MakeBucketFunc == nil {
2018-08-02 15:45:38 +02:00
panic("S3Mock.MakeBucketFunc: method is nil but S3.MakeBucket was just called")
2018-04-24 22:35:21 +02:00
}
callInfo := struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-08-02 15:45:38 +02:00
BucketName string
2021-08-05 11:44:40 +02:00
Opts minio.MakeBucketOptions
2018-04-24 22:35:21 +02:00
}{
2021-08-05 11:44:40 +02:00
Ctx: ctx,
2018-08-02 15:45:38 +02:00
BucketName: bucketName,
2021-08-05 11:44:40 +02:00
Opts: opts,
2017-05-08 23:07:07 +02:00
}
2020-08-12 00:30:18 +02:00
mock.lockMakeBucket.Lock()
2018-04-24 22:35:21 +02:00
mock.calls.MakeBucket = append(mock.calls.MakeBucket, callInfo)
2020-08-12 00:30:18 +02:00
mock.lockMakeBucket.Unlock()
2021-08-05 11:44:40 +02:00
return mock.MakeBucketFunc(ctx, bucketName, opts)
2018-04-24 22:35:21 +02:00
}
2017-05-08 23:07:07 +02:00
2018-04-24 22:35:21 +02:00
// MakeBucketCalls gets all the calls that were made to MakeBucket.
// Check the length with:
2022-08-04 22:30:04 +02:00
//
// len(mockedS3.MakeBucketCalls())
2018-04-24 22:35:21 +02:00
func (mock *S3Mock) MakeBucketCalls() []struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-08-02 15:45:38 +02:00
BucketName string
2021-08-05 11:44:40 +02:00
Opts minio.MakeBucketOptions
2018-04-24 22:35:21 +02:00
} {
var calls []struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-08-02 15:45:38 +02:00
BucketName string
2021-08-05 11:44:40 +02:00
Opts minio.MakeBucketOptions
2018-04-24 22:35:21 +02:00
}
2020-08-12 00:30:18 +02:00
mock.lockMakeBucket.RLock()
2018-04-24 22:35:21 +02:00
calls = mock.calls.MakeBucket
2020-08-12 00:30:18 +02:00
mock.lockMakeBucket.RUnlock()
2018-04-24 22:35:21 +02:00
return calls
}
2017-05-08 23:07:07 +02:00
2023-08-20 14:03:02 +02:00
// PresignedGetObject calls PresignedGetObjectFunc.
func (mock *S3Mock) PresignedGetObject(ctx context.Context, bucketName string, objectName string, expiry time.Duration, reqParams url.Values) (*url.URL, error) {
if mock.PresignedGetObjectFunc == nil {
panic("S3Mock.PresignedGetObjectFunc: method is nil but S3.PresignedGetObject was just called")
}
callInfo := struct {
Ctx context.Context
BucketName string
ObjectName string
Expiry time.Duration
ReqParams url.Values
}{
Ctx: ctx,
BucketName: bucketName,
ObjectName: objectName,
Expiry: expiry,
ReqParams: reqParams,
}
mock.lockPresignedGetObject.Lock()
mock.calls.PresignedGetObject = append(mock.calls.PresignedGetObject, callInfo)
mock.lockPresignedGetObject.Unlock()
return mock.PresignedGetObjectFunc(ctx, bucketName, objectName, expiry, reqParams)
}
// PresignedGetObjectCalls gets all the calls that were made to PresignedGetObject.
// Check the length with:
//
// len(mockedS3.PresignedGetObjectCalls())
func (mock *S3Mock) PresignedGetObjectCalls() []struct {
Ctx context.Context
BucketName string
ObjectName string
Expiry time.Duration
ReqParams url.Values
} {
var calls []struct {
Ctx context.Context
BucketName string
ObjectName string
Expiry time.Duration
ReqParams url.Values
}
mock.lockPresignedGetObject.RLock()
calls = mock.calls.PresignedGetObject
mock.lockPresignedGetObject.RUnlock()
return calls
}
2018-04-24 22:35:21 +02:00
// PutObject calls PutObjectFunc.
2021-08-05 11:44:40 +02:00
func (mock *S3Mock) PutObject(ctx context.Context, bucketName string, objectName string, reader io.Reader, objectSize int64, opts minio.PutObjectOptions) (minio.UploadInfo, error) {
2018-04-24 22:35:21 +02:00
if mock.PutObjectFunc == nil {
2018-08-02 15:45:38 +02:00
panic("S3Mock.PutObjectFunc: method is nil but S3.PutObject was just called")
2017-05-08 23:07:07 +02:00
}
2018-04-24 22:35:21 +02:00
callInfo := struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-08-02 15:45:38 +02:00
BucketName string
ObjectName string
Reader io.Reader
ObjectSize int64
Opts minio.PutObjectOptions
2018-04-24 22:35:21 +02:00
}{
2021-08-05 11:44:40 +02:00
Ctx: ctx,
2018-08-02 15:45:38 +02:00
BucketName: bucketName,
ObjectName: objectName,
Reader: reader,
ObjectSize: objectSize,
Opts: opts,
2018-04-24 22:35:21 +02:00
}
2020-08-12 00:30:18 +02:00
mock.lockPutObject.Lock()
2018-04-24 22:35:21 +02:00
mock.calls.PutObject = append(mock.calls.PutObject, callInfo)
2020-08-12 00:30:18 +02:00
mock.lockPutObject.Unlock()
2021-08-05 11:44:40 +02:00
return mock.PutObjectFunc(ctx, bucketName, objectName, reader, objectSize, opts)
2018-04-24 22:35:21 +02:00
}
2017-05-08 23:07:07 +02:00
2018-04-24 22:35:21 +02:00
// PutObjectCalls gets all the calls that were made to PutObject.
// Check the length with:
2022-08-04 22:30:04 +02:00
//
// len(mockedS3.PutObjectCalls())
2018-04-24 22:35:21 +02:00
func (mock *S3Mock) PutObjectCalls() []struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-08-02 15:45:38 +02:00
BucketName string
ObjectName string
Reader io.Reader
ObjectSize int64
Opts minio.PutObjectOptions
2018-04-24 22:35:21 +02:00
} {
var calls []struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-08-02 15:45:38 +02:00
BucketName string
ObjectName string
Reader io.Reader
ObjectSize int64
Opts minio.PutObjectOptions
2018-04-24 22:35:21 +02:00
}
2020-08-12 00:30:18 +02:00
mock.lockPutObject.RLock()
2018-04-24 22:35:21 +02:00
calls = mock.calls.PutObject
2020-08-12 00:30:18 +02:00
mock.lockPutObject.RUnlock()
2018-04-24 22:35:21 +02:00
return calls
2017-05-08 23:07:07 +02:00
}
2018-04-24 22:35:21 +02:00
// RemoveBucket calls RemoveBucketFunc.
2021-08-05 11:44:40 +02:00
func (mock *S3Mock) RemoveBucket(ctx context.Context, bucketName string) error {
2018-04-24 22:35:21 +02:00
if mock.RemoveBucketFunc == nil {
2018-08-02 15:45:38 +02:00
panic("S3Mock.RemoveBucketFunc: method is nil but S3.RemoveBucket was just called")
2018-04-24 22:35:21 +02:00
}
callInfo := struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-08-02 15:45:38 +02:00
BucketName string
2018-04-24 22:35:21 +02:00
}{
2021-08-05 11:44:40 +02:00
Ctx: ctx,
2018-08-02 15:45:38 +02:00
BucketName: bucketName,
2018-04-24 22:35:21 +02:00
}
2020-08-12 00:30:18 +02:00
mock.lockRemoveBucket.Lock()
2018-04-24 22:35:21 +02:00
mock.calls.RemoveBucket = append(mock.calls.RemoveBucket, callInfo)
2020-08-12 00:30:18 +02:00
mock.lockRemoveBucket.Unlock()
2021-08-05 11:44:40 +02:00
return mock.RemoveBucketFunc(ctx, bucketName)
2017-05-08 23:07:07 +02:00
}
2018-04-24 22:35:21 +02:00
// RemoveBucketCalls gets all the calls that were made to RemoveBucket.
// Check the length with:
2022-08-04 22:30:04 +02:00
//
// len(mockedS3.RemoveBucketCalls())
2018-04-24 22:35:21 +02:00
func (mock *S3Mock) RemoveBucketCalls() []struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-08-02 15:45:38 +02:00
BucketName string
2018-04-24 22:35:21 +02:00
} {
var calls []struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-08-02 15:45:38 +02:00
BucketName string
2018-04-24 22:35:21 +02:00
}
2020-08-12 00:30:18 +02:00
mock.lockRemoveBucket.RLock()
2018-04-24 22:35:21 +02:00
calls = mock.calls.RemoveBucket
2020-08-12 00:30:18 +02:00
mock.lockRemoveBucket.RUnlock()
2018-04-24 22:35:21 +02:00
return calls
2017-05-08 23:07:07 +02:00
}
2018-04-24 22:35:21 +02:00
// RemoveObject calls RemoveObjectFunc.
2021-08-05 11:44:40 +02:00
func (mock *S3Mock) RemoveObject(ctx context.Context, bucketName string, objectName string, opts minio.RemoveObjectOptions) error {
2018-04-24 22:35:21 +02:00
if mock.RemoveObjectFunc == nil {
2018-08-02 15:45:38 +02:00
panic("S3Mock.RemoveObjectFunc: method is nil but S3.RemoveObject was just called")
2018-04-24 22:35:21 +02:00
}
callInfo := struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-08-02 15:45:38 +02:00
BucketName string
ObjectName string
2021-08-05 11:44:40 +02:00
Opts minio.RemoveObjectOptions
2018-04-24 22:35:21 +02:00
}{
2021-08-05 11:44:40 +02:00
Ctx: ctx,
2018-08-02 15:45:38 +02:00
BucketName: bucketName,
ObjectName: objectName,
2021-08-05 11:44:40 +02:00
Opts: opts,
2018-04-24 22:35:21 +02:00
}
2020-08-12 00:30:18 +02:00
mock.lockRemoveObject.Lock()
2018-04-24 22:35:21 +02:00
mock.calls.RemoveObject = append(mock.calls.RemoveObject, callInfo)
2020-08-12 00:30:18 +02:00
mock.lockRemoveObject.Unlock()
2021-08-05 11:44:40 +02:00
return mock.RemoveObjectFunc(ctx, bucketName, objectName, opts)
2017-05-08 23:07:07 +02:00
}
2018-04-24 22:35:21 +02:00
// RemoveObjectCalls gets all the calls that were made to RemoveObject.
// Check the length with:
2022-08-04 22:30:04 +02:00
//
// len(mockedS3.RemoveObjectCalls())
2018-04-24 22:35:21 +02:00
func (mock *S3Mock) RemoveObjectCalls() []struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-08-02 15:45:38 +02:00
BucketName string
ObjectName string
2021-08-05 11:44:40 +02:00
Opts minio.RemoveObjectOptions
2018-04-24 22:35:21 +02:00
} {
var calls []struct {
2021-08-05 11:44:40 +02:00
Ctx context.Context
2018-08-02 15:45:38 +02:00
BucketName string
ObjectName string
2021-08-05 11:44:40 +02:00
Opts minio.RemoveObjectOptions
2018-04-24 22:35:21 +02:00
}
2020-08-12 00:30:18 +02:00
mock.lockRemoveObject.RLock()
2018-04-24 22:35:21 +02:00
calls = mock.calls.RemoveObject
2020-08-12 00:30:18 +02:00
mock.lockRemoveObject.RUnlock()
2018-04-24 22:35:21 +02:00
return calls
2017-05-08 23:07:07 +02:00
}