clairclient

package
v0.0.0-...-d1992f0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeJSONBody

func DecodeJSONBody(resp *http.Response, out interface{}) error

DecodeJSONBody decodes the body from a response into the provided interface

func ErrorStatusCode

func ErrorStatusCode(err error) int

ErrorStatusCode func init

func IsStatusCodeError

func IsStatusCodeError(err error) bool

IsStatusCodeError func init

Types

type Client

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

Client struct

func NewClient

func NewClient(c *Config) (*Client, error)

NewClient Sets up a new Clair client

func (*Client) DeleteFixes

func (c *Client) DeleteFixes(nspace, vuln, feat string) error

DeleteFixes func init

func (*Client) DeleteLayers

func (c *Client) DeleteLayers(name string) error

DeleteLayers func init

func (*Client) DeleteNotifications

func (c *Client) DeleteNotifications(name string) error

DeleteNotifications func init

func (*Client) DeleteVulnerbaility

func (c *Client) DeleteVulnerbaility(nspace, vuln string) error

DeleteVulnerbaility func init

func (*Client) GetFixes

func (c *Client) GetFixes(nspace, vuln string) (*FeatureEnvelope, error)

GetFixes func init

func (*Client) GetLayers

func (c *Client) GetLayers(name string, withFeatures, withVulnerabilities bool) (*LayerEnvelope, error)

GetLayers func init

func (*Client) GetNamespaces

func (c *Client) GetNamespaces() (*NamespaceEnvelope, error)

GetNamespaces func init

func (*Client) GetNotifications

func (c *Client) GetNotifications(name, page string, limit int) (*NotificationEnvelope, error)

GetNotifications func init

func (*Client) GetVulnerabilities

func (c *Client) GetVulnerabilities(nspace string) (*VulnerabilityEnvelope, error)

GetVulnerabilities init

func (*Client) GetVulnerability

func (c *Client) GetVulnerability(nspace, vuln string) (*VulnerabilityEnvelope, error)

GetVulnerability init

func (*Client) PostLayers

func (c *Client) PostLayers(layer *Layer) (*LayerEnvelope, error)

PostLayers func init

func (*Client) PostVulnerabilities

func (c *Client) PostVulnerabilities(vuln *Vulnerability) (*VulnerabilityEnvelope, error)

PostVulnerabilities init

func (*Client) PutFixes

func (c *Client) PutFixes(vuln string, feat *Feature) (*FeatureEnvelope, error)

PutFixes func init

func (*Client) PutVulnerbaility

func (c *Client) PutVulnerbaility(vuln *Vulnerability) (*VulnerabilityEnvelope, error)

PutVulnerbaility init

func (*Client) Request

func (c *Client) Request(r *Request) (*http.Response, error)

Request builds the standard request to Clair

type Config

type Config struct {
	Address    string
	HTTPClient *http.Client
}

Config for Clair Client

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig will return a client configuration with default values

func (*Config) ConfigureTLS

func (c *Config) ConfigureTLS(tc *TLSConfig) error

ConfigureTLS will apply the provided tlsconfig to the config

type Error

type Error struct {
	Message string `json:"Message,omitempty"`
}

Error struct init

type Feature

type Feature struct {
	Name            string          `json:"Name,omitempty"`
	NamespaceName   string          `json:"NamespaceName,omitempty"`
	VersionFormat   string          `json:"VersionFormat,omitempty"`
	Version         string          `json:"Version,omitempty"`
	Vulnerabilities []Vulnerability `json:"Vulnerabilities,omitempty"`
	AddedBy         string          `json:"AddedBy,omitempty"`
}

Feature struct init

type FeatureEnvelope

type FeatureEnvelope struct {
	Feature  *Feature   `json:"Feature,omitempty"`
	Features *[]Feature `json:"Features,omitempty"`
	Error    *Error     `json:"Error,omitempty"`
}

FeatureEnvelope struct init

type Layer

