github.com/cloudbase/juju-core@v0.0.0-20140504232958-a7271ac7912f/state/apiserver/environment/environment.go (about) 1 // Copyright 2014 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package environment 5 6 import ( 7 "launchpad.net/juju-core/state" 8 "launchpad.net/juju-core/state/apiserver/common" 9 ) 10 11 // EnvironmentAPI implements the API used by the machine environment worker. 12 type EnvironmentAPI struct { 13 *common.EnvironWatcher 14 } 15 16 // NewEnvironmentAPI creates a new instance of the Environment API. 17 func NewEnvironmentAPI(st *state.State, resources *common.Resources, authorizer common.Authorizer) (*EnvironmentAPI, error) { 18 // Can always watch for environ changes. 19 getCanWatch := common.AuthAlways(true) 20 // Does not get the secrets. 21 getCanReadSecrets := common.AuthAlways(false) 22 return &EnvironmentAPI{ 23 EnvironWatcher: common.NewEnvironWatcher(st, resources, getCanWatch, getCanReadSecrets), 24 }, nil 25 }