Skip to content

Commit

Permalink
aws
Browse files Browse the repository at this point in the history
  • Loading branch information
mstgnz committed Dec 29, 2024
1 parent be384f1 commit 6a0e2e9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions service/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type AwsService interface {
ListBuckets() ([]types.Bucket, error)
BucketExists(bucketName string) bool
DeleteObjects(bucketName string, objectKeys []string) error
IsConnected() bool
}

type awsService struct {
Expand Down Expand Up @@ -99,3 +100,9 @@ func (as *awsService) GlacierUploadArchive(vaultName string, fileBuffer []byte)
Body: bytes.NewReader(fileBuffer),
})
}

func (a *awsService) IsConnected() bool {
client := s3.NewFromConfig(a.cfg)
_, err := client.ListBuckets(context.TODO(), &s3.ListBucketsInput{})
return err == nil
}

0 comments on commit 6a0e2e9

Please sign in to comment.