type Layer struct {
	Name             string            `json:"Name,omitempty"`
	NamespaceName    string            `json:"NamespaceName,omitempty"`
	Path             string            `json:"Path,omitempty"`
	Headers          map[string]string `json:"Headers,omitempty"`
	ParentName       string            `json:"ParentName,omitempty"`
	Format           string            `json:"Format,omitempty"`
	IndexedByVersion int               `json:"IndexedByVersion,omitempty"`
	Features         []Feature         `json:"Features,omitempty"`
}

Layer struct init

type LayerEnvelope

type LayerEnvelope struct {
	Layer *Layer `json:"Layer,omitempty"`
	Error *Error `json:"Error,omitempty"`
}

LayerEnvelope struct init

type Namespace

type Namespace struct {
	Name          string `json:"Name,omitempty"`
	VersionFormat string `json:"VersionFormat,omitempty"`
}

Namespace struct init

type NamespaceEnvelope

type NamespaceEnvelope struct {
	Namespaces *[]Namespace `json:"Namespaces,omitempty"`
	Error      *Error       `json:"Error,omitempty"`
}

NamespaceEnvelope struct init

type Notification

type Notification struct {
	Name     string                   `json:"Name,omitempty"`
	Created  string                   `json:"Created,omitempty"`
	Notified string                   `json:"Notified,omitempty"`
	Deleted  string                   `json:"Deleted,omitempty"`
	Limit    int                      `json:"Limit,omitempty"`
	Page     string                   `json:"Page,omitempty"`
	NextPage string                   `json:"NextPage,omitempty"`
	Old      *VulnerabilityWithLayers `json:"Old,omitempty"`
	New      *VulnerabilityWithLayers `json:"New,omitempty"`
}

Notification struct init

type NotificationEnvelope

type NotificationEnvelope struct {
	Notification *Notification `json:"Notification,omitempty"`
	Error        *Error        `json:"Error,omitempty"`
}

NotificationEnvelope struct init

type OrderedLayerName

type OrderedLayerName struct {
	Index     int    `json:"Index"`
	LayerName string `json:"LayerName"`
}

OrderedLayerName struct init

type Request

type Request struct {
	Method   string
	URL      *url.URL
	Params   url.Values
	Body     io.Reader
	BodySize int64
}

Request struct init

func (*Request) HTTPReq

func (r *Request) HTTPReq() (*http.Request, error)

HTTPReq func init

func (*Request) JSONBody

func (r *Request) JSONBody(val interface{}) error

JSONBody sets the request's body to the json encoded value

func (*Request) RawBody

func (r *Request) RawBody(raw []byte) error

RawBody func init

type TLSConfig

type TLSConfig struct {
	CaCert   string
	Insecure bool
}

TLSConfig for Clair Client

type Vulnerability

type Vulnerability struct {
	Name          string                 `json:"Name,omitempty"`
	NamespaceName string                 `json:"NamespaceName,omitempty"`
	Description   string                 `json:"Description,omitempty"`
	Link          string                 `json:"Link,omitempty"`
	Severity      string                 `json:"Severity,omitempty"`
	Metadata      map[string]interface{} `json:"Metadata,omitempty"`
	FixedBy       string                 `json:"FixedBy,omitempty"`
	FixedIn       []Feature              `json:"FixedIn,omitempty"`
}

Vulnerability struct init

type VulnerabilityEnvelope

type VulnerabilityEnvelope struct {
	Vulnerability   *Vulnerability   `json:"Vulnerability,omitempty"`
	Vulnerabilities *[]Vulnerability `json:"Vulnerabilities,omitempty"`
	NextPage        string           `json:"NextPage,omitempty"`
	Error           *Error           `json:"Error,omitempty"`
}

VulnerabilityEnvelope struct init

type VulnerabilityWithLayers

type VulnerabilityWithLayers struct {
	Vulnerability *Vulnerability `json:"Vulnerability,omitempty"`

	// This field is guaranteed to be in order only for pagination.
	// Indices from different notifications may not be comparable.
	OrderedLayersIntroducingVulnerability []OrderedLayerName `json:"OrderedLayersIntroducingVulnerability,omitempty"`

	// This field is deprecated.
	LayersIntroducingVulnerability []string `json:"LayersIntroducingVulnerability,omitempty"`
}

VulnerabilityWithLayers struct init

Jump to

Keyboard shortcuts

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