ld

package
v2.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotFoundErr                       = errors.New("not found")
	ConflictErr                       = errors.New("conflict")
	RateLimitExceededErr              = errors.New("rate limit exceeded")
	InternalServiceErr                = errors.New("internal service error")
	ServiceUnavailableErr             = errors.New("service unavailable")
	BranchUpdateSequenceIdConflictErr = errors.New("updateSequenceId conflict")
	RepositoryDisabledErr             = newConfigurationError("repository is disabled")
	UnauthorizedErr                   = newConfigurationError("unauthorized, check your LaunchDarkly access token")
	EntityTooLargeErr                 = newConfigurationError("entity too large")
)

Functions

func IsTransient

func IsTransient(err error) bool

IsTransient returns true if the error returned by the LaunchDarkly API is either unexpected, or unable to be resolved by the user.

func RateLimitBackoff added in v2.11.9

func RateLimitBackoff(now func() time.Time, fallbackBackoff h.Backoff) func(time.Duration, time.Duration, int, *http.Response) time.Duration

LaunchDarkly API uses the X-Ratelimit-Reset header to communicate when to retry after a 429 Fallback to default backoff if header can't be parsed https://apidocs.launchdarkly.com/#section/Overview/Rate-limiting Method is curried in order to avoid stubbing the time package and fallback Backoff in unit tests

Types

type ApiClient

type ApiClient struct {
	Options ApiOptions
	// contains filtered or unexported fields
}

func InitApiClient

func InitApiClient(options ApiOptions) ApiClient

func (ApiClient) GetCodeReferenceRepositoryBranches

func (c ApiClient) GetCodeReferenceRepositoryBranches(repoName string) ([]BranchRep, error)

func (ApiClient) GetFlagKeyList

func (c ApiClient) GetFlagKeyList(projKey string) ([]string, error)

func (ApiClient) MaybeUpsertCodeReferenceRepository

func (c ApiClient) MaybeUpsertCodeReferenceRepository(repo RepoParams) error

func (ApiClient) PostDeleteBranchesTask

func (c ApiClient) PostDeleteBranchesTask(repoName string, branches []string) error

func (ApiClient) PostExtinctionEvents

func (c ApiClient) PostExtinctionEvents(extinctions []ExtinctionRep, repoName, branchName string) error

func (ApiClient) PutCodeReferenceBranch

func (c ApiClient) PutCodeReferenceBranch(branch BranchRep, repoName string) error

type ApiOptions

type ApiOptions struct {
	ApiKey    string
	ProjKey   string
	BaseUri   string
	UserAgent string
	RetryMax  *int
}

type BranchCollection

type BranchCollection struct {
	Items []BranchRep `json:"items"`
}

type BranchRep

type BranchRep struct {
	Name             string              `json:"name"`
	Head             string              `json:"head"`
	UpdateSequenceId *int                `json:"updateSequenceId,omitempty"`
	SyncTime         int64               `json:"syncTime"`
	References       []ReferenceHunksRep `json:"references,omitempty"`
	CommitTime       int64               `json:"commitTime,omitempty"`
}

func (BranchRep) CountAll

func (b BranchRep) CountAll() map[string]int64

func (BranchRep) CountByProjectAndFlag

func (b BranchRep) CountByProjectAndFlag(matcher [][]string, projects []string) map[string]map[string]int64

func (BranchRep) PrintReferenceCountTable

func (b BranchRep) PrintReferenceCountTable()

func (BranchRep) TotalHunkCount

func (b BranchRep) TotalHunkCount() int

func (BranchRep) WriteToCSV

func (b BranchRep) WriteToCSV(outDir, projKey, repo, sha string) (path string, err error)

type ConfigurationError

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

type ExtinctionRep

type ExtinctionRep struct {
	Revision string `json:"revision"`
	Message  string `json:"message"`
	Time     int64  `json:"time"`
	ProjKey  string `json:"projKey"`
	FlagKey  string `json:"flagKey"`
}

type HunkRep

type HunkRep struct {
	StartingLineNumber int      `json:"startingLineNumber"`
	Lines              string   `json:"lines,omitempty"`
	ProjKey            string   `json:"projKey"`
	FlagKey            string   `json:"flagKey"`
	Aliases            []string `json:"aliases,omitempty"`
	ContentHash        string   `json:"contentHash,omitempty"`
}

func (HunkRep) NumLines

func (h HunkRep) NumLines() int

func (HunkRep) Overlap

func (h HunkRep) Overlap(hr HunkRep) int

Returns the number of lines overlapping between the receiver (h) and the parameter (hr) hunkreps The return value will be negative if the hunks do not overlap

type ReferenceHunksRep

type ReferenceHunksRep struct {
	Path  string    `json:"path"`
	Hunks []HunkRep `json:"hunks"`
}

type RepoParams

type RepoParams struct {
	Type              string `json:"type"`
	Name              string `json:"name"`
	Url               string `json:"sourceLink"`
	CommitUrlTemplate string `json:"commitUrlTemplate"`
	HunkUrlTemplate   string `json:"hunkUrlTemplate"`
	DefaultBranch     string `json:"defaultBranch"`
}

type RepoRep

type RepoRep struct {
	Type              string `json:"type"`
	Name              string `json:"name"`
	Url               string `json:"sourceLink"`
	CommitUrlTemplate string `json:"commitUrlTemplate"`
	HunkUrlTemplate   string `json:"hunkUrlTemplate"`
	DefaultBranch     string `json:"defaultBranch"`
	Enabled           bool   `json:"enabled,omitempty"`
}

Jump to

Keyboard shortcuts

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