lib

package
v0.0.0-...-b42b9e6 Latest Latest
Warning

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

Go to latest
Published: May 15, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CandidatesByResourceType

func CandidatesByResourceType(plan TfPlan) map[string]Candidates

func ConsumeByLine

func ConsumeByLine(reader io.Reader, f func(string)) error

func Find

func Find(
	runtime RuntimeEnvironment,
	findFlags FindFlags,
	planfile NamedWriter,
) error

func Plan

func Plan(
	runtime RuntimeEnvironment,
	changes io.Reader,
	localState NamedWriter,
) error

Types

type BestEffortRefactorFinder

type BestEffortRefactorFinder struct{}

func (BestEffortRefactorFinder) Find

func (_ BestEffortRefactorFinder) Find(plan TfPlan) ([]Refactor, error)

type Candidates

type Candidates struct {
	Creating []ChangingResource
	Deleting []ChangingResource
}

func (Candidates) Add

func (Candidates) All

func (c Candidates) All() []ChangingResource

func (Candidates) NewAddresses

func (c Candidates) NewAddresses() []string

func (Candidates) OldAddresses

func (c Candidates) OldAddresses() []string

func (Candidates) Remove

func (c Candidates) Remove(address string) Candidates

type Change

type Change struct {
	Actions []string                `json:"actions"`
	After   *map[string]interface{} `json:"after"`
	Before  *map[string]interface{} `json:"before"`
}

type ChangingResource

type ChangingResource struct {
	Address      string `json:"address"`
	Change       Change `json:"change"`
	Name         string `json:"name"`
	ProviderName string `json:"provider_name"`
	Type         string `json:"type"`
}

func (ChangingResource) GetAction

func (cr ChangingResource) GetAction() string

func (ChangingResource) GetAddress

func (cr ChangingResource) GetAddress() string

func (ChangingResource) GetType

func (cr ChangingResource) GetType() string

type CommandRunner

type CommandRunner func(io.Writer, string, ...string) error

type Edge

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

type FindFlags

type FindFlags struct {
	InteractiveMode bool
}

type GetApproval

type GetApproval func() (bool, error)
var AutoApprove GetApproval = func() (bool, error) {
	return true, nil
}
var GetApprovalFromPrompt GetApproval = func() (bool, error) {
	prompt := promptui.Prompt{
		Label: "\tEnter a value",
	}
	input, err := prompt.Run()
	if err != nil {
		return false, err
	}
	return input == "yes", nil
}

type GuidedRefactorFinder

type GuidedRefactorFinder struct {
	Prompt Prompt
}

func (GuidedRefactorFinder) Find

func (f GuidedRefactorFinder) Find(plan TfPlan) ([]Refactor, error)

type NamedWriter

type NamedWriter interface {
	io.Writer
	Name() string
}

type Prompt

type Prompt interface {
	Confirm(string) (bool, error)
	Select([]string, string) (string, error)
}

type Refactor

type Refactor struct {
	NewAddress string
	OldAddress string
}

func (Refactor) AsCommand

func (r Refactor) AsCommand() string

type RefactorFinder

type RefactorFinder interface {
	Find(TfPlan) ([]Refactor, error)
}

type RuntimeEnvironment

type RuntimeEnvironment struct {
	Execute      CommandRunner
	ExtraArgs    []string
	GetApproval  GetApproval
	Prompt       Prompt
	Screen       io.Writer
	StartSpinner StartSpinner
	Void         io.Writer
}

func CreateLiveRuntimeEnvironment

func CreateLiveRuntimeEnvironment(extraArgs []string) RuntimeEnvironment

type SilentSpinner

type SilentSpinner struct{}

func (*SilentSpinner) Stop

func (s *SilentSpinner) Stop() error

func (*SilentSpinner) Success

func (s *SilentSpinner) Success(_ ...interface{})

func (*SilentSpinner) UpdateText

func (s *SilentSpinner) UpdateText(_ string)

type Spinner

type Spinner interface {
	UpdateText(string)
	Success(...interface{})
	Stop() error
}

type StartSpinner

type StartSpinner func(...interface{}) (Spinner, error)
var StartPtermSpinner StartSpinner = func(x ...interface{}) (Spinner, error) {
	return pterm.DefaultSpinner.WithRemoveWhenDone(true).Start(x)
}
var StartSilentSpinner StartSpinner = func(_ ...interface{}) (Spinner, error) {
	s := SilentSpinner{}
	return &s, nil
}

type SurveyPrompt

type SurveyPrompt struct{}

func (SurveyPrompt) Confirm

func (p SurveyPrompt) Confirm(msg string) (bool, error)

func (SurveyPrompt) Select

func (p SurveyPrompt) Select(options []string, msg string) (string, error)

type TfPlan

type TfPlan struct {
	ChangingResources []ChangingResource `json:"resource_changes"`
}

func NewTfPlan

func NewTfPlan(r io.Reader) (TfPlan, error)

Jump to

Keyboard shortcuts

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