本文整理汇总了Java中org.apache.mesos.Protos.Credential方法的典型用法代码示例。如果您正苦于以下问题:Java Protos.Credential方法的具体用法?Java Protos.Credential怎么用?Java Protos.Credential使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.mesos.Protos
的用法示例。
在下文中一共展示了Protos.Credential方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
protected void configure() {
Optional<Protos.Credential> credentials = getCredentials();
Optional<String> principal = Optional.absent();
if (FRAMEWORK_ANNOUNCE_PRINCIPAL.get() && credentials.isPresent()) {
principal = Optional.of(credentials.get().getPrincipal());
}
Optional<String> role =
MESOS_ROLE.hasAppliedValue() ? Optional.of(MESOS_ROLE.get()) : Optional.absent();
DriverSettings settings = new DriverSettings(
MESOS_MASTER_ADDRESS.get(),
credentials,
buildFrameworkInfo(
EXECUTOR_USER.get(),
principal,
FRAMEWORK_FAILOVER_TIMEOUT.get(),
RECEIVE_REVOCABLE_RESOURCES.get(),
role));
bind(DriverSettings.class).toInstance(settings);
}
示例2: getCredentials
import org.apache.mesos.Protos; //导入方法依赖的package包/类
private static Optional<Protos.Credential> getCredentials() {
if (FRAMEWORK_AUTHENTICATION_FILE.hasAppliedValue()) {
Properties properties;
try {
properties = parseCredentials(new FileInputStream(FRAMEWORK_AUTHENTICATION_FILE.get()));
} catch (FileNotFoundException e) {
LOG.error("Authentication File not Found");
throw Throwables.propagate(e);
}
LOG.info(
"Connecting to master using authentication (principal: {}).",
properties.get(PRINCIPAL_KEY));
return Optional.of(Protos.Credential.newBuilder()
.setPrincipal(properties.getProperty(PRINCIPAL_KEY))
.setSecret(properties.getProperty(SECRET_KEY))
.build());
} else {
return Optional.absent();
}
}
示例3: create
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public SchedulerDriver create(
Scheduler scheduler,
Optional<Protos.Credential> credentials,
FrameworkInfo frameworkInfo,
String master) {
if (credentials.isPresent()) {
return new MesosSchedulerDriver(
scheduler,
frameworkInfo,
master,
false, // Disable implicit acknowledgements.
credentials.get());
} else {
return new MesosSchedulerDriver(
scheduler,
frameworkInfo,
master,
false); // Disable implicit acknowledgements.
}
}
示例4: createMesosSchedulerDriver
import org.apache.mesos.Protos; //导入方法依赖的package包/类
static MesosSchedulerDriver createMesosSchedulerDriver(Scheduler scheduler, Launcher.Configuration conf, Protos.FrameworkInfo fw)
throws IOException {
Protos.Credential credential = null;
if (conf.fileConfig.hasSecretFile()) {
credential = Protos.Credential.newBuilder()
.setPrincipal(conf.fileConfig.getPrincipal())
.setSecretBytes(ByteString.readFrom(new FileInputStream(conf.fileConfig.getSecretFile())))
.build();
}
LOG.info("{} starting", MesosSchedulerDriver.class.getName());
if (credential != null) {
return new MesosSchedulerDriver(scheduler, fw, conf.getMesosMaster(), credential);
}
return new MesosSchedulerDriver(scheduler, fw, conf.getMesosMaster());
}
示例5: DriverSettings
import org.apache.mesos.Protos; //导入方法依赖的package包/类
public DriverSettings(
String masterUri,
Optional<Protos.Credential> credentials,
Protos.FrameworkInfo frameworkInfo) {
this.masterUri = requireNonNull(masterUri);
this.credentials = requireNonNull(credentials);
this.frameworkInfo = requireNonNull(frameworkInfo);
}
示例6: create
import org.apache.mesos.Protos; //导入方法依赖的package包/类
@Override
public SchedulerDriver create(
Scheduler scheduler,
Optional<Protos.Credential> credentials,
FrameworkInfo frameworkInfo,
String master) {
schedulerFuture.set(scheduler);
return this;
}
示例7: getCredentials
import org.apache.mesos.Protos; //导入方法依赖的package包/类
public Optional<Protos.Credential> getCredentials() {
return credentials;
}
示例8: create
import org.apache.mesos.Protos; //导入方法依赖的package包/类
SchedulerDriver create(
Scheduler scheduler,
Optional<Protos.Credential> credentials,
Protos.FrameworkInfo frameworkInfo,
String master);
示例9: evolve
import org.apache.mesos.Protos; //导入方法依赖的package包/类
public static org.apache.mesos.v1.Protos.Credential evolve(Protos.Credential credential) {
return transform(credential, org.apache.mesos.v1.Protos.Credential.newBuilder());
}