Search in sources :

Example 11 with ApplicationId

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();
}
Also used : ApplicationName(com.yahoo.config.provision.ApplicationName) TenantName(com.yahoo.config.provision.TenantName) ApplicationId(com.yahoo.config.provision.ApplicationId)

Example 12 with ApplicationId

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));
}
Also used : Tenant(com.yahoo.vespa.config.server.tenant.Tenant) ApplicationFile(com.yahoo.config.application.api.ApplicationFile) Duration(java.time.Duration) ApplicationId(com.yahoo.config.provision.ApplicationId) ContentHandler(com.yahoo.vespa.config.server.http.ContentHandler)

Example 13 with 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());
}
Also used : ConfigKey(com.yahoo.vespa.config.ConfigKey) RequestHandler(com.yahoo.vespa.config.server.RequestHandler) ApplicationId(com.yahoo.config.provision.ApplicationId)

Example 14 with ApplicationId

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);
}
Also used : ApplicationId(com.yahoo.config.provision.ApplicationId)

Example 15 with ApplicationId

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);
}
Also used : Tenant(com.yahoo.vespa.config.server.tenant.Tenant) TenantName(com.yahoo.config.provision.TenantName) TimeoutBudget(com.yahoo.vespa.config.server.TimeoutBudget) DeployLogger(com.yahoo.config.application.api.DeployLogger) Slime(com.yahoo.slime.Slime) ApplicationId(com.yahoo.config.provision.ApplicationId)

Aggregations

ApplicationId (com.yahoo.config.provision.ApplicationId)173 Test (org.junit.Test)102 Zone (com.yahoo.config.provision.Zone)52 Node (com.yahoo.vespa.hosted.provision.Node)30 ClusterSpec (com.yahoo.config.provision.ClusterSpec)22 TenantName (com.yahoo.config.provision.TenantName)20 Flavor (com.yahoo.config.provision.Flavor)19 List (java.util.List)16 HashSet (java.util.HashSet)15 HostSpec (com.yahoo.config.provision.HostSpec)12 Duration (java.time.Duration)12 HashMap (java.util.HashMap)12 Map (java.util.Map)12 Set (java.util.Set)12 Collectors (java.util.stream.Collectors)12 Version (com.yahoo.component.Version)11 OutOfCapacityException (com.yahoo.config.provision.OutOfCapacityException)11 Slime (com.yahoo.slime.Slime)11 ArrayList (java.util.ArrayList)11 Optional (java.util.Optional)11