Apache Mesos
resolver.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 __MESOS_SECRET_RESOLVER_HPP__
18 #define __MESOS_SECRET_RESOLVER_HPP__
19 
20 #include <mesos/mesos.hpp>
21 
22 #include <process/future.hpp>
23 
24 namespace mesos {
25 
26 // This interface is used to resolve a `Secret` type into data bytes.
27 //
28 // The `resolve()` method takes a `Secret` object, potentially communicates
29 // with a secret-store backend, and returns `Future<Secret::Value>`. If the
30 // secret cannot be resolved (e.g., secret is invalid), the future fails.
31 //
32 // NOTE: The `create()` call should return a dynamically allocated object
33 // whose lifecycle is then delegated to the master/agent.
35 {
36 public:
37  // Factory method used to create a SecretResolver instance. If the
38  // `name` parameter is provided, the module is instantiated
39  // using the `ModuleManager`. Otherwise, a "default" secret resolver
40  // instance (defined in `src/secret/resolver.cpp`) is returned.
42 
43  virtual ~SecretResolver() {}
44 
45  // Validates the given secret, resolves the secret reference (by potentially
46  // querying a secret backend store), and returns the data associated with
47  // the secret.
49  const Secret& secret) const = 0;
50 
51 protected:
53 };
54 
55 } // namespace mesos {
56 
57 #endif // __MESOS_SECRET_RESOLVER_HPP__
Definition: check.hpp:33
virtual process::Future< Secret::Value > resolve(const Secret &secret) const =0
static Try< SecretResolver * > create(const Option< std::string > &name=None())
Definition: agent.hpp:25
virtual ~SecretResolver()
Definition: resolver.hpp:43
Definition: none.hpp:27
SecretResolver()
Definition: resolver.hpp:52
Definition: resolver.hpp:34
constexpr const char * name
Definition: shell.hpp:41
Definition: future.hpp:58