models

package
v0.0.0-...-1fa52ee Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0, BSD-2-Clause, ISC, + 1 more Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FAILED      = "Failed"
	ERROR       = "ERROR"
	UNDEPLOYED  = "UNDEPLOYED"
	UNKNOWN     = "Unknown"
	STOPPED     = "Stopped"
	SKIPPED     = "Skipped"
	SUCCESSFUL  = "Successful"
	COMPLETED   = "COMPLETED"
	PAUSED      = "COMPLETED"
	HALTED      = "HALTED"
	IN_PROGRESS = "IN_PROGRESS"
	PENDING     = "PENDING"
	BUILDING    = "BUILDING"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiBambooDeployBuild

type ApiBambooDeployBuild struct {
	DeploymentVersion     ApiBambooDeploymentVersion `json:"deploymentVersion"`
	DeploymentVersionName string                     `json:"deploymentVersionName"`
	Id                    uint64                     `json:"id"`
	DeploymentState       string                     `json:"deploymentState"`
	LifeCycleState        string                     `json:"lifeCycleState"`
	StartedDate           int64                      `json:"startedDate"`
	QueuedDate            int64                      `json:"queuedDate"`
	ExecutedDate          int64                      `json:"executedDate"`
	FinishedDate          int64                      `json:"finishedDate"`
	ReasonSummary         string                     `json:"reasonSummary"`
	Key                   ApiBambooDeployBuildKey    `json:"key"`
	Agent                 ApiBambooDeployBuildAgent  `json:"agent"`
	Operations            ApiBambooOperations        `json:"operations"`
}

func (*ApiBambooDeployBuild) Convert

func (api *ApiBambooDeployBuild) Convert(op *BambooOptions, envName string) []*BambooDeployBuild

type ApiBambooDeployBuildAgent

type ApiBambooDeployBuildAgent struct {
	Id   uint64 `json:"id"`
	Name string `json:"name"`

	Type   string `json:"type"`
	Active bool   `json:"active"`
	Enable bool   `json:"enabled"`
	Busy   bool   `json:"busy"`
}

type ApiBambooDeployBuildKey

type ApiBambooDeployBuildKey struct {
	Key          string       `json:"key"`
	EntityKey    ApiBambooKey `json:"entityKey"`
	ResultNumber uint64       `json:"resultNumber"`
}

type ApiBambooDeployProject

type ApiBambooDeployProject struct {
	ID           uint64                 `json:"id"`
	OID          string                 `json:"oid"`
	Key          ApiBambooKey           `json:"key"`
	Name         string                 `json:"name"`
	PlanKey      ApiBambooKey           `json:"planKey"`
	Description  string                 `json:"description"`
	Environments []ApiBambooEnvironment `json:"environments"`
	Operations   ApiBambooOperations    `json:"operations"`
}

type ApiBambooDeploymentVersion

type ApiBambooDeploymentVersion struct {
	ID              uint64 `json:"id"`
	Name            string `json:"name"`
	CreationDate    int64  `json:"creationDate"`
	CreatorUserName string `json:"creatorUserName"`
	Items           []struct {
		ID            int    `json:"id"`
		Name          string `json:"name"`
		PlanResultKey struct {
			Key       string `json:"key"`
			EntityKey struct {
				Key string `json:"key"`
			} `json:"entityKey"`
			ResultNumber int `json:"resultNumber"`
		} `json:"planResultKey"`
		Type        string `json:"type"`
		Label       string `json:"label"`
		Location    string `json:"location"`
		CopyPattern string `json:"copyPattern"`
		Size        int    `json:"size"`
	} `json:"items"`
	PlanBranchName string `json:"planBranchName"`
}

type ApiBambooEnvironment

type ApiBambooEnvironment struct {
	ID                  uint64              `json:"id"`
	Key                 ApiBambooKey        `json:"key"`
	Name                string              `json:"name"`
	Description         string              `json:"description"`
	DeploymentProjectId uint64              `json:"deploymentProjectId"`
	Operations          ApiBambooOperations `json:"operations"`
	Position            uint64              `json:"position"`
	ConfigurationState  string              `json:"configurationState"`
}

type ApiBambooJob

