component

package
v0.93.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ReleaseSourceTypeBOSHIO      = cargo.BOSHReleaseTarballSourceTypeBOSHIO
	ReleaseSourceTypeS3          = cargo.BOSHReleaseTarballSourceTypeS3
	ReleaseSourceTypeGithub      = cargo.BOSHReleaseTarballSourceTypeGithub
	ReleaseSourceTypeArtifactory = cargo.BOSHReleaseTarballSourceTypeArtifactory
)

TODO: use the constants from "cargo" everywhere

View Source
const ErrNotFound stringError = "not found"

Variables

This section is empty.

Functions

func CalculateSum

func CalculateSum(releasePath string, fs billy.Filesystem) (string, error)

func IsErrNotFound

func IsErrNotFound(err error) bool

func ReadReleaseManifest added in v0.71.0

func ReadReleaseManifest(releaseTarball io.Reader) ([]byte, error)

ReadReleaseManifest reads from the tarball and parses out the manifest

Types

type ArtifactoryFileInfo

type ArtifactoryFileInfo struct {
	Checksums struct {
		SHA1 string `json:"sha1"`
	} `json:"checksums"`
}

type ArtifactoryFileMetadata

type ArtifactoryFileMetadata struct {
	Checksums struct {
		Sha1   string `json:"sha1"`
		Sha256 string `json:"sha256"`
		MD5    string `json:"md5"`
	} `json:"checksums"`
}

type ArtifactoryFolderInfo

type ArtifactoryFolderInfo struct {
	Children []struct {
		URI    string `json:"uri"`
		Folder bool   `json:"folder"`
	} `json:"children"`
}

type ArtifactoryReleaseSource

type ArtifactoryReleaseSource struct {
	cargo.ReleaseSourceConfig
	Client *http.Client

	ID string
	// contains filtered or unexported fields
}

func NewArtifactoryReleaseSource

func NewArtifactoryReleaseSource(c cargo.ReleaseSourceConfig) *ArtifactoryReleaseSource

NewArtifactoryReleaseSource will provision a new ArtifactoryReleaseSource Project from the Kilnfile (ReleaseSourceConfig). If type is incorrect it will PANIC

func (*ArtifactoryReleaseSource) Configuration

func (ars *ArtifactoryReleaseSource) Configuration() cargo.ReleaseSourceConfig

func (*ArtifactoryReleaseSource) DownloadRelease

func (ars *ArtifactoryReleaseSource) DownloadRelease(releaseDir string, remoteRelease cargo.BOSHReleaseTarballLock) (Local, error)

func (*ArtifactoryReleaseSource) FindReleaseVersion

FindReleaseVersion may use any of the fields on Requirement to return the best matching release.

func (*ArtifactoryReleaseSource) GetMatchedRelease

GetMatchedRelease uses the Name and Version and if supported StemcellOS and StemcellVersion fields on Requirement to download a specific release.

func (*ArtifactoryReleaseSource) RemotePath

func (*ArtifactoryReleaseSource) UploadRelease

type BOSHIOReleaseSource

type BOSHIOReleaseSource struct {
	cargo.ReleaseSourceConfig
	// contains filtered or unexported fields
}

func NewBOSHIOReleaseSource

func NewBOSHIOReleaseSource(c cargo.ReleaseSourceConfig, customServerURI string, logger *log.Logger) *BOSHIOReleaseSource

func (BOSHIOReleaseSource) Configuration

func (src BOSHIOReleaseSource) Configuration() cargo.ReleaseSourceConfig

func (BOSHIOReleaseSource) DownloadRelease

func (src BOSHIOReleaseSource) DownloadRelease(releaseDir string, remoteRelease cargo.BOSHReleaseTarballLock) (Local, error)

func (BOSHIOReleaseSource) FindReleaseVersion

func (BOSHIOReleaseSource) GetMatchedRelease

func (BOSHIOReleaseSource) ID

func (src BOSHIOReleaseSource) ID() string

func (BOSHIOReleaseSource) Publishable

func (src BOSHIOReleaseSource) Publishable() bool

type ErrorUnexpectedStatus

type ErrorUnexpectedStatus struct {
	Want, Got int
}

func (ErrorUnexpectedStatus) Error

func (err ErrorUnexpectedStatus) Error() string

type Exported

type Exported struct {
	Lock        cargo.BOSHReleaseTarballLock
	TarballPath string
	BlobstoreID string
}

type GithubReleaseSource

func NewGithubReleaseSource

func NewGithubReleaseSource(c cargo.ReleaseSourceConfig) *GithubReleaseSource

NewGithubReleaseSource will provision a new GithubReleaseSource Project from the Kilnfile (ReleaseSourceConfig). If type is incorrect it will PANIC

