Documentation ¶
Overview ¶
Copyright 2019 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 NewDeploymentsResourceRoutes(controller *DeploymentsApiHandlers) []*rest.Route
- func NewImagesResourceRoutes(controller *DeploymentsApiHandlers) []*rest.Route
- func NewLimitsResourceRoutes(controller *DeploymentsApiHandlers) []*rest.Route
- func NewRouter(c config.Reader) (rest.App, error)
- func ParseLookupQuery(vals url.Values) (model.Query, error)
- func ReleasesRoutes(controller *DeploymentsApiHandlers) []*rest.Route
- func SetupArtifactory(c config.Reader) (model.FileStorage, error)
- func SetupS3(c config.Reader) (model.FileStorage, error)
- func TenantRoutes(controller *DeploymentsApiHandlers) []*rest.Route
- type ArtifactoryStorageService
- type DeploymentsApiHandlers
- func (d *DeploymentsApiHandlers) AbortDeployment(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) DecommissionDevice(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) DeleteImage(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) DeploymentsPerTenantHandler(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) DownloadLink(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) EditImage(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) GetDeployment(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) GetDeploymentForDevice(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) GetDeploymentLogForDevice(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) GetDeploymentStats(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) GetDeviceStatusesForDeployment(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) GetImage(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) GetLimit(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) GetReleases(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) ListImages(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) LookupDeployment(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) NewImage(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) NewImageForTenantHandler(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) ParseMultipart(mr *multipart.Reader, maxMetaSize int64) (*model.MultipartUploadMsg, error)
- func (d *DeploymentsApiHandlers) PostDeployment(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) ProvisionTenantsHandler(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) PutDeploymentLogForDevice(w rest.ResponseWriter, r *rest.Request)
- func (d *DeploymentsApiHandlers) PutDeploymentStatusForDevice(w rest.ResponseWriter, r *rest.Request)
- type RESTView
Constants ¶
View Source
const ( // 15 minutes DefaultDownloadLinkExpire = 15 * time.Minute DefaultMaxMetaSize = 1024 * 1024 * 10 )
View Source
const ( GetDeploymentForDeviceQueryArtifact = "artifact_name" GetDeploymentForDeviceQueryDeviceType = "device_type" )
storage keys
View Source
const ( ApiUrlInternal = "/api/internal/v1/deployments" ApiUrlManagement = "/api/management/v1/deployments" ApiUrlDevices = "/api/devices/v1/deployments" ApiUrlManagementArtifacts = ApiUrlManagement + "/artifacts" ApiUrlManagementArtifactsId = ApiUrlManagement + "/artifacts/:id" ApiUrlManagementArtifactsIdDownload = ApiUrlManagement + "/artifacts/:id/download" ApiUrlManagementDeployments = ApiUrlManagement + "/deployments" ApiUrlManagementDeploymentsId = ApiUrlManagement + "/deployments/:id" ApiUrlManagementDeploymentsStatistics = ApiUrlManagement + "/deployments/:id/statistics" ApiUrlManagementDeploymentsStatus = ApiUrlManagement + "/deployments/:id/status" ApiUrlManagementDeploymentsDevices = ApiUrlManagement + "/deployments/:id/devices" ApiUrlManagementDeploymentsLog = ApiUrlManagement + "/deployments/:id/devices/:devid/log" ApiUrlManagementDeploymentsDeviceId = ApiUrlManagement + "/deployments/devices/:id" ApiUrlManagementReleases = ApiUrlManagement + "/deployments/releases" ApiUrlManagementLimitsName = ApiUrlManagement + "/limits/:name" ApiUrlDevicesDeploymentsNext = ApiUrlDevices + "/device/deployments/next" ApiUrlDevicesDeploymentStatus = ApiUrlDevices + "/device/deployments/:id/status" ApiUrlDevicesDeploymentsLog = ApiUrlDevices + "/device/deployments/:id/log" ApiUrlInternalTenants = ApiUrlInternal + "/tenants" ApiUrlInternalTenantDeployments = ApiUrlInternal + "/tenants/:tenant/deployments" ApiUrlInternalTenantArtifacts = ApiUrlInternal + "/tenants/:tenant/artifacts" )
Variables ¶
View Source
var ( ErrIDNotUUIDv4 = errors.New("ID is not UUIDv4") ErrArtifactUsedInActiveDeployment = errors.New("Artifact is used in active deployment") ErrInvalidExpireParam = errors.New("Invalid expire parameter") ErrInternal = errors.New("Internal error") ErrDeploymentAlreadyFinished = errors.New("Deployment already finished") ErrUnexpectedDeploymentStatus = errors.New("Unexpected deployment status") ErrMissingIdentity = errors.New("Missing identity data") )
Errors
Functions ¶
func NewDeploymentsResourceRoutes ¶
func NewDeploymentsResourceRoutes(controller *DeploymentsApiHandlers) []*rest.Route
func NewImagesResourceRoutes ¶
func NewImagesResourceRoutes(controller *DeploymentsApiHandlers) []*rest.Route
func NewLimitsResourceRoutes ¶
func NewLimitsResourceRoutes(controller *DeploymentsApiHandlers) []*rest.Route
func ReleasesRoutes ¶
func ReleasesRoutes(controller *DeploymentsApiHandlers) []*rest.Route
func SetupArtifactory ¶
func SetupArtifactory(c config.Reader) (model.FileStorage, error)
func TenantRoutes ¶
func TenantRoutes(controller *DeploymentsApiHandlers) []*rest.Route
Types ¶
type ArtifactoryStorageService ¶
type ArtifactoryStorageService struct {
// contains filtered or unexported fields
}
ArtifactoryStorageService - Artifactory storage client
type DeploymentsApiHandlers ¶
type DeploymentsApiHandlers struct {
// contains filtered or unexported fields
}
func (*DeploymentsApiHandlers) AbortDeployment ¶
func (d *DeploymentsApiHandlers) AbortDeployment(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) DecommissionDevice ¶
func (d *DeploymentsApiHandlers) DecommissionDevice(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) DeleteImage ¶
func (d *DeploymentsApiHandlers) DeleteImage(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) DeploymentsPerTenantHandler ¶
func (d *DeploymentsApiHandlers) DeploymentsPerTenantHandler(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) DownloadLink ¶
func (d *DeploymentsApiHandlers) DownloadLink(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) EditImage ¶
func (d *DeploymentsApiHandlers) EditImage(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) GetDeployment ¶
func (d *DeploymentsApiHandlers) GetDeployment(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) GetDeploymentForDevice ¶
func (d *DeploymentsApiHandlers) GetDeploymentForDevice(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) GetDeploymentLogForDevice ¶
func (d *DeploymentsApiHandlers) GetDeploymentLogForDevice(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) GetDeploymentStats ¶
func (d *DeploymentsApiHandlers) GetDeploymentStats(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) GetDeviceStatusesForDeployment ¶
func (d *DeploymentsApiHandlers) GetDeviceStatusesForDeployment(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) GetImage ¶
func (d *DeploymentsApiHandlers) GetImage(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) GetLimit ¶
func (d *DeploymentsApiHandlers) GetLimit(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) GetReleases ¶
func (d *DeploymentsApiHandlers) GetReleases(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) ListImages ¶
func (d *DeploymentsApiHandlers) ListImages(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) LookupDeployment ¶
func (d *DeploymentsApiHandlers) LookupDeployment(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) NewImage ¶
func (d *DeploymentsApiHandlers) NewImage(w rest.ResponseWriter, r *rest.Request)
Multipart Image/Meta upload handler. Request should be of type "multipart/form-data". First part should contain Metadata file. This file should be of type "application/json". Second part should contain artifact file.
func (*DeploymentsApiHandlers) NewImageForTenantHandler ¶
func (d *DeploymentsApiHandlers) NewImageForTenantHandler(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) ParseMultipart ¶
func (d *DeploymentsApiHandlers) ParseMultipart(mr *multipart.Reader, maxMetaSize int64) (*model.MultipartUploadMsg, error)
ParseMultipart parses multipart/form-data message.
func (*DeploymentsApiHandlers) PostDeployment ¶
func (d *DeploymentsApiHandlers) PostDeployment(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) ProvisionTenantsHandler ¶
func (d *DeploymentsApiHandlers) ProvisionTenantsHandler(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) PutDeploymentLogForDevice ¶
func (d *DeploymentsApiHandlers) PutDeploymentLogForDevice(w rest.ResponseWriter, r *rest.Request)
func (*DeploymentsApiHandlers) PutDeploymentStatusForDevice ¶
func (d *DeploymentsApiHandlers) PutDeploymentStatusForDevice(w rest.ResponseWriter, r *rest.Request)
type RESTView ¶
type RESTView interface { RenderSuccessGet(w rest.ResponseWriter, object interface{}) RenderError(w rest.ResponseWriter, r *rest.Request, err error, status int, l *log.Logger) RenderInternalError(w rest.ResponseWriter, r *rest.Request, err error, l *log.Logger) RenderNoUpdateForDevice(w rest.ResponseWriter) RenderSuccessPost(w rest.ResponseWriter, r *rest.Request, id string) RenderEmptySuccessResponse(w rest.ResponseWriter) RenderErrorNotFound(w rest.ResponseWriter, r *rest.Request, l *log.Logger) RenderDeploymentLog(w rest.ResponseWriter, dlog model.DeploymentLog) RenderSuccessDelete(w rest.ResponseWriter) RenderSuccessPut(w rest.ResponseWriter) }
Click to show internal directories.
Click to hide internal directories.