Beispiel #1
0
// Environment returns an object that provides access to the Environment API
// facade. The id argument is reserved for future use and currently needs to
// be empty.
func (r *srvRoot) Environment(id string) (*environment.EnvironmentAPI, error) {
	if id != "" {
		// Safeguard id for possible future use.
		return nil, common.ErrBadId
	}
	return environment.NewEnvironmentAPI(r.srv.state, r.resources, r)
}
Beispiel #2
0
func (s *environmentSuite) SetUpTest(c *gc.C) {
	s.JujuConnSuite.SetUpTest(c)

	var err error
	s.machine0, err = s.State.AddMachine("quantal", state.JobHostUnits, state.JobManageEnviron)
	c.Assert(err, gc.IsNil)

	s.authorizer = apiservertesting.FakeAuthorizer{
		Tag:          s.machine0.Tag(),
		LoggedIn:     true,
		MachineAgent: true,
		Entity:       s.machine0,
	}
	s.resources = common.NewResources()

	s.api, err = environment.NewEnvironmentAPI(
		s.State,
		s.resources,
		s.authorizer,
	)
	c.Assert(err, gc.IsNil)
	s.EnvironWatcherTest = commontesting.NewEnvironWatcherTest(
		s.api, s.State, s.resources, commontesting.NoSecrets)
}