Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
sinbai committed Feb 1, 2024
1 parent b947c38 commit c9b8495
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ func (r DataProtectionBackupPolicyKubernatesClusterResource) Create() sdk.Resour

policyRules := make([]backuppolicies.BasePolicyRule, 0)
policyRules = append(policyRules, expandBackupPolicyKubernetesClusterAzureBackupRuleArray(model.BackupRepeatingTimeIntervals, model.TimeZone, taggingCriteria)...)
policyRules = append(policyRules, expandBackupPolicyKubernetesClusterDefaultRetentionRule(model.DefaultRetentionRule))
if v := expandBackupPolicyKubernetesClusterDefaultRetentionRule(model.DefaultRetentionRule); v != nil {
policyRules = append(policyRules, pointer.From(v))
}
policyRules = append(policyRules, expandBackupPolicyKubernetesClusterAzureRetentionRules(model.RetentionRule)...)

parameters := backuppolicies.BaseBackupPolicyResource{
Expand Down Expand Up @@ -397,18 +399,15 @@ func expandBackupPolicyKubernetesClusterAzureBackupRuleArray(input []string, tim
return results
}

func expandBackupPolicyKubernetesClusterDefaultRetentionRule(input []DefaultRetentionRule) backuppolicies.BasePolicyRule {
results := backuppolicies.AzureRetentionRule{}
func expandBackupPolicyKubernetesClusterDefaultRetentionRule(input []DefaultRetentionRule) *backuppolicies.AzureRetentionRule {
if len(input) == 0 {
return results
return nil
}
return &backuppolicies.AzureRetentionRule{
Name: "Default",
IsDefault: pointer.To(true),
Lifecycles: expandBackupPolicyKubernetesClusterLifeCycle(input[0].LifeCycle),
}

lifeCycle := expandBackupPolicyKubernetesClusterLifeCycle(input[0].LifeCycle)
results.Name = "Default"
results.IsDefault = pointer.To(true)
results.Lifecycles = lifeCycle

return results
}

func expandBackupPolicyKubernetesClusterAzureRetentionRules(input []RetentionRule) []backuppolicies.BasePolicyRule {
Expand Down

0 comments on commit c9b8495

Please sign in to comment.