rubrik-sdk-for-go icon indicating copy to clipboard operation
rubrik-sdk-for-go copied to clipboard

assign_sla() should overwrite inherited SLA assignments with a direct assignment

Open drew-russell opened this issue 6 years ago • 0 comments

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)
}

drew-russell avatar Feb 20 '19 18:02 drew-russell