Java Code Examples for jetbrains.buildServer.util.StringUtil

The following examples show how to use jetbrains.buildServer.util.StringUtil. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Nullable
@Override
protected ModelAndView doHandle(@NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws Exception {
    String projectId = httpServletRequest.getParameter("projectId");
    String profileId = httpServletRequest.getParameter("profileId");
    String imageId = httpServletRequest.getParameter("imageId");
    if(StringUtil.isEmpty(imageId)) return null;

    final CloudClientEx client = myCloudManager.getClientIfExistsByProjectExtId(projectId, profileId);
    CloudImage image = client.findImageById(imageId);

    if(isGet(httpServletRequest)){
        ModelAndView modelAndView = new ModelAndView(myPluginDescriptor.getPluginResourcesPath("deleteImageDialog.jsp"));
        modelAndView.getModelMap().put("instances", image == null ? Collections.emptyList() : image.getInstances());
        return modelAndView;
    } else if(isPost(httpServletRequest) && image != null){
        for (CloudInstance instance : image.getInstances()){
            client.terminateInstance(instance);
        }
    }
    return null;
}
 
Example 2
@Override
public Collection<InvalidProperty> process(Map<String, String> map) {
    Collection<InvalidProperty> invalids = new ArrayList<>();
    if(StringUtil.isEmptyOrSpaces(map.get(API_SERVER_URL))) invalids.add(new InvalidProperty(API_SERVER_URL, "Kubernetes API server URL must not be empty"));
    final String authStrategy = map.get(AUTH_STRATEGY);
    if (StringUtil.isEmptyOrSpaces(authStrategy)) {
        invalids.add(new InvalidProperty(AUTH_STRATEGY, "Authentication strategy must be selected"));
        return invalids;
    }
    KubeAuthStrategy strategy = myKubeAuthStrategyProvider.find(authStrategy);
    if (strategy != null) {
        Collection<InvalidProperty> strategyCollection = strategy.process(map);
        if (strategyCollection != null && !strategyCollection.isEmpty()){
            invalids.addAll(strategyCollection);
        }
    }

    return invalids;
}
 
Example 3
private synchronized void loadIdxes(@NotNull final File idxStorage) {
  final File[] idxes = idxStorage.listFiles();
  if (idxes == null){

  }
  for (File idxFile : idxes) {
    if (!idxFile.getName().endsWith(".idx"))
      continue;
    String idxName = idxFile.getName().substring(0, idxFile.getName().length()-4);
    try {
      int val = StringUtil.parseInt(FileUtil.readText(idxFile), -1);
      if (val > 0){
        myCounters.putIfAbsent(idxName, new AtomicInteger(0));
        myCounters.get(idxName).set(val);
      }
    } catch (IOException e) {}
  }
}
 
Example 4
@NotNull
public String generateNewVmName(@NotNull KubeCloudImage image) {
  try {
    myLock.readLock().lock();
    if (!myIsAvailable.get()){
      throw new CloudException("Unable to generate a name for image " + image.getId() + " - server is shutting down");
    }
    String newVmName;
    do {
      String prefix = image.getAgentNamePrefix();
      if (StringUtil.isEmptyOrSpaces(prefix)) {
        prefix = image.getDockerImage();
      }
      if (StringUtil.isEmptyOrSpaces(prefix)) {
        return UUID.randomUUID().toString();
      }
      prefix = StringUtil.replaceNonAlphaNumericChars(prefix.trim().toLowerCase(), '-');
      newVmName = String.format("%s-%d", prefix, getNextCounter(prefix));
      setTouched(prefix);

    } while (image.findInstanceById(newVmName) != null);
    return newVmName;
  } finally {
    myLock.readLock().unlock();
  }
}
 
Example 5
protected Config createConfig(@NotNull KubeApiConnection connectionSettings, @NotNull KubeAuthStrategy authStrategy){
    ConfigBuilder configBuilder = new ConfigBuilder()
      .withMasterUrl(connectionSettings.getApiServerUrl())
      .withNamespace(connectionSettings.getNamespace())
      .withRequestTimeout(DEFAULT_REQUEST_TIMEOUT_MS)
      .withHttp2Disable(true)
      .withConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT_MS);
    final String caCertData = connectionSettings.getCACertData();
    if(StringUtil.isEmptyOrSpaces(caCertData)){
        configBuilder.withTrustCerts(true);
    } else {
        configBuilder.withCaCertData(KubeUtils.encodeBase64IfNecessary(caCertData));
    }
    configBuilder = authStrategy.apply(configBuilder, connectionSettings);
    return configBuilder.build();
}
 
