2010-05-20 20:58:17 +04:00
/* -------------------------------------------------------------------------- */
2024-07-29 15:25:20 +03:00
/* Copyright 2002-2024, OpenNebula Project, OpenNebula Systems */
2010-05-20 20:58:17 +04: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 IMAGE_TEMPLATE_H_
# define IMAGE_TEMPLATE_H_
2010-08-03 18:22:48 +04:00
# include "Template.h"
2010-05-20 20:58:17 +04:00
/**
2011-10-11 02:20:50 +04:00
* Image Template class , it represents the attributes of an Image
2010-05-20 20:58:17 +04:00
*/
2010-08-03 18:22:48 +04:00
class ImageTemplate : public Template
2010-05-20 20:58:17 +04:00
{
public :
2024-06-03 12:40:24 +03:00
ImageTemplate ( ) : Template ( true , ' = ' , " TEMPLATE " ) { } ;
2010-05-20 20:58:17 +04:00
2024-06-03 12:40:24 +03:00
ImageTemplate ( const Template & tmpl ) : Template ( tmpl ) { } ;
2012-05-25 14:56:51 +04:00
2024-06-03 12:40:24 +03:00
~ ImageTemplate ( ) { } ;
2012-01-20 20:45:14 +04:00
2015-06-10 20:56:35 +03:00
bool is_saving ( )
2013-03-01 22:04:56 +04:00
{
2015-06-10 00:25:10 +03:00
bool save_as_hot ;
2012-03-06 02:49:18 +04:00
2015-06-10 00:25:10 +03:00
get ( " SAVE_AS_HOT " , save_as_hot ) ;
2012-03-06 02:49:18 +04:00
2015-06-10 00:25:10 +03:00
return save_as_hot ;
2012-03-06 02:49:18 +04:00
}
2015-06-10 20:56:35 +03:00
void set_saving ( )
2013-03-01 22:04:56 +04:00
{
2015-06-10 00:25:10 +03:00
replace ( " SAVE_AS_HOT " , " YES " ) ;
2012-03-06 02:49:18 +04:00
}
2022-01-18 14:00:17 +03:00
void clear_saving ( )
{
erase ( " SAVE_AS_HOT " ) ;
}
2017-09-04 02:14:47 +03:00
// -------------------------------------------------------------------------
// Restricted attributes interface implementation
// -------------------------------------------------------------------------
2023-09-18 17:17:59 +03:00
bool check_restricted ( std : : string & rs_attr , const Template * base , bool append ) override
2017-09-04 02:14:47 +03:00
{
2023-09-18 17:17:59 +03:00
return Template : : check_restricted ( rs_attr , base , restricted , append ) ;
2017-09-04 02:14:47 +03:00
}
2012-01-23 20:18:12 +04:00
2023-02-07 10:50:30 +03:00
bool check_restricted ( std : : string & rs_attr ) override
2017-09-04 02:14:47 +03:00
{
return Template : : check_restricted ( rs_attr , restricted ) ;
}
2012-01-23 20:18:12 +04:00
2023-02-07 10:50:30 +03:00
static void parse_restricted ( const std : : vector < const SingleAttribute * > & ra )
2014-10-06 18:57:40 +04:00
{
2017-09-04 02:14:47 +03:00
Template : : parse_restricted ( ra , restricted ) ;
}
2014-10-06 18:57:40 +04:00
2021-02-17 15:56:37 +03:00
// -------------------------------------------------------------------------
// Encrypted attributes interface implementation
// -------------------------------------------------------------------------
2023-02-07 10:50:30 +03:00
void encrypt ( const std : : string & one_key ) override
2021-02-17 15:56:37 +03:00
{
Template : : encrypt ( one_key , encrypted ) ;
}
2023-02-07 10:50:30 +03:00
void decrypt ( const std : : string & one_key ) override
2021-02-17 15:56:37 +03:00
{
Template : : decrypt ( one_key , encrypted ) ;
}
2023-02-07 10:50:30 +03:00
static void parse_encrypted ( const std : : vector < const SingleAttribute * > & ea )
2021-02-17 15:56:37 +03:00
{
Template : : parse_encrypted ( ea , encrypted ) ;
}
2017-09-04 02:14:47 +03:00
private :
2012-01-24 15:00:57 +04:00
/**
2017-09-04 02:14:47 +03:00
* Restricted attribute list for ImageTemplates
2012-01-24 15:00:57 +04:00
*/
2017-09-04 02:14:47 +03:00
static std : : map < std : : string , std : : set < std : : string > > restricted ;
2021-02-17 15:56:37 +03:00
/**
* Encrypted attribute list for ImageTemplates
*/
static std : : map < std : : string , std : : set < std : : string > > encrypted ;
2010-05-20 20:58:17 +04:00
} ;
2013-03-08 01:44:18 +04:00
2010-05-20 20:58:17 +04:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
# endif /*IMAGE_TEMPLATE_H_*/