2323import org .apache .cloudstack .api .command .user .vpc .CreateVPCCmd ;
2424import org .apache .cloudstack .api .command .user .vpc .ListPrivateGatewaysCmd ;
2525import org .apache .cloudstack .api .command .user .vpc .ListStaticRoutesCmd ;
26+ import org .apache .cloudstack .api .command .user .vpc .ListVPCsCmd ;
2627import org .apache .cloudstack .api .command .user .vpc .RestartVPCCmd ;
28+ import org .apache .cloudstack .api .command .user .vpc .UpdateVPCCmd ;
2729
2830import com .cloud .exception .ConcurrentOperationException ;
2931import com .cloud .exception .InsufficientAddressCapacityException ;
3739
3840public interface VpcService {
3941
40- public Vpc createVpc (CreateVPCCmd cmd ) throws ResourceAllocationException ;
4142 /**
4243 * Persists VPC record in the database
4344 *
@@ -48,14 +49,25 @@ public interface VpcService {
4849 * @param displayText
4950 * @param cidr
5051 * @param networkDomain TODO
52+ * @param ip4Dns1
53+ * @param ip4Dns2
5154 * @param displayVpc TODO
5255 * @return
5356 * @throws ResourceAllocationException TODO
5457 */
55- public Vpc createVpc (long zoneId , long vpcOffId , long vpcOwnerId , String vpcName , String displayText , String cidr , String networkDomain ,
56- String dns1 , String dns2 , String ip6Dns1 , String ip6Dns2 , Boolean displayVpc , Integer publicMtu )
58+ Vpc createVpc (long zoneId , long vpcOffId , long vpcOwnerId , String vpcName , String displayText , String cidr , String networkDomain ,
59+ String ip4Dns1 , String ip4Dns2 , String ip6Dns1 , String ip6Dns2 , Boolean displayVpc , Integer publicMtu )
5760 throws ResourceAllocationException ;
5861
62+ /**
63+ * Persists VPC record in the database
64+ *
65+ * @param cmd the command with specification data for the new vpc
66+ * @return a data object describing the new vpc
67+ * @throws ResourceAllocationException the resources for this VPC cannot be allocated
68+ */
69+ Vpc createVpc (CreateVPCCmd cmd ) throws ResourceAllocationException ;
70+
5971 /**
6072 * Deletes a VPC
6173 *
@@ -65,48 +77,48 @@ public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName
6577 * @throws ResourceUnavailableException
6678 * @throws ConcurrentOperationException
6779 */
68- public boolean deleteVpc (long vpcId ) throws ConcurrentOperationException , ResourceUnavailableException ;
80+ boolean deleteVpc (long vpcId ) throws ConcurrentOperationException , ResourceUnavailableException ;
81+
82+ /**
83+ * Persists VPC record in the database
84+ *
85+ * @param cmd the command with specification data for updating the vpc
86+ * @return a data object describing the new vpc state
87+ * @throws ResourceUnavailableException if during restart some resources may not be available
88+ * @throws InsufficientCapacityException if for instance no address space, compute or storage is sufficiently available
89+ */
90+ Vpc updateVpc (UpdateVPCCmd cmd ) throws ResourceUnavailableException , InsufficientCapacityException ;
6991
7092 /**
7193 * Updates VPC with new name/displayText
7294 *
73- * @param vpcId
74- * @param vpcName
75- * @param displayText
76- * @param customId TODO
77- * @param displayVpc TODO
78- * @param mtu
79- * @return
95+ * @param vpcId the ID of the Vpc to update
96+ * @param vpcName The new name to give the vpc
97+ * @param displayText the new display text to use for describing the VPC
98+ * @param customId A new custom (external) ID to associate this VPC with
99+ * @param displayVpc should this VPC be displayed on public lists
100+ * @param mtu what maximal transfer unit to us in this VPCs networks
101+ * @param sourceNatIp the source NAT address to use for this VPC (must already be associated with the VPC)
102+ * @return an object describing the current state of the VPC
103+ * @throws ResourceUnavailableException if during restart some resources may not be available
104+ * @throws InsufficientCapacityException if for instance no address space, compute or storage is sufficiently available
80105 */
81- public Vpc updateVpc (long vpcId , String vpcName , String displayText , String customId , Boolean displayVpc , Integer mtu ) ;
106+ Vpc updateVpc (long vpcId , String vpcName , String displayText , String customId , Boolean displayVpc , Integer mtu , String sourceNatIp ) throws ResourceUnavailableException , InsufficientCapacityException ;
82107
83108 /**
84- * Lists VPC(s) based on the parameters passed to the method call
109+ * Lists VPC(s) based on the parameters passed to the API call
85110 *
86- * @param id
87- * @param vpcName
88- * @param displayText
89- * @param supportedServicesStr
90- * @param cidr
91- * @param state TODO
92- * @param accountName
93- * @param domainId
94- * @param keyword
95- * @param startIndex
96- * @param pageSizeVal
97- * @param zoneId TODO
98- * @param isRecursive TODO
99- * @param listAll TODO
100- * @param restartRequired TODO
101- * @param tags TODO
102- * @param projectId TODO
103- * @param display TODO
104- * @param vpc
105- * @return
111+ * @param cmd object containing the search specs
112+ * @return the List of VPCs
106113 */
107- public Pair <List <? extends Vpc >, Integer > listVpcs (Long id , String vpcName , String displayText , List <String > supportedServicesStr , String cidr , Long vpcOffId , String state ,
108- String accountName , Long domainId , String keyword , Long startIndex , Long pageSizeVal , Long zoneId , Boolean isRecursive , Boolean listAll , Boolean restartRequired ,
109- Map <String , String > tags , Long projectId , Boolean display );
114+ Pair <List <? extends Vpc >, Integer > listVpcs (ListVPCsCmd cmd );
115+
116+ /**
117+ * Lists VPC(s) based on the parameters passed to the method call
118+ */
119+ Pair <List <? extends Vpc >, Integer > listVpcs (Long id , String vpcName , String displayText , List <String > supportedServicesStr , String cidr , Long vpcOffId , String state ,
120+ String accountName , Long domainId , String keyword , Long startIndex , Long pageSizeVal , Long zoneId , Boolean isRecursive , Boolean listAll , Boolean restartRequired ,
121+ Map <String , String > tags , Long projectId , Boolean display );
110122
111123 /**
112124 * Starts VPC which includes starting VPC provider and applying all the networking rules on the backend
@@ -130,17 +142,17 @@ public Pair<List<? extends Vpc>, Integer> listVpcs(Long id, String vpcName, Stri
130142 */
131143 boolean shutdownVpc (long vpcId ) throws ConcurrentOperationException , ResourceUnavailableException ;
132144
145+ boolean restartVpc (RestartVPCCmd cmd ) throws ConcurrentOperationException , ResourceUnavailableException , InsufficientCapacityException ;
146+
133147 /**
134148 * Restarts the VPC. VPC gets shutdown and started as a part of it
135149 *
136- * @param id
137- * @param cleanUp
138- * @param makeredundant
139- * @return
140- * @throws InsufficientCapacityException
150+ * @param networkId the network to restart
151+ * @param cleanup throw away the existing VR and rebuild a new one?
152+ * @param makeRedundant create two VRs for this network
153+ * @return success or not
154+ * @throws InsufficientCapacityException when there is no suitable deployment plan possible
141155 */
142- boolean restartVpc (RestartVPCCmd cmd ) throws ConcurrentOperationException , ResourceUnavailableException , InsufficientCapacityException ;
143-
144156 boolean restartVpc (Long networkId , boolean cleanup , boolean makeRedundant , boolean livePatch , User user ) throws ConcurrentOperationException , ResourceUnavailableException , InsufficientCapacityException ;
145157
146158 /**
@@ -154,23 +166,12 @@ public Pair<List<? extends Vpc>, Integer> listVpcs(Long id, String vpcName, Stri
154166 /**
155167 * Persists VPC private gateway in the Database.
156168 *
157- *
158- * @param vpcId TODO
159- * @param physicalNetworkId
160- * @param vlan
161- * @param ipAddress
162- * @param gateway
163- * @param netmask
164- * @param gatewayOwnerId
165- * @param networkOfferingId
166- * @param isSourceNat
167- * @param aclId
168- * @return
169+ * @return data object describing the private gateway
169170 * @throws InsufficientCapacityException
170171 * @throws ConcurrentOperationException
171172 * @throws ResourceAllocationException
172173 */
173- public PrivateGateway createVpcPrivateGateway (CreatePrivateGatewayCmd command ) throws ResourceAllocationException , ConcurrentOperationException , InsufficientCapacityException ;
174+ PrivateGateway createVpcPrivateGateway (CreatePrivateGatewayCmd command ) throws ResourceAllocationException , ConcurrentOperationException , InsufficientCapacityException ;
174175
175176 /**
176177 * Applies VPC private gateway on the backend, so it becomes functional
@@ -181,12 +182,12 @@ public Pair<List<? extends Vpc>, Integer> listVpcs(Long id, String vpcName, Stri
181182 * @throws ResourceUnavailableException
182183 * @throws ConcurrentOperationException
183184 */
184- public PrivateGateway applyVpcPrivateGateway (long gatewayId , boolean destroyOnFailure ) throws ConcurrentOperationException , ResourceUnavailableException ;
185+ PrivateGateway applyVpcPrivateGateway (long gatewayId , boolean destroyOnFailure ) throws ConcurrentOperationException , ResourceUnavailableException ;
185186
186187 /**
187188 * Deletes VPC private gateway
188189 *
189- * @param id
190+ * @param gatewayId
190191 * @return
191192 * @throws ResourceUnavailableException
192193 * @throws ConcurrentOperationException
@@ -199,7 +200,7 @@ public Pair<List<? extends Vpc>, Integer> listVpcs(Long id, String vpcName, Stri
199200 * @param listPrivateGatewaysCmd
200201 * @return
201202 */
202- public Pair <List <PrivateGateway >, Integer > listPrivateGateway (ListPrivateGatewaysCmd listPrivateGatewaysCmd );
203+ Pair <List <PrivateGateway >, Integer > listPrivateGateway (ListPrivateGatewaysCmd listPrivateGatewaysCmd );
203204
204205 /**
205206 * Returns Static Route found by Id
@@ -216,7 +217,7 @@ public Pair<List<? extends Vpc>, Integer> listVpcs(Long id, String vpcName, Stri
216217 * @return
217218 * @throws ResourceUnavailableException
218219 */
219- public boolean applyStaticRoutesForVpc (long vpcId ) throws ResourceUnavailableException ;
220+ boolean applyStaticRoutesForVpc (long vpcId ) throws ResourceUnavailableException ;
220221
221222 /**
222223 * Deletes static route from the backend and the database
@@ -225,7 +226,7 @@ public Pair<List<? extends Vpc>, Integer> listVpcs(Long id, String vpcName, Stri
225226 * @return TODO
226227 * @throws ResourceUnavailableException
227228 */
228- public boolean revokeStaticRoute (long routeId ) throws ResourceUnavailableException ;
229+ boolean revokeStaticRoute (long routeId ) throws ResourceUnavailableException ;
229230
230231 /**
231232 * Persists static route entry in the Database
@@ -234,15 +235,15 @@ public Pair<List<? extends Vpc>, Integer> listVpcs(Long id, String vpcName, Stri
234235 * @param cidr
235236 * @return
236237 */
237- public StaticRoute createStaticRoute (long gatewayId , String cidr ) throws NetworkRuleConflictException ;
238+ StaticRoute createStaticRoute (long gatewayId , String cidr ) throws NetworkRuleConflictException ;
238239
239240 /**
240241 * Lists static routes based on parameters passed to the call
241242 *
242- * @param listStaticRoutesCmd
243+ * @param cmd Command object with parameters for { @see ListStaticRoutesCmd }
243244 * @return
244245 */
245- public Pair <List <? extends StaticRoute >, Integer > listStaticRoutes (ListStaticRoutesCmd cmd );
246+ Pair <List <? extends StaticRoute >, Integer > listStaticRoutes (ListStaticRoutesCmd cmd );
246247
247248 /**
248249 * Associates IP address from the Public network, to the VPC
@@ -262,6 +263,5 @@ IpAddress associateIPToVpc(long ipId, long vpcId) throws ResourceAllocationExcep
262263 * @param routeId
263264 * @return
264265 */
265- public boolean applyStaticRoute (long routeId ) throws ResourceUnavailableException ;
266-
266+ boolean applyStaticRoute (long routeId ) throws ResourceUnavailableException ;
267267}
0 commit comments