1. Packages
  2. Sonarqube Provider
  3. API Docs
  4. Rule
sonarqube 0.16.14 published on Monday, Apr 14, 2025 by jdamata

sonarqube.Rule

Explore with Pulumi AI

Provides a Sonarqube Rules resource. This can be used to manage Sonarqube rules.

Create Rule Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Rule(name: string, args: RuleArgs, opts?: CustomResourceOptions);
@overload
def Rule(resource_name: str,
         args: RuleArgs,
         opts: Optional[ResourceOptions] = None)

@overload
def Rule(resource_name: str,
         opts: Optional[ResourceOptions] = None,
         custom_key: Optional[str] = None,
         markdown_description: Optional[str] = None,
         template_key: Optional[str] = None,
         name: Optional[str] = None,
         params: Optional[str] = None,
         prevent_reactivation: Optional[str] = None,
         rule_id: Optional[str] = None,
         severity: Optional[str] = None,
         status: Optional[str] = None,
         type: Optional[str] = None)
func NewRule(ctx *Context, name string, args RuleArgs, opts ...ResourceOption) (*Rule, error)
public Rule(string name, RuleArgs args, CustomResourceOptions? opts = null)
public Rule(String name, RuleArgs args)
public Rule(String name, RuleArgs args, CustomResourceOptions options)
type: sonarqube:Rule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. RuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. RuleArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. RuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. RuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. RuleArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var ruleResource = new Sonarqube.Rule("ruleResource", new()
{
    CustomKey = "string",
    MarkdownDescription = "string",
    TemplateKey = "string",
    Name = "string",
    Params = "string",
    PreventReactivation = "string",
    RuleId = "string",
    Severity = "string",
    Status = "string",
    Type = "string",
});
Copy
example, err := sonarqube.NewRule(ctx, "ruleResource", &sonarqube.RuleArgs{
CustomKey: pulumi.String("string"),
MarkdownDescription: pulumi.String("string"),
TemplateKey: pulumi.String("string"),
Name: pulumi.String("string"),
Params: pulumi.String("string"),
PreventReactivation: pulumi.String("string"),
RuleId: pulumi.String("string"),
Severity: pulumi.String("string"),
Status: pulumi.String("string"),
Type: pulumi.String("string"),
})
Copy
var ruleResource = new Rule("ruleResource", RuleArgs.builder()
    .customKey("string")
    .markdownDescription("string")
    .templateKey("string")
    .name("string")
    .params("string")
    .preventReactivation("string")
    .ruleId("string")
    .severity("string")
    .status("string")
    .type("string")
    .build());
Copy
rule_resource = sonarqube.Rule("ruleResource",
    custom_key="string",
    markdown_description="string",
    template_key="string",
    name="string",
    params="string",
    prevent_reactivation="string",
    rule_id="string",
    severity="string",
    status="string",
    type="string")
Copy
const ruleResource = new sonarqube.Rule("ruleResource", {
    customKey: "string",
    markdownDescription: "string",
    templateKey: "string",
    name: "string",
    params: "string",
    preventReactivation: "string",
    ruleId: "string",
    severity: "string",
    status: "string",
    type: "string",
});
Copy
type: sonarqube:Rule
properties:
    customKey: string
    markdownDescription: string
    name: string
    params: string
    preventReactivation: string
    ruleId: string
    severity: string
    status: string
    templateKey: string
    type: string
Copy

Rule Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Rule resource accepts the following input properties:

CustomKey This property is required. string
key of the custom rule should only contain : a-z, 0-9, _
MarkdownDescription This property is required. string
Rule description
TemplateKey This property is required. string
Key of the template rule in order to create a custom rule (mandatory for custom rule) - Example values
Name string
Rule name
Params string
Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) - parameter order: expression=value;filePattern=value;message=value
PreventReactivation string
If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned - Possible values

  • true, false, yes, no
