response

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

Package response contains plain old Go types returned by wharf-web in the HTTP responses, with Swaggo-specific Go tags.

Copied from https://github.com/iver-wharf/wharf-api/blob/v5.1.2/pkg/model/response/response.go

Index

Constants

This section is empty.

Variables

View Source
var ArtifactJSONFields = struct {
	ArtifactID string
	Name       string
	FileName   string
}{
	ArtifactID: "artifactId",
	Name:       "name",
	FileName:   "fileName",
}

ArtifactJSONFields holds the JSON field names for each field. Useful in ordering statements to map the correct field to the correct database column.

View Source
var BuildJSONFields = struct {
	BuildID     string
	Environment string
	CompletedOn string
	ScheduledOn string
	StartedOn   string
	Stage       string
	StatusID    string
	IsInvalid   string
}{
	BuildID:     "buildId",
	Environment: "environment",
	CompletedOn: "finishedOn",
	ScheduledOn: "scheduledOn",
	StartedOn:   "startedOn",
	Stage:       "stage",
	StatusID:    "statusId",
	IsInvalid:   "isInvalid",
}

BuildJSONFields holds the JSON field names for each field. Useful in ordering statements to map the correct field to the correct database column.

View Source
var ProjectJSONFields = struct {
	ProjectID       string
	RemoteProjectID string
	Name            string
	GroupName       string
	Description     string
	GitURL          string
}{
	ProjectID:       "projectId",
	RemoteProjectID: "remoteProjectId",
	Name:            "name",
	GroupName:       "groupName",
	Description:     "description",
	GitURL:          "gitUrl",
}

ProjectJSONFields holds the JSON field names for each field. Useful in ordering statements to map the correct field to the correct database column.

View Source
var ProviderJSONFields = struct {
	ProviderID string
	Name       string
	URL        string
	TokenID    string
}{
	ProviderID: "providerId",
	Name:       "name",
	URL:        "url",
	TokenID:    "tokenId",
}

ProviderJSONFields holds the JSON field names for each field. Useful in ordering statements to map the correct field to the correct database column.

View Source
var TokenJSONFields = struct {
	TokenID  string
	Token    string
	UserName string
}{
	TokenID:  "tokenId",
	Token:    "token",
	UserName: "userName",
}

TokenJSONFields holds the JSON field names for each field. Useful in ordering statements to map the correct field to the correct database column.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	TimeMetadata
	ArtifactID uint   `json:"artifactId" minimum:"0"`
	BuildID    uint   `json:"buildId" minimum:"0"`
	Name       string `json:"name"`
	FileName   string `json:"fileName"`
}

Artifact holds the binary data as well as metadata about that binary such as the file name and which build it belongs to.

type ArtifactMetadata

type ArtifactMetadata struct {
	TimeMetadata
	FileName   string `json:"fileName"`
	ArtifactID uint   `json:"artifactId" minimum:"0"`
}

ArtifactMetadata contains the file name and artifact ID of an Artifact.

type Branch

type Branch struct {
	TimeMetadata
	BranchID  uint   `json:"branchId" minimum:"0"`
	ProjectID uint   `json:"projectId" minimum:"0"`
	Name      string `json:"name"`
	Default   bool   `json:"default"`
	TokenID   uint   `json:"tokenId" minimum:"0"`
}

Branch holds details about a project's branch.

type BranchList

type BranchList struct {
	DefaultBranch *Branch  `json:"defaultBranch" extensions:"x-nullable"`
	Branches      []Branch `json:"branches"`
}

BranchList holds a list of branches, and a separate field for the default branch (if any).

type Build

