imagespy

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2017 License: MIT Imports: 11 Imported by: 0

README

client-go

Usage

package main

import (
  "log"

  "github.com/imagespy/client-go"
)

func main() {
  client := imagespy.NewClientV1()
  spy, err := client.ImageSpy.Get("golang:1.9.1")
  if err != nil {
    log.Fatal(err)
  }

  log.Println(spy.Name)
  log.Println(spy.CurrentImage.Tag)
  log.Println(spy.LatestImage.Tag)
}

Documentation

Index

Constants

View Source
const (
	// DefaultAPIEndpoint is the default endpoint of the ImageSpy API.
	DefaultAPIEndpoint = "https://imagespy.hydrantosaurus.com"
)

Variables

View Source
var DefaultRegistryWhitelist = map[string]struct{}{
	"index.docker.io": struct{}{},
	"docker.io":       struct{}{},
	"quay.io":         struct{}{},
}

Functions

This section is empty.

Types

type ClientV1

type ClientV1 struct {
	ImageSpy *ImageSpyService
	Layer    *LayerService
	// contains filtered or unexported fields
}

ClientV1 is the client for the Image Spy API version 1.

func NewClientV1

func NewClientV1() *ClientV1

NewClientV1 returns a new client for the V1 HTTP API.

func (*ClientV1) WithBaseURL

func (c *ClientV1) WithBaseURL(baseURL string) *ClientV1

WithBaseURL sets the base URL of the ImageSpy API.

func (*ClientV1) WithHTTPClient

func (c *ClientV1) WithHTTPClient(hc *http.Client) *ClientV1

WithHTTPClient sets the http.Client.

func (*ClientV1) WithRegistryWhitelist

func (c *ClientV1) WithRegistryWhitelist(whitelist map[string]struct{}) *ClientV1

WithRegistryWhitelist allows specifying the registries to send requests to.

func (*ClientV1) WithTimeout

func (c *ClientV1) WithTimeout(s string) *ClientV1

WithTimeout sets the timeout of the underlying http.Client.

type Image

type Image struct {
	Created time.Time `json:"created"`
	Digest  string    `json:"digest"`
	Name    string    `json:"name"`
	Tag     string    `json:"tag"`
}

Image is a Docker image.

type ImageSpy

type ImageSpy struct {
	CurrentImage *Image `json:"current_image"`
	LatestImage  *Image `json:"latest_image"`
	Name         string `json:"name"`
}

ImageSpy is a ImageSpy.

type ImageSpyService

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

ImageSpyService handles interactions.

func (*ImageSpyService) Get

func (is *ImageSpyService) Get(name string) (*ImageSpy, error)

Get retrieves an ImageSpy. Creates the ImageSpy if it does not exist.

type Layer added in v0.2.0

type Layer struct {
	Digest       string   `json:"digest"`
	SourceImages []*Image `json:"source_images"`
}

Layer is the digest of a layer and a list of images which created the layer.

type LayerService added in v0.2.0

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

LayerService exposes the Layer API of the Image Spy API.

func (*LayerService) Get added in v0.2.0

func (ls *LayerService) Get(digest string) (*Layer, error)

Get retrieves a Layer.

type Logger

type Logger interface {
	Debug(args ...interface{})
}

Logger provides logging.

var Log Logger = &NullLogger{}

Log is used by this library to log messages.

type NullLogger

type NullLogger struct{}

NullLogger is noop.

func (*NullLogger) Debug

func (l *NullLogger) Debug(args ...interface{})

Debug implements Logger.

Jump to

Keyboard shortcuts

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