Skip to content

Commit

Permalink
update 3.23.4
Browse files Browse the repository at this point in the history
  • Loading branch information
noaccident committed May 8, 2023
1 parent b9320bf commit c0bb6c7
Show file tree
Hide file tree
Showing 19 changed files with 2,187 additions and 1,734 deletions.
17 changes: 17 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,20 @@
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.


## OPEN SOURCE SOFTWARE NOTICE
This document contains open source software notice for this product. And this document is confidential information of copyright holder. Recipient shall protect it in due care and shall not disseminate it without permission.

### Warranty Disclaimer
THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,BUT WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.

### Copyright Notice and License Texts

### Written Offer
This product contains software whose rights holders license it on the terms of the GNU General Public License, version 2 (GPLv2) or other open source software license. We will provide you with the source code of the software licensed under related license if you send us a written request by mail or email to the following addresses:
[email protected]
detailing the name of the product and the firmware version for which you need the source code and indicating how we can contact you.

**PLEASE NOTE THAT WE WILL ASK YOU TO PAY US FOR THE COSTS OF A DATA CARRIER AND THE POSTAL CHARGES TO SEND THE DATA CARRIER TO YOU. THIS OFFER IS VALID FOR THREE YEARS FROM THE MOMENT WE DISTRIBUTED THE PRODUCT AND VALID FOR AS LONG AS WE OFFER SPARE PARTS OR CUSTOMER SUPPORT FOR THAT PRODUCT MODEL.**

Binary file added huaweicloud-obs-sdk-go_3.23.4.tar.gz
Binary file not shown.
111 changes: 111 additions & 0 deletions main/obs_go_sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,111 @@ func deleteBucketLifecycleConfiguration() {
}
}
}
func setBucketMirrorBackToSource() {
input := &obs.SetBucketMirrorBackToSourceInput{}
input.Bucket = bucketName
input.Rules = "your rules"
output, err := getObsClient().SetBucketMirrorBackToSource(input)
if err == nil {
fmt.Printf("StatusCode:%d, RequestId:%s\n", output.StatusCode, output.RequestId)
} else {
if obsError, ok := err.(obs.ObsError); ok {
fmt.Println(obsError.StatusCode)
fmt.Println(obsError.Code)
fmt.Println(obsError.Message)
} else {
fmt.Println(err)
}
}
}

func getBucketMirrorBackToSource() {
output, err := getObsClient().GetBucketMirrorBackToSource(bucketName)
if err == nil {
fmt.Printf("StatusCode:%d, RequestId:%s\n", output.StatusCode, output.RequestId)
fmt.Printf("Rules:%s\n", output.Rules)
} else {
if obsError, ok := err.(obs.ObsError); ok {
fmt.Println(obsError.StatusCode)
fmt.Println(obsError.Code)
fmt.Println(obsError.Message)
} else {
fmt.Println(err)
}
}
}

func deleteBucketMirrorBackToSource() {
output, err := getObsClient().DeleteBucketMirrorBackToSource(bucketName)
if err == nil {
fmt.Printf("StatusCode:%d, RequestId:%s\n", output.StatusCode, output.RequestId)
} else {
if obsError, ok := err.(obs.ObsError); ok {
fmt.Println(obsError.StatusCode)
fmt.Println(obsError.Code)
fmt.Println(obsError.Message)
} else {
fmt.Println(err)
}
}
}

func setBucketCustomDomain() {
input := &obs.SetBucketCustomDomainInput{}
input.Bucket = bucketName
input.CustomDomain = "www.example.com"

output, err := getObsClient().SetBucketCustomDomain(input)
if err == nil {
fmt.Printf("StatusCode:%d, RequestId:%s\n", output.StatusCode, output.RequestId)
} else {
if obsError, ok := err.(obs.ObsError); ok {
fmt.Println(obsError.StatusCode)
fmt.Println(obsError.Code)
fmt.Println(obsError.Message)
} else {
fmt.Println(err)
}
}
}

func getBucketCustomDomain() {

output, err := getObsClient().GetBucketCustomDomain(bucketName)
if err == nil {
fmt.Printf("StatusCode:%d, RequestId:%s\n", output.StatusCode, output.RequestId)
for index, domain := range output.Domains {
fmt.Printf("index[%d], DomainName:%s, CreateTime:%s\n", index, domain.DomainName, domain.CreateTime)
}
} else {
if obsError, ok := err.(obs.ObsError); ok {
fmt.Println(obsError.StatusCode)
fmt.Println(obsError.Code)
fmt.Println(obsError.Message)
} else {
fmt.Println(err)
}
}
}

