Add --set-bucket and --delete-bucket to Cyad
[platform/core/security/cynara.git] / src / cyad / CommandsDispatcher.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain 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  * @file        src/cyad/CommandsDispatcher.h
18  * @author      Aleksander Zdyb <a.zdyb@samsung.com>
19  * @version     1.0
20  * @brief       CommandsDispatcher class
21  */
22
23 #ifndef SRC_CYAD_COMMANDSDISPATCHER_H_
24 #define SRC_CYAD_COMMANDSDISPATCHER_H_
25
26 #include <cyad/BaseAdminApiWrapper.h>
27 #include <cyad/CommandlineParser/CyadCommand.h>
28 #include <cyad/DispatcherIO.h>
29
30 struct cynara_admin;
31 struct cynara_admin_policy;
32
33 namespace Cynara {
34
35 class CommandsDispatcher {
36 public:
37     CommandsDispatcher(BaseDispatcherIO &io, BaseAdminApiWrapper &adminApiWrapper);
38     virtual ~CommandsDispatcher();
39
40     virtual int execute(CyadCommand &);
41     virtual int execute(HelpCyadCommand &);
42     virtual int execute(ErrorCyadCommand &);
43     virtual int execute(DeleteBucketCyadCommand &);
44     virtual int execute(SetBucketCyadCommand &);
45
46 private:
47     // TODO: Get argv[0] instead of hardcoded name
48     const std::string helpMessage = "Usage: cyad [OPTIONS]\n\n"
49                                     "Bucket set options (with -b or --set-bucket)\n"
50                                     "  -b, --set-bucket=<name>        name of bucket\n"
51                                     "  -p, --policy=<policy>          default policy\n"
52                                     "  -m, --metadata=<metadata>      metadata for default policy\n"
53                                     "\n"
54                                     "Bucket delete options (with -d or --delete-bucket)\n"
55                                     "  -d, --delete-bucket=<name>     name of bucket to delete\n"
56                                     "\n"
57                                     "Help options:\n"
58                                     "  -h, --help                     print help message";
59     BaseDispatcherIO &m_io;
60     BaseAdminApiWrapper &m_adminApiWrapper;
61     struct cynara_admin *m_cynaraAdmin;
62 };
63
64 } /* namespace Cynara */
65
66 #endif /* SRC_CYAD_COMMANDSDISPATCHER_H_ */