func (*GithubReleaseSource) Configuration

func (grs *GithubReleaseSource) Configuration() cargo.ReleaseSourceConfig

Configuration returns the configuration of the ReleaseSource that came from the kilnfile. It should not be modified.

func (*GithubReleaseSource) DownloadRelease

func (grs *GithubReleaseSource) DownloadRelease(releaseDir string, remoteRelease cargo.BOSHReleaseTarballLock) (Local, error)

DownloadRelease downloads the release and writes the resulting file to the releasesDir. It should also calculate and set the SHA1 field on the Local result; it does not need to ensure the sums match, the caller must verify this.

func (*GithubReleaseSource) FindReleaseVersion

FindReleaseVersion may use any of the fields on Requirement to return the best matching release.

func (*GithubReleaseSource) GetGithubReleaseWithTag added in v0.76.0

func (*GithubReleaseSource) GetLatestMatchingRelease added in v0.76.0

func (*GithubReleaseSource) GetMatchedRelease

GetMatchedRelease uses the Name and Version and if supported StemcellOS and StemcellVersion fields on Requirement to download a specific release.

type Local

type Local struct {
	Lock      cargo.BOSHReleaseTarballLock
	LocalPath string
}

type LocalReleaseDirectory

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

func NewLocalReleaseDirectory

func NewLocalReleaseDirectory(logger *log.Logger) LocalReleaseDirectory

func (LocalReleaseDirectory) DeleteExtraReleases

func (l LocalReleaseDirectory) DeleteExtraReleases(extraReleaseSet []Local, noConfirm bool) error

func (LocalReleaseDirectory) GetLocalReleases

func (l LocalReleaseDirectory) GetLocalReleases(releasesDir string) ([]Local, error)

type MultiReleaseSource

type MultiReleaseSource interface {
	GetMatchedRelease(cargo.BOSHReleaseTarballSpecification) (cargo.BOSHReleaseTarballLock, error)
	FindReleaseVersion(spec cargo.BOSHReleaseTarballSpecification, noDownload bool) (cargo.BOSHReleaseTarballLock, error)
	DownloadRelease(releasesDir string, remoteRelease cargo.BOSHReleaseTarballLock) (Local, error)

	FindByID(string) (ReleaseSource, error)

	// SetDownloadThreads allows configuring the concurrency for the s3 release source.
	SetDownloadThreads(n int)
}

MultiReleaseSource wraps a set of release sources. It is mostly used to generate fakes for testing commands. See ReleaseSourceList for the concrete implementation.

type ReleaseAssetDownloader

type ReleaseAssetDownloader interface {
	DownloadReleaseAsset(ctx context.Context, owner, repo string, id int64, followRedirectsClient *http.Client) (rc io.ReadCloser, redirectURL string, err error)
}

type ReleaseByTagGetter

type ReleaseByTagGetter interface {
	GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*github.RepositoryRelease, *github.Response, error)
}

type ReleaseByTagGetterAssetDownloader added in v0.76.0

type ReleaseByTagGetterAssetDownloader interface {
	ReleaseByTagGetter
	ReleaseAssetDownloader
}

type ReleaseSource

type ReleaseSource interface {
	// Configuration returns the configuration of the ReleaseSource that came from the kilnfile.
	// It should not be modified.
	Configuration() cargo.ReleaseSourceConfig

	// GetMatchedRelease uses the Name and Version and if supported StemcellOS and StemcellVersion
	// fields on Requirement to download a specific release.
	GetMatchedRelease(cargo.BOSHReleaseTarballSpecification) (cargo.BOSHReleaseTarballLock, error)

	// FindReleaseVersion may use any of the fields on Requirement to return the best matching
	// release.
	FindReleaseVersion(spec cargo.BOSHReleaseTarballSpecification, noDownload bool) (cargo.BOSHReleaseTarballLock, error)

	// DownloadRelease downloads the release and writes the resulting file to the releasesDir.
	// It should also calculate and set the SHA1 field on the Local result; it does not need
	// to ensure the sums match, the caller must verify this.
	DownloadRelease(releasesDir string, remoteRelease cargo.BOSHReleaseTarballLock) (Local, error)
}

ReleaseSource represents a source where a tile component BOSH releases may come from. The releases may be compiled or just built bosh releases.

func ReleaseSourceFactory

func ReleaseSourceFactory(releaseConfig cargo.ReleaseSourceConfig, outLogger *log.Logger) ReleaseSource

ReleaseSourceFactory returns a configured ReleaseSource based on the Type field on the cargo.ReleaseSourceConfig structure.

type ReleaseSourceList

