Skip to content

Commit fc35dfd

Browse files
committed
LP-1362664 :: Rename actionDoc Payload to Parameters
1 parent 7aa5b27 commit fc35dfd

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

state/action.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ type actionDoc struct {
6060
// match an action defined by the unit's charm.
6161
Name string `bson:"name"`
6262

63-
// Payload holds the action's parameters, if any; it should validate
63+
// Parameters holds the action's parameters, if any; it should validate
6464
// against the schema defined by the named action in the unit's charm
65-
Payload map[string]interface{} `bson:"payload"`
65+
Parameters map[string]interface{} `bson:"parameters"`
6666
}
6767

6868
// Action represents an instruction to do some "action" and is expected
@@ -111,11 +111,11 @@ func (a *Action) Name() string {
111111
return a.doc.Name
112112
}
113113

114-
// Payload will contain a structure representing arguments or parameters to
114+
// Parameters will contain a structure representing arguments or parameters to
115115
// an action, and is expected to be validated by the Unit using the Charm
116116
// definition of the Action
117-
func (a *Action) Payload() map[string]interface{} {
118-
return a.doc.Payload
117+
func (a *Action) Parameters() map[string]interface{} {
118+
return a.doc.Parameters
119119
}
120120

121121
// ActionResults is a data transfer object that holds the key Action
@@ -165,7 +165,7 @@ func newActionDoc(st *State, ar ActionReceiver, actionName string, parameters ma
165165
if err != nil {
166166
return actionDoc{}, err
167167
}
168-
return actionDoc{Id: actionId, Name: actionName, Payload: parameters}, nil
168+
return actionDoc{Id: actionId, Name: actionName, Parameters: parameters}, nil
169169
}
170170

171171
var ensureActionMarker = ensureSuffixFn(actionMarker)

state/action_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func (s *ActionSuite) TestAddAction(c *gc.C) {
7575

7676
// verify we get out what we put in
7777
c.Assert(action.Name(), gc.Equals, name)
78-
c.Assert(action.Payload(), jc.DeepEquals, params)
78+
c.Assert(action.Parameters(), jc.DeepEquals, params)
7979
}
8080

8181
func (s *ActionSuite) TestAddActionAcceptsDuplicateNames(c *gc.C) {
@@ -105,7 +105,7 @@ func (s *ActionSuite) TestAddActionAcceptsDuplicateNames(c *gc.C) {
105105

106106
action2, err := s.State.Action(a2.Id())
107107
c.Assert(err, gc.IsNil)
108-
c.Assert(action2.Payload(), jc.DeepEquals, params2)
108+
c.Assert(action2.Parameters(), jc.DeepEquals, params2)
109109

110110
// verify only one left, and it's the expected one
111111
actions, err = s.unit.Actions()

state/actionresult.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func newActionResultDoc(a *Action, finalStatus ActionStatus, results map[string]
124124
return actionResultDoc{
125125
Id: id,
126126
ActionName: a.doc.Name,
127-
Parameters: a.doc.Payload,
127+
Parameters: a.doc.Parameters,
128128
Status: finalStatus,
129129
Results: results,
130130
Message: message,

state/apiserver/uniter/uniter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ func (u *UniterAPI) getOneActionByTag(tag names.ActionTag) (params.ActionsQueryR
815815

816816
result.Action = &params.Action{
817817
Name: action.Name(),
818-
Params: action.Payload(),
818+
Params: action.Parameters(),
819819
}
820820
return result, nil
821821
}

0 commit comments

Comments
 (0)