d5722cd263e6b6a1e62a18f452dc20abe92cb323
[osm/SO.git] / rwlaunchpad / plugins / yang / rw-staging-mgmt.yang
1 /*
2  *
3  *   Copyright 2016 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   revision 2016-06-01 {
57     description
58       "Initial revision.";
59   }
60
61   typedef staging-area-status {
62     type enumeration {
63       enum LIVE;
64       enum EXPIRED;
65     }
66   }
67
68   grouping staging-area-config {
69     leaf package-type {
70       mandatory true;
71       type manotypes:package-type;
72     }
73
74     leaf name {
75       description "name of the binary";
76       type string;
77     }
78
79     leaf validity-time {
80       description "lifetime of the staging area (in seconds)";
81       type uint64;
82       default 3600;
83     }
84   }
85
86   grouping staging-area-meta {
87
88     leaf status {
89       description "The status of the staging area";
90       type staging-area-status;
91     }
92
93     leaf created-time {
94       description "start time (unix epoch)";
95       type uint32;
96     }
97
98     leaf deleted-time {
99       description "stop time (unix epoch)";
100       type uint32;
101     }
102
103     leaf size {
104       description "size of the binary in bytes";
105       type uint64;
106     }
107
108     leaf path {
109       description "Path of the staging area";
110       type string;
111     }
112
113   }
114
115   container staging-areas {
116     rwpb:msg-new StagingAreas;
117     description "Staging Areas";
118     config false;
119
120     list staging-area {
121       rwpb:msg-new StagingArea;
122       key "area-id";
123
124       leaf area-id {
125         description "Staging Area ID";
126         type string;
127       }
128
129       uses staging-area-config;
130       uses staging-area-meta;
131     }
132   }
133
134
135   rpc create-staging-area {
136     description "Creates a staging area for the upload.";
137
138     input {
139       uses staging-area-config;
140     }
141
142     output {
143       leaf port {
144         type uint32;
145       }
146
147       leaf endpoint {
148         description "Endpoint that contains all the package-related data";
149         type string;
150       }
151     }
152   }
153 }