当前位置: 首页>>代码示例>>Java>>正文


Java Protos.Credential方法代码示例

本文整理汇总了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);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:21,代码来源:CommandLineDriverSettingsModule.java

示例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();
  }
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:23,代码来源:CommandLineDriverSettingsModule.java

示例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.
  }
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:22,代码来源:DriverFactoryImpl.java

示例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());
}
 
开发者ID:retz,项目名称:retz,代码行数:18,代码来源:SchedulerDriverFactory.java

示例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);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:10,代码来源:DriverSettings.java

示例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;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:11,代码来源:FakeMaster.java

示例7: getCredentials

import org.apache.mesos.Protos; //导入方法依赖的package包/类
public Optional<Protos.Credential> getCredentials() {
  return credentials;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:4,代码来源:DriverSettings.java

示例8: create

import org.apache.mesos.Protos; //导入方法依赖的package包/类
SchedulerDriver create(
Scheduler scheduler,
Optional<Protos.Credential> credentials,
Protos.FrameworkInfo frameworkInfo,
String master);
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:6,代码来源:DriverFactory.java

示例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());
}
 
开发者ID:mesosphere,项目名称:mesos-http-adapter,代码行数:4,代码来源:EvolverDevolver.java


注:本文中的org.apache.mesos.Protos.Credential方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。