plan

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogKeyTFEWorkspace = "tfe_workspace"
	LogKeyTFERun       = "tfe_run"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientProvider

type ClientProvider struct {
	// contains filtered or unexported fields
}

func NewClientProvider

func NewClientProvider(c ClientProviderConfig, middlewares ...githubapp.ClientMiddleware) (*ClientProvider, error)

func (*ClientProvider) Address

func (p *ClientProvider) Address() string

func (*ClientProvider) Client

func (p *ClientProvider) Client(org string) (*tfe.Client, error)

type ClientProviderConfig

type ClientProviderConfig struct {
	Address       string               `yaml:"address"`
	Organizations []OrganizationConfig `yaml:"organizations"`
}

func (*ClientProviderConfig) SetValuesFromEnv

func (c *ClientProviderConfig) SetValuesFromEnv()

type Comment added in v0.1.4

type Comment struct {
	Name    string `yaml:"name"`
	Content string `yaml:"content"`
}

type Config

type Config struct {
	Workspaces    []WorkspaceConfig `yaml:"workspaces"`
	ApprovalRules []*approval.Rule  `yaml:"approval_rules"`
	Comments      []Comment         `yaml:"comments"`
	// contains filtered or unexported fields
}

func (*Config) ParseComments added in v0.1.4

func (c *Config) ParseComments() error

type Context

type Context struct {
	// contains filtered or unexported fields
}

func NewContext

func NewContext(ctx context.Context, wkcfg WorkspaceConfig, prctx pull.Context, cfg *Config, statusCtx string, v3client *github.Client, tp *ClientProvider) (*Context, error)

func (*Context) Evaluate

func (pc *Context) Evaluate() Result

func (*Context) MonitorRun

func (pc *Context) MonitorRun(ctx context.Context, poster StatusPoster, runID string)

func (*Context) Trigger added in v0.2.0

func (pc *Context) Trigger() common.Trigger

type EvaluationStatus

type EvaluationStatus int
const (
	StatusSkipped EvaluationStatus = iota // note: values used for ordering
	StatusPolicyPending
	StatusPolicyDisapproved
	StatusPlanCreated
	StatusPlanPending
	StatusPlanDone
)

func (EvaluationStatus) String

func (s EvaluationStatus) String() string

type OrganizationConfig

type OrganizationConfig struct {
	Name  string `yaml:"name"`
	Token string `yaml:"token"`
}

type Result

type Result struct {
	StatusDescription string
	Status            EvaluationStatus

	Error error

	PolicyResult common.Result

	RunID string
}

type StatusPoster

type StatusPoster interface {
	PostStatus(ctx context.Context, prctx pull.Context, wkcfg WorkspaceConfig, runID string, client *github.Client, state, message string) error
}

type WorkspaceConfig

type WorkspaceConfig struct {
	Organization     string        `yaml:"organization"`
	Name             string        `yaml:"name"`
	WorkingDirectory string        `yaml:"working_directory"`
	Branch           string        `yaml:"branch"`
	Policy           policy.Policy `yaml:"policy"`
	Comment          string        `yaml:"comment"`
	ShowSkipped      bool          `yaml:"show_skipped"`
}

func (WorkspaceConfig) String

func (w WorkspaceConfig) String() string

Jump to

Keyboard shortcuts

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