OLD | NEW |
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 // A global. | 3 // A global. |
4 var noLogin; | 4 var noLogin; |
5 | 5 |
6 YUI.add('juju-env', function(Y) { | 6 YUI.add('juju-env', function(Y) { |
7 | 7 |
8 function Environment(config) { | 8 function Environment(config) { |
9 // Invoke Base constructor, passing through arguments | 9 // Invoke Base constructor, passing through arguments |
10 Environment.superclass.constructor.apply(this, arguments); | 10 Environment.superclass.constructor.apply(this, arguments); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 this._send_rpc({ | 261 this._send_rpc({ |
262 op: 'resolved', | 262 op: 'resolved', |
263 unit_name: unit_name, | 263 unit_name: unit_name, |
264 relation_name: relation_name || null, | 264 relation_name: relation_name || null, |
265 retry: retry || false}, callback); | 265 retry: retry || false}, callback); |
266 }, | 266 }, |
267 | 267 |
268 get_endpoints: function(services, callback) { | 268 get_endpoints: function(services, callback) { |
269 this._send_rpc({'op': 'get_endpoints', 'service_names': services}, | 269 this._send_rpc({'op': 'get_endpoints', 'service_names': services}, |
270 callback); | 270 callback); |
| 271 }, |
| 272 |
| 273 /** |
| 274 * Update the annotations for an entity by name. |
| 275 * |
| 276 * @param {Object} entity The name of a machine, unit, service, or |
| 277 * environment, e.g. '0', 'mysql/0', or 'mysql'. To specify the |
| 278 * environment as the entity the magic string 'env' is used. |
| 279 * @param {Object} data A dictionary of key, value pairs. |
| 280 * @return {undefined} Nothing. |
| 281 */ |
| 282 update_annotations: function(entity, data, callback) { |
| 283 this._send_rpc({ |
| 284 op: 'update_annotations', |
| 285 entity: entity, |
| 286 data: data}, callback); |
| 287 }, |
| 288 |
| 289 /** |
| 290 * Get the annotations for an entity by name. |
| 291 * |
| 292 * Note that the annotations are returned as part of the delta stream, so |
| 293 * the explicit use of this command should rarely be needed. |
| 294 * |
| 295 * @param {Object} entity The name of a machine, unit, service, or |
| 296 * environment, e.g. '0', 'mysql/0', or 'mysql'. To specify the |
| 297 * environment as the entity the magic string 'env' is used. |
| 298 * @return {Object} A dictionary of key,value pairs is returned in the |
| 299 * callback. The invocation of this command returns nothing. |
| 300 */ |
| 301 get_annotations: function(entity, callback) { |
| 302 this._send_rpc({ |
| 303 op: 'get_annotations', |
| 304 entity: entity}, callback); |
| 305 }, |
| 306 |
| 307 /** |
| 308 * Remove the annotations for an entity by name. |
| 309 * |
| 310 * @param {Object} entity The name of a machine, unit, service, or |
| 311 * environment, e.g. '0', 'mysql/0', or 'mysql'. To specify the |
| 312 * environment as the entity the magic string 'env' is used. |
| 313 * @param {Object} keys An optional list of annotation key names for the |
| 314 * annotations to be deleted. If no keys are passed, all annotations |
| 315 * for the entity will be removed. |
| 316 * @return {undefined} Nothing. |
| 317 */ |
| 318 remove_annotations: function(entity, keys, callback) { |
| 319 this._send_rpc({ |
| 320 op: 'remove_annotations', |
| 321 entity: entity, |
| 322 keys: keys || []}, callback); |
271 } | 323 } |
272 | 324 |
273 | |
274 }); | 325 }); |
275 | 326 |
276 | 327 |
277 Y.namespace('juju').Environment = Environment; | 328 Y.namespace('juju').Environment = Environment; |
278 | 329 |
279 }, '0.1.0', { | 330 }, '0.1.0', { |
280 requires: [ | 331 requires: [ |
281 'io', | 332 'io', |
282 'json-parse', | 333 'json-parse', |
283 'json-stringify', | 334 'json-stringify', |
284 'base', | 335 'base', |
285 'reconnecting-websocket' | 336 'reconnecting-websocket' |
286 ] | 337 ] |
287 }); | 338 }); |
OLD | NEW |