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

sonarqube.Portfolio

Explore with Pulumi AI

sonarqube logo
sonarqube 0.16.14 published on Monday, Apr 14, 2025 by jdamata

    Provides a Sonarqube Portfolio resource. This can be used to create and manage Sonarqube Portfolio. Note that the SonarQube API for Portfolios is called views

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as sonarqube from "@pulumi/sonarqube";
    
    const main = new sonarqube.Portfolio("main", {
        description: "portfolio-description",
        key: "portfolio-key",
    });
    
    import pulumi
    import pulumi_sonarqube as sonarqube
    
    main = sonarqube.Portfolio("main",
        description="portfolio-description",
        key="portfolio-key")
    
    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.NewPortfolio(ctx, "main", &sonarqube.PortfolioArgs{
    			Description: pulumi.String("portfolio-description"),
    			Key:         pulumi.String("portfolio-key"),
    		})
    		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 main = new Sonarqube.Portfolio("main", new()
        {
            Description = "portfolio-description",
            Key = "portfolio-key",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.sonarqube.Portfolio;
    import com.pulumi.sonarqube.PortfolioArgs;
    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) {
            var main = new Portfolio("main", PortfolioArgs.builder()
                .description("portfolio-description")
                .key("portfolio-key")
                .build());
    
        }
    }
    
    resources:
      main:
        type: sonarqube:Portfolio
        properties:
          description: portfolio-description
          key: portfolio-key
    

    Create Portfolio Resource

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

    Constructor syntax

    new Portfolio(name: string, args: PortfolioArgs, opts?: CustomResourceOptions);
    @overload
    def Portfolio(resource_name: str,
                  args: PortfolioArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def Portfolio(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  description: Optional[str] = None,
                  key: Optional[str] = None,
                  branch: Optional[str] = None,
                  name: Optional[str] = None,
                  portfolio_id: Optional[str] = None,
                  regexp: Optional[str] = None,
                  selected_projects: Optional[Sequence[PortfolioSelectedProjectArgs]] = None,
                  selection_mode: Optional[str] = None,
                  tags: Optional[Sequence[str]] = None,
                  visibility: Optional[str] = None)
    func NewPortfolio(ctx *Context, name string, args PortfolioArgs, opts ...ResourceOption) (*Portfolio, error)
    public Portfolio(string name, PortfolioArgs args, CustomResourceOptions? opts = null)
    public Portfolio(String name, PortfolioArgs args)
    public Portfolio(String name, PortfolioArgs args, CustomResourceOptions options)
    
    type: sonarqube:Portfolio
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args PortfolioArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args PortfolioArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args PortfolioArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PortfolioArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PortfolioArgs
    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 portfolioResource = new Sonarqube.Portfolio("portfolioResource", new()
    {
        Description = "string",
        Key = "string",
        Branch = "string",
        Name = "string",
        PortfolioId = "string",
        Regexp = "string",
        SelectedProjects = new[]
        {
            new Sonarqube.Inputs.PortfolioSelectedProjectArgs
            {
                ProjectKey = "string",
                SelectedBranches = new[]
                {
                    "string",
                },
            },
        },
        SelectionMode = "string",
        Tags = new[]
        {
            "string",
        },
        Visibility = "string",
    });
    
    example, err := sonarqube.NewPortfolio(ctx, "portfolioResource", &sonarqube.PortfolioArgs{
    	Description: pulumi.String("string"),
    	Key:         pulumi.String("string"),
    	Branch:      pulumi.String("string"),
    	Name:        pulumi.String("string"),
    	PortfolioId: pulumi.String("string"),
    	Regexp:      pulumi.String("string"),
    	SelectedProjects: sonarqube.PortfolioSelectedProjectArray{
    		&sonarqube.PortfolioSelectedProjectArgs{
    			ProjectKey: pulumi.String("string"),
    			SelectedBranches: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    		},
    	},
    	SelectionMode: pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Visibility: pulumi.String("string"),
    })
    
    var portfolioResource = new Portfolio("portfolioResource", PortfolioArgs.builder()
        .description("string")
        .key("string")
        .branch("string")
        .name("string")
        .portfolioId("string")
        .regexp("string")
        .selectedProjects(PortfolioSelectedProjectArgs.builder()
            .projectKey("string")
            .selectedBranches("string")
            .build())
        .selectionMode("string")
        .tags("string")
        .visibility("string")
        .build());
    
    portfolio_resource = sonarqube.Portfolio("portfolioResource",
        description="string",
        key="string",
        branch="string",
        name="string",
        portfolio_id="string",
        regexp="string",
        selected_projects=[{
            "project_key": "string",
            "selected_branches": ["string"],
        }],
        selection_mode="string",
        tags=["string"],
        visibility="string")
    
    const portfolioResource = new sonarqube.Portfolio("portfolioResource", {
        description: "string",
        key: "string",
        branch: "string",
        name: "string",
        portfolioId: "string",
        regexp: "string",
        selectedProjects: [{
            projectKey: "string",
            selectedBranches: ["string"],
        }],
        selectionMode: "string",
        tags: ["string"],
        visibility: "string",
    });
    
    type: sonarqube:Portfolio
    properties:
        branch: string
        description: string
        key: string
        name: string
        portfolioId: string
        regexp: string
        selectedProjects:
            - projectKey: string
              selectedBranches:
                - string
        selectionMode: string
        tags:
            - string
        visibility: string
    

    Portfolio 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 Portfolio resource accepts the following input properties:

    Description string
    A description of the Portfolio to create
    Key string
    The key of the Portfolio to create
    Branch string
    Which branch to analyze. If nothing, or '' is specified, the main branch is used.
    Name string
    The name of the Portfolio to create
    PortfolioId string
    The ID of this resource.
    Regexp string
    A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio
    SelectedProjects List<PortfolioSelectedProject>
    A set of projects to add to the portfolio.
    SelectionMode string
    How to populate the Portfolio to create. Possible values are NONE, MANUAL, TAGS, REGEXP or REST. See docs for how Portfolio population works
    Tags List<string>
    List of Project tags to populate the Portfolio from. Only active when selection_mode is TAGS
    Visibility string
    Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be public.
    Description string
    A description of the Portfolio to create
    Key string
    The key of the Portfolio to create
    Branch string
    Which branch to analyze. If nothing, or '' is specified, the main branch is used.
    Name string
    The name of the Portfolio to create
    PortfolioId string
    The ID of this resource.
    Regexp string
    A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio
    SelectedProjects []PortfolioSelectedProjectArgs
    A set of projects to add to the portfolio.
    SelectionMode string
    How to populate the Portfolio to create. Possible values are NONE, MANUAL, TAGS, REGEXP or REST. See docs for how Portfolio population works
    Tags []string
    List of Project tags to populate the Portfolio from. Only active when selection_mode is TAGS
    Visibility string
    Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be public.
    description String
    A description of the Portfolio to create
    key String
    The key of the Portfolio to create
    branch String
    Which branch to analyze. If nothing, or '' is specified, the main branch is used.
    name String
    The name of the Portfolio to create
    portfolioId String
    The ID of this resource.
    regexp String
    A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio
    selectedProjects List<PortfolioSelectedProject>
    A set of projects to add to the portfolio.
    selectionMode String
    How to populate the Portfolio to create. Possible values are NONE, MANUAL, TAGS, REGEXP or REST. See docs for how Portfolio population works
    tags List<String>
    List of Project tags to populate the Portfolio from. Only active when selection_mode is TAGS
    visibility String
    Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be public.
    description string
    A description of the Portfolio to create
    key string
    The key of the Portfolio to create
    branch string
    Which branch to analyze. If nothing, or '' is specified, the main branch is used.
    name string
    The name of the Portfolio to create
    portfolioId string
    The ID of this resource.
    regexp string
    A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio
    selectedProjects PortfolioSelectedProject[]
    A set of projects to add to the portfolio.
    selectionMode string
    How to populate the Portfolio to create. Possible values are NONE, MANUAL, TAGS, REGEXP or REST. See docs for how Portfolio population works
    tags string[]
    List of Project tags to populate the Portfolio from. Only active when selection_mode is TAGS
    visibility string
    Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be public.
    description str
    A description of the Portfolio to create
    key str
    The key of the Portfolio to create
    branch str
    Which branch to analyze. If nothing, or '' is specified, the main branch is used.
    name str
    The name of the Portfolio to create
    portfolio_id str
    The ID of this resource.
    regexp str
    A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio
    selected_projects Sequence[PortfolioSelectedProjectArgs]
    A set of projects to add to the portfolio.
    selection_mode str
    How to populate the Portfolio to create. Possible values are NONE, MANUAL, TAGS, REGEXP or REST. See docs for how Portfolio population works
    tags Sequence[str]
    List of Project tags to populate the Portfolio from. Only active when selection_mode is TAGS
    visibility str
    Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be public.
    description String
    A description of the Portfolio to create
    key String
    The key of the Portfolio to create
    branch String
    Which branch to analyze. If nothing, or '' is specified, the main branch is used.
    name String
    The name of the Portfolio to create
    portfolioId String
    The ID of this resource.
    regexp String
    A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio
    selectedProjects List<Property Map>
    A set of projects to add to the portfolio.
    selectionMode String
    How to populate the Portfolio to create. Possible values are NONE, MANUAL, TAGS, REGEXP or REST. See docs for how Portfolio population works
    tags List<String>
    List of Project tags to populate the Portfolio from. Only active when selection_mode is TAGS
    visibility String
    Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be public.

    Outputs

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

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

    Look up Existing Portfolio Resource

    Get an existing Portfolio 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?: PortfolioState, opts?: CustomResourceOptions): Portfolio
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            branch: Optional[str] = None,
            description: Optional[str] = None,
            key: Optional[str] = None,
            name: Optional[str] = None,
            portfolio_id: Optional[str] = None,
            qualifier: Optional[str] = None,
            regexp: Optional[str] = None,
            selected_projects: Optional[Sequence[PortfolioSelectedProjectArgs]] = None,
            selection_mode: Optional[str] = None,
            tags: Optional[Sequence[str]] = None,
            visibility: Optional[str] = None) -> Portfolio
    func GetPortfolio(ctx *Context, name string, id IDInput, state *PortfolioState, opts ...ResourceOption) (*Portfolio, error)
    public static Portfolio Get(string name, Input<string> id, PortfolioState? state, CustomResourceOptions? opts = null)
    public static Portfolio get(String name, Output<String> id, PortfolioState state, CustomResourceOptions options)
    resources:  _:    type: sonarqube:Portfolio    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    Branch string
    Which branch to analyze. If nothing, or '' is specified, the main branch is used.
    Description string
    A description of the Portfolio to create
    Key string
    The key of the Portfolio to create
    Name string
    The name of the Portfolio to create
    PortfolioId string
    The ID of this resource.
    Qualifier string
    Regexp string
    A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio
    SelectedProjects List<PortfolioSelectedProject>
    A set of projects to add to the portfolio.
    SelectionMode string
    How to populate the Portfolio to create. Possible values are NONE, MANUAL, TAGS, REGEXP or REST. See docs for how Portfolio population works
    Tags List<string>
    List of Project tags to populate the Portfolio from. Only active when selection_mode is TAGS
    Visibility string
    Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be public.
    Branch string
    Which branch to analyze. If nothing, or '' is specified, the main branch is used.
    Description string
    A description of the Portfolio to create
    Key string
    The key of the Portfolio to create
    Name string
    The name of the Portfolio to create
    PortfolioId string
    The ID of this resource.
    Qualifier string
    Regexp string
    A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio
    SelectedProjects []PortfolioSelectedProjectArgs
    A set of projects to add to the portfolio.
    SelectionMode string
    How to populate the Portfolio to create. Possible values are NONE, MANUAL, TAGS, REGEXP or REST. See docs for how Portfolio population works
    Tags []string
    List of Project tags to populate the Portfolio from. Only active when selection_mode is TAGS
    Visibility string
    Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be public.
    branch String
    Which branch to analyze. If nothing, or '' is specified, the main branch is used.
    description String
    A description of the Portfolio to create
    key String
    The key of the Portfolio to create
    name String
    The name of the Portfolio to create
    portfolioId String
    The ID of this resource.
    qualifier String
    regexp String
    A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio
    selectedProjects List<PortfolioSelectedProject>
    A set of projects to add to the portfolio.
    selectionMode String
    How to populate the Portfolio to create. Possible values are NONE, MANUAL, TAGS, REGEXP or REST. See docs for how Portfolio population works
    tags List<String>
    List of Project tags to populate the Portfolio from. Only active when selection_mode is TAGS
    visibility String
    Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be public.
    branch string
    Which branch to analyze. If nothing, or '' is specified, the main branch is used.
    description string
    A description of the Portfolio to create
    key string
    The key of the Portfolio to create
    name string
    The name of the Portfolio to create
    portfolioId string
    The ID of this resource.
    qualifier string
    regexp string
    A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio
    selectedProjects PortfolioSelectedProject[]
    A set of projects to add to the portfolio.
    selectionMode string
    How to populate the Portfolio to create. Possible values are NONE, MANUAL, TAGS, REGEXP or REST. See docs for how Portfolio population works
    tags string[]
    List of Project tags to populate the Portfolio from. Only active when selection_mode is TAGS
    visibility string
    Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be public.
    branch str
    Which branch to analyze. If nothing, or '' is specified, the main branch is used.
    description str
    A description of the Portfolio to create
    key str
    The key of the Portfolio to create
    name str
    The name of the Portfolio to create
    portfolio_id str
    The ID of this resource.
    qualifier str
    regexp str
    A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio
    selected_projects Sequence[PortfolioSelectedProjectArgs]
    A set of projects to add to the portfolio.
    selection_mode str
    How to populate the Portfolio to create. Possible values are NONE, MANUAL, TAGS, REGEXP or REST. See docs for how Portfolio population works
    tags Sequence[str]
    List of Project tags to populate the Portfolio from. Only active when selection_mode is TAGS
    visibility str
    Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be public.
    branch String
    Which branch to analyze. If nothing, or '' is specified, the main branch is used.
    description String
    A description of the Portfolio to create
    key String
    The key of the Portfolio to create
    name String
    The name of the Portfolio to create
    portfolioId String
    The ID of this resource.
    qualifier String
    regexp String
    A regular expression that is used to match Projects with a matching name OR key. If they match, they are added to the Portfolio
    selectedProjects List<Property Map>
    A set of projects to add to the portfolio.
    selectionMode String
    How to populate the Portfolio to create. Possible values are NONE, MANUAL, TAGS, REGEXP or REST. See docs for how Portfolio population works
    tags List<String>
    List of Project tags to populate the Portfolio from. Only active when selection_mode is TAGS
    visibility String
    Whether the created portfolio should be visible to everyone, or only specific user/groups. If no visibility is specified, the default portfolio visibility will be public.

    Supporting Types

    PortfolioSelectedProject, PortfolioSelectedProjectArgs

    ProjectKey string
    The project key of the project to add to the portfolio
    SelectedBranches List<string>
    A set of branches for the project to add to the portfolio
    ProjectKey string
    The project key of the project to add to the portfolio
    SelectedBranches []string
    A set of branches for the project to add to the portfolio
    projectKey String
    The project key of the project to add to the portfolio
    selectedBranches List<String>
    A set of branches for the project to add to the portfolio
    projectKey string
    The project key of the project to add to the portfolio
    selectedBranches string[]
    A set of branches for the project to add to the portfolio
    project_key str
    The project key of the project to add to the portfolio
    selected_branches Sequence[str]
    A set of branches for the project to add to the portfolio
    projectKey String
    The project key of the project to add to the portfolio
    selectedBranches List<String>
    A set of branches for the project to add to the portfolio

    Package Details

    Repository
    sonarqube jdamata/terraform-provider-sonarqube
    License
    Notes
    This Pulumi package is based on the sonarqube Terraform Provider.
    sonarqube logo
    sonarqube 0.16.14 published on Monday, Apr 14, 2025 by jdamata