type ApiBambooJob struct {
	Id           string `json:"id"`
	Type         string `json:"type"`
	SearchEntity struct {
		Id          string `json:"id"`
		Key         string `json:"key"`
		ProjectName string `json:"projectName"`
		PlanName    string `json:"planName"`
		BranchName  string `json:"branchName"`
		StageName   string `json:"stageName"`
		JobName     string `json:"jobName"`
		Description string `json:"description"`
		Type        string `json:"type"`
	} `json:"searchEntity"`
}

func (*ApiBambooJob) Convert

func (apiRes *ApiBambooJob) Convert() *BambooJob

type ApiBambooJobBuild

type ApiBambooJobBuild ApiBambooPlanBuild

func (*ApiBambooJobBuild) Convert

func (apiRes *ApiBambooJobBuild) Convert() *BambooJobBuild

type ApiBambooKey

type ApiBambooKey struct {
	Key string `json:"key"`
}
type ApiBambooLink struct {
	Href string `json:"href"`
	Rel  string `json:"rel"`
}

type ApiBambooOperations

type ApiBambooOperations struct {
	CanView                   bool `json:"canView"`
	CanEdit                   bool `json:"canEdit"`
	CanDelete                 bool `json:"canDelete"`
	AllowedToExecute          bool `json:"allowedToExecute"`
	CanExecute                bool `json:"canExecute"`
	AllowedToCreateVersion    bool `json:"allowedToCreateVersion"`
	AllowedToSetVersionStatus bool `json:"allowedToSetVersionStatus"`
}

type ApiBambooPlan

type ApiBambooPlan struct {
	ShortName string `json:"shortName"`
	ShortKey  string `json:"shortKey"`
	Type      string `json:"type"`
	Enabled   bool   `json:"enabled"`
	Link      struct {
		Href string `json:"href"`
		Rel  string `json:"rel"`
	} `json:"link"`
	Key     string `json:"key"`
	Name    string `json:"name"`
	PlanKey struct {
		Key string `json:"key"`
	} `json:"planKey"`
}

func (ApiBambooPlan) ConvertApiScope

func (p ApiBambooPlan) ConvertApiScope() plugin.ToolLayerScope

type ApiBambooPlanBuild

type ApiBambooPlanBuild struct {
	Expand                   string     `json:"expand"`
	PlanName                 string     `json:"planName"`
	ProjectName              string     `json:"projectName"`
	BuildResultKey           string     `json:"buildResultKey"`
	LifeCycleState           string     `json:"lifeCycleState"`
	Id                       int        `json:"id"`
	BuildStartedTime         *time.Time `json:"buildStartedTime"`
	PrettyBuildStartedTime   string     `json:"prettyBuildStartedTime"`
	BuildCompletedTime       *time.Time `json:"buildCompletedTime"`
	BuildCompletedDate       *time.Time `json:"buildCompletedDate"`
	QueueStartedTime         *time.Time `json:"queueStartedTime"`
	QueueDuration            int64      `json:"queueDuration"`
	QueueTimeInSeconds       int64      `json:"queueTimeInSeconds"`
	PrettyBuildCompletedTime string     `json:"prettyBuildCompletedTime"`
	BuildDurationInSeconds   int        `json:"buildDurationInSeconds"`
	BuildDuration            int        `json:"buildDuration"`
	BuildDurationDescription string     `json:"buildDurationDescription"`
	BuildRelativeTime        string     `json:"buildRelativeTime"`
	VcsRevisionKey           string     `json:"vcsRevisionKey"`
	VcsRevisions             struct {
		Size        int    `json:"size"`
		Expand      string `json:"expand"`
		VcsRevision []struct {
			RepositoryId   int    `json:"repositoryId"`
			RepositoryName string `json:"repositoryName"`
			VcsRevisionKey string `json:"vcsRevisionKey"`
		} `json:"vcsRevision"`
		StartIndex int `json:"start-index"`
		MaxResult  int `json:"max-result"`
	} `json:"vcsRevisions"`
	BuildTestSummary     string `json:"buildTestSummary"`
	SuccessfulTestCount  int    `json:"successfulTestCount"`
	FailedTestCount      int    `json:"failedTestCount"`
	QuarantinedTestCount int    `json:"quarantinedTestCount"`
	SkippedTestCount     int    `json:"skippedTestCount"`
	Continuable          bool   `json:"continuable"`
	OnceOff              bool   `json:"onceOff"`
	Restartable          bool   `json:"restartable"`
	NotRunYet            bool   `json:"notRunYet"`
	Finished             bool   `json:"finished"`
	Successful           bool   `json:"successful"`
	BuildReason          string `json:"buildReason"`
	ReasonSummary        string `json:"reasonSummary"`
	Key                  string `json:"key"`
	PlanResultKey        struct {
		Key       string `json:"key"`
		EntityKey struct {
			Key string `json:"key"`
		} `json:"entityKey"`
		ResultNumber int `json:"resultNumber"`
	} `json:"planResultKey"`
	State       string `json:"state"`
	BuildState  string `json:"buildState"`
	Number      int    `json:"number"`
	BuildNumber int    `json:"buildNumber"`
	Parent      `json:"parent"`
}

