github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/api/statushistory/pruner.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package statushistory
     5  
     6  import (
     7  	"time"
     8  
     9  	"github.com/juju/juju/api/base"
    10  	"github.com/juju/juju/apiserver/params"
    11  )
    12  
    13  const apiName = "StatusHistory"
    14  
    15  // Facade allows calls to "StatusHistory" endpoints
    16  type Facade struct {
    17  	facade base.FacadeCaller
    18  }
    19  
    20  // NewFacade returns a status "StatusHistory" Facade.
    21  func NewFacade(caller base.APICaller) *Facade {
    22  	facadeCaller := base.NewFacadeCaller(caller, apiName)
    23  	return &Facade{facadeCaller}
    24  }
    25  
    26  // Prune calls "StatusHistory.Prune"
    27  func (s *Facade) Prune(maxHistoryTime time.Duration, maxHistoryMB int) error {
    28  	p := params.StatusHistoryPruneArgs{
    29  		MaxHistoryTime: maxHistoryTime,
    30  		MaxHistoryMB:   maxHistoryMB,
    31  	}
    32  	return s.facade.FacadeCall("Prune", p, nil)
    33  }