publicecr

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: MIT Imports: 5 Imported by: 0

README

go-publicecr

go-publicecr is a module for listing ECR image tags on a public ECR repository.

Why go-publicecr

The official Go SDK does not support interacting with ECR repositories that you do not own. This module allows you to list image tags on any repository, whether you own it or otherwise.

Issue Tracking

Please use GitHub Issues to raise any issues. I can't promise I'll be able to support everything as this project is largely driven by my own needs. See Contributing if you'd like to contibute to a new feature/bug fix.

Contributing

Contributions are welcome! Please raise a PR and include any relevant ticket references.

Documentation

Overview

Package publicecr allows clients to interact with public ECR repositories in the absense of a complete SDK provided by AWS.

Create a new ECRReader using New() and supply any functional options as required.

Example
r := publicecr.New()
images, err := r.ListTags(context.TODO(), "appmesh", "aws-appmesh-envoy")
if err != nil {
	log.Fatal(err)
}

// Print all the image names
for _, image := range images {
	log.Println(image.Name)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var DefaultECRReaderOpts = &ECRReaderOpts{
	baseURL: defaultBaseURL,
	logger:  nil,
}

DefaultECRReaderOpts is the default options for an ECRReader

Functions

func WithBaseURL

func WithBaseURL(url string) func(*ECRReaderOpts)

WithBaseURL returns a functional optional for setting the ECR base URL

func WithDebugLogger

func WithDebugLogger(logger Logger) func(*ECRReaderOpts)

WithDebugLogging returns a functional optional for enabling debug logging

Types

type ECRReader

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

func New

func New(optFns ...func(*ECRReaderOpts)) *ECRReader

func (*ECRReader) ListTags

func (r *ECRReader) ListTags(ctx context.Context, repoOwner, repoName string) ([]*Image, error)

ListTags returns a slice of tags for a public ECR repo given by repoOwner and repoName

type ECRReaderOpts

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

ECRReaderOpts is an option set that can be provided to an ECRReader

type Image

type Image struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type Logger

type Logger interface {
	Print(v ...interface{})
	Printf(format string, v ...interface{})
}

Jump to

Keyboard shortcuts

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