Statistics
| Branch: | Tag: | Revision:

one / include / RequestManagerPoolInfoFilter.h @ 01d932ad

History | View | Annotate | Download (5.05 KB)

1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org)             */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

    
17
#ifndef REQUEST_MANAGER_POOL_INFO_FILTER_H_
18
#define REQUEST_MANAGER_POOL_INFO_FILTER_H_
19

    
20
#include "Request.h"
21
#include "Nebula.h"
22
#include "AuthManager.h"
23

    
24
using namespace std;
25

    
26
/* ------------------------------------------------------------------------- */
27
/* ------------------------------------------------------------------------- */
28
/* ------------------------------------------------------------------------- */
29

    
30
class RequestManagerPoolInfoFilter: public Request
31
{
32
protected:
33
    RequestManagerPoolInfoFilter(const string& method_name,
34
                                 const string& help)
35
        :Request(method_name,"A:si",help){};
36

    
37
    ~RequestManagerPoolInfoFilter(){};
38

    
39
    /* -------------------------------------------------------------------- */
40

    
41
    static const int ALL;        /**< Secify all objects in the pool (-2)   */
42
    static const int MINE;       /**< Secify user's objects in the pool (-3)*/
43
    static const int MINE_GROUP; /**< Secify users + group objects (-1)     */
44

    
45
    /* -------------------------------------------------------------------- */
46

    
47
    void request_execute(int uid, 
48
                         int gid,
49
                         xmlrpc_c::paramList const& _paramList);
50
    
51
    /* -------------------------------------------------------------------- */
52

    
53
    PoolSQL *           pool;
54
    AuthRequest::Object auth_object;
55
};
56

    
57
/* ------------------------------------------------------------------------- */
58
/* ------------------------------------------------------------------------- */
59

    
60
class VirtualMachinePoolInfo : public RequestManagerPoolInfoFilter
61
{
62
public:
63
    VirtualMachinePoolInfo():
64
        RequestManagerPoolInfoFilter("VirtualMachinePoolInfo",
65
                                     "Returns the virtual machine instances pool")
66
    {    
67
        Nebula& nd  = Nebula::instance();
68
        pool        = nd.get_vmpool();
69
        auth_object = AuthRequest::VM;
70
    };
71

    
72
    ~VirtualMachinePoolInfo(){};
73
};
74

    
75
/* ------------------------------------------------------------------------- */
76
/* ------------------------------------------------------------------------- */
77

    
78
class TemplatePoolInfo : public RequestManagerPoolInfoFilter
79
{
80
public:
81
    TemplatePoolInfo():
82
        RequestManagerPoolInfoFilter("TemplatePoolInfo",
83
                                     "Returns the virtual machine template pool")
84
    {    
85
        Nebula& nd  = Nebula::instance();
86
        pool        = nd.get_tpool();
87
        auth_object = AuthRequest::TEMPLATE;
88
    };
89

    
90
    ~TemplatePoolInfo(){};
91

    
92
private:
93
    VMTemplatePool * tpool;
94
    UserPool *       upool;
95
};
96

    
97
/* ------------------------------------------------------------------------- */
98
/* ------------------------------------------------------------------------- */
99

    
100

    
101
class VirtualNetworkPoolInfo: public RequestManagerPoolInfoFilter
102
{
103
public:
104
    VirtualNetworkPoolInfo():
105
        RequestManagerPoolInfoFilter("VirtualNetworkPoolInfo",
106
                                     "Returns the virtual network pool")
107
    {    
108
        Nebula& nd  = Nebula::instance();
109
        pool        = nd.get_vnpool();
110
        auth_object = AuthRequest::NET;
111
    };
112

    
113
    ~VirtualNetworkPoolInfo(){};
114
};
115

    
116
/* ------------------------------------------------------------------------- */
117
/* ------------------------------------------------------------------------- */
118

    
119
class ImagePoolInfo: public RequestManagerPoolInfoFilter
120
{
121
public:
122
    ImagePoolInfo():
123
        RequestManagerPoolInfoFilter("ImagePoolInfo",
124
                                     "Returns the image pool")
125
    {    
126
        Nebula& nd  = Nebula::instance();
127
        pool        = nd.get_ipool();
128
        auth_object = AuthRequest::IMAGE;
129
    };
130

    
131
    ~ImagePoolInfo(){};
132
};
133

    
134

    
135
/* -------------------------------------------------------------------------- */
136
/* -------------------------------------------------------------------------- */
137
/* -------------------------------------------------------------------------- */
138

    
139
#endif