Skip to content

Commit

Permalink
Update plugin metadata fixes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
gschueler committed Feb 23, 2013
1 parent d372c0a commit b5b6adc
Showing 1 changed file with 38 additions and 54 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import com.dtolabs.rundeck.core.plugins.configuration.*; import com.dtolabs.rundeck.core.plugins.configuration.*;
import com.dtolabs.rundeck.core.resources.ResourceModelSource; import com.dtolabs.rundeck.core.resources.ResourceModelSource;
import com.dtolabs.rundeck.core.resources.ResourceModelSourceFactory; import com.dtolabs.rundeck.core.resources.ResourceModelSourceFactory;
import com.dtolabs.rundeck.plugins.util.DescriptionBuilder;
import com.dtolabs.rundeck.plugins.util.PropertyBuilder;


import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
Expand All @@ -46,7 +48,7 @@
* *
* @author Greg Schueler <a href="mailto:greg@dtosolutions.com">greg@dtosolutions.com</a> * @author Greg Schueler <a href="mailto:greg@dtosolutions.com">greg@dtosolutions.com</a>
*/ */
@Plugin (name = "aws-ec2", service = "ResourceModelSource") @Plugin(name = "aws-ec2", service = "ResourceModelSource")
public class EC2ResourceModelSourceFactory implements ResourceModelSourceFactory, Describable { public class EC2ResourceModelSourceFactory implements ResourceModelSourceFactory, Describable {
public static final String PROVIDER_NAME = "aws-ec2"; public static final String PROVIDER_NAME = "aws-ec2";
private Framework framework; private Framework framework;
Expand All @@ -71,59 +73,41 @@ public ResourceModelSource createResourceModelSource(final Properties properties
return ec2ResourceModelSource; return ec2ResourceModelSource;
} }


private static List<Property> descriptionProperties = new ArrayList<Property>(); static Description DESC = DescriptionBuilder.builder()

.name(PROVIDER_NAME)

.title("AWS EC2 Resources")
static { .description("Produces nodes from AWS EC2")
descriptionProperties.add(PropertyUtil.string(ACCESS_KEY, "Access Key", "AWS Access Key", true, null));
descriptionProperties.add(PropertyUtil.string(SECRET_KEY, "Secret Key", "AWS Secret Key", true, null)); .property(PropertyUtil.string(ACCESS_KEY, "Access Key", "AWS Access Key", true, null))
descriptionProperties.add(PropertyUtil.integer(REFRESH_INTERVAL, "Refresh Interval", .property(PropertyUtil.string(SECRET_KEY, "Secret Key", "AWS Secret Key", true, null))
"Minimum time in seconds between API requests to AWS (default is 30)", false, "30")); .property(PropertyUtil.integer(REFRESH_INTERVAL, "Refresh Interval",
descriptionProperties.add(PropertyUtil.string(FILTER_PARAMS, "Filter Params", "AWS EC2 filters", false, null)); "Minimum time in seconds between API requests to AWS (default is 30)", false, "30"))
descriptionProperties.add(PropertyUtil.string(ENDPOINT, "Endpoint", "AWS EC2 Endpoint, or blank for default", .property(PropertyUtil.string(FILTER_PARAMS, "Filter Params", "AWS EC2 filters", false, null))
false, null)); .property(PropertyUtil.string(ENDPOINT, "Endpoint", "AWS EC2 Endpoint, or blank for default", false, null))
descriptionProperties.add(PropertyUtil.string(MAPPING_PARAMS, "Mapping Params", .property(PropertyUtil.string(MAPPING_PARAMS, "Mapping Params",
"Property mapping definitions. Specify multiple mappings " "Property mapping definitions. Specify multiple mappings in the form " +
+ "in the form \"attribute.name.selector=selector\" or \"attribute.name.default=value\", separated by \";\"", "\"attributeName.selector=selector\" or \"attributeName.default=value\", " +
false, null)); "separated by \";\"",
descriptionProperties.add(PropertyUtil.string(MAPPING_FILE, "Mapping File", "Property mapping File", false, false, null))
null, new PropertyValidator() { .property(PropertyUtil.string(MAPPING_FILE, "Mapping File", "Property mapping File", false, null,
public boolean isValid(final String s) throws ValidationException { new PropertyValidator() {
if (!new File(s).isFile()) { public boolean isValid(final String s) throws ValidationException {
throw new ValidationException("File does not exist: " + s); if (!new File(s).isFile()) {
} throw new ValidationException("File does not exist: " + s);
return true; }
} return true;
})); }
descriptionProperties.add(PropertyUtil.bool(USE_DEFAULT_MAPPING, "Use Default Mapping", }))
"Start with default mapping definition. (Defaults will automatically be used if no others are defined.)", .property(PropertyUtil.bool(USE_DEFAULT_MAPPING, "Use Default Mapping",
false, "true")); "Start with default mapping definition. (Defaults will automatically be used if no others are " +
descriptionProperties.add(PropertyUtil.bool(RUNNING_ONLY, "Only Running Instances", "defined.)",
"Include Running state instances only. If false, all instances will be returned that match your filters.", false, "true"))
false, "true")); .property(PropertyUtil.bool(RUNNING_ONLY, "Only Running Instances",
} "Include Running state instances only. If false, all instances will be returned that match your " +

"filters.",
static Description DESC = new Description() { false, "true"))
public String getName() {
return PROVIDER_NAME; .build();
}

public String getTitle() {
return "AWS EC2 Resources";
}

public String getDescription() {
return "Produces nodes from AWS EC2";
}

public List<Property> getProperties() {
return descriptionProperties;
}

public Map<String, String> getPropertiesMapping() {
return null;
}
};


public Description getDescription() { public Description getDescription() {
return DESC; return DESC;
Expand Down

0 comments on commit b5b6adc

Please sign in to comment.