Search in sources :

Example 6 with RegionName

use of com.yahoo.config.provision.RegionName in project vespa by vespa-engine.

the class LbServicesProducerTest method testConfigAliasesWithRotations.

@Test
public void testConfigAliasesWithRotations() throws IOException, SAXException {
    Map<TenantName, Map<ApplicationId, ApplicationInfo>> testModel = createTestModel(new DeployState.Builder().rotations(rotations));
    RegionName regionName = RegionName.from("us-east-1");
    LbServicesConfig conf = getLbServicesConfig(new Zone(Environment.prod, regionName), testModel);
    final LbServicesConfig.Tenants.Applications.Hosts.Services services = conf.tenants("foo").applications("foo:prod:" + regionName.value() + ":default").hosts("foo.foo.yahoo.com").services("qrserver");
    assertThat(services.servicealiases().size(), is(1));
    assertThat(services.endpointaliases().size(), is(4));
    assertThat(services.servicealiases(0), is("service1"));
    assertThat(services.endpointaliases(0), is("foo1.bar1.com"));
    assertThat(services.endpointaliases(1), is("foo2.bar2.com"));
    assertThat(services.endpointaliases(2), is(rotation1));
    assertThat(services.endpointaliases(3), is(rotation2));
}
Also used : RegionName(com.yahoo.config.provision.RegionName) TenantName(com.yahoo.config.provision.TenantName) Zone(com.yahoo.config.provision.Zone) LbServicesConfig(com.yahoo.cloud.config.LbServicesConfig) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) Test(org.junit.Test)

Example 7 with RegionName

use of com.yahoo.config.provision.RegionName in project vespa by vespa-engine.

the class ZoneApiHandler method defaultRegion.

private HttpResponse defaultRegion(HttpRequest request, Environment environment) {
    RegionName region = zoneRegistry.getDefaultRegion(environment).orElseThrow(() -> new IllegalArgumentException("No default region for environment: " + environment));
    Slime slime = new Slime();
    Cursor root = slime.setObject();
    root.setString("name", region.value());
    root.setString("url", request.getUri().resolve("/zone/v2/environment/").resolve(environment.value() + "/").resolve("region/").resolve(region.value()).toString());
    return new SlimeJsonResponse(slime);
}
Also used : SlimeJsonResponse(com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse) RegionName(com.yahoo.config.provision.RegionName) Slime(com.yahoo.slime.Slime) Cursor(com.yahoo.slime.Cursor)

Aggregations

RegionName (com.yahoo.config.provision.RegionName)7 Environment (com.yahoo.config.provision.Environment)5 Zone (com.yahoo.config.provision.Zone)2 LbServicesConfig (com.yahoo.cloud.config.LbServicesConfig)1 SystemName (com.yahoo.config.provision.SystemName)1 TenantName (com.yahoo.config.provision.TenantName)1 Cursor (com.yahoo.slime.Cursor)1 Slime (com.yahoo.slime.Slime)1 SlimeJsonResponse (com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse)1 BufferedReader (java.io.BufferedReader)1 FileReader (java.io.FileReader)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Test (org.junit.Test)1 Element (org.w3c.dom.Element)1