Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(client): remove ListObjectVersions method #188

Merged
merged 1 commit into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions pkg/client/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ type IS3 interface {
objects []types.ObjectIdentifier,
region string,
) ([]types.Error, error)
ListObjectVersions(ctx context.Context,
bucketName *string,
region string,
oldVersionsOnly bool,
) ([]types.ObjectIdentifier, error)
ListObjectVersionsByPage(
ctx context.Context,
bucketName *string,
Expand Down Expand Up @@ -157,51 +152,6 @@ func (s *S3) DeleteObjects(
return errors, nil
}

func (s *S3) ListObjectVersions(
ctx context.Context,
bucketName *string,
region string,
oldVersionsOnly bool,
) ([]types.ObjectIdentifier, error) {
var keyMarker *string
var versionIdMarker *string
objectIdentifiers := []types.ObjectIdentifier{}

for {
select {
case <-ctx.Done():
return objectIdentifiers, &ClientError{
ResourceName: bucketName,
Err: ctx.Err(),
}
default:
}

objectIdentifiersByPage, nextKeyMarker, nextVersionIdMarker, err :=
s.ListObjectVersionsByPage(
ctx,
bucketName,
region,
oldVersionsOnly,
keyMarker,
versionIdMarker,
)
if err != nil {
return nil, err // ListObjectVersionsByPage already wraps the error
}

objectIdentifiers = append(objectIdentifiers, objectIdentifiersByPage...)
keyMarker = nextKeyMarker
versionIdMarker = nextVersionIdMarker

if keyMarker == nil && versionIdMarker == nil {
break
}
}

return objectIdentifiers, nil
}

func (s *S3) ListObjectVersionsByPage(
ctx context.Context,
bucketName *string,
Expand Down
15 changes: 0 additions & 15 deletions pkg/client/s3_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading