summaryrefslogtreecommitdiffstats
path: root/lib/xaapiv1/sdks.go
blob: 7f2ab0203121e50c5c4bdf77fcbb349cd4f36a46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Copyright (C) 2017-2018 "IoT.bzh"
 * Author Sebastien Douheret <sebastien@iot.bzh>
 *
 * 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.
 */

package xaapiv1

// SDK status definition
const (
	SdkStatusDisable      = "Disable"
	SdkStatusNotInstalled = "Not Installed"
	SdkStatusInstalling   = "Installing"
	SdkStatusUninstalling = "Un-installing"
	SdkStatusInstalled    = "Installed"
)

// SDK Define a cross tool chain used to build application
type SDK struct {
	ID          string `json:"id" binding:"required"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Profile     string `json:"profile"`
	Version     string `json:"version"`
	Arch        string `json:"arch"`
	Path        string `json:"path"`
	URL         string `json:"url"`
	Status      string `json:"status"`
	Date        string `json:"date"`
	Size        string `json:"size"`
	Md5sum      string `json:"md5sum"`
	SetupFile   string `json:"setupFile"`
	LastError   string `json:"lastError"`
}

// SDKInstallArgs JSON parameters of POST /sdks or /sdks/abortinstall commands
type SDKInstallArgs struct {
	ID          string   `json:"id"`          // install by ID (must be part of GET /sdks result)
	Filename    string   `json:"filename"`    // install by using a file
	Force       bool     `json:"force"`       // force SDK install when already existing
	Timeout     int      `json:"timeout"`     // 1800 == default 30 minutes
	InstallArgs []string `json:"installArgs"` // args directly passed to add/install script
}

// SDKManagementMsg Message send during SDK installation or when installation is complete
type SDKManagementMsg struct {
	CmdID     string `json:"cmdID"`
	Timestamp string `json:"timestamp"`
	Sdk       SDK    `json:"sdk"`
	Stdout    string `json:"stdout"`
	Stderr    string `json:"stderr"`
	Progress  int    `json:"progress"` // 0 = not started to 100% = complete
	Exited    bool   `json:"exited"`
	Code      int    `json:"code"`
	Error     string `json:"error"`
}