type Build struct {
	TimeMetadata
	BuildID               uint                  `json:"buildId" minimum:"0"`
	StatusID              int                   `json:"statusId" enums:"0,1,2,3"`
	Status                BuildStatus           `json:"status" enums:"Scheduling,Running,Completed,Failed"`
	ProjectID             uint                  `json:"projectId" minimum:"0"`
	ScheduledOn           null.Time             `json:"scheduledOn" format:"date-time" extensions:"x-nullable"`
	StartedOn             null.Time             `json:"startedOn" format:"date-time" extensions:"x-nullable"`
	CompletedOn           null.Time             `json:"finishedOn" format:"date-time" extensions:"x-nullable"`
	GitBranch             string                `json:"gitBranch"`
	Environment           null.String           `json:"environment" swaggertype:"string" extensions:"x-nullable"`
	Stage                 string                `json:"stage"`
	WorkerID              string                `json:"workerId" example:"5d6bcf20-81fd-4ad8-a446-735aa8423dfe"`
	Params                []BuildParam          `json:"params"`
	IsInvalid             bool                  `json:"isInvalid"`
	TestResultSummaries   []TestResultSummary   `json:"testResultSummaries"`
	TestResultListSummary TestResultListSummary `json:"testResultListSummary"`
	Engine                *Engine               `json:"engine" extensions:"x-nullable"`
}

Build holds data about the state of a build. Which parameters was used to start it, what status it holds, et.al.

type BuildParam

type BuildParam struct {
	BuildID uint   `json:"buildId" minimum:"0"`
	Name    string `json:"name"`
	Value   string `json:"value"`
}

BuildParam holds the name and value of an input parameter fed into a build.

type BuildReferenceWrapper

type BuildReferenceWrapper struct {
	BuildReference string `json:"buildRef" example:"123"`
}

BuildReferenceWrapper holds a build reference. A unique identifier to a build.

type BuildStatus

type BuildStatus string

BuildStatus is an enum of different states for a build.

const (
	// BuildScheduling means the build has been registered, but no code
	// execution has begun yet. This is usually quite an ephemeral state.
	BuildScheduling BuildStatus = "Scheduling"
	// BuildRunning means the build is executing right now. The execution
	// engine has load in the target code paths and repositories.
	BuildRunning BuildStatus = "Running"
	// BuildCompleted means the build has finished execution successfully.
	BuildCompleted BuildStatus = "Completed"
	// BuildFailed means that something went wrong with the build. Could be a
	// misconfiguration in the .wharf-ci.yml file, or perhaps a scripting error
	// in some build step.
	BuildFailed BuildStatus = "Failed"
)

type CreatedLogsSummary added in v2.1.0

type CreatedLogsSummary struct {
	LogsInserted uint
}

CreatedLogsSummary contains a summary of the logs that was created after closing a CreateBuildLogStream.

type Engine added in v2.2.0

type Engine struct {
	ID   string `json:"id" example:"primary"`
	Name string `json:"name" example:"Primary"`
	URL  string `json:"url" example:"http://wharf-cmd-provisioner/trigger"`
}

Engine is an execution engine wharf-api uses to perform its builds. Engines are configured in wharf-api's configuration, and cannot be changed on a running instance of wharf-api.

type EngineList added in v2.2.0

type EngineList struct {
	DefaultEngine *Engine  `json:"defaultEngine" extensions:"x-nullable"`
	List          []Engine `json:"list"`
}

EngineList contains a list of execution engines that the wharf-api is configured with, as well as a declaration of which one is the default engine that will be used on new builds if no engine is specified.

type HealthStatus

type HealthStatus struct {
	Message   string `json:"message" example:"API is healthy."`
	IsHealthy bool   `json:"isHealthy" example:"true"`
}

HealthStatus holds a human-readable string stating the health of the API and its integrations, as well as a boolean for easy machine-readability.

type Log

type Log struct {
	LogID     uint      `json:"logId" minimum:"0"`
	BuildID   uint      `json:"buildId" minimum:"0"`
	Message   string    `json:"message"`
	Timestamp time.Time `json:"timestamp" format:"date-time"`
}

Log is a single logged line for a build.

type PaginatedArtifacts

type PaginatedArtifacts struct {
	List       []Artifact `json:"list"`
	TotalCount int64      `json:"totalCount"`
}

PaginatedArtifacts is a list of artifacts as well as the explicit total count field.

