Documentation ¶
Index ¶
- Variables
- func GetAll[T any](context context.Context, cmd *cobra.Command, profile *Profile, uripath string) (resources []T, err error)
- func ValidProfileNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
- type BitBucketError
- type PaginatedResources
- type Profile
- func (profile *Profile) Delete(context context.Context, cmd *cobra.Command, uripath string, ...) (err error)
- func (profile *Profile) Download(context context.Context, cmd *cobra.Command, uripath, destination string) (err error)
- func (profile *Profile) Get(context context.Context, cmd *cobra.Command, uripath string, ...) (err error)
- func (profile Profile) GetHeader(short bool) []string
- func (profile Profile) GetRow(headers []string) []string
- func (profile Profile) MarshalJSON() ([]byte, error)
- func (profile *Profile) Patch(context context.Context, cmd *cobra.Command, uripath string, body interface{}, ...) (err error)
- func (profile *Profile) Post(context context.Context, cmd *cobra.Command, uripath string, body interface{}, ...) (err error)
- func (profile Profile) Print(context context.Context, cmd *cobra.Command, payload any) error
- func (profile *Profile) Put(context context.Context, cmd *cobra.Command, uripath string, body interface{}, ...) (err error)
- func (profile Profile) ShouldIgnoreErrors(cmd *cobra.Command) bool
- func (profile Profile) ShouldStopOnError(cmd *cobra.Command) bool
- func (profile Profile) ShouldWarnOnError(cmd *cobra.Command) bool
- func (profile Profile) String() string
- func (profile *Profile) UnmarshalJSON(data []byte) error
- func (profile *Profile) Update(other Profile) error
- func (profile *Profile) Upload(context context.Context, cmd *cobra.Command, uripath, source string) (err error)
- func (profile *Profile) Validate() error
- func (profile Profile) WhatIf(context context.Context, cmd *cobra.Command, format string, args ...any) (proceed bool)
Constants ¶
This section is empty.
Variables ¶
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
var Profiles profiles
Profiles is the collection of profiles
Functions ¶
func GetAll ¶
func GetAll[T any](context context.Context, cmd *cobra.Command, profile *Profile, uripath string) (resources []T, err error)
GetAllResources gets all resources of the given type
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:"-"` }
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 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"` DefaultWorkspace string `json:"defaultWorkspace,omitempty" mapstructure:"defaultWorkspace" yaml:",omitempty"` DefaultProject string `json:"defaultProject,omitempty" mapstructure:"defaultProject" yaml:",omitempty"` ErrorProcessing common.ErrorProcessing `json:"errorProcessing,omitempty" mapstructure:"errorProcessing,omitempty" yaml:",omitempty"` OutputFormat string `json:"outputFormat,omitempty" mapstructure:"outputFormat,omitempty" 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, cmd *cobra.Command, uripath string, response interface{}) (err error)
Delete deletes a resource
func (*Profile) Download ¶ added in v0.4.0
func (profile *Profile) Download(context context.Context, cmd *cobra.Command, uripath, destination string) (err error)
Dowmload downloads a resource to a destination folder
func (*Profile) Get ¶
func (profile *Profile) Get(context context.Context, cmd *cobra.Command, uripath string, response interface{}) (err error)
Get gets a resource
func (Profile) GetHeader ¶ added in v0.3.0
GetHeader gets the header for a table
implements common.Tableable
func (Profile) MarshalJSON ¶ added in v0.3.0
MarshalJSON marshals this profile to JSON
implements json.Marshaler
func (*Profile) Patch ¶
func (profile *Profile) Patch(context context.Context, cmd *cobra.Command, uripath string, body interface{}, response interface{}) (err error)
Patch patches a resource
func (*Profile) Post ¶
func (profile *Profile) Post(context context.Context, cmd *cobra.Command, uripath string, body interface{}, response interface{}) (err error)
Post posts a resource
func (*Profile) Put ¶
func (profile *Profile) Put(context context.Context, cmd *cobra.Command, uripath string, body interface{}, response interface{}) (err error)
Put puts/updates a resource
func (Profile) ShouldIgnoreErrors ¶ added in v0.9.0
ShouldIgnoreErrors tells if the command should ignore errors
func (Profile) ShouldStopOnError ¶ added in v0.9.0
ShouldStopOnError tells if the command should stop on error
func (Profile) ShouldWarnOnError ¶ added in v0.9.0
ShouldWarnOnError tells if the command should warn on error
func (*Profile) UnmarshalJSON ¶ added in v0.3.0
UnmarshalJSON unmarshals this profile from JSON
implements json.Unmarshaler
func (*Profile) Upload ¶ added in v0.4.0
func (profile *Profile) Upload(context context.Context, cmd *cobra.Command, uripath, source string) (err error)
Upload uploads a resource from a source file
func (Profile) WhatIf ¶ added in v0.9.0
func (profile Profile) WhatIf(context context.Context, cmd *cobra.Command, format string, args ...any) (proceed bool)
WhatIf prints what would be done by the command
If the DryRun flag is set, it prints what would be done by the command otherwise it does nothing