Documentation
¶
Overview ¶
Package data provides data types for readers. All data types for readers are packages inside an Entry. This allows for a single channel to be used for all data types.
Index ¶
- Variables
- type ChangeType
- type Entry
- func (e Entry) ChangeType() ChangeType
- func (e Entry) ClusterRole() (*rbacv1.ClusterRole, error)
- func (e Entry) ClusterRoleBinding() (*rbacv1.ClusterRoleBinding, error)
- func (e Entry) Deployment() (*appsv1.Deployment, error)
- func (e Entry) Endpoint() (*corev1.Endpoints, error)
- func (e Entry) IngressController() (*networkingv1.Ingress, error)
- func (e Entry) Namespace() (*corev1.Namespace, error)
- func (e Entry) Node() (*corev1.Node, error)
- func (e Entry) Object() runtime.Object
- func (e Entry) ObjectType() ObjectType
- func (e Entry) PersistentVolume() (*corev1.PersistentVolume, error)
- func (e Entry) Pod() (*corev1.Pod, error)
- func (e Entry) Role() (*rbacv1.Role, error)
- func (e Entry) RoleBinding() (*rbacv1.RoleBinding, error)
- func (e Entry) Service() (*corev1.Service, error)
- func (e Entry) SourceType() SourceType
- func (e Entry) UID() types.UID
- type ObjectType
- type SourceType
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidType is returned when the type is invalid. ErrInvalidType = errors.New("invalid type") )
Functions ¶
This section is empty.
Types ¶
type ChangeType ¶
type ChangeType uint8
ChangeType is the type of change.
const ( // CTUnknown indicates a bug in the code. CTUnknown ChangeType = 0 // Unknown // CTAdd indicates the data was added. CTAdd ChangeType = 1 // Add // CTUpdate indicates the data was updated. CTUpdate ChangeType = 2 // Update // CTDelete indicates the data was deleted. CTDelete ChangeType = 3 // Delete // CTSnapshot indicates the data is a snapshot. A snapshot is // when we relist the same data object in order to make sure our // data is up to date. CTSnapshot ChangeType = 4 // Snapshot )
func (ChangeType) String ¶
func (i ChangeType) String() string
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
Entry is a data entry. This is field aligned for better performance.
func MustNewEntry ¶
func MustNewEntry[T runtime.Object](obj T, st SourceType, ct ChangeType) Entry
MustNewEntry creates a new Entry. It panics if an error occurs.
func NewEntry ¶
func NewEntry(obj runtime.Object, st SourceType, ct ChangeType) (Entry, error)
NewEntry creates a new Entry. The underlying object must be a corev1.Node, corev1.Pod, corev1.PersistentVolume or corev1.Namespace.
func (Entry) ChangeType ¶
func (e Entry) ChangeType() ChangeType
ChangeType returns the type of change that occurred, add, update or delete.
func (Entry) ClusterRole ¶
func (e Entry) ClusterRole() (*rbacv1.ClusterRole, error)
ClusterRole returns the data as a cluster role type change. An error is returned if the type is not ClusterRole.
func (Entry) ClusterRoleBinding ¶
func (e Entry) ClusterRoleBinding() (*rbacv1.ClusterRoleBinding, error)
ClusterRoleBinding returns the data as a cluster role binding type change. An error is returned if the type is not ClusterRoleBinding.
func (Entry) Deployment ¶
func (e Entry) Deployment() (*appsv1.Deployment, error)
Deployment returns the data as a deployment type change. An error is returned if the type is not Deployment.
func (Entry) Endpoint ¶
Endpoint returns the data as an endpoint type change. An error is returned if the type is not Endpoint.
func (Entry) IngressController ¶
func (e Entry) IngressController() (*networkingv1.Ingress, error)
IngressController returns the data as an ingress controller type change. An error is returned if the type is not IngressController.
func (Entry) Namespace ¶
Namespace returns the data as a namespace type change. An error is returned if the type is not Namespace.
func (Entry) Node ¶
Node returns the data for a Node type change. An error is returned if the type is not Node.
func (Entry) ObjectType ¶
func (e Entry) ObjectType() ObjectType
ObjectType returns the type of the underlying object to allow for calling the correct decoder method such as Node, Pod, Namespace, etc.
func (Entry) PersistentVolume ¶
func (e Entry) PersistentVolume() (*corev1.PersistentVolume, error)
PersistentVolume returns the data as a persistent volume type change. An error is returned if the type is not PersistentVolume.
func (Entry) Pod ¶
Pod returns the data a pod type change. An error is returned if the type is not Pod.
func (Entry) Role ¶
Role returns the data as a role type change. An error is returned if the type is not Role.
func (Entry) RoleBinding ¶
func (e Entry) RoleBinding() (*rbacv1.RoleBinding, error)
RoleBinding returns the data as a role binding type change. An error is returned if the type is not RoleBinding.
func (Entry) Service ¶
Service returns the data as a service type change. An error is returned if the type is not Service.
func (Entry) SourceType ¶
func (e Entry) SourceType() SourceType
SourceType returns the data source of the entry.
type ObjectType ¶
type ObjectType uint8
ObjectType is the type of the object held in a type.
const ( // OTUnknown indicates a bug in the code. OTUnknown ObjectType = 0 // Unknown // OTNode indicates the data is a node. OTNode ObjectType = 1 // Node // OTPod indicates the data is a pod. OTPod ObjectType = 2 // Pod // OTNamespace indicates the data is a namespace. OTNamespace ObjectType = 3 // Namespace // OTPersistentVolume indicates the data is a persistent volume. OTPersistentVolume ObjectType = 4 // PersistentVolume // OTClusterRole indicates the data is a cluster role. OTClusterRole ObjectType = 5 // ClusterRole // OTClusterRoleBinding indicates the data is a cluster role binding. OTClusterRoleBinding ObjectType = 6 // ClusterRoleBinding // OTRole indicates the data is a role. OTRole ObjectType = 7 // Role // OTRoleBinding indicates the data is a role binding. OTRoleBinding ObjectType = 8 // RoleBinding // OTService indicates the data is a service. OTService ObjectType = 9 // Service // OTDeployment indicates the data is a deployment. OTDeployment ObjectType = 10 // Deployment // OTIngressController indicates the data is an ingress controller. OTIngressController ObjectType = 11 // IngressController // OTEndpoint indicates the data is an endpoint. OTEndpoint ObjectType = 12 // Endpoint )
func (ObjectType) String ¶
func (i ObjectType) String() string
type SourceType ¶
type SourceType uint8
const ( // STUnknown SourceType = 0 // Unknown STInformer SourceType = 1 // Informer STWatchList SourceType = 2 // WatchList STEtcd SourceType = 3 // Etcd )
func (SourceType) String ¶
func (i SourceType) String() string