client

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHUNKSIZE                               = 100
	NVDFEEDGROUP                            = "nvdv2:cves"
	RegistryCredentialUpdateRequestTemplate = `{"registry": "%v", "registry_user": "%v", "registry_pass": "%v", "registry_verify": %v, "registry_type": "docker_v2"}` // #nosec G101
	AddImageURL                             = "/images"
	GetImageURLTemplate                     = "/images/%s"
	GetImageVulnerabilitiesURLTemplate      = "/images/%s/vuln/all"
	QueryVulnerabilitiesURLTemplate         = "/query/vulnerabilities"
	RegistriesCollectionURL                 = "/registries"
	RegistryCredentialUpdateURLTemplate     = "/registries/%s" // #nosec G101
	FeedsURL                                = "/system/feeds"
	VersionURL                              = "/version"
)

Variables

This section is empty.

Functions

func AddRegistryCredential

func AddRegistryCredential(
	clientConfiguration *Config,
	registryURL string,
	repository string,
	username string,
	password string,
	registryTLSVerify bool,
	validateCreds bool,
) (gorequest.Response, []byte, []error)

Add a new registry credential to anchore

func AnalyzeImage

func AnalyzeImage(clientConfiguration *Config, analyzeRequest anchore.ImageScanRequest) error

func ExtractRegistryFromURL added in v1.2.0

func ExtractRegistryFromURL(registryURL string) (string, error)

Process the registry URL to return only the hostname and port as docker pull strings support

func GetImage

func GetImage(clientConfiguration *Config, digest string, retryCount int) (anchore.Image, error)

func GetImageVulnerabilities

func GetImageVulnerabilities(
	clientConfiguration *Config,
	digest string,
	filterIgnored bool,
	retryCount int,
) (anchore.ImageVulnerabilityReport, error)

Retrieve the vulnerabilities

func GetVulnDBUpdateTime added in v1.2.0

func GetVulnDBUpdateTime(clientConfiguration *Config) (time.Time, error)

func GetVulnerabilityDescriptions

func GetVulnerabilityDescriptions(clientConfiguration *Config, vulns *[]anchore.NamespacedVulnerability) error

Updates the Description fields in the input array of Description objects

func QueryVulnerabilityRecords

func QueryVulnerabilityRecords(
	clientConfiguration *Config,
	ids []string,
	namespaces []string,
) (anchore.VulnerabilityQueryResults, []error)

Simple query that handles pagination and returns the results

func RegistryNameFromRepo

func RegistryNameFromRepo(registryURL string, repository string) (string, error)

Return the registry credential entry as anchore will use it. This is the registry url minus the scheme + / + repository name

func StringToTime

func StringToTime(timestampString string) (time.Time, error)

Get a time.Time version of a string

func UpdateRegistryCredential

func UpdateRegistryCredential(
	clientConfiguration *Config,
	registryURL string,
	repository string,
	username string,
	password string,
	registryTLSVerify bool,
	validateCreds bool,
) (gorequest.Response, []byte, []error)

Update an existing credential record

Types

type AnchoreVersion added in v1.2.0

type AnchoreVersion struct {
	API struct {
		Version string `json:"version"`
	} `json:"api"`
	DB struct {
		SchemaVersion string `json:"schema_version"`
	} `json:"db"`
	Service struct {
		Version string `json:"version"`
	} `json:"service"`
}

type Config added in v1.2.0

type Config struct {
	Endpoint       string
	Username       string
	Password       string
	TimeoutSeconds int
	TLSVerify      bool
}

Jump to

Keyboard shortcuts

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