cmd

package
v0.0.0-...-0ac5a20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Copyright © 2021 NAME HERE <EMAIL ADDRESS>

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.

Copyright © 2021 NAME HERE <EMAIL ADDRESS>

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.

Copyright © 2021 NAME HERE <EMAIL ADDRESS>

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

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func ExitErr

func ExitErr(errCode ErrorCode, err error)

Types

type Arch

type Arch string
const (
	Arm   Arch = "arm"
	Amd64 Arch = "amd64"
	Arm64 Arch = "arm64"
)

type ByLastPushedDesc

type ByLastPushedDesc []Image

func (ByLastPushedDesc) Len

func (i ByLastPushedDesc) Len() int

Len - implement sort.Interface for ByLastPushedDesc

func (ByLastPushedDesc) Less

func (i ByLastPushedDesc) Less(a int, b int) bool

Less - implement sort.Interface for ByLastPushedDesc

func (ByLastPushedDesc) Swap

func (i ByLastPushedDesc) Swap(a int, b int)

Swap - implement sort.Interface for ByLastPushedDesc

type Cake

type Cake struct {
	sync.Mutex
	Repo               string
	Tag                string
	Registry           string
	DockerClient       *dockerClient.Client
	PreviousDigest     string
	PreviousDigestTime time.Time
	LatestDigest       string
	LatestDigestTime   time.Time
	LastChecked        time.Time
	LastUpdated        time.Time
	ContainersRunning  map[string]int
	StopTimeout        time.Duration
}

func NewCake

func NewCake(repo string, tag string, registry string) *Cake

NewCake - creates a new Config struct

func (*Cake) GetLatestDigest

func (c *Cake) GetLatestDigest(arch Arch) *Cake

func (*Cake) IsLatestDigestPulled

func (c *Cake) IsLatestDigestPulled() bool

func (*Cake) IsLatestDigestRunning

func (c *Cake) IsLatestDigestRunning() bool

func (*Cake) PullLatestDigest

func (c *Cake) PullLatestDigest()

func (*Cake) Run

func (c *Cake) Run()

Run - run cake

func (*Cake) RunLatestDigest

func (c *Cake) RunLatestDigest()

func (*Cake) Stop

func (c *Cake) Stop()

Stop - stop this instance of cake and perform some clean up

func (*Cake) StopPreviousDigest

func (c *Cake) StopPreviousDigest()

type ErrorCode

type ErrorCode struct {
	// contains filtered or unexported fields
}
var ErrCakeNotFound ErrorCode = ErrorCode{
	// contains filtered or unexported fields
}

ErrCakeNotFound - thrown when a call to a cake instance is required but is not found

var ErrCreateContainer ErrorCode = ErrorCode{
	// contains filtered or unexported fields
}

ErrCreateContainer - thrown when creating container

var ErrGettingRepoTags ErrorCode = ErrorCode{
	// contains filtered or unexported fields
}

ErrGettingRepoTags - thrown when connection to repo is disrupted

var ErrJsonDecode ErrorCode = ErrorCode{
	// contains filtered or unexported fields
}

ErrJsonDecode - thrown when error decoding JSON

var ErrNoRegistry ErrorCode = ErrorCode{
	// contains filtered or unexported fields
}

ErrNoRegistry - an error used to specify if no registry is defined when running cake

var ErrReadingRepoTags ErrorCode = ErrorCode{
	// contains filtered or unexported fields
}

ErrReadingRepoTags - thrown when repo response could not be read

var ErrUnrecognisedSubcommands ErrorCode = ErrorCode{
	// contains filtered or unexported fields
}

ErrUnrecognisedSubcommands - an error to specify subcommands are uncregonised

type Image

type Image struct {
	Architecture string    `json:"architecture"`
	Features     string    `json:"features"`
	Variant      string    `json:"variant"`
	Digest       string    `json:"digest"`
	OS           string    `json:"os"`
	OSFeature    string    `json:"os_feature"`
	OSVersion    string    `json:"os_version"`
	Size         int       `json:"size"`
	Status       string    `json:"status"`
	LastPulled   time.Time `json:"last_pulled"`
	LastPushed   time.Time `json:"last_pushed"`
}

type ImageDetails

type ImageDetails struct {
	Creator             int       `json:"creator"`
	ID                  int       `json:"id"`
	ImageID             string    `json:"image_id"`
	Images              []Image   `json:"images"`
	LastUpdated         time.Time `json:"last_updated"`
	LastUpdater         int       `json:"last_updater"`
	LastUpdaterUsername string    `json:"last_updater_username"`
	Name                string    `json:"name"`
	Repository          int       `json:"repository"`
	FullSize            int       `json:"full_size"`
	V2                  bool      `json:"v2"`
	TagStatus           string    `json:"tag_status"`
	TagLastPulled       time.Time `json:"tag_last_pulled"`
	TagLastPushed       time.Time `json:"tag_last_pushed"`
}

type RepoList

type RepoList struct {
	Count    int            `json:"count"`
	Next     string         `json:"next"`
	Previous string         `json:"previous"`
	Results  []ImageDetails `json:"results"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL