githubhttpcache

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DateFormat defines format for LastModifiedDate & PublishDate
	DateFormat = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

func NewGHC

func NewGHC(hostName string, rateLimit RateLimitSource, repositories Repositories, git Git, client httpclient.Client, os osshim.Os, acceptedHosts []string, localMappings map[string]string, options manifest.ParsingOptions) repositoryhosts.RepositoryHost

NewGHC creates new GHC resource handler

Types

type GHC

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

GHC implements repositoryhosts.RepositoryHost interface using GitHub manifestadapter with transport level persistent cache.

func (*GHC) Accept

func (p *GHC) Accept(uri string) bool

Accept implements the repositoryhosts.RepositoryHost#Accept

func (*GHC) FileTreeFromURL

func (p *GHC) FileTreeFromURL(URL string) ([]string, error)

FileTreeFromURL implements manifest.FileSource#FileTreeFromURL

func (*GHC) GetClient

func (p *GHC) GetClient() httpclient.Client

GetClient implements the repositoryhosts.RepositoryHost#GetClient

func (*GHC) GetRateLimit

func (p *GHC) GetRateLimit(ctx context.Context) (int, int, time.Time, error)

GetRateLimit implements the repositoryhosts.RepositoryHost#GetRateLimit

func (p *GHC) GetRawFormatLink(absLink string) (string, error)

GetRawFormatLink implements the repositoryhosts.RepositoryHost#GetRawFormatLink

func (*GHC) ManifestFromURL

func (p *GHC) ManifestFromURL(url string) (string, error)

ManifestFromURL implements manifest.FileSource#ManifestFromURL

func (*GHC) Name

func (p *GHC) Name() string

Name returns host name

func (*GHC) Read

func (p *GHC) Read(ctx context.Context, uri string) ([]byte, error)

Read implements the repositoryhosts.RepositoryHost#Read

func (*GHC) ReadGitInfo

func (p *GHC) ReadGitInfo(ctx context.Context, uri string) ([]byte, error)

ReadGitInfo implements the repositoryhosts.RepositoryHost#ReadGitInfo

func (p *GHC) ToAbsLink(source, link string) (string, error)

ToAbsLink implements manifest.FileSource#ToAbsLink

type Git

type Git interface {
	GetBlobRaw(ctx context.Context, owner, repo, sha string) ([]byte, *github.Response, error)
	GetTree(ctx context.Context, owner string, repo string, sha string, recursive bool) (*github.Tree, *github.Response, error)
}

Git is an interface needed for faking

type GitInfo

type GitInfo struct {
	LastModifiedDate *string        `json:"lastmod,omitempty"`
	PublishDate      *string        `json:"publishdate,omitempty"`
	Author           *github.User   `json:"author,omitempty"`
	Contributors     []*github.User `json:"contributors,omitempty"`
	WebURL           *string        `json:"weburl,omitempty"`
	SHA              *string        `json:"sha,omitempty"`
	SHAAlias         *string        `json:"shaalias,omitempty"`
	Path             *string        `json:"path,omitempty"`
}

GitInfo defines git resource attributes

type RateLimitSource

type RateLimitSource interface {
	RateLimits(ctx context.Context) (*github.RateLimits, *github.Response, error)
}

RateLimitSource is an interface needed for faking

type Repositories

type Repositories interface {
	ListCommits(ctx context.Context, owner, repo string, opts *github.CommitsListOptions) ([]*github.RepositoryCommit, *github.Response, error)
	GetContents(ctx context.Context, owner, repo, path string, opts *github.RepositoryContentGetOptions) (fileContent *github.RepositoryContent, directoryContent []*github.RepositoryContent, resp *github.Response, err error)
	Get(ctx context.Context, owner, repo string) (*github.Repository, *github.Response, error)
}

Repositories is an interface needed for faking

Directories

Path Synopsis
SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and Gardener contributors
SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and Gardener contributors

Jump to

Keyboard shortcuts

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