APISonar


io.cattle.platform.server.context.ServerContext.BaseProtocol.HTTP

> io > cattle > platform > server > context > ServerContext > BaseProtocol > HTTP
io APIs cattle APIs platform APIs server APIs context APIs ServerContext APIs BaseProtocol APIs HTTP APIs

Example 1
protected String getUrl(ApiRequest request) {
        String url = URL.get();

        if (!StringUtils.isBlank(url)) {
            return url;
        }

        if (ServerContext.isCustomApiHost()) {
            return ServerContext.getHostApiBaseUrl(BaseProtocol.HTTP);
        }

        return request.getUrlBuilder().version(request.getVersion()).toExternalForm();
    }
Example 2
protected void setEnvironment(Map<String, String> env) {
        Credential cred = getCredential();
        env.put("CATTLE_ACCESS_KEY", cred.getPublicValue());
        env.put("CATTLE_SECRET_KEY", cred.getSecretValue());
        env.put("CATTLE_URL", ServerContext.getHostApiBaseUrl(BaseProtocol.HTTP));
    }
Example 3
protected ConfigUpdate getEvent(ConfigUpdateRequest request, List<ConfigUpdateItem> items) {
        Client client = request.getClient();
        String url = ServerContext.getHostApiBaseUrl(BaseProtocol.HTTP);

        if (items.size() == 0) {
            return new ConfigUpdate(client.getEventName(), url, Collections.<ConfigUpdateItem> emptyList());
        }

        ConfigUpdate event = new ConfigUpdate(client.getEventName(), url, items);

        event.withResourceType(objectManager.getType(client.getResourceType())).withResourceId(Long.toString(client.getResourceId()));

        return event;
    }
Example 4
protected void populateContext(Agent agent, Instance instance, ConfigItem item, ArchiveContext context) {
        context.getData().put("customApiHost", ServerContext.isCustomApiHost());
        context.getData().put("configUrl", ServerContext.getHostApiBaseUrl(BaseProtocol.HTTP));
    }