bitbucket

package
v2.3.6 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: MPL-2.0 Imports: 26 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// BitbucketEndpoint is the fqdn used to talk to bitbucket
	BitbucketEndpoint string = "https://api.bitbucket.org/"
)

Variables

This section is empty.

Functions

func Provider

func Provider() *schema.Provider

Provider will create the necessary terraform provider to talk to the Bitbucket APIs you should either specify Username and App Password, OAuth Client Credentials or a valid OAuth Access Token.

See the Bitbucket authentication documentation for more: https://developer.atlassian.com/cloud/bitbucket/rest/intro/#authentication

func RandPlainSSHKeyPairSize

func RandPlainSSHKeyPairSize(keySize int) (string, error)

func RandSSHKeyPairSize

func RandSSHKeyPairSize(keySize int, comment string) (string, string, error)

Taken from https://github.com/hashicorp/terraform-provider-aws/blob/187f1659a4fef11ac314567273b5470afe6b662f/internal/service/iam/acc_test.go RandSSHKeyPair generates a public and private SSH key pair. The public key is returned in OpenSSH format, and the private key is PEM encoded. Copied from github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest,

with the addition of the key size

Types

type BranchModel

type BranchModel struct {
	IsValid            bool    `json:"is_valid,omitempty"`
	Name               *string `json:"name"`
	UseMainbranch      bool    `json:"use_mainbranch,omitempty"`
	BranchDoesNotExist bool    `json:"branch_does_not_exist,omitempty"`
	Enabled            bool    `json:"enabled,omitempty"`
}

type BranchRestriction

type BranchRestriction struct {
	ID              int     `json:"id,omitempty"`
	Kind            string  `json:"kind,omitempty"`
	BranchMatchkind string  `json:"branch_match_kind,omitempty"`
	BranchType      string  `json:"branch_type,omitempty"`
	Pattern         string  `json:"pattern,omitempty"`
	Value           int     `json:"value,omitempty"`
	Users           []User  `json:"users,omitempty"`
	Groups          []Group `json:"groups,omitempty"`
}

BranchRestriction is the data we need to send to create a new branch restriction for the repository

type BranchType

type BranchType struct {
	Enabled bool   `json:"enabled,omitempty"`
	Kind    string `json:"kind,omitempty"`
	Prefix  string `json:"prefix,omitempty"`
}

type BranchingModel

type BranchingModel struct {
	Development *BranchModel  `json:"development,omitempty"`
	Production  *BranchModel  `json:"production,omitempty"`
	BranchTypes []*BranchType `json:"branch_types"`
}

BranchingModel is the data we need to send to create a new branching model for the repository

type Change

type Change struct {
	Name         string       `json:"name,omitempty"`
	Restrictions Restrictions `json:"restrictions,omitempty"`
}

type Changes

type Changes struct {
	Change *Change `json:"change"`
}

type Client

type Client struct {
	Username         *string
	Password         *string
	OAuthToken       *string
	OAuthTokenSource oauth2.TokenSource
	HTTPClient       *http.Client
}

Client is the base internal Client to talk to bitbuckets API. This should be a username and password the password should be a app-password.

func (*Client) Delete

func (c *Client) Delete(endpoint string) (*http.Response, error)

Delete is just a helper to Do but with a DELETE verb

func (*Client) Do

func (c *Client) Do(method, endpoint string, payload *bytes.Buffer, contentType string) (*http.Response, error)

Do Will just call the bitbucket api but also add auth to it and some extra headers

func (*Client) Get

func (c *Client) Get(endpoint string) (*http.Response, error)

Get is just a helper method to do but with a GET verb

func (*Client) Post

func (c *Client) Post(endpoint string, jsonpayload *bytes.Buffer) (*http.Response, error)

Post is just a helper method to do but with a POST verb

func (*Client) PostNonJson

func (c *Client) PostNonJson(endpoint string, payload *bytes.Buffer) (*http.Response, error)

PostNonJson is just a helper method to do but with a POST verb without Json Header

func (*Client) PostWithContentType

func (c *Client) PostWithContentType(endpoint, contentType string, payload *bytes.Buffer) (*http.Response, error)

PostWithContentType is just a helper method to do but with a POST verb and a provided content type

func (*Client) Put

func (c *Client) Put(endpoint string, jsonpayload *bytes.Buffer) (*http.Response, error)

Put is just a helper method to do but with a PUT verb

func (*Client) PutOnly

func (c *Client) PutOnly(endpoint string) (*http.Response, error)

PutOnly is just a helper method to do but with a PUT verb and a nil body

type Clients

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

type Deployment

type Deployment struct {
	Name         string        `json:"name"`
	Stage        *Stage        `json:"environment_type"`
	UUID         string        `json:"uuid,omitempty"`
	Restrictions *Restrictions `json:"restrictions,omitempty"`
}

