MCPcopy Create free account
hub / github.com/apache/mesos / validateSecret

Function validateSecret

src/common/validation.cpp:107–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105
106
107Option<Error> validateSecret(const Secret& secret)
108{
109 switch (secret.type()) {
110 case Secret::REFERENCE:
111 if (!secret.has_reference()) {
112 return Error(
113 "Secret of type REFERENCE must have the 'reference' field set");
114 }
115
116 if (secret.has_value()) {
117 return Error(
118 "Secret '" + secret.reference().name() + "' of type REFERENCE "
119 "must not have the 'value' field set");
120 }
121 break;
122
123 case Secret::VALUE:
124 if (!secret.has_value()) {
125 return Error("Secret of type VALUE must have the 'value' field set");
126 }
127
128 if (secret.has_reference()) {
129 return Error(
130 "Secret of type VALUE must not have the 'reference' field set");
131 }
132 break;
133
134 case Secret::UNKNOWN:
135 break;
136
137 UNREACHABLE();
138 }
139
140 return None();
141}
142
143
144Option<Error> validateEnvironment(const Environment& environment)

Callers 8

generateAuthTokenMethod · 0.85
TEST_FFunction · 0.85
TESTFunction · 0.85
startMethod · 0.85
generateSecretMethod · 0.85
foreachFunction · 0.85
foreachFunction · 0.85
foreachFunction · 0.85

Calls 5

NoneClass · 0.85
typeMethod · 0.80
referenceMethod · 0.80
ErrorFunction · 0.50
nameMethod · 0.45

Tested by 2

TEST_FFunction · 0.68
TESTFunction · 0.68