release

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Latest added in v0.5.0

func Latest(ctx context.Context, r Release) (string, error)

Latest returns the latest release. Note that GetLatestRelease API in GitHub and GitLab returns the most recent release, which doesn't means the latest stable release. I'm not sure it also affects Terraform Registry but I think we should use the same strategy for consistency. So we sort versions in semver order and find the latest non pre-release.

func List added in v0.5.0

func List(ctx context.Context, r Release, maxLength int, preRelease bool) ([]string, error)

List returns a list of releases in semver order. If preRelease is set to false, the result doesn't contain pre-releases.

Types

type GitHubAPI added in v0.3.1

type GitHubAPI interface {
	// RepositoriesListReleases lists the releases for a repository.
	// GitHub API docs: https://developer.github.com/v3/repos/releases/#list-releases-for-a-repository
	RepositoriesListReleases(ctx context.Context, owner, repo string, opt *github.ListOptions) ([]*github.RepositoryRelease, *github.Response, error)
}

GitHubAPI is an interface which calls GitHub API. This abstraction layer is needed for testing with mock.

type GitHubClient added in v0.3.1

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

GitHubClient is a real GitHubAPI implementation.

func NewGitHubClient added in v0.3.1

func NewGitHubClient(config GitHubConfig) (*GitHubClient, error)

NewGitHubClient returns a real GitHubClient instance.

func (*GitHubClient) RepositoriesListReleases added in v0.3.5

func (c *GitHubClient) RepositoriesListReleases(ctx context.Context, owner, repo string, opt *github.ListOptions) ([]*github.RepositoryRelease, *github.Response, error)

RepositoriesListReleases lists the releases for a repository.

type GitHubConfig added in v0.3.1

type GitHubConfig struct {

	// BaseURL is a URL for GitHub API requests.
	// Defaults to the public GitHub API.
	// This looks like the GitHub Enterprise support, but currently for testing purposes only.
	// The GitHub Enterprise is not supported yet.
	// BaseURL should always be specified with a trailing slash.
	BaseURL string

	// Token is a personal access token for GitHub.
	// This allows access to a private repository.
	Token string
	// contains filtered or unexported fields
}

GitHubConfig is a set of configurations for GitHubRelease.

type GitHubRelease

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

GitHubRelease is a release implementation which provides version information with GitHub Release.

func (*GitHubRelease) ListReleases added in v0.5.0

func (r *GitHubRelease) ListReleases(ctx context.Context) ([]string, error)

ListReleases returns a list of unsorted all releases including pre-release.

type GitLabAPI added in v0.3.2

type GitLabAPI interface {
	// ProjectListReleases gets a pagenated of releases accessible by the authenticated user.
	ProjectListReleases(ctx context.Context, owner, project string, opt *gitlab.ListReleasesOptions) ([]*gitlab.Release, *gitlab.Response, error)
}

GitLabAPI is an interface which calls GitLab API. This abstraction layer is needed for testing with mock.

type GitLabClient added in v0.3.2

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

GitLabClient is a real GitLabAPI implementation.

func NewGitLabClient added in v0.3.2

func NewGitLabClient(config GitLabConfig) (*GitLabClient, error)

NewGitLabClient returns a real GitLab instance.

func (*GitLabClient) ProjectListReleases added in v0.3.5

func (c *GitLabClient) ProjectListReleases(ctx context.Context, owner, project string, opt *gitlab.ListReleasesOptions) ([]*gitlab.Release, *gitlab.Response, error)

ProjectListReleases gets a pagenated of releases accessible by the authenticated user.

type GitLabConfig added in v0.3.2

type GitLabConfig struct {

	// BaseURL is a URL for GitLab API requests.
	// Defaults to the public GitLab API.
	// BaseURL should always be specified with a trailing slash.
	BaseURL string

	// Token is a personal access token for GitLab, needed to use the api.
	Token string
	// contains filtered or unexported fields
}

GitLabConfig is a set of configurations for GitLabRelease..

type GitLabRelease added in v0.3.2

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

GitLabRelease is a release implementation which provides version information with GitLab Release.

func NewGitLabRelease added in v0.3.2

func NewGitLabRelease(source string, config GitLabConfig) (*GitLabRelease, error)

NewGitLabRelease is a factory method which returns an GitLabRelease instance.