RuleId string
Severity string
Rule severity - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER
Status string
Rule status - Possible values - BETA, DEPRECATED, READY, REMOVED - Default value - READY
Type string
Rule type - Possible values - CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT
CustomKey This property is required. string
key of the custom rule should only contain : a-z, 0-9, _
MarkdownDescription This property is required. string
Rule description
TemplateKey This property is required. string
Key of the template rule in order to create a custom rule (mandatory for custom rule) - Example values
Name string
Rule name
Params string
Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) - parameter order: expression=value;filePattern=value;message=value
PreventReactivation string
If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned - Possible values

  • true, false, yes, no
RuleId string
Severity string
Rule severity - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER
Status string
Rule status - Possible values - BETA, DEPRECATED, READY, REMOVED - Default value - READY
Type string
Rule type - Possible values - CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT
customKey This property is required. String
key of the custom rule should only contain : a-z, 0-9, _
markdownDescription This property is required. String
Rule description
templateKey This property is required. String
Key of the template rule in order to create a custom rule (mandatory for custom rule) - Example values
name String
Rule name
params String
Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) - parameter order: expression=value;filePattern=value;message=value
preventReactivation String
If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned - Possible values

  • true, false, yes, no
ruleId String
severity String
Rule severity - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER
status String
Rule status - Possible values - BETA, DEPRECATED, READY, REMOVED - Default value - READY
type String
Rule type - Possible values - CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT
customKey This property is required. string
key of the custom rule should only contain : a-z, 0-9, _
markdownDescription This property is required. string
Rule description
templateKey This property is required. string
Key of the template rule in order to create a custom rule (mandatory for custom rule) - Example values
name string
Rule name
params string
Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) - parameter order: expression=value;filePattern=value;message=value
preventReactivation string
If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned - Possible values

  • true, false, yes, no
ruleId string
severity string
Rule severity - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER
status string
Rule status - Possible values - BETA, DEPRECATED, READY, REMOVED - Default value - READY
type string
Rule type - Possible values - CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT
custom_key This property is required. str
key of the custom rule should only contain : a-z, 0-9, _
markdown_description This property is required. str
Rule description
template_key This property is required. str
Key of the template rule in order to create a custom rule (mandatory for custom rule) - Example values
name str
Rule name
params str
Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) - parameter order: expression=value;filePattern=value;message=value
prevent_reactivation str
If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned - Possible values

  • true, false, yes, no
rule_id str
severity str
Rule severity - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER
status str
Rule status - Possible values - BETA, DEPRECATED, READY, REMOVED - Default value - READY
type str
Rule type - Possible values - CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT
customKey This property is required. String
key of the custom rule should only contain : a-z, 0-9, _
markdownDescription This property is required. String
Rule description
templateKey This property is required. String
Key of the template rule in order to create a custom rule (mandatory for custom rule) - Example values
name String
Rule name
params String
Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) - parameter order: expression=value;filePattern=value;message=value
preventReactivation String
If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned - Possible values

  • true, false, yes, no
ruleId String
severity String
Rule severity - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER
status String
Rule status - Possible values - BETA, DEPRECATED, READY, REMOVED - Default value - READY
type String
Rule type - Possible values - CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT

Outputs

All input properties are implicitly available as output properties. Additionally, the Rule resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing Rule Resource

Get an existing Rule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: RuleState, opts?: CustomResourceOptions): Rule
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        custom_key: Optional[str] = None,
        markdown_description: Optional[str] = None,
        name: Optional[str] = None,
        params: Optional[str] = None,
        prevent_reactivation: Optional[str] = None,
        rule_id: Optional[str] = None,
        severity: Optional[str] = None,
        status: Optional[str] = None,
        template_key: Optional[str] = None,
        type: Optional[str] = None) -> Rule