func (*ApiBambooPlanBuild) Convert

func (apiRes *ApiBambooPlanBuild) Convert() *BambooPlanBuild

type ApiBambooSearchPlanResponse

type ApiBambooSearchPlanResponse struct {
	ApiBambooSizeData `json:"squash"`
	SearchResults     []ApiSearchResult `json:"searchResults"`
}

type ApiBambooServerInfo

type ApiBambooServerInfo struct {
	Version     string     `json:"version"`
	Edition     string     `json:"edition"`
	BuildDate   *time.Time `json:"buildDate"`
	BuildNumber string     `json:"buildNumber"`
	State       string     `json:"state"`
}

type ApiBambooSizeData

type ApiBambooSizeData struct {
	Size       int `json:"size"`
	StartIndex int `json:"start-index"`
	MaxResult  int `json:"max-result"`
}

type ApiRepository

type ApiRepository struct {
	Size          int         `json:"size"`
	SearchResults interface{} `json:"searchResults"`
	StartIndex    int         `json:"start-index"`
	MaxResult     int         `json:"max-result"`
}

type ApiSearchResult

type ApiSearchResult struct {
	Id           string       `json:"id"`
	Type         string       `json:"type"`
	SearchEntity SearchEntity `json:"searchEntity"`
}

type BambooApiParams

type BambooApiParams struct {
	ConnectionId uint64 `json:"connectionId"`
	PlanKey      string
}

type BambooConn

type BambooConn struct {
	api.RestConnection `mapstructure:",squash"`
	//TODO you may need to use helper.BasicAuth instead of helper.AccessToken
	api.BasicAuth `mapstructure:",squash"`
}

TODO Please modify the following code to fit your needs This object conforms to what the frontend currently sends.

func (*BambooConn) PrepareApiClient

func (conn *BambooConn) PrepareApiClient(apiClient plugin.ApiClient) errors.Error

PrepareApiClient test api and set the IsPrivateToken,version,UserId and so on.

func (*BambooConn) Sanitize

func (conn *BambooConn) Sanitize() BambooConn

type BambooConnection

type BambooConnection struct {
	api.BaseConnection `mapstructure:",squash"`
	BambooConn         `mapstructure:",squash"`
}

func (*BambooConnection) MergeFromRequest

func (connection *BambooConnection) MergeFromRequest(target *BambooConnection, body map[string]interface{}) error

func (BambooConnection) Sanitize

func (connection BambooConnection) Sanitize() BambooConnection

func (BambooConnection) TableName

func (BambooConnection) TableName() string

type BambooDeployBuild

type BambooDeployBuild struct {
	ConnectionId          uint64     `json:"connection_id" gorm:"primaryKey"`
	DeployBuildId         uint64     `json:"deploy_build_id" gorm:"primaryKey"`
	PlanResultKey         string     `json:"planResultKey"`
	DeploymentVersionName string     `json:"deploymentVersionName"`
	DeploymentState       string     `json:"deploymentState"`
	LifeCycleState        string     `json:"lifeCycleState"`
	StartedDate           *time.Time `json:"startedDate"`
	QueuedDate            *time.Time `json:"queuedDate"`
	ExecutedDate          *time.Time `json:"executedDate"`
	FinishedDate          *time.Time `json:"finishedDate"`
	ReasonSummary         string     `json:"reasonSummary"`
	ProjectKey            string     `json:"project_key" gorm:"index"`
	PlanKey               string     `json:"plan_key" gorm:"index"`
	Environment           string     `gorm:"type:varchar(255)"`
	PlanBranchName        string     `gorm:"type:varchar(255)"`
	ApiBambooOperations
	common.NoPKModel
}