Example 6
@NotNull
@Override
public Date getStartedTime() {
    final PodStatus podStatus = myPod.getStatus();
    if(podStatus == null) return myCreationTime;
    try {
        final List<PodCondition> podConditions = podStatus.getConditions();
        if (podConditions != null && !podConditions.isEmpty()) {
            for (PodCondition podCondition : podConditions) {
                if (PodConditionType.valueOf(podCondition.getType()) == PodConditionType.Ready)
                    return myPodTransitionTimeFormat.parse(podCondition.getLastTransitionTime());
            }
        }
        String startTime = podStatus.getStartTime();
        return !StringUtil.isEmpty(startTime) ? myPodStartTimeFormat.parse(startTime) : myCreationTime;
    } catch (ParseException e) {
        throw new KubeCloudException("Failed to get instance start date", e);
    }
}
 
Example 7
Source Project: TeamCity.Virtual   Source File: VMRunType.java    License: Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public PropertiesProcessor getRunnerPropertiesProcessor() {
  return new PropertiesProcessor() {
    @NotNull
    public Collection<InvalidProperty> process(Map<String, String> properties) {
      List<InvalidProperty> result = new ArrayList<InvalidProperty>();
      if (StringUtil.isEmptyOrSpaces(properties.get(VMConstants.PARAMETER_SCRIPT))) {
        result.add(new InvalidProperty(VMConstants.PARAMETER_SCRIPT, "Script should not be empty"));
      }

      final String vm = properties.get(VMConstants.PARAMETER_VM);
      final VM w = VM.find(vm);
      if (w == null) {
        result.add(new InvalidProperty(VMConstants.PARAMETER_VM, "Unknown VM"));
      } else {
        result.addAll(w.validate(properties));
      }
      return result;
    }
  };
}
 
Example 8
@Used("tests")
/* package local for tests */ Pod getPodTemplateInternal(@NotNull final CloudInstanceUserData cloudInstanceUserData,
                                  @NotNull final String imageId,
                                  @NotNull final String namespace,
                                  final String instanceName,
                                  String spec) {
    spec = spec.replaceAll("%instance\\.id%", instanceName);

    if (StringUtil.isEmpty(spec)) {
        throw new KubeCloudException("Custom pod template spec is not specified for image " + imageId);
    }

    final PodTemplateSpec podTemplateSpec = Serialization.unmarshal(
      new ByteArrayInputStream(spec.getBytes()),
      PodTemplateSpec.class
    );

    return patchedPodTemplateSpec(podTemplateSpec,
                                  instanceName,
                                  namespace,
                                  myServerSettings.getServerUUID(),
                                  imageId,
                                  cloudInstanceUserData);
}
 
Example 9
@Nullable
@Override
public PersistentVolumeClaim getPVC(@NotNull final String instanceName,
                                    @NotNull final KubeCloudImage kubeCloudImage) {
    String pvcTemplate = kubeCloudImage.getPVCTemplate();
    if (StringUtil.isEmpty(pvcTemplate)){
        return null;
    }
    pvcTemplate = pvcTemplate.replaceAll("%instance\\.id%", instanceName);
    final PersistentVolumeClaim pvc = Serialization.unmarshal(
      new ByteArrayInputStream(pvcTemplate.getBytes()),
      PersistentVolumeClaim.class
    );

    return pvc;
}
 
Example 10
private ActionErrors validate(@NotNull TelegramSettingsBean settings) {
  ActionErrors errors = new ActionErrors();
  if (StringUtil.isEmptyOrSpaces(settings.getBotToken())) {
    errors.addError("emptyBotToken", "Bot token must not be empty");
  }
  if (settings.isUseProxy()) {
    if (StringUtils.isEmpty(settings.getProxyServer())) {
      errors.addError("emptyProxyServer", "Proxy server must not be empty");
    }
    if (StringUtils.isEmpty(settings.getProxyPort())) {
      errors.addError("emptyProxyPort", "Proxy port must not be empty");
    }
  }
  String port = settings.getProxyPort();
  if (!StringUtils.isEmpty(port) &&
      (!StringUtil.isNumber(port) || Integer.valueOf(port) < 1 || Integer.valueOf(port) > 65535)) {
    errors.addError("badProxyPort", "Proxy port must be integer between 1 and 65535");
  }
  return errors;
}
 
