github.com/altoros/juju-vmware@v0.0.0-20150312064031-f19ae857ccca/apiserver/annotations/state.go (about) 1 // Copyright 2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package annotations 5 6 import ( 7 "github.com/juju/juju/state" 8 "github.com/juju/names" 9 ) 10 11 type annotationAccess interface { 12 FindEntity(tag names.Tag) (state.Entity, error) 13 GetAnnotations(entity state.GlobalEntity) (map[string]string, error) 14 SetAnnotations(entity state.GlobalEntity, annotations map[string]string) error 15 } 16 17 type stateShim struct { 18 state *state.State 19 } 20 21 func (s stateShim) FindEntity(tag names.Tag) (state.Entity, error) { 22 return s.state.FindEntity(tag) 23 } 24 25 func (s stateShim) GetAnnotations(entity state.GlobalEntity) (map[string]string, error) { 26 return s.state.Annotations(entity) 27 } 28 29 func (s stateShim) SetAnnotations(entity state.GlobalEntity, annotations map[string]string) error { 30 return s.state.SetAnnotations(entity, annotations) 31 }