@@ -698,6 +698,51 @@ func (r *distributionResource) Update(ctx context.Context, req resource.UpdateRe
698698 blockedCountries = & tempBlockedCountries
699699 }
700700
701+ // redirects
702+ var redirectsConfig * cdn.RedirectConfig
703+ if configModel .Redirects != nil {
704+ sdkRules := []cdn.RedirectRule {}
705+ if len (configModel .Redirects .Rules ) > 0 {
706+ for _ , rule := range configModel .Redirects .Rules {
707+ matchers := []cdn.Matcher {}
708+ for _ , matcher := range rule .Matchers {
709+ var matchCond * cdn.MatchCondition
710+ if matcher .ValueMatchCondition != nil {
711+ cond := cdn .MatchCondition (* matcher .ValueMatchCondition )
712+ matchCond = & cond
713+ }
714+
715+ matchers = append (matchers , cdn.Matcher {
716+ Values : & matcher .Values ,
717+ ValueMatchCondition : matchCond ,
718+ })
719+ }
720+
721+ var ruleMatchCond * cdn.MatchCondition
722+ if rule .RuleMatchCondition != nil {
723+ cond := cdn .MatchCondition (* rule .RuleMatchCondition )
724+ ruleMatchCond = & cond
725+ }
726+
727+ statusCode := cdn .RedirectRuleStatusCode (rule .StatusCode )
728+ targetUrl := rule .TargetUrl
729+
730+ sdkConfigRule := cdn.RedirectRule {
731+ Description : rule .Description ,
732+ Enabled : rule .Enabled ,
733+ Matchers : & matchers ,
734+ RuleMatchCondition : ruleMatchCond ,
735+ StatusCode : & statusCode ,
736+ TargetUrl : & targetUrl ,
737+ }
738+ sdkRules = append (sdkRules , sdkConfigRule )
739+ }
740+ }
741+ redirectsConfig = & cdn.RedirectConfig {
742+ Rules : & sdkRules ,
743+ }
744+ }
745+
701746 configPatchBackend := & cdn.ConfigPatchBackend {}
702747
703748 switch configModel .Backend .Type {
0 commit comments