client

package
v0.0.0-...-3bb125c Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: Apache-2.0, MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegistryURLPath = "/api/v2.0/registries"
)

Variables

View Source
var (
	InsecureTransport http.RoundTripper = &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		DialContext: (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 30 * time.Second,
			DualStack: true,
		}).DialContext,
		TLSClientConfig: &tls.Config{
			InsecureSkipVerify: true,
		},
		MaxIdleConns:          100,
		IdleConnTimeout:       90 * time.Second,
		TLSHandshakeTimeout:   10 * time.Second,
		ExpectContinueTimeout: 1 * time.Second,
	}
)

Functions

func DownloadFile

func DownloadFile(url string, filepath string) error

func NewHarborClient

func NewHarborClient(options *root.GlobalOptions) *harborClient

func Test

func Test()

Types

type Chart

type Chart struct {
	// contains filtered or unexported fields
}

func NewChart

func NewChart(options *root.GlobalOptions) *Chart

func (*Chart) DownloadChart

func (ch *Chart) DownloadChart(name string, Dpath string)

func (Chart) GetImageTagsByImageName

func (h Chart) GetImageTagsByImageName(name string) map[string]string

scan use

func (*Chart) SearchChart

func (c *Chart) SearchChart(name string) error

func (*Chart) SearchTotalVersions

func (ch *Chart) SearchTotalVersions(res *models.Search) *models.Search

type ChartInfo

type ChartInfo struct {
	Name        string   `json:"name"`
	Home        string   `json:"home"`
	Sources     []string `json:"sources"`
	Version     string   `json:"version"`
	Description string   `json:"description"`
	Keywords    []string `json:"keywords"`
	Maintainers []struct {
		Name  string `json:"name"`
		Email string `json:"email"`
	} `json:"maintainers"`
	Icon        string `json:"icon"`
	APIVersion  string `json:"apiVersion"`
	AppVersion  string `json:"appVersion"`
	Annotations struct {
		ArtifacthubIoLinks    string `json:"artifacthub.io/links"`
		ArtifacthubIoOperator string `json:"artifacthub.io/operator"`
	} `json:"annotations"`
	KubeVersion  string `json:"kubeVersion"`
	Dependencies []struct {
		Name       string `json:"name"`
		Version    string `json:"version"`
		Repository string `json:"repository"`
		Condition  string `json:"condition"`
	} `json:"dependencies"`
	Type    string        `json:"type"`
	Urls    []string      `json:"urls"`
	Created time.Time     `json:"created"`
	Digest  string        `json:"digest"`
	Labels  []interface{} `json:"labels"`
}

type HarborChartInterface

type HarborChartInterface interface {
	Download()
}

type HarborClientInterface

type HarborClientInterface interface {
	HarborRegistryInterface
	HarborReplicationInterface
}

type HarborImageInterface

type HarborImageInterface interface {
	SearchProjects(name string) error
}

type HarborProjectInterface

type HarborProjectInterface interface {
	SearchProjects(name string) error
	SearchProjectsList(name string) error
	CreateProject(name string) error
	DeleteProject(name string) error
}

type HarborRegistryInterface

type HarborRegistryInterface interface {
	CreateRegistry() error
	CreateRegistryByConfigInfo(string) error
}

type HarborReplicationInterface

type HarborReplicationInterface interface {
}

type Image

type Image struct {
	// contains filtered or unexported fields
}

func NewImage

func NewImage(options *root.GlobalOptions) *Image

func (*Image) DownloadImage

func (i *Image) DownloadImage(name string, Dpath string)

func (Image) GetImageTagsByImageName

func (h Image) GetImageTagsByImageName(name string) map[string]string

scan use

func (*Image) SearchAll

func (i *Image) SearchAll(name string) error

type Project

type Project struct {
	// contains filtered or unexported fields
}

func NewProject

func NewProject(options *root.GlobalOptions) *Project

func (*Project) CreateProject

func (p *Project) CreateProject(name string) error

func (*Project) DeleteProject

func (p *Project) DeleteProject(name string) error

func (Project) GetImageTagsByImageName

func (h Project) GetImageTagsByImageName(name string) map[string]string

scan use

func (*Project) SearchProjects

func (p *Project) SearchProjects(name string) error

func (*Project) SearchProjectsList

func (p *Project) SearchProjectsList() error

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry(options *root.GlobalOptions) *Registry

func (*Registry) CreateRegistry

func (r *Registry) CreateRegistry() error

func (*Registry) CreateRegistryByConfigInfo

func (r *Registry) CreateRegistryByConfigInfo(name string, replaceName string) error

func (*Registry) DeleteRegistry

func (r *Registry) DeleteRegistry(id int64) error

func (Registry) GetImageTagsByImageName

func (h Registry) GetImageTagsByImageName(name string) map[string]string

scan use

func (*Registry) SearchRegistry

func (r *Registry) SearchRegistry(name string) error

func (*Registry) SearchRegistryByID

func (r *Registry) SearchRegistryByID(id string, isPrint bool) (*models.Registry, error)

func (*Registry) SearchRegistryList

func (r *Registry) SearchRegistryList() error

type RegistryInfo

type RegistryInfo struct {
	ID              int64  `json:"id"`
	Name            string `json:"name"`
	Description     string `json:"description"`
	Type            string `json:"type"`
	URL             string `json:"url"`
	TokenServiceURL string `json:"token_service_url"`
	Credential      struct {
		Type         string `json:"type"`
		AccessKey    string `json:"access_key"`
		AccessSecret string `json:"access_secret"`
	} `json:"credential"`
	Insecure     bool      `json:"insecure"`
	Status       string    `json:"status"`
	CreationTime time.Time `json:"creation_time"`
	UpdateTime   time.Time `json:"update_time"`
}