Example 11
Source Project: allure-teamcity   Source File: AllureToolProvider.java    License: Apache License 2.0 6 votes vote down vote up
@NotNull
@Override
public GetPackageVersionResult tryGetPackageVersion(@NotNull File toolPackage) {
    final String packageName = FilenameUtils.removeExtension(toolPackage.getName());
    Pattern pattern = Pattern.compile("allure-commandline-(.+)");

    Matcher matcher = pattern.matcher(packageName);
    if (!matcher.matches()) {
        return GetPackageVersionResult.error("Not allure-commandline");
    }
    final String toolId = matcher.group(1);
    if (StringUtil.isEmpty(toolId)) {
        return GetPackageVersionResult.error(String.format("Failed to determine allure-commandline version based on its package file name %s. Checked package %s", toolPackage.getName(), toolPackage.getAbsolutePath()));
    }
    return GetPackageVersionResult.version(new AllureDownloadableToolVersion(toolId));
}
 
Example 12
/**
 * Reload bot if settings changed
 * @param newSettings updated user settings
 */
public synchronized void reloadIfNeeded(@NotNull TelegramSettings newSettings) {
  if (Objects.equals(newSettings, settings)) {
    LOG.debug("Telegram bot token settings has not changed");
    return;
  }
  LOG.debug("New telegram bot token is received: " +
          StringUtil.truncateStringValueWithDotsAtEnd(newSettings.getBotToken(), 6));
  this.settings = newSettings;
  cleanupBot();
  if (settings.getBotToken() != null && !settings.isPaused()) {
    TelegramBot newBot = createBot(settings);
    addUpdatesListener(newBot);
    bot = newBot;
  }
}
 
Example 13
@NotNull
public static Map<String, String> validateParameters(@NotNull final Map<String, String> params, final boolean acceptReferences) {
  final Map<String, String> commonErrors = AWSCommonParams.validate(params, acceptReferences);
  if (!commonErrors.isEmpty()) {
    return commonErrors;
  }
  final Map<String, String> invalids = new HashMap<>();
  if (StringUtil.isEmptyOrSpaces(getBucketName(params))) {
    invalids.put(beanPropertyNameForBucketName(), "S3 bucket name must not be empty");
  }
  final String pathPrefix = params.getOrDefault(S3_PATH_PREFIX_SETTING, "");
  if (TeamCityProperties.getBoolean("teamcity.internal.storage.s3.bucket.prefix.enable") && !StringUtil.isEmptyOrSpaces(pathPrefix)) {
    if (pathPrefix.length() > OUT_MAX_PREFIX_LENGTH) {
      invalids.put(S3_PATH_PREFIX_SETTING, "Should be less than " + OUT_MAX_PREFIX_LENGTH + " characters");
    }
    if (!OUR_OBJECT_KEY_PATTERN.matcher(pathPrefix).matches()) {
      invalids.put(S3_PATH_PREFIX_SETTING, "Should match the regexp [" + OUR_OBJECT_KEY_PATTERN.pattern() + "]");
    }
  }
  return invalids;
}
 
Example 14
public static String getContentType(final File file) {
  String contentType = URLConnection.guessContentTypeFromName(file.getName());
  if (StringUtil.isNotEmpty(contentType)) {
    return contentType;
  }
  if (PROBE_CONTENT_TYPE_METHOD != null && FILE_TO_PATH_METHOD != null) {
    try {
      final Object result = PROBE_CONTENT_TYPE_METHOD.invoke(null, FILE_TO_PATH_METHOD.invoke(file));
      if (result instanceof String) {
        contentType = (String)result;
      }
    } catch (Exception ignored) {
    }
  }
  return StringUtil.notEmpty(contentType, DEFAULT_CONTENT_TYPE);
}
 
