2020-09-18 18:05:15 +00:00
|
|
|
// Code generated by mog. DO NOT EDIT.
|
|
|
|
|
|
|
|
package pbservice
|
|
|
|
|
2022-03-23 16:10:03 +00:00
|
|
|
import "github.com/hashicorp/consul/agent/structs"
|
2020-09-18 18:05:15 +00:00
|
|
|
|
2022-03-23 16:10:03 +00:00
|
|
|
func ConnectProxyConfigToStructs(s *ConnectProxyConfig, t *structs.ConnectProxyConfig) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
2022-12-22 18:03:33 +00:00
|
|
|
t.EnvoyExtensions = EnvoyExtensionsToStructs(s.EnvoyExtensions)
|
2020-09-18 18:05:15 +00:00
|
|
|
t.DestinationServiceName = s.DestinationServiceName
|
|
|
|
t.DestinationServiceID = s.DestinationServiceID
|
|
|
|
t.LocalServiceAddress = s.LocalServiceAddress
|
|
|
|
t.LocalServicePort = int(s.LocalServicePort)
|
2021-05-04 04:43:55 +00:00
|
|
|
t.LocalServiceSocketPath = s.LocalServiceSocketPath
|
2022-03-23 16:10:03 +00:00
|
|
|
t.Mode = structs.ProxyMode(s.Mode)
|
2020-09-18 18:05:15 +00:00
|
|
|
t.Config = ProtobufTypesStructToMapStringInterface(s.Config)
|
|
|
|
t.Upstreams = UpstreamsToStructs(s.Upstreams)
|
2022-03-23 16:10:03 +00:00
|
|
|
if s.MeshGateway != nil {
|
|
|
|
MeshGatewayConfigToStructs(s.MeshGateway, &t.MeshGateway)
|
|
|
|
}
|
|
|
|
if s.Expose != nil {
|
|
|
|
ExposeConfigToStructs(s.Expose, &t.Expose)
|
|
|
|
}
|
|
|
|
if s.TransparentProxy != nil {
|
|
|
|
TransparentProxyConfigToStructs(s.TransparentProxy, &t.TransparentProxy)
|
|
|
|
}
|
2020-09-18 18:05:15 +00:00
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
func ConnectProxyConfigFromStructs(t *structs.ConnectProxyConfig, s *ConnectProxyConfig) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
2022-12-22 18:03:33 +00:00
|
|
|
s.EnvoyExtensions = EnvoyExtensionsFromStructs(t.EnvoyExtensions)
|
2020-09-18 18:05:15 +00:00
|
|
|
s.DestinationServiceName = t.DestinationServiceName
|
|
|
|
s.DestinationServiceID = t.DestinationServiceID
|
|
|
|
s.LocalServiceAddress = t.LocalServiceAddress
|
|
|
|
s.LocalServicePort = int32(t.LocalServicePort)
|
2021-05-04 04:43:55 +00:00
|
|
|
s.LocalServiceSocketPath = t.LocalServiceSocketPath
|
2022-03-23 16:10:03 +00:00
|
|
|
s.Mode = string(t.Mode)
|
2020-09-18 18:05:15 +00:00
|
|
|
s.Config = MapStringInterfaceToProtobufTypesStruct(t.Config)
|
|
|
|
s.Upstreams = NewUpstreamsFromStructs(t.Upstreams)
|
2022-03-23 16:10:03 +00:00
|
|
|
{
|
|
|
|
var x MeshGatewayConfig
|
|
|
|
MeshGatewayConfigFromStructs(&t.MeshGateway, &x)
|
|
|
|
s.MeshGateway = &x
|
|
|
|
}
|
|
|
|
{
|
|
|
|
var x ExposeConfig
|
|
|
|
ExposeConfigFromStructs(&t.Expose, &x)
|
|
|
|
s.Expose = &x
|
|
|
|
}
|
|
|
|
{
|
|
|
|
var x TransparentProxyConfig
|
|
|
|
TransparentProxyConfigFromStructs(&t.TransparentProxy, &x)
|
|
|
|
s.TransparentProxy = &x
|
|
|
|
}
|
2020-09-18 18:05:15 +00:00
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
func ExposeConfigToStructs(s *ExposeConfig, t *structs.ExposeConfig) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
2020-09-18 18:05:15 +00:00
|
|
|
t.Checks = s.Checks
|
|
|
|
t.Paths = ExposePathSliceToStructs(s.Paths)
|
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
func ExposeConfigFromStructs(t *structs.ExposeConfig, s *ExposeConfig) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
2020-09-18 18:05:15 +00:00
|
|
|
s.Checks = t.Checks
|
|
|
|
s.Paths = NewExposePathSliceFromStructs(t.Paths)
|
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
func ExposePathToStructs(s *ExposePath, t *structs.ExposePath) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
2020-09-18 18:05:15 +00:00
|
|
|
t.ListenerPort = int(s.ListenerPort)
|
|
|
|
t.Path = s.Path
|
|
|
|
t.LocalPathPort = int(s.LocalPathPort)
|
|
|
|
t.Protocol = s.Protocol
|
|
|
|
t.ParsedFromCheck = s.ParsedFromCheck
|
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
func ExposePathFromStructs(t *structs.ExposePath, s *ExposePath) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
2020-09-18 18:05:15 +00:00
|
|
|
s.ListenerPort = int32(t.ListenerPort)
|
|
|
|
s.Path = t.Path
|
|
|
|
s.LocalPathPort = int32(t.LocalPathPort)
|
|
|
|
s.Protocol = t.Protocol
|
|
|
|
s.ParsedFromCheck = t.ParsedFromCheck
|
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
func MeshGatewayConfigToStructs(s *MeshGatewayConfig, t *structs.MeshGatewayConfig) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
t.Mode = structs.MeshGatewayMode(s.Mode)
|
2020-09-18 18:05:15 +00:00
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
func MeshGatewayConfigFromStructs(t *structs.MeshGatewayConfig, s *MeshGatewayConfig) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
s.Mode = string(t.Mode)
|
2020-09-18 18:05:15 +00:00
|
|
|
}
|
2022-05-25 17:37:44 +00:00
|
|
|
func PeeringServiceMetaToStructs(s *PeeringServiceMeta, t *structs.PeeringServiceMeta) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
t.SNI = s.SNI
|
|
|
|
t.SpiffeID = s.SpiffeID
|
|
|
|
t.Protocol = s.Protocol
|
|
|
|
}
|
|
|
|
func PeeringServiceMetaFromStructs(t *structs.PeeringServiceMeta, s *PeeringServiceMeta) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
s.SNI = t.SNI
|
|
|
|
s.SpiffeID = t.SpiffeID
|
|
|
|
s.Protocol = t.Protocol
|
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
func ServiceConnectToStructs(s *ServiceConnect, t *structs.ServiceConnect) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
2020-09-18 18:05:15 +00:00
|
|
|
t.Native = s.Native
|
|
|
|
t.SidecarService = ServiceDefinitionPtrToStructs(s.SidecarService)
|
2022-05-25 17:37:44 +00:00
|
|
|
if s.PeerMeta != nil {
|
|
|
|
var x structs.PeeringServiceMeta
|
|
|
|
PeeringServiceMetaToStructs(s.PeerMeta, &x)
|
|
|
|
t.PeerMeta = &x
|
|
|
|
}
|
2020-09-18 18:05:15 +00:00
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
func ServiceConnectFromStructs(t *structs.ServiceConnect, s *ServiceConnect) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
2020-09-18 18:05:15 +00:00
|
|
|
s.Native = t.Native
|
|
|
|
s.SidecarService = NewServiceDefinitionPtrFromStructs(t.SidecarService)
|
2022-05-25 17:37:44 +00:00
|
|
|
if t.PeerMeta != nil {
|
|
|
|
var x PeeringServiceMeta
|
|
|
|
PeeringServiceMetaFromStructs(t.PeerMeta, &x)
|
|
|
|
s.PeerMeta = &x
|
|
|
|
}
|
2020-09-18 18:05:15 +00:00
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
func ServiceDefinitionToStructs(s *ServiceDefinition, t *structs.ServiceDefinition) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
t.Kind = structs.ServiceKind(s.Kind)
|
2020-09-18 18:05:15 +00:00
|
|
|
t.ID = s.ID
|
|
|
|
t.Name = s.Name
|
|
|
|
t.Tags = s.Tags
|
|
|
|
t.Address = s.Address
|
|
|
|
t.TaggedAddresses = MapStringServiceAddressToStructs(s.TaggedAddresses)
|
|
|
|
t.Meta = s.Meta
|
|
|
|
t.Port = int(s.Port)
|
2021-05-05 16:51:40 +00:00
|
|
|
t.SocketPath = s.SocketPath
|
2022-03-23 16:10:03 +00:00
|
|
|
if s.Check != nil {
|
|
|
|
CheckTypeToStructs(s.Check, &t.Check)
|
2022-03-15 14:34:46 +00:00
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
t.Checks = CheckTypesToStructs(s.Checks)
|
2020-09-18 18:05:15 +00:00
|
|
|
t.Weights = WeightsPtrToStructs(s.Weights)
|
|
|
|
t.Token = s.Token
|
|
|
|
t.EnableTagOverride = s.EnableTagOverride
|
|
|
|
t.Proxy = ConnectProxyConfigPtrToStructs(s.Proxy)
|
|
|
|
t.EnterpriseMeta = EnterpriseMetaToStructs(s.EnterpriseMeta)
|
|
|
|
t.Connect = ServiceConnectPtrToStructs(s.Connect)
|
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
func ServiceDefinitionFromStructs(t *structs.ServiceDefinition, s *ServiceDefinition) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
s.Kind = string(t.Kind)
|
2020-09-18 18:05:15 +00:00
|
|
|
s.ID = t.ID
|
|
|
|
s.Name = t.Name
|
|
|
|
s.Tags = t.Tags
|
|
|
|
s.Address = t.Address
|
|
|
|
s.TaggedAddresses = NewMapStringServiceAddressFromStructs(t.TaggedAddresses)
|
|
|
|
s.Meta = t.Meta
|
|
|
|
s.Port = int32(t.Port)
|
2021-05-05 16:51:40 +00:00
|
|
|
s.SocketPath = t.SocketPath
|
2022-03-23 16:10:03 +00:00
|
|
|
{
|
|
|
|
var x CheckType
|
|
|
|
CheckTypeFromStructs(&t.Check, &x)
|
|
|
|
s.Check = &x
|
|
|
|
}
|
2020-09-18 18:05:15 +00:00
|
|
|
s.Checks = NewCheckTypesFromStructs(t.Checks)
|
|
|
|
s.Weights = NewWeightsPtrFromStructs(t.Weights)
|
|
|
|
s.Token = t.Token
|
|
|
|
s.EnableTagOverride = t.EnableTagOverride
|
|
|
|
s.Proxy = NewConnectProxyConfigPtrFromStructs(t.Proxy)
|
|
|
|
s.EnterpriseMeta = NewEnterpriseMetaFromStructs(t.EnterpriseMeta)
|
|
|
|
s.Connect = NewServiceConnectPtrFromStructs(t.Connect)
|
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
func TransparentProxyConfigToStructs(s *TransparentProxyConfig, t *structs.TransparentProxyConfig) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
2021-04-15 19:21:44 +00:00
|
|
|
t.OutboundListenerPort = int(s.OutboundListenerPort)
|
2021-06-09 20:34:17 +00:00
|
|
|
t.DialedDirectly = s.DialedDirectly
|
2021-04-15 19:21:44 +00:00
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
func TransparentProxyConfigFromStructs(t *structs.TransparentProxyConfig, s *TransparentProxyConfig) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
2021-04-15 19:21:44 +00:00
|
|
|
s.OutboundListenerPort = int32(t.OutboundListenerPort)
|
2021-06-09 20:34:17 +00:00
|
|
|
s.DialedDirectly = t.DialedDirectly
|
2021-04-15 19:21:44 +00:00
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
func UpstreamToStructs(s *Upstream, t *structs.Upstream) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
2020-09-18 18:05:15 +00:00
|
|
|
t.DestinationType = s.DestinationType
|
|
|
|
t.DestinationNamespace = s.DestinationNamespace
|
2021-08-20 16:57:45 +00:00
|
|
|
t.DestinationPartition = s.DestinationPartition
|
2022-04-29 22:12:51 +00:00
|
|
|
t.DestinationPeer = s.DestinationPeer
|
2020-09-18 18:05:15 +00:00
|
|
|
t.DestinationName = s.DestinationName
|
|
|
|
t.Datacenter = s.Datacenter
|
|
|
|
t.LocalBindAddress = s.LocalBindAddress
|
|
|
|
t.LocalBindPort = int(s.LocalBindPort)
|
2021-05-04 04:43:55 +00:00
|
|
|
t.LocalBindSocketPath = s.LocalBindSocketPath
|
|
|
|
t.LocalBindSocketMode = s.LocalBindSocketMode
|
2020-09-18 18:05:15 +00:00
|
|
|
t.Config = ProtobufTypesStructToMapStringInterface(s.Config)
|
2022-03-23 16:10:03 +00:00
|
|
|
if s.MeshGateway != nil {
|
|
|
|
MeshGatewayConfigToStructs(s.MeshGateway, &t.MeshGateway)
|
|
|
|
}
|
2021-03-11 21:58:59 +00:00
|
|
|
t.CentrallyConfigured = s.CentrallyConfigured
|
2020-09-18 18:05:15 +00:00
|
|
|
}
|
2022-03-23 16:10:03 +00:00
|
|
|
func UpstreamFromStructs(t *structs.Upstream, s *Upstream) {
|
|
|
|
if s == nil {
|
|
|
|
return
|
|
|
|
}
|
2020-09-18 18:05:15 +00:00
|
|
|
s.DestinationType = t.DestinationType
|
|
|
|
s.DestinationNamespace = t.DestinationNamespace
|
2021-08-20 16:57:45 +00:00
|
|
|
s.DestinationPartition = t.DestinationPartition
|
2022-04-29 22:12:51 +00:00
|
|
|
s.DestinationPeer = t.DestinationPeer
|
2020-09-18 18:05:15 +00:00
|
|
|
s.DestinationName = t.DestinationName
|
|
|
|
s.Datacenter = t.Datacenter
|
|
|
|
s.LocalBindAddress = t.LocalBindAddress
|
|
|
|
s.LocalBindPort = int32(t.LocalBindPort)
|
2021-05-04 04:43:55 +00:00
|
|
|
s.LocalBindSocketPath = t.LocalBindSocketPath
|
|
|
|
s.LocalBindSocketMode = t.LocalBindSocketMode
|
2020-09-18 18:05:15 +00:00
|
|
|
s.Config = MapStringInterfaceToProtobufTypesStruct(t.Config)
|
2022-03-23 16:10:03 +00:00
|
|
|
{
|
|
|
|
var x MeshGatewayConfig
|
|
|
|
MeshGatewayConfigFromStructs(&t.MeshGateway, &x)
|
|
|
|
s.MeshGateway = &x
|
|
|
|
}
|
2021-03-11 21:58:59 +00:00
|
|
|
s.CentrallyConfigured = t.CentrallyConfigured
|
2020-09-18 18:05:15 +00:00
|
|
|
}
|