rename ActionInvocation for clarity

pull/37305/head
Daniel Schmidt 10 months ago
parent 8c657163b2
commit 8649eae35d

@ -330,8 +330,8 @@ type configActionKey string
func (k configActionKey) uniqueKeySigil() {}
// ActionInvocation describes the invocation of an action as part of a plan / apply.
type ActionInvocation struct {
// AbsActionInvocationInstance describes the invocation of an action as part of a plan / apply.
type AbsActionInvocationInstance struct {
TriggeringResource AbsResourceInstance
Action AbsActionInstance
TriggerIndex int
@ -345,6 +345,6 @@ type ActionInvocation struct {
ActionReferenceSourceRange *tfdiags.SourceRange
}
func (a ActionInvocation) String() string {
func (a AbsActionInvocationInstance) String() string {
return fmt.Sprintf("%s.%d.%s", a.TriggeringResource.String(), a.TriggerIndex, a.Action.String())
}

@ -30,8 +30,8 @@ func testJSONHookResourceID(addr addrs.AbsResourceInstance) terraform.HookResour
}
}
func testJSONHookActionID(addr addrs.ActionInvocation) terraform.HookActionIdentity {
return addrs.ActionInvocation{
func testJSONHookActionID(addr addrs.AbsActionInvocationInstance) terraform.HookActionIdentity {
return addrs.AbsActionInvocationInstance{
TriggeringResource: addr.TriggeringResource,
Action: addr.Action,
TriggerIndex: addr.TriggerIndex,
@ -593,7 +593,7 @@ func TestJSONHook_actions(t *testing.T) {
Name: "boop",
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance)
invocationA := addrs.ActionInvocation{
invocationA := addrs.AbsActionInvocationInstance{
TriggeringResource: resourceA,
Action: actionA,
TriggerIndex: 23,
@ -614,7 +614,7 @@ func TestJSONHook_actions(t *testing.T) {
Name: "boop",
}.Instance(addrs.NoKey).Absolute(subModule)
invocationB := addrs.ActionInvocation{
invocationB := addrs.AbsActionInvocationInstance{
TriggeringResource: resourceB,
Action: actionB,
TriggerIndex: 0,

@ -370,7 +370,7 @@ func (h *actionStart) String() string {
return fmt.Sprintf("%s.trigger[%d]: Action Started: %s", h.TriggeringResource.Addr, h.TriggerIndex, h.Action.Addr)
}
func NewActionStart(addr addrs.ActionInvocation) Hook {
func NewActionStart(addr addrs.AbsActionInvocationInstance) Hook {
return &actionStart{
TriggeringResource: newResourceAddr(addr.TriggeringResource),
TriggerIndex: addr.TriggerIndex,
@ -395,7 +395,7 @@ func (h *actionProgress) String() string {
return fmt.Sprintf("%s (%d): %s - %s", h.TriggeringResource.Addr, h.TriggerIndex, h.Action.Addr, h.Message)
}
func NewActionProgress(addr addrs.ActionInvocation, message string) Hook {
func NewActionProgress(addr addrs.AbsActionInvocationInstance, message string) Hook {
return &actionProgress{
TriggeringResource: newResourceAddr(addr.TriggeringResource),
TriggerIndex: addr.TriggerIndex,
@ -420,7 +420,7 @@ func (h *actionComplete) String() string {
return fmt.Sprintf("%s (%d): Action Complete: %s", h.TriggeringResource.Addr, h.TriggerIndex, h.Action.Addr)
}
func NewActionComplete(addr addrs.ActionInvocation) Hook {
func NewActionComplete(addr addrs.AbsActionInvocationInstance) Hook {
return &actionComplete{
TriggeringResource: newResourceAddr(addr.TriggeringResource),
TriggerIndex: addr.TriggerIndex,
@ -445,7 +445,7 @@ func (h *actionErrored) String() string {
return fmt.Sprintf("%s (%d): Action Errored: %s - %s", h.TriggeringResource.Addr, h.TriggerIndex, h.Action.Addr, h.Error)
}
func NewActionErrored(addr addrs.ActionInvocation, err error) Hook {
func NewActionErrored(addr addrs.AbsActionInvocationInstance, err error) Hook {
return &actionErrored{
TriggeringResource: newResourceAddr(addr.TriggeringResource),
TriggerIndex: addr.TriggerIndex,

@ -35,7 +35,7 @@ type HookResourceIdentity struct {
// HookActionIdentity is passed to Hook interface methods to fully identify
// the action being performed.
type HookActionIdentity = addrs.ActionInvocation
type HookActionIdentity = addrs.AbsActionInvocationInstance
// Hook is the interface that must be implemented to hook into various
// parts of Terraform, allowing you to inspect or change behavior at runtime.

Loading…
Cancel
Save