profile

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:   "profile",
	Short: "Manage profiles",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Profile requires a subcommand:")
		for _, command := range cmd.Commands() {
			fmt.Println(command.Name())
		}
	},
}

Command represents this folder's command

View Source
var Profiles profiles

Profiles is the collection of profiles

Functions

func GetAll

func GetAll[T any](context context.Context, profile *Profile, repository string, uripath string) (resources []T, err error)

GetAllResources gets all resources using the given profile

func ValidProfileNames

func ValidProfileNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)

ValidProfileNames gets the valid profile names

Types

type BitBucketError

type BitBucketError struct {
	Type    string              `json:"type"`
	Message string              `json:"-"`
	Detail  string              `json:"-"`
	Fields  map[string][]string `json:"fields"`
}

func (*BitBucketError) Error

func (bberr *BitBucketError) Error() string

func (*BitBucketError) UnmarshalJSON

func (bberr *BitBucketError) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON unmarshals the JSON

type PaginatedResources

type PaginatedResources[T any] struct {
	Values   []T    `json:"values"`
	Page     int    `json:"page"`
	PageSize int    `json:"pagelen"`
	Size     int    `json:"size"`
	Next     string `json:"next"`
	Previous string `json:"previous"`
}

type Profile

type Profile struct {
	Name         string    `json:"name"                   mapstructure:"name"`
	Description  string    `json:"description,omitempty"  mapstructure:"description,omitempty" yaml:",omitempty"`
	Default      bool      `json:"default"                mapstructure:"default"               yaml:",omitempty"`
	User         string    `json:"user,omitempty"         mapstructure:"user"                  yaml:",omitempty"`
	Password     string    `json:"password,omitempty"     mapstructure:"password"              yaml:",omitempty"`
	ClientID     string    `json:"clientID,omitempty"     mapstructure:"clientID"              yaml:",omitempty"`
	ClientSecret string    `json:"clientSecret,omitempty" mapstructure:"clientSecret"          yaml:",omitempty"`
	AccessToken  string    `json:"accessToken,omitempty"  mapstructure:"accessToken"           yaml:",omitempty"`
	RefreshToken string    `json:"-"                      mapstructure:"refreshToken"          yaml:"-"`
	TokenExpires time.Time `json:"-"                      mapstructure:"tokenExpires"          yaml:"-"`
	TokenScopes  []string  `json:"-"                      mapstructure:"tokenScopes"           yaml:"-"`
}

Profile describes the configuration needed to connect to BitBucket

var Current *Profile

Current is the current profile

func (*Profile) Delete

func (profile *Profile) Delete(context context.Context, repository, uripath string, response interface{}) (err error)

func (*Profile) Get

func (profile *Profile) Get(context context.Context, repository, uripath string, response interface{}) (err error)

func (*Profile) Patch

func (profile *Profile) Patch(context context.Context, repository, uripath string, body interface{}, response interface{}) (err error)

func (*Profile) Post

func (profile *Profile) Post(context context.Context, repository, uripath string, body interface{}, response interface{}) (err error)

func (*Profile) Put

func (profile *Profile) Put(context context.Context, repository, uripath string, body interface{}, response interface{}) (err error)

func (Profile) String

func (profile Profile) String() string

String gets a string representation of this profile

implements fmt.Stringer

func (*Profile) Validate

func (profile *Profile) Validate() error

Validate validates a Profile

Jump to

Keyboard shortcuts

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