Documentation
¶
Overview ¶
Copyright 2022 Pantacor Ltd.
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 AddDockerApp(p *Pvr, app *AppData) error
- func AddFragsToState(srcState, patchState map[string]interface{}, frags string) map[string]interface{}
- func AddPvApp(p *Pvr, app *AppData) error
- func AddRootFsApp(p *Pvr, app *AppData) error
- func AskForConfirmation(question string) bool
- func CleanPatchSignedPkg(src, patch, target *PvrMap) (err error)
- func CleanRemovedSignatures(initialState, finalState *PvrMap, initialStateBuf []byte) (err error)
- func Copy(dst, src string) error
- func Create(path string, perm os.FileMode) error
- func CreateFolder(path string) error
- func CreateTrail(baseURL string, deviceAccessToken string, state map[string]interface{}) (*resty.Response, error)
- func DeleteSignatureFromState(state PvrMap, stateBuf []byte, delSigKey string, ...) ([]string, error)
- func DownloadFile(uri *url.URL) (string, error)
- func DownloadLayersFromLocalDocker(digest string) (io.ReadCloser, error)
- func DownloadSigningCert(url, path string) error
- func DownloadSigningCertWithConfirmation(url, path string, force bool) error
- func ExecCommand(name string, arg ...string) error
- func ExecCommandOut(name string, arg ...string) (string, error)
- func ExpandFragmentsWithSignedParts(src PvrMap, fragments string) (string, error)
- func ExpandPath(path string) (string, error)
- func ExtractFiles(files []string, extractPath string) error
- func FileHasSameSha(path, sha string) (bool, error)
- func FiletoSha(path string) (string, error)
- func FilterByFrags(state map[string]interface{}, frags string) (map[string]interface{}, error)
- func FindWhiteoutsFromLayer(layerPath string) ([]string, error)
- func FixupRepoRef(repoUri string) (string, error)
- func FormatJson(data []byte) ([]byte, error)
- func FormatJsonC(data []byte) ([]byte, error)
- func GetDockerConfigFile(p *Pvr, app *AppData) (map[string]interface{}, error)
- func GetFileContentType(src string) (string, error)
- func GetFromConfigPvs(url, configPath, name string, force bool) (string, error)
- func GetFromRootFs(app *AppData) (string, error)
- func GetPersistence(app *AppData) (map[string]string, error)
- func GetPhAuthHeaderTokenKey(authHeader string) (string, error)
- func GetPlatform() string
- func GetStatePatch(initialState, endState []byte) (*[]byte, error)
- func Hardlink(dst, src string) error
- func InstallDockerApp(p *Pvr, app *AppData, appManifest *Source) error
- func InstallPVApp(p *Pvr, app *AppData, appManifest *Source) error
- func InstallRootFsApp(p *Pvr, app *AppData, appManifest *Source) error
- func IsFileExists(filePath string) (bool, error)
- func IsSha(sha string) bool
- func IsValidUrl(value string) bool
- func LoadLocalImage(app *AppData) error
- func LoginDevice(baseURL string, prn string, secret string) (string, error)
- func Max(x, y int) int
- func MergePatch(srcData, target []byte) ([]byte, error)
- func MergeSummary(dest *JwsVerifySummary, merge ...JwsVerifySummary)
- func Min(x, y int) int
- func Mkdir(path string, perm os.FileMode) error
- func MkdirAll(path string, perm os.FileMode) error
- func OverwriteState(state PvrMap, newState PvrMap)
- func ParseRFC3339(date string) (time.Time, error)
- func PatchState(srcBuff, patchBuff []byte, srcFrags, patchFrag string, merge bool, ...) ([]byte, map[string]interface{}, error)
- func PrintDebugf(format string, a ...interface{}) (n int, err error)
- func PrintDebugln(a ...interface{}) (n int, err error)
- func ProcessWhiteouts(extractPath string, layerPath string, layerNumber int) error
- func ReadArgsFile(filePath string) (map[string]interface{}, error)
- func ReadOrCreateFile(filePath string) (*[]byte, error)
- func Remove(path string) error
- func RemoveAll(path string) error
- func RemoveDirContents(dir string) error
- func RenameFile(src string, dst string) (err error)
- func ReportDockerManifestError(err error, image string) error
- func ReportError(err error, knowSolutions ...string) error
- func Scan()
- func SetTempFilesInterrupHandler(tempdir string)
- func ShowOrOpenRegisterLink(baseAPIURL, email, username, password string) error
- func SliceContainsItem(slice []string, item string) bool
- func SortObjects(objects map[string]string) []string
- func SprintTmpl(format string, obj interface{}) (string, error)
- func StructToMap(s interface{}) (map[string]interface{}, error)
- func Untar(dst string, src string, options []string) error
- func UpdateDockerApp(p *Pvr, app *AppData, appManifest *Source) (err error)
- func UpdateIfNecessary(c *cli.Context) error
- func UpdatePvApp(p *Pvr, app *AppData, appManifest *Source) error
- func UpdateRootFSApp(p *Pvr, app *AppData, appManifest *Source) error
- func ValidateSourceFlag(source string) error
- func WriteConfiguration(filePath string, config *PvrGlobalConfig) error
- func WriteTxtFile(filePath string, content string) error
- type Account
- type ApiError
- type AppData
- type AsyncBody
- type DmSource
- type DmVerityJson
- type DockerImage
- type DockerManifest
- type DockerSource
- type EncryptedAccountData
- type FilePut
- type GetAccesstokenMethod
- type JwsVerifySummary
- type LogFilter
- type LogFormatter
- type LogFormatterJson
- type LogFormatterTemplate
- type Manifest
- type Object
- type ObjectWithAccess
- type PVZeroConf
- type PantahubDevice
- type PantahubDevicesJoinToken
- type Pvr
- func (p *Pvr) AddApplication(app *AppData, addonly bool) (err error)
- func (p *Pvr) AddFile(globs []string, forceObject bool) error
- func (p *Pvr) AuthConfig(username, password, registry string) (types.AuthConfig, error)
- func (p *Pvr) CheckIfIsRunningAsRoot() error
- func (p *Pvr) Cleanup() error
- func (p *Pvr) Commit(msg string, isCheckpoint bool) (err error)
- func (p *Pvr) DeployPvLinks() error
- func (p *Pvr) Diff() (*[]byte, error)
- func (p *Pvr) DmCVerityApply(prefix string) error
- func (p *Pvr) DmCVerityConvert(container string, volume string) error
- func (p *Pvr) DmCryptApply() error
- func (p *Pvr) DoClaim(deviceEp, challenge string) error
- func (p *Pvr) DoDelete(deviceEp string, confirm bool) error
- func (p *Pvr) Export(parts []string, dst string) error
- func (p *Pvr) FindDockerImage(app *AppData) (err error)
- func (p *Pvr) GenerateApplicationSquashFS(app *AppData, appManifest *Source) error
- func (p *Pvr) GenerateApplicationTemplateFiles(appname string, dockerConfig map[string]interface{}, appManifest *Source) error
- func (p *Pvr) GetAppDockerDigest(appname string) (string, error)
- func (p *Pvr) GetAppDockerName(appname string) (string, error)
- func (p *Pvr) GetApplicationInfo(appname string) error
- func (p *Pvr) GetApplicationManifest(appname string) (*Source, error)
- func (p *Pvr) GetApplications() ([]AppData, error)
- func (p *Pvr) GetCPristineJson() ([]byte, error)
- func (p *Pvr) GetDefaultGroup() string
- func (p *Pvr) GetDockerConfig(manifest *Manifest, image registry.Image, auth types.AuthConfig) (map[string]interface{}, error)
- func (p *Pvr) GetDockerImageRepoDigest(image registry.Image, auth types.AuthConfig) (string, error)
- func (p *Pvr) GetDockerManifest(image registry.Image, auth types.AuthConfig, digest, version string) (*Manifest, error)
- func (p *Pvr) GetDockerRegistry(image registry.Image, auth types.AuthConfig) (*registry.Registry, error)
- func (p *Pvr) GetFromRepo(app *AppData) (string, *Source, error)
- func (p *Pvr) GetGroup(name string) (result string, err error)
- func (p *Pvr) GetJson(uri string) (state map[string]interface{}, err error)
- func (p *Pvr) GetRepo(uri string, merge bool, showFilenames bool, state *PvrMap) (objectsCount int, err error)
- func (p *Pvr) GetRepoLocal(getPath string, merge bool, showFilenames bool, state *PvrMap) (objectsCount int, err error)
- func (p *Pvr) GetRepoRemote(url *url.URL, merge bool, showFilenames bool, state *PvrMap) (objectsCount int, err error)
- func (p *Pvr) GetSquashFSDigest(squashFile, appName string) (string, error)
- func (p *Pvr) GetStateJson(uri string) (state map[string]interface{}, err error)
- func (p *Pvr) GetTrackURL(appname string) (string, error)
- func (p *Pvr) GetWorkingGroupsJson() (result []interface{}, err error)
- func (p *Pvr) GetWorkingJson() ([]byte, []string, error)
- func (p *Pvr) GetWorkingJsonMap() (resMap map[string]interface{}, untracked []string, err error)
- func (p *Pvr) HasGroup(name string) bool
- func (p *Pvr) HasGroups() bool
- func (p *Pvr) Import(src string) error
- func (p *Pvr) Init(objectsDir string) error
- func (p *Pvr) InitCustom(customInitJson string, objectsDir string) error
- func (p *Pvr) InstallApplication(app *AppData) (err error)
- func (p *Pvr) JSONDiff() (*[]byte, error)
- func (p *Pvr) JwsSign(name string, privKeyPath string, match *PvsMatch, options *PvsOptions) error
- func (p *Pvr) JwsSignAuto(keyPath string, part string, options *PvsOptions) error
- func (p *Pvr) JwsSignPvs(privKeyPath string, pvsPath string, options *PvsOptions) error
- func (p *Pvr) JwsVerifyPvs(keyPath string, caCerts string, pvsPath string, includePayload bool) (*JwsVerifySummary, error)
- func (p *Pvr) ListApplications() error
- func (p *Pvr) LoadRemoteImage(app *AppData) error
- func (p *Pvr) MakeSquash(rootfsPath string, app *AppData) error
- func (p *Pvr) Post(uri string, envelope string, commitMsg string, rev string, force bool) error
- func (p *Pvr) Put(uri string, force bool) error
- func (p *Pvr) PutLocal(repoPath string) error
- func (p *Pvr) PutObjects(uri string, force bool) error
- func (p *Pvr) PutRemote(repoPath *url.URL, force bool) error
- func (p *Pvr) RemoteCopy(pvrSrc string, pvrDest string, merge bool, envelope string, commitMsg string, ...) error
- func (p *Pvr) RemoteInfo(pvrRef string) (*pvrapi.PvrRemote, error)
- func (p *Pvr) RemoveApplication(appname string) error
- func (p *Pvr) Reset(canonicalJson bool) error
- func (p *Pvr) ResetWithHardlink() error
- func (p *Pvr) ResetWithState(state *PvrMap) error
- func (p *Pvr) RunAsRoot() error
- func (p *Pvr) SaveConfig() error
- func (pvr *Pvr) SetConfiguration(arguments []string) (*PvrGlobalConfig, error)
- func (p *Pvr) SetSourceTypeFromManifest(app *AppData, options *models.GetSTOptions) error
- func (p *Pvr) Status() (*PvrStatus, error)
- func (p *Pvr) String() string
- func (p *Pvr) UnpackRepo(repoPath, outDir string, options []string) error
- func (p *Pvr) UpdateApplication(app AppData) error
- func (pvr *Pvr) UpdatePvr(username, password string, silent, force bool) error
- func (p *Pvr) Verify(keyPath string) error
- type PvrAuthConfig
- type PvrAuthTarget
- type PvrAuthTokens
- type PvrConfig
- type PvrFileAddInfo
- type PvrGlobalConfig
- type PvrIndex
- type PvrMap
- type PvrSource
- type PvrStatus
- type PvsCertPool
- type PvsMatch
- type PvsOptions
- type PvsPartSelection
- type RootFsSource
- type Session
- func (s *Session) CreateDevice(baseURL string, deviceNick string) (*resty.Response, error)
- func (s *Session) DoAuthCall(withAnonToken, interactiveOnly bool, fn WrappableRestyCallFunc) (*resty.Response, error)
- func (p *Session) DoLogs(baseurl string, deviceIds []string, rev string, startTime *time.Time, ...) (logEntries []*logs.Entry, cursorID string, err error)
- func (p *Session) DoLogsCursor(baseurl string, cursor string) (logEntries []*logs.Entry, cursorID string, err error)
- func (p *Session) DoPs(baseurl string) ([]PantahubDevice, error)
- func (s *Session) GetApp() *cli.App
- func (s *Session) GetAuthStatus(baseURL string) (*resty.Response, error)
- func (s *Session) GetConfigDir() string
- func (s *Session) GetDevice(baseURL string, deviceNick string, ownerNick string) (*resty.Response, error)
- func (s *Session) GetDevices(baseURL string, ownerNick string, deviceNick string) (*resty.Response, error)
- func (s *Session) GetUserProfiles(baseURL string, userNick string) (*resty.Response, error)
- func (s *Session) GetWhoami() (nick string, err error)
- func (session *Session) IsUserLoggedIn(baseURL string) (bool, error)
- func (s *Session) Login(APIURL string, interactiveOnly bool) (*resty.Response, error)
- func (s *Session) SuggestDeviceNicks(userNick, searchTerm string, baseURL string)
- func (s *Session) SuggestNicks(searchTerm string, baseURL string)
- func (s *Session) SuggestUserNicks(searchTerm string, baseURL string)
- func (p *Session) TokenCreate(baseurl string, usermeta map[string]interface{}) (*PantahubDevicesJoinToken, error)
- func (p *Session) TokenDisable(baseurl string, id string) (*PantahubDevicesJoinToken, error)
- func (p *Session) TokenLs(baseurl string) ([]PantahubDevicesJoinToken, error)
- func (s *Session) UpdateDevice(baseURL string, deviceNick string, data map[string]interface{}, ...) (*resty.Response, error)
- func (s *Session) Whoami() (err error)
- type SignedParts
- type Source
- type TreeDiff
- type WrappableRestyCallFunc
Constants ¶
const ( SRC_FILE = "src.json" SRC_SPEC = "service-manifest-src@1" TEMPLATE_BUILTIN_LXC_DOCKER = "builtin-lxc-docker" )
const ( MAKE_SQUASHFS_CMD = "mksquashfs" SQUASH_FILE = "root.squashfs" SQUASH_OVL_FILE = "root.ovl.squashfs" DOCKER_DIGEST_SUFFIX = ".docker-digest" ROOTFS_DIGEST_SUFFIX = ".rootfs-digest" DOCKER_DOMAIN = "docker.io" DOCKER_DOMAIN_URL = "https://" + DOCKER_DOMAIN DOCKER_REGISTRY = "https://index.docker.io/v1/" DOCKER_REGISTRY_SERVER_ADDRESS = "https://registry-1.docker.io" )
const ( // PhTrailsEp constant defining pantahub /trails PhTrailsEp = "/trails" // PhTrailsSummaryEp constant defines pantahub /trails/summary EP PhTrailsSummaryEp = PhTrailsEp + "/summary" // PhAccountsEp constant defines pantahub /accounts endpoint PhAccountsEp = "/auth/accounts" // PhLogsEp constant defining pantahub /logs/ PhLogsEp = "/logs/" // PhLogsEpCursor constant defines path to /logs/cursor PhLogsEpCursor = PhLogsEp + "cursor" // PhDeviceTokens constant defines path to /devices/tokens PhDeviceTokens = "/devices/tokens" )
const ( SigKeyFilename = "key.default.pem" SigX5cFilename = "x5c.default.pem" SigCacertFilename = "cacerts.default.pem" )
const ( CHMOD_CMD = "chmod" CP_CMD = "cp" LN_CMD = "ln" MKDIR_CMD = "mkdir" MKNOD_CMD = "mknod" MKTEMP_CMD = "mktemp" RM_CMD = "rm" TAR_CMD = "tar" TOUCH_CMD = "touch" )
const (
ConfigurationFile = "config.json"
)
const (
DmVolumes = "_dm"
)
const (
PoolSize = 5
)
const (
PvrCheckpointFilename = "checkpoint.json"
)
Variables ¶
var ( ErrInvalidVolumeFormat = errors.New("invalid volume format") ErrEmptyAppName = errors.New("empty app name") ErrEmptyFrom = errors.New("empty from") ErrEmptyPart = errors.New("empty part on the pvr url PVR_URL#part") ErrNeedBeRoot = errors.New("please run this command as root or use fakeroot utility") )
var ( ErrMakeSquashFSNotFound = errors.New("mksquashfs not found in your PATH, please install before continue") ErrTarNotFound = errors.New("tar not found in your PATH, please install before continue") ErrImageNotFound = errors.New("image not found or you do not have access") ErrDownloadedLayerDiffSize = errors.New("size of downloaded layer is different from expected") )
var IsDebugEnabled bool
Variable set in main() to enable/disable debug
var (
RuntimeDefaultMetadata = map[string]interface{}{
"PVR_BASEURL": "https://api.pantahub.com",
"PVR_REPO_BASEURL": "https://pvr.pantahub.com",
"PVR_AUTH": "",
}
)
Functions ¶
func AddDockerApp ¶
func AddFragsToState ¶
func AddRootFsApp ¶
func AskForConfirmation ¶
AskForConfirmation ask the user for confirmation action
func CleanPatchSignedPkg ¶
CleanPatchSignedPkg cleans the patched signed package by removing unnecessary keys and expressions. It takes in the source, patch, and target PvrMaps as parameters and returns an error if any.
Parameters: - src: The source PvrMap. - patch: The patch PvrMap. - target: The target PvrMap.
Returns: - error: An error if any occurred during the cleaning process.
func CleanRemovedSignatures ¶
CleanRemovedSignatures cleans the removed signatures in the initial state by comparing it with the final state.
Parameters: - initialState: A pointer to the initial state PvrMap. - finalState: A pointer to the final state PvrMap.
Returns: - error: An error if any occurred during the cleaning process.
func CreateFolder ¶
func CreateTrail ¶
func CreateTrail(baseURL string, deviceAccessToken string, state map[string]interface{}, ) ( *resty.Response, error, )
CreateTrail : Create Trail
func DeleteSignatureFromState ¶
func DeleteSignatureFromState(state PvrMap, stateBuf []byte, delSigKey string, delSigValue map[string]interface{}, signedParts SignedParts) ([]string, error)
DeleteSignatureFromState deletes a signature and signed files from the state and updates the signed parts accordingly.
Parameters: - state: the PVR state map. - stateBuf: the state buffer. - deletedSignature: the signature to be deleted. - signedParts: the signed parts mapping. Returns a slice of deleted parts and an error.
func DownloadLayersFromLocalDocker ¶
func DownloadLayersFromLocalDocker(digest string) (io.ReadCloser, error)
DownloadLayersFromLocalDocker : Download Layers From Local Docker
func DownloadSigningCert ¶
func DownloadSigningCertWithConfirmation ¶
DownloadSigningCertWithConfirmation ask for confirmation to download signing certs
func ExecCommand ¶
func ExpandPath ¶
func ExtractFiles ¶
func FileHasSameSha ¶
func FilterByFrags ¶
func FindWhiteoutsFromLayer ¶
FindWhiteoutsFromLayer : Find Whiteout Files From a Layer
func FixupRepoRef ¶
func FormatJson ¶
func FormatJsonC ¶
func GetDockerConfigFile ¶
func GetFileContentType ¶
GetFileContentType : Get File Content Type of a file
func GetFromConfigPvs ¶
func GetFromRootFs ¶
func GetPhAuthHeaderTokenKey ¶
func GetStatePatch ¶
func IsFileExists ¶
IsFileExists : Check if File Exists or not
func IsValidUrl ¶
IsValidUrl tests a string to determine if it is a well-structured url or not.
func LoadLocalImage ¶
LoadLocalImage : To check whether Image Exist In Local Docker Or Not
func LoginDevice ¶
LoginDevice : Login Device
func MergePatch ¶
func MergeSummary ¶
func MergeSummary(dest *JwsVerifySummary, merge ...JwsVerifySummary)
func OverwriteState ¶
func ParseRFC3339 ¶
ParseRFC3339 : Parse RFC3339 string : 2006-01-02T15:04:05+07:00
func PatchState ¶
func PatchState(srcBuff, patchBuff []byte, srcFrags, patchFrag string, merge bool, state *PvrMap) ([]byte, map[string]interface{}, error)
PatchState update a json with a patch
func PrintDebugf ¶
PrintDebugf forwards to Printfs if IsDebugEnabled
func PrintDebugln ¶
PrintDebugln forwards to Printfs if IsDebugEnabled
func ProcessWhiteouts ¶
ProcessWhiteouts : FInd Whiteouts from a layer and process it in a given extract path
func ReadArgsFile ¶
func ReadOrCreateFile ¶
ReadOrCreateFile read a file from file system if is not avaible creates the file
func RemoveDirContents ¶
func RenameFile ¶
func ReportError ¶
func SetTempFilesInterrupHandler ¶
func SetTempFilesInterrupHandler(tempdir string)
SetTempFilesInterrupHandler : Set Temp Files Interrup Handler
This function will capture Interrupt signals and delete all temp files
func ShowOrOpenRegisterLink ¶
ShowOrOpenRegisterLink show or open the user the registration link
func SliceContainsItem ¶
SliceContainsItem : checks if an item exists in a string array or not
func SortObjects ¶
func SprintTmpl ¶
func StructToMap ¶
func UpdateIfNecessary ¶
UpdateIfNecessary update pvr if is necesary but only check on time at the day
func ValidateSourceFlag ¶
ValidateSourceFlag : Validate Source Flag
func WriteConfiguration ¶
func WriteConfiguration(filePath string, config *PvrGlobalConfig) error
WriteConfiguration write ~/.pvr/config.json with new data
func WriteTxtFile ¶
Types ¶
type Account ¶
type Account struct { Email string `json:"email" bson:"email"` Nick string `json:"nick" bson:"nick"` Password string `json:"password,omitempty" bson:"password"` }
Account data model
type ApiError ¶
func LogPrettyJSON ¶
LogPrettyJSON : Pretty print Json content
type AppData ¶
type AppData struct { SquashFile string Appname string DockerURL string Username string Password string Appmanifest *Source TemplateArgs map[string]interface{} Config map[string]interface{} DestinationPath string LocalImage DockerImage RemoteImage DockerImage From string Source string Platform string ConfigFile string Volumes []string FormatOptions string SourceType string DoOverlay bool Base string ManifestType string ForceAdd bool }
AppData : To hold all required App Information
type AsyncBody ¶
type AsyncBody struct { Delegate io.ReadCloser // contains filtered or unexported fields }
type DmVerityJson ¶
type DockerImage ¶
type DockerImage struct { Exists bool DockerDigest string DockerConfig map[string]interface{} DockerManifest *Manifest DockerRegistry *registry.Registry ImagePath string DockerPlatform string }
DockerImage : return type of ImageExistsInLocalDocker()
type DockerManifest ¶
type DockerManifest map[string]interface{}
type DockerSource ¶
type DockerSource struct { DockerName string `json:"docker_name,omitempty"` DockerTag string `json:"docker_tag,omitempty"` DockerDigest string `json:"docker_digest,omitempty"` DockerOvlDigest string `json:"docker_ovl_digest,omitempty"` DockerSource string `json:"docker_source,omitempty"` DockerConfig map[string]interface{} `json:"docker_config,omitempty"` DockerPlatform string `json:"docker_platform,omitempty"` FormatOptions string `json:"format_options,omitempty"` }
type EncryptedAccountData ¶
type EncryptedAccountData struct { Token string `json:"token"` RedirectURI string `json:"redirect-uri"` }
EncryptedAccountData Encrypted account response
func GetEncryptedAccount ¶
func GetEncryptedAccount(authEp, email, username, password string) (*EncryptedAccountData, error)
GetEncryptedAccount encrypt account data in order to open the browser to finish the registration process
type GetAccesstokenMethod ¶
type GetAccesstokenMethod int8
const ( CachedAccessTokenMethod GetAccesstokenMethod = 1 RefreshTokenMethod GetAccesstokenMethod = 2 UserPassMethod GetAccesstokenMethod = 3 AnonTokenMethod GetAccesstokenMethod = 4 InteractiveMethod GetAccesstokenMethod = 5 )
type JwsVerifySummary ¶
type LogFormatter ¶
type LogFormatterJson ¶
type LogFormatterJson struct{}
func (*LogFormatterJson) Init ¶
func (s *LogFormatterJson) Init(format string) error
type LogFormatterTemplate ¶
type LogFormatterTemplate struct {
// contains filtered or unexported fields
}
func (*LogFormatterTemplate) Init ¶
func (s *LogFormatterTemplate) Init(template string) error
type Manifest ¶
type Manifest struct { manifest.Versioned // Config references the image configuration as a blob. Config distribution.Descriptor `json:"config"` // Layers lists descriptors for the layers referenced by the // configuration. Layers []distribution.Descriptor `json:"layers"` // Annotations contains arbitrary metadata for the image manifest. Annotations map[string]string `json:"annotations,omitempty"` }
type ObjectWithAccess ¶
type PVZeroConf ¶
type PVZeroConf struct { Hostname string AddrIPv4 []net.IP AddrIPv6 []net.IP Port int Pantahub string DeviceId string Challenge string }
func (PVZeroConf) ClaimCmd ¶
func (p PVZeroConf) ClaimCmd() string
func (PVZeroConf) String ¶
func (p PVZeroConf) String() string
type PantahubDevice ¶
type PantahubDevice struct { Id string `json:"deviceid"` Prn string `json:"device"` Nick string `json:"device-nick"` Revision int `json:"revision"` ProgressRevision int `json:"progress-revision"` RealIP string `json:"real-ip"` Timestamp time.Time `json:"timestamp"` StateSha string `json:"state-sha"` Status string `json:"status"` StatusMsg string `json:"status-msg"` }
type PantahubDevicesJoinToken ¶
type PantahubDevicesJoinToken struct { ID string `json:"id"` Prn string `json:"prn"` Nick string `json:"nick"` Owner string `json:"owner"` Token string `json:"token,omitempty"` TokenSha []byte `json:"token-sha,omitempty"` DefaultUserMeta map[string]interface{} `json:"default-user-meta"` Disabled bool `json:"disabled"` TimeCreated time.Time `json:"time-created"` TimeModified time.Time `json:"time-modified"` }
type Pvr ¶
type Pvr struct { Initialized bool Dir string Pvrdir string Pvdir string Objdir string Pvrconfig PvrConfig PristineJson []byte PristineJsonMap PvrMap NewFiles PvrIndex Session *Session }
func (*Pvr) AddApplication ¶
AddApplication : Add application from several types of sources
func (*Pvr) AuthConfig ¶
func (p *Pvr) AuthConfig(username, password, registry string) (types.AuthConfig, error)
func (*Pvr) CheckIfIsRunningAsRoot ¶
func (*Pvr) DeployPvLinks ¶
DeployPvLinks sets up the hardlinks for the .pv/ files
func (*Pvr) DmCVerityApply ¶
func (*Pvr) DmCVerityConvert ¶
func (*Pvr) DmCryptApply ¶
func (*Pvr) Export ¶
Export will put the 'json' file first into the archive to allow for stream parsing and validation of json before processing objects
func (*Pvr) FindDockerImage ¶
FindDockerImage : Find Docker Image
func (*Pvr) GenerateApplicationSquashFS ¶
func (*Pvr) GenerateApplicationTemplateFiles ¶
func (*Pvr) GetAppDockerDigest ¶
GetAppDockerDigest : Get App Docker Digest
func (*Pvr) GetAppDockerName ¶
GetAppDockerName : Get App Docker Name
func (*Pvr) GetApplicationInfo ¶
GetApplicationInfo : Get Application Info
func (*Pvr) GetApplicationManifest ¶
func (*Pvr) GetApplications ¶
ListApplications : List Applications
func (*Pvr) GetCPristineJson ¶
func (*Pvr) GetDefaultGroup ¶
func (*Pvr) GetDockerConfig ¶
func (*Pvr) GetDockerImageRepoDigest ¶
GetDockerImageRepoDigest : Get Docker Image Repo Digest
func (*Pvr) GetDockerManifest ¶
func (*Pvr) GetDockerRegistry ¶
func (*Pvr) GetRepoLocal ¶
func (*Pvr) GetRepoRemote ¶
func (*Pvr) GetSquashFSDigest ¶
func (*Pvr) GetStateJson ¶
func (*Pvr) GetTrackURL ¶
GetTrackURL : Get Track URL
func (*Pvr) GetWorkingGroupsJson ¶
func (*Pvr) GetWorkingJson ¶
create the canonical json for the working directory
func (*Pvr) GetWorkingJsonMap ¶
func (*Pvr) InstallApplication ¶
InstallApplication : Install Application from any type of source
func (*Pvr) JwsSign ¶
JwsSign will add or update a signature based using a private key provided.
The payload will be assembled from the prinstine system state JSON using the match rule provided in PvsMatch struct.
PvsOptions allow to pass additional JoseHeader options to include in the Signature.
func (*Pvr) JwsSignAuto ¶
func (p *Pvr) JwsSignAuto(keyPath string, part string, options *PvsOptions) error
func (*Pvr) JwsSignPvs ¶
func (p *Pvr) JwsSignPvs(privKeyPath string, pvsPath string, options *PvsOptions) error
JwsSignPvs will parse a pvs@s json provided as argument and use the included PvsMatch section to invoke JwsSign
func (*Pvr) JwsVerifyPvs ¶
func (p *Pvr) JwsVerifyPvs(keyPath string, caCerts string, pvsPath string, includePayload bool) (*JwsVerifySummary, error)
JwsVerify will add or update a signature based using a private key provided.
The payload will be assembled from the prinstine system state JSON using the match rule provided in PvsMatch struct included in the pvs.
special value for caCerts "_system_" hints at using the system cacert store. Can be configured using SSH_CERT_FILE and SSH_CERTS_DIR on linux
func (*Pvr) ListApplications ¶
ListApplications : List Applications
func (*Pvr) LoadRemoteImage ¶
LoadRemoteImage : To check whether Image Exist In Remote Docker Or Not
func (*Pvr) Post ¶
make a json post to a REST endpoint. You can provide metainfo etc. in post argument as json. postKey if set will be used as key that refers to the posted json. Example usage: json blog post, json revision repo with commit message etc
func (*Pvr) RemoteCopy ¶
func (p *Pvr) RemoteCopy(pvrSrc string, pvrDest string, merge bool, envelope string, commitMsg string, rev string, force bool) error
RemoteCopy will perform a remote only copy by taking the json, select elements that have the #fragement of a provided url as Prefix of their key and replace all elements in pvrDest that match that prefix. The target prefix can be overloaded through providing a #fragment in destination URL as well. It is an illegal input if pvrSrc has no fragement, but pvrDest has one. It is however legal input if pvrSrc has a fragement, but pvrDest does not have one. In that case the same fragement is implicitely appended to pvrDest
func (*Pvr) RemoveApplication ¶
RemoveApplication : Remove Application
func (*Pvr) ResetWithHardlink ¶
func (*Pvr) ResetWithState ¶
func (*Pvr) SaveConfig ¶
func (*Pvr) SetConfiguration ¶
func (pvr *Pvr) SetConfiguration(arguments []string) (*PvrGlobalConfig, error)
SetConfiguration read arguments and write new configuration, merging with the previous configuration on the file
func (*Pvr) SetSourceTypeFromManifest ¶
func (p *Pvr) SetSourceTypeFromManifest(app *AppData, options *models.GetSTOptions) error
func (*Pvr) UpdateApplication ¶
UpdateApplication : Update any application and any type
type PvrAuthConfig ¶
type PvrAuthConfig struct { Spec string `json:"spec"` Tokens map[string]PvrAuthTokens `json:"tokens"` User string `json:"-"` Password string `json:"-"` // contains filtered or unexported fields }
func LoadConfig ¶
func LoadConfig(filePath string) (*PvrAuthConfig, error)
func (*PvrAuthConfig) DoRefresh ¶
func (p *PvrAuthConfig) DoRefresh(authEp, token string) (string, string, error)
func (*PvrAuthConfig) Save ¶
func (p *PvrAuthConfig) Save() error
type PvrAuthTarget ¶
type PvrAuthTokens ¶
type PvrFileAddInfo ¶
type PvrGlobalConfig ¶
type PvrGlobalConfig struct { Spec string `json:"Spec"` AutoUpgrade bool `json:"AutoUpgrade"` DistributionTag string `json:"DistributionTag"` }
PvrGlobalConfig define all the posible general configuration for pvr
func LoadConfiguration ¶
func LoadConfiguration(filePath string) (*PvrGlobalConfig, error)
LoadConfiguration read configuration from ~/.pvr/config.json or return default configuration
type PvrIndex ¶
type PvrIndex map[string]PvrFileAddInfo
type PvrStatus ¶
type PvsCertPool ¶
type PvsCertPool struct {
// contains filtered or unexported fields
}
func NewPvsCertPool ¶
func NewPvsCertPool() *PvsCertPool
func (*PvsCertPool) AppendCertsFromPEM ¶
func (s *PvsCertPool) AppendCertsFromPEM(pemCerts []byte) (ok bool)
func (*PvsCertPool) GetCertsRaw ¶
func (s *PvsCertPool) GetCertsRaw() [][]byte
type PvsOptions ¶
type PvsPartSelection ¶
type RootFsSource ¶
type Session ¶
type Session struct { Configuration *PvrGlobalConfig // contains filtered or unexported fields }
func DefaultSession ¶
func DefaultSession() *Session
func (*Session) CreateDevice ¶
CreateDevice : Create Device
func (*Session) DoAuthCall ¶
func (*Session) DoLogsCursor ¶
func (*Session) GetAuthStatus ¶
GetAuthStatus : Get Auth Status, GET /auth/auth_status
func (*Session) GetConfigDir ¶
func (*Session) GetDevice ¶
func (s *Session) GetDevice(baseURL string, deviceNick string, ownerNick string, ) ( *resty.Response, error, )
GetDevice : Get Device
func (*Session) GetDevices ¶
func (s *Session) GetDevices(baseURL string, ownerNick string, deviceNick string, ) ( *resty.Response, error, )
GetDevices : Get Devices
func (*Session) GetUserProfiles ¶
GetUserProfiles : Get User Profiles
func (*Session) IsUserLoggedIn ¶
IsUserLoggedIn : To check if a user is logged in or not
func (*Session) SuggestDeviceNicks ¶
SuggestDeviceNicks : Suggest Device Nicks
func (*Session) SuggestNicks ¶
SuggestNicks : Suggest Nicks (Either user nicks or device nicks)
func (*Session) SuggestUserNicks ¶
SuggestUserNicks : Suggest User Nicks
func (*Session) TokenCreate ¶
func (p *Session) TokenCreate(baseurl string, usermeta map[string]interface{}) (*PantahubDevicesJoinToken, error)
func (*Session) TokenDisable ¶
func (p *Session) TokenDisable(baseurl string, id string) (*PantahubDevicesJoinToken, error)
func (*Session) TokenLs ¶
func (p *Session) TokenLs(baseurl string) ([]PantahubDevicesJoinToken, error)
type SignedParts ¶
type Source ¶
type Source struct { Base string `json:"base,omitempty"` Name string `json:"name,omitempty"` Spec string `json:"#spec"` Template string `json:"template,omitempty"` TemplateArgs map[string]interface{} `json:"args,omitempty"` DmEnabled map[string]bool `json:"dm_enabled,omitempty"` Logs []map[string]interface{} `json:"logs,omitempty"` Exports []string `json:"exports,omitempty"` Config map[string]interface{} `json:"config,omitempty"` DockerSource PvrSource RootFsSource Persistence map[string]string `json:"persistence,omitempty"` }