Revision b0ddfd38 include/RequestManager.h

View differences:

include/RequestManager.h
312 312
        return oss.str();
313 313
    }
314 314

  
315

  
316
    // ----------------------------------------------------------------------
317
    // ----------------------------------------------------------------------
318
    //                          Constants
319
    // ----------------------------------------------------------------------
320
    // ----------------------------------------------------------------------
321

  
322
    // TODO: enum of Objects is maintained in AuthManager.h, could be moved
323
    // to Nebula.h
324
    enum Object
325
    {
326
        VM,
327
        HOST,
328
        NET,
329
        IMAGE,
330
        USER,
331
        CLUSTER,
332
        TEMPLATE,
333
        GROUP
334
    };
335

  
336
    PoolSQL * get_pool(Object ob)
337
    {
338
        switch (ob)
339
        {
340
            case VM:       return static_cast<PoolSQL*>(vmpool);
341
            case HOST:     return static_cast<PoolSQL*>(hpool);
342
            case NET:      return static_cast<PoolSQL*>(vnpool);
343
            case IMAGE:    return static_cast<PoolSQL*>(ipool);
344
            case USER:     return static_cast<PoolSQL*>(upool);
345
            case CLUSTER:  return static_cast<PoolSQL*>(cpool);
346
            case TEMPLATE: return static_cast<PoolSQL*>(tpool);
347
            case GROUP:    return static_cast<PoolSQL*>(gpool);
348
        }
349
    };
350

  
351
    string get_method_prefix(Object ob)
352
    {
353
        switch (ob)
354
        {
355
            case VM:       return "VirtualMachine";
356
            case HOST:     return "Host";
357
            case NET:      return "VirtualNetwork";
358
            case IMAGE:    return "Image";
359
            case USER:     return "User";
360
            case CLUSTER:  return "Cluster";
361
            case TEMPLATE: return "Template";
362
            case GROUP:    return "Group";
363
        }
364
    };
365

  
366
    string get_object_name(Object ob)
367
    {
368
        switch (ob)
369
        {
370
            case VM:       return "VM";
371
            case HOST:     return "HOST";
372
            case NET:      return "NET";
373
            case IMAGE:    return "IMAGE";
374
            case USER:     return "USER";
375
            case CLUSTER:  return "CLUSTER";
376
            case TEMPLATE: return "TEMPLATE";
377
            case GROUP:    return "GROUP";
378
        }
379
    };
380

  
315 381
    // ----------------------------------------------------------------------
316 382
    // ----------------------------------------------------------------------
317 383
    //                          XML-RPC Methods
......
319 385
    // ----------------------------------------------------------------------
320 386

  
321 387
    /* ---------------------------------------------------------------------- */
388
    /*                     Generic Helpers                                    */
389
    /* ---------------------------------------------------------------------- */
390

  
391
    class GenericChown: public xmlrpc_c::method
392
    {
393
    public:
394
        GenericChown(RequestManager  *  _rm,
395
                     Object             _ob):
396
                        rm(_rm),
397
                        ob(_ob)
398
        {
399
            _signature="A:siii";
400
            _help="Changes the owner and/or group";
401
        };
402

  
403
        ~GenericChown(){};
404

  
405
        void execute(
406
            xmlrpc_c::paramList const& paramList,
407
            xmlrpc_c::value *   const  retvalP);
408

  
409
    private:
410
        RequestManager *    rm;
411
        Object              ob;
412
    };
413

  
414
    /* ---------------------------------------------------------------------- */
322 415
    /*                     Virtual Machine Interface                          */
323 416
    /* ---------------------------------------------------------------------- */
324 417
    class VirtualMachineAllocate: public xmlrpc_c::method

Also available in: Unified diff