當前位置: 首頁>>代碼示例>>Java>>正文


Java Parameter類代碼示例

本文整理匯總了Java中io.fabric8.openshift.api.model.Parameter的典型用法代碼示例。如果您正苦於以下問題:Java Parameter類的具體用法?Java Parameter怎麽用?Java Parameter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Parameter類屬於io.fabric8.openshift.api.model包,在下文中一共展示了Parameter類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configureProject

import io.fabric8.openshift.api.model.Parameter; //導入依賴的package包/類
@Override
public void configureProject(final OpenShiftProject project,
                             final URI sourceRepositoryUri,
                             final String gitRef,
                             final URI pipelineTemplateUri) {
    final InputStream pipelineTemplateStream;
    try {
        pipelineTemplateStream = pipelineTemplateUri.toURL().openStream();
    } catch (IOException e) {
        throw new RuntimeException("Could not create OpenShift pipeline", e);
    }
    List<Parameter> parameters = Arrays.asList(
            createParameter("GIT_URL", sourceRepositoryUri.toString()),
            createParameter("GIT_REF", gitRef));
    configureProject(project, pipelineTemplateStream, parameters);
    fixJenkinsServiceAccount(project);
}
 
開發者ID:fabric8-launcher,項目名稱:launcher-backend,代碼行數:18,代碼來源:Fabric8OpenShiftServiceImpl.java

示例2: applyParameterValueProperties

import io.fabric8.openshift.api.model.Parameter; //導入依賴的package包/類
private void applyParameterValueProperties(final OpenShiftProject project, final Template template) {
    RouteList routes = null;
    for (Parameter parameter : template.getParameters()) {
        // Find any parameters with special "fabric8-value" properties
        if (parameter.getAdditionalProperties().containsKey("fabric8-value")
                && parameter.getValue() == null) {
            String value = parameter.getAdditionalProperties().get("fabric8-value").toString();
            Matcher m = PARAM_VAR_PATTERN.matcher(value);
            StringBuffer newval = new StringBuffer();
            while (m.find()) {
                String type = m.group(1);
                String routeName = m.group(2);
                String propertyPath = m.group(3);
                String propertyValue = "";
                // We only support "route/XXX[.spec.host]" for now,
                // but we're prepared for future expansion
                if ("route".equals(type) && ".spec.host".equals(propertyPath)) {
                    // Try to find a Route with that name and use its host name
                    if (routes == null) {
                        routes = client.routes().inNamespace(project.getName()).list();
                    }
                    propertyValue = routes.getItems().stream()
                            .filter(r -> routeName.equals(r.getMetadata().getName()))
                            .map(r -> r.getSpec().getHost())
                            .filter(Objects::nonNull)
                            .findAny()
                            .orElse(propertyValue);
                }
                m.appendReplacement(newval, Matcher.quoteReplacement(propertyValue));
            }
            m.appendTail(newval);
            parameter.setValue(newval.toString());
        }
    }
}
 
開發者ID:fabric8-launcher,項目名稱:launcher-backend,代碼行數:36,代碼來源:Fabric8OpenShiftServiceImpl.java

示例3: applyParameterValueProperties

import io.fabric8.openshift.api.model.Parameter; //導入依賴的package包/類
private void applyParameterValueProperties(final OpenShiftProject project, final Template template) {
    RouteList routes = null;
    for (Parameter parameter : template.getParameters()) {
        // Find any parameters with special "fabric8-value" properties
        if (parameter.getAdditionalProperties().containsKey("fabric8-value")
                && parameter.getValue() == null) {
            String value = parameter.getAdditionalProperties().get("fabric8-value").toString();
            Matcher m = PARAM_VAR_PATTERN.matcher(value);
            StringBuffer newval = new StringBuffer();
            while (m.find()) {
                String type = m.group(1);
                String routeName = m.group(2);
                String propertyPath = m.group(3);
                String propertyValue = "";
                // We only support "route/XXX[.spec.host]" for now,
                // but we're prepared for future expansion
                if ("route".equals(type) && ".spec.host".equals(propertyPath)) {
                    // Try to find a Route with that name and use its host name
                    if (routes == null) {
                        routes = client.routes().inNamespace(project.getName()).list();
                    }
                    propertyValue = routes.getItems().stream()
                        .filter(r -> routeName.equals(r.getMetadata().getName()))
                        .map(r -> r.getSpec().getHost())
                        .filter(Objects::nonNull)
                        .findAny()
                        .orElse(propertyValue);
                }
                m.appendReplacement(newval, Matcher.quoteReplacement(propertyValue));
            }
            m.appendTail(newval);
            parameter.setValue(newval.toString());
        }
    }
}
 
開發者ID:fabric8-launcher,項目名稱:launchpad-missioncontrol,代碼行數:36,代碼來源:Fabric8OpenShiftServiceImpl.java

示例4: createParameter

import io.fabric8.openshift.api.model.Parameter; //導入依賴的package包/類
private Parameter createParameter(final String name, final String value) {
    Parameter parameter = new Parameter();
    parameter.setName(name);
    parameter.setValue(value);
    return parameter;
}
 
開發者ID:fabric8-launcher,項目名稱:launcher-backend,代碼行數:7,代碼來源:Fabric8OpenShiftServiceImpl.java

示例5: createCheServer

import io.fabric8.openshift.api.model.Parameter; //導入依賴的package包/類
@Test
public void createCheServer() throws Exception {
    OpenShiftClient openShiftClient = null;
    try {
        openShiftClient = client.get(endpoint, username, password);

        ProjectRequest projectRequest = createTestProject(openShiftClient);
        LOG.info("Number of projects: {}", getNumberOfProjects(openShiftClient));

        LOG.info("Test project has been deleted: {}", deleteTestProject(openShiftClient, projectRequest));
        LOG.info("Number of projects: {}", getNumberOfProjects(openShiftClient));

        // Controller controller = new Controller(client);
        // controller.applyJson(template.get());

        Template template = loadTemplate(openShiftClient);

        List<Parameter> parameters = template.getParameters();
        LOG.info("Number of template parameters: {}", parameters.size());

        List<ParameterValue> pvs = new ArrayList<>();
        for (Parameter parameter : parameters) {
            String name = parameter.getName();
            String value = parameter.getValue();
            LOG.info("Template Parameter Name: {}", name);
            LOG.info("Template Parameter Value: {}", value);
            if (CHE_OPENSHIFT_ENDPOINT.equals(name) && value.isEmpty()) {
                value = endpoint;
            }
            pvs.add(new ParameterValue(name, value));
        }

        KubernetesList list = processTemplate(openShiftClient, pvs);
        createResources(openShiftClient, list);

        Pod pod = openShiftClient.pods().inNamespace(project).withName("che-host").get();

        Route route = openShiftClient.routes().inNamespace(project).withName("che-host").get();

        LOG.info("Pods: {}", getNumberOfPods(openShiftClient));
    } finally {
        if (openShiftClient != null) {
            openShiftClient.close();
        }
    }
}
 
開發者ID:redhat-developer,項目名稱:che-starter,代碼行數:47,代碼來源:OpenShiftTest.java


注:本文中的io.fabric8.openshift.api.model.Parameter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。