mirror of https://github.com/hashicorp/terraform
This commit replaces the existing jsonformat.PlanRendererOpt type with a new type with identical semantics, located in the plans package. We needed to be able to exchange the facts represented by `jsonformat.PlanRendererOpt` across some package boundaries, but the jsonformat package is implicated in too many dependency chains to be safe for that purpose! So, we had to make a new one. The plans package seems safe to import from all the places that must emit or accept this info, and already contains plans.Mode, which is effectively a sibling of this type.cli-team/saved-cloud-plans
parent
da963a13b9
commit
0df3c143bb
@ -0,0 +1,20 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package plans
|
||||
|
||||
// Quality represents facts about the nature of a plan that might be relevant
|
||||
// when rendering it, like whether it errored or contains no changes. A plan can
|
||||
// have multiple qualities.
|
||||
type Quality int
|
||||
|
||||
//go:generate go run golang.org/x/tools/cmd/stringer -type Quality
|
||||
|
||||
const (
|
||||
// Errored plans did not successfully complete, and cannot be applied.
|
||||
Errored Quality = iota
|
||||
// NoChanges plans won't result in any actions on infrastructure, or any
|
||||
// semantically meaningful updates to state. They can sometimes still affect
|
||||
// the format of state if applied.
|
||||
NoChanges
|
||||
)
|
||||
@ -0,0 +1,24 @@
|
||||
// Code generated by "stringer -type Quality"; 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[Errored-0]
|
||||
_ = x[NoChanges-1]
|
||||
}
|
||||
|
||||
const _Quality_name = "ErroredNoChanges"
|
||||
|
||||
var _Quality_index = [...]uint8{0, 7, 16}
|
||||
|
||||
func (i Quality) String() string {
|
||||
if i < 0 || i >= Quality(len(_Quality_index)-1) {
|
||||
return "Quality(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _Quality_name[_Quality_index[i]:_Quality_index[i+1]]
|
||||
}
|
||||
Loading…
Reference in new issue