cloud

package
v0.7.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: MPL-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SatelliteStatusOperational indicates an on satellite that is ready to accept connections.
	SatelliteStatusOperational = "Operational"
	// SatelliteStatusSleep indicates a satellite that is in a sleep state.
	SatelliteStatusSleep = "Sleeping"
	// SatelliteStatusStarting indicates a satellite that is waking from a sleep state.
	SatelliteStatusStarting = "Starting"
	// SatelliteStatusStopping indicates a new satellite that is currently going to sleep.
	SatelliteStatusStopping = "Stopping"
	// SatelliteStatusCreating indicates a new satellite that is currently being launched.
	SatelliteStatusCreating = "Creating"
	// SatelliteStatusUpdating indicates a satellite that is upgrading to a new version, either manually or via maintenance window.
	SatelliteStatusUpdating = "Updating"
	// SatelliteStatusFailed indicates a satellite that has crashed and cannot be used.
	SatelliteStatusFailed = "Failed"
	// SatelliteStatusDestroying indicates a satellite that is actively being deleted.
	SatelliteStatusDestroying = "Destroying"
	// SatelliteStatusOffline indicates a satellite that has been stopped and will not be woken up normally via build.
	SatelliteStatusOffline = "Offline"
	// SatelliteStatusUnknown is used when an unexpected satellite status is returned by the server.
	SatelliteStatusUnknown = "Unknown"
)

Variables

View Source
var (
	// ErrUnauthorized occurs when a user is unauthorized to access a resource
	ErrUnauthorized = errors.New("unauthorized")
	// ErrNoAuthorizedPublicKeys occurs when no authorized public keys are found
	ErrNoAuthorizedPublicKeys = errors.New("no authorized public keys found")
)
View Source
var ErrNoSSHAgent = errors.Errorf("no ssh auth agent socket")

ErrNoSSHAgent occurs when no ssh auth agent exists

Functions

func IsValidEmail

func IsValidEmail(ctx context.Context, email string) bool

IsValidEmail returns true if email is valid

func LocalMaintenanceWindowToUTC added in v0.7.0

func LocalMaintenanceWindowToUTC(window string, loc *time.Location) (string, error)

LocalMaintenanceWindowToUTC checks if the provided maintenance window is valid and returns a new maintenance window converted from local time to UTC format.

func UTCMaintenanceWindowToLocal added in v0.7.0

func UTCMaintenanceWindowToLocal(window string, loc *time.Location) (string, error)

UTCMaintenanceWindowToLocal checks if the provided maintenance window is valid and returns a new maintenance window converted from local time to UTC format.

Types

type Client

type Client interface {
	RegisterEmail(ctx context.Context, email string) error
	CreateAccount(ctx context.Context, email, verificationToken, password, publicKey string, termsConditionsPrivacy bool) error
	Authenticate(ctx context.Context) error
	Get(ctx context.Context, path string) ([]byte, error)
	Remove(ctx context.Context, path string) error
	Set(ctx context.Context, path string, data []byte) error
	List(ctx context.Context, path string) ([]string, error)
	GetPublicKeys(ctx context.Context) ([]*agent.Key, error)
	CreateOrg(ctx context.Context, org string) error
	Invite(ctx context.Context, org, user string, write bool) error
	InviteToOrg(ctx context.Context, invite *OrgInvitation) (string, error)
	AcceptInvite(ctx context.Context, inviteCode string) error
	ListInvites(ctx context.Context, org string) ([]*OrgInvitation, error)
	ListOrgs(ctx context.Context) ([]*OrgDetail, error)
	ListOrgPermissions(ctx context.Context, path string) ([]*OrgPermissions, error)
	ListOrgMembers(ctx context.Context, orgName string) ([]*OrgMember, error)
	UpdateOrgMember(ctx context.Context, orgName, userEmail, permission string) error
	RemoveOrgMember(ctx context.Context, orgName, userEmail string) error
	RevokePermission(ctx context.Context, path, user string) error
	ListPublicKeys(ctx context.Context) ([]string, error)
	AddPublicKey(ctx context.Context, key string) error
	RemovePublicKey(ctx context.Context, key string) error
	CreateToken(context.Context, string, bool, *time.Time) (string, error)
	ListTokens(ctx context.Context) ([]*TokenDetail, error)
	RemoveToken(ctx context.Context, token string) error
	WhoAmI(ctx context.Context) (string, string, bool, error)
	UploadLog(ctx context.Context, pathOnDisk string) (string, error)
	SetPasswordCredentials(context.Context, string, string) error
	SetTokenCredentials(ctx context.Context, token string) (string, error)
	SetSSHCredentials(ctx context.Context, email, sshKey string) error
	FindSSHCredentials(ctx context.Context, emailToFind string) error
	DeleteAuthCache(ctx context.Context) error
	DeleteCachedToken(ctx context.Context) error
	DisableSSHKeyGuessing(ctx context.Context)
	SetAuthTokenDir(ctx context.Context, path string)
	SendAnalytics(ctx context.Context, data *EarthlyAnalytics) error
	IsLoggedIn(ctx context.Context) bool
	GetAuthToken(ctx context.Context) (string, error)
	LaunchSatellite(ctx context.Context, name, orgID, platform, size, version, maintenanceWindow string, features []string) error
	GetOrgID(ctx context.Context, name string) (string, error)
	ListSatellites(ctx context.Context, orgID string) ([]SatelliteInstance, error)
	GetSatellite(ctx context.Context, name, orgID string) (*SatelliteInstance, error)
	DeleteSatellite(ctx context.Context, name, orgID string) error
	ReserveSatellite(ctx context.Context, name, orgID, gitAuthor, gitConfigEmail string, isCI bool) chan SatelliteStatusUpdate
	WakeSatellite(ctx context.Context, name, orgID string) chan SatelliteStatusUpdate
	SleepSatellite(ctx context.Context, name, orgID string) chan SatelliteStatusUpdate
	UpdateSatellite(ctx context.Context, name, orgID, version, maintenanceWindow string, dropCache bool, featureFlags []string) error
	CreateProject(ctx context.Context, name, orgName string) (*Project, error)
	ListProjects(ctx context.Context, orgName string) ([]*Project, error)
	GetProject(ctx context.Context, orgName, name string) (*Project, error)
	DeleteProject(ctx context.Context, orgName, name string) error
	AddProjectMember(ctx context.Context, orgName, name, userEmail, permission string) error
	UpdateProjectMember(ctx context.Context, orgName, name, userEmail, permission string) error
	ListProjectMembers(ctx context.Context, orgName, name string) ([]*ProjectMember, error)
	RemoveProjectMember(ctx context.Context, orgName, name, userEmail string) error
	ListSecrets(ctx context.Context, path string) ([]*Secret, error)
	GetProjectSecret(ctx context.Context, org, project, secretName string) (*Secret, error)
	GetUserSecret(ctx context.Context, secretName string) (*Secret, error)
	SetSecret(ctx context.Context, path string, secret []byte) error
	RemoveSecret(ctx context.Context, path string) error
	ListSecretPermissions(ctx context.Context, path string) ([]*SecretPermission, error)
	SetSecretPermission(ctx context.Context, path, userEmail, permission string) error
	RemoveSecretPermission(ctx context.Context, path, userEmail string) error
	AccountResetRequestToken(ctx context.Context, userEmail string) error
	AccountReset(ctx context.Context, userEmail, token, password string) error
	StreamLogs(ctx context.Context, buildID string, deltas chan []*logstream.Delta) error
}

