remove OSS gateway due to lack of licensing (#9390)
OSS go sdk lacks licensing terms in their repository, and there has been no activity On the issue here https://github.com/aliyun/aliyun-oss-go-sdk/issues/245 This PR is to ensure we remove any dependency code which lacks explicit license file in their repo.master
parent
d02deff3d7
commit
69ee28a082
File diff suppressed because it is too large
Load Diff
@ -1,189 +0,0 @@ |
|||||||
/* |
|
||||||
* MinIO Cloud Storage, (C) 2017 MinIO, Inc. |
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
package oss |
|
||||||
|
|
||||||
import ( |
|
||||||
"fmt" |
|
||||||
"net/http" |
|
||||||
"reflect" |
|
||||||
"testing" |
|
||||||
|
|
||||||
"github.com/aliyun/aliyun-oss-go-sdk/oss" |
|
||||||
|
|
||||||
minio "github.com/minio/minio/cmd" |
|
||||||
) |
|
||||||
|
|
||||||
func ossErrResponse(code string) error { |
|
||||||
return oss.ServiceError{ |
|
||||||
Code: code, |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
func TestOSSToObjectError(t *testing.T) { |
|
||||||
testCases := []struct { |
|
||||||
inputErr error |
|
||||||
expectedErr error |
|
||||||
bucket, object string |
|
||||||
}{ |
|
||||||
{ |
|
||||||
inputErr: ossErrResponse("BucketAlreadyExists"), |
|
||||||
expectedErr: minio.BucketAlreadyOwnedByYou{}, |
|
||||||
}, |
|
||||||
{ |
|
||||||
inputErr: ossErrResponse("BucketNotEmpty"), |
|
||||||
expectedErr: minio.BucketNotEmpty{}, |
|
||||||
}, |
|
||||||
{ |
|
||||||
inputErr: ossErrResponse("InvalidBucketName"), |
|
||||||
expectedErr: minio.BucketNameInvalid{}, |
|
||||||
}, |
|
||||||
{ |
|
||||||
inputErr: ossErrResponse("NoSuchBucket"), |
|
||||||
expectedErr: minio.BucketNotFound{}, |
|
||||||
}, |
|
||||||
// with empty object, NoSuchKey is interpreted as BucketNotFound
|
|
||||||
{ |
|
||||||
inputErr: ossErrResponse("NoSuchKey"), |
|
||||||
expectedErr: minio.BucketNotFound{}, |
|
||||||
}, |
|
||||||
{ |
|
||||||
inputErr: ossErrResponse("NoSuchUpload"), |
|
||||||
expectedErr: minio.InvalidUploadID{}, |
|
||||||
}, |
|
||||||
{ |
|
||||||
inputErr: ossErrResponse("InvalidObjectName"), |
|
||||||
expectedErr: minio.ObjectNameInvalid{}, |
|
||||||
}, |
|
||||||
{ |
|
||||||
inputErr: ossErrResponse("AccessDenied"), |
|
||||||
expectedErr: minio.PrefixAccessDenied{}, |
|
||||||
}, |
|
||||||
{ |
|
||||||
inputErr: ossErrResponse("NoSuchUpload"), |
|
||||||
expectedErr: minio.InvalidUploadID{}, |
|
||||||
}, |
|
||||||
{ |
|
||||||
inputErr: ossErrResponse("EntityTooSmall"), |
|
||||||
expectedErr: minio.PartTooSmall{}, |
|
||||||
}, |
|
||||||
{ |
|
||||||
inputErr: nil, |
|
||||||
expectedErr: nil, |
|
||||||
}, |
|
||||||
// Special test case for NoSuchKey with object name
|
|
||||||
{ |
|
||||||
inputErr: ossErrResponse("NoSuchKey"), |
|
||||||
expectedErr: minio.ObjectNotFound{Bucket: "bucket", Object: "object"}, |
|
||||||
bucket: "bucket", |
|
||||||
object: "object", |
|
||||||
}, |
|
||||||
|
|
||||||
// Special test case for error value that is not of
|
|
||||||
// type (*Error)
|
|
||||||
{ |
|
||||||
inputErr: fmt.Errorf("not a *Error"), |
|
||||||
expectedErr: fmt.Errorf("not a *Error"), |
|
||||||
}, |
|
||||||
} |
|
||||||
|
|
||||||
for i, tc := range testCases { |
|
||||||
actualErr := ossToObjectError(tc.inputErr, tc.bucket, tc.object) |
|
||||||
if actualErr != nil && tc.expectedErr != nil && actualErr.Error() != tc.expectedErr.Error() { |
|
||||||
t.Errorf("Test case %d: Expected error '%v' but received error '%v'", i+1, tc.expectedErr, actualErr) |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
func TestS3MetaToOSSOptions(t *testing.T) { |
|
||||||
var err error |
|
||||||
|
|
||||||
headers := map[string]string{ |
|
||||||
"x-amz-meta-invalid_meta": "value", |
|
||||||
} |
|
||||||
_, err = appendS3MetaToOSSOptions(minio.GlobalContext, nil, headers) |
|
||||||
if err != nil { |
|
||||||
if _, ok := err.(minio.UnsupportedMetadata); !ok { |
|
||||||
t.Fatalf("Test failed with unexpected error %s, expected UnsupportedMetadata", err) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
headers = map[string]string{ |
|
||||||
"accept-encoding": "gzip", // not this
|
|
||||||
"content-encoding": "gzip", |
|
||||||
"X-Amz-Meta-Hdr": "value", |
|
||||||
"X-Amz-Meta-X-test-key": "value", |
|
||||||
"X-Amz-Meta-X--test--key": "value", |
|
||||||
"X-Amz-Meta-X-Amz-Key": "hu3ZSqtqwn+aL4V2VhAeov4i+bG3KyCtRMSXQFRHXOk=", |
|
||||||
"X-Amz-Meta-X-Amz-Matdesc": "{}", |
|
||||||
"X-Amz-Meta-X-Amz-Iv": "eWmyryl8kq+EVnnsE7jpOg==", |
|
||||||
} |
|
||||||
opts, err := appendS3MetaToOSSOptions(minio.GlobalContext, nil, headers) |
|
||||||
if err != nil { |
|
||||||
t.Fatalf("Test failed, with %s", err) |
|
||||||
} |
|
||||||
if len(opts) != len(headers) { |
|
||||||
t.Fatalf("Test failed, S3 metdata is not fully transformed. expeted: %d, actual: %d", len(headers)-1, len(opts)) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
func TestOSSHeaderToS3Meta(t *testing.T) { |
|
||||||
meta := map[string]string{ |
|
||||||
"x-oss-meta-first_name": "myname", |
|
||||||
"X-OSS-Meta-x_test_key": "value", |
|
||||||
"X-Oss-Meta-x_test__key": "value", |
|
||||||
"X-Oss-Meta-x__test__key": "value", |
|
||||||
"X-Oss-Meta-x____test____key": "value", |
|
||||||
"X-Oss-Meta-x_amz_key": "hu3ZSqtqwn+aL4V2VhAeov4i+bG3KyCtRMSXQFRHXOk=", |
|
||||||
"X-Oss-Meta-x_amz_matdesc": "{}", |
|
||||||
"x-oss-meta-x_amz_iv": "eWmyryl8kq+EVnnsE7jpOg==", |
|
||||||
} |
|
||||||
header := make(http.Header) |
|
||||||
for k, v := range meta { |
|
||||||
header.Set(k, v) |
|
||||||
} |
|
||||||
|
|
||||||
expectedMeta := map[string]string{ |
|
||||||
"X-Amz-Meta-First-Name": "myname", |
|
||||||
"X-Amz-Meta-X-Test-Key": "value", |
|
||||||
"X-Amz-Meta-X-Test_key": "value", |
|
||||||
"X-Amz-Meta-X_test_key": "value", |
|
||||||
"X-Amz-Meta-X__test__key": "value", |
|
||||||
"X-Amz-Meta-X-Amz-Key": "hu3ZSqtqwn+aL4V2VhAeov4i+bG3KyCtRMSXQFRHXOk=", |
|
||||||
"X-Amz-Meta-X-Amz-Matdesc": "{}", |
|
||||||
"X-Amz-Meta-X-Amz-Iv": "eWmyryl8kq+EVnnsE7jpOg==", |
|
||||||
} |
|
||||||
actualMeta := ossHeaderToS3Meta(header) |
|
||||||
for k, v := range expectedMeta { |
|
||||||
if v2, ok := actualMeta[k]; !ok { |
|
||||||
t.Errorf("Test failed for key %s: missing key", k) |
|
||||||
} else if v != v2 { |
|
||||||
t.Errorf("Test failed for key %s, expected '%s', got '%s'", k, v, v2) |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
func TestOSSBuildListObjectPartsParams(t *testing.T) { |
|
||||||
expected := map[string]interface{}{ |
|
||||||
"uploadId": "test", |
|
||||||
"part-number-marker": "123", |
|
||||||
"max-parts": "456", |
|
||||||
} |
|
||||||
actual := ossBuildListObjectPartsParams("test", 123, 456) |
|
||||||
if !reflect.DeepEqual(expected, actual) { |
|
||||||
t.Fatalf("Test failed, expected %v, got %v", expected, actual) |
|
||||||
} |
|
||||||
} |
|
@ -1,57 +0,0 @@ |
|||||||
# MinIO OSS Gateway [![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io) |
|
||||||
MinIO Gateway adds Amazon S3 compatibility to Alibaba Cloud Object Storage Service (OSS). |
|
||||||
|
|
||||||
## Run MinIO Gateway for OSS. |
|
||||||
|
|
||||||
### Using Docker |
|
||||||
``` |
|
||||||
docker run -p 9000:9000 --name azure-s3 \ |
|
||||||
-e "MINIO_ACCESS_KEY=ossaccesskey" \ |
|
||||||
-e "MINIO_SECRET_KEY=osssecretkey" \ |
|
||||||
minio/minio gateway oss |
|
||||||
``` |
|
||||||
|
|
||||||
### Using Binary |
|
||||||
``` |
|
||||||
export MINIO_ACCESS_KEY=ossaccesskey |
|
||||||
export MINIO_SECRET_KEY=osssecretkey |
|
||||||
minio gateway oss |
|
||||||
``` |
|
||||||
|
|
||||||
## Test using MinIO Browser |
|
||||||
MinIO Gateway comes with an embedded web based object browser. Point your web browser to http://127.0.0.1:9000 to ensure that your server has started successfully. |
|
||||||
|
|
||||||
![Screenshot](https://raw.githubusercontent.com/minio/minio/master/docs/screenshots/minio-browser-gateway.png) |
|
||||||
|
|
||||||
## Test using MinIO Client `mc` |
|
||||||
`mc` provides a modern alternative to UNIX commands such as ls, cat, cp, mirror, diff etc. It supports filesystems and Amazon S3 compatible cloud storage services. |
|
||||||
|
|
||||||
### Configure `mc` |
|
||||||
``` |
|
||||||
mc config host add myoss http://gateway-ip:9000 ossaccesskey osssecretkey |
|
||||||
``` |
|
||||||
|
|
||||||
### List buckets on OSS |
|
||||||
``` |
|
||||||
mc ls myb2 |
|
||||||
[2017-02-22 01:50:43 PST] 0B ferenginar/ |
|
||||||
[2017-02-26 21:43:51 PST] 0B my-bucket/ |
|
||||||
[2017-02-26 22:10:11 PST] 0B test-bucket1/ |
|
||||||
``` |
|
||||||
|
|
||||||
### Known limitations |
|
||||||
|
|
||||||
Gateway inherits the following OSS limitations: |
|
||||||
|
|
||||||
- Bucket names with "." in the bucket name are not supported. |
|
||||||
- Custom metadata with "_" in the key is not supported. |
|
||||||
|
|
||||||
Other limitations: |
|
||||||
|
|
||||||
- Bucket notification APIs are not supported. |
|
||||||
|
|
||||||
## Explore Further |
|
||||||
|
|
||||||
- [`mc` command-line interface](https://docs.min.io/docs/minio-client-quickstart-guide) |
|
||||||
- [`aws` command-line interface](https://docs.min.io/docs/aws-cli-with-minio) |
|
||||||
- [`minio-go` Go SDK](https://docs.min.io/docs/golang-client-quickstart-guide) |
|
Loading…
Reference in new issue