All Classes Namespaces Files Functions Variables Pages
dxapp.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2016 DNAnexus, Inc.
2 //
3 // This file is part of dx-toolkit (DNAnexus platform client libraries).
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License"); you may
6 // not use this file except in compliance with the License. You may obtain a
7 // copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 // License for the specific language governing permissions and limitations
15 // under the License.
16 
22 
38 
39 #ifndef DXCPP_BINDINGS_DXAPP_H
40 #define DXCPP_BINDINGS_DXAPP_H
41 
42 #include "../bindings.h"
43 
44 namespace dx {
45  class DXApp {
46  private:
47  std::string dxid_;
48  std::string name_;
49  std::string alias_;
50 
51  public:
52  // App-specific functions
53  DXApp() { }
54 
64  DXApp(const std::string &nameOrID,
65  const std::string &alias="default") {
66  setID(nameOrID, alias);
67  }
68 
78  void setID(const std::string &nameOrID, const std::string &alias="default") {
79  if (nameOrID.find("app-") == 0) {
80  dxid_ = nameOrID;
81  name_ = "";
82  alias_ = "";
83  } else {
84  dxid_ = "";
85  name_ = nameOrID;
86  alias_ = alias;
87  }
88  }
89 
97  dx::JSON describe() const;
98 
104  void update(const dx::JSON &to_update) const;
105 
116  void addCategories(const dx::JSON &categories) const;
117 
128  void removeCategories(const dx::JSON &categories) const;
129 
140  void addTags(const dx::JSON &tags) const;
141 
152  void removeTags(const dx::JSON &tags) const;
153 
161  void install() const;
162 
171  void uninstall() const;
172 
180  dx::JSON get() const;
181 
192  void publish(bool makeDefault=false) const;
193 
202  void remove() const;
203 
222  DXJob run(const dx::JSON &app_input,
223  const std::string &output_folder="/",
224  const std::vector<std::string> &depends_on=std::vector<std::string>(),
225  const dx::JSON &instance_type=dx::JSON(dx::JSON_NULL),
226  const std::string &project_context=config::CURRENT_PROJECT()
227  ) const;
228  };
229 }
230 #endif
dx::JSON describe() const
Definition: dxapp.cc:23
DXApp(const std::string &nameOrID, const std::string &alias="default")
Definition: dxapp.h:64
Definition: dxapp.h:45
void update(const dx::JSON &to_update) const
Definition: dxapp.cc:33
void addTags(const dx::JSON &tags) const
Definition: dxapp.cc:68
void install() const
Definition: dxapp.cc:92
void addCategories(const dx::JSON &categories) const
Definition: dxapp.cc:43
void setID(const std::string &nameOrID, const std::string &alias="default")
Definition: dxapp.h:78
DXJob run(const dx::JSON &app_input, const std::string &output_folder="/", const std::vector< std::string > &depends_on=std::vector< std::string >(), const dx::JSON &instance_type=dx::JSON(dx::JSON_NULL), const std::string &project_context=config::CURRENT_PROJECT()) const
Definition: dxapp.cc:143
void publish(bool makeDefault=false) const
Definition: dxapp.cc:122
void removeTags(const dx::JSON &tags) const
Definition: dxapp.cc:80
void removeCategories(const dx::JSON &categories) const
Definition: dxapp.cc:55
The instantiation of an applet or app.
Definition: dxjob.h:41
void uninstall() const
Definition: dxapp.cc:102