common

package
v0.9.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicationStatusInfoHealthy   = "Device's application workloads are healthy."
	ApplicationStatusInfoUndefined = "Device has no application workloads defined."
	DeviceStatusInfoHealthy        = "Device's system resources are healthy."
	DeviceStatusInfoRebooting      = "Device is rebooting."
	CPUIsCritical                  = "CPU utilization has reached a critical level."
	CPUIsWarning                   = "CPU utilization has reached a warning level."
	CPUIsNormal                    = "CPU utilization has returned to normal."
	MemoryIsCritical               = "Memory utilization has reached a critical level."
	MemoryIsWarning                = "Memory utilization has reached a warning level."
	MemoryIsNormal                 = "Memory utilization has returned to normal."
	DiskIsCritical                 = "Disk utilization has reached a critical level."
	DiskIsWarning                  = "Disk utilization has reached a warning level."
	DiskIsNormal                   = "Disk utilization has returned to normal."
)

Variables

This section is empty.

Functions

func EmitMultipleOwnersEvents added in v0.9.0

func EmitMultipleOwnersEvents(ctx context.Context, device *api.Device, oldCondition, newCondition *api.Condition,
	createEvent func(context.Context, *api.Event),
	getDeviceMultipleOwnersDetectedEvent func(context.Context, string, []string, logrus.FieldLogger) *api.Event,
	getDeviceMultipleOwnersResolvedEvent func(context.Context, string, api.DeviceMultipleOwnersResolvedDetailsResolutionType, *string, []string, logrus.FieldLogger) *api.Event,
	log logrus.FieldLogger)

EmitMultipleOwnersEvents emits events for MultipleOwners condition changes

func EmitSpecValidEvents added in v0.9.0

func EmitSpecValidEvents(ctx context.Context, device *api.Device, oldCondition, newCondition *api.Condition,
	createEvent func(context.Context, *api.Event),
	getDeviceSpecValidEvent func(ctx context.Context, deviceName string) *api.Event,
	getDeviceSpecInvalidEvent func(ctx context.Context, deviceName string, message string) *api.Event,
	log logrus.FieldLogger,
)

EmitSpecValidEvents emits events for SpecValid condition changes

func GetDeviceDecommissionedFailureEvent added in v0.9.0

func GetDeviceDecommissionedFailureEvent(ctx context.Context, _ bool, _ api.ResourceKind, resourceName string, status api.Status) *api.Event

GetDeviceDecommissionedFailureEvent creates an event for failed device decommission

func GetDeviceDecommissionedSuccessEvent added in v0.9.0

func GetDeviceDecommissionedSuccessEvent(ctx context.Context, _ bool, _ api.ResourceKind, resourceName string, update *api.ResourceUpdatedDetails, log logrus.FieldLogger) *api.Event

GetDeviceDecommissionedSuccessEvent creates an event for successful device decommission

func GetDeviceEventFromUpdateDetails added in v0.9.0

func GetDeviceEventFromUpdateDetails(ctx context.Context, resourceName string, update ResourceUpdate) *api.Event

GetDeviceEventFromUpdateDetails creates a device event from update details

func GetDeviceMultipleOwnersDetectedEvent added in v0.9.0

func GetDeviceMultipleOwnersDetectedEvent(ctx context.Context, deviceName string, matchingFleets []string, log logrus.FieldLogger) *api.Event

GetDeviceMultipleOwnersDetectedEvent creates an event for multiple fleet owners detected

func GetDeviceMultipleOwnersResolvedEvent added in v0.9.0

func GetDeviceMultipleOwnersResolvedEvent(ctx context.Context, deviceName string, resolutionType api.DeviceMultipleOwnersResolvedDetailsResolutionType, assignedOwner *string, previousMatchingFleets []string, log logrus.FieldLogger) *api.Event

GetDeviceMultipleOwnersResolvedEvent creates an event for multiple fleet owners resolved

func GetDeviceSpecInvalidEvent added in v0.9.0

func GetDeviceSpecInvalidEvent(ctx context.Context, deviceName string, message string) *api.Event

GetDeviceSpecInvalidEvent creates an event for device spec becoming invalid

func GetDeviceSpecValidEvent added in v0.9.0

