// Path: provider/src/main/java/com/cloudera/director/aws/Tags.java
// public final class Tags {
// 
//   /**
//    * Director tags for cloud resources.
//    */
//   public enum ResourceTags {
//     /**
//      * The name of the resource.
//      */
//     RESOURCE_NAME("Name"),
// 
//     /**
//      * The virtual instance ID as generated by Cloudera Altus Director.
//      */
//     CLOUDERA_DIRECTOR_ID("Cloudera-Director-Id"),
// 
//     /**
//      * The virtual instance ID as generated by Cloudera Altus Director.
//      */
//     CLOUDERA_DIRECTOR_TEMPLATE_NAME("Cloudera-Director-Template-Name");
// 
//     private final String tagName;
// 
//     ResourceTags(String tagName) {
//       this.tagName = tagName;
//     }
// 
//     /**
//      * Gets the tag's key.
//      * Note that you should always call this method to get the tag's key, and not the
//      * {@link ResourceTags#valueOf(String)} method.
//      *
//      * @return tag's key name
//      */
//     public String getTagKey() {
//       return tagName;
//     }
//   }
// 
//   /**
//    * Director tags specifically for cloud instances.
//    */
//   public enum InstanceTags {
//     /**
//      * The instance owner.
//      */
//     OWNER("owner");
// 
//     private final String tagName;
// 
//     InstanceTags(String tagName) {
//       this.tagName = tagName;
//     }
// 
//     /**
//      * Gets the tag's key.
//      * Note that you should always call this method to get the tag's key, and not the
//      * {@link InstanceTags#valueOf(String)} method.
//      *
//      * @return tag's key name
//      */
//     public String getTagKey() {
//       return tagName;
//     }
//   }
// 
// 
//   /**
//    * Private constructor to prevent instantiation.
//    */
//   private Tags() {
//   }
// }


import static com.cloudera.director.spi.v2.model.InstanceTemplate.InstanceTemplateConfigurationPropertyToken.INSTANCE_NAME_PREFIX;
import com.cloudera.director.aws.Tags;
import com.cloudera.director.spi.v2.model.ConfigurationPropertyToken;
import java.util.LinkedHashMap;
import java.util.Map;
// (c) Copyright 2017 Cloudera, Inc.
//
// 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 com.cloudera.director.aws.test;




/**
 * Convenience class to store instance template configs and tags.
 */
public class TestInstanceTemplate {

  private String templateName;
  private Map<String, String> configs;
  private Map<String, String> tags;

  public void addConfig(ConfigurationPropertyToken propertyToken, String value) {
    if (value != null) {
      configs.put(propertyToken.unwrap().getConfigKey(), value);
    }
  }

  public void addTag(String tagKey, String tagValue) {
    tags.put(tagKey, tagValue);
  }

  /**
   * Constructor, will set an owner tag and instance name prefix based
   * on the current user name.
   */
  public TestInstanceTemplate() {
    configs = new LinkedHashMap<>();
    tags = new LinkedHashMap<>();

    String username = System.getProperty("user.name");
    templateName = username + "-test";

    addConfig(INSTANCE_NAME_PREFIX, templateName);
// Path: provider/src/main/java/com/cloudera/director/aws/Tags.java
// public final class Tags {
// 
//   /**
//    * Director tags for cloud resources.
//    */
//   public enum ResourceTags {
//     /**
//      * The name of the resource.
//      */
//     RESOURCE_NAME("Name"),
// 
//     /**
//      * The virtual instance ID as generated by Cloudera Altus Director.
//      */
//     CLOUDERA_DIRECTOR_ID("Cloudera-Director-Id"),
// 
//     /**
//      * The virtual instance ID as generated by Cloudera Altus Director.
//      */
//     CLOUDERA_DIRECTOR_TEMPLATE_NAME("Cloudera-Director-Template-Name");
// 
//     private final String tagName;
// 
//     ResourceTags(String tagName) {
//       this.tagName = tagName;
//     }
// 
//     /**
//      * Gets the tag's key.
//      * Note that you should always call this method to get the tag's key, and not the
//      * {@link ResourceTags#valueOf(String)} method.
//      *
//      * @return tag's key name
//      */
//     public String getTagKey() {
//       return tagName;
//     }
//   }
// 
//   /**
//    * Director tags specifically for cloud instances.
//    */
//   public enum InstanceTags {
//     /**
//      * The instance owner.
//      */
//     OWNER("owner");
// 
//     private final String tagName;
// 
//     InstanceTags(String tagName) {
//       this.tagName = tagName;
//     }
// 
//     /**
//      * Gets the tag's key.
//      * Note that you should always call this method to get the tag's key, and not the
//      * {@link InstanceTags#valueOf(String)} method.
//      *
//      * @return tag's key name
//      */
//     public String getTagKey() {
//       return tagName;
//     }
//   }
// 
// 
//   /**
//    * Private constructor to prevent instantiation.
//    */
//   private Tags() {
//   }
// }


// Path: tests/src/test/java/com/cloudera/director/aws/test/TestInstanceTemplate.java
import static com.cloudera.director.spi.v2.model.InstanceTemplate.InstanceTemplateConfigurationPropertyToken.INSTANCE_NAME_PREFIX;
import com.cloudera.director.aws.Tags;
import com.cloudera.director.spi.v2.model.ConfigurationPropertyToken;
import java.util.LinkedHashMap;
import java.util.Map;

// (c) Copyright 2017 Cloudera, Inc.
//
// 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 com.cloudera.director.aws.test;




/**
 * Convenience class to store instance template configs and tags.
 */
public class TestInstanceTemplate {

  private String templateName;
  private Map<String, String> configs;
  private Map<String, String> tags;

  public void addConfig(ConfigurationPropertyToken propertyToken, String value) {
    if (value != null) {
      configs.put(propertyToken.unwrap().getConfigKey(), value);
    }
  }

  public void addTag(String tagKey, String tagValue) {
    tags.put(tagKey, tagValue);
  }

  /**
   * Constructor, will set an owner tag and instance name prefix based
   * on the current user name.
   */
  public TestInstanceTemplate() {
    configs = new LinkedHashMap<>();
    tags = new LinkedHashMap<>();

    String username = System.getProperty("user.name");
    templateName = username + "-test";

    addConfig(INSTANCE_NAME_PREFIX, templateName);
    addTag(Tags.InstanceTags.OWNER.getTagKey(), username);