Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(71)

Side by Side Diff: environs/interface.go

Issue 6343107: environs: add configuration attributes and access
Patch Set: Created 5 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 package environs 1 package environs
2 2
3 import ( 3 import (
4 "errors" 4 "errors"
5 "io" 5 "io"
6 "launchpad.net/juju-core/state" 6 "launchpad.net/juju-core/state"
7 ) 7 )
8 8
9 // A EnvironProvider represents a computing and storage provider. 9 // A EnvironProvider represents a computing and storage provider.
10 type EnvironProvider interface { 10 type EnvironProvider interface {
11 // NewConfig returns a new EnvironConfig representing the 11 // NewConfig returns a new EnvironConfig representing the
12 // environment with the given attributes. Every provider must 12 // environment with the given attributes. Every provider must
13 // accept the "name" and "type" keys, holding the name of the 13 // accept the "name" and "type" keys, holding the name of the
14 // environment and the provider type respectively. 14 // environment and the provider type respectively.
15 NewConfig(attrs map[string]interface{}) (EnvironConfig, error) 15 NewConfig(attrs map[string]interface{}) (EnvironConfig, error)
16 } 16 }
17 17
18 // EnvironConfig represents an environment's configuration. 18 // EnvironConfig represents an environment's configuration.
19 type EnvironConfig interface { 19 type EnvironConfig interface {
20 » // Open opens the environment and returns it. 20 » // DefaultSeries returns the default series of the configuration.
21 » DefaultSeries() string
22
23 » // AuthorizedKeys returns the SSH authorized keys of the
24 » // environment in standard form.
25 » AuthorizedKeys() string
26
27 » // Name returns the environment name of the configuration.
28 » Name() string
29
30 » // Type returns the environment type of the configuration.
31 » Type() string
32
33 » // Attrs returns the attributes of the configuration.
34 » Attrs() map[string]interface{}
35
36 » // Change changes the given attributes of the configuration.
37 » Change(attrs map[string]interface{}) error
38
39 » // Clone returns a copy of the configuration.
40 » Clone() EnvironConfig
41
42 » // Open opens the environment with the given configuration,
43 » // which must have been created with NewConfig.
21 Open() (Environ, error) 44 Open() (Environ, error)
fwereade 2012/07/13 16:08:14 Still not wild on Open, but not especially bothere
22 } 45 }
23 46
24 var ErrNoDNSName = errors.New("DNS name not allocated") 47 var ErrNoDNSName = errors.New("DNS name not allocated")
25 48
26 // Instance represents the provider-specific notion of a machine. 49 // Instance represents the provider-specific notion of a machine.
27 type Instance interface { 50 type Instance interface {
28 // Id returns a provider-generated identifier for the Instance. 51 // Id returns a provider-generated identifier for the Instance.
29 Id() string 52 Id() string
30 53
31 // DNSName returns the DNS name for the instance. 54 // DNSName returns the DNS name for the instance.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // Name returns the Environ's name. 134 // Name returns the Environ's name.
112 Name() string 135 Name() string
113 136
114 // Bootstrap initializes the state for the environment, 137 // Bootstrap initializes the state for the environment,
115 // possibly starting one or more instances. 138 // possibly starting one or more instances.
116 // If uploadTools is true, the current version of 139 // If uploadTools is true, the current version of
117 // the juju tools will be uploaded and used 140 // the juju tools will be uploaded and used
118 // on the environment's instances. 141 // on the environment's instances.
119 Bootstrap(uploadTools bool) error 142 Bootstrap(uploadTools bool) error
120 143
144 // Config returns the configuration of the environment.
145 Config() EnvironConfig
fwereade 2012/07/13 16:08:14 Please no. I can't see any good reason for this at
146
121 // StateInfo returns information on the state initialized 147 // StateInfo returns information on the state initialized
122 // by Bootstrap. 148 // by Bootstrap.
123 StateInfo() (*state.Info, error) 149 StateInfo() (*state.Info, error)
124 150
125 // SetConfig updates the Environs configuration. 151 // SetConfig updates the Environs configuration.
126 // Calls to SetConfig do not affect the configuration of 152 // Calls to SetConfig do not affect the configuration of
127 // values previously obtained from Storage and PublicStorage. 153 // values previously obtained from Storage and PublicStorage.
128 SetConfig(config EnvironConfig) 154 SetConfig(config EnvironConfig)
129 155
130 // StartInstance asks for a new instance to be created, 156 // StartInstance asks for a new instance to be created,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // yet be visible in the environment, so this method 189 // yet be visible in the environment, so this method
164 // can wait until they are. 190 // can wait until they are.
165 // 191 //
166 // When Destroy has been called, any Environ referring to the 192 // When Destroy has been called, any Environ referring to the
167 // same remote environment may become invalid 193 // same remote environment may become invalid
168 Destroy(insts []Instance) error 194 Destroy(insts []Instance) error
169 195
170 // AssignmentPolicy returns the environment's unit assignment policy. 196 // AssignmentPolicy returns the environment's unit assignment policy.
171 AssignmentPolicy() state.AssignmentPolicy 197 AssignmentPolicy() state.AssignmentPolicy
172 } 198 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 204d58d