Documentation ¶
Overview ¶
Copyright 2023 Northern.tech AS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func ImagePathFromContext(ctx context.Context, id string) string
- func IsDeviceDeploymentStatusFinished(status DeviceDeploymentStatus) bool
- func IsNotGraphic(r rune) bool
- func IsValidLimit(name string) bool
- type ArtifactDeploymentInstructions
- type ArtifactInfo
- type ArtifactMeta
- type ArtifactUpdateTypeInfo
- type ConfigurationDeploymentConstructor
- type ConflictError
- type Deployment
- func NewDeployment() (*Deployment, error)
- func NewDeploymentFromConfigurationDeploymentConstructor(constructor *ConfigurationDeploymentConstructor, deploymentID string) (*Deployment, error)
- func NewDeploymentFromConstructor(constructor *DeploymentConstructor) (*Deployment, error)
- func NewDeploymentWithID(ID string) (*Deployment, error)
- type DeploymentArtifactsUpdate
- type DeploymentConstructor
- type DeploymentIDs
- type DeploymentInstructions
- type DeploymentLog
- type DeploymentNextRequest
- type DeploymentStatistics
- type DeploymentStats
- type DeploymentStatus
- type DeploymentType
- type DeviceAttribute
- type DeviceDeployment
- type DeviceDeploymentLastStatus
- type DeviceDeploymentLastStatusReq
- type DeviceDeploymentLastStatuses
- type DeviceDeploymentListItem
- type DeviceDeploymentState
- type DeviceDeploymentStatus
- type DeviceGroups
- type DeviceIds
- type DirectUploadMetadata
- type FilterPredicate
- type Image
- type ImageMeta
- type InstalledDeviceDeployment
- type InvDevice
- type InvalidCharError
- type InvalidCharacterError
- type Limit
- type Link
- type LinkStatus
- type LogMessage
- type MultipartGenerateImageMsg
- type MultipartUploadMsg
- type NewTenantReq
- type Notes
- type ProvidesIdx
- type Query
- type ReadCounter
- type Release
- type ReleaseOrImageFilter
- type ReleasePatch
- type ReleaseV1
- type ReleasesDeleteError
- type RequestSignature
- type SearchParams
- type Stats
- type StatusQuery
- type StatusReport
- type StorageSettings
- type StorageType
- type Tag
- type Tags
- type Update
- type UpdateFile
- type UploadLink
Constants ¶
const ( DeploymentStatusFinished DeploymentStatus = "finished" DeploymentStatusInProgress DeploymentStatus = "inprogress" DeploymentStatusPending DeploymentStatus = "pending" DeploymentTypeSoftware DeploymentType = "software" DeploymentTypeConfiguration DeploymentType = "configuration" )
const ( // The following statuses are distributed evenly by incrementing the // enum counter's second byte. // NOTE: when adding new statuses into the list, use the mean value between the // neighbouring values and append the value AFTER the following list and extend // the DeviceDeploymentStatus<type>Str constant and allStatuses variable as well // as the MarshalText and UnmarshalText interface functions. // See example below. // WARN: DO NOT CHANGE ANY OF THE FOLLOWING VALUES. DeviceDeploymentStatusNull DeviceDeploymentStatus = iota << 8 // i=0... {i * 2^8} DeviceDeploymentStatusFailure DeviceDeploymentStatusAborted DeviceDeploymentStatusPauseBeforeInstall DeviceDeploymentStatusPauseBeforeCommit DeviceDeploymentStatusPauseBeforeReboot DeviceDeploymentStatusDownloading DeviceDeploymentStatusInstalling DeviceDeploymentStatusRebooting DeviceDeploymentStatusPending DeviceDeploymentStatusSuccess DeviceDeploymentStatusNoArtifact DeviceDeploymentStatusAlreadyInst DeviceDeploymentStatusDecommissioned DeviceDeploymentStatusActiveLow = DeviceDeploymentStatusPauseBeforeInstall DeviceDeploymentStatusActiveHigh = DeviceDeploymentStatusPending DeviceDeploymentStatusFailureStr = "failure" DeviceDeploymentStatusAbortedStr = "aborted" DeviceDeploymentStatusPauseBeforeInstallStr = "pause_before_installing" DeviceDeploymentStatusPauseBeforeCommitStr = "pause_before_committing" DeviceDeploymentStatusPauseBeforeRebootStr = "pause_before_rebooting" DeviceDeploymentStatusDownloadingStr = "downloading" DeviceDeploymentStatusInstallingStr = "installing" DeviceDeploymentStatusRebootingStr = "rebooting" DeviceDeploymentStatusPendingStr = "pending" DeviceDeploymentStatusSuccessStr = "success" DeviceDeploymentStatusNoArtifactStr = "noartifact" DeviceDeploymentStatusAlreadyInstStr = "already-installed" DeviceDeploymentStatusDecommissionedStr = "decommissioned" )
Deployment statuses
const ( DeviceDeploymentStatusPauseStr = "pause" DeviceDeploymentStatusActiveStr = "active" DeviceDeploymentStatusFinishedStr = "finished" )
const ( TagsMaxPerRelease = 20 // Maximum number of tags per release. TagsMaxUnique = 100 // Maximum number of unique tags. )
const ( ParamExpire = "x-men-expire" ParamSignature = "x-men-signature" ParamTenantID = "tenant_id" )
const (
ArtifactFileSuffix = ".mender"
)
const (
LimitStorage = "storage"
)
const (
TagMaxLength = 1024
)
Variables ¶
var ( ErrInvalidDeviceID = errors.New("Invalid device ID") ErrInvalidDeploymentDefinition = errors.New("Invalid deployments definition") ErrInvalidDeploymentDefinitionNoDevices = errors.New( "Invalid deployments definition: provide list of devices or set all_devices flag", ) ErrInvalidDeploymentDefinitionConflict = errors.New( "Invalid deployments definition: list of devices provided togheter with all_devices flag", ) ErrInvalidDeploymentToGroupDefinitionConflict = errors.New( "The deployment for group constructor should have neither list of devices" + " nor all_devices flag set", ) )
Errors
var ( ErrInvalidDeploymentLog = errors.New("invalid deployment log") ErrInvalidLogMessage = errors.New("invalid log message") )
var ( StorageKeyImageProvidesIdxKey = "meta_artifact.provides_idx.key" StorageKeyImageProvidesIdxValue = "meta_artifact.provides_idx.value" )
var ( ErrTooManyTags = errors.New( "the total number of tags per exceeded maximum of " + strconv.Itoa(TagsMaxPerRelease), ) ErrTooManyUniqueTags = errors.New( "the total number of unique tags (" + strconv.Itoa(TagsMaxUnique) + ") has been exceeded", ) )
var ( ErrTagEmpty = errors.New("tag cannot be empty") ErrTagTooLong = errors.New("tag must be less than " + strconv.Itoa(TagMaxLength) + " characters") )
var ( NotesLengthMaximumCharacters = 1024 ErrReleaseNotesTooLong = errors.New("release notes too long") ErrCharactersNotAllowed = errors.New("release notes contain characters which are not allowed") )
var (
ErrBadStatus = errors.New("unknown status value")
)
var (
ErrDeviceDeploymentStatusMismatch = errors.New(
"model active state does not match status",
)
)
var ErrLinkExpired = errors.New("URL expired")
var (
ValidLimits = []string{LimitStorage}
)
Functions ¶
func IsDeviceDeploymentStatusFinished ¶
func IsDeviceDeploymentStatusFinished(status DeviceDeploymentStatus) bool
func IsNotGraphic ¶
func IsValidLimit ¶
Types ¶
type ArtifactInfo ¶
type ArtifactInfo struct { // Mender artifact format - the only possible value is "mender" //Format string `json:"format" valid:"string,equal("mender"),required"` Format string `json:"format" valid:"required"` // Mender artifact format version //Version uint `json:"version" valid:"uint,equal(1),required"` Version uint `json:"version" valid:"required"` }
Structure with artifact version information
func (ArtifactInfo) Validate ¶
func (ai ArtifactInfo) Validate() error
type ArtifactMeta ¶
type ArtifactMeta struct { // artifact_name from artifact file Name string `json:"name" bson:"name" valid:"length(1|4096),required"` // Compatible device types for the application //nolint:lll DeviceTypesCompatible []string `json:"device_types_compatible" bson:"device_types_compatible" valid:"length(1|4096),required"` // Artifact version info Info *ArtifactInfo `json:"info"` // Flag that indicates if artifact is signed or not Signed bool `json:"signed" bson:"signed"` // List of updates Updates []Update `json:"updates" valid:"-"` // Provides is a map of artifact_provides used // for checking artifact (version 3) dependencies. //nolint: lll Provides map[string]string `json:"artifact_provides,omitempty" bson:"provides,omitempty" valid:"-"` // ProvidesIdx is special representation of provides // which makes possible to index and query using provides. ProvidesIdx ProvidesIdx `json:"-" bson:"provides_idx,omitempty"` // Depends is a map[string]interface{} (JSON) of artifact_depends used // for checking/validate against artifact (version 3) provides. Depends map[string]interface{} `json:"artifact_depends,omitempty" bson:"depends" valid:"-"` // ClearsProvides is a list of strings (JSON) of clears_artifact_provides used // for clearing already-installed artifact (version 3) provides. //nolint:lll ClearsProvides []string `json:"clears_artifact_provides,omitempty" bson:"clears_provides,omitempty" valid:"-"` }
Information provided by the Mender Artifact header
func NewArtifactMeta ¶
func NewArtifactMeta() *ArtifactMeta
func (ArtifactMeta) MarshalBSON ¶
func (am ArtifactMeta) MarshalBSON() ([]byte, error)
MarshalBSON transparently creates depends_idx field on bson.Marshal
func (ArtifactMeta) MarshalBSONValue ¶
func (am ArtifactMeta) MarshalBSONValue() (bsontype.Type, []byte, error)
MarshalBSONValue transparently creates depends_idx field on bson.MarshalValue which is called if ArtifactMeta is marshaled as an embedded document.
func (*ArtifactMeta) Validate ¶
func (am *ArtifactMeta) Validate() error
Validate checks structure according to valid tags.
type ArtifactUpdateTypeInfo ¶
type ArtifactUpdateTypeInfo struct {
Type *string `json:"type" valid:"required"`
}
Type info structure
type ConfigurationDeploymentConstructor ¶
type ConfigurationDeploymentConstructor struct { // Deployment name, required Name string `json:"name"` // A string containing a configuration object. // The deployments service will use it to generate configuration // artifact for the device. // The artifact will be generated when the device will ask // for an update. Configuration configuration `json:"configuration,omitempty"` // Retries represents the number of retries in case of deployment failures Retries uint `json:"retries,omitempty"` }
ConfigurationDeploymentConstructor represent input data needed for creating new Configuration Deployment
func (ConfigurationDeploymentConstructor) Validate ¶
func (c ConfigurationDeploymentConstructor) Validate() error
Validate validates the structure.
type ConflictError ¶
type ConflictError struct { Err error `json:"error"` Metadata interface{} `json:"metadata,omitempty"` RequestID string `json:"request_id,omitempty"` }
func NewConflictError ¶
func NewConflictError(err error) *ConflictError
func (*ConflictError) Error ¶
func (ce *ConflictError) Error() string
func (*ConflictError) WithMetadata ¶
func (ce *ConflictError) WithMetadata(metadata interface{}) *ConflictError
func (*ConflictError) WithRequestID ¶
func (ce *ConflictError) WithRequestID(requestID string) *ConflictError
type Deployment ¶
type Deployment struct { // User provided field set *DeploymentConstructor // Set the DeploymentConstructor checksum DeploymentConstructorChecksum string `json:"-" bson:"deploymentconstructor_checksum,omitempty"` // Auto set on create, required Created *time.Time `json:"created"` // Finished deployment time Finished *time.Time `json:"finished,omitempty"` // Deployment id, required Id string `json:"id" bson:"_id"` // List of artifact id's targeted for deployments, optional Artifacts []string `json:"artifacts,omitempty" bson:"artifacts"` // Aggregated device status counters. // Initialized with the "pending" counter set to total device count for deployment. // Individual counter incremented/decremented according to device status updates. Stats Stats `json:"-"` Statistics DeploymentStatistics `json:"statistics,omitempty" bson:"statistics,omitempty"` // Status is the overall deployment status Status DeploymentStatus `json:"status" bson:"status"` // Active is true for unfinished deployments Active bool `json:"-" bson:"active"` // Number of devices being part of the deployment DeviceCount *int `json:"device_count" bson:"device_count"` // Total number of devices targeted MaxDevices int `json:"max_devices,omitempty" bson:"max_devices"` // device groups Groups []string `json:"groups,omitempty" bson:"groups"` // list of devices DeviceList []string `json:"-" bson:"device_list"` // deployment type // currently we are supporting two types of deployments: // software and configuration Type DeploymentType `json:"type,omitempty" bson:"type"` // A field containing a configuration object. // The deployments service will use it to generate configuration // artifact for the device. // The artifact will be generated when the device will ask // for an update. Configuration deploymentConfiguration `json:"configuration,omitempty" bson:"configuration"` }
func NewDeployment ¶
func NewDeployment() (*Deployment, error)
NewDeployment creates new deployment object, sets create data by default.
func NewDeploymentFromConfigurationDeploymentConstructor ¶
func NewDeploymentFromConfigurationDeploymentConstructor( constructor *ConfigurationDeploymentConstructor, deploymentID string, ) (*Deployment, error)
NewConfigurationDeploymentFromConstructor creates new Deployments object based onconfiguration deployment constructor data
func NewDeploymentFromConstructor ¶
func NewDeploymentFromConstructor(constructor *DeploymentConstructor) (*Deployment, error)
NewDeploymentFromConstructor creates new Deployments object based on constructor data
func NewDeploymentWithID ¶
func NewDeploymentWithID(ID string) (*Deployment, error)
NewDeploymentWithID creates new configuration deployment object, sets create data by default.
func (*Deployment) GetStatus ¶
func (d *Deployment) GetStatus() DeploymentStatus
func (*Deployment) IsFinished ¶
func (d *Deployment) IsFinished() bool
func (*Deployment) IsNotPending ¶
func (d *Deployment) IsNotPending() bool
func (*Deployment) MarshalBSON ¶
func (r *Deployment) MarshalBSON() ([]byte, error)
func (*Deployment) MarshalJSON ¶
func (d *Deployment) MarshalJSON() ([]byte, error)
To be able to hide devices field, from API output provide custom marshaler
func (Deployment) Validate ¶
func (d Deployment) Validate() error
Validate checks structure validation rules
type DeploymentArtifactsUpdate ¶
type DeploymentArtifactsUpdate struct { // List of artifact id's targeted for deployments, optional Artifacts []string `bson:"artifacts"` }
type DeploymentConstructor ¶
type DeploymentConstructor struct { // Deployment name, required Name string `json:"name,omitempty"` // Artifact name to be installed required, associated with image ArtifactName string `json:"artifact_name,omitempty"` // List of device id's targeted for deployments, required Devices []string `json:"devices,omitempty" bson:"-"` // When set to true deployment will be created for all currently accepted devices AllDevices bool `json:"all_devices,omitempty" bson:"-"` // ForceInstallation forces the installation of the artifact and disables the // `already-installed` check ForceInstallation bool `json:"force_installation,omitempty" bson:"force_installation"` // When set the deployment will be created for all accepted devices from a given group Group string `json:"-" bson:"-"` }
DeploymentConstructor represent input data needed for creating new Deployment (they differ in fields)
func (DeploymentConstructor) Checksum ¶
func (c DeploymentConstructor) Checksum() string
func (DeploymentConstructor) Validate ¶
func (c DeploymentConstructor) Validate() error
Validate checks structure according to valid tags TODO: Add custom validator to check devices array content (such us UUID formatting)
func (DeploymentConstructor) ValidateNew ¶
func (c DeploymentConstructor) ValidateNew() error
type DeploymentIDs ¶
type DeploymentIDs struct {
IDs []string `json:"deployment_ids"`
}
func (DeploymentIDs) Validate ¶
func (d DeploymentIDs) Validate() error
type DeploymentInstructions ¶
type DeploymentInstructions struct { ID string `json:"id"` Artifact ArtifactDeploymentInstructions `json:"artifact"` Type DeploymentType `json:"-"` }
type DeploymentLog ¶
type DeploymentLog struct { // skip these 2 field when (un)marshaling to/from JSON DeviceID string `json:"-" valid:"required"` DeploymentID string `json:"-" valid:"uuidv4,required"` Messages []LogMessage `json:"messages" valid:"required"` }
func (*DeploymentLog) UnmarshalJSON ¶
func (d *DeploymentLog) UnmarshalJSON(raw []byte) error
func (DeploymentLog) Validate ¶
func (d DeploymentLog) Validate() error
type DeploymentNextRequest ¶
type DeploymentNextRequest struct { DeviceProvides *InstalledDeviceDeployment `json:"device_provides"` UpdateControlMap bool `json:"update_control_map"` }
DeploymentNextRequest holds a deployments/next request
func (*DeploymentNextRequest) String ¶
func (i *DeploymentNextRequest) String() string
func (*DeploymentNextRequest) Validate ¶
func (i *DeploymentNextRequest) Validate() error
type DeploymentStatistics ¶
type DeploymentStats ¶
type DeploymentStatus ¶
type DeploymentStatus string
func (DeploymentStatus) Validate ¶
func (stat DeploymentStatus) Validate() error
type DeploymentType ¶
type DeploymentType string
func (DeploymentType) Validate ¶
func (typ DeploymentType) Validate() error
type DeviceAttribute ¶
type DeviceDeployment ¶
type DeviceDeployment struct { // Active says whether the device's deployment status is in an active // state - in progress or pending. Active bool `json:"-" bson:"active"` // Internal field of initial creation of deployment Created *time.Time `json:"created" bson:"created"` // Internal field of start of the deployment (after /next call) Started *time.Time `json:"started,omitempty" bson:"started"` // Update finish time Finished *time.Time `json:"finished,omitempty" bson:"finished,omitempty"` // Logical deletion time Deleted *time.Time `json:"deleted,omitempty" bson:"deleted,omitempty"` // Status Status DeviceDeploymentStatus `json:"status" bson:"status"` // Device id DeviceId string `json:"id" bson:"deviceid"` // Deployment id DeploymentId string `json:"-" bson:"deploymentid"` // ID Id string `json:"-" bson:"_id"` // Assigned software image Image *Image `json:"image,omitempty"` // deployments/next request from the device Request *DeploymentNextRequest `json:"-"` // Presence of deployment log IsLogAvailable bool `json:"log" bson:"log"` // Device reported substate SubState string `json:"substate,omitempty" bson:"substate,omitempty"` }
func NewDeviceDeployment ¶
func NewDeviceDeployment(deviceId, deploymentId string) *DeviceDeployment
func (DeviceDeployment) Validate ¶
func (d DeviceDeployment) Validate() error
type DeviceDeploymentLastStatus ¶
type DeviceDeploymentLastStatus struct { // Device id DeviceId string `json:"device_id" bson:"_id"` // Deployment id DeploymentId string `json:"deployment_id" bson:"deployment_id"` // Device Deployment id DeviceDeploymentId string `json:"device_deployment_id" bson:"device_deployment_id"` // Status // nolint:lll DeviceDeploymentStatus DeviceDeploymentStatus `json:"device_deployment_status" bson:"device_deployment_status"` // Tenant id TenantId string `json:"-" bson:"tenant_id"` }
type DeviceDeploymentLastStatusReq ¶
type DeviceDeploymentLastStatusReq struct { // Device ids DeviceIds []string `json:"device_ids"` }
type DeviceDeploymentLastStatuses ¶
type DeviceDeploymentLastStatuses struct { // DeviceDeploymentLastStatuses array of last device deployments statuses // nolint:lll DeviceDeploymentLastStatuses []DeviceDeploymentLastStatus `json:"device_deployment_last_statuses" bson:"device_deployment_last_statuses"` }
type DeviceDeploymentListItem ¶
type DeviceDeploymentListItem struct { Id string `json:"id"` Deployment *Deployment `json:"deployment"` Device *DeviceDeployment `json:"device"` }
type DeviceDeploymentState ¶
type DeviceDeploymentState struct { // status reported by device Status DeviceDeploymentStatus // substate reported by device SubState string `json:",omitempty" bson:",omitempty"` // finish time FinishTime *time.Time `json:",omitempty" bson:",omitempty"` }
DeviceDeploymentStatus is a helper type for reporting status changes through the layers
func (DeviceDeploymentState) Validate ¶
func (state DeviceDeploymentState) Validate() error
type DeviceDeploymentStatus ¶
type DeviceDeploymentStatus int32
DeviceDeploymentStatus is an enumerated type showing the status of a device within a deployment
func ActiveDeploymentStatuses ¶
func ActiveDeploymentStatuses() []DeviceDeploymentStatus
ActiveDeploymentStatuses lists statuses that represent deployment in active state (not finished).
func InactiveDeploymentStatuses ¶
func InactiveDeploymentStatuses() []DeviceDeploymentStatus
func NewStatus ¶
func NewStatus(status string) DeviceDeploymentStatus
func (DeviceDeploymentStatus) Active ¶
func (stat DeviceDeploymentStatus) Active() bool
func (DeviceDeploymentStatus) MarshalText ¶
func (stat DeviceDeploymentStatus) MarshalText() ([]byte, error)
func (DeviceDeploymentStatus) String ¶
func (stat DeviceDeploymentStatus) String() string
func (*DeviceDeploymentStatus) UnmarshalText ¶
func (stat *DeviceDeploymentStatus) UnmarshalText(b []byte) error
type DeviceGroups ¶
type DeviceGroups struct { //device's groups names Groups []string `json:"groups" bson:"-"` }
type DeviceIds ¶
type DeviceIds struct {
Devices []string `json:"devices,omitempty" valid:"required" bson:"-"`
}
type DirectUploadMetadata ¶
type DirectUploadMetadata struct { Size int64 `json:"size,omitempty" valid:"-"` Updates []Update `json:"updates" valid:"-"` }
func (DirectUploadMetadata) Validate ¶
func (m DirectUploadMetadata) Validate() error
type FilterPredicate ¶
type Image ¶
type Image struct { // Image ID Id string `json:"id" bson:"_id" valid:"uuidv4,required"` // User provided field set *ImageMeta `bson:"meta"` // Field set provided with yocto image *ArtifactMeta `bson:"meta_artifact"` // Artifact total size Size int64 `json:"size" bson:"size" valid:"-"` // Last modification time, including image upload time Modified *time.Time `json:"modified" valid:"-"` }
Image YOCTO image with user application
func NewImage ¶
func NewImage( id string, metaConstructor *ImageMeta, metaArtifactConstructor *ArtifactMeta, artifactSize int64) *Image
NewImage creates new software image object.
func (Image) MarshalBSON ¶
func (*Image) SetModified ¶
SetModified set last modification time for the image.
type ImageMeta ¶
type ImageMeta struct { // Image description Description string `json:"description,omitempty" valid:"length(1|4096),optional"` }
Information provided by the user
type InstalledDeviceDeployment ¶
type InstalledDeviceDeployment struct { ArtifactName string `json:"artifact_name"` DeviceType string `json:"device_type"` Provides map[string]string `json:"artifact_provides,omitempty"` }
InstalledDeviceDeployment describes a deployment currently installed on the device, usually reported by a device
func (*InstalledDeviceDeployment) Validate ¶
func (i *InstalledDeviceDeployment) Validate() error
type InvDevice ¶
type InvDevice struct { //system-generated device ID ID string `json:"id" bson:"_id,omitempty"` //a map of attributes names and their values. Attributes []DeviceAttribute `json:"attributes,omitempty" bson:"attributes,omitempty"` //device's group name Group string `json:"-" bson:"group,omitempty"` CreatedTs time.Time `json:"-" bson:"created_ts,omitempty"` //Timestamp of the last attribute update. UpdatedTs time.Time `json:"updated_ts" bson:"updated_ts,omitempty"` }
Inventory device wrapper
type InvalidCharError ¶
func (*InvalidCharError) Error ¶
func (err *InvalidCharError) Error() string
type InvalidCharacterError ¶
func (*InvalidCharacterError) Error ¶
func (err *InvalidCharacterError) Error() string
type Link ¶
type LinkStatus ¶
type LinkStatus uint32
const ( LinkStatusPending LinkStatus = (iota << 4) LinkStatusProcessing LinkStatusCompleted LinkStatusAborted LinkStatusProcessedBit = LinkStatus(1 << 7) LinkStatusProcessedMask = ^LinkStatus(LinkStatusProcessedBit) )
func (LinkStatus) MarshalText ¶
func (status LinkStatus) MarshalText() (b []byte, err error)
func (*LinkStatus) UnmarshalText ¶
func (status *LinkStatus) UnmarshalText(b []byte) error
type LogMessage ¶
type LogMessage struct { Timestamp *time.Time `json:"timestamp" valid:"required"` Level string `json:"level" valid:"required"` Message string `json:"message" valid:"required"` }
func (LogMessage) String ¶
func (l LogMessage) String() string
func (*LogMessage) UnmarshalJSON ¶
func (l *LogMessage) UnmarshalJSON(raw []byte) error
func (LogMessage) Validate ¶
func (l LogMessage) Validate() error
type MultipartGenerateImageMsg ¶
type MultipartGenerateImageMsg struct { Name string `json:"name"` Description string `json:"description"` DeviceTypesCompatible []string `json:"device_types_compatible"` Type string `json:"type"` Args string `json:"args"` ArtifactID string `json:"artifact_id"` GetArtifactURI string `json:"get_artifact_uri"` DeleteArtifactURI string `json:"delete_artifact_uri"` TenantID string `json:"tenant_id"` Token string `json:"token"` FileReader io.Reader `json:"-"` }
MultipartGenerateImageMsg is a structure with fields extracted from the multipart/form-data form sent in the artifact generation request
func (MultipartGenerateImageMsg) Validate ¶
func (msg MultipartGenerateImageMsg) Validate() error
type MultipartUploadMsg ¶
type MultipartUploadMsg struct { // user metadata constructor MetaConstructor *ImageMeta // ArtifactID contains the artifact ID ArtifactID string // reader pointing to the beginning of the artifact data ArtifactReader io.Reader }
MultipartUploadMsg is a structure with fields extracted from the multipart/form-data form send in the artifact upload request
type NewTenantReq ¶
type NewTenantReq struct {
TenantId string `json:"tenant_id"`
}
func ParseNewTenantReq ¶
func ParseNewTenantReq(source io.Reader) (*NewTenantReq, error)
type ProvidesIdx ¶
func (ProvidesIdx) MarshalBSONValue ¶
func (p ProvidesIdx) MarshalBSONValue() (bsontype.Type, []byte, error)
func (*ProvidesIdx) UnmarshalBSONValue ¶
func (p *ProvidesIdx) UnmarshalBSONValue(t bsontype.Type, b []byte) error
type Query ¶
type Query struct { // list of IDs IDs []string // match deployments by text by looking at deployment name and artifact name SearchText string // deployment type Type DeploymentType // deployment status Status StatusQuery Limit int Skip int // only return deployments between timestamp range CreatedAfter *time.Time CreatedBefore *time.Time // sort values by creation date Sort string // disable the counting DisableCount bool }
Deployment lookup query
type ReadCounter ¶
type Release ¶
type Release struct { Name string `json:"name" bson:"_id"` Modified *time.Time `json:"modified,omitempty" bson:"modified,omitempty"` Artifacts []Image `json:"artifacts" bson:"artifacts"` ArtifactsCount int `json:"artifacts_count" bson:"artifacts_count"` Tags Tags `json:"tags" bson:"tags,omitempty"` Notes Notes `json:"notes" bson:"notes,omitempty"` }
type ReleaseOrImageFilter ¶
type ReleasePatch ¶
type ReleasePatch struct {
Notes Notes `json:"notes" bson:"notes,omitempty"`
}
func (ReleasePatch) Validate ¶
func (r ReleasePatch) Validate() error
type ReleaseV1 ¶
type ReleaseV1 struct { Name string `json:"Name"` Modified *time.Time `json:"Modified,omitempty"` Artifacts []Image `json:"Artifacts"` ArtifactsCount int `json:"ArtifactsCount"` Tags Tags `json:"tags"` Notes Notes `json:"notes"` }
func ConvertReleasesToV1 ¶
type ReleasesDeleteError ¶
type RequestSignature ¶
func NewRequestSignature ¶
func NewRequestSignature(req *http.Request, secret []byte) *RequestSignature
func (*RequestSignature) Bytes ¶
func (sig *RequestSignature) Bytes() []byte
func (*RequestSignature) HMAC256 ¶
func (sig *RequestSignature) HMAC256() []byte
func (*RequestSignature) PresignURL ¶
func (sig *RequestSignature) PresignURL() string
PresignURL generates and assign the request signature parameter and returning the resulting URL.
func (*RequestSignature) SetExpire ¶
func (sig *RequestSignature) SetExpire(expire time.Time)
func (*RequestSignature) Validate ¶
func (sig *RequestSignature) Validate() error
Validate validates the request parameters - assumes that the signature is already signed.
func (*RequestSignature) VerifyHMAC256 ¶
func (sig *RequestSignature) VerifyHMAC256() bool
VerifyHMAC256 verifies the request signature with the parameter.
type SearchParams ¶
type SearchParams struct { Page int `json:"page"` PerPage int `json:"per_page"` Filters []FilterPredicate `json:"filters"` DeviceIDs []string `json:"device_ids"` }
type Stats ¶
Deployment statistics wrapper, each value carries a count of deployments aggregated by state.
func NewDeviceDeploymentStats ¶
func NewDeviceDeploymentStats() Stats
func (Stats) Get ¶
func (s Stats) Get(status DeviceDeploymentStatus) int
func (Stats) Inc ¶
func (s Stats) Inc(status DeviceDeploymentStatus)
func (Stats) Set ¶
func (s Stats) Set(status DeviceDeploymentStatus, count int)
type StatusQuery ¶
type StatusQuery int
const ( StatusQueryAny StatusQuery = iota StatusQueryPending StatusQueryInProgress StatusQueryFinished StatusQueryAborted SortDirectionAscending = "asc" SortDirectionDescending = "desc" )
type StatusReport ¶
type StatusReport struct { Status DeviceDeploymentStatus `json:"status"` SubState string `json:"substate"` }
func (*StatusReport) UnmarshalJSON ¶
func (s *StatusReport) UnmarshalJSON(raw []byte) error
func (StatusReport) Validate ¶
func (s StatusReport) Validate() error
type StorageSettings ¶
type StorageSettings struct { // Type is the provider type (azblob/s3) for the given settings Type StorageType `json:"type" bson:"type"` // Region sets the s3 bucket region (required when StorageType == StorageTypeAWS) Region string `json:"region" bson:"region"` // Bucket is the name of the bucket (s3) or container (azblob) storing artifacts. Bucket string `json:"bucket" bson:"bucket"` // Uri contains the (private) URI used to call the storage APIs. Uri string `json:"uri" bson:"uri"` // ExternalUri contains the public bucket / container URI. ExternalUri string `json:"external_uri" bson:"external_uri"` // ProxyURI is used for rewriting presigned requests, pointing the // requests to the proxy URL instead of the direct URL to s3. ProxyURI *string `json:"proxy_uri,omitempty" bson:"proxy_uri,omitempty"` // Key contains the key identifier (azblob: account name) used to // authenticate with the storage APIs. Key string `json:"key,omitempty" bson:"key,omitempty"` // Secret holds the secret part of the authentication credentials. Secret string `json:"secret,omitempty" bson:"secret,omitempty"` // Token (s3) stores the optional session token. Token string `json:"token,omitempty" bson:"token,omitempty"` // ConnectionString (azblob) contains the Azure connection string as an // alternative set of credentials from (Uri, Key, Secret). ConnectionString *string `json:"connection_string,omitempty" bson:"connection_string,omitempty"` // ForcePathStyle (s3) enables path-style URL scheme for the s3 API. ForcePathStyle bool `json:"force_path_style" bson:"force_path_style"` // UseAccelerate (s3) enables AWS transfer acceleration. UseAccelerate bool `json:"use_accelerate" bson:"use_accelerate"` }
func ParseStorageSettingsRequest ¶
func ParseStorageSettingsRequest(source io.Reader) (settings *StorageSettings, err error)
func (StorageSettings) Validate ¶
func (s StorageSettings) Validate() error
Validate checks structure according to valid tags
type StorageType ¶
type StorageType uint32
const ( StorageTypeS3 StorageType = iota StorageTypeAzure )
func (StorageType) MarshalText ¶
func (typ StorageType) MarshalText() ([]byte, error)
func (*StorageType) UnmarshalText ¶
func (typ *StorageType) UnmarshalText(b []byte) error
type Update ¶
type Update struct { TypeInfo ArtifactUpdateTypeInfo `json:"type_info" valid:"required"` Files []UpdateFile `json:"files"` MetaData interface{} `json:"meta_data,omitempty" valid:"optional"` }
Update structure
type UpdateFile ¶
type UpdateFile struct { // Image name Name string `json:"name" valid:"required"` // Image file checksum Checksum string `json:"checksum" valid:"optional"` // Image size Size int64 `json:"size" valid:"optional"` // Date build Date *time.Time `json:"date" valid:"optional"` }
Update file structure
type UploadLink ¶
Source Files ¶
- configuration_deployment.go
- deployment.go
- deployment_instructions.go
- device.go
- device_deployment.go
- device_deployment_last_status.go
- device_deployment_list_item.go
- device_deployment_log.go
- error.go
- filters.go
- image.go
- limit.go
- link.go
- newtenant_req.go
- release.go
- signature.go
- status.go
- storage_settings.go
- update.go
- validation.go