Files
zeekay 241625e7d9 rename: ziti → zt across all paths
- Repo names: ziti-* → zt-*
- Go modules: github.com/hanzozt/ziti → github.com/hanzozt/zt
- Docker images: hanzozt/ziti-* → hanzozt/zt-*
- C/Java/JS symbols: ziti_* → zt_*
- File and directory names updated
2026-02-18 18:34:19 -08:00

43 lines
844 B
Go

package posture
import (
"github.com/hanzozt/zt/v2/common/pb/edge_ctrl_pb"
)
type DomainCheck struct {
*edge_ctrl_pb.DataState_PostureCheck
*edge_ctrl_pb.DataState_PostureCheck_Domains
}
func (m *DomainCheck) Evaluate(state *InstanceData) *CheckError {
if state == nil {
return &CheckError{
Id: m.Id,
Name: m.Name,
Cause: NilStateError,
}
}
notInListErr := &AnyInListError[Str]{
GivenValues: []Str{Str(state.Domain.Name)},
}
for _, domain := range m.Domains {
if state.Domain.Name != domain {
notInListErr.FailedValues = append(notInListErr.FailedValues, FailedValueError[Str]{
ExpectedValue: Str(domain),
GivenValue: Str(state.Domain.Name),
Reason: NotEqualError,
})
} else {
return nil
}
}
return &CheckError{
Id: m.Id,
Name: m.Name,
Cause: notInListErr,
}
}