fix: qcloud create bucket without appId

This commit is contained in:
Qiu Jian
2020-11-16 12:57:54 +08:00
parent b11b5a2b45
commit 38018080cc
2 changed files with 14 additions and 4 deletions
+13 -3
View File
@@ -39,7 +39,7 @@ const (
type SBucket struct {
multicloud.SBaseBucket
AppId string
appId string
region *SRegion
zone *SZone
@@ -54,7 +54,7 @@ func (b *SBucket) GetProjectId() string {
}
func (b *SBucket) GetGlobalId() string {
if b.AppId == b.region.client.appId {
if b.getAppId() == b.region.client.appId {
return b.Name
} else {
return b.getFullName()
@@ -141,8 +141,18 @@ func (b *SBucket) SetAcl(aclStr cloudprovider.TBucketACLType) error {
return nil
}
func (b *SBucket) getAppId() string {
if len(b.appId) > 0 {
return b.appId
}
if b.zone != nil {
return b.zone.region.client.appId
}
return b.region.client.appId
}
func (b *SBucket) getFullName() string {
return fmt.Sprintf("%s-%s", b.Name, b.AppId)
return fmt.Sprintf("%s-%s", b.Name, b.getAppId())
}
func (b *SBucket) getBucketUrlHost() string {
+1 -1
View File
@@ -787,7 +787,7 @@ func (client *SQcloudClient) fetchBuckets() error {
}
b := SBucket{
region: region.(*SRegion),
AppId: appId,
appId: appId,
Name: name,
Location: bInfo.Region,
CreateDate: createAt,