models

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2018 License: Apache-2.0 Imports: 8 Imported by: 352

Documentation

Overview

Copyright 2017 HootSuite Media Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.

Package models holds all models that are needed across packages. We place these models in their own package so as to avoid circular dependencies between packages (which is a compile error).

Index

Constants

View Source
const DefaultWorkspace = "default"

DefaultWorkspace is the default Terraform workspace for both Atlantis and Terraform.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plan

type Plan struct {
	// Project is the project this plan is for.
	Project Project
	// LocalPath is the absolute path to the plan on disk
	// (versus the relative path from the repo root).
	LocalPath string
}

Plan is the result of running an Atlantis plan command. This model is used to represent a plan on disk.

type Project

type Project struct {
	// RepoFullName is the owner and repo name, ex. "runatlantis/atlantis"
	RepoFullName string
	// Path to project root in the repo.
	// If "." then project is at root.
	// Never ends in "/".
	// todo: rename to RepoRelDir to match rest of project once we can separate
	// out how this is saved in boltdb vs. its usage everywhere else so we don't
	// break existing dbs.
	Path string
}

Project represents a Terraform project. Since there may be multiple Terraform projects in a single repo we also include Path to the project root relative to the repo root.

func NewProject

func NewProject(repoFullName string, path string) Project

NewProject constructs a Project. Use this constructor because it sets Path correctly.

func (Project) String added in v0.4.0

func (p Project) String() string

type ProjectCommandContext added in v0.4.0

type ProjectCommandContext struct {
	// BaseRepo is the repository that the pull request will be merged into.
	BaseRepo Repo
	// HeadRepo is the repository that is getting merged into the BaseRepo.
	// If the pull request branch is from the same repository then HeadRepo will
	// be the same as BaseRepo.
	// See https://help.github.com/articles/about-pull-request-merges/.
	HeadRepo Repo
	Pull     PullRequest
	// User is the user that triggered this command.
	User          User
	Log           *logging.SimpleLogger
	RepoRelDir    string
	ProjectConfig *valid.Project
	GlobalConfig  *valid.Config

	// CommentArgs are the extra arguments appended to comment,
	// ex. atlantis plan -- -target=resource
	CommentArgs []string
	Workspace   string
}

type ProjectLock

type ProjectLock struct {
	// Project is the project that is being locked.
	Project Project
	// Pull is the pull request from which the command was run that
	// created this lock.
	Pull PullRequest
	// User is the username of the user that ran the command
	// that created this lock.
	User User
	// Workspace is the Terraform workspace that this
	// lock is being held against.
	Workspace string
	// Time is the time at which the lock was first created.
	Time time.Time
}

ProjectLock represents a lock on a project.

type PullRequest

type PullRequest struct {
	// Num is the pull request number or ID.
	Num int
	// HeadCommit points to the head of the branch that is being
	// pull requested into the base.
	HeadCommit string
	// URL is the url of the pull request.
	// ex. "https://github.com/runatlantis/atlantis/pull/1"
	URL string
	// Branch is the name of the head branch (not the base).
	Branch string
	// Author is the username of the pull request author.
	Author string
	// State will be one of Open or Closed.
	// Gitlab supports an additional "merged" state but Github doesn't so we map
	// merged to Closed.
	State PullRequestState
	// BaseRepo is the repository that the pull request will be merged into.
	BaseRepo Repo
}

PullRequest is a VCS pull request. GitLab calls these Merge Requests.

type PullRequestState added in v0.2.0

type PullRequestState int
const (
	Open PullRequestState = iota
	Closed
)

type Repo

type Repo struct {
	// FullName is the owner and repo name separated
	// by a "/", ex. "runatlantis/atlantis".
	FullName string
	// Owner is just the repo owner, ex. "runatlantis".
	Owner string
	// Name is just the repo name, ex. "atlantis".
	Name string
	// CloneURL is the full HTTPS url for cloning with username and token string
	// ex. "https://username:token@github.com/atlantis/atlantis.git".
	CloneURL string
	// SanitizedCloneURL is the full HTTPS url for cloning without the username and password.
	// ex. "https://github.com/atlantis/atlantis.git".
	SanitizedCloneURL string
	// VCSHost is where this repo is hosted.
	VCSHost VCSHost
}

Repo is a VCS repository.

func NewRepo added in v0.3.2

func NewRepo(vcsHostType VCSHostType, repoFullName string, cloneURL string, vcsUser string, vcsToken string) (Repo, error)

type User

type User struct {
	Username string
}

User is a VCS user. During an autoplan, the user will be the Atlantis API user.

type VCSHost added in v0.3.6

type VCSHost struct {
	// Hostname is the hostname of the VCS provider, ex. "github.com" or
	// "github-enterprise.example.com".
	Hostname string

	// Type is which type of VCS host this is, ex. GitHub or GitLab.
	Type VCSHostType
}

VCSHost is a Git hosting provider, for example GitHub.

type VCSHostType added in v0.3.6

type VCSHostType int
const (
	Github VCSHostType = iota
	Gitlab
)

func (VCSHostType) String added in v0.3.6

func (h VCSHostType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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