Client contains gRPC and REST endpoints to the Earthly Cloud backend.

func NewClient

func NewClient(httpAddr, grpcAddr string, useInsecure bool, agentSockPath, authCredsOverride, authJWTOverride, installationName, requestID string, warnFunc func(string, ...interface{})) (Client, error)

NewClient provides a new Earthly Cloud client

type EarthlyAnalytics

type EarthlyAnalytics struct {
	Key              string                    `json:"key"`
	InstallID        string                    `json:"install_id"`
	Version          string                    `json:"version"`
	Platform         string                    `json:"platform"`
	BuildkitPlatform string                    `json:"buildkit_platform"`
	UserPlatform     string                    `json:"user_platform"`
	GitSHA           string                    `json:"git_sha"`
	ExitCode         int                       `json:"exit_code"`
	CI               string                    `json:"ci_name"`
	IsSatellite      bool                      `json:"is_satellite"`
	SatelliteVersion string                    `json:"satellite_version"`
	IsRemoteBuildkit bool                      `json:"is_remote_buildkit"`
	RepoHash         string                    `json:"repo_hash"`
	ExecutionSeconds float64                   `json:"execution_seconds"`
	Terminal         bool                      `json:"terminal"`
	Counts           map[string]map[string]int `json:"counts"`
}

EarthlyAnalytics is the payload used in SendAnalytics. It contains information about the command that was run, the environment it was run in, and the result of the command.

type OrgDetail

type OrgDetail struct {
	ID    string
	Name  string
	Admin bool
}

OrgDetail contains an organization and details

type OrgInvitation added in v0.6.20

type OrgInvitation struct {
	Name       string
	Email      string
	Permission string
	Message    string
	OrgName    string
	CreatedAt  time.Time
	AcceptedAt time.Time
}

OrgInvitation can be used to invite a user to become a member in an org.

type OrgMember added in v0.6.21

type OrgMember struct {
	UserEmail  string
	Permission string
	OrgName    string
}

OrgMember represents a user that belongs to an org

type OrgPermissions

type OrgPermissions struct {
	User  string
	Path  string
	Write bool
}

OrgPermissions contains permission details within an org

type Project added in v0.6.20

type Project struct {
	ID         string
	Name       string
	OrgName    string
	CreatedAt  time.Time
	ModifiedAt time.Time
}

Project contains information about the org project.

type ProjectMember added in v0.6.20

type ProjectMember struct {
	UserID     string
	UserEmail  string
	UserName   string
	Permission string
	CreatedAt  time.Time
	ModifiedAt time.Time
}

ProjectMember contains information about the project member.

type SatelliteInstance added in v0.6.16

type SatelliteInstance struct {
	Name                   string
	Org                    string
	State                  string
	Platform               string
	Size                   string
	Version                string
	VersionPinned          bool
	FeatureFlags           []string
	MaintenanceWindowStart string
	MaintenanceWindowEnd   string
	RevisionID             int32
}

SatelliteInstance contains details about a remote Buildkit instance.

type SatelliteStatusUpdate added in v0.6.28

type SatelliteStatusUpdate struct {
	State string
	Err   error
}

type Secret added in v0.6.20

type Secret struct {
	Path       string
	Value      string
	CreatedAt  time.Time
	ModifiedAt time.Time
}

Secret represents a Cloud secret with a path key and a string value.

type SecretPermission added in v0.6.20

type SecretPermission struct {
	Path       string
	UserEmail  string
	Permission string
	CreatedAt  time.Time
	ModifiedAt time.Time
}

SecretPermission contains information about a user-specific secret permission override.

type TokenDetail

type TokenDetail struct {
	Name   string
	Write  bool
	Expiry time.Time
}

TokenDetail contains token information

Jump to

Keyboard shortcuts

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