1. Registry
  2. Packages
  3. Sonarqube Provider
  4. API Docs
  5. getMeasures
Viewing docs for sonarqube 0.16.26
published on Friday, Oct 2, 2026 by jdamata
sonarqube
Viewing docs for sonarqube 0.16.26
published on Friday, Oct 2, 2026 by jdamata

    Provides a Sonarqube Measures data source. Use this to read metric measures for a component.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as sonarqube from "@pulumi/sonarqube";
    
    const myProject = sonarqube.getMeasures({
        component: "my_project",
        metricKeys: [
            "coverage",
            "reliability_rating",
            "security_hotspots",
        ],
    });
    export const coverage = myProject.then(myProject => myProject.measures);
    
    import pulumi
    import pulumi_sonarqube as sonarqube
    
    my_project = sonarqube.get_measures(component="my_project",
        metric_keys=[
            "coverage",
            "reliability_rating",
            "security_hotspots",
        ])
    pulumi.export("coverage", my_project.measures)
    
    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 {
    		myProject, err := sonarqube.GetMeasures(ctx, &sonarqube.GetMeasuresArgs{
    			Component: "my_project",
    			MetricKeys: []string{
    				"coverage",
    				"reliability_rating",
    				"security_hotspots",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("coverage", myProject.Measures)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Sonarqube = Pulumi.Sonarqube;
    
    return await Deployment.RunAsync(() => 
    {
        var myProject = Sonarqube.GetMeasures.Invoke(new()
        {
            Component = "my_project",
            MetricKeys = new[]
            {
                "coverage",
                "reliability_rating",
                "security_hotspots",
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["coverage"] = myProject.Apply(getMeasuresResult => getMeasuresResult.Measures),
        };
    });
    
    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.GetMeasuresArgs;
    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 myProject = SonarqubeFunctions.getMeasures(GetMeasuresArgs.builder()
                .component("my_project")
                .metricKeys(            
                    "coverage",
                    "reliability_rating",
                    "security_hotspots")
                .build());
    
            ctx.export("coverage", myProject.measures());
        }
    }
    
    variables:
      myProject:
        fn::invoke:
          function: sonarqube:getMeasures
          arguments:
            component: my_project
            metricKeys:
              - coverage
              - reliability_rating
              - security_hotspots
    outputs:
      coverage: ${myProject.measures}
    
    Example coming soon!
    

    Using getMeasures

    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 getMeasures(args: GetMeasuresArgs, opts?: InvokeOptions): Promise<GetMeasuresResult>
    function getMeasuresOutput(args: GetMeasuresOutputArgs, opts?: InvokeOutputOptions): Output<GetMeasuresResult>
    def get_measures(component: Optional[str] = None,
                     id: Optional[str] = None,
                     metric_keys: Optional[Sequence[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> GetMeasuresResult
    def get_measures_output(component: pulumi.Input[Optional[str]] = None,
                     id: pulumi.Input[Optional[str]] = None,
                     metric_keys: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
                     opts: Optional[InvokeOutputOptions] = None) -> Output[GetMeasuresResult]
    func GetMeasures(ctx *Context, args *GetMeasuresArgs, opts ...InvokeOption) (*GetMeasuresResult, error)
    func GetMeasuresOutput(ctx *Context, args *GetMeasuresOutputArgs, opts ...InvokeOption) GetMeasuresResultOutput

    > Note: This function is named GetMeasures in the Go SDK.

    public static class GetMeasures 
    {
        public static Task<GetMeasuresResult> InvokeAsync(GetMeasuresArgs args, InvokeOptions? opts = null)
        public static Output<GetMeasuresResult> Invoke(GetMeasuresInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetMeasuresResult> Invoke(GetMeasuresInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetMeasuresResult> getMeasures(GetMeasuresArgs args, InvokeOptions options)
    public static Output<GetMeasuresResult> getMeasures(GetMeasuresArgs args, InvokeOptions options)
    public static Output<GetMeasuresResult> getMeasures(GetMeasuresArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: sonarqube:index/getMeasures:getMeasures
      arguments:
        # arguments dictionary
    data "sonarqube_get_measures" "name" {
        # arguments
    }

    The following arguments are supported:

    Component string
    The key of the component (project) to retrieve measures for.
    MetricKeys List<string>
    List of metric keys to retrieve.
    Id string
    The ID of this resource.
    Component string
    The key of the component (project) to retrieve measures for.
    MetricKeys []string
    List of metric keys to retrieve.
    Id string
    The ID of this resource.
    component string
    The key of the component (project) to retrieve measures for.
    metric_keys list(string)
    List of metric keys to retrieve.
    id string
    The ID of this resource.
    component String
    The key of the component (project) to retrieve measures for.
    metricKeys List<String>
    List of metric keys to retrieve.
    id String
    The ID of this resource.
    component string
    The key of the component (project) to retrieve measures for.
    metricKeys string[]
    List of metric keys to retrieve.
    id string
    The ID of this resource.
    component str
    The key of the component (project) to retrieve measures for.
    metric_keys Sequence[str]
    List of metric keys to retrieve.
    id str
    The ID of this resource.
    component String
    The key of the component (project) to retrieve measures for.
    metricKeys List<String>
    List of metric keys to retrieve.
    id String
    The ID of this resource.

    getMeasures Result

    The following output properties are available:

    Component string
    The key of the component (project) to retrieve measures for.
    Id string
    The ID of this resource.
    Measures List<ImmutableDictionary<string, string>>
    List of measures returned by SonarQube.
    MetricKeys List<string>
    List of metric keys to retrieve.
    Component string
    The key of the component (project) to retrieve measures for.
    Id string
    The ID of this resource.
    Measures []map[string]string
    List of measures returned by SonarQube.
    MetricKeys []string
    List of metric keys to retrieve.
    component string
    The key of the component (project) to retrieve measures for.
    id string
    The ID of this resource.
    measures list(map(string))
    List of measures returned by SonarQube.
    metric_keys list(string)
    List of metric keys to retrieve.
    component String
    The key of the component (project) to retrieve measures for.
    id String
    The ID of this resource.
    measures List<Map<String,String>>
    List of measures returned by SonarQube.
    metricKeys List<String>
    List of metric keys to retrieve.
    component string
    The key of the component (project) to retrieve measures for.
    id string
    The ID of this resource.
    measures {[key: string]: string}[]
    List of measures returned by SonarQube.
    metricKeys string[]
    List of metric keys to retrieve.
    component str
    The key of the component (project) to retrieve measures for.
    id str
    The ID of this resource.
    measures Sequence[Mapping[str, str]]
    List of measures returned by SonarQube.
    metric_keys Sequence[str]
    List of metric keys to retrieve.
    component String
    The key of the component (project) to retrieve measures for.
    id String
    The ID of this resource.
    measures List<Map<String>>
    List of measures returned by SonarQube.
    metricKeys List<String>
    List of metric keys to retrieve.

    Package Details

    Repository
    sonarqube jdamata/terraform-provider-sonarqube
    License
    Notes
    This Pulumi package is based on the sonarqube Terraform Provider.
    sonarqube
    Viewing docs for sonarqube 0.16.26
    published on Friday, Oct 2, 2026 by jdamata

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial