2a6b37d823e011695b385c82a0c89eaf8b224ee4
[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
99   grouping staging-area-meta {
100
101     leaf status {
102       description "The status of the staging area";
103       type staging-area-status;
104     }
105
106     leaf created-time {
107       description "start time (unix epoch)";
108       type uint32;
109     }
110
111     leaf deleted-time {
112       description "stop time (unix epoch)";
113       type uint32;
114     }
115
116     leaf size {
117       description "size of the binary in bytes";
118       type uint64;
119     }
120
121     leaf path {
122       description "Path of the staging area";
123       type string;
124     }
125
126   }
127
128   augment "/rw-project:project" {
129     container staging-areas {
130       rwpb:msg-new StagingAreas;
131       description "Staging Areas";
132       config false;
133
134       list staging-area {
135         rwpb:msg-new StagingArea;
136         key "area-id";
137
138         leaf area-id {
139           description "Staging Area ID";
140           type string;
141         }
142
143         uses staging-area-config;
144         uses staging-area-meta;
145       }
146     }
147   }
148
149   rpc create-staging-area {
150     description "Creates a staging area for the upload.";
151
152     input {
153       uses staging-area-config;
154       uses manotypes:rpc-project-name;
155     }
156
157     output {
158       leaf port {
159         type uint32;
160       }
161
162       leaf endpoint {
163         description "Endpoint that contains all the package-related data";
164         type string;
165       }
166     }
167   }
168 }