sonarqube 0.16.14 published on Monday, Apr 14, 2025 by jdamata
sonarqube.getRule
Explore with Pulumi AI
Use this data source to get a Sonarqube rule resource
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as sonarqube from "@pulumi/sonarqube";
const rule = sonarqube.getRule({
key: "squid:forbidSonar",
});
import pulumi
import pulumi_sonarqube as sonarqube
rule = sonarqube.get_rule(key="squid:forbidSonar")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/sonarqube/sonarqube"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sonarqube.LookupRule(ctx, &sonarqube.LookupRuleArgs{
Key: "squid:forbidSonar",
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Sonarqube = Pulumi.Sonarqube;
return await Deployment.RunAsync(() =>
{
var rule = Sonarqube.GetRule.Invoke(new()
{
Key = "squid:forbidSonar",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.sonarqube.SonarqubeFunctions;
import com.pulumi.sonarqube.inputs.GetRuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var rule = SonarqubeFunctions.getRule(GetRuleArgs.builder()
.key("squid:forbidSonar")
.build());
}
}
variables:
rule:
fn::invoke:
function: sonarqube:getRule
arguments:
key: squid:forbidSonar
Using getRule
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getRule(args: GetRuleArgs, opts?: InvokeOptions): Promise<GetRuleResult>
function getRuleOutput(args: GetRuleOutputArgs, opts?: InvokeOptions): Output<GetRuleResult>
def get_rule(id: Optional[str] = None,
key: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetRuleResult
def get_rule_output(id: Optional[pulumi.Input[str]] = None,
key: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetRuleResult]
func LookupRule(ctx *Context, args *LookupRuleArgs, opts ...InvokeOption) (*LookupRuleResult, error)
func LookupRuleOutput(ctx *Context, args *LookupRuleOutputArgs, opts ...InvokeOption) LookupRuleResultOutput
> Note: This function is named LookupRule
in the Go SDK.
public static class GetRule
{
public static Task<GetRuleResult> InvokeAsync(GetRuleArgs args, InvokeOptions? opts = null)
public static Output<GetRuleResult> Invoke(GetRuleInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetRuleResult> getRule(GetRuleArgs args, InvokeOptions options)
public static Output<GetRuleResult> getRule(GetRuleArgs args, InvokeOptions options)
fn::invoke:
function: sonarqube:index/getRule:getRule
arguments:
# arguments dictionary
The following arguments are supported:
getRule Result
The following output properties are available:
- Id string
- The ID of this resource.
- Key string
- The key of the sonarqube rule. Should be \n\n:\n\n. https://next.sonarqube.com/sonarqube/web_api/api/rules?query=api%2Frules%2Fcreate
- Markdown
Description string - Rule description
- Name string
- Rule name
- Severity string
- Rule severity
- Status string
- Rule status
- Template
Key string - Key of the template rule
- Type string
- Rule type
- Id string
- The ID of this resource.
- Key string
- The key of the sonarqube rule. Should be \n\n:\n\n. https://next.sonarqube.com/sonarqube/web_api/api/rules?query=api%2Frules%2Fcreate
- Markdown
Description string - Rule description
- Name string
- Rule name
- Severity string
- Rule severity
- Status string
- Rule status
- Template
Key string - Key of the template rule
- Type string
- Rule type
- id String
- The ID of this resource.
- key String
- The key of the sonarqube rule. Should be \n\n:\n\n. https://next.sonarqube.com/sonarqube/web_api/api/rules?query=api%2Frules%2Fcreate
- markdown
Description String - Rule description
- name String
- Rule name
- severity String
- Rule severity
- status String
- Rule status
- template
Key String - Key of the template rule
- type String
- Rule type
- id string
- The ID of this resource.
- key string
- The key of the sonarqube rule. Should be \n\n:\n\n. https://next.sonarqube.com/sonarqube/web_api/api/rules?query=api%2Frules%2Fcreate
- markdown
Description string - Rule description
- name string
- Rule name
- severity string
- Rule severity
- status string
- Rule status
- template
Key string - Key of the template rule
- type string
- Rule type
- id str
- The ID of this resource.
- key str
- The key of the sonarqube rule. Should be \n\n:\n\n. https://next.sonarqube.com/sonarqube/web_api/api/rules?query=api%2Frules%2Fcreate
- markdown_
description str - Rule description
- name str
- Rule name
- severity str
- Rule severity
- status str
- Rule status
- template_
key str - Key of the template rule
- type str
- Rule type
- id String
- The ID of this resource.
- key String
- The key of the sonarqube rule. Should be \n\n:\n\n. https://next.sonarqube.com/sonarqube/web_api/api/rules?query=api%2Frules%2Fcreate
- markdown
Description String - Rule description
- name String
- Rule name
- severity String
- Rule severity
- status String
- Rule status
- template
Key String - Key of the template rule
- type String
- Rule type
Package Details
- Repository
- sonarqube jdamata/terraform-provider-sonarqube
- License
- Notes
- This Pulumi package is based on the
sonarqube
Terraform Provider.