type PaginatedBranches

type PaginatedBranches struct {
	List          []Branch `json:"list"`
	TotalCount    int64    `json:"totalCount"`
	DefaultBranch *Branch  `json:"defaultBranch"`
}

PaginatedBranches is a list of branches as well as an explicit total count field.

type PaginatedBuilds

type PaginatedBuilds struct {
	List       []Build `json:"list"`
	TotalCount int64   `json:"totalCount"`
}

PaginatedBuilds is a list of builds as well as an explicit total count field.

type PaginatedProjects

type PaginatedProjects struct {
	List       []Project `json:"list"`
	TotalCount int64     `json:"totalCount"`
}

PaginatedProjects is a list of projects as well as the explicit total count field.

type PaginatedProviders

type PaginatedProviders struct {
	List       []Provider `json:"list"`
	TotalCount int64      `json:"totalCount"`
}

PaginatedProviders is a list of providers as well as the explicit total count field.

type PaginatedTestResultDetails

type PaginatedTestResultDetails struct {
	List       []TestResultDetail `json:"list"`
	TotalCount int64              `json:"totalCount"`
}

PaginatedTestResultDetails is a list of test result details as well as the explicit total count field.

type PaginatedTestResultSummaries

type PaginatedTestResultSummaries struct {
	List       []TestResultSummary `json:"list"`
	TotalCount int64               `json:"totalCount"`
}

PaginatedTestResultSummaries is a list of test result summaries as well as the explicit total count field.

type PaginatedTokens

type PaginatedTokens struct {
	List       []Token `json:"list"`
	TotalCount int64   `json:"totalCount"`
}

PaginatedTokens is a list of tokens as well as the explicit total count field.

type Ping

type Ping struct {
	Message string `json:"message" example:"pong"`
}

Ping pongs.

type Project

type Project struct {
	TimeMetadata
	ProjectID             uint        `json:"projectId" minimum:"0"`
	RemoteProjectID       string      `json:"remoteProjectId"`
	Name                  string      `json:"name"`
	GroupName             string      `json:"groupName"`
	Description           string      `json:"description"`
	AvatarURL             string      `json:"avatarUrl"`
	TokenID               uint        `json:"tokenId" minimum:"0"`
	ProviderID            uint        `json:"providerId" minimum:"0"`
	Provider              *Provider   `json:"provider" extensions:"x-nullable"`
	BuildDefinition       string      `json:"buildDefinition"`
	Branches              []Branch    `json:"branches"`
	GitURL                string      `json:"gitUrl"`
	ParsedBuildDefinition interface{} `json:"build" swaggertype:"object" extensions:"x-nullable"`
}

Project holds details about a project.

type ProjectOverrides

type ProjectOverrides struct {
	ProjectID   uint   `json:"projectId" minimum:"0"`
	Description string `json:"description"`
	AvatarURL   string `json:"avatarUrl"`
	GitURL      string `json:"gitUrl"`
}

ProjectOverrides holds field overrides for a project.

type Provider

type Provider struct {
	TimeMetadata
	ProviderID uint         `json:"providerId" minimum:"0"`
	Name       ProviderName `json:"name" enums:"azuredevops,gitlab,github"`
	URL        string       `json:"url"`
	TokenID    uint         `json:"tokenId" minimum:"0"`
}

Provider holds metadata about a connection to a remote provider. Some of importance are the URL field of where to find the remote, and the token field used to authenticate.

type ProviderName

type ProviderName string

ProviderName is an enum of different providers that are available over at https://github.com/iver-wharf

const (
	// ProviderAzureDevOps refers to the Azure DevOps provider plugin,
	// https://github.com/iver-wharf/wharf-provider-azuredevops
	ProviderAzureDevOps ProviderName = "azuredevops"
	// ProviderGitLab refers to the GitLab provider plugin,
	// https://github.com/iver-wharf/wharf-provider-gitlab
	ProviderGitLab ProviderName = "gitlab"
	// ProviderGitHub refers to the GitHub provider plugin,
	// https://github.com/iver-wharf/wharf-provider-github
	ProviderGitHub ProviderName = "github"
)