func GetDeviceSpecValidEvent(ctx context.Context, deviceName string) *api.Event

GetDeviceSpecValidEvent creates an event for device spec becoming valid

func GetEnrollmentRequestApprovalFailedEvent added in v0.9.0

func GetEnrollmentRequestApprovalFailedEvent(ctx context.Context, resourceName string, status api.Status, log logrus.FieldLogger) *api.Event

GetEnrollmentRequestApprovalFailedEvent creates an event for failed enrollment request approval

func GetEnrollmentRequestApprovedEvent added in v0.9.0

func GetEnrollmentRequestApprovedEvent(ctx context.Context, resourceName string, log logrus.FieldLogger) *api.Event

GetEnrollmentRequestApprovedEvent creates an event for enrollment request approval

func GetFleetRolloutBatchCompletedEvent added in v0.9.0

func GetFleetRolloutBatchCompletedEvent(ctx context.Context, name string, deployingTemplateVersion string, report *api.RolloutBatchCompletionReport) *api.Event

GetFleetRolloutBatchCompletedEvent creates an event for fleet rollout completion

func GetFleetRolloutBatchDispatchedEvent added in v0.9.0

func GetFleetRolloutBatchDispatchedEvent(ctx context.Context, fleetName string, templateVersion string, batch string) *api.Event

GetFleetRolloutBatchDispatchedEvent creates an event for fleet rollout batch dispatch

func GetFleetRolloutCompletedEvent added in v0.9.0

func GetFleetRolloutCompletedEvent(ctx context.Context, name string, templateVersion string) *api.Event

GetFleetRolloutCompletedEvent creates an event for fleet rollout completion

func GetFleetRolloutDeviceSelectedEvent added in v0.9.0

func GetFleetRolloutDeviceSelectedEvent(ctx context.Context, deviceName string, fleetName string, templateVersion string) *api.Event

GetFleetRolloutDeviceSelectedEvent creates an event for fleet rollout device selection

func GetFleetRolloutFailedEvent added in v0.9.0

func GetFleetRolloutFailedEvent(ctx context.Context, name string, deployingTemplateVersion string, message string) *api.Event

GetFleetRolloutFailedEvent creates an event for fleet rollout failure

func GetFleetRolloutNewEvent added in v0.9.0

func GetFleetRolloutNewEvent(ctx context.Context, name string) *api.Event

GetFleetRolloutNewEvent creates an event for fleet rollout creation

func GetFleetRolloutStartedEvent added in v0.9.0

func GetFleetRolloutStartedEvent(ctx context.Context, templateVersionName string, fleetName string, immediateRollout bool, policyRemoved bool) *api.Event

GetFleetRolloutStartedEvent creates an event for fleet rollout start

func GetFleetSpecInvalidEvent added in v0.9.0

func GetFleetSpecInvalidEvent(ctx context.Context, fleetName string, message string) *api.Event

GetFleetSpecInvalidEvent creates an event for fleet spec becoming invalid

func GetFleetSpecValidEvent added in v0.9.0

func GetFleetSpecValidEvent(ctx context.Context, fleetName string) *api.Event

GetFleetSpecValidEvent creates an event for fleet spec becoming valid

func GetInternalTaskFailedEvent added in v0.9.0

func GetInternalTaskFailedEvent(ctx context.Context, resourceKind api.ResourceKind, resourceName string, taskType string, errorMessage string, retryCount *int, taskParameters map[string]string, log logrus.FieldLogger) *api.Event

GetInternalTaskFailedEvent creates an event for internal task failures

func GetReferencedRepositoryUpdatedEvent added in v0.9.0

func GetReferencedRepositoryUpdatedEvent(ctx context.Context, kind api.ResourceKind, name, repositoryName string) *api.Event

GetReferencedRepositoryUpdatedEvent creates an event for a referenced repository being updated

func GetRepositoryAccessibleEvent added in v0.9.0

func GetRepositoryAccessibleEvent(ctx context.Context, name string) *api.Event

GetRepositoryAccessibleEvent creates an event for repository accessibility

func GetRepositoryInaccessibleEvent added in v0.9.0

func GetRepositoryInaccessibleEvent(ctx context.Context, name string, errorMessage string) *api.Event