func (BambooDeployBuild) TableName

func (BambooDeployBuild) TableName() string

type BambooDeployEnvironment

type BambooDeployEnvironment struct {
	ConnectionId        uint64 `json:"connection_id" gorm:"primaryKey"`
	EnvId               uint64 `json:"env_id" gorm:"primaryKey"`
	EnvKey              string `json:"key" gorm:"index"`
	Name                string `json:"name" gorm:"index"`
	PlanKey             string `json:"plan_key" gorm:"index"`
	ProjectKey          string `json:"project_key" gorm:"index"`
	Description         string `json:"description"`
	DeploymentProjectId uint64 `json:"deploymentProjectId"`
	Position            uint64 `json:"position"`
	ConfigurationState  string `json:"configurationState"`

	ApiBambooOperations
	common.NoPKModel
}

func (*BambooDeployEnvironment) Convert

func (b *BambooDeployEnvironment) Convert(apiEnv *ApiBambooEnvironment)

func (BambooDeployEnvironment) TableName

func (BambooDeployEnvironment) TableName() string

type BambooJob

type BambooJob struct {
	ConnectionId uint64 `gorm:"primaryKey"`
	JobKey       string `gorm:"primaryKey"`
	Id           string
	Name         string `json:"name"`
	PlanKey      string `json:"planKey"`
	PlanName     string `json:"planName"`
	ProjectKey   string `gorm:"index"`
	ProjectName  string `json:"projectName"`
	Description  string `json:"description"`
	BranchName   string `json:"branchName"`
	StageName    string `json:"stageName"`
	Type         string `json:"type"`
	common.NoPKModel
}

func (BambooJob) TableName

func (BambooJob) TableName() string

type BambooJobBuild

type BambooJobBuild struct {
	ConnectionId             uint64     `gorm:"primaryKey"`
	JobBuildKey              string     `gorm:"primaryKey"`
	PlanBuildKey             string     `gorm:"index"`
	Expand                   string     `json:"expand"`
	Number                   int        `json:"number"`
	BuildNumber              int        `json:"buildNumber"`
	JobName                  string     `gorm:"index"`
	JobKey                   string     `gorm:"index"`
	PlanName                 string     `gorm:"index"`
	PlanKey                  string     `gorm:"index"`
	ProjectName              string     `gorm:"index"`
	ProjectKey               string     `gorm:"index"`
	BuildResultKey           string     `json:"buildResultKey"`
	LifeCycleState           string     `json:"lifeCycleState"`
	BuildStartedTime         *time.Time `json:"buildStartedTime"`
	PrettyBuildStartedTime   string     `json:"prettyBuildStartedTime"`
	BuildCompletedTime       *time.Time `json:"buildCompletedTime"`
	QueueStartedTime         *time.Time `json:"queueStartedTime"`
	QueueDuration            int64      `json:"queueDuration"`
	QueueDurationInSeconds   int64      `json:"queueDurationInSeconds"`
	BuildCompletedDate       *time.Time `json:"buildCompletedDate"`
	PrettyBuildCompletedTime string     `json:"prettyBuildCompletedTime"`
	BuildDurationInSeconds   int        `json:"buildDurationInSeconds"`
	BuildDuration            int        `json:"buildDuration"`
	BuildDurationDescription string     `json:"buildDurationDescription"`
	BuildRelativeTime        string     `json:"buildRelativeTime"`
	VcsRevisionKey           string     `json:"vcsRevisionKey"`
	BuildTestSummary         string     `json:"buildTestSummary"`
	SuccessfulTestCount      int        `json:"successfulTestCount"`
	FailedTestCount          int        `json:"failedTestCount"`
	QuarantinedTestCount     int        `json:"quarantinedTestCount"`
	SkippedTestCount         int        `json:"skippedTestCount"`
	Continuable              bool       `json:"continuable"`
	OnceOff                  bool       `json:"onceOff"`
	Restartable              bool       `json:"restartable"`
	NotRunYet                bool       `json:"notRunYet"`
	Finished                 bool       `json:"finished"`
	Successful               bool       `json:"successful"`
	BuildReason              string     `json:"buildReason"`
	ReasonSummary            string     `json:"reasonSummary"`
	State                    string     `json:"state"`
	BuildState               string     `json:"buildState"`
	Type                     string     `gorm:"type:varchar(255)"`
	Environment              string     `gorm:"type:varchar(255)"`
	JobResultKey             string
	common.NoPKModel
}

