~rogpeppe/juju-core/azure

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
45
46
47
48
49
50
// Copyright 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.

package api

import (
	"launchpad.net/juju-core/state/api/deployer"
	"launchpad.net/juju-core/state/api/machineagent"
	"launchpad.net/juju-core/state/api/machiner"
	"launchpad.net/juju-core/state/api/params"
	"launchpad.net/juju-core/state/api/upgrader"
)

// Login authenticates as the entity with the given name and password.
// Subsequent requests on the state will act as that entity.
// This method is usually called automatically by Open.
func (st *State) Login(tag, password string) error {
	return st.Call("Admin", "", "Login", &params.Creds{
		AuthTag:  tag,
		Password: password,
	}, nil)
}

// Client returns an object that can be used
// to access client-specific functionality.
func (st *State) Client() *Client {
	return &Client{st}
}

// Machiner returns a version of the state that provides functionality
// required by the machiner worker.
func (st *State) Machiner() *machiner.State {
	return machiner.NewState(st)
}

// MachineAgent returns a version of the state that provides
// functionality required by the machine agent code.
func (st *State) MachineAgent() *machineagent.State {
	return machineagent.NewState(st)
}

// Upgrader returns access to the Upgrader API
func (st *State) Upgrader() (*upgrader.Upgrader, error) {
	return upgrader.New(st), nil
}

// Deployer returns access to the Deployer API
func (st *State) Deployer() (*deployer.Deployer, error) {
	return deployer.New(st), nil
}