func (*GitLabRelease) ListReleases added in v0.5.0

func (r *GitLabRelease) ListReleases(ctx context.Context) ([]string, error)

ListReleases returns a list of unsorted all releases including pre-release.

type Release

type Release interface {
	// ListReleases returns a list of unsorted all releases including pre-release.
	ListReleases(ctx context.Context) ([]string, error)
}

Release is an interface which provides version information of a module or provider.

func NewGitHubRelease

func NewGitHubRelease(source string, config GitHubConfig) (Release, error)

NewGitHubRelease is a factory method which returns an GitHubRelease instance.

func NewTFRegistryModuleRelease added in v0.3.4

func NewTFRegistryModuleRelease(source string, config TFRegistryConfig) (Release, error)

NewTFRegistryModuleRelease is a factory method which returns an TFRegistryModuleRelease instance.

func NewTFRegistryProviderRelease added in v0.4.2

func NewTFRegistryProviderRelease(source string, config TFRegistryConfig) (Release, error)

NewTFRegistryProviderRelease is a factory method which returns an TFRegistryProviderRelease instance.

type TFRegistryAPI added in v0.3.4

type TFRegistryAPI interface {
	// ModuleLatestForProvider returns the latest version of a module for a single provider.
	// https://www.terraform.io/docs/registry/api.html#latest-version-for-a-specific-module-provider
	ModuleLatestForProvider(ctx context.Context, req *tfregistry.ModuleLatestForProviderRequest) (*tfregistry.ModuleLatestForProviderResponse, error)

	// ProviderLatest returns the latest version of a provider.
	// This relies on a currently undocumented providers API endpoint which behaves exactly like the equivalent documented modules API endpoint.
	// https://www.terraform.io/docs/registry/api.html#latest-version-for-a-specific-module-provider
	ProviderLatest(ctx context.Context, req *tfregistry.ProviderLatestRequest) (*tfregistry.ProviderLatestResponse, error)
}

TFRegistryAPI is an interface which calls Terraform Registry API. This abstraction layer is needed for testing with mock.

type TFRegistryClient added in v0.3.4

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

TFRegistryClient is a real TFRegistryAPI implementation.

func NewTFRegistryClient added in v0.3.4

func NewTFRegistryClient(config TFRegistryConfig) (*TFRegistryClient, error)

NewTFRegistryClient returns a real TFRegistryClient instance.

func (*TFRegistryClient) ModuleLatestForProvider added in v0.3.4

ModuleLatestForProvider returns the latest version of a module for a single provider. https://www.terraform.io/docs/registry/api.html#latest-version-for-a-specific-module-provider

func (*TFRegistryClient) ProviderLatest added in v0.4.2

ProviderLatest returns the latest version of a provider. This relies on a currently undocumented providers API endpoint which behaves exactly like the equivalent documented modules API endpoint. https://www.terraform.io/docs/registry/api.html#latest-version-for-a-specific-module-provider

type TFRegistryConfig added in v0.3.4

type TFRegistryConfig struct {

	// BaseURL is a URL for Terraform Registry API requests.
	// Defaults to the public Terraform Registry API.
	// This looks like the Terraform Cloud support, but currently for testing purposes only.
	// The Terraform Cloud is not supported yet.
	// BaseURL should always be specified with a trailing slash.
	BaseURL string
	// contains filtered or unexported fields
}

TFRegistryConfig is a set of configurations for TFRegistryModuleRelease and TFRegistryProviderRelease.

type TFRegistryModuleRelease added in v0.3.4

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

TFRegistryModuleRelease is a release implementation which provides version information with TFRegistryModule Release.

func (*TFRegistryModuleRelease) ListReleases added in v0.5.0

func (r *TFRegistryModuleRelease) ListReleases(ctx context.Context) ([]string, error)

ListReleases returns a list of unsorted all releases including pre-release.

type TFRegistryProviderRelease added in v0.4.2

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

TFRegistryProviderRelease is a release implementation which provides version information with TFRegistryProvider Release.

func (*TFRegistryProviderRelease) ListReleases added in v0.5.0

func (r *TFRegistryProviderRelease) ListReleases(ctx context.Context) ([]string, error)

ListReleases returns a list of unsorted all releases including pre-release.

Jump to

Keyboard shortcuts

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