Documentation
¶
Index ¶
- Variables
- type APIResourceOption
- type CertificateSigningRequest
- type CertificateSigningRequestList
- type Device
- type DeviceList
- type EnrollmentRequest
- type EnrollmentRequestList
- type Fleet
- type FleetList
- type JSONField
- type Repository
- type RepositoryList
- type Resource
- type ResourceSync
- func (rs *ResourceSync) AddPathAccessCondition(err error)
- func (rs *ResourceSync) AddRepoAccessCondition(err error)
- func (rs *ResourceSync) AddRepoNotFoundCondition(err error)
- func (rs *ResourceSync) AddResourceParsedCondition(err error)
- func (rs *ResourceSync) AddSyncedCondition(err error)
- func (rs *ResourceSync) NeedsSyncToHash(hash string) bool
- func (rs *ResourceSync) SetCondition(conditionType api.ConditionType, okReason, failReason string, err error) bool
- func (r *ResourceSync) String() string
- func (r *ResourceSync) ToApiResource() api.ResourceSync
- type ResourceSyncList
- type ServiceConditions
- type TemplateVersion
- type TemplateVersionList
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CertificateSigningRequestAPI = "v1alpha1" CertificateSigningRequestKind = "CertificateSigningRequest" CertificateSigningRequestListKind = "CertificateSigningRequestList" )
View Source
var ( DeviceAPI = "v1alpha1" DeviceKind = "Device" DeviceListKind = "DeviceList" DeviceAnnotationTemplateVersion = "fleet-controller/templateVersion" DeviceAnnotationRenderedVersion = "device-controller/renderedVersion" DeviceAnnotationConsole = "device-controller/console" )
View Source
var ( EnrollmentRequestAPI = "v1alpha1" EnrollmentRequestKind = "EnrollmentRequest" EnrollmentRequestListKind = "EnrollmentRequestList" )
View Source
var ( FleetAPI = "v1alpha1" FleetKind = "Fleet" FleetListKind = "FleetList" FleetAnnotationTemplateVersion = "fleet-controller/templateVersion" )
View Source
var ( RepositoryAPI = "v1alpha1" RepositoryKind = "Repository" RepositoryListKind = "RepositoryList" )
View Source
var ( ResourceSyncAPI = "v1alpha1" ResourceSyncKind = "ResourceSync" ResourceSyncListKind = "ResourceSyncList" )
View Source
var ( TemplateVersionAPI = "v1alpha1" TemplateVersionKind = "TemplateVersion" TemplateVersionListKind = "TemplateVersionList" )
Functions ¶
This section is empty.
Types ¶
type APIResourceOption ¶
type APIResourceOption func(*apiResourceOptions)
func WithSummary ¶
func WithSummary(summary *api.DevicesSummary) APIResourceOption
type CertificateSigningRequest ¶
type CertificateSigningRequest struct {
Resource
// The desired state of the enrollment request, stored as opaque JSON object.
Spec *JSONField[api.CertificateSigningRequestSpec] `gorm:"type:jsonb"`
// The last reported state of the enrollment request, stored as opaque JSON object.
Status *JSONField[api.CertificateSigningRequestStatus] `gorm:"type:jsonb" selector:"status"`
}
func NewCertificateSigningRequestFromApiResource ¶
func NewCertificateSigningRequestFromApiResource(resource *api.CertificateSigningRequest) (*CertificateSigningRequest, error)
func (CertificateSigningRequest) String ¶
func (e CertificateSigningRequest) String() string
func (*CertificateSigningRequest) ToApiResource ¶
func (csr *CertificateSigningRequest) ToApiResource() api.CertificateSigningRequest
type CertificateSigningRequestList ¶
type CertificateSigningRequestList []CertificateSigningRequest
func (CertificateSigningRequestList) ToApiResource ¶
func (csrl CertificateSigningRequestList) ToApiResource(cont *string, numRemaining *int64) api.CertificateSigningRequestList
type Device ¶
type Device struct {
Resource
// The desired state, stored as opaque JSON object.
Spec *JSONField[api.DeviceSpec] `gorm:"type:jsonb"`
// The last reported state, stored as opaque JSON object.
Status *JSONField[api.DeviceStatus] `gorm:"type:jsonb" selector:"status"`
// Conditions set by the service, as opposed to the agent.
ServiceConditions *JSONField[ServiceConditions]
// The rendered ignition config, exposed in a separate endpoint.
RenderedConfig *string
// The rendered application provided by the service.
RenderedApplications *JSONField[*[]api.RenderedApplicationSpec] `gorm:"type:jsonb"`
// Join table with the relationship of devices to repositories (only maintained for standalone devices)
Repositories []Repository `gorm:"many2many:device_repos;constraint:OnDelete:CASCADE;"`
}
func (*Device) ToApiResource ¶
type DeviceList ¶
type DeviceList []Device
func (DeviceList) ToApiResource ¶
func (dl DeviceList) ToApiResource(cont *string, numRemaining *int64) api.DeviceList
type EnrollmentRequest ¶
type EnrollmentRequest struct {
Resource
// The desired state of the enrollment request, stored as opaque JSON object.
Spec *JSONField[api.EnrollmentRequestSpec] `gorm:"type:jsonb"`
// The last reported state of the enrollment request, stored as opaque JSON object.
Status *JSONField[api.EnrollmentRequestStatus] `gorm:"type:jsonb" selector:"status"`
}
func NewEnrollmentRequestFromApiResource ¶
func NewEnrollmentRequestFromApiResource(resource *api.EnrollmentRequest) (*EnrollmentRequest, error)
func (EnrollmentRequest) String ¶
func (e EnrollmentRequest) String() string
func (*EnrollmentRequest) ToApiResource ¶
func (e *EnrollmentRequest) ToApiResource() api.EnrollmentRequest
type EnrollmentRequestList ¶
type EnrollmentRequestList []EnrollmentRequest
func (EnrollmentRequestList) ToApiResource ¶
func (el EnrollmentRequestList) ToApiResource(cont *string, numRemaining *int64) api.EnrollmentRequestList
type Fleet ¶
type Fleet struct {
Resource
// The desired state, stored as opaque JSON object.
Spec *JSONField[api.FleetSpec] `gorm:"type:jsonb"`
// The last reported state, stored as opaque JSON object.
Status *JSONField[api.FleetStatus] `gorm:"type:jsonb" selector:"status"`
// Join table with the relationship of fleets to repositories
Repositories []Repository `gorm:"many2many:fleet_repos;constraint:OnDelete:CASCADE;"`
}
func (*Fleet) ToApiResource ¶
func (f *Fleet) ToApiResource(opts ...APIResourceOption) api.Fleet
type JSONField ¶
type JSONField[T any] struct { Data T }
JSONField wraps an arbitrary struct so that it can be included in a GORM model, for use in a JSON/JSONB field
func MakeJSONField ¶
Return a copy of 'data', wrapped in a JSONField object
func (JSONField[T]) MarshalJSON ¶
func (*JSONField[T]) UnmarshalJSON ¶
type Repository ¶
type Repository struct {
Resource
// The desired state, stored as opaque JSON object.
Spec *JSONField[api.RepositorySpec] `gorm:"type:jsonb"`
// The last reported state, stored as opaque JSON object.
Status *JSONField[api.RepositoryStatus] `gorm:"type:jsonb" selector:"status"`
// Join table with the relationship of repository to fleets
Fleets []Fleet `gorm:"many2many:fleet_repos;constraint:OnDelete:CASCADE;"`
// Join table with the relationship of repository to devices (only maintained for standalone devices)
Devices []Device `gorm:"many2many:device_repos;constraint:OnDelete:CASCADE;"`
}
func NewRepositoryFromApiResource ¶
func NewRepositoryFromApiResource(resource *api.Repository) (*Repository, error)
func (Repository) String ¶
func (d Repository) String() string
func (*Repository) ToApiResource ¶
func (f *Repository) ToApiResource() (api.Repository, error)
type RepositoryList ¶
type RepositoryList []Repository
func (RepositoryList) ToApiResource ¶
func (dl RepositoryList) ToApiResource(cont *string, numRemaining *int64) (api.RepositoryList, error)
type Resource ¶
type Resource struct {
// Uniquely identifies the tenant the resource belongs to.
// Assigned by IAM. Immutable.
OrgID uuid.UUID `gorm:"type:uuid;primary_key;index:owner_idx,priority:2"`
// Uniquely identifies the resource within a tenant and schema.
// Depending on the schema (kind), assigned by the device management system or the crypto identity of the device (public key). Immutable.
// This may become a URN later, so it's important API users treat this as an opaque handle.
Name string `gorm:"primary_key;" selector:"metadata.name"`
// The "kind/name" of the resource owner of this resource.
Owner *string `gorm:"index:owner_idx,priority:1" selector:"metadata.owner"`
// User-defined labels, used to select resources in queries.
// Labels are inserted in the device column as a string array, in a way
// that we can perform indexing and queries on them.
Labels pq.StringArray `gorm:"type:text[]"`
Annotations pq.StringArray `gorm:"type:text[]"`
Generation *int64
ResourceVersion *int64
CreatedAt time.Time `selector:"metadata.created_at"`
UpdatedAt time.Time `selector:"metadata.updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index"`
}
type ResourceSync ¶
type ResourceSync struct {
Resource
// The desired state, stored as opaque JSON object.
Spec *JSONField[api.ResourceSyncSpec] `gorm:"type:jsonb"`
// The last reported state, stored as opaque JSON object.
Status *JSONField[api.ResourceSyncStatus] `gorm:"type:jsonb" selector:"status"`
}
func NewResourceSyncFromApiResource ¶
func NewResourceSyncFromApiResource(resource *api.ResourceSync) (*ResourceSync, error)
func (*ResourceSync) AddPathAccessCondition ¶
func (rs *ResourceSync) AddPathAccessCondition(err error)
func (*ResourceSync) AddRepoAccessCondition ¶
func (rs *ResourceSync) AddRepoAccessCondition(err error)
func (*ResourceSync) AddRepoNotFoundCondition ¶
func (rs *ResourceSync) AddRepoNotFoundCondition(err error)
func (*ResourceSync) AddResourceParsedCondition ¶
func (rs *ResourceSync) AddResourceParsedCondition(err error)
func (*ResourceSync) AddSyncedCondition ¶
func (rs *ResourceSync) AddSyncedCondition(err error)
func (*ResourceSync) NeedsSyncToHash ¶
func (rs *ResourceSync) NeedsSyncToHash(hash string) bool
NeedsSyncToHash returns true if the resource needs to be synced to the given hash.
func (*ResourceSync) SetCondition ¶
func (rs *ResourceSync) SetCondition(conditionType api.ConditionType, okReason, failReason string, err error) bool
func (*ResourceSync) String ¶
func (r *ResourceSync) String() string
func (*ResourceSync) ToApiResource ¶
func (r *ResourceSync) ToApiResource() api.ResourceSync
type ResourceSyncList ¶
type ResourceSyncList []ResourceSync
func (ResourceSyncList) ToApiResource ¶
func (rl ResourceSyncList) ToApiResource(cont *string, numRemaining *int64) api.ResourceSyncList
type ServiceConditions ¶
type TemplateVersion ¶
type TemplateVersion struct {
OrgID uuid.UUID `gorm:"type:uuid;primary_key;"`
Name string `gorm:"primary_key;" selector:"metadata.name"`
FleetName string `gorm:"primary_key;" selector:"metadata.fleetname"`
Fleet Fleet `gorm:"foreignkey:OrgID,FleetName;constraint:OnDelete:CASCADE;"`
Labels pq.StringArray `gorm:"type:text[]"`
Annotations pq.StringArray `gorm:"type:text[]"`
Generation *int64
ResourceVersion *int64
CreatedAt time.Time `selector:"metadata.created_at"`
UpdatedAt time.Time `selector:"metadata.updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index"`
// The desired state, stored as opaque JSON object.
Spec *JSONField[api.TemplateVersionSpec] `gorm:"type:jsonb"`
// The last reported state, stored as opaque JSON object.
Status *JSONField[api.TemplateVersionStatus] `gorm:"type:jsonb" selector:"status"`
// An indication if this version is valid. It exposed in a Condition but easier to query here.
Valid *bool
}
func NewTemplateVersionFromApiResource ¶
func NewTemplateVersionFromApiResource(resource *api.TemplateVersion) (*TemplateVersion, error)
func (TemplateVersion) String ¶
func (t TemplateVersion) String() string
func (*TemplateVersion) ToApiResource ¶
func (t *TemplateVersion) ToApiResource() api.TemplateVersion
type TemplateVersionList ¶
type TemplateVersionList []TemplateVersion
func (TemplateVersionList) ToApiResource ¶
func (tl TemplateVersionList) ToApiResource(cont *string, numRemaining *int64) api.TemplateVersionList
Click to show internal directories.
Click to hide internal directories.