mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Previously there were only two planning modes: normal mode and destroy mode. In that context it made sense for these to be distinguished only by a boolean flag. We're now getting ready to add our third mode, "refresh only". This establishes the idea that planning can be done in one of a number of mutually-exclusive "modes", which are related to but separate from the various other options that serve as modifiers for the plan operation. This commit only introduces the new plans.Mode type and replaces the existing "destroy" flag with a variable of that type. This doesn't cause any change in effective behavior because Terraform Core still supports only NormalMode and DestroyMode, with NewContext rejecting an attempt to create a RefreshMode context for now. It is in retrospect a little odd that the "destroy" flag was part of ContextOpts rather than just an argument to the Plan method, but refactoring that would be too invasive a change for right now so we'll leave this as a field of the context for now and save revisiting that for another day.
34 lines
672 B
Go
34 lines
672 B
Go
// Code generated by "stringer -type Mode"; DO NOT EDIT.
|
|
|
|
package plans
|
|
|
|
import "strconv"
|
|
|
|
func _() {
|
|
// An "invalid array index" compiler error signifies that the constant values have changed.
|
|
// Re-run the stringer command to generate them again.
|
|
var x [1]struct{}
|
|
_ = x[NormalMode-0]
|
|
_ = x[DestroyMode-68]
|
|
_ = x[RefreshOnlyMode-82]
|
|
}
|
|
|
|
const (
|
|
_Mode_name_0 = "NormalMode"
|
|
_Mode_name_1 = "DestroyMode"
|
|
_Mode_name_2 = "RefreshOnlyMode"
|
|
)
|
|
|
|
func (i Mode) String() string {
|
|
switch {
|
|
case i == 0:
|
|
return _Mode_name_0
|
|
case i == 68:
|
|
return _Mode_name_1
|
|
case i == 82:
|
|
return _Mode_name_2
|
|
default:
|
|
return "Mode(" + strconv.FormatInt(int64(i), 10) + ")"
|
|
}
|
|
}
|