2021-04-19 03:41:13 +08:00
|
|
|
// Copyright (c) 2015-2021 MinIO, Inc.
|
|
|
|
//
|
|
|
|
// This file is part of MinIO Object Storage stack
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2017-03-17 03:21:58 +08:00
|
|
|
|
|
|
|
package cmd
|
|
|
|
|
2017-10-22 13:30:34 +08:00
|
|
|
import (
|
2018-03-15 09:36:54 +08:00
|
|
|
"context"
|
2019-11-14 04:17:45 +08:00
|
|
|
"errors"
|
2017-11-23 04:12:10 +08:00
|
|
|
|
2021-06-02 05:59:40 +08:00
|
|
|
"github.com/minio/minio/internal/logger"
|
2020-02-05 17:42:34 +08:00
|
|
|
|
2020-07-15 00:38:05 +08:00
|
|
|
"github.com/minio/minio-go/v7/pkg/tags"
|
2021-06-02 05:59:40 +08:00
|
|
|
bucketsse "github.com/minio/minio/internal/bucket/encryption"
|
|
|
|
"github.com/minio/minio/internal/bucket/lifecycle"
|
|
|
|
"github.com/minio/minio/internal/bucket/versioning"
|
2021-05-30 12:16:42 +08:00
|
|
|
"github.com/minio/pkg/bucket/policy"
|
2020-02-05 17:42:34 +08:00
|
|
|
|
2021-05-06 23:52:02 +08:00
|
|
|
"github.com/minio/madmin-go"
|
2017-10-22 13:30:34 +08:00
|
|
|
)
|
2017-10-10 07:41:35 +08:00
|
|
|
|
2017-12-06 09:58:09 +08:00
|
|
|
// GatewayUnsupported list of unsupported call stubs for gateway.
|
|
|
|
type GatewayUnsupported struct{}
|
2017-10-10 07:41:35 +08:00
|
|
|
|
2020-12-22 01:35:19 +08:00
|
|
|
// BackendInfo returns the underlying backend information
|
2021-03-05 06:36:23 +08:00
|
|
|
func (a GatewayUnsupported) BackendInfo() madmin.BackendInfo {
|
|
|
|
return madmin.BackendInfo{Type: madmin.Gateway}
|
2020-12-22 01:35:19 +08:00
|
|
|
}
|
|
|
|
|
2021-03-03 09:28:04 +08:00
|
|
|
// LocalStorageInfo returns the local disks information, mainly used
|
|
|
|
// in prometheus - for gateway this just a no-op
|
|
|
|
func (a GatewayUnsupported) LocalStorageInfo(ctx context.Context) (StorageInfo, []error) {
|
|
|
|
logger.CriticalIf(ctx, errors.New("not implemented"))
|
|
|
|
return StorageInfo{}, nil
|
|
|
|
}
|
|
|
|
|
2021-02-27 07:11:42 +08:00
|
|
|
// NSScanner - scanner is not implemented for gateway
|
2022-04-07 23:10:40 +08:00
|
|
|
func (a GatewayUnsupported) NSScanner(ctx context.Context, bf *bloomFilter, updates chan<- DataUsageInfo, wantCycle uint32, scanMode madmin.HealScanMode) error {
|
2020-01-22 06:07:49 +08:00
|
|
|
logger.CriticalIf(ctx, errors.New("not implemented"))
|
2020-03-19 07:19:29 +08:00
|
|
|
return NotImplemented{}
|
2020-01-22 06:07:49 +08:00
|
|
|
}
|
|
|
|
|
2021-04-05 04:32:31 +08:00
|
|
|
// PutObjectMetadata - not implemented for gateway.
|
|
|
|
func (a GatewayUnsupported) PutObjectMetadata(ctx context.Context, bucket, object string, opts ObjectOptions) (ObjectInfo, error) {
|
|
|
|
logger.CriticalIf(ctx, errors.New("not implemented"))
|
|
|
|
return ObjectInfo{}, NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2019-11-14 04:17:45 +08:00
|
|
|
// NewNSLock is a dummy stub for gateway.
|
2020-11-05 00:25:42 +08:00
|
|
|
func (a GatewayUnsupported) NewNSLock(bucket string, objects ...string) RWLocker {
|
|
|
|
logger.CriticalIf(context.Background(), errors.New("not implemented"))
|
2019-11-14 04:17:45 +08:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-01-23 04:09:24 +08:00
|
|
|
// SetDriveCounts no-op
|
|
|
|
func (a GatewayUnsupported) SetDriveCounts() []int {
|
|
|
|
return nil
|
2020-08-06 04:31:12 +08:00
|
|
|
}
|
|
|
|
|
2017-11-23 04:12:10 +08:00
|
|
|
// ListMultipartUploads lists all multipart uploads.
|
2018-03-15 09:36:54 +08:00
|
|
|
func (a GatewayUnsupported) ListMultipartUploads(ctx context.Context, bucket string, prefix string, keyMarker string, uploadIDMarker string, delimiter string, maxUploads int) (lmi ListMultipartsInfo, err error) {
|
2018-04-06 06:04:40 +08:00
|
|
|
return lmi, NotImplemented{}
|
2017-11-23 04:12:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewMultipartUpload upload object in multiple parts
|
2019-02-09 13:31:06 +08:00
|
|
|
func (a GatewayUnsupported) NewMultipartUpload(ctx context.Context, bucket string, object string, opts ObjectOptions) (uploadID string, err error) {
|
2018-04-06 06:04:40 +08:00
|
|
|
return "", NotImplemented{}
|
2017-11-23 04:12:10 +08:00
|
|
|
}
|
|
|
|
|
2018-01-23 06:54:55 +08:00
|
|
|
// CopyObjectPart copy part of object to uploadID for another object
|
2018-09-11 00:42:43 +08:00
|
|
|
func (a GatewayUnsupported) CopyObjectPart(ctx context.Context, srcBucket, srcObject, destBucket, destObject, uploadID string, partID int, startOffset, length int64, srcInfo ObjectInfo, srcOpts, dstOpts ObjectOptions) (pi PartInfo, err error) {
|
2018-04-06 06:04:40 +08:00
|
|
|
return pi, NotImplemented{}
|
2017-12-06 09:58:09 +08:00
|
|
|
}
|
|
|
|
|
2017-11-23 04:12:10 +08:00
|
|
|
// PutObjectPart puts a part of object in bucket
|
2018-11-15 09:36:41 +08:00
|
|
|
func (a GatewayUnsupported) PutObjectPart(ctx context.Context, bucket string, object string, uploadID string, partID int, data *PutObjReader, opts ObjectOptions) (pi PartInfo, err error) {
|
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
2018-04-06 06:04:40 +08:00
|
|
|
return pi, NotImplemented{}
|
2017-11-23 04:12:10 +08:00
|
|
|
}
|
|
|
|
|
2020-05-29 03:36:20 +08:00
|
|
|
// GetMultipartInfo returns metadata associated with the uploadId
|
|
|
|
func (a GatewayUnsupported) GetMultipartInfo(ctx context.Context, bucket string, object string, uploadID string, opts ObjectOptions) (MultipartInfo, error) {
|
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
|
|
|
return MultipartInfo{}, NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2020-06-13 11:04:01 +08:00
|
|
|
// ListObjectVersions returns all object parts for specified object in specified bucket
|
|
|
|
func (a GatewayUnsupported) ListObjectVersions(ctx context.Context, bucket, prefix, marker, versionMarker, delimiter string, maxKeys int) (ListObjectVersionsInfo, error) {
|
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
|
|
|
return ListObjectVersionsInfo{}, NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2017-11-23 04:12:10 +08:00
|
|
|
// ListObjectParts returns all object parts for specified object in specified bucket
|
2019-01-06 06:16:43 +08:00
|
|
|
func (a GatewayUnsupported) ListObjectParts(ctx context.Context, bucket string, object string, uploadID string, partNumberMarker int, maxParts int, opts ObjectOptions) (lpi ListPartsInfo, err error) {
|
2018-04-06 06:04:40 +08:00
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
|
|
|
return lpi, NotImplemented{}
|
2017-11-23 04:12:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// AbortMultipartUpload aborts a ongoing multipart upload
|
2020-09-15 06:57:13 +08:00
|
|
|
func (a GatewayUnsupported) AbortMultipartUpload(ctx context.Context, bucket string, object string, uploadID string, opts ObjectOptions) error {
|
2018-04-06 06:04:40 +08:00
|
|
|
return NotImplemented{}
|
2017-11-23 04:12:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// CompleteMultipartUpload completes ongoing multipart upload and finalizes object
|
2018-11-15 09:36:41 +08:00
|
|
|
func (a GatewayUnsupported) CompleteMultipartUpload(ctx context.Context, bucket string, object string, uploadID string, uploadedParts []CompletePart, opts ObjectOptions) (oi ObjectInfo, err error) {
|
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
2018-04-06 06:04:40 +08:00
|
|
|
return oi, NotImplemented{}
|
2017-11-23 04:12:10 +08:00
|
|
|
}
|
|
|
|
|
2018-02-10 07:19:30 +08:00
|
|
|
// SetBucketPolicy sets policy on bucket
|
2018-04-25 06:53:30 +08:00
|
|
|
func (a GatewayUnsupported) SetBucketPolicy(ctx context.Context, bucket string, bucketPolicy *policy.Policy) error {
|
2018-04-06 06:04:40 +08:00
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
|
|
|
return NotImplemented{}
|
2017-11-23 04:12:10 +08:00
|
|
|
}
|
|
|
|
|
2018-02-10 07:19:30 +08:00
|
|
|
// GetBucketPolicy will get policy on bucket
|
2018-04-25 06:53:30 +08:00
|
|
|
func (a GatewayUnsupported) GetBucketPolicy(ctx context.Context, bucket string) (bucketPolicy *policy.Policy, err error) {
|
|
|
|
return nil, NotImplemented{}
|
2017-11-23 04:12:10 +08:00
|
|
|
}
|
|
|
|
|
2018-02-10 07:19:30 +08:00
|
|
|
// DeleteBucketPolicy deletes all policies on bucket
|
2018-03-15 09:36:54 +08:00
|
|
|
func (a GatewayUnsupported) DeleteBucketPolicy(ctx context.Context, bucket string) error {
|
2018-04-06 06:04:40 +08:00
|
|
|
return NotImplemented{}
|
2017-11-26 03:58:29 +08:00
|
|
|
}
|
|
|
|
|
2020-06-13 11:04:01 +08:00
|
|
|
// SetBucketVersioning enables versioning on a bucket.
|
|
|
|
func (a GatewayUnsupported) SetBucketVersioning(ctx context.Context, bucket string, v *versioning.Versioning) error {
|
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
|
|
|
return NotImplemented{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetBucketVersioning retrieves versioning configuration of a bucket.
|
|
|
|
func (a GatewayUnsupported) GetBucketVersioning(ctx context.Context, bucket string) (*versioning.Versioning, error) {
|
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
|
|
|
return nil, NotImplemented{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetBucketLifecycle enables lifecycle policies on a bucket.
|
2019-07-20 04:20:33 +08:00
|
|
|
func (a GatewayUnsupported) SetBucketLifecycle(ctx context.Context, bucket string, lifecycle *lifecycle.Lifecycle) error {
|
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
|
|
|
return NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2020-06-13 11:04:01 +08:00
|
|
|
// GetBucketLifecycle retrieves lifecycle configuration of a bucket.
|
2019-07-20 04:20:33 +08:00
|
|
|
func (a GatewayUnsupported) GetBucketLifecycle(ctx context.Context, bucket string) (*lifecycle.Lifecycle, error) {
|
|
|
|
return nil, NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2020-06-13 11:04:01 +08:00
|
|
|
// DeleteBucketLifecycle deletes all lifecycle policies on a bucket
|
2019-07-20 04:20:33 +08:00
|
|
|
func (a GatewayUnsupported) DeleteBucketLifecycle(ctx context.Context, bucket string) error {
|
|
|
|
return NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2020-06-13 11:04:01 +08:00
|
|
|
// GetBucketSSEConfig returns bucket encryption config on a bucket
|
2020-02-05 17:42:34 +08:00
|
|
|
func (a GatewayUnsupported) GetBucketSSEConfig(ctx context.Context, bucket string) (*bucketsse.BucketSSEConfig, error) {
|
|
|
|
return nil, NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2020-06-13 11:04:01 +08:00
|
|
|
// SetBucketSSEConfig sets bucket encryption config on a bucket
|
2020-02-05 17:42:34 +08:00
|
|
|
func (a GatewayUnsupported) SetBucketSSEConfig(ctx context.Context, bucket string, config *bucketsse.BucketSSEConfig) error {
|
|
|
|
return NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2020-06-13 11:04:01 +08:00
|
|
|
// DeleteBucketSSEConfig deletes bucket encryption config on a bucket
|
2020-02-05 17:42:34 +08:00
|
|
|
func (a GatewayUnsupported) DeleteBucketSSEConfig(ctx context.Context, bucket string) error {
|
|
|
|
return NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2018-02-16 09:45:57 +08:00
|
|
|
// HealFormat - Not implemented stub
|
2018-03-15 09:36:54 +08:00
|
|
|
func (a GatewayUnsupported) HealFormat(ctx context.Context, dryRun bool) (madmin.HealResultItem, error) {
|
2018-04-06 06:04:40 +08:00
|
|
|
return madmin.HealResultItem{}, NotImplemented{}
|
2018-02-16 09:45:57 +08:00
|
|
|
}
|
|
|
|
|
2017-12-06 09:58:09 +08:00
|
|
|
// HealBucket - Not implemented stub
|
2020-12-14 03:57:08 +08:00
|
|
|
func (a GatewayUnsupported) HealBucket(ctx context.Context, bucket string, opts madmin.HealOpts) (madmin.HealResultItem, error) {
|
2019-02-11 11:53:13 +08:00
|
|
|
return madmin.HealResultItem{}, NotImplemented{}
|
2017-03-17 03:21:58 +08:00
|
|
|
}
|
|
|
|
|
2017-12-06 09:58:09 +08:00
|
|
|
// HealObject - Not implemented stub
|
2020-06-13 11:04:01 +08:00
|
|
|
func (a GatewayUnsupported) HealObject(ctx context.Context, bucket, object, versionID string, opts madmin.HealOpts) (h madmin.HealResultItem, e error) {
|
2018-04-06 06:04:40 +08:00
|
|
|
return h, NotImplemented{}
|
2017-03-17 03:21:58 +08:00
|
|
|
}
|
|
|
|
|
2017-12-06 09:58:09 +08:00
|
|
|
// ListObjectsV2 - Not implemented stub
|
2018-03-15 09:36:54 +08:00
|
|
|
func (a GatewayUnsupported) ListObjectsV2(ctx context.Context, bucket, prefix, continuationToken, delimiter string, maxKeys int, fetchOwner bool, startAfter string) (result ListObjectsV2Info, err error) {
|
2018-04-06 06:04:40 +08:00
|
|
|
return result, NotImplemented{}
|
2017-11-23 04:12:10 +08:00
|
|
|
}
|
|
|
|
|
2020-02-25 23:52:28 +08:00
|
|
|
// Walk - Not implemented stub
|
2020-07-11 13:21:04 +08:00
|
|
|
func (a GatewayUnsupported) Walk(ctx context.Context, bucket, prefix string, results chan<- ObjectInfo, opts ObjectOptions) error {
|
2020-02-25 23:52:28 +08:00
|
|
|
return NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2019-03-14 08:35:09 +08:00
|
|
|
// HealObjects - Not implemented stub
|
2020-06-13 11:04:01 +08:00
|
|
|
func (a GatewayUnsupported) HealObjects(ctx context.Context, bucket, prefix string, opts madmin.HealOpts, fn HealObjectFn) (e error) {
|
2019-03-14 08:35:09 +08:00
|
|
|
return NotImplemented{}
|
2017-03-17 03:21:58 +08:00
|
|
|
}
|
|
|
|
|
2017-11-23 04:12:10 +08:00
|
|
|
// CopyObject copies a blob from source container to destination container.
|
2018-03-15 09:36:54 +08:00
|
|
|
func (a GatewayUnsupported) CopyObject(ctx context.Context, srcBucket string, srcObject string, destBucket string, destObject string,
|
2022-04-14 03:00:11 +08:00
|
|
|
srcInfo ObjectInfo, srcOpts, dstOpts ObjectOptions,
|
|
|
|
) (objInfo ObjectInfo, err error) {
|
2018-04-06 06:04:40 +08:00
|
|
|
return objInfo, NotImplemented{}
|
2017-11-23 04:12:10 +08:00
|
|
|
}
|
2018-01-13 12:34:52 +08:00
|
|
|
|
2019-12-06 15:16:06 +08:00
|
|
|
// GetMetrics - no op
|
2021-01-19 12:35:38 +08:00
|
|
|
func (a GatewayUnsupported) GetMetrics(ctx context.Context) (*BackendMetrics, error) {
|
2019-12-06 15:16:06 +08:00
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
2021-01-19 12:35:38 +08:00
|
|
|
return &BackendMetrics{}, NotImplemented{}
|
2019-12-06 15:16:06 +08:00
|
|
|
}
|
|
|
|
|
2020-05-24 02:09:35 +08:00
|
|
|
// PutObjectTags - not implemented.
|
2021-02-02 05:52:51 +08:00
|
|
|
func (a GatewayUnsupported) PutObjectTags(ctx context.Context, bucket, object string, tags string, opts ObjectOptions) (ObjectInfo, error) {
|
2020-01-21 00:45:59 +08:00
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
2021-02-02 05:52:51 +08:00
|
|
|
return ObjectInfo{}, NotImplemented{}
|
2020-01-21 00:45:59 +08:00
|
|
|
}
|
|
|
|
|
2020-05-24 02:09:35 +08:00
|
|
|
// GetObjectTags - not implemented.
|
2020-06-13 11:04:01 +08:00
|
|
|
func (a GatewayUnsupported) GetObjectTags(ctx context.Context, bucket, object string, opts ObjectOptions) (*tags.Tags, error) {
|
2020-01-21 00:45:59 +08:00
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
2020-05-06 05:18:13 +08:00
|
|
|
return nil, NotImplemented{}
|
2020-01-21 00:45:59 +08:00
|
|
|
}
|
|
|
|
|
2020-05-24 02:09:35 +08:00
|
|
|
// DeleteObjectTags - not implemented.
|
2021-02-02 05:52:51 +08:00
|
|
|
func (a GatewayUnsupported) DeleteObjectTags(ctx context.Context, bucket, object string, opts ObjectOptions) (ObjectInfo, error) {
|
2020-01-21 00:45:59 +08:00
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
2021-02-02 05:52:51 +08:00
|
|
|
return ObjectInfo{}, NotImplemented{}
|
2020-01-21 00:45:59 +08:00
|
|
|
}
|
|
|
|
|
2018-02-10 07:19:30 +08:00
|
|
|
// IsNotificationSupported returns whether bucket notification is applicable for this layer.
|
|
|
|
func (a GatewayUnsupported) IsNotificationSupported() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2020-07-21 03:52:49 +08:00
|
|
|
// IsListenSupported returns whether listen bucket notification is applicable for this layer.
|
|
|
|
func (a GatewayUnsupported) IsListenSupported() bool {
|
2018-12-06 06:03:42 +08:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2019-01-06 06:16:43 +08:00
|
|
|
// IsEncryptionSupported returns whether server side encryption is implemented for this layer.
|
2018-02-10 07:19:30 +08:00
|
|
|
func (a GatewayUnsupported) IsEncryptionSupported() bool {
|
|
|
|
return false
|
|
|
|
}
|
2018-09-28 11:36:17 +08:00
|
|
|
|
2020-05-24 02:09:35 +08:00
|
|
|
// IsTaggingSupported returns whether object tagging is supported or not for this layer.
|
|
|
|
func (a GatewayUnsupported) IsTaggingSupported() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2018-09-28 11:36:17 +08:00
|
|
|
// IsCompressionSupported returns whether compression is applicable for this layer.
|
|
|
|
func (a GatewayUnsupported) IsCompressionSupported() bool {
|
|
|
|
return false
|
|
|
|
}
|
2019-12-29 00:54:43 +08:00
|
|
|
|
2020-07-21 09:31:22 +08:00
|
|
|
// Health - No Op.
|
|
|
|
func (a GatewayUnsupported) Health(_ context.Context, _ HealthOptions) HealthResult {
|
|
|
|
return HealthResult{}
|
2019-12-29 00:54:43 +08:00
|
|
|
}
|
2021-02-09 17:00:44 +08:00
|
|
|
|
|
|
|
// ReadHealth - No Op.
|
|
|
|
func (a GatewayUnsupported) ReadHealth(_ context.Context) bool {
|
|
|
|
return true
|
|
|
|
}
|
2021-04-20 01:30:42 +08:00
|
|
|
|
|
|
|
// TransitionObject - transition object content to target tier.
|
|
|
|
func (a GatewayUnsupported) TransitionObject(ctx context.Context, bucket, object string, opts ObjectOptions) error {
|
|
|
|
return NotImplemented{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// RestoreTransitionedObject - restore transitioned object content locally on this cluster.
|
|
|
|
func (a GatewayUnsupported) RestoreTransitionedObject(ctx context.Context, bucket, object string, opts ObjectOptions) error {
|
|
|
|
return NotImplemented{}
|
|
|
|
}
|