mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-07-29 19:18:35 +00:00
* Moved CommandContext and CommandResult to models (#193) * Moved CommandContext and CommandResult to models * move from models to command rename CommandContext -> Context rename CommandResult -> Result * moved command related helpers into command package * move ProjectCommandContext and ProjectResult to command/project package * move project command context and project result * revert unrelated code * move tests * fix left over * fix linting * fix tests * remove unused import * fix project context dependencies * fix depenedecies * fix typo
27 lines
564 B
Go
27 lines
564 B
Go
package command
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// LockMetadata contains additional data provided to the lock
|
|
type LockMetadata struct {
|
|
UnixTime int64
|
|
}
|
|
|
|
// Lock represents a global lock for an atlantis command (plan, apply, policy_check).
|
|
// It is used to prevent commands from being executed
|
|
type Lock struct {
|
|
// Time is the time at which the lock was first created.
|
|
LockMetadata LockMetadata
|
|
CommandName Name
|
|
}
|
|
|
|
func (l *Lock) LockTime() time.Time {
|
|
return time.Unix(l.LockMetadata.UnixTime, 0)
|
|
}
|
|
|
|
func (l *Lock) IsLocked() bool {
|
|
return !l.LockTime().IsZero()
|
|
}
|