use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class ApplicationHandler method createFromRequestSimpleAppId.
// The URL pattern with only tenant and application given
private static ApplicationId createFromRequestSimpleAppId(BindingMatch<?> bm) {
TenantName tenant = TenantName.from(bm.group(2));
ApplicationName application = ApplicationName.from(bm.group(3));
return new ApplicationId.Builder().tenant(tenant).applicationName(application).build();
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class ApplicationHandler method handleGET.
@Override
public HttpResponse handleGET(HttpRequest request) {
ApplicationId applicationId = getApplicationIdFromRequest(request);
Tenant tenant = verifyTenantAndApplication(applicationId);
if (isServiceConvergeRequest(request)) {
return applicationRepository.serviceConvergenceCheck(tenant, applicationId, getHostNameFromRequest(request), request.getUri());
}
if (isClusterControllerStatusRequest(request)) {
String hostName = getHostNameFromRequest(request);
String pathSuffix = getPathSuffix(request);
return applicationRepository.clusterControllerStatusPage(tenant, applicationId, hostName, pathSuffix);
}
if (isContentRequest(request)) {
long sessionId = applicationRepository.getSessionIdForApplication(tenant, applicationId);
String contentPath = ApplicationContentRequest.getContentPath(request);
ApplicationFile applicationFile = applicationRepository.getApplicationFileFromSession(tenant.getName(), sessionId, contentPath, ContentRequest.getApplicationFileMode(request.getMethod()));
ApplicationContentRequest contentRequest = new ApplicationContentRequest(request, sessionId, applicationId, zone, contentPath, applicationFile);
return new ContentHandler().get(contentRequest);
}
if (isServiceConvergeListRequest(request)) {
return applicationRepository.serviceListToCheckForConfigConvergence(tenant, applicationId, request.getUri());
}
if (isFiledistributionStatusRequest(request)) {
Duration timeout = HttpHandler.getRequestTimeout(request, Duration.ofSeconds(5));
return applicationRepository.filedistributionStatus(tenant, applicationId, timeout);
}
return new GetApplicationResponse(Response.Status.OK, applicationRepository.getApplicationGeneration(tenant, applicationId));
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class HttpListConfigsHandler method handleGET.
@Override
public HttpResponse handleGET(HttpRequest req) {
HttpListConfigsRequest listReq = HttpListConfigsRequest.createFromListRequest(req);
RequestHandler requestHandler = HttpConfigRequests.getRequestHandler(tenants, listReq);
ApplicationId appId = listReq.getApplicationId();
Set<ConfigKey<?>> configs = requestHandler.listConfigs(appId, Optional.empty(), listReq.isRecursive());
String urlBase = getUrlBase(req, listReq, appId, zone);
Set<ConfigKey<?>> allConfigs = requestHandler.allConfigsProduced(appId, Optional.empty());
return new ListConfigsResponse(configs, allConfigs, urlBase, listReq.isRecursive());
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class HttpListConfigsRequest method createFromListRequestFullAppId.
private static HttpListConfigsRequest createFromListRequestFullAppId(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);
ApplicationId appId = new ApplicationId.Builder().tenant(tenant).applicationName(application).instanceName(instance).build();
return new HttpListConfigsRequest(null, appId, req.getBooleanProperty(HttpConfigRequests.RECURSIVE_QUERY_PROPERTY), true);
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class SessionCreateHandler method handlePOST.
@Override
protected HttpResponse handlePOST(HttpRequest request) {
Slime deployLog = createDeployLog();
final TenantName tenantName = Utils.getTenantNameFromSessionRequest(request);
Utils.checkThatTenantExists(tenants, tenantName);
Tenant tenant = tenants.getTenant(tenantName);
TimeoutBudget timeoutBudget = SessionHandler.getTimeoutBudget(request, zookeeperBarrierTimeout);
DeployLogger logger = createLogger(request, deployLog, tenantName);
long sessionId;
if (request.hasProperty("from")) {
ApplicationId applicationId = getFromApplicationId(request);
sessionId = applicationRepository.createSessionFromExisting(tenant, logger, timeoutBudget, applicationId);
} else {
validateDataAndHeader(request);
String name = getNameProperty(request, logger);
sessionId = applicationRepository.createSession(tenant, timeoutBudget, request.getData(), request.getHeader(ApplicationApiHandler.contentTypeHeader), name);
}
return createResponse(request, tenantName, deployLog, sessionId);
}
Aggregations