func GetRule(ctx *Context, name string, id IDInput, state *RuleState, opts ...ResourceOption) (*Rule, error)
public static Rule Get(string name, Input<string> id, RuleState? state, CustomResourceOptions? opts = null)
public static Rule get(String name, Output<String> id, RuleState state, CustomResourceOptions options)
resources:  _:    type: sonarqube:Rule    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
CustomKey string
key of the custom rule should only contain : a-z, 0-9, _
MarkdownDescription string
Rule description
Name string
Rule name
Params string
Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) - parameter order: expression=value;filePattern=value;message=value
PreventReactivation string
If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned - Possible values

  • true, false, yes, no
RuleId string
Severity string
Rule severity - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER
Status string
Rule status - Possible values - BETA, DEPRECATED, READY, REMOVED - Default value - READY
TemplateKey string
Key of the template rule in order to create a custom rule (mandatory for custom rule) - Example values
Type string
Rule type - Possible values - CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT
CustomKey string
key of the custom rule should only contain : a-z, 0-9, _
MarkdownDescription string
Rule description
Name string
Rule name
Params string
Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) - parameter order: expression=value;filePattern=value;message=value
PreventReactivation string
If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned - Possible values

  • true, false, yes, no
RuleId string
Severity string
Rule severity - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER
Status string
Rule status - Possible values - BETA, DEPRECATED, READY, REMOVED - Default value - READY
TemplateKey string
Key of the template rule in order to create a custom rule (mandatory for custom rule) - Example values
Type string
Rule type - Possible values - CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT
customKey String
key of the custom rule should only contain : a-z, 0-9, _
markdownDescription String
Rule description
name String
Rule name
params String
Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) - parameter order: expression=value;filePattern=value;message=value
preventReactivation String
If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned - Possible values

  • true, false, yes, no
ruleId String
severity String
Rule severity - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER
status String
Rule status - Possible values - BETA, DEPRECATED, READY, REMOVED - Default value - READY
templateKey String
Key of the template rule in order to create a custom rule (mandatory for custom rule) - Example values
type String
Rule type - Possible values - CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT
customKey string
key of the custom rule should only contain : a-z, 0-9, _
markdownDescription string
Rule description
name string
Rule name
params string
Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) - parameter order: expression=value;filePattern=value;message=value
preventReactivation string
If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned - Possible values

  • true, false, yes, no
ruleId string
severity string
Rule severity - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER
status string
Rule status - Possible values - BETA, DEPRECATED, READY, REMOVED - Default value - READY
templateKey string
Key of the template rule in order to create a custom rule (mandatory for custom rule) - Example values
type string
Rule type - Possible values - CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT
custom_key str
key of the custom rule should only contain : a-z, 0-9, _
markdown_description str
Rule description
name str
Rule name
params str
Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) - parameter order: expression=value;filePattern=value;message=value
prevent_reactivation str
If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned - Possible values

  • true, false, yes, no
rule_id str
severity str
Rule severity - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER
status str
Rule status - Possible values - BETA, DEPRECATED, READY, REMOVED - Default value - READY
template_key str
Key of the template rule in order to create a custom rule (mandatory for custom rule) - Example values
type str
Rule type - Possible values - CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT
customKey String
key of the custom rule should only contain : a-z, 0-9, _
markdownDescription String
Rule description
name String
Rule name
params String
Parameters as semi-colon list of =, for example 'params=key1=v1;key2=v2' (Only for custom rule) - parameter order: expression=value;filePattern=value;message=value
preventReactivation String
If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned - Possible values

  • true, false, yes, no
ruleId String
severity String
Rule severity - Possible values - INFO, MINOR, MAJOR, CRITICAL, BLOCKER
status String
Rule status - Possible values - BETA, DEPRECATED, READY, REMOVED - Default value - READY
templateKey String
Key of the template rule in order to create a custom rule (mandatory for custom rule) - Example values
type String
Rule type - Possible values - CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT

Package Details

Repository
sonarqube jdamata/terraform-provider-sonarqube
License
Notes
This Pulumi package is based on the sonarqube Terraform Provider.