LEFT | RIGHT |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package params | 4 package params |
5 | 5 |
6 import ( | 6 import ( |
7 "bytes" | 7 "bytes" |
8 "encoding/json" | 8 "encoding/json" |
9 "fmt" | 9 "fmt" |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 return nil | 33 return nil |
34 } | 34 } |
35 | 35 |
36 // ErrorResult holds the error status of a single operation. | 36 // ErrorResult holds the error status of a single operation. |
37 type ErrorResult struct { | 37 type ErrorResult struct { |
38 Error *Error | 38 Error *Error |
39 } | 39 } |
40 | 40 |
41 // StatusData contains additional information for a status. | 41 // StatusData contains additional information for a status. |
42 type StatusData map[string]interface{} | 42 type StatusData map[string]interface{} |
43 | |
44 // Values converts the data into a slice of values to be passed | |
45 // to the SetStatus() methods. | |
46 func (d StatusData) Values() []StatusValue { | |
47 values := make([]StatusValue, len(d)) | |
48 index := 0 | |
49 for key, value := range d { | |
50 values[index] = StatusValue{key, value} | |
51 index++ | |
52 } | |
53 return values | |
54 } | |
55 | |
56 // StatusValue is a key/value pair for StatusData. | |
57 type StatusValue struct { | |
58 Key string | |
59 Value interface{} | |
60 } | |
61 | 43 |
62 // AddRelation holds the parameters for making the AddRelation call. | 44 // AddRelation holds the parameters for making the AddRelation call. |
63 // The endpoints specified are unordered. | 45 // The endpoints specified are unordered. |
64 type AddRelation struct { | 46 type AddRelation struct { |
65 Endpoints []string | 47 Endpoints []string |
66 } | 48 } |
67 | 49 |
68 // AddRelationResults holds the results of a AddRelation call. The Endpoints | 50 // AddRelationResults holds the results of a AddRelation call. The Endpoints |
69 // field maps service names to the involved endpoints. | 51 // field maps service names to the involved endpoints. |
70 type AddRelationResults struct { | 52 type AddRelationResults struct { |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 Tag string | 398 Tag string |
417 Annotations map[string]string | 399 Annotations map[string]string |
418 } | 400 } |
419 | 401 |
420 func (i *AnnotationInfo) EntityId() EntityId { | 402 func (i *AnnotationInfo) EntityId() EntityId { |
421 return EntityId{ | 403 return EntityId{ |
422 Kind: "annotation", | 404 Kind: "annotation", |
423 Id: i.Tag, | 405 Id: i.Tag, |
424 } | 406 } |
425 } | 407 } |
LEFT | RIGHT |