Documentation ¶
Overview ¶
Adding Models
Each model is kept in the model package of the REST v2 API in its own file. To create a new model, define a struct containing all of the fields that it will return and implement its two main interface methods BuildFromService and ToService. Be sure to include struct tags to the define the names the fields will have when serialized to JSON.
Guidelines for Creating Models ¶
Include as much data as a user is likely to want when inspecting this resource. This is likely to be more information than seems directly needed, but there is little penalty to its inclusion.
Use APIString instead of Golang's string type. APIString serializes empty strings as JSON null instead of Go's zero type of '""'.
Use APITime instead of go's time type. APITime is a type that wraps Go's time.Time and automatically and correctly serializes it to ISO-8601 UTC time.
Return an error when type casting fails.
Model Methods ¶
The Model type is an interface with two methods.
BuildFromService(in interface{}) error
BuildFromService fetches all needed data from the passed in object and sets them on the model. BuildFromService may sometimes be called multiple times with different types that all contain data to build up the model object. In this case, a type switch is likely necessary to determine what has been passed in.
ToService()(interface{}, error)
ToService creates an as-complete-as-possible version of the service layer's version of this model. For example, if this is is a REST v2 Task model, the ToService method creates a service layer Task and sets all of the fields it is able to and returns it.
Index ¶
- Constants
- func FromAPIString(in APIString) string
- func FromAPIStringList(in []APIString) []string
- func ParseTime(tval string) (time.Time, error)
- type APIAWSConfig
- type APIAdminEvent
- type APIAdminSettings
- type APIAlertsConfig
- type APIAmboyConfig
- type APIAuthConfig
- type APIAuthUser
- type APIBanner
- type APIBootstrapSettings
- type APIBuild
- type APICLIUpdate
- type APIClientBinary
- type APIClientConfig
- type APICloudProviders
- type APICommitQueue
- type APICommitQueueConfig
- type APICommitQueueItem
- type APICommitQueueItemAuthor
- type APICommitQueueParams
- type APICommitQueuePosition
- type APIContainerPool
- type APIContainerPoolsConfig
- type APIDistro
- type APIDistroCost
- type APIDockerConfig
- type APIDuration
- type APIEC2Key
- type APIEmail
- type APIEntry
- type APIEventStats
- type APIExpansion
- type APIFeedbackSubmission
- type APIFile
- type APIFinderSettings
- type APIGCEConfig
- type APIGithubAuthConfig
- type APIGithubHook
- type APIGithubMergeSubscriber
- type APIGithubPRSubscriber
- type APIGithubUser
- type APIHost
- type APIHostInitConfig
- type APIHostJasperConfig
- type APIHostStatsByDistro
- type APIJIRAIssueSubscriber
- type APIJIRANotificationsConfig
- type APIJiraComment
- type APIJiraConfig
- type APIJiraIssue
- type APILDAPConfig
- type APILogBuffering
- type APILoggerConfig
- type APIModule
- type APINaiveAuthConfig
- type APINotificationPreferences
- type APINotifyConfig
- type APIOpenStackConfig
- type APIPRInfo
- type APIPatch
- type APIPlannerSettings
- type APIProject
- type APIProjectAlias
- type APIProjectEvent
- type APIProjectRef
- type APIProjectSettings
- type APIProjectVars
- type APIPubKey
- type APIQuestionAnswer
- type APIRecentTaskStats
- type APIRecentTaskStatsList
- type APIRepoTrackerConfig
- type APISMTPConfig
- type APISchedulerConfig
- type APISelector
- type APIServiceFlags
- type APISlack
- type APISlackAttachment
- type APISlackAttachmentField
- type APISlackConfig
- type APISlackOptions
- type APISpawnHostModify
- type APISplunkConnectionInfo
- type APIStat
- type APIStatList
- type APIString
- type APISubscriber
- type APISubscription
- type APITask
- type APITaskCache
- type APITaskCost
- type APITaskReliability
- type APITaskStats
- type APITest
- type APITestStats
- type APITime
- type APITriggerConfig
- type APITriggerDefinition
- type APIUIConfig
- type APIUseSpruceOptions
- type APIUserAuthorInformation
- type APIUserSettings
- type APIVSphereConfig
- type APIVersion
- type APIVersionCost
- type APIVersions
- type APIWebhookSubscriber
- type APIapiConfig
- type BuildList
- type CreateHost
- type DistroInfo
- type HostRequestOptions
- type MockModel
- type MockSubStruct
- type Model
- type RestartResponse
- type StartAtKey
- type TestLogs
- type VersionVariantData
Constants ¶
const ( // This string defines ISO-8601 UTC with 3 fractional seconds behind a dot // specified by the API spec document. APITimeFormat = "\"2006-01-02T15:04:05.000Z\"" )
const (
LogLinkFormat = "%s/task_log_raw/%s/%d?type=%s"
)
Variables ¶
This section is empty.
Functions ¶
func FromAPIString ¶
func FromAPIStringList ¶
Types ¶
type APIAWSConfig ¶
type APIAWSConfig struct { EC2Keys []APIEC2Key `json:"ec2_keys"` S3Key APIString `json:"s3_key"` S3Secret APIString `json:"s3_secret"` Bucket APIString `json:"bucket"` S3BaseURL APIString `json:"s3_base_url"` DefaultSecurityGroup APIString `json:"default_security_group"` // Legacy EC2Secret APIString `json:"aws_secret"` EC2Key APIString `json:"aws_id"` }
func (*APIAWSConfig) BuildFromService ¶
func (a *APIAWSConfig) BuildFromService(h interface{}) error
func (*APIAWSConfig) ToService ¶
func (a *APIAWSConfig) ToService() (interface{}, error)
type APIAdminEvent ¶
type APIAdminEvent struct { Timestamp time.Time `json:"ts"` User string `json:"user"` Section string `json:"section"` Before Model `json:"before"` After Model `json:"after"` Guid string `json:"guid"` }
func (*APIAdminEvent) BuildFromService ¶
func (e *APIAdminEvent) BuildFromService(h interface{}) error
func (*APIAdminEvent) ToService ¶
func (e *APIAdminEvent) ToService() (interface{}, error)
type APIAdminSettings ¶
type APIAdminSettings struct { Alerts *APIAlertsConfig `json:"alerts,omitempty"` Amboy *APIAmboyConfig `json:"amboy,omitempty"` Api *APIapiConfig `json:"api,omitempty"` ApiUrl APIString `json:"api_url,omitempty"` AuthConfig *APIAuthConfig `json:"auth,omitempty"` Banner APIString `json:"banner,omitempty"` BannerTheme APIString `json:"banner_theme,omitempty"` ClientBinariesDir APIString `json:"client_binaries_dir,omitempty"` CommitQueue *APICommitQueueConfig `json:"commit_queue,omitempty"` ConfigDir APIString `json:"configdir,omitempty"` ContainerPools *APIContainerPoolsConfig `json:"container_pools,omitempty"` Credentials map[string]string `json:"credentials,omitempty"` DomainName APIString `json:"domain_name,omitempty"` Expansions map[string]string `json:"expansions,omitempty"` Bugsnag APIString `json:"bugsnag,omitempty"` GithubPRCreatorOrg APIString `json:"github_pr_creator_org,omitempty"` HostInit *APIHostInitConfig `json:"hostinit,omitempty"` HostJasper *APIHostJasperConfig `json:"host_jasper,omitempty"` Jira *APIJiraConfig `json:"jira,omitempty"` JIRANotifications *APIJIRANotificationsConfig `json:"jira_notifications,omitempty"` Keys map[string]string `json:"keys,omitempty"` LoggerConfig *APILoggerConfig `json:"logger_config,omitempty"` LogPath APIString `json:"log_path,omitempty"` Notify *APINotifyConfig `json:"notify,omitempty"` Plugins map[string]map[string]interface{} `json:"plugins,omitempty"` PprofPort APIString `json:"pprof_port,omitempty"` Providers *APICloudProviders `json:"providers,omitempty"` RepoTracker *APIRepoTrackerConfig `json:"repotracker,omitempty"` Scheduler *APISchedulerConfig `json:"scheduler,omitempty"` ServiceFlags *APIServiceFlags `json:"service_flags,omitempty"` Slack *APISlackConfig `json:"slack,omitempty"` Splunk *APISplunkConnectionInfo `json:"splunk,omitempty"` SuperUsers []string `json:"superusers,omitempty"` Triggers *APITriggerConfig `json:"triggers,omitempty"` Ui *APIUIConfig `json:"ui,omitempty"` }
APIAdminSettings is the structure of a response to the admin route
func NewConfigModel ¶
func NewConfigModel() *APIAdminSettings
func (*APIAdminSettings) BuildFromService ¶
func (as *APIAdminSettings) BuildFromService(h interface{}) error
BuildFromService builds a model from the service layer
func (*APIAdminSettings) ToService ¶
func (as *APIAdminSettings) ToService() (interface{}, error)
ToService returns a service model from an API model
type APIAlertsConfig ¶
type APIAlertsConfig struct {
SMTP APISMTPConfig `json:"smtp"`
}
func (*APIAlertsConfig) BuildFromService ¶
func (a *APIAlertsConfig) BuildFromService(h interface{}) error
func (*APIAlertsConfig) ToService ¶
func (a *APIAlertsConfig) ToService() (interface{}, error)
type APIAmboyConfig ¶
type APIAmboyConfig struct { Name APIString `json:"name"` SingleName APIString `json:"single_name"` DB APIString `json:"database"` PoolSizeLocal int `json:"pool_size_local"` PoolSizeRemote int `json:"pool_size_remote"` LocalStorage int `json:"local_storage_size"` GroupDefaultWorkers int `json:"group_default_workers"` GroupBackgroundCreateFrequencyMinutes int `json:"group_background_create_frequency"` GroupPruneFrequencyMinutes int `json:"group_prune_frequency"` GroupTTLMinutes int `json:"group_ttl"` }
func (*APIAmboyConfig) BuildFromService ¶
func (a *APIAmboyConfig) BuildFromService(h interface{}) error
func (*APIAmboyConfig) ToService ¶
func (a *APIAmboyConfig) ToService() (interface{}, error)
type APIAuthConfig ¶
type APIAuthConfig struct { LDAP *APILDAPConfig `json:"ldap"` Naive *APINaiveAuthConfig `json:"naive"` Github *APIGithubAuthConfig `json:"github"` }
func (*APIAuthConfig) BuildFromService ¶
func (a *APIAuthConfig) BuildFromService(h interface{}) error
func (*APIAuthConfig) ToService ¶
func (a *APIAuthConfig) ToService() (interface{}, error)
type APIAuthUser ¶
type APIAuthUser struct { Username APIString `json:"username"` DisplayName APIString `json:"display_name"` Password APIString `json:"password"` Email APIString `json:"email"` }
func (*APIAuthUser) BuildFromService ¶
func (a *APIAuthUser) BuildFromService(h interface{}) error
func (*APIAuthUser) ToService ¶
func (a *APIAuthUser) ToService() (interface{}, error)
type APIBanner ¶
APIBanner is a public structure representing the banner part of the admin settings
func (*APIBanner) BuildFromService ¶
BuildFromService builds a model from the service layer
type APIBootstrapSettings ¶
type APIBootstrapSettings struct { Method APIString `json:"method"` Communication APIString `json:"communication"` ShellPath APIString `json:"shell_path"` JasperBinaryDir APIString `json:"jasper_binary_dir"` ClientDir APIString `json:"client_dir"` JasperCredentialsPath APIString `json:"jasper_credentials_path"` }
func (*APIBootstrapSettings) BuildFromService ¶
func (s *APIBootstrapSettings) BuildFromService(h interface{}) error
BuildFromService converts from service level distro.BootstrapSettings to an APIBootstrapSettings.
func (*APIBootstrapSettings) ToService ¶
func (s *APIBootstrapSettings) ToService() (interface{}, error)
ToService returns a service layer distro.BootstrapSettings using the data from APIBootstrapSettings.
type APIBuild ¶
type APIBuild struct { Id APIString `json:"_id"` ProjectId APIString `json:"project_id"` CreateTime APITime `json:"create_time"` StartTime APITime `json:"start_time"` FinishTime APITime `json:"finish_time"` Version APIString `json:"version"` Branch APIString `json:"branch"` Revision APIString `json:"git_hash"` BuildVariant APIString `json:"build_variant"` Status APIString `json:"status"` Activated bool `json:"activated"` ActivatedBy APIString `json:"activated_by"` ActivatedTime APITime `json:"activated_time"` RevisionOrderNumber int `json:"order"` TaskCache []APITaskCache `json:"task_cache"` // Tasks is the build's task cache with just the names Tasks []string `json:"tasks"` TimeTaken APIDuration `json:"time_taken_ms"` DisplayName APIString `json:"display_name"` PredictedMakespan APIDuration `json:"predicted_makespan_ms"` ActualMakespan APIDuration `json:"actual_makespan_ms"` Origin APIString `json:"origin"` StatusCounts task.TaskStatusCount `json:"status_counts"` }
APIBuild is the model to be returned by the API whenever builds are fetched.
func (*APIBuild) BuildFromService ¶
BuildFromService converts from service level structs to an APIBuild. APIBuild.ProjectId is set in the route builder's Execute method.
type APICLIUpdate ¶
type APICLIUpdate struct { ClientConfig APIClientConfig `json:"client_config"` IgnoreUpdate bool `json:"ignore_update"` }
func (*APICLIUpdate) BuildFromService ¶
func (a *APICLIUpdate) BuildFromService(h interface{}) error
func (*APICLIUpdate) ToService ¶
func (a *APICLIUpdate) ToService() (interface{}, error)
type APIClientBinary ¶
type APIClientBinary struct { Arch APIString `json:"arch"` OS APIString `json:"os"` URL APIString `json:"url"` }
func (*APIClientBinary) BuildFromService ¶
func (a *APIClientBinary) BuildFromService(h interface{}) error
func (*APIClientBinary) ToService ¶
func (a *APIClientBinary) ToService() (interface{}, error)
type APIClientConfig ¶
type APIClientConfig struct { ClientBinaries []APIClientBinary `json:"client_binaries,omitempty"` LatestRevision APIString `json:"latest_revision"` }
func (*APIClientConfig) BuildFromService ¶
func (a *APIClientConfig) BuildFromService(h interface{}) error
func (*APIClientConfig) ToService ¶
func (a *APIClientConfig) ToService() (interface{}, error)
type APICloudProviders ¶
type APICloudProviders struct { AWS *APIAWSConfig `json:"aws"` Docker *APIDockerConfig `json:"docker"` GCE *APIGCEConfig `json:"gce"` OpenStack *APIOpenStackConfig `json:"openstack"` VSphere *APIVSphereConfig `json:"vsphere"` }
func (*APICloudProviders) BuildFromService ¶
func (a *APICloudProviders) BuildFromService(h interface{}) error
func (*APICloudProviders) ToService ¶
func (a *APICloudProviders) ToService() (interface{}, error)
type APICommitQueue ¶
type APICommitQueue struct { ProjectID APIString `json:"queue_id"` Queue []APICommitQueueItem `json:"queue"` }
func (*APICommitQueue) BuildFromService ¶
func (cq *APICommitQueue) BuildFromService(h interface{}) error
func (*APICommitQueue) ToService ¶
func (cq *APICommitQueue) ToService() (interface{}, error)
type APICommitQueueConfig ¶
type APICommitQueueConfig struct { MergeTaskDistro APIString `json:"merge_task_distro"` CommitterName APIString `json:"committer_name"` CommitterEmail APIString `json:"committer_email"` }
func (*APICommitQueueConfig) BuildFromService ¶
func (a *APICommitQueueConfig) BuildFromService(h interface{}) error
func (*APICommitQueueConfig) ToService ¶
func (a *APICommitQueueConfig) ToService() (interface{}, error)
type APICommitQueueItem ¶
type APICommitQueueItem struct { Issue APIString `json:"issue"` Version APIString `json:"version"` Modules []APIModule `json:"modules"` }
func (*APICommitQueueItem) BuildFromService ¶
func (item *APICommitQueueItem) BuildFromService(h interface{}) error
func (*APICommitQueueItem) ToService ¶
func (item *APICommitQueueItem) ToService() (interface{}, error)
type APICommitQueueItemAuthor ¶
type APICommitQueueItemAuthor struct {
Author APIString `json:"author"`
}
type APICommitQueueParams ¶
type APICommitQueueParams struct { Enabled bool `json:"enabled"` MergeMethod APIString `json:"merge_method"` PatchType APIString `json:"patch_type"` }
func (*APICommitQueueParams) BuildFromService ¶
func (cqParams *APICommitQueueParams) BuildFromService(h interface{}) error
func (*APICommitQueueParams) ToService ¶
func (cqParams *APICommitQueueParams) ToService() (interface{}, error)
type APICommitQueuePosition ¶
type APICommitQueuePosition struct {
Position int `json:"position"`
}
type APIContainerPool ¶
type APIContainerPool struct { Distro APIString `json:"distro"` Id APIString `json:"id"` MaxContainers int `json:"max_containers"` Port uint16 `json:"port"` }
func (*APIContainerPool) BuildFromService ¶
func (a *APIContainerPool) BuildFromService(h interface{}) error
func (*APIContainerPool) ToService ¶
func (a *APIContainerPool) ToService() (interface{}, error)
type APIContainerPoolsConfig ¶
type APIContainerPoolsConfig struct {
Pools []APIContainerPool `json:"pools"`
}
func (*APIContainerPoolsConfig) BuildFromService ¶
func (a *APIContainerPoolsConfig) BuildFromService(h interface{}) error
func (*APIContainerPoolsConfig) ToService ¶
func (a *APIContainerPoolsConfig) ToService() (interface{}, error)
type APIDistro ¶
type APIDistro struct { Name APIString `json:"name"` Aliases []string `json:"aliases"` UserSpawnAllowed bool `json:"user_spawn_allowed"` Provider APIString `json:"provider"` ProviderSettings map[string]interface{} `json:"settings"` ImageID APIString `json:"image_id"` Arch APIString `json:"arch"` WorkDir APIString `json:"work_dir"` PoolSize int `json:"pool_size"` SetupAsSudo bool `json:"setup_as_sudo"` Setup APIString `json:"setup"` Teardown APIString `json:"teardown"` User APIString `json:"user"` BootstrapSettings APIBootstrapSettings `json:"bootstrap_settings"` CloneMethod APIString `json:"clone_method"` SSHKey APIString `json:"ssh_key"` SSHOptions []string `json:"ssh_options"` Expansions []APIExpansion `json:"expansions"` Disabled bool `json:"disabled"` ContainerPool APIString `json:"container_pool"` PlannerSettings APIPlannerSettings `json:"planner_settings"` FinderSettings APIFinderSettings `json:"finder_settings"` }
func (*APIDistro) BuildFromService ¶
BuildFromService converts from service level distro.Distro to an APIDistro
type APIDistroCost ¶
type APIDistroCost struct { DistroId APIString `json:"distro_id"` SumTimeTaken APIDuration `json:"sum_time_taken"` Provider APIString `json:"provider"` InstanceType APIString `json:"instance_type,omitempty"` EstimatedCost float64 `json:"estimated_cost"` NumTasks int `json:"num_tasks"` }
APIDistroCost is the model to be returned by the API whenever cost data is fetched by distro id.
func (*APIDistroCost) BuildFromService ¶
func (apiDistroCost *APIDistroCost) BuildFromService(h interface{}) error
BuildFromService converts from a service level task by loading the data into the appropriate fields of the APIDistroCost.
func (*APIDistroCost) ToService ¶
func (apiDistroCost *APIDistroCost) ToService() (interface{}, error)
ToService returns a service layer distro cost using the data from APIDistroCost.
type APIDockerConfig ¶
type APIDockerConfig struct {
APIVersion APIString `json:"api_version"`
}
func (*APIDockerConfig) BuildFromService ¶
func (a *APIDockerConfig) BuildFromService(h interface{}) error
func (*APIDockerConfig) ToService ¶
func (a *APIDockerConfig) ToService() (interface{}, error)
type APIDuration ¶
type APIDuration uint64
Represents duration in milliseconds
func NewAPIDuration ¶
func NewAPIDuration(d time.Duration) APIDuration
func (APIDuration) ToDuration ¶
func (i APIDuration) ToDuration() time.Duration
type APIEC2Key ¶
type APIEC2Key struct { Name APIString `json:"name"` Region APIString `json:"region"` Key APIString `json:"key"` Secret APIString `json:"secret"` }
func (*APIEC2Key) BuildFromService ¶
type APIEmail ¶
type APIEmail struct { From APIString `json:"from"` Recipients []string `json:"recipients"` Subject APIString `json:"subject"` Body APIString `json:"body"` PlainTextContents bool `json:"is_plain_text"` Headers map[string][]string `json:"headers"` }
func (*APIEmail) BuildFromService ¶
BuildFromService converts from service level message.Email to an APIEmail.
type APIEntry ¶
type APIEntry struct { TaskId APIString `json:"task_id"` TaskDisplayName APIString `json:"task_name"` BuildId APIString `json:"build"` Files []APIFile `json:"files"` Execution int `json:"execution"` }
func (*APIEntry) BuildFromService ¶
type APIEventStats ¶
type APIEventStats struct { LastProcessedAt time.Time `json:"last_processed_at"` NumUnprocessedEvents int `json:"unprocessed_events"` PendingNotificationsByType apiNotificationStats `json:"pending_notifications_by_type"` }
func (*APIEventStats) BuildFromService ¶
func (n *APIEventStats) BuildFromService(h interface{}) error
func (*APIEventStats) ToService ¶
func (n *APIEventStats) ToService() (interface{}, error)
type APIExpansion ¶
APIExpansion is derived from a service layer distro.Expansion
func (*APIExpansion) BuildFromService ¶
func (e *APIExpansion) BuildFromService(h interface{}) error
BuildFromService converts a service level distro.Expansion to an APIExpansion
func (*APIExpansion) ToService ¶
func (e *APIExpansion) ToService() (interface{}, error)
ToService returns a service layer distro.Expansion using the data from an APIExpansion
type APIFeedbackSubmission ¶
type APIFeedbackSubmission struct { Type APIString `json:"type"` User APIString `json:"user"` SubmittedAt time.Time `json:"submitted_at"` Questions []APIQuestionAnswer `json:"questions"` }
func (*APIFeedbackSubmission) BuildFromService ¶
func (a *APIFeedbackSubmission) BuildFromService(h interface{}) error
func (*APIFeedbackSubmission) ToService ¶
func (a *APIFeedbackSubmission) ToService() (interface{}, error)
type APIFile ¶
type APIFile struct { Name APIString `json:"name"` Link APIString `json:"url"` Visibility APIString `json:"visibility"` IgnoreForFetch bool `json:"ignore_for_fetch"` }
func (*APIFile) BuildFromService ¶
type APIFinderSettings ¶
type APIFinderSettings struct {
Version APIString `json:"version"`
}
func (*APIFinderSettings) BuildFromService ¶
func (s *APIFinderSettings) BuildFromService(h interface{}) error
BuildFromService converts from service level distro.FinderSettings to an APIFinderSettings
func (*APIFinderSettings) ToService ¶
func (s *APIFinderSettings) ToService() (interface{}, error)
ToService returns a service layer distro.FinderSettings using the data from APIFinderSettings
type APIGCEConfig ¶
type APIGCEConfig struct { ClientEmail APIString `json:"client_email"` PrivateKey APIString `json:"private_key"` PrivateKeyID APIString `json:"private_key_id"` TokenURI APIString `json:"token_uri"` }
func (*APIGCEConfig) BuildFromService ¶
func (a *APIGCEConfig) BuildFromService(h interface{}) error
func (*APIGCEConfig) ToService ¶
func (a *APIGCEConfig) ToService() (interface{}, error)
type APIGithubAuthConfig ¶
type APIGithubAuthConfig struct { ClientId APIString `json:"client_id"` ClientSecret APIString `json:"client_secret"` Users []APIString `json:"users"` Organization APIString `json:"organization"` }
func (*APIGithubAuthConfig) BuildFromService ¶
func (a *APIGithubAuthConfig) BuildFromService(h interface{}) error
func (*APIGithubAuthConfig) ToService ¶
func (a *APIGithubAuthConfig) ToService() (interface{}, error)
type APIGithubHook ¶
type APIGithubHook struct { HookID int `json:"hook_id"` Owner APIString `json:"owner"` Repo APIString `json:"repo"` }
func (*APIGithubHook) BuildFromService ¶
func (a *APIGithubHook) BuildFromService(h interface{}) error
func (*APIGithubHook) ToService ¶
func (*APIGithubHook) ToService() (interface{}, error)
ToService returns a service layer build using the data from the APIBuild.
type APIGithubMergeSubscriber ¶
type APIGithubMergeSubscriber struct { PRs []APIPRInfo `json:"prs" mapstructure:"prs"` Item APIString `json:"item" mapstructure:"item"` MergeMethod APIString `json:"merge_method" mapstructure:"merge_method"` }
func (*APIGithubMergeSubscriber) BuildFromService ¶
func (s *APIGithubMergeSubscriber) BuildFromService(h interface{}) error
func (*APIGithubMergeSubscriber) ToService ¶
func (s *APIGithubMergeSubscriber) ToService() (interface{}, error)
type APIGithubPRSubscriber ¶
type APIGithubPRSubscriber struct { Owner APIString `json:"owner" mapstructure:"owner"` Repo APIString `json:"repo" mapstructure:"repo"` PRNumber int `json:"pr_number" mapstructure:"pr_number"` Ref APIString `json:"ref" mapstructure:"ref"` }
func (*APIGithubPRSubscriber) BuildFromService ¶
func (s *APIGithubPRSubscriber) BuildFromService(h interface{}) error
func (*APIGithubPRSubscriber) ToService ¶
func (s *APIGithubPRSubscriber) ToService() (interface{}, error)
type APIGithubUser ¶
type APIGithubUser struct { UID int `json:"uid,omitempty"` LastKnownAs APIString `json:"last_known_as,omitempty"` }
func (*APIGithubUser) BuildFromService ¶
func (g *APIGithubUser) BuildFromService(h interface{}) error
func (*APIGithubUser) ToService ¶
func (g *APIGithubUser) ToService() (interface{}, error)
type APIHost ¶
type APIHost struct { Id APIString `json:"host_id"` HostURL APIString `json:"host_url"` Distro DistroInfo `json:"distro"` Provisioned bool `json:"provisioned"` StartedBy APIString `json:"started_by"` Type APIString `json:"host_type"` User APIString `json:"user"` Status APIString `json:"status"` RunningTask taskInfo `json:"running_task"` UserHost bool `json:"user_host"` InstanceTags []host.Tag `json:"instance_tags"` }
APIHost is the model to be returned by the API whenever hosts are fetched.
func (*APIHost) BuildFromService ¶
BuildFromService converts from service level structs to an APIHost. It can be called multiple times with different data types, a service layer host and a service layer task, which are each loaded into the data structure.
type APIHostInitConfig ¶
type APIHostInitConfig struct {
SSHTimeoutSeconds int64 `json:"ssh_timeout_secs"`
}
func (*APIHostInitConfig) BuildFromService ¶
func (a *APIHostInitConfig) BuildFromService(h interface{}) error
func (*APIHostInitConfig) ToService ¶
func (a *APIHostInitConfig) ToService() (interface{}, error)
type APIHostJasperConfig ¶
type APIHostJasperConfig struct { BinaryName APIString `json:"binary_name,omitempty"` DownloadFileName APIString `json:"download_file_name,omitempty"` Port int `json:"port,omitempty"` URL APIString `json:"url,omitempty"` Version APIString `json:"version,omitempty"` }
func (*APIHostJasperConfig) BuildFromService ¶
func (c *APIHostJasperConfig) BuildFromService(h interface{}) error
func (*APIHostJasperConfig) ToService ¶
func (c *APIHostJasperConfig) ToService() (interface{}, error)
type APIHostStatsByDistro ¶
type APIHostStatsByDistro struct {
Distros []apiHostStatsForDistro `json:"distros"`
}
APIHostStatsByDistro is a slice of host stats for a distro the 3 structs below are nested within it
func (*APIHostStatsByDistro) BuildFromService ¶
func (s *APIHostStatsByDistro) BuildFromService(h interface{}) error
BuildFromService takes the slice of stats returned by GetHostStatsByDistro and embeds them so that the return value is a slice of distros
func (*APIHostStatsByDistro) ToService ¶
func (s *APIHostStatsByDistro) ToService() (interface{}, error)
ToService is not implemented for APIHostStatsByDistro
type APIJIRAIssueSubscriber ¶
type APIJIRAIssueSubscriber struct { Project APIString `json:"project" mapstructure:"project"` IssueType APIString `json:"issue_type" mapstructure:"issue_type"` }
func (*APIJIRAIssueSubscriber) BuildFromService ¶
func (s *APIJIRAIssueSubscriber) BuildFromService(h interface{}) error
func (*APIJIRAIssueSubscriber) ToService ¶
func (s *APIJIRAIssueSubscriber) ToService() (interface{}, error)
type APIJIRANotificationsConfig ¶
type APIJIRANotificationsConfig struct {
CustomFields map[string]map[string]string `json:"custom_fields,omitempty"`
}
func (*APIJIRANotificationsConfig) BuildFromService ¶
func (j *APIJIRANotificationsConfig) BuildFromService(h interface{}) error
func (*APIJIRANotificationsConfig) ToService ¶
func (j *APIJIRANotificationsConfig) ToService() (interface{}, error)
type APIJiraComment ¶
func (*APIJiraComment) BuildFromService ¶
func (c *APIJiraComment) BuildFromService(h interface{}) error
BuildFromService converts from service level message.JIRAComment to APIJiraComment.
func (*APIJiraComment) ToService ¶
func (c *APIJiraComment) ToService() (interface{}, error)
ToService returns a service layer message.JIRAComment using the data from APIJiraComment.
type APIJiraConfig ¶
type APIJiraConfig struct { Host APIString `json:"host"` Username APIString `json:"username"` Password APIString `json:"password"` DefaultProject APIString `json:"default_project"` }
func (*APIJiraConfig) BuildFromService ¶
func (a *APIJiraConfig) BuildFromService(h interface{}) error
func (*APIJiraConfig) ToService ¶
func (a *APIJiraConfig) ToService() (interface{}, error)
type APIJiraIssue ¶
type APIJiraIssue struct { IssueKey APIString `json:"issue_key"` Project APIString `json:"project"` Summary APIString `json:"summary"` Description APIString `json:"description"` Reporter APIString `json:"reporter"` Assignee APIString `json:"assignee"` Type APIString `json:"type"` Components []string `json:"components"` Labels []string `json:"labels"` Fields map[string]interface{} `json:"fields"` }
func (*APIJiraIssue) BuildFromService ¶
func (i *APIJiraIssue) BuildFromService(h interface{}) error
BuildFromService converts from service level message.JiraIssue to APIJiraIssue.
func (*APIJiraIssue) ToService ¶
func (i *APIJiraIssue) ToService() (interface{}, error)
ToService returns a service layer message.JiraIssue using the data from APIJiraIssue.
type APILDAPConfig ¶
type APILDAPConfig struct { URL APIString `json:"url"` Port APIString `json:"port"` UserPath APIString `json:"path"` ServicePath APIString `json:"service_path"` Group APIString `json:"group"` ServiceGroup APIString `json:"service_group"` ExpireAfterMinutes APIString `json:"expire_after_minutes"` }
func (*APILDAPConfig) BuildFromService ¶
func (a *APILDAPConfig) BuildFromService(h interface{}) error
func (*APILDAPConfig) ToService ¶
func (a *APILDAPConfig) ToService() (interface{}, error)
type APILogBuffering ¶
type APILogBuffering struct { DurationSeconds int `json:"duration_seconds"` Count int `json:"count"` }
func (*APILogBuffering) BuildFromService ¶
func (a *APILogBuffering) BuildFromService(h interface{}) error
func (*APILogBuffering) ToService ¶
func (a *APILogBuffering) ToService() (interface{}, error)
type APILoggerConfig ¶
type APILoggerConfig struct { Buffer *APILogBuffering `json:"buffer"` DefaultLevel APIString `json:"default_level"` ThresholdLevel APIString `json:"threshold_level"` LogkeeperURL APIString `json:"logkeeper_url"` }
func (*APILoggerConfig) BuildFromService ¶
func (a *APILoggerConfig) BuildFromService(h interface{}) error
func (*APILoggerConfig) ToService ¶
func (a *APILoggerConfig) ToService() (interface{}, error)
type APIModule ¶
type APINaiveAuthConfig ¶
type APINaiveAuthConfig struct {
Users []*APIAuthUser `json:"users"`
}
func (*APINaiveAuthConfig) BuildFromService ¶
func (a *APINaiveAuthConfig) BuildFromService(h interface{}) error
func (*APINaiveAuthConfig) ToService ¶
func (a *APINaiveAuthConfig) ToService() (interface{}, error)
type APINotificationPreferences ¶
type APINotificationPreferences struct { BuildBreak APIString `json:"build_break"` BuildBreakID APIString `json:"build_break_id,omitempty"` PatchFinish APIString `json:"patch_finish"` PatchFinishID APIString `json:"patch_finish_id,omitempty"` SpawnHostExpiration APIString `json:"spawn_host_expiration"` SpawnHostExpirationID APIString `json:"spawn_host_expiration_id,omitempty"` SpawnHostOutcome APIString `json:"spawn_host_outcome"` SpawnHostOutcomeID APIString `json:"spawn_host_outcome_id,omitempty"` CommitQueue APIString `json:"commit_queue"` CommitQueueID APIString `json:"commit_queue_id,omitempty"` }
func (*APINotificationPreferences) BuildFromService ¶
func (n *APINotificationPreferences) BuildFromService(h interface{}) error
func (*APINotificationPreferences) ToService ¶
func (n *APINotificationPreferences) ToService() (interface{}, error)
type APINotifyConfig ¶
type APINotifyConfig struct { BufferTargetPerInterval int `json:"buffer_target_per_interval"` BufferIntervalSeconds int `json:"buffer_interval_seconds"` SMTP APISMTPConfig `json:"smtp"` }
func (*APINotifyConfig) BuildFromService ¶
func (a *APINotifyConfig) BuildFromService(h interface{}) error
func (*APINotifyConfig) ToService ¶
func (a *APINotifyConfig) ToService() (interface{}, error)
type APIOpenStackConfig ¶
type APIOpenStackConfig struct { IdentityEndpoint APIString `json:"identity_endpoint"` Username APIString `json:"username"` Password APIString `json:"password"` DomainName APIString `json:"domain_name"` ProjectName APIString `json:"project_name"` ProjectID APIString `json:"project_id"` Region APIString `json:"region"` }
func (*APIOpenStackConfig) BuildFromService ¶
func (a *APIOpenStackConfig) BuildFromService(h interface{}) error
func (*APIOpenStackConfig) ToService ¶
func (a *APIOpenStackConfig) ToService() (interface{}, error)
type APIPRInfo ¶
type APIPRInfo struct { Owner APIString `json:"owner" mapstructure:"owner"` Repo APIString `json:"repo" mapstructure:"repo"` PRNumber int `json:"pr_number" mapstructure:"pr_number"` Ref APIString `json:"ref" mapstructure:"ref"` CommitTitle APIString `json:"commit_title" mapstructure:"commit_title"` }
func (*APIPRInfo) BuildFromService ¶
type APIPatch ¶
type APIPatch struct { Id APIString `json:"patch_id"` Description APIString `json:"description"` ProjectId APIString `json:"project_id"` Branch APIString `json:"branch"` Githash APIString `json:"git_hash"` PatchNumber int `json:"patch_number"` Author APIString `json:"author"` Version APIString `json:"version"` Status APIString `json:"status"` CreateTime APITime `json:"create_time"` StartTime APITime `json:"start_time"` FinishTime APITime `json:"finish_time"` Variants []APIString `json:"builds"` Tasks []APIString `json:"tasks"` VariantsTasks []variantTask `json:"variants_tasks"` Activated bool `json:"activated"` Alias APIString `json:"alias,omitempty"` GithubPatchData githubPatch `json:"github_patch_data,omitempty"` }
APIPatch is the model to be returned by the API whenever patches are fetched.
func (*APIPatch) BuildFromService ¶
BuildFromService converts from service level structs to an APIPatch
type APIPlannerSettings ¶
type APIPlannerSettings struct { Version APIString `json:"version"` MinimumHosts int `json:"minimum_hosts"` MaximumHosts int `json:"maximum_hosts"` TargetTime APIDuration `json:"target_time"` AcceptableHostIdleTime APIDuration `json:"acceptable_host_idle_time"` GroupVersions *bool `json:"group_versions"` TaskOrdering APIString `json:"task_ordering"` PatchFactor int64 `json:"patch_factor"` TimeInQueueFactor int64 `json:"time_in_queue_factor"` ExpectedRuntimeFactor int64 `json:"expected_runtime_factor"` }
func (*APIPlannerSettings) BuildFromService ¶
func (s *APIPlannerSettings) BuildFromService(h interface{}) error
BuildFromService converts from service level distro.PlannerSetting to an APIPlannerSettings
func (*APIPlannerSettings) ToService ¶
func (s *APIPlannerSettings) ToService() (interface{}, error)
ToService returns a service layer distro.PlannerSettings using the data from APIPlannerSettings
type APIProject ¶
type APIProject struct { BatchTime int `json:"batch_time"` Branch APIString `json:"branch_name"` DisplayName APIString `json:"display_name"` Enabled bool `json:"enabled"` Identifier APIString `json:"identifier"` Owner APIString `json:"owner_name"` Private bool `json:"private"` RemotePath APIString `json:"remote_path"` Repo APIString `json:"repo_name"` Tracked bool `json:"tracked"` DeactivatePrevious bool `json:"deactivate_previous"` Admins []APIString `json:"admins"` TracksPushEvents bool `json:"tracks_push_events"` PRTestingEnabled bool `json:"pr_testing_enabled"` CommitQueue APICommitQueueParams `json:"commit_queue"` }
func (*APIProject) BuildFromService ¶
func (apiProject *APIProject) BuildFromService(p interface{}) error
func (*APIProject) ToService ¶
func (apiProject *APIProject) ToService() (interface{}, error)
type APIProjectAlias ¶
type APIProjectAlias struct { Alias APIString `json:"alias"` Variant APIString `json:"variant"` Task APIString `json:"task"` VariantTags []APIString `json:"variant_tags,omitempty"` TaskTags []APIString `json:"tags,omitempty"` Delete bool `json:"delete,omitempty"` ID APIString `json:"_id,omitempty"` }
func DbProjectAliasesToRestModel ¶
func DbProjectAliasesToRestModel(aliases []model.ProjectAlias) []APIProjectAlias
func (*APIProjectAlias) BuildFromService ¶
func (a *APIProjectAlias) BuildFromService(h interface{}) error
func (*APIProjectAlias) ToService ¶
func (a *APIProjectAlias) ToService() (interface{}, error)
type APIProjectEvent ¶
type APIProjectEvent struct { Timestamp time.Time `json:"ts"` User APIString `json:"user"` Before APIProjectSettings `json:"before"` After APIProjectSettings `json:"after"` }
func (*APIProjectEvent) BuildFromService ¶
func (e *APIProjectEvent) BuildFromService(h interface{}) error
func (*APIProjectEvent) ToService ¶
func (e *APIProjectEvent) ToService() (interface{}, error)
type APIProjectRef ¶
type APIProjectRef struct { Owner APIString `json:"owner_name"` Repo APIString `json:"repo_name"` Branch APIString `json:"branch_name"` RepoKind APIString `json:"repo_kind"` Enabled bool `json:"enabled"` Private bool `json:"private"` BatchTime int `json:"batch_time"` RemotePath APIString `json:"remote_path"` Identifier APIString `json:"identifier"` DisplayName APIString `json:"display_name"` DeactivatePrevious bool `json:"deactivate_previous"` TracksPushEvents bool `json:"tracks_push_events"` PRTestingEnabled bool `json:"pr_testing_enabled"` CommitQueue APICommitQueueParams `json:"commit_queue"` Tracked bool `json:"tracked"` PatchingDisabled bool `json:"patching_disabled"` Admins []APIString `json:"admins"` DeleteAdmins []APIString `json:"delete_admins,omitempty"` NotifyOnBuildFailure bool `json:"notify_on_failure"` Revision APIString `json:"revision"` Triggers []APITriggerDefinition `json:"triggers"` Aliases []APIProjectAlias `json:"aliases"` Variables APIProjectVars `json:"variables"` Subscriptions []APISubscription `json:"subscriptions"` DeleteSubscriptions []APIString `json:"delete_subscriptions,omitempty"` }
func (*APIProjectRef) BuildFromService ¶
func (p *APIProjectRef) BuildFromService(v interface{}) error
func (*APIProjectRef) ToService ¶
func (p *APIProjectRef) ToService() (interface{}, error)
ToService returns a service layer ProjectRef using the data from APIProjectRef
type APIProjectSettings ¶
type APIProjectSettings struct { ProjectRef APIProjectRef `json:"proj_ref"` GitHubWebhooksEnabled bool `json:"github_webhooks_enabled"` Vars APIProjectVars `json:"vars"` Aliases []APIProjectAlias `json:"aliases"` Subscriptions []APISubscription `json:"subscriptions"` }
func DbProjectSettingsToRestModel ¶
func DbProjectSettingsToRestModel(settings model.ProjectSettingsEvent) (APIProjectSettings, error)
type APIProjectVars ¶
type APIProjectVars struct { Vars map[string]string `json:"vars"` PrivateVars map[string]bool `json:"private_vars"` VarsToDelete []string `json:"vars_to_delete,omitempty"` }
func (*APIProjectVars) BuildFromService ¶
func (p *APIProjectVars) BuildFromService(h interface{}) error
func (*APIProjectVars) ToService ¶
func (p *APIProjectVars) ToService() (interface{}, error)
type APIPubKey ¶
func (*APIPubKey) BuildFromService ¶
BuildFromService converts from service level structs to an APIPubKey.
type APIQuestionAnswer ¶
type APIQuestionAnswer struct { ID APIString `json:"id"` Prompt APIString `json:"prompt"` Answer APIString `json:"answer"` }
func (*APIQuestionAnswer) BuildFromService ¶
func (a *APIQuestionAnswer) BuildFromService(h interface{}) error
func (*APIQuestionAnswer) ToService ¶
func (a *APIQuestionAnswer) ToService() (interface{}, error)
type APIRecentTaskStats ¶
type APIRecentTaskStats struct { Total int `json:"total"` Inactive int `json:"inactive"` Unstarted int `json:"unstarted"` Started int `json:"started"` Succeeded int `json:"succeeded"` Failed int `json:"failed"` SystemFailed int `json:"system-failed"` SetupFailed int `json:"setup-failed"` SystemUnresponsive int `json:"system-unresponsive"` SystemTimedOut int `json:"system-timed-out"` TestTimedOut int `json:"test-timed-out"` }
APIRecentTaskStats is the model to be returned by the API whenever recent tasks are fetched.
func (*APIRecentTaskStats) BuildFromService ¶
func (apiStatus *APIRecentTaskStats) BuildFromService(h interface{}) error
BuildFromService converts from service level structs to an APIRecentTaskStats.
func (*APIRecentTaskStats) ToService ¶
func (apiStatus *APIRecentTaskStats) ToService() (interface{}, error)
ToService returns a service layer distro using the data from APIRecentTaskStats.
type APIRecentTaskStatsList ¶
func (*APIRecentTaskStatsList) BuildFromService ¶
func (s *APIRecentTaskStatsList) BuildFromService(h interface{}) error
func (*APIRecentTaskStatsList) ToService ¶
func (s *APIRecentTaskStatsList) ToService() (interface{}, error)
type APIRepoTrackerConfig ¶
type APIRepoTrackerConfig struct { NumNewRepoRevisionsToFetch int `json:"revs_to_fetch"` MaxRepoRevisionsToSearch int `json:"max_revs_to_search"` MaxConcurrentRequests int `json:"max_con_requests"` }
func (*APIRepoTrackerConfig) BuildFromService ¶
func (a *APIRepoTrackerConfig) BuildFromService(h interface{}) error
func (*APIRepoTrackerConfig) ToService ¶
func (a *APIRepoTrackerConfig) ToService() (interface{}, error)
type APISMTPConfig ¶
type APISMTPConfig struct { Server APIString `json:"server"` Port int `json:"port"` UseSSL bool `json:"use_ssl"` Username APIString `json:"username"` Password APIString `json:"password"` From APIString `json:"from"` AdminEmail []APIString `json:"admin_email"` }
func (*APISMTPConfig) BuildFromService ¶
func (a *APISMTPConfig) BuildFromService(h interface{}) error
func (*APISMTPConfig) ToService ¶
func (a *APISMTPConfig) ToService() (interface{}, error)
type APISchedulerConfig ¶
type APISchedulerConfig struct { TaskFinder APIString `json:"task_finder"` HostAllocator APIString `json:"host_allocator"` FreeHostFraction float64 `json:"free_host_fraction"` CacheDurationSeconds int `json:"cache_duration_seconds"` Planner APIString `json:"planner"` TaskOrdering APIString `json:"task_ordering"` TargetTimeSeconds int `json:"target_time_seconds"` AcceptableHostIdleTimeSeconds int `json:"acceptable_host_idle_time_seconds"` GroupVersions bool `json:"group_versions"` PatchFactor int64 `json:"patch_factor"` TimeInQueueFactor int64 `json:"time_in_queue_factor"` ExpectedRuntimeFactor int64 `json:"expected_runtime_factor"` }
func (*APISchedulerConfig) BuildFromService ¶
func (a *APISchedulerConfig) BuildFromService(h interface{}) error
func (*APISchedulerConfig) ToService ¶
func (a *APISchedulerConfig) ToService() (interface{}, error)
type APISelector ¶
func (*APISelector) BuildFromService ¶
func (s *APISelector) BuildFromService(h interface{}) error
func (*APISelector) ToService ¶
func (s *APISelector) ToService() (interface{}, error)
type APIServiceFlags ¶
type APIServiceFlags struct { TaskDispatchDisabled bool `json:"task_dispatch_disabled"` HostInitDisabled bool `json:"host_init_disabled"` MonitorDisabled bool `json:"monitor_disabled"` AlertsDisabled bool `json:"alerts_disabled"` AgentStartDisabled bool `json:"agent_start_disabled"` RepotrackerDisabled bool `json:"repotracker_disabled"` SchedulerDisabled bool `json:"scheduler_disabled"` GithubPRTestingDisabled bool `json:"github_pr_testing_disabled"` CLIUpdatesDisabled bool `json:"cli_updates_disabled"` BackgroundStatsDisabled bool `json:"background_stats_disabled"` TaskLoggingDisabled bool `json:"task_logging_disabled"` CacheStatsJobDisabled bool `json:"cache_stats_job_disabled"` CacheStatsEndpointDisabled bool `json:"cache_stats_endpoint_disabled"` CacheStatsOldTasksDisabled bool `json:"cache_stats_old_tasks_disabled"` TaskReliabilityDisabled bool `json:"task_reliability_disabled"` CommitQueueDisabled bool `json:"commit_queue_disabled"` PlannerDisabled bool `json:"planner_disabled"` HostAllocatorDisabled bool `json:"host_allocator_disabled"` // Notifications Flags EventProcessingDisabled bool `json:"event_processing_disabled"` JIRANotificationsDisabled bool `json:"jira_notifications_disabled"` SlackNotificationsDisabled bool `json:"slack_notifications_disabled"` EmailNotificationsDisabled bool `json:"email_notifications_disabled"` WebhookNotificationsDisabled bool `json:"webhook_notifications_disabled"` GithubStatusAPIDisabled bool `json:"github_status_api_disabled"` }
APIServiceFlags is a public structure representing the admin service flags
func (*APIServiceFlags) BuildFromService ¶
func (as *APIServiceFlags) BuildFromService(h interface{}) error
BuildFromService builds a model from the service layer
func (*APIServiceFlags) ToService ¶
func (as *APIServiceFlags) ToService() (interface{}, error)
ToService returns a service model from an API model
type APISlack ¶
type APISlack struct { Target APIString `json:"target"` Msg APIString `json:"msg"` Attachments []APISlackAttachment `json:"attachments"` }
func (*APISlack) BuildFromService ¶
BuildFromService converts from service level message.Slack to APISlack.
type APISlackAttachment ¶
type APISlackAttachment struct { Color APIString `json:"color"` Fallback APIString `json:"fallback"` AuthorName APIString `json:"author_name"` AuthorIcon APIString `json:"author_icon"` Title APIString `json:"title"` TitleLink APIString `json:"title_link"` Text APIString `json:"text"` Fields []APISlackAttachmentField `json:"fields"` MarkdownIn []string `json:"mrkdwn_in"` }
func (*APISlackAttachment) BuildFromService ¶
func (a *APISlackAttachment) BuildFromService(h interface{}) error
BuildFromService converts from service level message.SlackAttachment to APISlackAttachment.
func (*APISlackAttachment) ToService ¶
func (a *APISlackAttachment) ToService() (interface{}, error)
ToService returns a service layer message.SlackAttachment using the data from APISlackAttachment.
type APISlackAttachmentField ¶
type APISlackAttachmentField struct { Title APIString `json:"title"` Value APIString `json:"value"` Short bool `json:"short"` }
func (*APISlackAttachmentField) BuildFromService ¶
func (f *APISlackAttachmentField) BuildFromService(h interface{}) error
BuildFromService converts from service level message.SlackAttachmentField to an APISlackAttachmentField.
func (*APISlackAttachmentField) ToService ¶
func (f *APISlackAttachmentField) ToService() (interface{}, error)
ToService returns a service layer message.SlackAttachmentField using the data from APISlackAttachmentField.
type APISlackConfig ¶
type APISlackConfig struct { Options *APISlackOptions `json:"options"` Token APIString `json:"token"` Level APIString `json:"level"` }
func (*APISlackConfig) BuildFromService ¶
func (a *APISlackConfig) BuildFromService(h interface{}) error
func (*APISlackConfig) ToService ¶
func (a *APISlackConfig) ToService() (interface{}, error)
type APISlackOptions ¶
type APISlackOptions struct { Channel APIString `json:"channel"` Hostname APIString `json:"hostname"` Name APIString `json:"name"` Username APIString `json:"username"` IconURL APIString `json:"icon_url"` BasicMetadata bool `json:"add_basic_metadata"` Fields bool `json:"use_fields"` AllFields bool `json:"all_fields"` FieldsSet map[string]bool `json:"fields"` }
func (*APISlackOptions) BuildFromService ¶
func (a *APISlackOptions) BuildFromService(h interface{}) error
func (*APISlackOptions) ToService ¶
func (a *APISlackOptions) ToService() (interface{}, error)
type APISpawnHostModify ¶
type APISplunkConnectionInfo ¶
type APISplunkConnectionInfo struct { ServerURL APIString `json:"url"` Token APIString `json:"token"` Channel APIString `json:"channel"` }
func (*APISplunkConnectionInfo) BuildFromService ¶
func (a *APISplunkConnectionInfo) BuildFromService(h interface{}) error
func (*APISplunkConnectionInfo) ToService ¶
func (a *APISplunkConnectionInfo) ToService() (interface{}, error)
type APIStatList ¶
type APIStatList []APIStat
func (*APIStatList) BuildFromService ¶
func (s *APIStatList) BuildFromService(h interface{}) error
type APISubscriber ¶
type APISubscriber struct { Type APIString `json:"type"` Target interface{} `json:"target"` }
func (*APISubscriber) BuildFromService ¶
func (s *APISubscriber) BuildFromService(h interface{}) error
func (*APISubscriber) ToService ¶
func (s *APISubscriber) ToService() (interface{}, error)
type APISubscription ¶
type APISubscription struct { ID APIString `json:"id"` ResourceType APIString `json:"resource_type"` Trigger APIString `json:"trigger"` Selectors []APISelector `json:"selectors"` RegexSelectors []APISelector `json:"regex_selectors"` Subscriber APISubscriber `json:"subscriber"` OwnerType APIString `json:"owner_type"` Owner APIString `json:"owner"` TriggerData map[string]string `json:"trigger_data,omitempty"` }
func DbProjectSubscriptionsToRestModel ¶
func DbProjectSubscriptionsToRestModel(subscriptions []event.Subscription) ([]APISubscription, error)
func (*APISubscription) BuildFromService ¶
func (s *APISubscription) BuildFromService(h interface{}) error
func (*APISubscription) ToService ¶
func (s *APISubscription) ToService() (interface{}, error)
type APITask ¶
type APITask struct { Id APIString `json:"task_id"` ProjectId APIString `json:"project_id"` CreateTime APITime `json:"create_time"` DispatchTime APITime `json:"dispatch_time"` ScheduledTime APITime `json:"scheduled_time"` StartTime APITime `json:"start_time"` FinishTime APITime `json:"finish_time"` IngestTime APITime `json:"ingest_time"` Version APIString `json:"version_id"` Revision APIString `json:"revision"` Priority int64 `json:"priority"` Activated bool `json:"activated"` ActivatedBy APIString `json:"activated_by"` BuildId APIString `json:"build_id"` DistroId APIString `json:"distro_id"` BuildVariant APIString `json:"build_variant"` DependsOn []string `json:"depends_on"` DisplayName APIString `json:"display_name"` HostId APIString `json:"host_id"` Restarts int `json:"restarts"` Execution int `json:"execution"` Order int `json:"order"` Status APIString `json:"status"` Details apiTaskEndDetail `json:"status_details"` Logs logLinks `json:"logs"` TimeTaken APIDuration `json:"time_taken_ms"` ExpectedDuration APIDuration `json:"expected_duration_ms"` EstimatedStart APIDuration `json:"est_wait_to_start_ms"` EstimatedCost float64 `json:"estimated_cost"` PreviousExecutions []APITask `json:"previous_executions,omitempty"` GenerateTask bool `json:"generate_task"` GeneratedBy string `json:"generated_by"` Artifacts []APIFile `json:"artifacts"` DisplayOnly bool `json:"display_only"` ExecutionTasks []APIString `json:"execution_tasks,omitempty"` Mainline bool `json:"mainline"` TaskGroup string `json:"task_group,omitempty"` TaskGroupMaxHosts int `json:"task_group_max_hosts,omitempty"` Blocked bool `json:"blocked"` }
APITask is the model to be returned by the API whenever tasks are fetched.
func (*APITask) BuildFromService ¶
BuildFromService converts from a service level task by loading the data into the appropriate fields of the APITask.
func (*APITask) BuildPreviousExecutions ¶
func (*APITask) GetArtifacts ¶
type APITaskCache ¶
type APITaskCache struct { Id string `json:"id"` DisplayName string `json:"display_name"` Status string `json:"status"` StatusDetails apimodels.TaskEndDetail `json:"task_end_details"` StartTime time.Time `json:"start_time"` TimeTaken time.Duration `json:"time_taken"` Activated bool `json:"activated"` FailedTestNames []string `json:"failed_test_names,omitempty"` }
type APITaskCost ¶
type APITaskCost struct { Id APIString `json:"task_id"` DisplayName APIString `json:"display_name"` DistroId APIString `json:"distro"` BuildVariant APIString `json:"build_variant"` TimeTaken APIDuration `json:"time_taken"` Githash APIString `json:"githash"` EstimatedCost float64 `json:"estimated_cost"` }
APITaskCost is the model to be returned by the API whenever tasks for the cost route are fetched.
func (*APITaskCost) BuildFromService ¶
func (atc *APITaskCost) BuildFromService(t interface{}) error
BuildFromService converts from a service level task by loading the data into the appropriate fields of the APITaskCost. (It leaves out fields unnecessary for the route.)
func (*APITaskCost) ToService ¶
func (atc *APITaskCost) ToService() (interface{}, error)
ToService returns a service layer version cost using the data from APIVersionCost.
type APITaskReliability ¶
type APITaskReliability struct { TaskName APIString `json:"task_name"` BuildVariant APIString `json:"variant,omitempty"` Distro APIString `json:"distro,omitempty"` Date APIString `json:"date"` NumSuccess int `json:"num_success"` NumFailed int `json:"num_failed"` NumTotal int `json:"num_total"` NumTimeout int `json:"num_timeout"` NumTestFailed int `json:"num_test_failed"` NumSystemFailed int `json:"num_system_failed"` NumSetupFailed int `json:"num_setup_failed"` AvgDurationSuccess float64 `json:"avg_duration_success"` SuccessRate float64 `json:"success_rate"` }
APITaskReliability is the model to be returned by the API when querying task execution statistics
func (*APITaskReliability) BuildFromService ¶
func (apiTaskReliability *APITaskReliability) BuildFromService(h interface{}) error
Converts a service level struct to an API level struct
func (*APITaskReliability) StartAtKey ¶
func (apiTaskReliability *APITaskReliability) StartAtKey() string
StartAtKey returns the start_at key parameter that can be used to paginate and start at this element.
func (*APITaskReliability) ToService ¶
func (apiTaskReliability *APITaskReliability) ToService() (interface{}, error)
ToService is not implemented for APITaskStats.
type APITaskStats ¶
type APITaskStats struct { TaskName APIString `json:"task_name"` BuildVariant APIString `json:"variant,omitempty"` Distro APIString `json:"distro,omitempty"` Date APIString `json:"date"` NumSuccess int `json:"num_success"` NumFailed int `json:"num_failed"` NumTotal int `json:"num_total"` NumTimeout int `json:"num_timeout"` NumTestFailed int `json:"num_test_failed"` NumSystemFailed int `json:"num_system_failed"` NumSetupFailed int `json:"num_setup_failed"` AvgDurationSuccess float64 `json:"avg_duration_success"` }
APITaskStats is the model to be returned by the API when querying task execution statistics
func (*APITaskStats) BuildFromService ¶
func (apiTaskStats *APITaskStats) BuildFromService(h interface{}) error
Converts a service level struct to an API level struct
func (*APITaskStats) StartAtKey ¶
func (apiTaskStats *APITaskStats) StartAtKey() string
StartAtKey returns the start_at key parameter that can be used to paginate and start at this element.
func (*APITaskStats) ToService ¶
func (apiTaskStats *APITaskStats) ToService() (interface{}, error)
ToService is not implemented for APITaskStats.
type APITest ¶
type APITest struct { TaskId APIString `json:"task_id"` Status APIString `json:"status"` TestFile APIString `json:"test_file"` Logs TestLogs `json:"logs"` ExitCode int `json:"exit_code"` StartTime APITime `json:"start_time"` EndTime APITime `json:"end_time"` }
APITest contains the data to be returned whenever a test is used in the API.
func (*APITest) BuildFromService ¶
type APITestStats ¶
type APITestStats struct { TestFile APIString `json:"test_file"` TaskName APIString `json:"task_name,omitempty"` BuildVariant APIString `json:"variant,omitempty"` Distro APIString `json:"distro,omitempty"` Date APIString `json:"date"` NumPass int `json:"num_pass"` NumFail int `json:"num_fail"` AvgDurationPass float64 `json:"avg_duration_pass"` }
APITestStats is the model to be returned by the API when querying test execution statistics.
func (*APITestStats) BuildFromService ¶
func (apiTestStats *APITestStats) BuildFromService(h interface{}) error
BuildFromService converts a service level struct to an API level struct.
func (*APITestStats) StartAtKey ¶
func (apiTestStats *APITestStats) StartAtKey() string
StartAtKey returns the start_at key parameter that can be used to paginate and start at this element.
func (*APITestStats) ToService ¶
func (apiTestStats *APITestStats) ToService() (interface{}, error)
ToService is not implemented for APITestStats.
type APITime ¶
func NewTime ¶
NewTime creates a new APITime from an existing time.Time. It handles changing converting from the times time zone to UTC.
func (APITime) MarshalJSON ¶
MarshalJSON implements the custom marshalling of this type so that it can be correctly written out in an API response.
func (*APITime) UnmarshalJSON ¶
UnmarshalJSON implements the custom unmarshalling of this type so that it can be correctly parsed from an API request.
type APITriggerConfig ¶
type APITriggerConfig struct {
GenerateTaskDistro APIString `json:"generate_distro"`
}
func (*APITriggerConfig) BuildFromService ¶
func (c *APITriggerConfig) BuildFromService(h interface{}) error
func (*APITriggerConfig) ToService ¶
func (c *APITriggerConfig) ToService() (interface{}, error)
type APITriggerDefinition ¶
type APITriggerDefinition struct { Project APIString `json:"project"` Level APIString `json:"level"` //build or task DefinitionID APIString `json:"definition_id"` BuildVariantRegex APIString `json:"variant_regex"` TaskRegex APIString `json:"task_regex"` Status APIString `json:"status"` DateCutoff *int `json:"date_cutoff"` ConfigFile APIString `json:"config_file"` GenerateFile APIString `json:"generate_file"` Command APIString `json:"command"` Alias APIString `json:"alias"` }
type APIUIConfig ¶
type APIUIConfig struct { Url APIString `json:"url"` HelpUrl APIString `json:"help_url"` UIv2Url APIString `json:"uiv2_url"` HttpListenAddr APIString `json:"http_listen_addr"` Secret APIString `json:"secret"` DefaultProject APIString `json:"default_project"` CacheTemplates bool `json:"cache_templates"` CsrfKey APIString `json:"csrf_key"` CORSOrigins []string `json:"cors_origins"` }
func (*APIUIConfig) BuildFromService ¶
func (a *APIUIConfig) BuildFromService(h interface{}) error
func (*APIUIConfig) ToService ¶
func (a *APIUIConfig) ToService() (interface{}, error)
type APIUseSpruceOptions ¶
type APIUseSpruceOptions struct {
PatchPage bool `json:"patch_page,omitempty" bson:"patch_page,omitempty"`
}
type APIUserAuthorInformation ¶
func (*APIUserAuthorInformation) BuildFromService ¶
func (u *APIUserAuthorInformation) BuildFromService(h interface{}) error
func (*APIUserAuthorInformation) ToService ¶
func (u *APIUserAuthorInformation) ToService() (interface{}, error)
type APIUserSettings ¶
type APIUserSettings struct { Timezone APIString `json:"timezone"` UseSpruceOptions *APIUseSpruceOptions `json:"use_spruce_options"` GithubUser *APIGithubUser `json:"github_user"` SlackUsername APIString `json:"slack_username"` Notifications *APINotificationPreferences `json:"notifications"` SpruceFeedback *APIFeedbackSubmission `json:"spruce_feedback"` }
func ApplyUserChanges ¶
func ApplyUserChanges(current user.UserSettings, changes APIUserSettings) (APIUserSettings, error)
func (*APIUserSettings) BuildFromService ¶
func (s *APIUserSettings) BuildFromService(h interface{}) error
func (*APIUserSettings) ToService ¶
func (s *APIUserSettings) ToService() (interface{}, error)
type APIVSphereConfig ¶
type APIVSphereConfig struct { Host APIString `json:"host"` Username APIString `json:"username"` Password APIString `json:"password"` }
func (*APIVSphereConfig) BuildFromService ¶
func (a *APIVSphereConfig) BuildFromService(h interface{}) error
func (*APIVSphereConfig) ToService ¶
func (a *APIVSphereConfig) ToService() (interface{}, error)
type APIVersion ¶
type APIVersion struct { Id APIString `json:"version_id"` CreateTime APITime `json:"create_time"` StartTime APITime `json:"start_time"` FinishTime APITime `json:"finish_time"` Revision APIString `json:"revision"` Order int `json:"order"` Project APIString `json:"project"` Author APIString `json:"author"` AuthorEmail APIString `json:"author_email"` Message APIString `json:"message"` Status APIString `json:"status"` Repo APIString `json:"repo"` Branch APIString `json:"branch"` BuildVariants []buildDetail `json:"build_variants_status"` Errors []APIString `json:"errors"` Warnings []APIString `json:"warnings"` Ignored bool `json:"ignored"` }
APIVersion is the model to be returned by the API whenever versions are fetched.
func (*APIVersion) BuildFromService ¶
func (apiVersion *APIVersion) BuildFromService(h interface{}) error
BuildFromService converts from service level structs to an APIVersion.
func (*APIVersion) ToService ¶
func (apiVersion *APIVersion) ToService() (interface{}, error)
ToService returns a service layer build using the data from the APIVersion.
type APIVersionCost ¶
type APIVersionCost struct { VersionId APIString `json:"version_id"` SumTimeTaken APIDuration `json:"sum_time_taken"` EstimatedCost float64 `json:"estimated_cost"` }
APIVersionCost is the model to be returned by the API whenever cost data is fetched by version id.
func (*APIVersionCost) BuildFromService ¶
func (apiVersionCost *APIVersionCost) BuildFromService(h interface{}) error
BuildFromService converts from a service level task by loading the data into the appropriate fields of the APIVersionCost.
func (*APIVersionCost) ToService ¶
func (apiVersionCost *APIVersionCost) ToService() (interface{}, error)
ToService returns a service layer version cost using the data from APIVersionCost.
type APIVersions ¶
type APIVersions struct { // whether or not the version element actually consists of multiple inactive // versions rolled up into one RolledUp bool `json:"rolled_up"` Versions []APIVersion `json:"versions"` }
type APIWebhookSubscriber ¶
type APIWebhookSubscriber struct { URL APIString `json:"url" mapstructure:"url"` Secret APIString `json:"secret" mapstructure:"secret"` }
func (*APIWebhookSubscriber) BuildFromService ¶
func (s *APIWebhookSubscriber) BuildFromService(h interface{}) error
func (*APIWebhookSubscriber) ToService ¶
func (s *APIWebhookSubscriber) ToService() (interface{}, error)
type APIapiConfig ¶
type APIapiConfig struct { HttpListenAddr APIString `json:"http_listen_addr"` GithubWebhookSecret APIString `json:"github_webhook_secret"` }
func (*APIapiConfig) BuildFromService ¶
func (a *APIapiConfig) BuildFromService(h interface{}) error
func (*APIapiConfig) ToService ¶
func (a *APIapiConfig) ToService() (interface{}, error)
type CreateHost ¶
type CreateHost struct { DNSName APIString `json:"dns_name"` IP APIString `json:"ip_address"` InstanceID APIString `json:"instance_id"` HostID APIString `json:"host_id"` ParentID APIString `json:"parent_id"` Image APIString `json:"image"` Command APIString `json:"command"` }
func (*CreateHost) BuildFromService ¶
func (createHost *CreateHost) BuildFromService(h interface{}) error
func (*CreateHost) ToService ¶
func (createHost *CreateHost) ToService() (interface{}, error)
type DistroInfo ¶
type HostRequestOptions ¶
type HostRequestOptions struct { DistroID string `json:"distro"` TaskID string `json:"task"` KeyName string `json:"keyname"` UserData string `json:"userdata"` InstanceTags []host.Tag `json:"instance_tags"` }
HostPostRequest is a struct that holds the format of a POST request to /hosts
type MockModel ¶
type MockModel struct { FieldId string FieldInt1 int FieldInt2 int FieldMap map[string]string FieldStruct *MockSubStruct }
func (*MockModel) BuildFromService ¶
type MockSubStruct ¶
type MockSubStruct struct {
SubInt int
}
type Model ¶
Model defines how an API resource which will be both taken from requests and turned into service layer models and taken from service layer models and turned into api models to be returned.
func AdminDbToRestModel ¶
func AdminDbToRestModel(in evergreen.ConfigSection) (Model, error)
type RestartResponse ¶
type RestartResponse struct { ItemsRestarted []string `json:"items_restarted"` ItemsErrored []string `json:"items_errored"` }
RestartTasksResponse is the response model returned from the /admin/restart route
func (*RestartResponse) BuildFromService ¶
func (rtr *RestartResponse) BuildFromService(h interface{}) error
BuildFromService builds a model from the service layer
func (*RestartResponse) ToService ¶
func (rtr *RestartResponse) ToService() (interface{}, error)
ToService is not implemented for /admin/restart
type StartAtKey ¶
type StartAtKey struct {
// contains filtered or unexported fields
}
StartAtKey is a struct used to build the start_at key parameter for pagination.
func (StartAtKey) String ¶
func (s StartAtKey) String() string
type TestLogs ¶
type TestLogs struct { URL APIString `json:"url"` LineNum int `json:"line_num"` URLRaw APIString `json:"url_raw"` LogId APIString `json:"log_id"` }
TestLogs is a struct for storing the information about logs that will be written out as part of an APITest.
type VersionVariantData ¶
type VersionVariantData struct { Rows map[string]BuildList `json:"rows"` Versions []APIVersions `json:"versions"` BuildVariants []string `json:"build_variants"` }
func (*VersionVariantData) BuildFromService ¶
func (v *VersionVariantData) BuildFromService(h interface{}) error
func (*VersionVariantData) ToService ¶
func (v *VersionVariantData) ToService() (interface{}, error)
Source Files ¶
- admin.go
- admin_event.go
- artifact.go
- build.go
- cli_update.go
- commit_queue.go
- cost.go
- createhost.go
- distro.go
- doc.go
- github_hook.go
- host.go
- mocks.go
- model.go
- notification.go
- notifications.go
- patch.go
- project.go
- project_event.go
- reliability.go
- stats.go
- status.go
- string.go
- subscriber.go
- subscriptions.go
- task.go
- test.go
- time.go
- user.go
- version.go
- versions.go