Files
atlantis/models/models.go
Luke Kysow d425de95fa Refactoring
* set version in one place
* rename ExecutionContext to CommandContext
* delete unneeded PullRequestContext since it just duplicated what is in CommandContext
* split fields inside CommandContext into Repo, PullRequest, and User models
* clean up unused fields
* remove base_executor stuff which was trying to do inheritance in go and didn't get us anywhere
* clean up unused code and assets
* created a locking.Client that creates the Keys that are used on the front-end. This allows the backends to store the locks any way they like as long as they support the interface
2017-06-17 14:14:21 -07:00

55 lines
894 B
Go

package models
import (
paths "path"
"time"
)
type Repo struct {
FullName string
Owner string
Name string
SSHURL string
}
type PullRequest struct {
Num int
HeadCommit string
BaseCommit string
Link string
Branch string
Author string
}
type User struct {
Username string
}
type ProjectLock struct {
Project Project
PullNum int
Env string
Time time.Time
}
// Project represents a Terraform project.
// Since there may be multiple Terraform projects in a single repo we also include Path
type Project struct {
RepoFullName string
// Path to project root in the repo.
// If "." then project is at root.
// Never ends in "/".
Path string
}
func NewProject(repoFullName string, path string) Project {
path = paths.Clean(path)
if path == "/" {
path = "."
}
return Project{
RepoFullName: repoFullName,
Path: path,
}
}