Ejemplo n.º 1
0
// NewState returns a version of the state that provides functionality
// required by agent code.
func NewState(caller base.APICaller) *State {
	facadeCaller := base.NewFacadeCaller(caller, "Agent")
	return &State{
		facade:       facadeCaller,
		ModelWatcher: common.NewModelWatcher(facadeCaller),
	}
}
Ejemplo n.º 2
0
// NewState creates a new client-side Machiner facade.
func NewState(caller base.APICaller) *State {
	facadeCaller := base.NewFacadeCaller(caller, provisionerFacade)
	return &State{
		ModelWatcher: common.NewModelWatcher(facadeCaller),
		APIAddresser: common.NewAPIAddresser(facadeCaller),
		facade:       facadeCaller}
}
Ejemplo n.º 3
0
// NewState creates a new client-side Firewaller facade.
func NewState(caller base.APICaller) *State {
	facadeCaller := base.NewFacadeCaller(caller, firewallerFacade)
	return &State{
		facade:         facadeCaller,
		EnvironWatcher: common.NewEnvironWatcher(facadeCaller),
	}
}
Ejemplo n.º 4
0
Archivo: facade.go Proyecto: makyo/juju
// NewFacade returns a Facade backed by the supplied api caller.
func NewFacade(apiCaller base.APICaller, newWatcher NewWatcherFunc) *Facade {
	facadeCaller := base.NewFacadeCaller(apiCaller, "MigrationFlag")
	return &Facade{
		caller:     facadeCaller,
		newWatcher: newWatcher,
	}
}
Ejemplo n.º 5
0
// NewFacade returns a new api client facade instance.
func NewFacade(caller base.APICaller) *Facade {
	facadeCaller := base.NewFacadeCaller(caller, apiName)
	return &Facade{
		EnvironWatcher:      common.NewEnvironWatcher(facadeCaller),
		ToolsVersionUpdater: NewToolsVersionUpdater(facadeCaller),
	}
}
Ejemplo n.º 6
0
// NewState returns a version of the state that provides functionality
// required by the reboot worker.
func NewState(caller base.APICaller, machineTag names.MachineTag) *State {

	return &State{
		facade:     base.NewFacadeCaller(caller, "Reboot"),
		machineTag: machineTag,
	}
}
Ejemplo n.º 7
0
// NewState creates a new client-side Firewaller API facade.
func NewState(caller base.APICaller) *State {
	facadeCaller := base.NewFacadeCaller(caller, firewallerFacade)
	return &State{
		facade:       facadeCaller,
		ModelWatcher: common.NewModelWatcher(facadeCaller),
		CloudSpecAPI: cloudspec.NewCloudSpecAPI(facadeCaller),
	}
}
Ejemplo n.º 8
0
// NewAPI creates a new client-side Addresser facade.
func NewAPI(caller base.APICaller) *API {
	if caller == nil {
		panic("caller is nil")
	}
	return &API{
		facade: base.NewFacadeCaller(caller, addresserFacade),
	}
}
Ejemplo n.º 9
0
Archivo: machiner.go Proyecto: bac/juju
// NewState creates a new client-side Machiner facade.
func NewState(caller base.APICaller) *State {
	facadeCaller := base.NewFacadeCaller(caller, machinerFacade)
	return &State{
		facade:       facadeCaller,
		APIAddresser: common.NewAPIAddresser(facadeCaller),
	}

}
Ejemplo n.º 10
0
// NewState creates a new client-side Uniter facade.
func NewState(caller base.APICaller, authTag names.UnitTag) *State {
	facadeCaller := base.NewFacadeCaller(caller, uniterFacade)
	return &State{
		EnvironWatcher: common.NewEnvironWatcher(facadeCaller),
		APIAddresser:   common.NewAPIAddresser(facadeCaller),
		facade:         facadeCaller,
		unitTag:        authTag,
	}
}
Ejemplo n.º 11
0
// NewAPI creates a new facade.
func NewAPI(caller base.APICaller) *API {
	if caller == nil {
		panic("caller is nil")
	}
	facadeCaller := base.NewFacadeCaller(caller, discoverspacesFacade)
	return &API{
		facade: facadeCaller,
	}
}
Ejemplo n.º 12
0
Archivo: state.go Proyecto: bac/juju
// NewState returns a version of the state that provides functionality
// required by agent code.
func NewState(caller base.APICaller) *State {
	facadeCaller := base.NewFacadeCaller(caller, "Agent")
	return &State{
		facade:              facadeCaller,
		ModelWatcher:        common.NewModelWatcher(facadeCaller),
		CloudSpecAPI:        cloudspec.NewCloudSpecAPI(facadeCaller),
		ControllerConfigAPI: common.NewControllerConfig(facadeCaller),
	}
}
Ejemplo n.º 13
0
Archivo: tracker.go Proyecto: bac/juju
func newLastSentTracker(sink string, caller base.APICaller) *lastSentTracker {
	client := logfwdapi.NewLastSentClient(func(name string) logfwdapi.FacadeCaller {
		return base.NewFacadeCaller(caller, name)
	})
	return &lastSentTracker{
		sink:   sink,
		client: client,
	}
}
Ejemplo n.º 14
0
// NewAPI creates a new client-side InstancePoller facade.
func NewAPI(caller base.APICaller) *API {
	if caller == nil {
		panic("caller is nil")
	}
	facadeCaller := base.NewFacadeCaller(caller, instancePollerFacade)
	return &API{
		EnvironWatcher: common.NewEnvironWatcher(facadeCaller),
		facade:         facadeCaller,
	}
}
Ejemplo n.º 15
0
// NewState creates a new client-side StorageProvisioner facade.
func NewState(caller base.APICaller, scope names.Tag) (*State, error) {
	switch scope.(type) {
	case names.ModelTag:
	case names.MachineTag:
	default:
		return nil, errors.Errorf("expected ModelTag or MachineTag, got %T", scope)
	}
	facadeCaller := base.NewFacadeCaller(caller, storageProvisionerFacade)
	return &State{facadeCaller, scope}, nil
}
Ejemplo n.º 16
0
// NewClient creates a new client for accessing the metricsmanager api
func NewClient(apiCaller base.APICaller) (*Client, error) {
	modelTag, err := apiCaller.ModelTag()
	if err != nil {
		return nil, errors.Trace(err)
	}
	facade := base.NewFacadeCaller(apiCaller, "MetricsManager")
	return &Client{
		modelTag: modelTag,
		facade:   facade,
	}, nil
}
Ejemplo n.º 17
0
// NewClient creates a new client for accessing the undertaker API.
func NewClient(caller base.APICaller, newWatcher NewWatcherFunc) (*Client, error) {
	modelTag, ok := caller.ModelTag()
	if !ok {
		return nil, errors.New("undertaker client is not appropriate for controller-only API")
	}
	return &Client{
		modelTag:   modelTag,
		caller:     base.NewFacadeCaller(caller, "Undertaker"),
		newWatcher: newWatcher,
	}, nil
}
Ejemplo n.º 18
0
// NewClient creates a new client for accessing the undertaker API.
func NewClient(caller base.APICaller, newWatcher NewWatcherFunc) (*Client, error) {
	modelTag, err := caller.ModelTag()
	if err != nil {
		return nil, errors.Trace(err)
	}
	return &Client{
		modelTag:   modelTag,
		caller:     base.NewFacadeCaller(caller, "Undertaker"),
		newWatcher: newWatcher,
	}, nil
}
Ejemplo n.º 19
0
// NewAPI creates a new client-side machine undertaker facade.
func NewAPI(caller base.APICaller, newWatcher NewWatcherFunc) (*API, error) {
	modelTag, ok := caller.ModelTag()
	if !ok {
		return nil, errors.New("machine undertaker client requires a model API connection")
	}
	api := API{
		facade:     base.NewFacadeCaller(caller, "MachineUndertaker"),
		modelTag:   modelTag,
		newWatcher: newWatcher,
	}
	return &api, nil
}
Ejemplo n.º 20
0
Archivo: client.go Proyecto: bac/juju
// NewClient creates a new client for accessing the metricsmanager api
func NewClient(apiCaller base.APICaller) (*Client, error) {
	modelTag, ok := apiCaller.ModelTag()
	if !ok {
		return nil, errors.New("metricsmanager client is not appropriate for controller-only API")

	}
	facade := base.NewFacadeCaller(apiCaller, "MetricsManager")
	return &Client{
		modelTag: modelTag,
		facade:   facade,
	}, nil
}
Ejemplo n.º 21
0
// NewAPI returns a new api client facade instance.
func NewAPI(caller base.APICaller, tag names.Tag) (*API, error) {
	if caller == nil {
		return nil, fmt.Errorf("caller is nil")
	}

	if tag == nil {
		return nil, fmt.Errorf("tag is nil")
	}

	return &API{
		facade: base.NewFacadeCaller(caller, proxyUpdaterFacade),
		tag:    tag,
	}, nil
}
Ejemplo n.º 22
0
// NewState creates a new client-side StorageProvisioner facade.
func NewState(caller base.APICaller, scope names.Tag) *State {
	switch scope.(type) {
	case names.EnvironTag:
	case names.MachineTag:
	default:
		panic(errors.Errorf("expected EnvironTag or MachineTag, got %T", scope))
	}
	facadeCaller := base.NewFacadeCaller(caller, storageProvisionerFacade)
	return &State{
		facadeCaller,
		scope,
		common.NewEnvironWatcher(facadeCaller),
	}
}
Ejemplo n.º 23
0
Archivo: api.go Proyecto: pmatulis/juju
// NewAPI returns a new API client for the Singular facade. It exposes methods
// for claiming and observing administration responsibility for the apiCaller's
// model, on behalf of the supplied controller machine.
func NewAPI(apiCaller base.APICaller, controllerTag names.MachineTag) (*API, error) {
	controllerId := controllerTag.Id()
	if !names.IsValidMachine(controllerId) {
		return nil, errors.NotValidf("controller tag")
	}
	modelTag, err := apiCaller.ModelTag()
	if err != nil {
		return nil, errors.Trace(err)
	}
	facadeCaller := base.NewFacadeCaller(apiCaller, "Singular")
	return &API{
		modelTag:      modelTag,
		controllerTag: controllerTag,
		facadeCaller:  facadeCaller,
	}, nil
}
Ejemplo n.º 24
0
Archivo: api.go Proyecto: bac/juju
// NewAPI returns a new API client for the Singular facade. It exposes methods
// for claiming and observing administration responsibility for the apiCaller's
// model, on behalf of the supplied controller machine.
func NewAPI(apiCaller base.APICaller, controllerTag names.MachineTag) (*API, error) {
	controllerId := controllerTag.Id()
	if !names.IsValidMachine(controllerId) {
		return nil, errors.NotValidf("controller tag")
	}
	modelTag, ok := apiCaller.ModelTag()
	if !ok {
		return nil, errors.New("cannot use singular API on controller-only connection")
	}
	facadeCaller := base.NewFacadeCaller(apiCaller, "Singular")
	return &API{
		modelTag:      modelTag,
		controllerTag: controllerTag,
		facadeCaller:  facadeCaller,
	}, nil
}
Ejemplo n.º 25
0
// NewState returns a version of the state that provides functionality required by the worker.
func NewState(caller base.APICaller) *State {
	return &State{base.NewFacadeCaller(caller, "KeyUpdater")}
}
Ejemplo n.º 26
0
// NewClient creates a new client for accessing the metricsadder API.
func NewClient(caller base.APICaller) *Client {
	return &Client{facade: base.NewFacadeCaller(caller, "MetricsAdder")}
}
Ejemplo n.º 27
0
// NewClient returns a new Client based on an existing API connection.
func NewClient(caller base.APICaller) Client {
	return &client{base.NewFacadeCaller(caller, "MigrationMaster")}
}
Ejemplo n.º 28
0
// NewState returns a version of the state that provides functionality
// required by the upgrader worker.
func NewState(caller base.APICaller) *State {
	return &State{base.NewFacadeCaller(caller, "Upgrader")}
}
Ejemplo n.º 29
0
Archivo: client.go Proyecto: bac/juju
// NewClient returns a new Client based on an existing API connection.
func NewClient(caller base.APICaller) *Client {
	return &Client{base.NewFacadeCaller(caller, "MigrationTarget")}
}
Ejemplo n.º 30
0
// NewFacade returns a new Facade based on an existing API connection.
func NewFacade(caller base.APICaller) *Facade {
	return &Facade{base.NewFacadeCaller(caller, "SSHClient")}
}