github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/api/agent/uniter/action.go (about)

     1  // Copyright 2014 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package uniter
     5  
     6  // Action represents a single instance of an Action call, by name and params.
     7  type Action struct {
     8  	id             string
     9  	name           string
    10  	params         map[string]interface{}
    11  	parallel       bool
    12  	executionGroup string
    13  }
    14  
    15  // NewAction makes a new Action with specified id, name and params.
    16  func NewAction(id, name string, params map[string]interface{}, parallel bool, executionGroup string) *Action {
    17  	return &Action{id: id, name: name, params: params, parallel: parallel, executionGroup: executionGroup}
    18  }
    19  
    20  // ID retrieves the ID of the Action.
    21  func (a *Action) ID() string {
    22  	return a.id
    23  }
    24  
    25  // Name retrieves the name of the Action.
    26  func (a *Action) Name() string {
    27  	return a.name
    28  }
    29  
    30  // Params retrieves the params map of the Action.
    31  func (a *Action) Params() map[string]interface{} {
    32  	return a.params
    33  }
    34  
    35  // Parallel returns true if the action can run without
    36  // needed to acquire the machine lock.
    37  func (a *Action) Parallel() bool {
    38  	return a.parallel
    39  }
    40  
    41  // ExecutionGroup is the group of actions which cannot
    42  // execute in parallel with each other.
    43  func (a *Action) ExecutionGroup() string {
    44  	return a.executionGroup
    45  }