github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/api/machineactions/action.go (about)

     1  // Copyright 2016 Canonical Ltd.
     2  // Copyright 2016 Cloudbase Solutions
     3  // Licensed under the AGPLv3, see LICENCE file for details.
     4  
     5  package machineactions
     6  
     7  // Action represents a single instance of an Action call, by name and params.
     8  // TODO(bogdantelega): This is currently copied from uniter.Actions,
     9  // but until the implementations converge, it's saner to duplicate the code since
    10  // the "correct" abstraction over both is not obvious.
    11  type Action struct {
    12  	name   string
    13  	params map[string]interface{}
    14  }
    15  
    16  // NewAction makes a new Action with specified name and params map.
    17  func NewAction(name string, params map[string]interface{}) *Action {
    18  	return &Action{name: name, params: params}
    19  }
    20  
    21  // Name retrieves the name of the Action.
    22  func (a *Action) Name() string {
    23  	return a.name
    24  }
    25  
    26  // Params retrieves the params map of the Action.
    27  func (a *Action) Params() map[string]interface{} {
    28  	return a.params
    29  }