Newer
Older
EnvoyControlPlane / internal / api / types.go
package internal

import (
	clusterv3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
	listenerv3 "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
	resourcev3 "github.com/envoyproxy/go-control-plane/pkg/resource/v3"
)

// AddClusterRequest defines payload to add a cluster
type AddClusterRequest struct {
	Name    string            `json:"name"`
	Cluster clusterv3.Cluster `json:"cluster"`
}

// RemoveClusterRequest defines payload to remove a cluster (Not explicitly used in handlers, but included for completeness)
type RemoveClusterRequest struct {
	Name string `json:"name"`
}

// EnableResourceRequest defines payload to enable a resource
// This will be used for both enable-cluster and enable-listener
type EnableResourceRequest struct {
	Name string `json:"name"`
}

// RemoveResourceRequest defines payload to remove a resource.
// Used for both /remove-cluster and /remove-listener.
type RemoveResourceRequest struct {
	Name string `json:"name"`
}

// SnapshotFileRequest defines payload to load/save snapshot from/to file
type SnapshotFileRequest struct {
	Path string `json:"path"`
}

// AddListenerRequest defines payload to add a listener
type AddListenerRequest struct {
	Name     string              `json:"name"`
	Listener listenerv3.Listener `json:"listener"`
}

// RemoveListenerRequest defines payload to remove a listener (Not explicitly used in handlers, but included for completeness)
type RemoveListenerRequest struct {
	Name string `json:"name"`
}

// ConsistencyReport holds the results of the cache/DB consistency check.
type ConsistencyReport struct {
	CacheOnly    map[resourcev3.Type][]string `json:"cache-only"` // Resources present in cache but not enabled in DB
	DBOnly       map[resourcev3.Type][]string `json:"db-only"`    // Resources enabled in DB but not present in cache
	Inconsistent bool                         `json:"inconsistent"`
}