Example 15
Source Project: teamcity-symbol-server   Source File: ArtifactPathHelper.java    License: Apache License 2.0 6 votes vote down vote up
@NotNull
String concatenateArtifactPath(@NotNull final String fileNamePrefix, @NotNull final String pdbFileName) {
  final String normalizedFileNamePrefix = fileNamePrefix.replace(ARCHIVE_PATH_SEPARATOR, ARCHIVE_PATH_SEPARATOR_FULL);
  if (StringUtil.isEmpty(normalizedFileNamePrefix)) {
    return pdbFileName;
  }

  final String archivePath = getArchivePath(normalizedFileNamePrefix);
  if (archivePath == null || normalizedFileNamePrefix.contains(ARCHIVE_PATH_SEPARATOR_FULL)) {
    return normalizedFileNamePrefix + FOLDER_SEPARATOR + pdbFileName;
  }

  return archivePath + ARCHIVE_PATH_SEPARATOR +
    StringUtil.trimStart(normalizedFileNamePrefix, archivePath) + FOLDER_SEPARATOR +
    pdbFileName;
}
 
Example 16
@NotNull
@Override
public BuildProcess createBuildProcess(@NotNull final AgentRunningBuild runningBuild,
                                       @NotNull final BuildRunnerContext context) throws RunBuildException {

  final Map<String, String> runnerParameters = context.getRunnerParameters();
  final String username = StringUtil.emptyIfNull(runnerParameters.get(DeployerRunnerConstants.PARAM_USERNAME));
  final String password = StringUtil.emptyIfNull(runnerParameters.get(DeployerRunnerConstants.PARAM_PASSWORD));
  final String target = StringUtil.emptyIfNull(runnerParameters.get(DeployerRunnerConstants.PARAM_TARGET_URL));
  final String sourcePaths = runnerParameters.get(DeployerRunnerConstants.PARAM_SOURCE_PATH);

  final Collection<ArtifactsPreprocessor> preprocessors = myExtensionHolder.getExtensions(ArtifactsPreprocessor.class);

  final ArtifactsBuilder builder = new ArtifactsBuilder();
  builder.setPreprocessors(preprocessors);
  builder.setBaseDir(runningBuild.getCheckoutDirectory());
  builder.setArtifactsPaths(sourcePaths);

  final List<ArtifactsCollection> artifactsCollections = builder.build();

  return getDeployerProcess(context, username, password, target, artifactsCollections);
}
 
Example 17
Source Project: tc-ansible-runner   Source File: AnsibleRunType.java    License: MIT License 6 votes vote down vote up
@NotNull
@Override
public PropertiesProcessor getRunnerPropertiesProcessor() {
  return new PropertiesProcessor() {
    public Collection<InvalidProperty> process(final Map<String, String> properties) {
        List<InvalidProperty> errors = new ArrayList<InvalidProperty>();
        AnsibleRunConfig config = new AnsibleRunConfig(properties);
        if (AnsibleCommand.EXECUTABLE.equals(config.getCommandType())) {
            if (StringUtil.isEmptyOrSpaces(config.getExecutable())) {
                errors.add(new InvalidProperty(AnsibleRunnerConstants.EXECUTABLE_KEY, "Cannot be empty"));
            }
            if (StringUtil.isEmptyOrSpaces(config.getPlaybook())) {
                errors.add(new InvalidProperty(AnsibleRunnerConstants.PLAYBOOK_FILE_KEY, "Cannot be empty"));
            }
        } else if (AnsibleCommand.CUSTOM_SCRIPT.equals(config.getCommandType())) {
            if (StringUtil.isEmptyOrSpaces(config.getSourceCode())) {
                errors.add(new InvalidProperty(AnsibleRunnerConstants.SOURCE_CODE_KEY, "Cannot be empty"));
            }
        }
      return errors;
    }
  };
}
 
Example 18
private String getFullPath(@NotNull final String entityName,
                           @NotNull final ManagedObjectReference mor,
                           @Nullable final ManagedObjectReference firstParent,
                           @Nullable final Datacenter dc){
  final String uniqueName = String.format("%s (%s)", entityName, mor.getVal());
  if (firstParent == null) {
    return uniqueName;
  }
  try {
    final String morPath = getFullMORPath(createExactManagedEntity(firstParent), dc);
    if (StringUtil.isEmpty(morPath)) {
      return uniqueName;
    } else if (("Resources".equals(entityName) || "vm".equals(entityName)) && !mor.getType().equals(firstParent.getType())) {
      LOG.debug("The pool is a special pool. Skipping it...");
      return morPath;
    } else {
      return morPath + "/" + entityName;
    }
  } catch (Exception ex){
    LOG.warnAndDebugDetails("Can't calculate full path for " + uniqueName, ex);
    return uniqueName;
  }
}
 
