Merge pull request #666 from openziti/fix-update-terminator-omit-cost

Fix updating terminators when cost is omitted
This commit is contained in:
Paul Lorenz
2021-05-20 11:17:09 -04:00
committed by GitHub
@@ -44,7 +44,6 @@ func MapCreateTerminatorToModel(terminator *rest_model.TerminatorCreate) *networ
Identity: terminator.Identity,
IdentitySecret: terminator.IdentitySecret,
Precedence: xt.GetPrecedenceForName(string(terminator.Precedence)),
Cost: 0,
}
if terminator.Cost != nil {
@@ -65,8 +64,12 @@ func MapUpdateTerminatorToModel(id string, terminator *rest_model.TerminatorUpda
Binding: stringz.OrEmpty(terminator.Binding),
Address: stringz.OrEmpty(terminator.Address),
Precedence: xt.GetPrecedenceForName(string(terminator.Precedence)),
Cost: uint16(*terminator.Cost),
}
if terminator.Cost != nil {
ret.Cost = uint16(*terminator.Cost)
}
return ret
}
@@ -81,8 +84,12 @@ func MapPatchTerminatorToModel(id string, terminator *rest_model.TerminatorPatch
Binding: terminator.Binding,
Address: terminator.Address,
Precedence: xt.GetPrecedenceForName(string(terminator.Precedence)),
Cost: uint16(*terminator.Cost),
}
if terminator.Cost != nil {
ret.Cost = uint16(*terminator.Cost)
}
return ret
}