func deleteBucketCustomdomain() {
input := &obs.DeleteBucketCustomDomainInput{}
input.Bucket = bucketName
input.CustomDomain = "www.test-go4444.com"

output, err := getObsClient().DeleteBucketCustomDomain(input)
if err == nil {
fmt.Printf("StatusCode:%d, RequestId:%s\n", output.StatusCode, output.RequestId)
} else {
if obsError, ok := err.(obs.ObsError); ok {
fmt.Println(obsError.StatusCode)
fmt.Println(obsError.Code)
fmt.Println(obsError.Message)
} else {
fmt.Println(err)
}
}
}

func setBucketTagging() {
input := &obs.SetBucketTaggingInput{}
Expand Down Expand Up @@ -1565,6 +1670,12 @@ func main() {
// setBucketEncryption()
// getBucketEncryption()
// deleteBucketEncryption()
// setBucketMirrorBackToSource()
// getBucketMirrorBackToSource()
// deleteBucketMirrorBackToSource()
// setBucketCustomDomain()
// getBucketCustomDomain()
// deleteBucketCustomdomain()
// getBucketFSStatus()
// getAttribute()
// newFolder()
Expand Down
63 changes: 63 additions & 0 deletions obs/client_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,69 @@ import (
"strings"
)

func (obsClient ObsClient) DeleteBucketCustomDomain(input *DeleteBucketCustomDomainInput, extensions ...extensionOptions) (output *BaseModel, err error) {
if input == nil {
return nil, errors.New("DeleteBucketCustomDomainInput is nil")
}

output = &BaseModel{}
err = obsClient.doActionWithBucket("DeleteBucketCustomDomain", HTTP_DELETE, input.Bucket, newSubResourceSerialV2(SubResourceCustomDomain, input.CustomDomain), output, extensions)
if err != nil {
output = nil
}
return
}

func (obsClient ObsClient) SetBucketCustomDomain(input *SetBucketCustomDomainInput, extensions ...extensionOptions) (output *BaseModel, err error) {
if input == nil {
return nil, errors.New("SetBucketCustomDomainInput is nil")
}

output = &BaseModel{}
err = obsClient.doActionWithBucket("SetBucketCustomDomain", HTTP_PUT, input.Bucket, newSubResourceSerialV2(SubResourceCustomDomain, input.CustomDomain), output, extensions)
if err != nil {
output = nil
}
return
}

func (obsClient ObsClient) GetBucketCustomDomain(bucketName string, extensions ...extensionOptions) (output *GetBucketCustomDomainOuput, err error) {
output = &GetBucketCustomDomainOuput{}
err = obsClient.doActionWithBucket("GetBucketCustomDomain", HTTP_GET, bucketName, newSubResourceSerial(SubResourceCustomDomain), output, extensions)
if err != nil {
output = nil
}
return
}

func (obsClient ObsClient) SetBucketMirrorBackToSource(input *SetBucketMirrorBackToSourceInput, extensions ...extensionOptions) (output *BaseModel, err error) {

output = &BaseModel{}
err = obsClient.doActionWithBucket("SetBucketMirrorBackToSource", HTTP_PUT, input.Bucket, input, output, extensions)
if err != nil {
output = nil
}
return
}

func (obsClient ObsClient) DeleteBucketMirrorBackToSource(bucketName string, extensions ...extensionOptions) (output *BaseModel, err error) {
output = &BaseModel{}
err = obsClient.doActionWithBucketV2("DeleteBucketMirrorBackToSource", HTTP_DELETE, bucketName, newSubResourceSerial(SubResourceMirrorBackToSource), output, extensions)
if err != nil {
output = nil
}
return
}

func (obsClient ObsClient) GetBucketMirrorBackToSource(bucketName string, extensions ...extensionOptions) (output *GetBucketMirrorBackToSourceOuput, err error) {
output = &GetBucketMirrorBackToSourceOuput{}
err = obsClient.doActionWithBucketV2("GetBucketMirrorBackToSource", HTTP_GET, bucketName, newSubResourceSerial(SubResourceMirrorBackToSource), output, extensions)
if err != nil {
output = nil
}
return
}

// ListBuckets lists buckets.
//
// You can use this API to obtain the bucket list. In the list, bucket names are displayed in lexicographical order.
Expand Down
Loading

0 comments on commit c0bb6c7

Please sign in to comment.