Apache Mesos
validation.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a 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,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __COMMON_VALIDATION_HPP__
18 #define __COMMON_VALIDATION_HPP__
19 
20 #include <string>
21 
22 #include <mesos/mesos.hpp>
23 
24 #include <stout/error.hpp>
25 #include <stout/option.hpp>
26 
27 namespace mesos {
28 namespace internal {
29 namespace common {
30 namespace validation {
31 
32 // Validates if `id` meets the common requirements for IDs in Mesos.
33 // Note that some IDs in Mesos have additional/stricter requirements.
34 Option<Error> validateID(const std::string& id);
35 
36 Option<Error> validateTaskID(const TaskID& taskId);
37 
38 Option<Error> validateExecutorID(const ExecutorID& executorId);
39 
40 Option<Error> validateSlaveID(const SlaveID& slaveId);
41 
42 Option<Error> validateFrameworkID(const FrameworkID& frameworkId);
43 
44 Option<Error> validateSecret(const Secret& secret);
45 
47 
48 Option<Error> validateCommandInfo(const CommandInfo& command);
49 
50 Option<Error> validateVolume(const Volume& volume);
51 
52 Option<Error> validateContainerInfo(const ContainerInfo& containerInfo);
53 
55  const google::protobuf::RepeatedPtrField<Resource>& resources);
56 
57 } // namespace validation {
58 } // namespace common {
59 } // namespace internal {
60 } // namespace mesos {
61 
62 #endif // __COMMON_VALIDATION_HPP__
Option< Error > validateFrameworkID(const FrameworkID &frameworkId)
Option< Error > validateID(const std::string &id)
Option< Error > validateSecret(const Secret &secret)
Option< Error > validateEnvironment(const Environment &environment)
Option< Error > validateCommandInfo(const CommandInfo &command)
Option< Error > validateGpus(const google::protobuf::RepeatedPtrField< Resource > &resources)
Option< Error > validateSlaveID(const SlaveID &slaveId)
Environment * environment
Option< Error > validateVolume(const Volume &volume)
Definition: spec.hpp:30
Definition: attributes.hpp:24
Option< Error > validateExecutorID(const ExecutorID &executorId)
Option< Error > validateTaskID(const TaskID &taskId)
Option< Error > validateContainerInfo(const ContainerInfo &containerInfo)