Deployment structure for handling key info

type Error

type Error struct {
	APIError struct {
		Message string `json:"message,omitempty"`
	} `json:"error,omitempty"`
	Type       string `json:"type,omitempty"`
	StatusCode int
	Endpoint   string
}

Error represents a error from the bitbucket api.

func (Error) Error

func (e Error) Error() string

type Group

type Group struct {
	Slug  string `json:"slug,omitempty"`
	Owner User   `json:"owner,omitempty"`
}

Group is the group we want to add to a branch restriction

type Hook

type Hook struct {
	UUID                 string   `json:"uuid,omitempty"`
	URL                  string   `json:"url,omitempty"`
	Description          string   `json:"description,omitempty"`
	Active               bool     `json:"active"`
	SkipCertVerification bool     `json:"skip_cert_verification"`
	Events               []string `json:"events,omitempty"`
}

Hook is the hook you want to add to a bitbucket repository

type IPRange

type IPRange struct {
	Network    string   `json:"network"`
	MaskLen    int      `json:"mask_len"`
	CIDR       string   `json:"cidr"`
	Mask       string   `json:"mask"`
	Regions    []string `json:"region"`
	Products   []string `json:"product"`
	Directions []string `json:"direction"`
}

type PaginatedIPRanges

type PaginatedIPRanges struct {
	Items     []IPRange `json:"items,omitempty"`
	SyncToken int       `json:"syncToken,omitempty"`
}

type PaginatedReviewers

type PaginatedReviewers struct {
	Values []Reviewer `json:"values,omitempty"`
	Page   int        `json:"page,omitempty"`
	Size   int        `json:"size,omitempty"`
	Next   string     `json:"next,omitempty"`
}

PaginatedReviewers is a paginated list that the bitbucket api returns

type PaginatedUserEmails

type PaginatedUserEmails struct {
	Values []UserEmail `json:"values,omitempty"`
	Page   int         `json:"page,omitempty"`
	Size   int         `json:"size,omitempty"`
	Next   string      `json:"next,omitempty"`
}

type ProviderConfig

type ProviderConfig struct {
	ApiClient   *bitbucket.APIClient
	AuthContext context.Context
}

type RepositoryGroup

type RepositoryGroup struct {
	Name      string              `json:"name,omitempty"`
	Slug      string              `json:"slug,omitempty"`
	Workspace bitbucket.Workspace `json:"workspace,omitempty"`
}

type RepositoryGroupPermission

type RepositoryGroupPermission struct {
	Permission string           `json:"permission"`
	Group      *RepositoryGroup `json:"group,omitempty"`
}

type RepositoryInheritanceSettings

type RepositoryInheritanceSettings struct {
	DefaultMergeStrategy *bool `json:"default_merge_strategy,omitempty"`
	BranchingModel       *bool `json:"branching_model,omitempty"`
}

type RepositoryUser

type RepositoryUser struct {
	UUID string `json:"uuid,omitempty"`
}

type RepositoryUserPermission

type RepositoryUserPermission struct {
	Permission string          `json:"permission"`
	User       *RepositoryUser `json:"user,omitempty"`
}

type Restrictions

type Restrictions struct {
	AdminOnly bool `json:"admin_only"`
}

type Reviewer

type Reviewer struct {
	DisplayName string `json:"display_name,omitempty"`
	UUID        string `json:"uuid,omitempty"`
	Type        string `json:"type,omitempty"`
}

Reviewer is teh default reviewer you want

type SshKey

type SshKey struct {
	ID      int    `json:"id,omitempty"`
	UUID    string `json:"uuid,omitempty"`
	Key     string `json:"key,omitempty"`
	Label   string `json:"label,omitempty"`
	Comment string `json:"comment,omitempty"`
}

sshKey is the data we need to send to create a new SSH Key for the repository

type Stage

type Stage struct {
	Name string `json:"name"`
}

type User

type User struct {
	Username string `json:"username,omitempty"`
}

User is just the user struct we want to use for BranchRestrictions

type UserEmail

type UserEmail struct {
	Email       string `json:"email"`
	IsPrimary   bool   `json:"is_primary"`
	IsConfirmed bool   `json:"is_confirmed"`
}

type UserGroup

type UserGroup struct {
	Name                    string `json:"name,omitempty"`
	Slug                    string `json:"slug,omitempty"`
	AutoAdd                 bool   `json:"auto_add,omitempty"`
	Permission              string `json:"permission,omitempty"`
	EmailForwardingDisabled bool   `json:"email_forwarding_disabled,omitempty"`
}

type UserGroupMembership

type UserGroupMembership struct {
	UUID string `json:"uuid,omitempty"`
}

Jump to

Keyboard shortcuts

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