use of com.yahoo.config.provision.TenantName in project vespa by vespa-engine.
the class SuperModelControllerTest method setupHandler.
@Before
public void setupHandler() throws IOException, SAXException {
Map<TenantName, Map<ApplicationId, ApplicationInfo>> models = new LinkedHashMap<>();
models.put(TenantName.from("a"), new LinkedHashMap<>());
File testApp = new File("src/test/resources/deploy/app");
ApplicationId app = ApplicationId.from(TenantName.from("a"), ApplicationName.from("foo"), InstanceName.defaultName());
models.get(app.tenant()).put(app, new ApplicationInfo(app, 4l, new VespaModel(FilesApplicationPackage.fromFile(testApp))));
SuperModel superModel = new SuperModel(models);
handler = new SuperModelController(new SuperModelConfigProvider(superModel, Zone.defaultZone()), new TestConfigDefinitionRepo(), 2, new UncompressedConfigResponseFactory());
}
use of com.yahoo.config.provision.TenantName in project vespa by vespa-engine.
the class HttpListConfigsRequest method createFromListRequestSimpleAppId.
private static HttpListConfigsRequest createFromListRequestSimpleAppId(HttpRequest req, BindingMatch<?> bm) {
TenantName tenant = TenantName.from(bm.group(2));
ApplicationName application = ApplicationName.from(bm.group(3));
return new HttpListConfigsRequest(null, new ApplicationId.Builder().tenant(tenant).applicationName(application).build(), req.getBooleanProperty(HttpConfigRequests.RECURSIVE_QUERY_PROPERTY), false);
}
use of com.yahoo.config.provision.TenantName 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);
}
use of com.yahoo.config.provision.TenantName in project vespa by vespa-engine.
the class ListApplicationsHandler method handleGET.
@Override
public HttpResponse handleGET(HttpRequest request) {
TenantName tenantName = Utils.getTenantNameFromApplicationsRequest(request);
final String urlBase = Utils.getUrlBase(request, "/application/v2/tenant/" + tenantName + "/application/");
List<ApplicationId> applicationIds = listApplicationIds(tenantName);
Collection<String> applicationUrls = Collections2.transform(applicationIds, new Function<ApplicationId, String>() {
@Override
public String apply(ApplicationId id) {
return createUrlStringFromId(urlBase, id, zone);
}
});
return new ListApplicationsResponse(Response.Status.OK, applicationUrls);
}
use of com.yahoo.config.provision.TenantName in project vespa by vespa-engine.
the class SessionActiveHandler method handlePUT.
@Override
protected HttpResponse handlePUT(HttpRequest request) {
final TenantName tenantName = Utils.getTenantNameFromSessionRequest(request);
Utils.checkThatTenantExists(tenants, tenantName);
Tenant tenant = tenants.getTenant(tenantName);
TimeoutBudget timeoutBudget = getTimeoutBudget(request, DEFAULT_ACTIVATE_TIMEOUT);
final Long sessionId = getSessionIdV2(request);
ApplicationId applicationId = applicationRepository.activate(tenant, sessionId, timeoutBudget, shouldIgnoreLockFailure(request), shouldIgnoreSessionStaleFailure(request));
ApplicationMetaData metaData = applicationRepository.getMetadataFromSession(tenant, sessionId);
return new SessionActiveResponse(metaData.getSlime(), request, applicationId, sessionId, zone);
}
Aggregations