// Path: cloud-vmware-server/src/main/java/jetbrains/buildServer/clouds/vmware/web/VMWareWebConstants.java
// public class VMWareWebConstants {
// 
//   public static final String SERVER_URL="vmware_server_url";
//   public static final String USERNAME="vmware_username";
//   public static final String PASSWORD="vmware_password";
//   public static final String PROFILE_INSTANCE_LIMIT="vmware_profile_instance_limit";
// 
//   public static final String SECURE_PASSWORD = "secure:"+PASSWORD;
// 
// 
//   public String getServerUrl() {
//     return SERVER_URL;
//   }
// 
//   public String getUsername() {
//     return USERNAME;
//   }
// 
//   public String getPassword() {
//     return PASSWORD;
//   }
// 
//   public String getProfileInstanceLimit() {
//     return PROFILE_INSTANCE_LIMIT;
//   }
// }


import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import java.util.*;
import java.util.stream.StreamSupport;
import jetbrains.buildServer.clouds.CloudConstants;
import jetbrains.buildServer.clouds.CloudImageParameters;
import jetbrains.buildServer.clouds.server.CloudManagerBase;
import jetbrains.buildServer.clouds.vmware.web.VMWareWebConstants;
import jetbrains.buildServer.serverSide.InvalidProperty;
import jetbrains.buildServer.serverSide.PropertiesProcessor;
import jetbrains.buildServer.util.StringUtil;
import org.jetbrains.annotations.NotNull;
/*
 * Copyright 2000-2022 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package jetbrains.buildServer.clouds.vmware;


/**
 * Created by Sergey.Pak on 1/29/2016.
 */
public class VmwarePropertiesProcessor implements PropertiesProcessor {

  @NotNull private final CloudManagerBase myCloudManager;

  public VmwarePropertiesProcessor(@NotNull final CloudManagerBase cloudManager){
    myCloudManager = cloudManager;
  }

  @NotNull
  public Collection<InvalidProperty> process(final Map<String, String> properties) {
    List<InvalidProperty> list = new ArrayList<InvalidProperty>();

    // Remove helper properties used in ConfigurationHelperController and GetSnapshotsListController
    try {
      properties.remove("helperFieldValue");
      properties.remove("helperFieldId");
      properties.remove("image");
      properties.remove("force_trust_manager");
    } catch (UnsupportedOperationException ignored) {
      // In case of unmodifiable map passed
    }

// Path: cloud-vmware-server/src/main/java/jetbrains/buildServer/clouds/vmware/web/VMWareWebConstants.java
// public class VMWareWebConstants {
// 
//   public static final String SERVER_URL="vmware_server_url";
//   public static final String USERNAME="vmware_username";
//   public static final String PASSWORD="vmware_password";
//   public static final String PROFILE_INSTANCE_LIMIT="vmware_profile_instance_limit";
// 
//   public static final String SECURE_PASSWORD = "secure:"+PASSWORD;
// 
// 
//   public String getServerUrl() {
//     return SERVER_URL;
//   }
// 
//   public String getUsername() {
//     return USERNAME;
//   }
// 
//   public String getPassword() {
//     return PASSWORD;
//   }
// 
//   public String getProfileInstanceLimit() {
//     return PROFILE_INSTANCE_LIMIT;
//   }
// }


// Path: cloud-vmware-server/src/main/java/jetbrains/buildServer/clouds/vmware/VmwarePropertiesProcessor.java
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import java.util.*;
import java.util.stream.StreamSupport;
import jetbrains.buildServer.clouds.CloudConstants;
import jetbrains.buildServer.clouds.CloudImageParameters;
import jetbrains.buildServer.clouds.server.CloudManagerBase;
import jetbrains.buildServer.clouds.vmware.web.VMWareWebConstants;
import jetbrains.buildServer.serverSide.InvalidProperty;
import jetbrains.buildServer.serverSide.PropertiesProcessor;
import jetbrains.buildServer.util.StringUtil;
import org.jetbrains.annotations.NotNull;

/*
 * Copyright 2000-2022 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package jetbrains.buildServer.clouds.vmware;


/**
 * Created by Sergey.Pak on 1/29/2016.
 */
public class VmwarePropertiesProcessor implements PropertiesProcessor {

  @NotNull private final CloudManagerBase myCloudManager;

  public VmwarePropertiesProcessor(@NotNull final CloudManagerBase cloudManager){
    myCloudManager = cloudManager;
  }

  @NotNull
  public Collection<InvalidProperty> process(final Map<String, String> properties) {
    List<InvalidProperty> list = new ArrayList<InvalidProperty>();

    // Remove helper properties used in ConfigurationHelperController and GetSnapshotsListController
    try {
      properties.remove("helperFieldValue");
      properties.remove("helperFieldId");
      properties.remove("image");
      properties.remove("force_trust_manager");
    } catch (UnsupportedOperationException ignored) {
      // In case of unmodifiable map passed
    }

    notEmpty(properties, VMWareWebConstants.SECURE_PASSWORD, list);