Interface AutomationConfigStore
- All Known Implementing Classes:
CachingAutomationConfigStore,JiraAutomationConfigStore
public interface AutomationConfigStore
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddLabel(TenantContext context, Long ruleId, Long labelId) Adds a new rule label to rulecom.codebarrel.automation.api.config.RuleConfigBeancreateRule(TenantContext context, com.codebarrel.automation.api.config.RuleConfigBean createRequest) Creates a new rule.voiddelete(TenantContext context, Long ruleId) Deletes the rule with the id provided.voiddeleteAssociatedRuleProjects(TenantContext context, Long ruleId, String... projectIds) Deletes the associated project ids from a rulevoiddisableRule(TenantContext context, Long ruleId) This is an 'internal' method to be called by the rule executor when an execution loop may have been detected.List<com.codebarrel.automation.api.config.RuleConfigBean> getBillableRules(TenantContext context) Returns rules that are considered billable i.e.longgetEnabledRuleCount(TenantContext context) Counts enabled rules on a tenant.List<com.codebarrel.automation.api.config.RuleConfigBean> getProjectRules(TenantContext context, String... projectIds) Get rules restricted to the the given projects only, unlike getRules() rules without a project restriction will be ignored.Optional<com.codebarrel.automation.api.config.RuleConfigBean> getRule(TenantContext context, Long ruleId) Retrieve a rule by idgetRuleNames(List<Long> ruleIds) Retrieve rule names by rule idsList<com.codebarrel.automation.api.config.RuleConfigBean> getRules(TenantContext context, String... projectIds) Get all rules for the given projects, and also rules without a project restriction.List<com.codebarrel.automation.api.config.RuleConfigBean> getRules(TenantContext context, Set<String> projectIds) List<com.codebarrel.automation.api.config.RuleConfigBean> getRulesWithTag(TenantContext context, Tag tag) Returns all automation rules tagged with the provided tag.getRulesWithTagGlobally(Environment environment, Tag tag, com.codebarrel.automation.api.config.RuleState state) Returns all automation rules tagged with the provided tag irrelevant of tenant contextlonggetTotalRuleCount(TenantContext context) Returns a count of all the rules for tenantbooleanhasRulesInScope(TenantContext context, Long projectId) Whether there are any rule specifically in the given scopevoidremoveLabel(TenantContext context, Long ruleId, Long labelId) Removes a rule labelcom.codebarrel.automation.api.config.RuleConfigBeanupdateRule(TenantContext context, Long ruleId, com.codebarrel.automation.api.config.RuleConfigBean updateRequest) Updates the rule with the provided configuration.
-
Method Details
-
getRules
List<com.codebarrel.automation.api.config.RuleConfigBean> getRules(TenantContext context, String... projectIds) Get all rules for the given projects, and also rules without a project restriction.- Parameters:
context- The tenant contextprojectIds- The project ids to look up rules for- Returns:
- List of automation rules in this project and tenant
-
getRules
List<com.codebarrel.automation.api.config.RuleConfigBean> getRules(TenantContext context, Set<String> projectIds) -
getProjectRules
List<com.codebarrel.automation.api.config.RuleConfigBean> getProjectRules(TenantContext context, String... projectIds) Get rules restricted to the the given projects only, unlike getRules() rules without a project restriction will be ignored. -
getBillableRules
Returns rules that are considered billable i.e. multi-project and global rules- Parameters:
context- Tenant context- Returns:
- List of billable automation rules for the tenant
-
getRule
Optional<com.codebarrel.automation.api.config.RuleConfigBean> getRule(TenantContext context, Long ruleId) Retrieve a rule by id- Parameters:
context- The tenant contextruleId- The id of the rule to retrieve- Returns:
- the automation rule or empty if none exists.
-
getRuleNames
Retrieve rule names by rule ids- Parameters:
ruleIds- The ids of rules to retrieve- Returns:
- Map of rule id to rule name
-
getRulesWithTagGlobally
List<TenantRuleId> getRulesWithTagGlobally(Environment environment, Tag tag, @Nullable com.codebarrel.automation.api.config.RuleState state) Returns all automation rules tagged with the provided tag irrelevant of tenant contextUse with care! Generally you should use
getRulesWithTag(TenantContext, Tag)!- Parameters:
environment- The db environment to run this query intag- The tag to search forstate- Only retrieve rules matching this state. Maybe null for all states.- Returns:
- List of matching ruleIds the tag
-
getRulesWithTag
List<com.codebarrel.automation.api.config.RuleConfigBean> getRulesWithTag(TenantContext context, Tag tag) Returns all automation rules tagged with the provided tag.- Parameters:
context- The tenant contexttag- The tag to search for- Returns:
- List of rules matching the tag
-
createRule
com.codebarrel.automation.api.config.RuleConfigBean createRule(TenantContext context, com.codebarrel.automation.api.config.RuleConfigBean createRequest) Creates a new rule.- Parameters:
context- The tenant contextcreateRequest- Data needed to create the new rule- Returns:
- The newly created rule or an error collection
-
addLabel
Adds a new rule label to rule- Parameters:
context- The tenant contextruleId- the id of the rule to update
-
removeLabel
Removes a rule label- Parameters:
context- The tenant contextruleId- the id of the rule to update
-
updateRule
com.codebarrel.automation.api.config.RuleConfigBean updateRule(TenantContext context, Long ruleId, com.codebarrel.automation.api.config.RuleConfigBean updateRequest) Updates the rule with the provided configuration.- Parameters:
context- The tenant contextruleId- The id of the rule to udpateupdateRequest- Data needed to update the rule- Returns:
- The updated rule or an error collection
-
disableRule
This is an 'internal' method to be called by the rule executor when an execution loop may have been detected.- Parameters:
context- The tenant contextruleId- The id of the rule to disable
-
delete
Deletes the rule with the id provided.- Parameters:
context- The tenant contextruleId- The id of the rule to delete
-
deleteAssociatedRuleProjects
Deletes the associated project ids from a rule- Parameters:
context- The tenant contextruleId- The id of the rule to delete projects fromprojectIds- List of projects to remove from rule
-
getTotalRuleCount
Returns a count of all the rules for tenant- Parameters:
context- The tenant context- Returns:
- Count of all rules
-
hasRulesInScope
Whether there are any rule specifically in the given scope- Parameters:
context- The tenant contextprojectId- The scope to retrieve rules for
-
getEnabledRuleCount
Counts enabled rules on a tenant.- Parameters:
context- The tenant- Returns:
- count of enabled rules
-