bbinstance

package
v1.135.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackendTypeCloud  = "cloud"
	BackendTypeServer = "server"
)

Recognised values for HostConfig.BackendType. Empty string means "infer from hostname".

Variables

This section is empty.

Functions

func CloudAppPasswordsURL added in v1.2.0

func CloudAppPasswordsURL() string

CloudAppPasswordsURL returns the Bitbucket Cloud App Passwords creation URL.

func CloudHTTPSURL

func CloudHTTPSURL(namespace, slug string) string

CloudHTTPSURL builds https://bitbucket.org/NAMESPACE/SLUG.git

func CloudRESTBase

func CloudRESTBase() string

CloudRESTBase returns the Bitbucket Cloud REST API v2.0 base URL. BB_CLOUD_BASE_URL overrides the default for test scenarios.

func CloudSSHURL

func CloudSSHURL(namespace, slug string) string

CloudSSHURL builds git@bitbucket.org:NAMESPACE/SLUG.git

func CloudWebPRURL

func CloudWebPRURL(namespace, slug string, id int) string

CloudWebPRURL builds https://bitbucket.org/NAMESPACE/SLUG/pull-requests/ID

func CloudWebRepoURL

func CloudWebRepoURL(namespace, slug string) string

CloudWebRepoURL builds https://bitbucket.org/NAMESPACE/SLUG

func HTTPSURL

func HTTPSURL(host, project, slug string) string

HTTPSURL builds https://HOST/scm/PROJECT/REPO.git

func IsCloud

func IsCloud(hostname, backendType string) bool

IsCloud returns true when the hostname or backendType indicates Bitbucket Cloud. Rules (in order):

  1. backendType == "cloud" → always true
  2. backendType is any non-empty, non-"cloud" value (e.g. "server", "datacenter") → false
  3. No backendType: hostname == "bitbucket.org" (exact, no port) → true
  4. Everything else → false

func PATManageURL added in v1.2.0

func PATManageURL(hostname, username string) string

PATManageURL returns the URL for managing Personal Access Tokens on a Bitbucket Server / Data Center instance. When username is non-empty the user-scoped path is used (/plugins/servlet/access-tokens/users/{username}/manage), which works across all Bitbucket Server / Data Center versions. The generic /manage path is only used as a fallback when the username is not yet known.

func RESTBase

func RESTBase(host string) string

RESTBase builds https://HOST/rest/api/1.0

func SSHURL

func SSHURL(host, project, slug string) string

SSHURL builds git@HOST:PROJECT/REPO.git

func SupportsDraftPR

func SupportsDraftPR(version string) bool

SupportsDraftPR returns true if version >= "7.17.0".

func ValidateBackendType added in v1.73.0

func ValidateBackendType(s string) error

ValidateBackendType returns a non-nil error when s is not a recognised backend_type value. Empty string is valid (auto-detect from hostname).

func WebPRURL

func WebPRURL(host, project, slug string, id int) string

WebPRURL builds https://HOST/projects/PROJECT/repos/SLUG/pull-requests/ID

func WebRepoURL

func WebRepoURL(host, project, slug string) string

WebRepoURL builds https://HOST/projects/PROJECT/repos/SLUG/browse

Types

This section is empty.

Jump to

Keyboard shortcuts

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