Example 19
private String getLatestSnapshot(final String snapshotNameMask, final Map<String, VirtualMachineSnapshotTree> snapshotList) {
  if (snapshotNameMask == null)
    return null;
  if (!snapshotNameMask.contains("*") && !snapshotNameMask.contains("?")) {
    return snapshotList.containsKey(snapshotNameMask) ? snapshotNameMask : null;
  }
  Date latestTime = new Date(0);
  String latestSnapshotName = null;
  for (Map.Entry<String, VirtualMachineSnapshotTree> entry : snapshotList.entrySet()) {
    final String snapshotNameMaskRegex = StringUtil.convertWildcardToRegexp(snapshotNameMask);
    final Pattern pattern = Pattern.compile(snapshotNameMaskRegex);
    if (pattern.matcher(entry.getKey()).matches()) {
      final Date snapshotTime = entry.getValue().getCreateTime().getTime();
      if (latestTime.before(snapshotTime)) {
        latestTime = snapshotTime;
        latestSnapshotName = entry.getKey();
      }
    }
  }
  return latestSnapshotName;
}
 
Example 20
public VmwareCloudImageDetails(@NotNull final CloudImageParameters imageParameters){
  myCustomizationSpec = imageParameters.getParameter(VmwareConstants.CUSTOMIZATION_SPEC);
  myMaxInstances = StringUtil.parseInt(StringUtil.emptyIfNull(imageParameters.getParameter(VmwareConstants.MAX_INSTANCES)), 0);
  mySourceVmName = imageParameters.getParameter(VmwareConstants.SOURCE_VM_NAME);
  myFolderId = imageParameters.getParameter(VmwareConstants.FOLDER);
  myResourcePoolId = imageParameters.getParameter(VmwareConstants.RESOURCE_POOL);
  myCloneBehaviour = CloneBehaviour.valueOf(imageParameters.getParameter(VmwareConstants.BEHAVIOUR));
  mySnapshotName = StringUtil.emptyIfNull(imageParameters.getParameter(VmwareConstants.SNAPSHOT));
  myNickname = StringUtil.nullIfEmpty(imageParameters.getParameter(VmwareConstants.NICKNAME));
  myAgentPoolId = imageParameters.getAgentPoolId();
  if (myCloneBehaviour.isUseOriginal()){
    mySourceId = mySourceVmName;
  } else {
    mySourceId = myNickname == null ? mySourceVmName : myNickname;
  }
}
 
Example 21
@Nullable
@Override
public String generateAgentName(@NotNull AgentDescription agentDescription) {
    final Map<String, String> agentParameters = agentDescription.getAvailableParameters();
    final String imageId = agentParameters.get(Constants.ENV_PREFIX + IMAGE_NAME);
    final String instanceName = agentParameters.get(Constants.ENV_PREFIX + INSTANCE_NAME);
    if (!StringUtil.isNotEmpty(imageId) || !StringUtil.isNotEmpty(instanceName))
        return null;

    final KubeCloudImage cloudImage = myImageIdToImageMap.get(imageId);
    if(cloudImage == null)
        return null;

    return cloudImage.getAgentName(instanceName);
}
 
Example 22
@NotNull
@Override
public ConfigBuilder apply(@NotNull ConfigBuilder clientConfig, @NotNull KubeApiConnection connection) {
    String token = connection.getCustomParameter(SECURE_PREFIX + AUTH_TOKEN);
    if(StringUtil.isEmpty(token)) {
        throw new KubeCloudException("Auth token is empty for connection to " + connection.getApiServerUrl());
    }
    return clientConfig.withOauthToken(token);
}
 
Example 23
@Override
public Collection<InvalidProperty> process(final Map<String, String> properties) {
    if (StringUtil.isEmpty(properties.get(SECURE_PREFIX+AUTH_TOKEN))){
        return Collections.singletonList(new InvalidProperty( AUTH_TOKEN, "Token is required"));
    }
    return Collections.emptyList();
}
 
Example 24
@NotNull
@Override
public ConfigBuilder apply(@NotNull ConfigBuilder clientConfig, @NotNull KubeApiConnection connection) {
    String defaultServiceAccountAuthToken = getDefaultServiceAccountAuthToken();
    if(StringUtil.isEmpty(defaultServiceAccountAuthToken)) throw new KubeCloudException("Can't locate default Kubernetes service account token.");
    return clientConfig.withOauthToken(defaultServiceAccountAuthToken);
}
 
