2021-04-06 18:19:59 +00:00
|
|
|
package api
|
|
|
|
|
2021-04-29 21:44:32 +00:00
|
|
|
import "encoding/json"
|
|
|
|
|
2021-04-28 22:13:29 +00:00
|
|
|
type MeshConfigEntry struct {
|
|
|
|
Namespace string `json:",omitempty"`
|
|
|
|
TransparentProxy TransparentProxyMeshConfig `alias:"transparent_proxy"`
|
|
|
|
Meta map[string]string `json:",omitempty"`
|
2021-04-06 18:19:59 +00:00
|
|
|
CreateIndex uint64
|
|
|
|
ModifyIndex uint64
|
|
|
|
}
|
|
|
|
|
2021-04-28 22:13:29 +00:00
|
|
|
type TransparentProxyMeshConfig struct {
|
2021-06-14 20:15:09 +00:00
|
|
|
MeshDestinationsOnly bool `alias:"mesh_destinations_only"`
|
2021-04-06 18:19:59 +00:00
|
|
|
}
|
|
|
|
|
2021-04-28 22:13:29 +00:00
|
|
|
func (e *MeshConfigEntry) GetKind() string {
|
2021-04-29 19:54:27 +00:00
|
|
|
return MeshConfig
|
2021-04-06 18:19:59 +00:00
|
|
|
}
|
|
|
|
|
2021-04-28 22:13:29 +00:00
|
|
|
func (e *MeshConfigEntry) GetName() string {
|
2021-04-29 19:54:27 +00:00
|
|
|
return MeshConfigMesh
|
2021-04-06 18:19:59 +00:00
|
|
|
}
|
|
|
|
|
2021-04-28 22:13:29 +00:00
|
|
|
func (e *MeshConfigEntry) GetNamespace() string {
|
2021-04-06 18:19:59 +00:00
|
|
|
return e.Namespace
|
|
|
|
}
|
|
|
|
|
2021-04-28 22:13:29 +00:00
|
|
|
func (e *MeshConfigEntry) GetMeta() map[string]string {
|
2021-04-06 18:19:59 +00:00
|
|
|
return e.Meta
|
|
|
|
}
|
|
|
|
|
2021-04-28 22:13:29 +00:00
|
|
|
func (e *MeshConfigEntry) GetCreateIndex() uint64 {
|
2021-04-06 18:19:59 +00:00
|
|
|
return e.CreateIndex
|
|
|
|
}
|
|
|
|
|
2021-04-28 22:13:29 +00:00
|
|
|
func (e *MeshConfigEntry) GetModifyIndex() uint64 {
|
2021-04-06 18:19:59 +00:00
|
|
|
return e.ModifyIndex
|
|
|
|
}
|
2021-04-29 21:44:32 +00:00
|
|
|
|
|
|
|
// MarshalJSON adds the Kind field so that the JSON can be decoded back into the
|
|
|
|
// correct type.
|
|
|
|
func (e *MeshConfigEntry) MarshalJSON() ([]byte, error) {
|
|
|
|
type Alias MeshConfigEntry
|
|
|
|
source := &struct {
|
|
|
|
Kind string
|
|
|
|
*Alias
|
|
|
|
}{
|
|
|
|
Kind: MeshConfig,
|
|
|
|
Alias: (*Alias)(e),
|
|
|
|
}
|
|
|
|
return json.Marshal(source)
|
|
|
|
}
|