Skip to content

Commit ea099ec

Browse files
committed
add
1 parent 6ba8afd commit ea099ec

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

tencentcloud/services/cos/service_tencentcloud_cos.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,44 @@ func (me *CosService) GetBucketWebsite(ctx context.Context, bucket string, cdcId
780780
if response.RedirectAllRequestsTo != nil {
781781
website["redirect_all_requests_to"] = *response.RedirectAllRequestsTo.Protocol
782782
}
783+
if response.RoutingRules != nil {
784+
tmpList := make([]map[string]interface{}, 0)
785+
routingRules := make(map[string]interface{}, 0)
786+
rulesList := make([]map[string]interface{}, 0, len(response.RoutingRules))
787+
for _, item := range response.RoutingRules {
788+
tmpMap := make(map[string]interface{}, 0)
789+
if item.Condition != nil {
790+
if item.Condition.HttpErrorCodeReturnedEquals != nil {
791+
tmpMap["condition_error_code"] = item.Condition.HttpErrorCodeReturnedEquals
792+
}
793+
794+
if item.Condition.KeyPrefixEquals != nil {
795+
tmpMap["condition_prefix"] = item.Condition.KeyPrefixEquals
796+
}
797+
}
798+
799+
if item.Redirect != nil {
800+
if item.Redirect.Protocol != nil {
801+
tmpMap["redirect_protocol"] = item.Redirect.Protocol
802+
}
803+
804+
if item.Redirect.ReplaceKeyWith != nil {
805+
tmpMap["redirect_replace_key"] = item.Redirect.ReplaceKeyWith
806+
}
807+
808+
if item.Redirect.ReplaceKeyPrefixWith != nil {
809+
tmpMap["redirect_replace_key_prefix"] = item.Redirect.ReplaceKeyPrefixWith
810+
}
811+
}
812+
813+
rulesList = append(rulesList, tmpMap)
814+
}
815+
816+
routingRules["rules"] = rulesList
817+
tmpList = append(tmpList, routingRules)
818+
website["routing_rules"] = tmpList
819+
}
820+
783821
if len(website) > 0 {
784822
websites = append(websites, website)
785823
}

website/docs/r/cos_bucket.html.markdown

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,18 @@ The `replica_rules` object supports the following:
496496
* `id` - (Optional, String) Name of a specific rule.
497497
* `prefix` - (Optional, String) Prefix matching policy. Policies cannot overlap; otherwise, an error will be returned. To match the root directory, leave this parameter empty.
498498

499+
The `routing_rules` object of `website` supports the following:
500+
501+
* `rules` - (Required, List) Routing rule list.
502+
503+
The `rules` object of `routing_rules` supports the following:
504+
505+
* `condition_error_code` - (Optional, String) Specifies the error code as the match condition for the routing rule. Valid values: only 4xx return codes, such as 403 or 404.
506+
* `condition_prefix` - (Optional, String) Specifies the object key prefix as the match condition for the routing rule.
507+
* `redirect_protocol` - (Optional, String) Specifies the target protocol for the routing rule. Only HTTPS is supported.
508+
* `redirect_replace_key_prefix` - (Optional, String) Specifies the object key prefix to replace the original prefix in the request. You can set this parameter only if the condition is KeyPrefixEquals.
509+
* `redirect_replace_key` - (Optional, String) Specifies the target object key to replace the original object key in the request.
510+
499511
The `transition` object of `lifecycle_rules` supports the following:
500512

501513
* `storage_class` - (Required, String) Specifies the storage class to which you want the object to transition. Available values include `STANDARD_IA`, `MAZ_STANDARD_IA`, `INTELLIGENT_TIERING`, `MAZ_INTELLIGENT_TIERING`, `ARCHIVE`, `DEEP_ARCHIVE`. For more information, please refer to: https://cloud.tencent.com/document/product/436/33417.
@@ -507,6 +519,7 @@ The `website` object supports the following:
507519
* `error_document` - (Optional, String) An absolute path to the document to return in case of a 4XX error.
508520
* `index_document` - (Optional, String) COS returns this index document when requests are made to the root domain or any of the subfolders.
509521
* `redirect_all_requests_to` - (Optional, String) Redirects all request configurations. Valid values: http, https. Default is `http`.
522+
* `routing_rules` - (Optional, List) Routing rule configuration. A RoutingRules container can contain up to 100 RoutingRule elements.
510523

511524
## Attributes Reference
512525

0 commit comments

Comments
 (0)