Statistics
| Branch: | Tag: | Revision:

one / include / RequestManagerPoolInfo.h @ 01d932ad

History | View | Annotate | Download (4.5 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_H_
18
#define REQUEST_MANAGER_POOL_INFO_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 RequestManagerPoolInfo: public Request
31
{
32
protected:
33
    RequestManagerPoolInfo(const string& method_name,
34
                           const string& help)
35
        :Request(method_name,"A:s",help){};
36

    
37
    ~RequestManagerPoolInfo(){};
38

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

    
41
    void request_execute(int uid, 
42
                         int gid,
43
                         xmlrpc_c::paramList const& _paramList);
44
    
45
    /* -------------------------------------------------------------------- */
46

    
47
    PoolSQL *           pool;
48
    AuthRequest::Object auth_object;
49
};
50

    
51
/* ------------------------------------------------------------------------- */
52
/* ------------------------------------------------------------------------- */
53

    
54
class HostPoolInfo : public RequestManagerPoolInfo
55
{
56
public:
57
    HostPoolInfo():
58
        RequestManagerPoolInfo("HostPoolInfo",
59
                               "Returns the host pool")
60
    {    
61
        Nebula& nd  = Nebula::instance();
62
        pool        = nd.get_hpool();
63
        auth_object = AuthRequest::HOST;
64
    };
65

    
66
    ~HostPoolInfo(){};
67
};
68

    
69
/* ------------------------------------------------------------------------- */
70
/* ------------------------------------------------------------------------- */
71

    
72
class ClusterPoolInfo : public RequestManagerPoolInfo
73
{
74
public:
75
    ClusterPoolInfo():
76
        RequestManagerPoolInfo("ClusterPoolInfo",
77
                               "Returns the cluster pool")
78
    {    
79
        Nebula& nd = Nebula::instance();
80
        pool       = nd.get_cpool();
81
        auth_object = AuthRequest::CLUSTER;
82
    };
83

    
84
    ~ClusterPoolInfo(){};
85

    
86
private:
87
    VMTemplatePool * tpool;
88
    UserPool *       upool;
89
};
90

    
91
/* ------------------------------------------------------------------------- */
92
/* ------------------------------------------------------------------------- */
93

    
94

    
95
class GroupPoolInfo: public RequestManagerPoolInfo
96
{
97
public:
98
    GroupPoolInfo():
99
        RequestManagerPoolInfo("GroupPoolInfo",
100
                               "Returns the group pool")
101
    {    
102
        Nebula& nd = Nebula::instance();
103
        pool       = nd.get_gpool();
104
        auth_object = AuthRequest::GROUP;
105
    };
106

    
107
    ~GroupPoolInfo(){};
108
};
109

    
110
/* ------------------------------------------------------------------------- */
111
/* ------------------------------------------------------------------------- */
112

    
113
class UserPoolInfo: public RequestManagerPoolInfo
114
{
115
public:
116
    UserPoolInfo():
117
        RequestManagerPoolInfo("UserPoolInfo",
118
                               "Returns the user pool")
119
    {    
120
        Nebula& nd  = Nebula::instance();
121
        pool        = nd.get_upool();
122
        auth_object = AuthRequest::USER;
123
    };
124

    
125
    ~UserPoolInfo(){};
126
};
127

    
128

    
129
/* -------------------------------------------------------------------------- */
130
/* -------------------------------------------------------------------------- */
131
/* -------------------------------------------------------------------------- */
132

    
133
#endif