Search in sources :

Example 1 with Rules

use of com.contrastsecurity.models.Rules in project contrast-continuous-application-security-plugin by jenkinsci.

the class VulnerabilityTrendHelper method saveRules.

/**
 * Retrieves the enabled rules for an organization
 *
 * @param sdk              Contrast SDK object
 * @param organizationUuid uuid of the organization
 */
public static List<VulnerabilityType> saveRules(ContrastSDK sdk, String organizationUuid) {
    Rules rules;
    List<VulnerabilityType> vulnerabilityTypes = new ArrayList<>();
    try {
        rules = sdk.getRules(organizationUuid);
    } catch (IOException | UnauthorizedException e) {
        return vulnerabilityTypes;
    }
    for (Rules.Rule rule : rules.getRules()) {
        vulnerabilityTypes.add(new VulnerabilityType(rule.getName(), rule.getTitle()));
    }
    return vulnerabilityTypes;
}
Also used : UnauthorizedException(com.contrastsecurity.exceptions.UnauthorizedException) IOException(java.io.IOException) Rules(com.contrastsecurity.models.Rules)

Aggregations

UnauthorizedException (com.contrastsecurity.exceptions.UnauthorizedException)1 Rules (com.contrastsecurity.models.Rules)1 IOException (java.io.IOException)1