type TestResultDetail

type TestResultDetail struct {
	TimeMetadata
	TestResultDetailID uint             `json:"testResultDetailId" minimum:"0"`
	ArtifactID         uint             `json:"artifactId" minimum:"0"`
	BuildID            uint             `json:"buildId" minimum:"0"`
	Name               string           `json:"name"`
	Message            null.String      `json:"message" swaggertype:"string" extensions:"x-nullable"`
	StartedOn          null.Time        `json:"startedOn" format:"date-time" extensions:"x-nullable"`
	CompletedOn        null.Time        `json:"completedOn" format:"date-time" extensions:"x-nullable"`
	Status             TestResultStatus `json:"status" enums:"Failed,Passed,Skipped"`
}

TestResultDetail contains data about a single test in a test result file.

type TestResultListSummary

type TestResultListSummary struct {
	BuildID uint `json:"buildId" minimum:"0"`
	Total   uint `json:"total"`
	Failed  uint `json:"failed"`
	Passed  uint `json:"passed"`
	Skipped uint `json:"skipped"`
}

TestResultListSummary contains data about several test result files.

type TestResultStatus

type TestResultStatus string

TestResultStatus is an enum of different states a test result can be in.

const (
	// TestResultStatusSuccess means the test succeeded.
	TestResultStatusSuccess TestResultStatus = "Success"
	// TestResultStatusFailed means the test failed.
	TestResultStatusFailed TestResultStatus = "Failed"
	// TestResultStatusSkipped means the test was skipped.
	TestResultStatusSkipped TestResultStatus = "Skipped"
)

type TestResultSummary

type TestResultSummary struct {
	TimeMetadata
	TestResultSummaryID uint   `json:"testResultSummaryId" minimum:"0"`
	FileName            string `json:"fileName"`
	ArtifactID          uint   `json:"artifactId" minimum:"0"`
	BuildID             uint   `json:"buildId" minimum:"0"`
	Total               uint   `json:"total"`
	Failed              uint   `json:"failed"`
	Passed              uint   `json:"passed"`
	Skipped             uint   `json:"skipped"`
}

TestResultSummary contains data about a single test result file.

type TestStatus

type TestStatus string

TestStatus is an enum of different states a test run or test summary can be in.

const (
	// TestStatusSuccess means the test run or test summary passed, or in the
	// case that there are multiple tests then that there are no failing tests
	// and at least one successful test.
	TestStatusSuccess TestStatus = "Success"

	// TestStatusFailed means the test run or test summary failed, or in the
	// case that there are multiple tests then that at least one test failed.
	TestStatusFailed TestStatus = "Failed"

	// TestStatusNoTests means the test run or test summary is inconclusive,
	// where there are neither any passing nor failing tests.
	TestStatusNoTests TestStatus = "No tests"
)

type TestsResults

type TestsResults struct {
	Passed uint       `json:"passed"`
	Failed uint       `json:"failed"`
	Status TestStatus `json:"status" enums:"Success,Failed,No tests"`
}

TestsResults holds how many builds has passed and failed. A test result has the status of "Failed" if there are any failed tests, "Success" if there are any passing tests and no failed tests, and "No tests" if there are no failed nor passing tests.

type TimeMetadata

type TimeMetadata struct {
	UpdatedAt *time.Time `json:"updatedAt" format:"date-time" extensions:"x-nullable"`
	CreatedAt *time.Time `json:"createdAt" format:"date-time" extensions:"x-nullable"`
}

TimeMetadata contains fields of when an object was created/added to the database, and when any field was last updated.

type Token

type Token struct {
	TimeMetadata
	TokenID  uint   `json:"tokenId" minimum:"0"`
	Token    string `json:"token" format:"password"`
	UserName string `json:"userName"`
}

Token holds credentials for a remote provider.

Jump to

Keyboard shortcuts

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