type RegistryInputParams

type RegistryInputParams struct {
	// contains filtered or unexported fields
}

type Replication

type Replication struct {
	// contains filtered or unexported fields
}

func NewReplication

func NewReplication(options *root.GlobalOptions) *Replication

func (*Replication) CreateReplication

func (r *Replication) CreateReplication(id string, isPull bool) error

func (*Replication) DeleteReplication

func (r *Replication) DeleteReplication(id int64) error

func (Replication) GetImageTagsByImageName

func (h Replication) GetImageTagsByImageName(name string) map[string]string

scan use

func (*Replication) GetReplicationInfo

func (r *Replication) GetReplicationInfo(id string) *models.ReplicationPolicy

func (*Replication) ModifyReplication

func (r *Replication) ModifyReplication(id string)

func (*Replication) SearchExecutionByID

func (r *Replication) SearchExecutionByID(id string)

func (*Replication) SearchReplication

func (r *Replication) SearchReplication(name string) error

func (*Replication) SearchReplicationByID

func (r *Replication) SearchReplicationByID(id string, isPrint bool) (*models.ReplicationPolicy, error)

func (*Replication) SearchReplicationList

func (r *Replication) SearchReplicationList() error

func (*Replication) SearchTasksByID

func (r *Replication) SearchTasksByID(id string, size string)

func (*Replication) StartExecution

func (r *Replication) StartExecution(id string)

根据replicationID 直接开始推送

func (*Replication) StartExecutionFromConfig

func (re *Replication) StartExecutionFromConfig(id string, path string)

type ReplicationInfo

type ReplicationInfo struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Creator     string `json:"creator"`
	SrcRegistry struct {
		ID              int    `json:"id"`
		Name            string `json:"name"`
		Description     string `json:"description"`
		Type            string `json:"type"`
		URL             string `json:"url"`
		TokenServiceURL string `json:"token_service_url"`
		Credential      struct {
			Type         string `json:"type"`
			AccessKey    string `json:"access_key"`
			AccessSecret string `json:"access_secret"`
		} `json:"credential"`
		Insecure     bool      `json:"insecure"`
		Status       string    `json:"status"`
		CreationTime time.Time `json:"creation_time"`
		UpdateTime   time.Time `json:"update_time"`
	} `json:"src_registry"`
	DestRegistry struct {
		ID              int    `json:"id"`
		Name            string `json:"name"`
		Description     string `json:"description"`
		Type            string `json:"type"`
		URL             string `json:"url"`
		TokenServiceURL string `json:"token_service_url"`
		Credential      struct {
			Type         string `json:"type"`
			AccessKey    string `json:"access_key"`
			AccessSecret string `json:"access_secret"`
		} `json:"credential"`
		Insecure     bool      `json:"insecure"`
		Status       string    `json:"status"`
		CreationTime time.Time `json:"creation_time"`
		UpdateTime   time.Time `json:"update_time"`
	} `json:"dest_registry"`
	DestNamespace string `json:"dest_namespace"`
	Filters       []struct {
		Type  interface{} `json:"type"`
		Value interface{} `json:"value"`
	} `json:"filters"`
	Trigger struct {
		Type            string `json:"type"`
		TriggerSettings struct {
			Cron string `json:"cron"`
		} `json:"trigger_settings"`
	} `json:"trigger"`
	Deletion     bool      `json:"deletion"`
	Override     bool      `json:"override"`
	Enabled      bool      `json:"enabled"`
	CreationTime time.Time `json:"creation_time"`
	UpdateTime   time.Time `json:"update_time"`
}

type ReplicationRules

type ReplicationRules struct {
	Name         string `json:"name"`
	Tag          string `json:"tag"`
	Resource     string `json:"resource"`
	DstNamespace string `json:"dst_namespace"`
}

type ScanImage

type ScanImage struct {
	FilePathAndImagesName map[string][]*scan.Image `json:"file_path_and_images_name"`
	FilePathAndImages     map[string][]*scan.Image `json:"file_path_and_images"`
	WithFile              bool
	WithCompare           bool
	WithCompareOnlyFalse  bool
	// contains filtered or unexported fields
}

func NewScanImage

func NewScanImage(options *root.GlobalOptions, withFile, withCompare, withCompareOnlyFalse bool, path, release string) *ScanImage

func (*ScanImage) FilterHarborImageTagContains

func (s *ScanImage) FilterHarborImageTagContains(image *scan.Image, harborImage map[string]string) (ok bool, imageName string, imageTag string)

func (*ScanImage) FilterHarborImageTagEqual

func (s *ScanImage) FilterHarborImageTagEqual(image *scan.Image, harborImage map[string]string) (ok bool, imageName string, imageTag string)

func (*ScanImage) FilterHarborImageTagNoContains

func (s *ScanImage) FilterHarborImageTagNoContains(image *scan.Image, harborImage map[string]string) (ok bool, imageName string, imageTag string)

func (*ScanImage) FilterHarborImageTagNoEqual

func (s *ScanImage) FilterHarborImageTagNoEqual(image *scan.Image, harborImage map[string]string) (ok bool, imageName string, imageTag string)

func (ScanImage) GetImageTagsByImageName

func (h ScanImage) GetImageTagsByImageName(name string) map[string]string

scan use

func (*ScanImage) PrintCompare

func (s *ScanImage) PrintCompare() *ScanImage

func (*ScanImage) PrintDiff

func (s *ScanImage) PrintDiff() *ScanImage

func (*ScanImage) PrintFile

func (s *ScanImage) PrintFile()

func (*ScanImage) ReadDataFromFile

func (s *ScanImage) ReadDataFromFile(path string) []byte

func (*ScanImage) WithImagesFromHarbor

func (s *ScanImage) WithImagesFromHarbor()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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