fix: bug fixes, add docs

This commit is contained in:
Qiu Jian
2019-07-23 11:30:33 +08:00
parent 93b8bac5bb
commit c00ea1bf2e
61 changed files with 1154 additions and 47 deletions

View File

@@ -1,10 +1,25 @@
// Copyright 2019 Yunion
//
// 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 shell
import (
"yunion.io/x/jsonutils"
"io"
"os"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
@@ -102,7 +117,7 @@ func init() {
return err
}
arrays, _ := result.(*jsonutils.JSONArray).GetArray()
arrays, _ := result.GetArray("objects")
listResult := modules.ListResult{Data: arrays}
printList(&listResult, []string{})
return nil
@@ -113,11 +128,22 @@ func init() {
KEYS []string `help:"List of objects to delete"`
}
R(&BucketDeleteObjectsOptions{}, "bucket-object-delete", "Delete objects in a bucket", func(s *mcclient.ClientSession, args *BucketDeleteObjectsOptions) error {
params, err := options.StructToParams(args)
params := jsonutils.Marshal(args)
result, err := modules.Buckets.PerformAction(s, args.ID, "delete", params)
if err != nil {
return err
}
result, err := modules.Buckets.PerformAction(s, args.ID, "delete", params)
printObject(result)
return nil
})
type BucketMakeDirOptions struct {
ID string `help:"ID or name of bucket" json:"-"`
KEY string `help:"DIR key to create"`
}
R(&BucketMakeDirOptions{}, "bucket-mkdir", "Mkdir in a bucket", func(s *mcclient.ClientSession, args *BucketMakeDirOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Buckets.PerformAction(s, args.ID, "makedir", params)
if err != nil {
return err
}

View File

@@ -178,6 +178,17 @@ func init() {
return nil
})
R(&options.SS3CloudAccountCreateOptions{}, "cloud-account-create-s3", "Create a generaic S3 object storage account", func(s *mcclient.ClientSession, args *options.SS3CloudAccountCreateOptions) error {
params := jsonutils.Marshal(args)
params.(*jsonutils.JSONDict).Add(jsonutils.NewString("S3"), "provider")
result, err := modules.Cloudaccounts.Create(s, params)
if err != nil {
return err
}
printObject(result)
return nil
})
type CloudaccountUpdateOptions struct {
ID string `help:"ID or Name of cloud account"`
Name string `help:"New name to update"`
@@ -316,6 +327,19 @@ func init() {
return nil
})
R(&options.SUcloudCloudAccountUpdateOptions{}, "cloud-account-update-ucloud", "update a Ucloud cloud account", func(s *mcclient.ClientSession, args *options.SUcloudCloudAccountUpdateOptions) error {
params := jsonutils.Marshal(args).(*jsonutils.JSONDict)
if params.Size() == 0 {
return InvalidUpdateError()
}
result, err := modules.Cloudaccounts.Update(s, args.ID, params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SZStackCloudAccountUpdateOptions{}, "cloud-account-update-zstack", "update a ZStack cloud account", func(s *mcclient.ClientSession, args *options.SZStackCloudAccountUpdateOptions) error {
params := jsonutils.Marshal(args).(*jsonutils.JSONDict)
if params.Size() == 0 {
@@ -329,6 +353,19 @@ func init() {
return nil
})
R(&options.SS3CloudAccountUpdateOptions{}, "cloud-account-update-s3", "update a generic S3 cloud account", func(s *mcclient.ClientSession, args *options.SS3CloudAccountUpdateOptions) error {
params := jsonutils.Marshal(args).(*jsonutils.JSONDict)
if params.Size() == 0 {
return InvalidUpdateError()
}
result, err := modules.Cloudaccounts.Update(s, args.ID, params)
if err != nil {
return err
}
printObject(result)
return nil
})
type CloudaccountShowOptions struct {
ID string `help:"ID or Name of cloud account"`
}
@@ -483,6 +520,36 @@ func init() {
return nil
})
R(&options.SUcloudCloudAccountUpdateCredentialOptions{}, "cloud-account-update-credential-ucloud", "Update credential of a Ucloud cloud account", func(s *mcclient.ClientSession, args *options.SUcloudCloudAccountUpdateCredentialOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "update-credential", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SZStackCloudAccountUpdateCredentialOptions{}, "cloud-account-update-credential-zstack", "Update credential of a ZStack cloud account", func(s *mcclient.ClientSession, args *options.SZStackCloudAccountUpdateCredentialOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "update-credential", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SS3CloudAccountUpdateCredentialOptions{}, "cloud-account-update-credential-s3", "Update credential of a generic S3 cloud account", func(s *mcclient.ClientSession, args *options.SS3CloudAccountUpdateCredentialOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "update-credential", params)
if err != nil {
return err
}
printObject(result)
return nil
})
type CloudaccountSyncOptions struct {
ID string `help:"ID or Name of cloud account"`
Force bool `help:"Force sync no matter what"`

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 main
import (

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 main
import (

40
docs/bucket/bucket.yaml Normal file
View File

@@ -0,0 +1,40 @@
get:
summary: 获得指定对象存储桶的详情
parameters:
- $ref: '../parameters/bucket.yaml#/bucket_name'
responses:
200:
description: 对象存储桶信息
schema:
$ref: "../schemas/bucket.yaml#/BucketGetResponse"
tags:
- buckets
put:
summary: 更新指定对象存储桶的信息
parameters:
- $ref: '../parameters/bucket.yaml#/bucket_name'
- name: bucket
in: body
required: true
schema:
$ref: "../schemas/bucket.yaml#/BucketPutRequestInput"
responses:
200:
description: 对象存储桶信息
schema:
$ref: "../schemas/bucket.yaml#/BucketGetResponse"
tags:
- buckets
delete:
summary: 删除指定的对象存储桶
parameters:
- $ref: '../parameters/bucket.yaml#/bucket_name'
responses:
200:
description: 被删除的对象存储桶信息
schema:
$ref: "../schemas/bucket.yaml#/BucketGetResponse"
tags:
- buckets

32
docs/bucket/buckets.yaml Normal file
View File

@@ -0,0 +1,32 @@
get:
summary: 按指定条件列出对象存储桶
parameters:
- $ref: '../parameters/common.yaml#/offset'
- $ref: '../parameters/common.yaml#/limit'
- $ref: '../parameters/common.yaml#/provider'
- $ref: '../parameters/common.yaml#/brand'
- $ref: '../parameters/common.yaml#/region'
- $ref: '../parameters/common.yaml#/account'
responses:
200:
description: 对象存储桶列表信息
schema:
$ref: "../schemas/bucket.yaml#/BucketListResponse"
tags:
- buckets
post:
summary: 新建对象存储桶
parameters:
- name: bucket
in: body
required: true
schema:
$ref: "../schemas/bucket.yaml#/BucketCreateInput"
response:
200:
description: 对象存储桶信息
schema:
$ref: "../schemas/bucket.yaml#/BucketGetResponse"
tags:
- buckets

View File

@@ -0,0 +1,16 @@
post:
summary: 删除指定桶下的指定对象
parameters:
- $ref: '../parameters/bucket.yaml#/bucket_name'
- name: bucket
in: body
required: true
schema:
$ref: "../schemas/bucket.yaml#/BucketObjectDeleteInput"
responses:
200:
description: 对象删除结果
schema:
$ref: "../schemas/bucket.yaml#/BucketObjectDeleteResponse"
tags:
- buckets

View File

@@ -0,0 +1,13 @@
get:
summary: 获得指定对象存储桶的对象列表
parameters:
- $ref: '../parameters/bucket.yaml#/bucket_name'
- $ref: '../parameters/bucket.yaml#/prefix'
- $ref: '../parameters/bucket.yaml#/recursive'
responses:
200:
description: 对象存储桶的对象列表信息
schema:
$ref: "../schemas/bucket.yaml#/BucketObjectListResponse"
tags:
- buckets

14
docs/bucket/makedir.yaml Normal file
View File

@@ -0,0 +1,14 @@
post:
summary: 创建一个大小为0的对象用来做目录的占位
parameters:
- $ref: '../parameters/bucket.yaml#/bucket_name'
- name: bucket
in: body
required: true
schema:
$ref: "../schemas/bucket.yaml#/BucketMakedirInput"
responses:
200:
description: 创建成功
tags:
- buckets

16
docs/bucket/tempurl.yaml Normal file
View File

@@ -0,0 +1,16 @@
post:
summary: 生成访问指定对象的临时URL
parameters:
- $ref: '../parameters/bucket.yaml#/bucket_name'
- name: bucket
in: body
required: true
schema:
$ref: "../schemas/bucket.yaml#/BucketObjectTempUrlInput"
responses:
200:
description: 指定对象的临时URL响应
schema:
$ref: "../schemas/bucket.yaml#/BucketObjectTempUrlResponse"
tags:
- buckets

View File

@@ -0,0 +1,12 @@
post:
summary: 上传对象
parameters:
- $ref: "../parameters/bucket.yaml#/bucket_name"
- $ref: "../parameters/bucket.yaml#/x-bucket-object-key"
- $ref: "../parameters/bucket.yaml#/x-bucket-content-type"
- $ref: "../parameters/bucket.yaml#/x-bucket-storage-class"
responses:
200:
description: 上传成功
tags:
- buckets

View File

@@ -107,6 +107,7 @@ put:
$ref: "../schemas/image.yaml#/ImageResponse"
tags:
- images
get:
parameters:
- in: query

View File

@@ -353,3 +353,18 @@ paths:
$ref: "./networkinterface/networkinterfaces.yaml"
/networkinterfaces/{networkinterfaceId}:
$ref: "./networkinterface/networkinterface.yaml"
/buckets:
$ref: "./bucket/buckets.yaml"
/buckets/{bucketName}:
$ref: "./bucket/bucket.yaml"
/buckets/{bucketName}/objects:
$ref: "./bucket/listobjects.yaml"
/buckets/{bucketName}/delete:
$ref: "./bucket/deleteobjects.yaml"
/buckets/{bucketName}/makedir:
$ref: "./bucket/makedir.yaml"
/buckets/{bucketName}/upload:
$ref: "./bucket/uploadobject.yaml"
/buckets/{bucketName}/tempurl:
$ref: "./bucket/tempurl.yaml"

View File

@@ -0,0 +1,36 @@
bucket_name:
name: bucket_name
type: string
required: true
in: path
description: 存储桶的名称
prefix:
name: prefix
type: string
in: query
description: 对象的前缀过滤
recursive:
name: recursive
type: bool
in: query
description: 是否展开对象列表false则只显示当前目录层级下的对象true则显示匹配前缀的所有对象
x-bucket-object-key:
name: x-bucket-object-key
type: string
in: header
description: 对象的key
x-bucket-content-type:
name: x-bucket-content-type
type: string
in: header
description: 对象的content-type
x-bucket-storage-class:
name: x-bucket-storage-class
type: string
in: header
description: 对象的storage_class

175
docs/schemas/bucket.yaml Normal file
View File

@@ -0,0 +1,175 @@
BucketListResponse:
type: object
properties:
limit:
type: integer
example: 20
offset:
type: integer
example: 0
total:
type: integer
description: 总量
buckets:
type: array
items:
$ref: "#/Bucket"
BucketObjectListResponse:
type: object
properties:
bucket:
type: object
properties:
objects:
type: array
items:
$ref: '#/BucketObject'
BucketObject:
type: object
properties:
key:
type: string
description: 对象的key, 如果key以"/"结尾则该key一般是目录占位对象
size_bytes:
type: integer
description: 对象大小
last_modified:
type: string
description: 该对象的最近修改时间
etag:
type: string
description: 该对象的md5 checksum
storage_class:
type: string
description: 该对象的存储等级字符串
BucketGetResponse:
type: object
properties:
bucket:
type: object
$ref: "#/Bucket"
BucketPutRequestInput:
type: object
properties:
name:
type: string
description: 存储桶的名称
description:
type: string
description: 存储桶的描述
BucketCreateInput:
type: object
properties:
name:
type: string
required: true
description: 存储桶的名称
cloudregion:
type: string
required: true
description: 存储桶所在cloudregion的名称或ID对于on premise的通用s3存储cloudregion为default
manager:
type: string
required: true
description: 存储桶归属的账号订阅(cloudprovider)的名称或ID
storage_class:
type: string
description: 存储桶的存储类型可能值为standard, ia和archive
description:
type: string
description: 存储桶的描述
Bucket:
type: object
description: 存储桶的描述信息
properties:
id:
type: string
description: 存储桶的ID
readOnly: true
name:
type: string
description: 对象存储桶的名称,全局唯一。并且名字唯一性受到所在云供应商的桶名字空间唯一性的约束。
can_delete:
type: boolean
description: 是否可以删除
storage_class:
type: string
description: 存储桶的默认存储类型
tenant_id:
type: string
description: 存储桶归属的项目ID
domain_id:
type: string
description: 存储桶归属的项目的域ID
location:
type: string
description: 存储桶的所在区域信息
account_id:
type: string
description: 存储桶的云账号的ID
BucketObjectDeleteInput:
type: object
properties:
keys:
type: array
items:
type: string
description: 待删除的对象Key
BucketObjectDeleteResponse:
type: object
properties:
bucket:
type: array
items:
$ref: ""
BucketObjectDeleteInfo:
type: object
properties:
id:
type: string
description: 对象key
status:
type: integer
description: 删除结果200为成功400为失败
data:
type: string
description: 如果status为400则data为错误原因
BucketObjectTempUrlInput:
type: object
properties:
key:
type: string
description: 对象key
method:
type: string
description: 请求对象的HTTP方法例如GET|PUT|DELETE
expire_seconds:
type: integer
description: 该临时URL的超时时间单位为秒
BucketObjectTempUrlResponse:
type: object
properties:
bucket:
type: object
properties:
url:
type: string
description: 生成的临时URL
BucketMakedirInput:
type: object
properties:
key:
type: string
description: 目录的名称,必需以"/"结尾

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 compute
const (

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 s3gateway
const (

View File

@@ -1 +1,15 @@
// Copyright 2019 Yunion
//
// 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 s3gateway // import "yunion.io/x/onecloud/pkg/apis/s3gateway"

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 cloudprovider
import (
@@ -44,7 +58,7 @@ type ICloudBucket interface {
ListObjects(prefix string, marker string, delimiter string, maxCount int) (SListObjectResult, error)
GetIObjects(prefix string, isRecursive bool) ([]ICloudObject, error)
PutObject(ctx context.Context, key string, input io.ReadSeeker, contType string, storageClass string) error
PutObject(ctx context.Context, key string, input io.Reader, contType string, storageClass string) error
DeleteObject(ctx context.Context, keys string) error
GetTempUrl(method string, key string, expire time.Duration) (string, error)
// ObjectExist(key string) (bool, error)

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 models
import (
@@ -15,7 +29,6 @@ import (
"yunion.io/x/pkg/util/compare"
"yunion.io/x/sqlchemy"
"io"
api "yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/appsrv"
"yunion.io/x/onecloud/pkg/cloudcommon/db"
@@ -271,15 +284,19 @@ func (bucket *SBucket) GetRegion() (*SCloudregion, error) {
}
func (bucket *SBucket) GetIRegion() (cloudprovider.ICloudRegion, error) {
region, err := bucket.GetRegion()
if err != nil {
return nil, errors.Wrap(err, "bucket.GetRegion")
}
provider, err := bucket.GetDriver()
if err != nil {
return nil, err
}
return provider.GetIRegionById(region.GetExternalId())
if provider.GetFactory().IsOnPremise() {
return provider.GetOnPremiseIRegion()
} else {
region, err := bucket.GetRegion()
if err != nil {
return nil, errors.Wrap(err, "bucket.GetRegion")
}
return provider.GetIRegionById(region.GetExternalId())
}
}
func (bucket *SBucket) GetIBucket() (cloudprovider.ICloudBucket, error) {
@@ -452,7 +469,9 @@ func (bucket *SBucket) GetDetailsObjects(
for i := range objects {
retArray.Add(jsonutils.Marshal(cloudprovider.ICloudObject2BaseCloudObject(objects[i])))
}
return retArray, nil
ret := jsonutils.NewDict()
ret.Add(retArray, "objects")
return ret, nil
}
func (bucket *SBucket) AllowPerformTempUrl(ctx context.Context,
@@ -600,7 +619,7 @@ func (bucket *SBucket) PerformUpload(
contType := appParams.Request.Header.Get("Content-Type")
storageClass := appParams.Request.Header.Get(api.BUCKET_UPLOAD_OBJECT_STORAGECLASS_HEADER)
err = iBucket.PutObject(ctx, key, appParams.Request.Body.(io.ReadSeeker), contType, storageClass)
err = iBucket.PutObject(ctx, key, appParams.Request.Body, contType, storageClass)
if err != nil {
return nil, httperrors.NewInternalServerError("put object error %s", err)
}

View File

@@ -34,6 +34,7 @@ import (
_ "yunion.io/x/onecloud/pkg/compute/regiondrivers"
_ "yunion.io/x/onecloud/pkg/compute/storagedrivers"
_ "yunion.io/x/onecloud/pkg/compute/tasks"
_ "yunion.io/x/onecloud/pkg/multicloud/objectstore/provider"
_ "yunion.io/x/onecloud/pkg/util/aliyun/provider"
_ "yunion.io/x/onecloud/pkg/util/aws/provider"
_ "yunion.io/x/onecloud/pkg/util/azure/provider"

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 tasks
import (

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 tasks
import (

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: deploy.proto

View File

@@ -131,6 +131,12 @@ type SZStackCloudAccountCreateOptions struct {
AuthURL string `help:"ZStack auth_url" positional:"true" json:"auth_url"`
}
type SS3CloudAccountCreateOptions struct {
SCloudAccountCreateBaseOptions
SAccessKeyCredential
Endpoint string `help:"S3 endpoint" poisitional:"true" json:"endpoint"`
}
// update credential options
type SCloudAccountUpdateCredentialBaseOptions struct {
@@ -172,6 +178,21 @@ type SHuaweiCloudAccountUpdateCredentialOptions struct {
SAccessKeyCredential
}
type SUcloudCloudAccountUpdateCredentialOptions struct {
SCloudAccountUpdateCredentialBaseOptions
SAccessKeyCredential
}
type SZStackCloudAccountUpdateCredentialOptions struct {
SCloudAccountUpdateCredentialBaseOptions
SUserPasswordCredential
}
type SS3CloudAccountUpdateCredentialOptions struct {
SCloudAccountUpdateCredentialBaseOptions
SAccessKeyCredential
}
// update
type SCloudAccountUpdateBaseOptions struct {
@@ -218,7 +239,14 @@ type SHuaweiCloudAccountUpdateOptions struct {
SCloudAccountUpdateBaseOptions
}
type SUcloudCloudAccountUpdateOptions struct {
SCloudAccountUpdateBaseOptions
}
type SZStackCloudAccountUpdateOptions struct {
SCloudAccountUpdateBaseOptions
SUserPasswordCredential
}
type SS3CloudAccountUpdateOptions struct {
SCloudAccountUpdateBaseOptions
}

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 multicloud
import "yunion.io/x/onecloud/pkg/cloudprovider"

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 objectstore
import (
@@ -102,7 +116,7 @@ func (bucket *SBucket) GetIObjects(prefix string, isRecursive bool) ([]cloudprov
return ret, nil
}
func (bucket *SBucket) PutObject(ctx context.Context, key string, input io.ReadSeeker, contType string, storageClass string) error {
func (bucket *SBucket) PutObject(ctx context.Context, key string, input io.Reader, contType string, storageClass string) error {
opts := minio.PutObjectOptions{}
if len(contType) > 0 {
opts.ContentType = contType

View File

@@ -1 +1,15 @@
// Copyright 2019 Yunion
//
// 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 objectstore // import "yunion.io/x/onecloud/pkg/multicloud/objectstore"

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 objectstore
import (

View File

@@ -1,15 +1,29 @@
// Copyright 2019 Yunion
//
// 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 objectstore
import (
"net/url"
"time"
"github.com/minio/minio-go"
"github.com/pkg/errors"
"yunion.io/x/jsonutils"
"yunion.io/x/pkg/errors"
"yunion.io/x/pkg/util/secrules"
"time"
api "yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/cloudcommon/object"
"yunion.io/x/onecloud/pkg/cloudprovider"

View File

@@ -1 +1,15 @@
// Copyright 2019 Yunion
//
// 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 provider // import "yunion.io/x/onecloud/pkg/multicloud/objectstore/provider"

View File

@@ -39,13 +39,13 @@ func (self *SObjectStoreProviderFactory) GetName() string {
}
func (self *SObjectStoreProviderFactory) ValidateCreateCloudaccountData(ctx context.Context, userCred mcclient.TokenCredential, data *jsonutils.JSONDict) error {
accessKeyID, _ := data.GetString("access_key")
accessKeyID, _ := data.GetString("access_key_id")
if len(accessKeyID) == 0 {
return httperrors.NewMissingParameterError("access_key")
return httperrors.NewMissingParameterError("access_key_id")
}
accessKeySecret, _ := data.GetString("secret_key")
accessKeySecret, _ := data.GetString("access_key_secret")
if len(accessKeySecret) == 0 {
return httperrors.NewMissingParameterError("secret_key")
return httperrors.NewMissingParameterError("access_key_secret")
}
endpointURL, _ := data.GetString("endpoint")
if len(endpointURL) == 0 {
@@ -53,18 +53,18 @@ func (self *SObjectStoreProviderFactory) ValidateCreateCloudaccountData(ctx cont
}
data.Set("account", jsonutils.NewString(accessKeyID))
data.Set("secret", jsonutils.NewString(accessKeySecret))
data.Set("url", jsonutils.NewString(endpointURL))
data.Set("access_url", jsonutils.NewString(endpointURL))
return nil
}
func (self *SObjectStoreProviderFactory) ValidateUpdateCloudaccountCredential(ctx context.Context, userCred mcclient.TokenCredential, data jsonutils.JSONObject, cloudaccount string) (*cloudprovider.SCloudaccount, error) {
accessKeyID, _ := data.GetString("access_key")
accessKeyID, _ := data.GetString("access_key_id")
if len(accessKeyID) == 0 {
return nil, httperrors.NewMissingParameterError("access_key")
return nil, httperrors.NewMissingParameterError("access_key_id")
}
accessKeySecret, _ := data.GetString("secret_key")
accessKeySecret, _ := data.GetString("access_key_secret")
if len(accessKeySecret) == 0 {
return nil, httperrors.NewMissingParameterError("secret_key")
return nil, httperrors.NewMissingParameterError("access_key_secret")
}
account := &cloudprovider.SCloudaccount{
Account: accessKeyID,

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 objectstore
import (
@@ -63,7 +77,7 @@ func S3Shell() {
return err
}
if result.IsTruncated {
fmt.Println("NextMarker: %s IsTruncated: %v", result.NextMarker, result.IsTruncated)
fmt.Printf("NextMarker: %s IsTruncated: %v\n", result.NextMarker, result.IsTruncated)
}
fmt.Println("Common prefixes:")
printutils.PrintGetterList(result.CommonPrefixes, []string{"key", "size_bytes"})

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 shell
import "yunion.io/x/onecloud/pkg/multicloud/objectstore"

View File

@@ -1 +1,15 @@
// Copyright 2019 Yunion
//
// 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 shell // import "yunion.io/x/onecloud/pkg/multicloud/objectstore/shell"

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 shell
import "yunion.io/x/onecloud/pkg/util/printutils"

View File

@@ -1 +1,15 @@
// Copyright 2019 Yunion
//
// 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 models // import "yunion.io/x/onecloud/pkg/s3gateway/models"

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 models
import (

View File

@@ -1 +1,15 @@
// Copyright 2019 Yunion
//
// 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 options // import "yunion.io/x/onecloud/pkg/s3gateway/options"

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 options
import (

View File

@@ -1 +1,15 @@
// Copyright 2019 Yunion
//
// 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 service // import "yunion.io/x/onecloud/pkg/s3gateway/service"

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 service
import (

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 service
import (

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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.
// 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

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 aliyun
import (
@@ -128,7 +142,7 @@ func (b *SBucket) GetIObjects(prefix string, isRecursive bool) ([]cloudprovider.
return cloudprovider.GetIObjects(b, prefix, isRecursive)
}
func (b *SBucket) PutObject(ctx context.Context, key string, input io.ReadSeeker, contType string, storageClassStr string) error {
func (b *SBucket) PutObject(ctx context.Context, key string, input io.Reader, contType string, storageClassStr string) error {
osscli, err := b.region.GetOssClient()
if err != nil {
return errors.Wrap(err, "GetOssClient")

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 aliyun
import (

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 shell
import "yunion.io/x/onecloud/pkg/multicloud/objectstore"

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 aws
import (
@@ -6,8 +20,11 @@ import (
"io"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
"yunion.io/x/pkg/errors"
@@ -128,25 +145,30 @@ func (b *SBucket) GetIObjects(prefix string, isRecursive bool) ([]cloudprovider.
return cloudprovider.GetIObjects(b, prefix, isRecursive)
}
func (b *SBucket) PutObject(ctx context.Context, key string, reader io.ReadSeeker, contType string, storageClassStr string) error {
s3cli, err := b.region.GetS3Client()
func (b *SBucket) PutObject(ctx context.Context, key string, reader io.Reader, contType string, storageClassStr string) error {
sess, err := session.NewSession(&aws.Config{Region: aws.String(b.region.GetId())})
if err != nil {
return errors.Wrap(err, "GetS3Client")
return errors.Wrap(err, "session.NewSession")
}
input := &s3.PutObjectInput{}
input.SetBucket(b.Name)
input.SetKey(key)
input.SetBody(reader)
if len(storageClassStr) > 0 {
input.SetStorageClass(storageClassStr)
svc := s3manager.NewUploader(sess)
input := &s3manager.UploadInput{
Bucket: aws.String(b.Name),
Key: aws.String(key),
Body: reader,
}
if len(contType) > 0 {
input.SetContentType(contType)
input.ContentType = aws.String(contType)
}
_, err = s3cli.PutObjectWithContext(ctx, input)
if len(storageClassStr) > 0 {
input.StorageClass = aws.String(storageClassStr)
}
_, err = svc.Upload(input)
if err != nil {
return errors.Wrap(err, "PutObjectWithContext")
return errors.Wrap(err, "svc.Upload")
}
return nil
}

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 aws
import "yunion.io/x/onecloud/pkg/cloudprovider"

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 shell
import "yunion.io/x/onecloud/pkg/multicloud/objectstore"

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 azure
import "yunion.io/x/onecloud/pkg/cloudprovider"

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 shell
import (

View File

@@ -508,7 +508,7 @@ func (self *SContainer) CopySnapshot(snapshotId, fileName string) (*storage.Blob
return blobRef, blobRef.GetProperties(&storage.GetBlobPropertiesOptions{})
}
func (self *SContainer) UploadStream(key string, reader io.ReadSeeker, contType string) error {
func (self *SContainer) UploadStream(key string, reader io.Reader, contType string) error {
storageaccount := self.storageaccount
client, err := storage.NewBasicClientOnSovereignCloud(storageaccount.Name, storageaccount.accountKey, storageaccount.region.client.env)
if err != nil {
@@ -640,7 +640,7 @@ func (self *SStorageAccount) getOrCreateContainer(containerName string, create b
return container, nil
}
func (self *SStorageAccount) UploadStream(containerName string, key string, reader io.ReadSeeker, contType string) error {
func (self *SStorageAccount) UploadStream(containerName string, key string, reader io.Reader, contType string) error {
container, err := self.getOrCreateContainer(containerName, true)
if err != nil {
return errors.Wrap(err, "getOrCreateContainer")
@@ -849,7 +849,7 @@ func splitKey(key string) (string, string, error) {
return containerName, key, nil
}
func (b *SStorageAccount) PutObject(ctx context.Context, key string, reader io.ReadSeeker, contType string, storageClassStr string) error {
func (b *SStorageAccount) PutObject(ctx context.Context, key string, reader io.Reader, contType string, storageClassStr string) error {
containerName, blob, err := splitKey(key)
if err != nil {
return errors.Wrap(err, "splitKey")

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 huawei
import (
@@ -139,7 +153,7 @@ func (b *SBucket) ListObjects(prefix string, marker string, delimiter string, ma
return result, nil
}
func (b *SBucket) PutObject(ctx context.Context, key string, reader io.ReadSeeker, contType string, storageClassStr string) error {
func (b *SBucket) PutObject(ctx context.Context, key string, reader io.Reader, contType string, storageClassStr string) error {
obscli, err := b.region.getOBSClient()
if err != nil {
return errors.Wrap(err, "GetOBSClient")

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 huawei
import "yunion.io/x/onecloud/pkg/cloudprovider"

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 shell
import (

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 shell
import (

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 qcloud
import (
@@ -133,7 +147,7 @@ func (b *SBucket) ListObjects(prefix string, marker string, delimiter string, ma
return result, nil
}
func (b *SBucket) PutObject(ctx context.Context, key string, reader io.ReadSeeker, contType string, storageClassStr string) error {
func (b *SBucket) PutObject(ctx context.Context, key string, reader io.Reader, contType string, storageClassStr string) error {
coscli, err := b.region.GetCosClient(b)
if err != nil {
return errors.Wrap(err, "GetCosClient")

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 qcloud
import "yunion.io/x/onecloud/pkg/cloudprovider"

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// 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 shell
import (

View File

@@ -218,7 +218,7 @@ func (b *SBucket) ListObjects(prefix string, marker string, delimiter string, ma
return result, cloudprovider.ErrNotSupported
}
func (b *SBucket) PutObject(ctx context.Context, key string, reader io.ReadSeeker, contType string, storageClassStr string) error {
func (b *SBucket) PutObject(ctx context.Context, key string, reader io.Reader, contType string, storageClassStr string) error {
return cloudprovider.ErrNotSupported
}