Documentation ¶
Overview ¶
Package client provides a REST client for API requests to the server.
Index ¶
- Variables
- type Communicator
- type Mock
- func (c *Mock) AddPublicKey(ctx context.Context, keyName, keyValue string) error
- func (*Mock) AttachVolume(context.Context, string, *host.VolumeAttachment) error
- func (*Mock) ChangeSpawnHostPassword(context.Context, string, string) error
- func (c *Mock) Close()
- func (c *Mock) CreatePatchForMerge(ctx context.Context, patchID, commitMessage string) (*model.APIPatch, error)
- func (*Mock) CreateSpawnHost(ctx context.Context, spawnRequest *model.HostRequestOptions) (*model.APIHost, error)
- func (c *Mock) CreateVersionFromConfig(ctx context.Context, project, message string, active bool, config []byte) (*serviceModel.Version, error)
- func (*Mock) CreateVolume(context.Context, *host.Volume) (*model.APIVolume, error)
- func (c *Mock) DeleteCommitQueueItem(ctx context.Context, item string) error
- func (c *Mock) DeletePublicKey(ctx context.Context, keyName string) error
- func (c *Mock) DeleteServiceUser(context.Context, string) error
- func (*Mock) DeleteVolume(context.Context, string) error
- func (*Mock) DetachVolume(context.Context, string, string) error
- func (c *Mock) EnqueueItem(ctx context.Context, patchID string, force bool) (int, error)
- func (*Mock) ExtendSpawnHostExpiration(context.Context, string, int) error
- func (*Mock) FindHostByIpAddress(context.Context, string) error
- func (c *Mock) GetBannerMessage(ctx context.Context) (string, error)
- func (c *Mock) GetClientConfig(ctx context.Context) (*evergreen.ClientConfig, error)
- func (c *Mock) GetClientURLs(context.Context, string) ([]string, error)
- func (c *Mock) GetCommitQueue(ctx context.Context, projectID string) (*model.APICommitQueue, error)
- func (c *Mock) GetCurrentUsersKeys(ctx context.Context) ([]model.APIPubKey, error)
- func (c *Mock) GetDistroByName(context.Context, string) (*model.APIDistro, error)
- func (c *Mock) GetDistrosList(ctx context.Context) ([]model.APIDistro, error)
- func (c *Mock) GetEvents(ctx context.Context, ts time.Time, limit int) ([]interface{}, error)
- func (c *Mock) GetHostProcessOutput(context.Context, []model.APIHostProcess, int) ([]model.APIHostProcess, error)
- func (c *Mock) GetHostProvisioningOptions(ctx context.Context, hostID, hostSecret string) (*restmodel.APIHostProvisioningOptions, error)
- func (c *Mock) GetHosts(ctx context.Context, data model.APIHostParams) ([]*model.APIHost, error)
- func (c *Mock) GetManifestByTask(context.Context, string) (*manifest.Manifest, error)
- func (c *Mock) GetMatchingHosts(context.Context, time.Time, time.Time, string, bool) ([]string, error)
- func (c *Mock) GetMessageForPatch(context.Context, string) (string, error)
- func (c *Mock) GetParameters(context.Context, string) ([]serviceModel.ParameterInfo, error)
- func (c *Mock) GetRawPatchWithModules(context.Context, string) (*restmodel.APIRawPatch, error)
- func (c *Mock) GetRecentVersionsForProject(context.Context, string, string) ([]restmodel.APIVersion, error)
- func (c *Mock) GetServiceFlags(ctx context.Context) (*model.APIServiceFlags, error)
- func (c *Mock) GetServiceUsers(context.Context) ([]model.APIDBUser, error)
- func (c *Mock) GetSettings(ctx context.Context) (*evergreen.Settings, error)
- func (*Mock) GetSpawnHost(ctx context.Context, hostID string) (*model.APIHost, error)
- func (c *Mock) GetSubscriptions(_ context.Context) ([]event.Subscription, error)
- func (c *Mock) GetTaskSyncPath(context.Context, string) (string, error)
- func (c *Mock) GetTaskSyncReadCredentials(context.Context) (*evergreen.S3Credentials, error)
- func (c *Mock) GetVolume(context.Context, string) (*model.APIVolume, error)
- func (*Mock) GetVolumesByUser(context.Context) ([]model.APIVolume, error)
- func (c *Mock) ListAliases(ctx context.Context, keyName string) ([]serviceModel.ProjectAlias, error)
- func (c *Mock) ListPatchTriggerAliases(ctx context.Context, project string) ([]string, error)
- func (*Mock) ModifySpawnHost(ctx context.Context, hostID string, changes host.HostModifyOptions) error
- func (*Mock) ModifyVolume(context.Context, string, *model.VolumeModifyOptions) error
- func (c *Mock) PostHostIsUp(ctx context.Context, hostID, hostSecret, instanceID string) (*restmodel.APIHost, error)
- func (c *Mock) RestartRecentTasks(ctx context.Context, starAt, endAt time.Time) error
- func (c *Mock) RevertSettings(ctx context.Context, guid string) error
- func (c *Mock) SendNotification(_ context.Context, _ string, _ interface{}) error
- func (c *Mock) SetAPIKey(apiKey string)
- func (c *Mock) SetAPIUser(apiUser string)
- func (c *Mock) SetBannerMessage(ctx context.Context, m string, t evergreen.BannerTheme) error
- func (c *Mock) SetMaxAttempts(attempts int)
- func (c *Mock) SetServiceFlags(ctx context.Context, f *model.APIServiceFlags) error
- func (c *Mock) SetTimeoutMax(timeoutMax time.Duration)
- func (c *Mock) SetTimeoutStart(timeoutStart time.Duration)
- func (c *Mock) StartHostProcesses(context.Context, []string, string, int) ([]model.APIHostProcess, error)
- func (*Mock) StartSpawnHost(context.Context, string, string, bool) error
- func (*Mock) StopSpawnHost(context.Context, string, string, bool) error
- func (*Mock) TerminateSpawnHost(ctx context.Context, hostID string) error
- func (c *Mock) UpdateServiceUser(context.Context, string, string, []string) error
- func (c *Mock) UpdateSettings(ctx context.Context, update *model.APIAdminSettings) (*model.APIAdminSettings, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var AuthError = "Possibly user credentials are expired, try logging in again via the Evergreen web UI."
AuthError is a special error when the CLI receives 401 Unauthorized to suggest logging in again as a possible solution to the error.
Functions ¶
This section is empty.
Types ¶
type Communicator ¶
type Communicator interface { // Setters // // SetTimeoutStart sets the initial timeout for a request. SetTimeoutStart(time.Duration) // SetTimeoutMax sets the maximum timeout for a request. SetTimeoutMax(time.Duration) // SetMaxAttempts sets the number of attempts a request will be made. SetMaxAttempts(int) // Client Configuration methods // SetAPIUser(string) SetAPIKey(string) // Method to release resources used by the communicator. Close() // Admin methods // SetBannerMessage(context.Context, string, evergreen.BannerTheme) error GetBannerMessage(context.Context) (string, error) GetUiV2URL(context.Context) (string, error) SetServiceFlags(context.Context, *restmodel.APIServiceFlags) error GetServiceFlags(context.Context) (*restmodel.APIServiceFlags, error) RestartRecentTasks(context.Context, time.Time, time.Time) error GetSettings(context.Context) (*evergreen.Settings, error) UpdateSettings(context.Context, *restmodel.APIAdminSettings) (*restmodel.APIAdminSettings, error) GetEvents(context.Context, time.Time, int) ([]interface{}, error) RevertSettings(context.Context, string) error GetServiceUsers(ctx context.Context) ([]restmodel.APIDBUser, error) UpdateServiceUser(context.Context, string, string, []string) error DeleteServiceUser(context.Context, string) error // Spawnhost methods // CreateSpawnHost(context.Context, *restmodel.HostRequestOptions) (*restmodel.APIHost, error) GetSpawnHost(context.Context, string) (*restmodel.APIHost, error) ModifySpawnHost(context.Context, string, host.HostModifyOptions) error StopSpawnHost(context.Context, string, string, bool) error StartSpawnHost(context.Context, string, string, bool) error TerminateSpawnHost(context.Context, string) error ChangeSpawnHostPassword(context.Context, string, string) error ExtendSpawnHostExpiration(context.Context, string, int) error GetHosts(context.Context, restmodel.APIHostParams) ([]*restmodel.APIHost, error) AttachVolume(context.Context, string, *host.VolumeAttachment) error DetachVolume(context.Context, string, string) error CreateVolume(context.Context, *host.Volume) (*restmodel.APIVolume, error) DeleteVolume(context.Context, string) error ModifyVolume(context.Context, string, *restmodel.VolumeModifyOptions) error GetVolume(context.Context, string) (*restmodel.APIVolume, error) GetVolumesByUser(context.Context) ([]restmodel.APIVolume, error) StartHostProcesses(context.Context, []string, string, int) ([]restmodel.APIHostProcess, error) GetHostProcessOutput(context.Context, []restmodel.APIHostProcess, int) ([]restmodel.APIHostProcess, error) FindHostByIpAddress(context.Context, string) (*restmodel.APIHost, error) // Fetch list of distributions evergreen can spawn GetDistrosList(context.Context) ([]restmodel.APIDistro, error) // Fetch the current authenticated user's public keys GetCurrentUsersKeys(context.Context) ([]restmodel.APIPubKey, error) AddPublicKey(context.Context, string, string) error // Delete a key with specified name from the current authenticated user DeletePublicKey(context.Context, string) error // List variant/task aliases ListAliases(context.Context, string) ([]model.ProjectAlias, error) ListPatchTriggerAliases(context.Context, string) ([]string, error) GetDistroByName(context.Context, string) (*restmodel.APIDistro, error) // Get parameters for project GetParameters(context.Context, string) ([]model.ParameterInfo, error) // GetClientConfig fetches the ClientConfig for the evergreen server GetClientConfig(context.Context) (*evergreen.ClientConfig, error) // GetSubscriptions fetches the subscriptions for the user defined // in the local evergreen yaml GetSubscriptions(context.Context) ([]event.Subscription, error) // CreateVersionFromConfig takes an evergreen config and makes runnable tasks from it CreateVersionFromConfig(context.Context, string, string, bool, []byte) (*model.Version, error) // Commit Queue GetCommitQueue(ctx context.Context, projectID string) (*restmodel.APICommitQueue, error) DeleteCommitQueueItem(ctx context.Context, item string) error // if enqueueNext is true then allow item to be processed next EnqueueItem(ctx context.Context, patchID string, enqueueNext bool) (int, error) CreatePatchForMerge(ctx context.Context, patchID, commitMessage string) (*restmodel.APIPatch, error) GetMessageForPatch(ctx context.Context, patchID string) (string, error) // Notifications SendNotification(ctx context.Context, notificationType string, data interface{}) error // GetManifestByTask returns the manifest corresponding to the given task GetManifestByTask(ctx context.Context, taskId string) (*manifest.Manifest, error) GetRecentVersionsForProject(ctx context.Context, projectID, requester string) ([]restmodel.APIVersion, error) // GetTaskSyncReadCredentials returns the credentials to fetch task // directory from S3. GetTaskSyncReadCredentials(ctx context.Context) (*evergreen.S3Credentials, error) // GetTaskSyncPath returns the path to the task directory in S3. GetTaskSyncPath(ctx context.Context, taskID string) (string, error) // GetClientURLs returns the all URLs that can be used to request the // Evergreen binary for a given distro. GetClientURLs(ctx context.Context, distroID string) ([]string, error) // PostHostIsUp indicates to the app server that the task host is up and // running. PostHostIsUp(ctx context.Context, hostID, hostSecret, instanceID string) (*restmodel.APIHost, error) // GetHostProvisioningOptions gets the options to provision a host. GetHostProvisioningOptions(ctx context.Context, hostID, hostSecret string) (*restmodel.APIHostProvisioningOptions, error) // CompareTasks returns the order that the given tasks would be scheduled, along with the scheduling logic. CompareTasks(context.Context, []string, bool) ([]string, map[string]map[string]string, error) // GetRawPatchWithModules fetches the raw patch and module diffs for a given patch ID. GetRawPatchWithModules(ctx context.Context, patchId string) (*restmodel.APIRawPatch, error) }
Communicator is an interface for communicating with the API server.
func NewCommunicator ¶
func NewCommunicator(serverURL string) (Communicator, error)
NewCommunicator returns a Communicator capable of making HTTP REST requests against the API server. To change the default retry behavior, use the SetTimeoutStart, SetTimeoutMax, and SetMaxAttempts methods.
type Mock ¶
type Mock struct { // mock behavior GetSubscriptionsFail bool // contains filtered or unexported fields }
Mock mocks EvergreenREST for testing.
func (*Mock) AddPublicKey ¶
func (*Mock) AttachVolume ¶
func (*Mock) ChangeSpawnHostPassword ¶
func (*Mock) CreatePatchForMerge ¶
func (*Mock) CreateSpawnHost ¶
func (*Mock) CreateSpawnHost(ctx context.Context, spawnRequest *model.HostRequestOptions) (*model.APIHost, error)
CreateSpawnHost will return a mock host that would have been intended
func (*Mock) CreateVersionFromConfig ¶
func (*Mock) CreateVolume ¶
func (*Mock) DeleteCommitQueueItem ¶
func (*Mock) DeletePublicKey ¶
func (*Mock) EnqueueItem ¶
func (*Mock) ExtendSpawnHostExpiration ¶
func (*Mock) GetBannerMessage ¶
func (*Mock) GetClientConfig ¶
func (*Mock) GetClientURLs ¶
func (*Mock) GetCommitQueue ¶
func (*Mock) GetCurrentUsersKeys ¶
func (*Mock) GetDistroByName ¶
func (*Mock) GetDistrosList ¶
func (*Mock) GetHostProcessOutput ¶
func (c *Mock) GetHostProcessOutput(context.Context, []model.APIHostProcess, int) ([]model.APIHostProcess, error)
func (*Mock) GetHostProvisioningOptions ¶
func (*Mock) GetManifestByTask ¶
func (*Mock) GetMatchingHosts ¶
func (*Mock) GetMessageForPatch ¶
func (*Mock) GetParameters ¶
func (c *Mock) GetParameters(context.Context, string) ([]serviceModel.ParameterInfo, error)
func (*Mock) GetRawPatchWithModules ¶
func (*Mock) GetRecentVersionsForProject ¶
func (*Mock) GetServiceFlags ¶
func (*Mock) GetServiceUsers ¶
func (*Mock) GetSettings ¶
func (*Mock) GetSpawnHost ¶
func (*Mock) GetSubscriptions ¶
func (*Mock) GetTaskSyncPath ¶
func (*Mock) GetTaskSyncReadCredentials ¶
func (*Mock) GetVolumesByUser ¶
func (*Mock) ListAliases ¶
func (c *Mock) ListAliases(ctx context.Context, keyName string) ([]serviceModel.ProjectAlias, error)
func (*Mock) ListPatchTriggerAliases ¶
func (*Mock) ModifySpawnHost ¶
func (*Mock) ModifyVolume ¶
func (*Mock) PostHostIsUp ¶
func (*Mock) RestartRecentTasks ¶
func (*Mock) SendNotification ¶
func (*Mock) SetAPIUser ¶
func (*Mock) SetBannerMessage ¶
func (*Mock) SetMaxAttempts ¶
func (*Mock) SetServiceFlags ¶
func (*Mock) SetTimeoutMax ¶
func (*Mock) SetTimeoutStart ¶
func (*Mock) StartHostProcesses ¶
func (*Mock) StartSpawnHost ¶
func (*Mock) StopSpawnHost ¶
func (*Mock) TerminateSpawnHost ¶
func (*Mock) UpdateServiceUser ¶
func (*Mock) UpdateSettings ¶
func (c *Mock) UpdateSettings(ctx context.Context, update *model.APIAdminSettings) (*model.APIAdminSettings, error)
Click to show internal directories.
Click to hide internal directories.