forked from juju/juju
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resumer.go
37 lines (31 loc) · 929 Bytes
/
resumer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
// The resumer package implements the API interface
// used by the resumer worker.
package resumer
import (
"github.com/juju/juju/apiserver/common"
"github.com/juju/juju/apiserver/facade"
"github.com/juju/juju/state"
)
func init() {
common.RegisterStandardFacade("Resumer", 2, NewResumerAPI)
}
// ResumerAPI implements the API used by the resumer worker.
type ResumerAPI struct {
st stateInterface
auth facade.Authorizer
}
// NewResumerAPI creates a new instance of the Resumer API.
func NewResumerAPI(st *state.State, _ facade.Resources, authorizer facade.Authorizer) (*ResumerAPI, error) {
if !authorizer.AuthController() {
return nil, common.ErrPerm
}
return &ResumerAPI{
st: getState(st),
auth: authorizer,
}, nil
}
func (api *ResumerAPI) ResumeTransactions() error {
return api.st.ResumeTransactions()
}