rubrik-sdk-for-go
rubrik-sdk-for-go copied to clipboard
assign_sla() should overwrite inherited SLA assignments with a direct assignment
Is your feature request related to a problem? Please describe.
AssignSLA currently has an idempotence check that will not assign an SLA if its already applied via inheritance. The function should overwrite any inherited assignment with a direct assignment instead.
Describe the solution you'd like
Current:
var currentSLAID string
switch slaID {
case "INHERIT":
currentSLAID = vmSummary.(map[string]interface{})["configuredSlaDomainId"].(string)
default:
currentSLAID = vmSummary.(map[string]interface{})["effectiveSlaDomainId"].(string)
}
if slaID == currentSLAID {
return nil, fmt.Errorf("No change required. The vSphere VM '%s' is already assigned to the '%s' SLA Domain", objectName, slaName)
}
Updates:
if slaID == vmSummary.(map[string]interface{})["configuredSlaDomainId"].(string) {
return nil, fmt.Errorf("No change required. The vSphere VM '%s' is already assigned to the '%s' SLA Domain", objectName, slaName)
}