cloud

package
v0.0.0-...-bff77c1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LatestVersion        = "$LATEST"
	VersionNotApplicable = "NOT_APPLICABLE"
)

Variables

View Source
var (
	LocalPortStart = 49852
	LocalPortEnd   = 49862
)
View Source
var ErrAuthNotCompleted = errors.New("Authentication not completed")
View Source
var ErrAuthTimeout = errors.New("Authentication aborted (timeout)")

Functions

func Login

func Login(ctx context.Context) error

func NewClient

func NewClient(ctx context.Context) (*mccsdk.APIClient, error)

func NewTestClient

func NewTestClient(server *httptest.Server) *mccsdk.APIClient

func RegisterComponentVersion

func RegisterComponentVersion(ctx context.Context, client ClientWrapper, repository gitutils.GitRepository, organization, project, componentKey, branch, version string, dryRun, auto, createComponent bool, gitFilterPaths []string) error

func ResolveComponentsData

func ResolveComponentsData(ctx context.Context, cfg *config.MachConfig) error

func StartAuthentication

func StartAuthentication(ctx context.Context, config oauth2.Config, options *Options) (*oauth2.Token, error)

AuthorizeUser implements the PKCE OAuth2 flow.

Types

type ClientConfig

type ClientConfig struct {
	URL        string
	HTTPClient *http.Client
}

type ClientWrapper

type ClientWrapper interface {
	ListComponents(ctx context.Context, organization, project string, limit int32) (*mccsdk.ComponentPaginator, error)
	CreateComponent(ctx context.Context, organization, project, key string) (*mccsdk.Component, error)
	CreateComponentVersion(ctx context.Context, organization, project, key, version, branch string) (*mccsdk.ComponentVersion, error)
	GetLatestComponentVersion(ctx context.Context, organization, project, key, branch string) (*mccsdk.ComponentVersion, error)
	PushComponentVersionCommits(ctx context.Context, organization, project, componentKey, versionIdentifier string, commits []mccsdk.CommitDraft) error
}

ClientWrapper is an interface wrapper for the mccsdk.APIClient so we can more easily write tests

type MccSdkClientWrapper

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

func NewClientWrapper

func NewClientWrapper(client *mccsdk.APIClient) *MccSdkClientWrapper

func (*MccSdkClientWrapper) CreateComponent

func (m *MccSdkClientWrapper) CreateComponent(ctx context.Context, organization, project, componentKey string) (*mccsdk.Component, error)

func (*MccSdkClientWrapper) CreateComponentVersion

func (m *MccSdkClientWrapper) CreateComponentVersion(ctx context.Context, organization, project, componentKey, version, branch string) (*mccsdk.ComponentVersion, error)

func (*MccSdkClientWrapper) GetLatestComponentVersion

func (m *MccSdkClientWrapper) GetLatestComponentVersion(ctx context.Context, organization, project, componentKey, branch string) (*mccsdk.ComponentVersion, error)

func (*MccSdkClientWrapper) ListComponents

func (m *MccSdkClientWrapper) ListComponents(ctx context.Context, organization, project string, limit int32) (*mccsdk.ComponentPaginator, error)

func (*MccSdkClientWrapper) PushComponentVersionCommits

func (m *MccSdkClientWrapper) PushComponentVersionCommits(ctx context.Context, organization, project, componentKey, versionIdentifier string, commits []mccsdk.CommitDraft) error

type Options

type Options struct {
	Timeout           int
	CompletedRedirect string
	CompletedTemplate string
}

Jump to

Keyboard shortcuts

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