func (BambooJobBuild) TableName

func (BambooJobBuild) TableName() string

type BambooOptions

type BambooOptions struct {
	// TODO add some custom options here if necessary
	// options means some custom params required by plugin running.
	// Such As How many rows do your want
	// You can use it in sub tasks and you need pass it in main.go and pipelines.
	ConnectionId         uint64 `json:"connectionId" mapstructure:"connectionId"`
	PlanKey              string `json:"planKey" mapstructure:"planKey"`
	ScopeConfigId        uint64 ` json:"scopeConfigId" mapstructure:"scopeConfigId,omitempty"`
	*BambooScopeConfig   `json:"scopeConfig" mapstructure:"scopeConfig,omitempty"`
	api.CollectorOptions `mapstructure:",squash"`
}

type BambooPlan

type BambooPlan struct {
	common.Scope              `mapstructure:",squash"`
	PlanKey                   string  `json:"planKey" mapstructure:"planKey" gorm:"primaryKey"`
	Name                      string  `json:"name" mapstructure:"name"`
	Expand                    string  `json:"expand" mapstructure:"expand"`
	ProjectKey                string  `json:"projectKey" mapstructure:"projectKey" gorm:"index"`
	ProjectName               string  `json:"projectName" mapstructure:"projectName"`
	Description               string  `json:"description" mapstructure:"description"`
	ShortName                 string  `json:"shortName" mapstructure:"shortName"`
	BuildName                 string  `json:"buildName" mapstructure:"buildName"`
	ShortKey                  string  `json:"shortKey" mapstructure:"shortKey"`
	Type                      string  `json:"type" mapstructure:"type"`
	Enabled                   bool    `json:"enabled" mapstructure:"enabled"`
	Href                      string  `json:"href" mapstructure:"href"`
	Rel                       string  `json:"rel" mapstructure:"rel"`
	IsFavourite               bool    `json:"isFavourite" mapstructure:"isFavourite"`
	IsActive                  bool    `json:"isActive" mapstructure:"isActive"`
	IsBuilding                bool    `json:"isBuilding" mapstructure:"isBuilding"`
	AverageBuildTimeInSeconds float64 `json:"averageBuildTimeInSeconds" mapstructure:"averageBuildTimeInSeconds"`
}

func (BambooPlan) ScopeFullName

func (p BambooPlan) ScopeFullName() string

func (BambooPlan) ScopeId

func (p BambooPlan) ScopeId() string

func (BambooPlan) ScopeName

func (p BambooPlan) ScopeName() string

func (BambooPlan) ScopeParams

func (p BambooPlan) ScopeParams() interface{}

func (BambooPlan) TableName

func (p BambooPlan) TableName() string

type BambooPlanBuild

