2018-11-20 17:24:59 +01:00
/* -------------------------------------------------------------------------- */
2020-04-30 15:00:02 +02:00
/* Copyright 2002-2020, OpenNebula Project, OpenNebula Systems */
2018-11-20 17:24:59 +01:00
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
# ifndef REQUEST_MANAGER_VN_TEMPLATE_H
# define REQUEST_MANAGER_VN_TEMPLATE_H
# include "Request.h"
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class RequestManagerVNTemplate : public Request
{
protected :
2020-07-02 22:42:10 +02:00
RequestManagerVNTemplate ( const std : : string & method_name ,
const std : : string & help ,
const std : : string & params ) ;
2018-11-20 17:24:59 +01:00
2019-12-10 11:45:15 +01:00
~ RequestManagerVNTemplate ( ) = default ;
2018-11-20 17:24:59 +01:00
virtual void request_execute ( xmlrpc_c : : paramList const & _paramList ,
RequestAttributes & att ) = 0 ;
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VNTemplateInstantiate : public RequestManagerVNTemplate
{
public :
VNTemplateInstantiate ( ) :
RequestManagerVNTemplate ( " one.vntemplate.instantiate " , " Instantiates a new "
" virtual network using a template " , " A:siss " )
{
auth_op = AuthRequest : : USE ;
} ;
2019-12-10 11:45:15 +01:00
~ VNTemplateInstantiate ( ) = default ;
2018-11-20 17:24:59 +01:00
/**
* Instantiates the VN Template , checking permissions , quotas , etc
* @ param id VN Template ID
* @ param name Name for the new VN . Can be empty
* @ param s_uattr Template supplied by user to merge with the original
* contents . Can be empty
* @ param extra_attrs Template to be merged . It should contain internal
* configuration , and it won ' t be authenticated or checked for restricted
* attributes . Can be 0
* @ param vnid on success of the new VN
* @ param att the specific request attributes
*
* @ return ErroCode for the request .
*/
2020-07-02 22:42:10 +02:00
ErrorCode request_execute ( int id , std : : string name ,
const std : : string & s_uattr , Template * extra_attrs , int & vid ,
2018-11-20 17:24:59 +01:00
RequestAttributes & att ) ;
2019-09-09 13:13:52 +02:00
/**
2018-11-20 17:24:59 +01:00
* Parse & merge user attributes ( check if the request user is not oneadmin )
* @ param tmpl to merge the attributes to
* @ param s_uattr Template supplied by user to merge with the original
* contents . Can be empty
* @ param att the specific request attributes
*/
2020-07-02 22:42:10 +02:00
ErrorCode merge ( Template * tmpl , const std : : string & s_uattr ,
RequestAttributes & att ) ;
2018-11-20 17:24:59 +01:00
protected :
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 17:23:21 +02:00
RequestAttributes & att ) override ;
2018-11-20 17:24:59 +01:00
} ;
# endif