github.com/jdolitsky/cnab-go@v0.7.1-beta1/action/status.go (about)

     1  package action
     2  
     3  import (
     4  	"github.com/deislabs/cnab-go/claim"
     5  	"github.com/deislabs/cnab-go/credentials"
     6  	"github.com/deislabs/cnab-go/driver"
     7  )
     8  
     9  // Status runs a status action on a CNAB bundle.
    10  type Status struct {
    11  	Driver driver.Driver
    12  }
    13  
    14  // Run executes a status action in an image
    15  func (i *Status) Run(c *claim.Claim, creds credentials.Set, opCfgs ...OperationConfigFunc) error {
    16  	invocImage, err := selectInvocationImage(i.Driver, c)
    17  	if err != nil {
    18  		return err
    19  	}
    20  
    21  	op, err := opFromClaim(claim.ActionStatus, stateful, c, invocImage, creds)
    22  	if err != nil {
    23  		return err
    24  	}
    25  
    26  	err = OperationConfigs(opCfgs).ApplyConfig(op)
    27  	if err != nil {
    28  		return err
    29  	}
    30  
    31  	// Ignore OperationResult because non-modifying actions don't have outputs to save.
    32  	_, err = i.Driver.Run(op)
    33  	return err
    34  }