feat(domain,storage/s3):lab4 add ObjectStorage.Ping
This commit is contained in:
@@ -45,6 +45,11 @@ func New(ctx context.Context, cfg Config) (*MinioStorage, error) {
|
||||
return &MinioStorage{client: client, bucket: cfg.Bucket}, nil
|
||||
}
|
||||
|
||||
func (s *MinioStorage) Ping(ctx context.Context) error {
|
||||
_, err := s.client.BucketExists(ctx, s.bucket)
|
||||
return mapError(err)
|
||||
}
|
||||
|
||||
func (s *MinioStorage) Put(ctx context.Context, key string, r io.Reader, size int64, contentType string) error {
|
||||
_, err := s.client.PutObject(ctx, s.bucket, key, r, size, minio.PutObjectOptions{
|
||||
ContentType: contentType,
|
||||
|
||||
Reference in New Issue
Block a user