Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
71 lines (57 sloc) 2.04 KB
// Code generated by solo-kit. DO NOT EDIT.
package v1
import (
gloo_solo_io "github.com/solo-io/gloo/projects/gloo/pkg/api/v1"
encryption_istio_io "github.com/solo-io/supergloo/pkg/api/external/istio/encryption/v1"
"github.com/solo-io/solo-kit/pkg/utils/hashutils"
"go.uber.org/zap"
)
type TranslatorSnapshot struct {
Secrets gloo_solo_io.SecretsByNamespace
Upstreams gloo_solo_io.UpstreamsByNamespace
Meshes MeshesByNamespace
Routingrules RoutingrulesByNamespace
Istiocerts encryption_istio_io.IstiocertsByNamespace
}
func (s TranslatorSnapshot) Clone() TranslatorSnapshot {
return TranslatorSnapshot{
Secrets: s.Secrets.Clone(),
Upstreams: s.Upstreams.Clone(),
Meshes: s.Meshes.Clone(),
Routingrules: s.Routingrules.Clone(),
Istiocerts: s.Istiocerts.Clone(),
}
}
func (s TranslatorSnapshot) Hash() uint64 {
return hashutils.HashAll(
s.hashSecrets(),
s.hashUpstreams(),
s.hashMeshes(),
s.hashRoutingrules(),
s.hashIstiocerts(),
)
}
func (s TranslatorSnapshot) hashSecrets() uint64 {
return hashutils.HashAll(s.Secrets.List().AsInterfaces()...)
}
func (s TranslatorSnapshot) hashUpstreams() uint64 {
return hashutils.HashAll(s.Upstreams.List().AsInterfaces()...)
}
func (s TranslatorSnapshot) hashMeshes() uint64 {
return hashutils.HashAll(s.Meshes.List().AsInterfaces()...)
}
func (s TranslatorSnapshot) hashRoutingrules() uint64 {
return hashutils.HashAll(s.Routingrules.List().AsInterfaces()...)
}
func (s TranslatorSnapshot) hashIstiocerts() uint64 {
return hashutils.HashAll(s.Istiocerts.List().AsInterfaces()...)
}
func (s TranslatorSnapshot) HashFields() []zap.Field {
var fields []zap.Field
fields = append(fields, zap.Uint64("secrets", s.hashSecrets()))
fields = append(fields, zap.Uint64("upstreams", s.hashUpstreams()))
fields = append(fields, zap.Uint64("meshes", s.hashMeshes()))
fields = append(fields, zap.Uint64("routingrules", s.hashRoutingrules()))
fields = append(fields, zap.Uint64("istiocerts", s.hashIstiocerts()))
return append(fields, zap.Uint64("snapshotHash", s.Hash()))
}