@@ -116,6 +116,27 @@ public InfrastructureUri createInfrastructure(String infrastructureDefinition,
116116 return getImClient ().post (PATH_INFRASTRUCTURES , infrastructureDefinition ,
117117 bodyContentType .getValue (), InfrastructureUri .class );
118118 }
119+
120+ /**
121+ * Create and configure an infrastructure with the requirements specified in
122+ * the document of the body contents.<br>
123+ * If success, it is returned the URI of the new infrastructure.
124+ * This call will not wait for the VMs to be created to return.
125+ *
126+ * @param infrastructureDefinition
127+ * : file with the virtual machine properties and configuration
128+ * @param bodyContentType
129+ * : set the body content type. Can be RADL, RADL_JSON or TOSCA.
130+ * @return : URI of the new infrastructure
131+ */
132+ public InfrastructureUri createInfrastructureAsync (String infrastructureDefinition ,
133+ BodyContentType bodyContentType ) throws ImClientException {
134+
135+ RestParameter asyncParameter = createCallParameters (REST_PARAMETER_NAME_ASYNC , true );
136+
137+ return getImClient ().post (PATH_INFRASTRUCTURES , infrastructureDefinition ,
138+ bodyContentType .getValue (), InfrastructureUri .class , asyncParameter );
139+ }
119140
120141 /**
121142 * Return a list of URIs referencing the infrastructures associated to the IM
@@ -301,47 +322,18 @@ public InfrastructureUris addResource(String infId, String radlFile,
301322 * @param context
302323 * : flag to specify if the contextualization step will be launched
303324 * just after the VM addition
304- * @param async
305- * : flag to specify if the call has to wait for the VMs to be
306- * created.
307325 * @return : list of URIs of the new virtual machines
308326 */
309327 public InfrastructureUris addResource (String infId , String radlFile ,
310- BodyContentType bodyContentType , boolean context , boolean async )
328+ BodyContentType bodyContentType , boolean context )
311329 throws ImClientException {
312330
313331 RestParameter ctxParameter =
314332 createCallParameters (REST_PARAMETER_NAME_CONTEXT , context );
315- RestParameter asyncParameter =
316- createCallParameters (REST_PARAMETER_NAME_ASYNC , async );
317-
333+
318334 return getImClient ().post (PATH_INFRASTRUCTURES + PATH_SEPARATOR + infId ,
319- radlFile , bodyContentType .getValue (), InfrastructureUris .class ,
320- ctxParameter , asyncParameter );
321- }
322-
323- /**
324- * Add the resources specified in the body contents to the infrastructure with
325- * ID 'infId'. The RADL restrictions are the same as in
326- * <a href="http://www.grycap.upv.es/im/doc/xmlrpc.html#addresource-xmlrpc">
327- * RPC-XML AddResource</a><br>
328- * If success, it is returned a list of URIs of the new virtual machines. <br>
329- * This call will not wait the VMs to be created.
330- *
331- * @param infId
332- * : infrastructure id
333- * @param radlFile
334- * : file with the virtual machine properties and configuration
335- * @param bodyContentType
336- * : set the body content type. Can be RADL, RADL_JSON or TOSCA.
337- * @return : list of URIs of the new virtual machines
338- */
339- public InfrastructureUris addAsyncResource (String infId , String radlFile ,
340- BodyContentType bodyContentType ) throws ImClientException {
341- RestParameter asyncParameter =
342- createCallParameters (REST_PARAMETER_NAME_ASYNC , true );
343- return addResourcesWithParameters (infId , radlFile , bodyContentType ,
344- asyncParameter );
335+ radlFile , bodyContentType .getValue (), InfrastructureUris .class ,
336+ ctxParameter );
345337 }
346338
347339 /**
0 commit comments