查看PDF

获取桶的Website配置

更新时间: 2019-03-13 10:25

功能说明

获取桶的Website配置。

方法定义

  1. func (obsClient ObsClient) GetBucketWebsiteConfiguration(bucketName string) (output *GetBucketWebsiteConfigurationOutput, err error)

使用带授权信息URL的方法定义

  1. func (obsClient ObsClient) GetBucketWebsiteConfigurationWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header) (output *GetBucketWebsiteConfigurationOutput, err error)

请求参数


参数名

类型

约束

说明

bucketName

string

必选

桶名。

返回结果


参数名

类型

output

*GetBucketWebsiteConfigurationOutput

err

error

代码样例

  1. func main() {
  2. output, err := obsClient.GetBucketWebsiteConfiguration("bucketname")
  3. if err == nil {
  4. fmt.Printf("RequestId:%s\n", output.RequestId)
  5. fmt.Printf("Suffix:%s\n", output.IndexDocument.Suffix)
  6. fmt.Printf("Key:%s\n", output.ErrorDocument.Key)
  7. for index, routingRule := range output.RoutingRules {
  8. fmt.Printf("Condition[%d]-KeyPrefixEquals:%s, HttpErrorCodeReturnedEquals:%s\n", index, routingRule.Condition.KeyPrefixEquals, routingRule.Condition.HttpErrorCodeReturnedEquals)
  9. fmt.Printf("Redirect[%d]-Protocol:%s, HostName:%s, ReplaceKeyPrefixWith:%s, HttpRedirectCode:%s\n",
  10. index, routingRule.Redirect.Protocol, routingRule.Redirect.HostName, routingRule.Redirect.ReplaceKeyPrefixWith, routingRule.Redirect.HttpRedirectCode)
  11. }
  12. } else {
  13. if obsError, ok := err.(obs.ObsError); ok {
  14. fmt.Println(obsError.Code)
  15. fmt.Println(obsError.Message)
  16. } else {
  17. fmt.Println(err)
  18. }
  19. }
  20. }

父主题:桶相关接口