Skip to content

Commit

Permalink
Merge pull request #31 from ks3sdklib/fix_create_bucket
Browse files Browse the repository at this point in the history
修复创建桶时总是使用第一次的项目 ID 的问题
  • Loading branch information
LiKui-2 authored Dec 1, 2023
2 parents c0fb853 + 331c1cf commit f29de47
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion aws/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ package aws
const SDKName = "aws-sdk-go"

// SDKVersion is the version of this SDK
const SDKVersion = "1.2.7"
const SDKVersion = "1.2.8"
51 changes: 24 additions & 27 deletions service/s3/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,18 @@ func (c *S3) CreateBucketRequest(input *CreateBucketInput) (req *aws.Request, ou
oprw.Lock()
defer oprw.Unlock()

if opCreateBucket == nil {
if input.ProjectId == nil {
opCreateBucket = &aws.Operation{
Name: "CreateBucket",
HTTPMethod: "PUT",
HTTPPath: "/{Bucket}",
}
} else {
opCreateBucket = &aws.Operation{
Name: "CreateBucket",
HTTPMethod: "PUT",
HTTPPath: "/{Bucket}?projectId=" + *input.ProjectId,
}
var opCreateBucket *aws.Operation
if input.ProjectId == nil {
opCreateBucket = &aws.Operation{
Name: "CreateBucket",
HTTPMethod: "PUT",
HTTPPath: "/{Bucket}",
}
} else {
opCreateBucket = &aws.Operation{
Name: "CreateBucket",
HTTPMethod: "PUT",
HTTPPath: "/{Bucket}?projectId=" + *input.ProjectId,
}
}

Expand All @@ -163,8 +162,6 @@ func (c *S3) CreateBucket(input *CreateBucketInput) (*CreateBucketOutput, error)
return out, err
}

var opCreateBucket *aws.Operation

// CreateMultipartUploadRequest generates a request for the CreateMultipartUpload operation.
func (c *S3) CreateMultipartUploadRequest(input *CreateMultipartUploadInput) (req *aws.Request, output *CreateMultipartUploadOutput) {
oprw.Lock()
Expand Down Expand Up @@ -1021,7 +1018,7 @@ func (c *S3) HeadBucket(input *HeadBucketInput) (*HeadBucketOutput, error) {
return out, err
}

//判断桶是否存在
// 判断桶是否存在
func (c *S3) HeadBucketExist(bucket string) (bool, error) {
var err error
req, _ := c.HeadBucketRequest(&HeadBucketInput{
Expand Down Expand Up @@ -1704,14 +1701,14 @@ func (c *S3) PutObject(input *PutObjectInput) (*PutObjectOutput, error) {
return out, err
}

//func (c *S3) PutObjectMD5Check(input *PutObjectInput) (*PutObjectOutput, error) {
// func (c *S3) PutObjectMD5Check(input *PutObjectInput) (*PutObjectOutput, error) {
// req, out := c.PutObjectRequest(input)
// req.Handlers.Build.PushBack(contentMD5)
// err := req.Send()
// return out, err
//}
// }

//生成链接
// 生成链接
func (c *S3) GeneratePresignedUrl(input *GeneratePresignedUrlInput) (url string, err error) {

opGeneratePresigned := &aws.Operation{
Expand Down Expand Up @@ -1743,7 +1740,7 @@ func (c *S3) GeneratePresignedUrl(input *GeneratePresignedUrlInput) (url string,
return req.HTTPRequest.URL.String(), nil
}

//生成链接(旧版本)
// 生成链接(旧版本)
func (c *S3) GeneratePresignedUrlInput(input *GeneratePresignedUrlInput) (url string) {

opGeneratePresigned := &aws.Operation{
Expand Down Expand Up @@ -5323,15 +5320,15 @@ type metadataWebsiteConfiguration struct {

type Header map[string][]string

//type Ks3WebServiceResponse struct {
// type Ks3WebServiceResponse struct {
// HttpCode int `xml:"HttpCode"`
// Code string `xml:"Code"`
// Message string `xml:"Message"`
// Resource string `xml:"Resource"`
// RequestId string `xml:"RequestId"`
// Header Header
// Body []byte
//}
// }

func (c *S3) SignedReq(req *http.Request, canonicalizedResource string) {

Expand Down Expand Up @@ -5438,7 +5435,7 @@ func GetAcl(resp GetObjectACLOutput) CannedAccessControlType {
}
}

//----obj tag start--
// ----obj tag start--

func (c *S3) DeleteObjectTaggingRequest(input *DeleteObjectTaggingInput) (req *aws.Request, output *DeleteObjectTaggingOutput) {
oprw.Lock()
Expand Down Expand Up @@ -5496,7 +5493,7 @@ type metadataDeleteObjectTaggingOutput struct {
SDKShapeTraits bool `type:"structure"`
}

//get 对象标签
// get 对象标签
func (c *S3) GetObjectTaggingRequest(input *GetObjectTaggingInput) (req *aws.Request, output *GetObjectTaggingOutput) {
oprw.Lock()
defer oprw.Unlock()
Expand Down Expand Up @@ -5556,7 +5553,7 @@ type metadataGetObjectTaggingOutput struct {
SDKShapeTraits bool `type:"structure" payload:"Tagging"`
}

//对象标签 put
// 对象标签 put
func (c *S3) PutObjectTaggingRequest(input *PutObjectTaggingInput) (req *aws.Request, output *PutObjectTaggingOutput) {
oprw.Lock()
defer oprw.Unlock()
Expand Down Expand Up @@ -5615,7 +5612,7 @@ type metadataPutObjectTaggingOutput struct {
SDKShapeTraits bool `type:"structure"`
}

//----obj tag end--
// ----obj tag end--

// FetchObjectRequest generates a request for the FetchObject operation.
func (c *S3) FetchObjectRequest(input *FetchObjectInput) (req *aws.Request, output *FetchObjectOutput) {
Expand Down Expand Up @@ -5788,4 +5785,4 @@ type metadataFetchObjectOutput struct {
SDKShapeTraits bool `type:"structure"`
}

//--------fetch object end-------
// --------fetch object end-------

0 comments on commit f29de47

Please sign in to comment.