// NewFacadeV8 provides the signature required for facade registration
// for version 8.
178220
func NewFacadeV8(ctx facade.Context) (*APIv8, error) {
	api, err := NewFacadeV9(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return &APIv8{api}, nil
}
1095552
func NewStateFacade(ctx facade.Context) (*Facade, error) {
	authorizer := ctx.Auth()
	resources := ctx.Resources()
	sb, err := state.NewStorageBackend(ctx.State())
	if err != nil {
		return nil, errors.Trace(err)
	}
	db, err := state.NewDeviceBackend(ctx.State())
	if err != nil {
		return nil, errors.Trace(err)
	}

	broker, err := stateenvirons.GetNewCAASBrokerFunc(caas.New)(ctx.State())
	if err != nil {
		return nil, errors.Annotate(err, "getting caas client")
	}
	registry := stateenvirons.NewStorageProviderRegistry(broker)
	pm := poolmanager.New(state.NewStateSettings(ctx.State()), registry)

	return NewFacade(
		resources,
		authorizer,
		stateShim{ctx.State()},
		sb,
		db,
		pm,
		registry,
		clock.WallClock,
	)
}
462637
func NewFacadeV6(ctx facade.Context) (*MachineManagerAPIV6, error) {
	machineManagerAPI, err := NewFacade(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return &MachineManagerAPIV6{machineManagerAPI}, nil
}
626991
func NewFacade(
	st *state.State,
	resources facade.Resources,
	authorizer facade.Authorizer,
) (*InstancePollerAPI, error) {
	m, err := st.Model()
	if err != nil {
		return nil, errors.Trace(err)
	}
	return NewInstancePollerAPI(st, m, resources, authorizer, clock.WallClock)
}
582694
func (s *BrocadeVCSService) NewAddBrocadeVcsDeviceParams(hostname string, password string, physicalnetworkid string, username string) *AddBrocadeVcsDeviceParams {
	p := &AddBrocadeVcsDeviceParams{}
	p.p = make(map[string]interface{})
	p.p["hostname"] = hostname
	p.p["password"] = password
	p.p["physicalnetworkid"] = physicalnetworkid
	p.p["username"] = username
	return p
}
543145
func NewFacadeV2(ctx facade.Context) (*APIv2, error) {
	api, err := newFacade(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return &APIv2{api}, nil
}
1309837
func NewFacadeV4(context facade.Context) (*CloudAPIV4, error) {
	v5, err := NewFacadeV5(context)
	if err != nil {
		return nil, err
	}
	return &CloudAPIV4{v5}, nil
}
896229
func NewModelGenerationFacade(ctx facade.Context) (*API, error) {
	authorizer := ctx.Auth()
	st := &stateShim{State: ctx.State()}
	m, err := st.Model()
	if err != nil {
		return nil, errors.Trace(err)
	}
	return NewModelGenerationAPI(st, authorizer, m)
}
513607
func NewStateFromFacade(facadeCaller base.FacadeCaller) *State {
	return &State{
		ModelWatcher:        common.NewModelWatcher(facadeCaller),
		APIAddresser:        common.NewAPIAddresser(facadeCaller),
		ControllerConfigAPI: common.NewControllerConfig(facadeCaller),
		facade:              facadeCaller,
	}
}
550072
func NewDefaultAuthenticationInfoResolver(kubeconfigFile string) (AuthenticationInfoResolver, error) {
	if len(kubeconfigFile) == 0 {
		return &defaultAuthenticationInfoResolver{}, nil
	}

	loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
	loadingRules.ExplicitPath = kubeconfigFile
	loader := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, &clientcmd.ConfigOverrides{})
	clientConfig, err := loader.RawConfig()
	if err != nil {
		return nil, err
	}

	return &defaultAuthenticationInfoResolver{kubeconfig: clientConfig}, nil
}
1351526
func NewFacade(
	backend Backend,
	resources facade.Resources,
	authorizer facade.Authorizer,
) (*Facade, error) {
	if !authorizer.AuthMachineAgent() {
		return nil, common.ErrPerm
	}
	return &Facade{
		backend:       backend,
		resources:     resources,
		accessMachine: authorizer.AuthOwner,
	}, nil
}
75666
func NewStateFacade(ctx facade.Context) (*Facade, error) {
	pool := NewPool(ctx.StatePool())
	registry := environs.GlobalProviderRegistry()
	watcher := common.NewAgentEntityWatcher(
		ctx.State(),
		ctx.Resources(),
		common.AuthFuncForTagKind(names.ModelTagKind),
	)
	statusSetter := common.NewStatusSetter(
		ctx.State(),
		common.AuthFuncForTagKind(names.ModelTagKind),
	)
	return NewFacade(ctx.State(), pool, registry, watcher, statusSetter, ctx.Auth())
}
148402
func NewFacade(ctx facade.Context) (*API, error) {
	authorizer := ctx.Auth()
	if !authorizer.AuthClient() {
		return nil, common.ErrPerm
	}

	st := ctx.State()
	m, err := st.Model()
	if err != nil {
		return nil, errors.Trace(err)
	}

	return &API{
		authorizer: authorizer,
		backend:    getState(st, m),
	}, nil
}
1313094
func NewClientFacade(caller APICallCloser, facadeName string) (ClientFacade, FacadeCaller) {
	clientFacade := clientFacade{
		facadeCaller: facadeCaller{
			facadeName:  facadeName,
			bestVersion: caller.BestFacadeVersion(facadeName),
			caller:      caller,
		}, closer: caller,
	}
	return clientFacade, clientFacade
}
487605
func NewFacadeV5(ctx facade.Context) (*ModelManagerAPIV5, error) {
	v6, err := NewFacadeV6(ctx)
	if err != nil {
		return nil, err
	}
	return &ModelManagerAPIV5{v6}, nil
}
685522
func NewFacade(backend Backend, res facade.Resources, auth facade.Authorizer) (*Facade, error) {
	if !auth.AuthController() {
		return nil, common.ErrPerm
	}
	return &Facade{
		backend:   backend,
		resources: res,
	}, nil
}
995186
func NewFacade(ctx facade.Context) (*API, error) {
	backend, err := NewStateBackend(ctx.State())
	if err != nil {
		return nil, errors.Annotate(err, "getting state")
	}
	blockChecker := common.NewBlockChecker(ctx.State())
	return NewAPI(
		backend,
		ctx.Auth(),
		blockChecker,
	)
}