type ReleaseSourceList []ReleaseSource

func NewMultiReleaseSource

func NewMultiReleaseSource(sources ...ReleaseSource) ReleaseSourceList

func NewReleaseSourceRepo

func NewReleaseSourceRepo(kilnfile cargo.Kilnfile, logger *log.Logger) ReleaseSourceList

func (ReleaseSourceList) DownloadRelease

func (list ReleaseSourceList) DownloadRelease(releaseDir string, remoteRelease cargo.BOSHReleaseTarballLock) (Local, error)

func (ReleaseSourceList) Filter

func (list ReleaseSourceList) Filter(allowOnlyPublishable bool) ReleaseSourceList

func (ReleaseSourceList) FindByID

func (list ReleaseSourceList) FindByID(id string) (ReleaseSource, error)

func (ReleaseSourceList) FindReleaseUploader

func (list ReleaseSourceList) FindReleaseUploader(sourceID string) (ReleaseUploader, error)

func (ReleaseSourceList) FindReleaseVersion

func (list ReleaseSourceList) FindReleaseVersion(requirement cargo.BOSHReleaseTarballSpecification, noDownload bool) (cargo.BOSHReleaseTarballLock, error)

func (ReleaseSourceList) FindRemotePather

func (list ReleaseSourceList) FindRemotePather(sourceID string) (RemotePather, error)

func (ReleaseSourceList) GetMatchedRelease

func (ReleaseSourceList) SetDownloadThreads

func (list ReleaseSourceList) SetDownloadThreads(n int)

type ReleaseUploader

type ReleaseUploader interface {
	GetMatchedRelease(cargo.BOSHReleaseTarballSpecification) (cargo.BOSHReleaseTarballLock, error)
	UploadRelease(spec cargo.BOSHReleaseTarballSpecification, file io.Reader) (cargo.BOSHReleaseTarballLock, error)
}

ReleaseUploader represents a place to put releases. Some implementations of ReleaseSource should implement this interface. Credentials for this should come from an interpolated cargo.ReleaseSourceConfig.

type ReleasesLister

type ReleasesLister interface {
	ListReleases(ctx context.Context, owner, repo string, opts *github.ListOptions) ([]*github.RepositoryRelease, *github.Response, error)
}

type RemotePather

type RemotePather interface {
	RemotePath(cargo.BOSHReleaseTarballSpecification) (string, error)
}

RemotePather is used to get the remote path for a remote release. For example the complete s3 uri.

This interface may be ripe for removal.

type ResponseStatusCodeError

type ResponseStatusCodeError http.Response

func (ResponseStatusCodeError) Error

func (err ResponseStatusCodeError) Error() string

type S3Client

type S3Client interface {
	HeadObject(input *s3.HeadObjectInput) (*s3.HeadObjectOutput, error)
	ListObjectsV2(input *s3.ListObjectsV2Input) (*s3.ListObjectsV2Output, error)
}

type S3Downloader

type S3Downloader interface {
	Download(w io.WriterAt, input *s3.GetObjectInput, options ...func(*s3manager.Downloader)) (n int64, err error)
}

type S3ReleaseSource

type S3ReleaseSource struct {
	cargo.ReleaseSourceConfig

	DownloadThreads int
	// contains filtered or unexported fields
}

func NewS3ReleaseSource

func NewS3ReleaseSource(c cargo.ReleaseSourceConfig, client S3Client, downloader S3Downloader, uploader S3Uploader, logger *log.Logger) S3ReleaseSource

func NewS3ReleaseSourceFromConfig

func NewS3ReleaseSourceFromConfig(config cargo.ReleaseSourceConfig, logger *log.Logger) S3ReleaseSource

func (S3ReleaseSource) Configuration

func (src S3ReleaseSource) Configuration() cargo.ReleaseSourceConfig

func (S3ReleaseSource) DownloadRelease

func (src S3ReleaseSource) DownloadRelease(releaseDir string, lock cargo.BOSHReleaseTarballLock) (Local, error)

func (S3ReleaseSource) FindReleaseVersion

func (src S3ReleaseSource) FindReleaseVersion(spec cargo.BOSHReleaseTarballSpecification, noDownload bool) (cargo.BOSHReleaseTarballLock, error)

func (S3ReleaseSource) GetMatchedRelease

func (S3ReleaseSource) ID

func (src S3ReleaseSource) ID() string

func (S3ReleaseSource) Publishable

func (src S3ReleaseSource) Publishable() bool

func (S3ReleaseSource) RemotePath

func (S3ReleaseSource) UploadRelease

type S3Uploader

type S3Uploader interface {
	Upload(input *s3manager.UploadInput, options ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error)
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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