storj.io/minio@v0.0.0-20230509071714-0cbc90f649b1/cmd/gateway-unsupported.go (about)

     1  /*
     2   * MinIO Cloud Storage, (C) 2017 MinIO, Inc.
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   *     http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  package cmd
    18  
    19  import (
    20  	"context"
    21  	"errors"
    22  
    23  	"github.com/minio/minio-go/v7/pkg/tags"
    24  
    25  	"storj.io/minio/cmd/logger"
    26  	bucketsse "storj.io/minio/pkg/bucket/encryption"
    27  	"storj.io/minio/pkg/bucket/lifecycle"
    28  	"storj.io/minio/pkg/bucket/policy"
    29  	"storj.io/minio/pkg/bucket/versioning"
    30  	"storj.io/minio/pkg/madmin"
    31  )
    32  
    33  // GatewayUnsupported list of unsupported call stubs for gateway.
    34  type GatewayUnsupported struct{}
    35  
    36  // BackendInfo returns the underlying backend information
    37  func (a GatewayUnsupported) BackendInfo() madmin.BackendInfo {
    38  	return madmin.BackendInfo{Type: madmin.Gateway}
    39  }
    40  
    41  // LocalStorageInfo returns the local disks information, mainly used
    42  // in prometheus - for gateway this just a no-op
    43  func (a GatewayUnsupported) LocalStorageInfo(ctx context.Context) (StorageInfo, []error) {
    44  	logger.CriticalIf(ctx, errors.New("not implemented"))
    45  	return StorageInfo{}, nil
    46  }
    47  
    48  // NSScanner - scanner is not implemented for gateway
    49  func (a GatewayUnsupported) NSScanner(ctx context.Context, bf *bloomFilter, updates chan<- madmin.DataUsageInfo) error {
    50  	logger.CriticalIf(ctx, errors.New("not implemented"))
    51  	return NotImplemented{}
    52  }
    53  
    54  // PutObjectMetadata - not implemented for gateway.
    55  func (a GatewayUnsupported) PutObjectMetadata(ctx context.Context, bucket, object string, opts ObjectOptions) (ObjectInfo, error) {
    56  	logger.CriticalIf(ctx, errors.New("not implemented"))
    57  	return ObjectInfo{}, NotImplemented{}
    58  }
    59  
    60  // NewNSLock is a dummy stub for gateway.
    61  func (a GatewayUnsupported) NewNSLock(bucket string, objects ...string) RWLocker {
    62  	logger.CriticalIf(context.Background(), errors.New("not implemented"))
    63  	return nil
    64  }
    65  
    66  // SetDriveCounts no-op
    67  func (a GatewayUnsupported) SetDriveCounts() []int {
    68  	return nil
    69  }
    70  
    71  // ListMultipartUploads lists all multipart uploads.
    72  func (a GatewayUnsupported) ListMultipartUploads(ctx context.Context, bucket string, prefix string, keyMarker string, uploadIDMarker string, delimiter string, maxUploads int) (lmi ListMultipartsInfo, err error) {
    73  	return lmi, NotImplemented{}
    74  }
    75  
    76  // NewMultipartUpload upload object in multiple parts
    77  func (a GatewayUnsupported) NewMultipartUpload(ctx context.Context, bucket string, object string, opts ObjectOptions) (uploadID string, err error) {
    78  	return "", NotImplemented{}
    79  }
    80  
    81  // CopyObjectPart copy part of object to uploadID for another object
    82  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) {
    83  	return pi, NotImplemented{}
    84  }
    85  
    86  // PutObjectPart puts a part of object in bucket
    87  func (a GatewayUnsupported) PutObjectPart(ctx context.Context, bucket string, object string, uploadID string, partID int, data *PutObjReader, opts ObjectOptions) (pi PartInfo, err error) {
    88  	logger.LogIf(ctx, NotImplemented{})
    89  	return pi, NotImplemented{}
    90  }
    91  
    92  // GetMultipartInfo returns metadata associated with the uploadId
    93  func (a GatewayUnsupported) GetMultipartInfo(ctx context.Context, bucket string, object string, uploadID string, opts ObjectOptions) (MultipartInfo, error) {
    94  	logger.LogIf(ctx, NotImplemented{})
    95  	return MultipartInfo{}, NotImplemented{}
    96  }
    97  
    98  // ListObjectVersions returns all object parts for specified object in specified bucket
    99  func (a GatewayUnsupported) ListObjectVersions(ctx context.Context, bucket, prefix, marker, versionMarker, delimiter string, maxKeys int) (ListObjectVersionsInfo, error) {
   100  	logger.LogIf(ctx, NotImplemented{})
   101  	return ListObjectVersionsInfo{}, NotImplemented{}
   102  }
   103  
   104  // ListObjectParts returns all object parts for specified object in specified bucket
   105  func (a GatewayUnsupported) ListObjectParts(ctx context.Context, bucket string, object string, uploadID string, partNumberMarker int, maxParts int, opts ObjectOptions) (lpi ListPartsInfo, err error) {
   106  	logger.LogIf(ctx, NotImplemented{})
   107  	return lpi, NotImplemented{}
   108  }
   109  
   110  // AbortMultipartUpload aborts a ongoing multipart upload
   111  func (a GatewayUnsupported) AbortMultipartUpload(ctx context.Context, bucket string, object string, uploadID string, opts ObjectOptions) error {
   112  	return NotImplemented{}
   113  }
   114  
   115  // CompleteMultipartUpload completes ongoing multipart upload and finalizes object
   116  func (a GatewayUnsupported) CompleteMultipartUpload(ctx context.Context, bucket string, object string, uploadID string, uploadedParts []CompletePart, opts ObjectOptions) (oi ObjectInfo, err error) {
   117  	logger.LogIf(ctx, NotImplemented{})
   118  	return oi, NotImplemented{}
   119  }
   120  
   121  // SetBucketPolicy sets policy on bucket
   122  func (a GatewayUnsupported) SetBucketPolicy(ctx context.Context, bucket string, bucketPolicy *policy.Policy) error {
   123  	logger.LogIf(ctx, NotImplemented{})
   124  	return NotImplemented{}
   125  }
   126  
   127  // GetBucketPolicy will get policy on bucket
   128  func (a GatewayUnsupported) GetBucketPolicy(ctx context.Context, bucket string) (bucketPolicy *policy.Policy, err error) {
   129  	return nil, NotImplemented{}
   130  }
   131  
   132  // DeleteBucketPolicy deletes all policies on bucket
   133  func (a GatewayUnsupported) DeleteBucketPolicy(ctx context.Context, bucket string) error {
   134  	return NotImplemented{}
   135  }
   136  
   137  // SetBucketVersioning enables versioning on a bucket.
   138  func (a GatewayUnsupported) SetBucketVersioning(ctx context.Context, bucket string, v *versioning.Versioning) error {
   139  	logger.LogIf(ctx, NotImplemented{})
   140  	return NotImplemented{}
   141  }
   142  
   143  // GetBucketVersioning retrieves versioning configuration of a bucket.
   144  func (a GatewayUnsupported) GetBucketVersioning(ctx context.Context, bucket string) (*versioning.Versioning, error) {
   145  	logger.LogIf(ctx, NotImplemented{})
   146  	return nil, NotImplemented{}
   147  }
   148  
   149  // SetBucketLifecycle enables lifecycle policies on a bucket.
   150  func (a GatewayUnsupported) SetBucketLifecycle(ctx context.Context, bucket string, lifecycle *lifecycle.Lifecycle) error {
   151  	logger.LogIf(ctx, NotImplemented{})
   152  	return NotImplemented{}
   153  }
   154  
   155  // GetBucketLifecycle retrieves lifecycle configuration of a bucket.
   156  func (a GatewayUnsupported) GetBucketLifecycle(ctx context.Context, bucket string) (*lifecycle.Lifecycle, error) {
   157  	return nil, NotImplemented{}
   158  }
   159  
   160  // DeleteBucketLifecycle deletes all lifecycle policies on a bucket
   161  func (a GatewayUnsupported) DeleteBucketLifecycle(ctx context.Context, bucket string) error {
   162  	return NotImplemented{}
   163  }
   164  
   165  // GetBucketSSEConfig returns bucket encryption config on a bucket
   166  func (a GatewayUnsupported) GetBucketSSEConfig(ctx context.Context, bucket string) (*bucketsse.BucketSSEConfig, error) {
   167  	return nil, NotImplemented{}
   168  }
   169  
   170  // SetBucketSSEConfig sets bucket encryption config on a bucket
   171  func (a GatewayUnsupported) SetBucketSSEConfig(ctx context.Context, bucket string, config *bucketsse.BucketSSEConfig) error {
   172  	return NotImplemented{}
   173  }
   174  
   175  // DeleteBucketSSEConfig deletes bucket encryption config on a bucket
   176  func (a GatewayUnsupported) DeleteBucketSSEConfig(ctx context.Context, bucket string) error {
   177  	return NotImplemented{}
   178  }
   179  
   180  // HealFormat - Not implemented stub
   181  func (a GatewayUnsupported) HealFormat(ctx context.Context, dryRun bool) (madmin.HealResultItem, error) {
   182  	return madmin.HealResultItem{}, NotImplemented{}
   183  }
   184  
   185  // HealBucket - Not implemented stub
   186  func (a GatewayUnsupported) HealBucket(ctx context.Context, bucket string, opts madmin.HealOpts) (madmin.HealResultItem, error) {
   187  	return madmin.HealResultItem{}, NotImplemented{}
   188  }
   189  
   190  // HealObject - Not implemented stub
   191  func (a GatewayUnsupported) HealObject(ctx context.Context, bucket, object, versionID string, opts madmin.HealOpts) (h madmin.HealResultItem, e error) {
   192  	return h, NotImplemented{}
   193  }
   194  
   195  // ListObjectsV2 - Not implemented stub
   196  func (a GatewayUnsupported) ListObjectsV2(ctx context.Context, bucket, prefix, continuationToken, delimiter string, maxKeys int, fetchOwner bool, startAfter string) (result ListObjectsV2Info, err error) {
   197  	return result, NotImplemented{}
   198  }
   199  
   200  // Walk - Not implemented stub
   201  func (a GatewayUnsupported) Walk(ctx context.Context, bucket, prefix string, results chan<- ObjectInfo, opts ObjectOptions) error {
   202  	return NotImplemented{}
   203  }
   204  
   205  // HealObjects - Not implemented stub
   206  func (a GatewayUnsupported) HealObjects(ctx context.Context, bucket, prefix string, opts madmin.HealOpts, fn HealObjectFn) (e error) {
   207  	return NotImplemented{}
   208  }
   209  
   210  // CopyObject copies a blob from source container to destination container.
   211  func (a GatewayUnsupported) CopyObject(ctx context.Context, srcBucket string, srcObject string, destBucket string, destObject string,
   212  	srcInfo ObjectInfo, srcOpts, dstOpts ObjectOptions) (objInfo ObjectInfo, err error) {
   213  	return objInfo, NotImplemented{}
   214  }
   215  
   216  // GetMetrics - no op
   217  func (a GatewayUnsupported) GetMetrics(ctx context.Context) (*BackendMetrics, error) {
   218  	logger.LogIf(ctx, NotImplemented{})
   219  	return &BackendMetrics{}, NotImplemented{}
   220  }
   221  
   222  // PutObjectTags - not implemented.
   223  func (a GatewayUnsupported) PutObjectTags(ctx context.Context, bucket, object string, tags string, opts ObjectOptions) (ObjectInfo, error) {
   224  	logger.LogIf(ctx, NotImplemented{})
   225  	return ObjectInfo{}, NotImplemented{}
   226  }
   227  
   228  // GetObjectTags - not implemented.
   229  func (a GatewayUnsupported) GetObjectTags(ctx context.Context, bucket, object string, opts ObjectOptions) (*tags.Tags, error) {
   230  	logger.LogIf(ctx, NotImplemented{})
   231  	return nil, NotImplemented{}
   232  }
   233  
   234  // DeleteObjectTags - not implemented.
   235  func (a GatewayUnsupported) DeleteObjectTags(ctx context.Context, bucket, object string, opts ObjectOptions) (ObjectInfo, error) {
   236  	logger.LogIf(ctx, NotImplemented{})
   237  	return ObjectInfo{}, NotImplemented{}
   238  }
   239  
   240  // IsNotificationSupported returns whether bucket notification is applicable for this layer.
   241  func (a GatewayUnsupported) IsNotificationSupported() bool {
   242  	return false
   243  }
   244  
   245  // IsListenSupported returns whether listen bucket notification is applicable for this layer.
   246  func (a GatewayUnsupported) IsListenSupported() bool {
   247  	return false
   248  }
   249  
   250  // IsEncryptionSupported returns whether server side encryption is implemented for this layer.
   251  func (a GatewayUnsupported) IsEncryptionSupported() bool {
   252  	return false
   253  }
   254  
   255  // IsTaggingSupported returns whether object tagging is supported or not for this layer.
   256  func (a GatewayUnsupported) IsTaggingSupported() bool {
   257  	return false
   258  }
   259  
   260  // IsCompressionSupported returns whether compression is applicable for this layer.
   261  func (a GatewayUnsupported) IsCompressionSupported() bool {
   262  	return false
   263  }
   264  
   265  // Health - No Op.
   266  func (a GatewayUnsupported) Health(_ context.Context, _ HealthOptions) HealthResult {
   267  	return HealthResult{}
   268  }
   269  
   270  // ReadHealth - No Op.
   271  func (a GatewayUnsupported) ReadHealth(_ context.Context) bool {
   272  	return true
   273  }