-
Notifications
You must be signed in to change notification settings - Fork 491
/
state.go
44 lines (37 loc) · 1.08 KB
/
state.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
38
39
40
41
42
43
44
// Copyright 2017 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package caasoperatorprovisioner
import (
"gopkg.in/juju/names.v3"
"github.com/juju/juju/controller"
"github.com/juju/juju/core/network"
"github.com/juju/juju/environs/config"
"github.com/juju/juju/state"
)
// CAASOperatorProvisionerState provides the subset of global state
// required by the CAAS operator provisioner facade.
type CAASOperatorProvisionerState interface {
ControllerConfig() (controller.Config, error)
StateServingInfo() (state.StateServingInfo, error)
WatchApplications() state.StringsWatcher
FindEntity(tag names.Tag) (state.Entity, error)
Addresses() ([]string, error)
ModelUUID() string
Model() (Model, error)
APIHostPortsForAgents() ([][]network.HostPort, error)
WatchAPIHostPortsForAgents() state.NotifyWatcher
}
type Model interface {
UUID() string
ModelConfig() (*config.Config, error)
}
type stateShim struct {
*state.State
}
func (s stateShim) Model() (Model, error) {
model, err := s.State.Model()
if err != nil {
return nil, err
}
return model.CAASModel()
}