GetRepositoryInaccessibleEvent creates an event for repository inaccessibility

func GetResourceCreatedOrUpdatedFailureEvent added in v0.9.0

func GetResourceCreatedOrUpdatedFailureEvent(ctx context.Context, created bool, resourceKind api.ResourceKind, resourceName string, status api.Status, updatedDetails *api.ResourceUpdatedDetails) *api.Event

GetResourceCreatedOrUpdatedFailureEvent creates an event for failed resource creation or update

func GetResourceCreatedOrUpdatedSuccessEvent added in v0.9.0

func GetResourceCreatedOrUpdatedSuccessEvent(ctx context.Context, created bool, resourceKind api.ResourceKind, resourceName string, updates *api.ResourceUpdatedDetails, log logrus.FieldLogger) *api.Event

GetResourceCreatedOrUpdatedSuccessEvent creates an event for successful resource creation or update

func GetResourceDeletedFailureEvent added in v0.9.0

func GetResourceDeletedFailureEvent(ctx context.Context, resourceKind api.ResourceKind, resourceName string, status api.Status) *api.Event

GetResourceDeletedFailureEvent creates an event for failed resource deletion

func GetResourceDeletedSuccessEvent added in v0.9.0

func GetResourceDeletedSuccessEvent(ctx context.Context, resourceKind api.ResourceKind, resourceName string) *api.Event

GetResourceDeletedSuccessEvent creates an event for successful resource deletion

func GetResourceSyncAccessibleEvent added in v0.9.0

func GetResourceSyncAccessibleEvent(ctx context.Context, resourceName string) *api.Event

func GetResourceSyncCommitDetectedEvent added in v0.9.0

func GetResourceSyncCommitDetectedEvent(ctx context.Context, resourceName string, commitHash string) *api.Event

ResourceSync event functions

func GetResourceSyncInaccessibleEvent added in v0.9.0

func GetResourceSyncInaccessibleEvent(ctx context.Context, resourceName string, errorMessage string) *api.Event

func GetResourceSyncParsedEvent added in v0.9.0

func GetResourceSyncParsedEvent(ctx context.Context, resourceName string) *api.Event

func GetResourceSyncParsingFailedEvent added in v0.9.0

func GetResourceSyncParsingFailedEvent(ctx context.Context, resourceName string, errorMessage string) *api.Event

func GetResourceSyncSyncFailedEvent added in v0.9.0

func GetResourceSyncSyncFailedEvent(ctx context.Context, resourceName string, errorMessage string) *api.Event

func GetResourceSyncSyncedEvent added in v0.9.0

func GetResourceSyncSyncedEvent(ctx context.Context, resourceName string) *api.Event

func KeepDBDeviceStatus added in v0.9.0

func KeepDBDeviceStatus(device, dbDevice *api.Device)

do not overwrite valid service-side statuses with placeholder device-side status

func UpdateServiceSideStatus added in v0.4.0

func UpdateServiceSideStatus(ctx context.Context, orgId uuid.UUID, device *api.Device, st store.Store, log logrus.FieldLogger) bool

Types

type DeviceFailureEvent added in v0.9.0

type DeviceFailureEvent func(ctx context.Context, created bool, resourceKind api.ResourceKind, resourceName string, status api.Status) *api.Event

type DeviceSuccessEvent added in v0.9.0

type DeviceSuccessEvent func(ctx context.Context, created bool, resourceKind api.ResourceKind, resourceName string, updateDetails *api.ResourceUpdatedDetailsUpdatedFields, log logrus.FieldLogger) *api.Event

type GetResourceEventFromUpdateDetailsFunc added in v0.9.0

type GetResourceEventFromUpdateDetailsFunc func(ctx context.Context, update ResourceUpdate) *api.Event

type ResourceUpdate added in v0.9.0

type ResourceUpdate struct {
	Reason  api.EventReason
	Details string
}

type ResourceUpdates added in v0.9.0

type ResourceUpdates []ResourceUpdate

func ComputeDeviceStatusChanges added in v0.9.0

func ComputeDeviceStatusChanges(ctx context.Context, oldDevice, newDevice *api.Device, orgId uuid.UUID, st store.Store) ResourceUpdates

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL