Documentation ¶
Index ¶
- Constants
- Variables
- func IsValidEmail(ctx context.Context, email string) bool
- func LocalMaintenanceWindowToUTC(window string, loc *time.Location) (string, error)
- func UTCMaintenanceWindowToLocal(window string, loc *time.Location) (string, error)
- func ValidSatellitePlatform(size string) bool
- func ValidSatelliteSize(size string) bool
- type AuthMethod
- type Client
- func (c *Client) AcceptInvite(ctx context.Context, inviteCode string) error
- func (c *Client) AccountReset(ctx context.Context, email, token, password string) error
- func (c *Client) AccountResetRequestToken(ctx context.Context, email string) error
- func (c *Client) AddProjectMember(ctx context.Context, orgName, name, userEmail, permission string) error
- func (c *Client) AddPublicKey(ctx context.Context, key string) error
- func (c *Client) Authenticate(ctx context.Context) (AuthMethod, error)
- func (c *Client) AutoSkipAdd(ctx context.Context, org, path, target string, hash []byte) error
- func (c *Client) AutoSkipExists(ctx context.Context, org string, hash []byte) (bool, error)
- func (c *Client) AutoSkipPrune(ctx context.Context, org, pathPrefix, target string, deep bool) (int, error)
- func (c *Client) CreateAccount(ctx context.Context, email, verificationToken, password, publicKey string, ...) error
- func (c *Client) CreateOrg(ctx context.Context, org string) error
- func (c *Client) CreateProject(ctx context.Context, name, orgName string) (*Project, error)
- func (c *Client) CreateToken(ctx context.Context, name string, write bool, expiry *time.Time, ...) (string, error)
- func (c *Client) DeleteAuthCache(ctx context.Context) error
- func (c *Client) DeleteCachedToken(ctx context.Context) error
- func (c *Client) DeleteProject(ctx context.Context, orgName, name string) error
- func (c *Client) DeleteSatellite(ctx context.Context, name, orgName string, force bool) error
- func (c *Client) DisableAutoLogin(ctx context.Context) error
- func (c *Client) DisableSSHKeyGuessing(ctx context.Context)
- func (c *Client) EnableAutoLogin(ctx context.Context) error
- func (c *Client) FindSSHCredentials(ctx context.Context, emailToFind string) error
- func (c *Client) Get(ctx context.Context, path string) ([]byte, error)
- func (c *Client) GetAuthToken(ctx context.Context) (string, error)
- func (c *Client) GetBillingPlan(ctx context.Context, org string) (*billing.GetBillingPlanResponse, error)
- func (c *Client) GetOrgID(ctx context.Context, orgName string) (string, error)
- func (c *Client) GetProject(ctx context.Context, orgName, name string) (*Project, error)
- func (c *Client) GetProjectSecret(ctx context.Context, org, project, secretName string) (*Secret, error)
- func (c *Client) GetPublicKeys(ctx context.Context) ([]*agent.Key, error)
- func (c *Client) GetSatellite(ctx context.Context, name, orgName string) (*SatelliteInstance, error)
- func (c *Client) GetUserOrProjectSecret(ctx context.Context, path string) (*Secret, error)
- func (c *Client) GetUserSecret(ctx context.Context, secretName string) (*Secret, error)
- func (c *Client) GuessOrgMembership(ctx context.Context) (orgName, orgID string, err error)
- func (c *Client) Invite(ctx context.Context, path, user string, write bool) error
- func (c *Client) InviteToOrg(ctx context.Context, invite *OrgInvitation) (string, error)
- func (c *Client) IsAutoLoginPermitted(ctx context.Context) (bool, error)
- func (c *Client) IsLoggedIn(ctx context.Context) bool
- func (c *Client) LaunchSatellite(ctx context.Context, opt LaunchSatelliteOpt) error
- func (c *Client) List(ctx context.Context, path string) ([]string, error)
- func (c *Client) ListInvites(ctx context.Context, org string) ([]*OrgInvitation, error)
- func (c *Client) ListOrgMembers(ctx context.Context, orgName string) ([]*OrgMember, error)
- func (c *Client) ListOrgPermissions(ctx context.Context, path string) ([]*OrgPermissions, error)
- func (c *Client) ListOrgs(ctx context.Context) ([]*OrgDetail, error)
- func (c *Client) ListPipelines(ctx context.Context, project, org, earthfileHash string) ([]Pipeline, error)
- func (c *Client) ListProjectMembers(ctx context.Context, orgName, name string) ([]*ProjectMember, error)
- func (c *Client) ListProjects(ctx context.Context, orgName string) ([]*Project, error)
- func (c *Client) ListPublicKeys(ctx context.Context) ([]string, error)
- func (c *Client) ListSatellites(ctx context.Context, orgName string, includeHidden bool) ([]SatelliteInstance, error)
- func (c *Client) ListSecretPermissions(ctx context.Context, path string) ([]*SecretPermission, error)
- func (c *Client) ListSecrets(ctx context.Context, path string) ([]*Secret, error)
- func (c *Client) ListTokens(ctx context.Context) ([]*TokenDetail, error)
- func (c *Client) RegisterEmail(ctx context.Context, email string) error
- func (c *Client) Remove(ctx context.Context, path string) error
- func (c *Client) RemoveOrgMember(ctx context.Context, orgName, userEmail string) error
- func (c *Client) RemoveProjectMember(ctx context.Context, orgName, name, userEmail string) error
- func (c *Client) RemovePublicKey(ctx context.Context, key string) error
- func (c *Client) RemoveSecret(ctx context.Context, path string) error
- func (c *Client) RemoveSecretPermission(ctx context.Context, path, userEmail string) error
- func (c *Client) RemoveToken(ctx context.Context, name string) error
- func (c *Client) ReserveSatellite(ctx context.Context, name, orgName, gitAuthor, gitConfigEmail string, ...) (out chan SatelliteStatusUpdate)
- func (c *Client) RevokePermission(ctx context.Context, path, user string) error
- func (c *Client) SendAnalytics(ctx context.Context, data *analytics.SendAnalyticsRequest) error
- func (c *Client) Set(ctx context.Context, path string, data []byte) error
- func (c *Client) SetAuthTokenDir(ctx context.Context, path string)
- func (c *Client) SetPasswordCredentials(ctx context.Context, email, password string) error
- func (c *Client) SetSSHCredentials(ctx context.Context, email, sshKey string) error
- func (c *Client) SetSecret(ctx context.Context, path string, secret []byte) error
- func (c *Client) SetSecretPermission(ctx context.Context, path, userEmail, permission string) error
- func (c *Client) SetTokenCredentials(ctx context.Context, token string) (string, error)
- func (c *Client) SleepSatellite(ctx context.Context, name, orgName string) (out chan SatelliteStatusUpdate)
- func (c *Client) StreamInterceptor() grpc.StreamClientInterceptor
- func (c *Client) StreamLogs(ctx context.Context, man *pb.RunManifest, ch <-chan *pb.Delta) <-chan error
- func (c *Client) UnaryInterceptor(opts ...InterceptorOpt) grpc.UnaryClientInterceptor
- func (c *Client) UpdateOrgMember(ctx context.Context, orgName, userEmail, permission string) error
- func (c *Client) UpdateProjectMember(ctx context.Context, orgName, name, userEmail, permission string) error
- func (c *Client) UpdateSatellite(ctx context.Context, opt UpdateSatelliteOpt) error
- func (c *Client) UploadLog(ctx context.Context, pathOnDisk string) (string, error)
- func (c *Client) WakeSatellite(ctx context.Context, name, orgName string) (out chan SatelliteStatusUpdate)
- func (c *Client) WhoAmI(ctx context.Context) (string, AuthMethod, bool, error)
- type ClientOpt
- type InterceptorOpt
- type LaunchSatelliteOpt
- type OrgDetail
- type OrgInvitation
- type OrgMember
- type OrgPermissions
- type Pipeline
- type PipelineArg
- type PipelineTrigger
- type Project
- type ProjectMember
- type SatelliteInstance
- type SatelliteStatusUpdate
- type Secret
- type SecretPermission
- type StreamError
- type TokenDetail
- type UpdateSatelliteOpt
Constants ¶
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" )
const ( SatelliteSizeXSmall = "xsmall" SatelliteSizeSmall = "small" SatelliteSizeMedium = "medium" SatelliteSizeLarge = "large" SatelliteSizeXLarge = "xlarge" SatelliteSize2XLarge = "2xlarge" SatelliteSize3XLarge = "3xlarge" SatelliteSize4XLarge = "4xlarge" )
const ( SatellitePlatformAMD64 = "linux/amd64" SatellitePlatformARM64 = "linux/arm64" )
const DefaultSatelliteSize = SatelliteSizeMedium
Variables ¶
var ( // ErrUnauthorized occurs when a user is unauthorized to access a resource ErrAuthTokenExpired = errors.New("auth token expired") // ErrNoAuthorizedPublicKeys occurs when no authorized public keys are found ErrNoAuthorizedPublicKeys = errors.New("no authorized public keys found") ErrNotFound = errors.Errorf("not found") ErrMalformedSecretPath = errors.Errorf("malformed secret path") )
var ErrNoSSHAgent = errors.Errorf("no ssh auth agent socket")
ErrNoSSHAgent occurs when no ssh auth agent exists
var RPCErrRegex = regexp.MustCompile(`(?U)rpc error: code = .+ desc = `)
Functions ¶
func IsValidEmail ¶
IsValidEmail returns true if email is valid
func LocalMaintenanceWindowToUTC ¶ added in v0.7.0
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
UTCMaintenanceWindowToLocal checks if the provided maintenance window is valid and returns a new maintenance window converted from local time to UTC format.
func ValidSatellitePlatform ¶ added in v0.7.0
func ValidSatelliteSize ¶ added in v0.7.0
Types ¶
type AuthMethod ¶ added in v0.7.13
type AuthMethod string
const ( AuthMethodSSH AuthMethod = "ssh" AuthMethodPassword AuthMethod = "password" AuthMethodToken AuthMethod = "token" AuthMethodCachedJWT AuthMethod = "cached jwt" )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(httpAddr, grpcAddr string, useInsecure bool, agentSockPath, authCredsOverride, authJWTOverride, installationName, requestID string, warnFunc func(string, ...interface{}), debugFunc func(string, ...interface{}), serverConnTimeout time.Duration, opts ...ClientOpt) (*Client, error)
NewClient provides a new Earthly Cloud client
func (*Client) AcceptInvite ¶ added in v0.6.21
AcceptInvite accepts the org invitation and adds the user to the org.
func (*Client) AccountReset ¶ added in v0.6.21
func (*Client) AccountResetRequestToken ¶ added in v0.6.29
func (*Client) AddProjectMember ¶ added in v0.6.20
func (c *Client) AddProjectMember(ctx context.Context, orgName, name, userEmail, permission string) error
AddProjectMember adds a new member to the project by email or user ID.
func (*Client) AddPublicKey ¶ added in v0.6.27
func (*Client) Authenticate ¶
func (c *Client) Authenticate(ctx context.Context) (AuthMethod, error)
Authenticate fetches a new auth token from the server and saves it to the client. The user should have credentials store on disk within the ~/.earthly directory. Credentials may be either email/password, ssh-based, or a custom token. Upon successful authenticate, the JWT provided by the server is stored in ~/.earthly/auth.jwt, and can be refreshed any time via another call to Authenticate().
func (*Client) AutoSkipAdd ¶ added in v0.7.6
func (*Client) AutoSkipExists ¶ added in v0.7.6
func (*Client) AutoSkipPrune ¶ added in v0.7.23
func (*Client) CreateAccount ¶
func (*Client) CreateProject ¶ added in v0.6.20
CreateProject creates a new project within the specified organization.
func (*Client) CreateToken ¶
func (*Client) DeleteProject ¶ added in v0.6.20
DeleteProject deletes a given project by name.
func (*Client) DeleteSatellite ¶ added in v0.6.16
func (*Client) DisableAutoLogin ¶ added in v0.7.9
func (*Client) DisableSSHKeyGuessing ¶
func (*Client) EnableAutoLogin ¶ added in v0.7.9
func (*Client) FindSSHCredentials ¶
func (*Client) GetBillingPlan ¶ added in v0.7.22
func (*Client) GetProject ¶ added in v0.6.20
GetProject loads a single project from the projects endpoint.
func (*Client) GetProjectSecret ¶ added in v0.7.0
func (c *Client) GetProjectSecret(ctx context.Context, org, project, secretName string) (*Secret, error)
GetProjectSecret gets a secret from a project secret store
func (*Client) GetPublicKeys ¶
func (*Client) GetSatellite ¶ added in v0.6.16
func (*Client) GetUserOrProjectSecret ¶ added in v0.7.0
GetUserOrProjectSecret gets a secret from a project or the current user's personal secret store, depending on the path being structured as /org/project/... or /user/... respectively.
func (*Client) GetUserSecret ¶ added in v0.7.0
GetUserSecret gets a secret from the current user's personal secret store
func (*Client) GuessOrgMembership ¶ added in v0.7.9
GuessOrgMembership returns an org name and ID if the user belongs to a single org Deprecated: we should stop "guessing" org membership and have the user always specify they want to use. A future `org select` command would make specifying the org easier.
func (*Client) InviteToOrg ¶ added in v0.6.20
InviteToOrg sends an email invitation to a user and asks for them to join an org.
func (*Client) IsAutoLoginPermitted ¶ added in v0.7.9
func (*Client) LaunchSatellite ¶ added in v0.6.16
func (c *Client) LaunchSatellite(ctx context.Context, opt LaunchSatelliteOpt) error
func (*Client) ListInvites ¶ added in v0.6.24
ListInvites returns a collection of organization invites and their status.
func (*Client) ListOrgMembers ¶ added in v0.6.21
ListOrgMembers returns a collection of org members.
func (*Client) ListOrgPermissions ¶
ListOrgPermissions returns all configured permissions for the org.
func (*Client) ListPipelines ¶ added in v0.7.3
func (*Client) ListProjectMembers ¶ added in v0.6.20
func (c *Client) ListProjectMembers(ctx context.Context, orgName, name string) ([]*ProjectMember, error)
ListProjectMembers will return all project members if the user has permission to do so.
func (*Client) ListProjects ¶ added in v0.6.20
ListProjects returns all projects in the organization that are visible to the logged-in user.
func (*Client) ListPublicKeys ¶
func (*Client) ListSatellites ¶ added in v0.6.16
func (*Client) ListSecretPermissions ¶ added in v0.6.20
func (c *Client) ListSecretPermissions(ctx context.Context, path string) ([]*SecretPermission, error)
ListSecretPermissions returns a set of user permissions for project secrets.
func (*Client) ListSecrets ¶ added in v0.6.20
ListSecrets returns a list of secrets base on the given path.
func (*Client) ListTokens ¶
func (c *Client) ListTokens(ctx context.Context) ([]*TokenDetail, error)
func (*Client) RegisterEmail ¶
func (*Client) RemoveOrgMember ¶ added in v0.6.21
RemoveOrgMember removes a member from the org.
func (*Client) RemoveProjectMember ¶ added in v0.6.20
RemoveProjectMember will remove a member from a project.
func (*Client) RemovePublicKey ¶ added in v0.6.27
func (*Client) RemoveSecret ¶ added in v0.6.20
RemoveSecret deletes a secret by path name.
func (*Client) RemoveSecretPermission ¶ added in v0.6.20
RemoveSecretPermission removes a secret permission for the user and path.
func (*Client) ReserveSatellite ¶ added in v0.6.24
func (*Client) RevokePermission ¶
RevokePermission removes the org permission from the user.
func (*Client) SendAnalytics ¶
SendAnalytics send an analytics event to the Cloud server.
func (*Client) SetPasswordCredentials ¶
func (*Client) SetSSHCredentials ¶
func (*Client) SetSecret ¶ added in v0.6.20
SetSecret adds or updates the given path and secret combination.
func (*Client) SetSecretPermission ¶ added in v0.6.20
SetSecretPermission is used to set a user permission on a given secret path.
func (*Client) SetTokenCredentials ¶
func (*Client) SleepSatellite ¶ added in v0.6.29
func (c *Client) SleepSatellite(ctx context.Context, name, orgName string) (out chan SatelliteStatusUpdate)
func (*Client) StreamInterceptor ¶ added in v0.7.0
func (c *Client) StreamInterceptor() grpc.StreamClientInterceptor
StreamInterceptor is a stream middleware function for the Earthly gRPC client which handle re-authentication when necessary, and automatically prints requestIDs to errors when errors are received from the server.
func (*Client) StreamLogs ¶ added in v0.6.30
func (*Client) UnaryInterceptor ¶ added in v0.7.0
func (c *Client) UnaryInterceptor(opts ...InterceptorOpt) grpc.UnaryClientInterceptor
UnaryInterceptor is a unary middleware function for the Earthly gRPC client which handle re-authentication when necessary, and automatically prints requestIDs to errors when errors are received from the server.
func (*Client) UpdateOrgMember ¶ added in v0.6.21
UpdateOrgMember updates a member's permission in an org.
func (*Client) UpdateProjectMember ¶ added in v0.6.20
func (c *Client) UpdateProjectMember(ctx context.Context, orgName, name, userEmail, permission string) error
UpdateProjectMember updates an existing member with the new permission
func (*Client) UpdateSatellite ¶ added in v0.7.0
func (c *Client) UpdateSatellite(ctx context.Context, opt UpdateSatelliteOpt) error
func (*Client) WakeSatellite ¶ added in v0.6.28
func (c *Client) WakeSatellite(ctx context.Context, name, orgName string) (out chan SatelliteStatusUpdate)
type ClientOpt ¶ added in v0.7.1
type ClientOpt func(*Client)
ClientOpt is used to customize the Cloud client.
func WithAuthToken ¶ added in v0.8.0
WithAuthToken can be used to ignore other authentication mechanisms besides the given token. Any previously set JWT tokens are cleared.
func WithLogstreamGRPCAddressOverride ¶ added in v0.7.1
WithLogstreamGRPCAddressOverride can be used to override the Logstream gRPC address.
type InterceptorOpt ¶ added in v0.7.0
type InterceptorOpt func(opt *interceptorOpts)
func WithSkipAuth ¶ added in v0.7.0
func WithSkipAuth(methods ...string) InterceptorOpt
type LaunchSatelliteOpt ¶ added in v0.7.0
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 OrgPermissions ¶
OrgPermissions contains permission details within an org
type PipelineArg ¶ added in v0.7.3
type PipelineTrigger ¶ added in v0.7.3
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 MaintenanceWeekendsOnly bool RevisionID int32 Hidden bool LastUsed time.Time CacheRetention time.Duration Address string IsManaged bool Certificate *pb.TLSCertificate }
SatelliteInstance contains details about a remote Buildkit instance.
type SatelliteStatusUpdate ¶ added in v0.6.28
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 StreamError ¶ added in v0.7.19
func (*StreamError) Error ¶ added in v0.7.19
func (s *StreamError) Error() string