1
// Copyright 2015 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
7
"github.com/juju/juju/apiserver/common"
8
"github.com/juju/juju/apiserver/params"
9
"github.com/juju/juju/state"
11
"github.com/juju/loggo"
15
common.RegisterStandardFacade("StatusHistory", 2, NewAPI)
18
var logger = loggo.GetLogger("juju.apiserver.statushistory")
20
// API is the concrete implementation of the Pruner endpoint..
23
authorizer common.Authorizer
26
// NewAPI returns an API Instance.
27
func NewAPI(st *state.State, _ *common.Resources, auth common.Authorizer) (*API, error) {
34
// Prune endpoint removes status history entries until
35
// only the N newest records per unit remain.
36
func (api *API) Prune(p params.StatusHistoryPruneArgs) error {
37
if !api.authorizer.AuthModelManager() {
40
return state.PruneStatusHistory(api.st, p.MaxLogsPerEntity)