Example 25
@NotNull
@Override
public ConfigBuilder apply(@NotNull ConfigBuilder clientConfig, @NotNull KubeApiConnection connection) {
    String clientCertData = connection.getCustomParameter(SECURE_PREFIX+ CLIENT_CERTIFICATE_DATA);
    String clientKeyData = connection.getCustomParameter(SECURE_PREFIX+ CLIENT_KEY_DATA);
    if(StringUtil.isEmpty(clientCertData)) {
        throw new KubeCloudException("Client certificate data is empty");
    }
    if(StringUtil.isEmpty(clientKeyData)) {
        throw new KubeCloudException("Client key data is empty");
    }
    return clientConfig.withClientCertData(KubeUtils.encodeBase64IfNecessary(clientCertData))
                       .withClientKeyData(KubeUtils.encodeBase64IfNecessary(clientKeyData));
}
 
Example 26
@Override
public Collection<InvalidProperty> process(final Map<String, String> properties) {
    List<InvalidProperty> retval = new ArrayList<>();
    String certData = properties.get(SECURE_PREFIX+ CLIENT_CERTIFICATE_DATA);
    if (StringUtil.isEmpty(certData)){
        retval.add(new InvalidProperty(CLIENT_CERTIFICATE_DATA, "Client certificate data is empty"));
    }
    String keyData = properties.get(SECURE_PREFIX + CLIENT_KEY_DATA);
    if (StringUtil.isEmpty(keyData)){
        retval.add(new InvalidProperty(CLIENT_KEY_DATA, "Client key data is empty"));
    }
    return retval;
}
 
Example 27
Source Project: teamcity-kubernetes-plugin   Source File: KubeUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static String encodeBase64IfNecessary(@NotNull String dataString){
    byte[] decodedString;
    try {
        decodedString = Base64.decodeBase64(dataString);
    } catch (Exception ex) {
        decodedString = null;
    }
    if (StringUtil.areEqual(dataString, Base64.encodeBase64String(decodedString)))
        return dataString;
    else
        return Base64.encodeBase64String(dataString.getBytes());
}
 
Example 28
Source Project: teamcity-kubernetes-plugin   Source File: KubeUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static byte[] decodeBase64IfNecessary(@NotNull String dataString){
    byte[] decodedString;
    try {
        decodedString = Base64.decodeBase64(dataString);
    } catch (Exception ex) {
        decodedString = null;
    }
    if (StringUtil.areEqual(dataString, Base64.encodeBase64String(decodedString)))
        return Base64.decodeBase64(dataString);
    else
        return dataString.getBytes();
}
 
Example 29
@NotNull
@Override
public Pod getPodTemplate(@NotNull String instanceName,
                          @NotNull CloudInstanceUserData cloudInstanceUserData,
                          @NotNull KubeCloudImage kubeCloudImage,
                          @NotNull KubeCloudClientParameters kubeClientParams) {
  String sourceDeploymentName = kubeCloudImage.getSourceDeploymentName();
  if (StringUtil.isEmpty(sourceDeploymentName)) {
    throw new KubeCloudException("Deployment name is not set in kubernetes cloud image " + kubeCloudImage.getId());
  }

  Deployment sourceDeployment = myDeploymentContentProvider.findDeployment(sourceDeploymentName, kubeClientParams);
  if (sourceDeployment == null) {
    throw new KubeCloudException("Can't find source deployment by name " + sourceDeploymentName);
  }

  //final String agentNameProvided = cloudInstanceUserData.getAgentName();
  //final String instanceName = StringUtil.isEmpty(agentNameProvided) ? sourceDeploymentName + "-" + UUID.randomUUID().toString() : agentNameProvided;

  return patchedPodTemplateSpec(sourceDeployment.getSpec().getTemplate(),
                                instanceName,
                                kubeClientParams.getNamespace(),
                                myServerSettings.getServerUUID(),
                                kubeCloudImage.getId(),
                                cloudInstanceUserData
  );
  }
 
Example 30
public TelegramSettings toSettings() {
  TelegramSettings settings = new TelegramSettings();
  settings.setBotToken(botToken);
  settings.setPaused(paused);
  settings.setUseProxy(useProxy);
  settings.setProxyServer(proxyServer);
  settings.setProxyPort(StringUtil.isEmpty(proxyPort) ? null : Integer.valueOf(proxyPort));
  settings.setProxyUsername(proxyUsername);
  settings.setProxyPassword(proxyPassword);
  return settings;
}