url

package
v0.0.0-...-4c964c4 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GITSuffix is the suffix used to terminate repo paths for git apis.
	GITSuffix = ".git"

	// APIMount is the prefix path for the api endpoints.
	APIMount = "api"

	// GITMount is the prefix path for the git endpoints.
	GITMount = "git"

	// ArtifactMount is the prefix path for the artifact endpoints
	ArtifactMount = "_artifacts"

	// ContainerRegistry is the prefix path for the container registry endpoints
	ContainerRegistry = "v2"
)

Variables

WireSet provides a wire set for this package.

Functions

func BuildGITCloneSSHURL

func BuildGITCloneSSHURL(user string, sshURL *url.URL, repoPath string) string

Types

type Provider

type Provider interface {
	// GetInternalAPIURL returns the internally reachable base url of the server.
	// NOTE: url is guaranteed to not have any trailing '/'.
	GetInternalAPIURL(ctx context.Context) string

	// GenerateContainerGITCloneURL generates a URL that can be used by CI container builds to
	// interact with Harness and clone a repo.
	GenerateContainerGITCloneURL(ctx context.Context, repoPath string) string

	// GenerateGITCloneURL generates the public git clone URL for the provided repo path.
	// NOTE: url is guaranteed to not have any trailing '/'.
	GenerateGITCloneURL(ctx context.Context, repoPath string) string

	// GenerateCustomUIRepoURL returns the url for the UI screen of a repository.
	GenerateCustomUIRepoURL(repoPath, custom string) string
	// GenerateGITCloneSSHURL generates the public git clone URL for the provided repo path.
	// NOTE: url is guaranteed to not have any trailing '/'.
	GenerateGITCloneSSHURL(ctx context.Context, repoPath string) string

	// GenerateUIRepoURL returns the url for the UI screen of a repository.
	GenerateUIRepoURL(ctx context.Context, repoPath string) string

	// GenerateUIPRURL returns the url for the UI screen of an existing pr.
	GenerateUIPRURL(ctx context.Context, repoPath string, prID int64) string

	// GenerateUICompareURL returns the url for the UI screen comparing two references.
	GenerateUICompareURL(ctx context.Context, repoPath string, ref1 string, ref2 string) string

	// GetAPIHostname returns the host for the api endpoint.
	GetAPIHostname(ctx context.Context) string

	// GenerateUIBuildURL returns the endpoint to use for viewing build executions.
	GenerateUIBuildURL(ctx context.Context, repoPath, pipelineIdentifier string, seqNumber int64) string

	// GetGITHostname returns the host for the git endpoint.
	GetGITHostname(ctx context.Context) string

	// GetAPIProto returns the proto for the API hostname
	GetAPIProto(ctx context.Context) string

	// GenerateRegistryURL return the container registry endpoint
	GenerateRegistryURL(segments ...string) *url.URL
	// RegistryURL returns the url for oci token endpoint
	RegistryURL() string
}

Provider is an abstraction of a component that provides system related URLs. NOTE: Abstract to allow for custom implementation for more complex routing environments.

func NewProvider

func NewProvider(
	internalURLRaw,
	containerURLRaw string,
	apiURLRaw string,
	gitURLRaw,
	gitSSHURLRaw string,
	sshDefaultUser string,
	sshEnabled bool,
	uiURLRaw string,
	registryURLRaw string,
) (Provider, error)

func ProvideURLProvider

func ProvideURLProvider(config *types.Config) (Provider, error)

Jump to

Keyboard shortcuts

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