provider

package
v0.0.0-...-2dfab7d Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WebServiceType             serviceTypeOption = "Web Service"
	CronjobServiceType         serviceTypeOption = "Cron Job"
	JetpackManagedCluster      string            = "Jetpack managed cluster"
	CreateJetpackCluster       string            = "Create a new cluster with Jetpack"
	ImageRepositoryFlagHelpMsg                   = "Image repository to push the built image to. " +
		"Your kubernetes cluster must have the permissions to pull images from this repository."
)

Variables

This section is empty.

Functions

func IsLocalCluster

func IsLocalCluster(kubeContext string) (bool, error)

Types

type Analytics

type Analytics interface {
	Track(ctx context.Context, event string, options map[string]any)
	Close() error
}

func DefaultAnalyticsProvider

func DefaultAnalyticsProvider() Analytics

type Auth

type Auth interface {
	Identify(ctx context.Context) (context.Context, error)
	User(ctx context.Context) (User, error)
}

func Anonymous

func Anonymous() Auth

type Cluster

type Cluster interface {
	GetHostname() string
	GetKubeContext() string

	IsJetpackManaged() bool
	IsLocal() bool
	IsRemoteUnmanaged() bool

	GetIsPrivate() bool

	GetName() string
}

func KubeConfigCluster

func KubeConfigCluster(
	hostname string,
	jetpackManaged bool,
	kubeContextName string,
	local bool,
) Cluster

type ClusterProvider

type ClusterProvider interface {
	// Get returns the preferred Cluster to be used for the current command.
	Get(ctx context.Context) (Cluster, error)

	// GetAll returns all Clusters available to the user. May be empty.
	GetAll(ctx context.Context) ([]Cluster, error)

	GetSelectedClusterName() *string
	SetSelectedClusterName(name string)
}

func KubeConfigClusterProvider

func KubeConfigClusterProvider() ClusterProvider

type EnvSec

type EnvSec interface {
	// string here refers to "selected provider"
	Get(context.Context, string) (EnvSecConfig, error)
	NewEnvId(ctx context.Context, projectId string, env string) (*envsec.EnvID, error)
}

func DefaultEnvSecProvider

func DefaultEnvSecProvider() EnvSec

type EnvSecConfig

type EnvSecConfig interface {
	GetRegion() string
	GetAccessKeyId() string
	GetSecretAccessKey() string
	GetSessionToken() string
	GetKmsKeyId() string
}

type ErrorLogger

type ErrorLogger interface {
	CaptureException(exception error)

	// DisplayException displays an error to the user. This is useful for custom error that padcli
	// would otherwise not know how to display in a user-friendly way. Returns true if the error
	// is displayed. If true, the caller can continue without doing further error handling.
	DisplayException(err error) bool
}

type InitSurveyProvider

type InitSurveyProvider interface {
	Run(
		ctx context.Context,
		authProvider Auth,
		appName string,
	) (*SurveyAnswers, error)
}

func DefaultInitSurveyProvider

func DefaultInitSurveyProvider(cp ClusterProvider) InitSurveyProvider

type NamespaceProvider

type NamespaceProvider interface {
	Get(ctx context.Context, ns string, kubeContext string, e api.Environment) (string, error)
}

func KubeConfigNamespaceProvider

func KubeConfigNamespaceProvider() NamespaceProvider

type NoOpLogger

type NoOpLogger struct{}

func (*NoOpLogger) CaptureException

func (l *NoOpLogger) CaptureException(err error)

func (*NoOpLogger) DisplayException

func (l *NoOpLogger) DisplayException(err error) bool

type Providers

type Providers interface {
	AnalyticsProvider() Analytics
	AuthProvider() Auth
	ClusterProvider() ClusterProvider
	EnvSecProvider() EnvSec
	ErrorLogger() ErrorLogger
	InitSurveyProvider() InitSurveyProvider
	NamespaceProvider() NamespaceProvider
	RepositoryProvider() Repository
}

Keep abc

type RepoConfig

type RepoConfig interface {
	GetCredentials() string
	GetImageRepoPrefix() string
	GetCloudCredentials() any
	GetRegion() string
}

type Repository

type Repository interface {
	// string here is the image repository address (excluding the image tag).
	// It is left as "" if using the default provided image repository
	Get(context.Context, Cluster, string) (RepoConfig, error)
}

func EmptyRepository

func EmptyRepository() Repository

type SurveyAnswers

type SurveyAnswers struct {
	AppName                 string
	AppType                 string
	ClusterOption           string
	KubeContext             string
	ImageRepositoryLocation string
}

type User

type User interface {
	Email() string
	Token() string
	OrgID() string
	ID() string
}

Jump to

Keyboard shortcuts

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