Search in sources :

Example 16 with ConfigKey

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

the class UpstreamConfigSubscriber method subscribe.

void subscribe() {
    subscriber = new GenericConfigSubscriber(requesterPool);
    ConfigKey<?> key = config.getKey();
    handle = subscriber.subscribe(new ConfigKey<RawConfig>(key.getName(), key.getConfigId(), key.getNamespace()), config.getDefContent(), configSourceSet, timingValues);
}
Also used : ConfigKey(com.yahoo.vespa.config.ConfigKey) GenericConfigSubscriber(com.yahoo.config.subscription.impl.GenericConfigSubscriber)

Example 17 with ConfigKey

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

the class SuperModelControllerTest method test_unknown_config_definition.

@Test(expected = UnknownConfigDefinitionException.class)
public void test_unknown_config_definition() {
    String md5 = "asdfasf";
    Request request = JRTClientConfigRequestV3.createWithParams(new ConfigKey<>("foo", "id", "bar", md5, null), DefContent.fromList(Collections.emptyList()), "fromHost", md5, 1, 1, Trace.createDummy(), CompressionType.UNCOMPRESSED, Optional.empty()).getRequest();
    JRTServerConfigRequestV3 v3Request = JRTServerConfigRequestV3.createFromRequest(request);
    handler.resolveConfig(v3Request);
}
Also used : ConfigKey(com.yahoo.vespa.config.ConfigKey) Request(com.yahoo.jrt.Request) JRTServerConfigRequestV3(com.yahoo.vespa.config.protocol.JRTServerConfigRequestV3) Test(org.junit.Test)

Example 18 with ConfigKey

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

the class HttpListConfigsRequest method createFromNamedListRequestSimpleAppId.

private static HttpListConfigsRequest createFromNamedListRequestSimpleAppId(HttpRequest req, BindingMatch<?> bm) {
    TenantName tenant = TenantName.from(bm.group(2));
    ApplicationName application = ApplicationName.from(bm.group(3));
    String conf = bm.group(4);
    String cId;
    String cName;
    String cNamespace;
    if (bm.groupCount() >= 6) {
        cId = bm.group(5);
    } else {
        cId = "";
    }
    Tuple2<String, String> nns = HttpConfigRequest.nameAndNamespace(conf);
    cName = nns.first;
    cNamespace = nns.second;
    ConfigKey<?> key = new ConfigKey<>(cName, cId, cNamespace);
    return new HttpListConfigsRequest(key, new ApplicationId.Builder().tenant(tenant).applicationName(application).build(), req.getBooleanProperty(HttpConfigRequests.RECURSIVE_QUERY_PROPERTY), false);
}
Also used : ApplicationName(com.yahoo.config.provision.ApplicationName) ConfigKey(com.yahoo.vespa.config.ConfigKey) TenantName(com.yahoo.config.provision.TenantName)

Example 19 with ConfigKey

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

the class HttpListConfigsRequest method createFromNamedListRequestFullAppId.

private static HttpListConfigsRequest createFromNamedListRequestFullAppId(HttpRequest req, BindingMatch<?> bm) {
    String tenant = bm.group(2);
    String application = bm.group(3);
    String environment = bm.group(4);
    String region = bm.group(5);
    String instance = bm.group(6);
    String conf = bm.group(7);
    String cId;
    String cName;
    String cNamespace;
    if (bm.groupCount() >= 9) {
        cId = bm.group(8);
    } else {
        cId = "";
    }
    Tuple2<String, String> nns = HttpConfigRequest.nameAndNamespace(conf);
    cName = nns.first;
    cNamespace = nns.second;
    ConfigKey<?> key = new ConfigKey<>(cName, cId, cNamespace);
    ApplicationId appId = new ApplicationId.Builder().tenant(tenant).applicationName(application).instanceName(instance).build();
    return new HttpListConfigsRequest(key, appId, req.getBooleanProperty(HttpConfigRequests.RECURSIVE_QUERY_PROPERTY), true);
}
Also used : ConfigKey(com.yahoo.vespa.config.ConfigKey) ApplicationId(com.yahoo.config.provision.ApplicationId)

Example 20 with ConfigKey

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

the class HttpListNamedConfigsHandler method handleGET.

@Override
public HttpResponse handleGET(HttpRequest req) {
    HttpListConfigsRequest listReq = HttpListConfigsRequest.createFromNamedListRequest(req);
    RequestHandler requestHandler = HttpConfigRequests.getRequestHandler(tenants, listReq);
    ApplicationId appId = listReq.getApplicationId();
    HttpConfigRequest.validateRequestKey(listReq.getKey(), requestHandler, appId);
    Set<ConfigKey<?>> configs = requestHandler.listNamedConfigs(appId, Optional.empty(), listReq.getKey(), listReq.isRecursive());
    String urlBase = HttpListConfigsHandler.getUrlBase(req, listReq, appId, zone);
    Set<ConfigKey<?>> allConfigs = requestHandler.allConfigsProduced(appId, Optional.empty());
    return new HttpListConfigsHandler.ListConfigsResponse(configs, allConfigs, urlBase, listReq.isRecursive());
}
Also used : ConfigKey(com.yahoo.vespa.config.ConfigKey) RequestHandler(com.yahoo.vespa.config.server.RequestHandler) ApplicationId(com.yahoo.config.provision.ApplicationId)

Aggregations

ConfigKey (com.yahoo.vespa.config.ConfigKey)23 Test (org.junit.Test)9 ApplicationId (com.yahoo.config.provision.ApplicationId)4 MockRequestHandler (com.yahoo.vespa.config.server.rpc.MockRequestHandler)4 Before (org.junit.Before)4 ConfigInstance (com.yahoo.config.ConfigInstance)3 ComponentId (com.yahoo.component.ComponentId)2 Version (com.yahoo.component.Version)2 ComponentClass (com.yahoo.component.provider.ComponentClass)2 TenantName (com.yahoo.config.provision.TenantName)2 HttpResponse (com.yahoo.container.jdisc.HttpResponse)2 RequestHandler (com.yahoo.vespa.config.server.RequestHandler)2 HandlerTest (com.yahoo.vespa.config.server.http.HandlerTest)2 SessionHandlerTest (com.yahoo.vespa.config.server.http.SessionHandlerTest)2 Tenants (com.yahoo.vespa.config.server.tenant.Tenants)2 File (java.io.File)2 LbServicesConfig (com.yahoo.cloud.config.LbServicesConfig)1 RoutingConfig (com.yahoo.cloud.config.RoutingConfig)1 ConfigurationRuntimeException (com.yahoo.config.ConfigurationRuntimeException)1 IntConfig (com.yahoo.config.core.IntConfig)1