Merge from OSM SO master
[osm/SO.git] / rwlaunchpad / plugins / yang / rw-staging-mgmt.yang
1 /*
2  *
3  *   Copyright 2016-2017 RIFT.IO Inc
4  *
5  *   Licensed under the Apache License, Version 2.0 (the "License");
6  *   you may not use this file except in compliance with the License.
7  *   You may obtain a copy of the License at
8  *
9  *       http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *   Unless required by applicable law or agreed to in writing, software
12  *   distributed under the License is distributed on an "AS IS" BASIS,
13  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *   See the License for the specific language governing permissions and
15  *   limitations under the License.
16  *
17  *
18  */
19
20 /**
21  * @file rw-staging-mgmt.yang
22  * @author Varun Prasad
23  * @date 2016/09/21
24  * @brief Pacakage Management Yang
25  */
26
27 module rw-staging-mgmt
28 {
29   namespace "http://riftio.com/ns/riftware-1.0/rw-staging-mgmt";
30   prefix "rw-staging-mgmt";
31
32   import ietf-yang-types {
33     prefix "yang";
34   }
35
36   import rw-pb-ext {
37     prefix "rwpb";
38   }
39
40   import rw-cli-ext {
41     prefix "rwcli";
42   }
43
44   import rw-cloud {
45     prefix "rwcloud";
46   }
47
48   import rwcal {
49     prefix "rwcal";
50   }
51
52   import mano-types {
53     prefix "manotypes";
54   }
55
56   import rw-project {
57     prefix "rw-project";
58   }
59
60   import rw-project-mano {
61     prefix "rw-project-mano";
62   }
63
64   revision 2017-02-08 {
65     description
66       "Update model to support projects.";
67   }
68
69   revision 2016-06-01 {
70     description
71       "Initial revision.";
72   }
73
74   typedef staging-area-status {
75     type enumeration {
76       enum LIVE;
77       enum EXPIRED;
78     }
79   }
80
81   grouping staging-area-config {
82     leaf package-type {
83       mandatory true;
84       type manotypes:package-type;
85     }
86
87     leaf name {
88       description "name of the binary";
89       type string;
90     }
91
92     leaf validity-time {
93       description "lifetime of the staging area (in seconds)";
94       type uint64;
95       default 3600;
96     }
97
98     leaf project-name {
99       description "Project to which this belongs";
100       type leafref {
101         path "/rw-project:project/rw-project:name";
102       }
103     }
104   }
105
106   grouping staging-area-meta {
107
108     leaf status {
109       description "The status of the staging area";
110       type staging-area-status;
111     }
112
113     leaf created-time {
114       description "start time (unix epoch)";
115       type uint32;
116     }
117
118     leaf deleted-time {
119       description "stop time (unix epoch)";
120       type uint32;
121     }
122
123     leaf size {
124       description "size of the binary in bytes";
125       type uint64;
126     }
127
128     leaf path {
129       description "Path of the staging area";
130       type string;
131     }
132
133   }
134
135   augment "/rw-project:project" {
136     container staging-areas {
137       rwpb:msg-new StagingAreas;
138       description "Staging Areas";
139       config false;
140
141       list staging-area {
142         rwpb:msg-new StagingArea;
143         key "area-id";
144
145         leaf area-id {
146           description "Staging Area ID";
147           type string;
148         }
149
150         uses staging-area-config;
151         uses staging-area-meta;
152       }
153     }
154   }
155
156   rpc create-staging-area {
157     description "Creates a staging area for the upload.";
158
159     input {
160       uses staging-area-config;
161     }
162
163     output {
164       leaf port {
165         type uint32;
166       }
167
168       leaf endpoint {
169         description "Endpoint that contains all the package-related data";
170         type string;
171       }
172     }
173   }
174 }