gpt4 book ai didi

com.yahoo.config.provision.Zone.region()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 22:11:31 25 4
gpt4 key购买 nike

本文整理了Java中com.yahoo.config.provision.Zone.region()方法的一些代码示例,展示了Zone.region()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Zone.region()方法的具体详情如下:
包路径:com.yahoo.config.provision.Zone
类名称:Zone
方法名:region

Zone.region介绍

[英]Returns the current region
[中]返回当前区域

代码示例

代码示例来源:origin: com.yahoo.vespa/config-application-package

private void preprocessXML(File destination, File inputXml, Zone zone) throws ParserConfigurationException, TransformerException, SAXException, IOException {
  Document document = new XmlPreProcessor(appDir, inputXml, zone.environment(), zone.region()).run();
  Transformer transformer = TransformerFactory.newInstance().newTransformer();
  try (FileOutputStream outputStream = new FileOutputStream(destination)) {
    transformer.transform(new DOMSource(document), new StreamResult(outputStream));
  }
}

代码示例来源:origin: com.yahoo.vespa/config-model

private boolean zoneHasActiveRotation(Zone zone, DeploymentSpec spec) {
  return spec.zones().stream()
      .anyMatch(declaredZone -> declaredZone.deploysTo(zone.environment(), Optional.of(zone.region())) &&
                         declaredZone.active());
}

代码示例来源:origin: com.yahoo.vespa/config-model

private String getConfigserverIdentityName() {
    return String.format("%s.provider_%s_%s",
               zone.system() == SystemName.main ? "vespa.vespa" : "vespa.vespa.cd",
               zone.environment().value(),
               zone.region().value());
  }
}

代码示例来源:origin: com.yahoo.vespa/node-repository

@Override
public boolean isActive() {
  if(zone.system() == SystemName.cd) {
    return zone.environment() == Environment.dev || zone.environment() == Environment.prod;
  }
  if (zone.system() == SystemName.main) {
    if (zone.region().equals(RegionName.from("us-east-3"))) {
      return zone.environment() == Environment.perf || zone.environment() == Environment.prod;
    } else if (zone.region().equals(RegionName.from("us-west-1"))) {
      return zone.environment() == Environment.prod;
    } else if (zone.region().equals(RegionName.from("us-central-1"))) {
      return zone.environment() == Environment.prod;
    } else if (zone.region().equals(RegionName.from("ap-southeast-1"))) {
      return zone.environment() == Environment.prod;
    } else if (zone.region().equals(RegionName.from("ap-northeast-1"))) {
      return zone.environment() == Environment.prod;
    } else if (zone.region().equals(RegionName.from("ap-northeast-2"))) {
      return zone.environment() == Environment.prod;
    } else if (zone.region().equals(RegionName.from("eu-west-1"))) {
      return zone.environment() == Environment.prod;
    }
  }
  return false;
}

代码示例来源:origin: com.yahoo.vespa/config-model

private void addIdentityProvider(ContainerCluster cluster,
                 List<ConfigServerSpec> configServerSpecs,
                 HostName loadBalancerName,
                 URI ztsUrl,
                 String athenzDnsSuffix,
                 Zone zone,
                 DeploymentSpec spec) {
  spec.athenzDomain().ifPresent(domain -> {
    AthenzService service = spec.athenzService(zone.environment(), zone.region())
        .orElseThrow(() -> new RuntimeException("Missing Athenz service configuration"));
    String zoneDnsSuffix = zone.environment().value() + "-" + zone.region().value() + "." + athenzDnsSuffix;
    IdentityProvider identityProvider = new IdentityProvider(domain, service, getLoadBalancerName(loadBalancerName, configServerSpecs), ztsUrl, zoneDnsSuffix, zone);
    cluster.addComponent(identityProvider);
    cluster.getContainers().forEach(container -> {
      container.setProp("identity.domain", domain.value());
      container.setProp("identity.service", service.value());
    });
  });
}

代码示例来源:origin: com.yahoo.vespa/node-repository

private String getHostFromVespaCertificate(List<SubjectAlternativeName> sans) {
  // TODO Remove this branch once all BM nodes are gone
  if (sans.stream().anyMatch(san -> san.getValue().endsWith("ostk.yahoo.cloud"))) {
    return getHostFromCalypsoCertificate(sans);
  }
  VespaUniqueInstanceId instanceId = VespaUniqueInstanceId.fromDottedString(getUniqueInstanceId(sans));
  if (!zone.environment().value().equals(instanceId.environment()))
    throw new NodeIdentifierException("Invalid environment: " + instanceId.environment());
  if (!zone.region().value().equals(instanceId.region()))
    throw new NodeIdentifierException("Invalid region(): " + instanceId.region());
  List<Node> applicationNodes =
      nodeRepository.getNodes(ApplicationId.from(instanceId.tenant(), instanceId.application(), instanceId.instance()));
  return applicationNodes.stream()
      .filter(
          node -> node.allocation()
              .map(allocation -> allocation.membership().index() == instanceId.clusterIndex()
                  && allocation.membership().cluster().id().value().equals(instanceId.clusterId()))
              .orElse(false))
      .map(Node::hostname)
      .findFirst()
      .orElseThrow(() -> new NodeIdentifierException("Could not find any node with instance id: " + instanceId.asDottedString()));
}

代码示例来源:origin: com.yahoo.vespa/config-model

/**
 * Returns a config server config containing the right zone settings (and defaults for the rest).
 * This is useful to allow applications to find out in which zone they are runnung by having the Zone
 * object (which is constructed from this config) injected.
 */
@Override
public void getConfig(ConfigserverConfig.Builder builder) {
  builder.system(zone.system().name());
  builder.environment(zone.environment().value());
  builder.region(zone.region().value());
}

代码示例来源:origin: com.yahoo.vespa/config-model

private SentinelConfig.Application.Builder getApplicationConfig() {
  SentinelConfig.Application.Builder builder = new SentinelConfig.Application.Builder();
  builder.tenant(applicationId.tenant().value());
  builder.name(applicationId.application().value());
  builder.environment(zone.environment().value());
  builder.region(zone.region().value());
  builder.instance(applicationId.instance().value());
  return builder;
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com