type BambooPlanBuild struct {
	ConnectionId             uint64 `gorm:"primaryKey"`
	PlanBuildKey             string `gorm:"primaryKey"`
	Expand                   string `json:"expand"`
	Number                   int    `json:"number"`
	BuildNumber              int    `json:"buildNumber"`
	PlanName                 string `json:"planName"`
	PlanKey                  string
	ProjectName              string `json:"projectName"`
	ProjectKey               string
	BuildResultKey           string     `json:"buildResultKey"`
	LifeCycleState           string     `json:"lifeCycleState"`
	BuildStartedTime         *time.Time `json:"buildStartedTime"`
	PrettyBuildStartedTime   string     `json:"prettyBuildStartedTime"`
	BuildCompletedTime       *time.Time `json:"buildCompletedTime"`
	BuildCompletedDate       *time.Time `json:"buildCompletedDate"`
	PrettyBuildCompletedTime string     `json:"prettyBuildCompletedTime"`
	BuildDurationInSeconds   int        `json:"buildDurationInSeconds"`
	BuildDuration            int        `json:"buildDuration"`
	BuildDurationDescription string     `json:"buildDurationDescription"`
	BuildRelativeTime        string     `json:"buildRelativeTime"`
	VcsRevisionKey           string     `json:"vcsRevisionKey"`
	BuildTestSummary         string     `json:"buildTestSummary"`
	SuccessfulTestCount      int        `json:"successfulTestCount"`
	FailedTestCount          int        `json:"failedTestCount"`
	QuarantinedTestCount     int        `json:"quarantinedTestCount"`
	SkippedTestCount         int        `json:"skippedTestCount"`
	Continuable              bool       `json:"continuable"`
	OnceOff                  bool       `json:"onceOff"`
	Restartable              bool       `json:"restartable"`
	NotRunYet                bool       `json:"notRunYet"`
	Finished                 bool       `json:"finished"`
	Successful               bool       `json:"successful"`
	BuildReason              string     `json:"buildReason"`
	ReasonSummary            string     `json:"reasonSummary"`
	State                    string     `json:"state"`
	BuildState               string     `json:"buildState"`
	Type                     string     `gorm:"type:varchar(255)"`
	Environment              string     `gorm:"type:varchar(255)"`
	PlanResultKey            string
	common.NoPKModel
}

func (BambooPlanBuild) GenerateCICDPipeLineName

func (bambooPlanBuild BambooPlanBuild) GenerateCICDPipeLineName() string

func (BambooPlanBuild) TableName

func (bambooPlanBuild BambooPlanBuild) TableName() string

type BambooPlanBuildVcsRevision

type BambooPlanBuildVcsRevision struct {
	ConnectionId   uint64 `gorm:"primaryKey"`
	PlanBuildKey   string `gorm:"primaryKey"`
	PlanResultKey  string `gorm:"primaryKey"`
	RepositoryId   int
	RepositoryName string `json:"repositoryName"`
	VcsRevisionKey string `gorm:"primaryKey"`
	common.NoPKModel
}

func (BambooPlanBuildVcsRevision) TableName

func (BambooPlanBuildVcsRevision) TableName() string

type BambooResponse

type BambooResponse struct {
	Name string `json:"name"`
	ID   int    `json:"id"`
	BambooConnection
}

This object conforms to what the frontend currently expects.

type BambooScopeConfig

type BambooScopeConfig struct {
	common.ScopeConfig `mapstructure:",squash" json:",inline" gorm:"embedded"`
	RepoMap            map[string][]int `json:"repoMap" gorm:"type:json;serializer:json"` // should be {realRepoName: [bamboo_repoId, ...]}
	DeploymentPattern  string           `mapstructure:"deploymentPattern,omitempty" json:"deploymentPattern" gorm:"type:varchar(255)"`
	ProductionPattern  string           `mapstructure:"productionPattern,omitempty" json:"productionPattern" gorm:"type:varchar(255)"`
	EnvNamePattern     string           `mapstructure:"envNamePattern,omitempty" json:"envNamePattern" gorm:"type:varchar(255)"`
}

func (*BambooScopeConfig) GetRepoIdMap

func (cfg *BambooScopeConfig) GetRepoIdMap() map[int]string

func (*BambooScopeConfig) SetConnectionId

func (cfg *BambooScopeConfig) SetConnectionId(c *BambooScopeConfig, connectionId uint64)

func (BambooScopeConfig) TableName

func (BambooScopeConfig) TableName() string

type Parent

type Parent struct {
	Href string `json:"href"`
	Rel  string `json:"rel"`
}

type SearchEntity

type SearchEntity struct {
	ID          string `json:"id"`
	Key         string `json:"key"`
	ProjectName string `json:"projectName"`
	PlanName    string `json:"planName"`
	BranchName  string `json:"branchName"`
	Description string `json:"description"`
	Type        string `json:"type"`
}

func (SearchEntity) Name

func (entity SearchEntity) Name() string

Name trys to keep plan's name field the same with name in /remote-scopes. In /remote-scopes, plan's name is "{projectName - planName}".

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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