Jiri Simsa | 756772c | 2015-03-25 15:40:54 -0700 | [diff] [blame] | 1 | // Copyright 2015 The Vanadium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 5 | // Package repository contains implementation of the interface for |
Suharsh Sivakumar | d1cc6e0 | 2015-03-16 13:58:49 -0700 | [diff] [blame] | 6 | // storing and serving various vanadium management objects. |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 7 | package repository |
| 8 | |
| 9 | import ( |
Todd Wang | 387d8a4 | 2015-03-30 17:09:05 -0700 | [diff] [blame^] | 10 | "v.io/v23/security/access" |
Jiri Simsa | 6ac9522 | 2015-02-23 16:11:49 -0800 | [diff] [blame] | 11 | "v.io/v23/services/mgmt/application" |
Todd Wang | 387d8a4 | 2015-03-30 17:09:05 -0700 | [diff] [blame^] | 12 | "v.io/x/ref/services/mgmt/profile" |
Jiri Simsa | 6ac9522 | 2015-02-23 16:11:49 -0800 | [diff] [blame] | 13 | public "v.io/v23/services/mgmt/repository" |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 14 | ) |
| 15 | |
| 16 | // Application describes an application repository internally. Besides |
| 17 | // the public Application interface, it allows to add and remove |
| 18 | // application envelopes. |
| 19 | type Application interface { |
| 20 | public.Application |
| 21 | // Put adds the given tuple of application version (specified |
Bogdan Caprita | d9281a3 | 2014-07-02 14:40:39 -0700 | [diff] [blame] | 22 | // through the object name suffix) and application envelope to all |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 23 | // of the given application profiles. |
Asim Shankar | 6888519 | 2014-11-26 12:48:35 -0800 | [diff] [blame] | 24 | Put(Profiles []string, Envelope application.Envelope) error {access.Write} |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 25 | // Remove removes the application envelope for the given profile |
Bogdan Caprita | d9281a3 | 2014-07-02 14:40:39 -0700 | [diff] [blame] | 26 | // name and application version (specified through the object name |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 27 | // suffix). If no version is specified as part of the suffix, the |
| 28 | // method removes all versions for the given profile. |
| 29 | // |
| 30 | // TODO(jsimsa): Add support for using "*" to specify all profiles |
| 31 | // when Matt implements Globing (or Ken implements querying). |
Asim Shankar | 6888519 | 2014-11-26 12:48:35 -0800 | [diff] [blame] | 32 | Remove(Profile string) error {access.Write} |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | // Profile describes a profile internally. Besides the public Profile |
| 36 | // interface, it allows to add and remove profile specifications. |
| 37 | type Profile interface { |
| 38 | public.Profile |
| 39 | // Specification returns the profile specification for the profile |
Bogdan Caprita | d9281a3 | 2014-07-02 14:40:39 -0700 | [diff] [blame] | 40 | // identified through the object name suffix. |
Todd Wang | 383e88c | 2014-12-18 01:52:34 -0800 | [diff] [blame] | 41 | Specification() (profile.Specification | error) {access.Read} |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 42 | // Put sets the profile specification for the profile identified |
Bogdan Caprita | d9281a3 | 2014-07-02 14:40:39 -0700 | [diff] [blame] | 43 | // through the object name suffix. |
Asim Shankar | 6888519 | 2014-11-26 12:48:35 -0800 | [diff] [blame] | 44 | Put(Specification profile.Specification) error {access.Write} |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 45 | // Remove removes the profile specification for the profile |
Bogdan Caprita | d9281a3 | 2014-07-02 14:40:39 -0700 | [diff] [blame] | 46 | // identified through the object name suffix. |
Asim Shankar | 6888519 | 2014-11-26 12:48:35 -0800 | [diff] [blame] | 47 | Remove() error {access.Write} |
Jiri Simsa | ddbfebb | 2014-06-20 15:56:06 -0700 | [diff] [blame] | 48 | } |