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

sonarqube.ProjectMainBranch

Explore with Pulumi AI

Provides a Sonarqube Project main branch resource. This can be used to create and manage a Sonarqube Projects main branch.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as sonarqube from "@pulumi/sonarqube";

const main = new sonarqube.Project("main", {
    project: "my_project",
    visibility: "public",
});
const mybranch = new sonarqube.ProjectMainBranch("mybranch", {project: "my_project"});
Copy
import pulumi
import pulumi_sonarqube as sonarqube

main = sonarqube.Project("main",
    project="my_project",
    visibility="public")
mybranch = sonarqube.ProjectMainBranch("mybranch", project="my_project")
Copy
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.NewProject(ctx, "main", &sonarqube.ProjectArgs{
			Project:    pulumi.String("my_project"),
			Visibility: pulumi.String("public"),
		})
		if err != nil {
			return err
		}
		_, err = sonarqube.NewProjectMainBranch(ctx, "mybranch", &sonarqube.ProjectMainBranchArgs{
			Project: pulumi.String("my_project"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Sonarqube = Pulumi.Sonarqube;

return await Deployment.RunAsync(() => 
{
    var main = new Sonarqube.Project("main", new()
    {
        Project = "my_project",
        Visibility = "public",
    });

    var mybranch = new Sonarqube.ProjectMainBranch("mybranch", new()
    {
        Project = "my_project",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.sonarqube.Project;
import com.pulumi.sonarqube.ProjectArgs;
import com.pulumi.sonarqube.ProjectMainBranch;
import com.pulumi.sonarqube.ProjectMainBranchArgs;
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 Project("main", ProjectArgs.builder()
            .project("my_project")
            .visibility("public")
            .build());

        var mybranch = new ProjectMainBranch("mybranch", ProjectMainBranchArgs.builder()
            .project("my_project")
            .build());

    }
}
Copy
resources:
  main:
    type: sonarqube:Project
    properties:
      project: my_project
      visibility: public
  mybranch:
    type: sonarqube:ProjectMainBranch
    properties:
      project: my_project
Copy

Create ProjectMainBranch Resource

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

Constructor syntax

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

@overload
def ProjectMainBranch(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      project: Optional[str] = None,
                      name: Optional[str] = None,
                      project_main_branch_id: Optional[str] = None)
func NewProjectMainBranch(ctx *Context, name string, args ProjectMainBranchArgs, opts ...ResourceOption) (*ProjectMainBranch, error)
public ProjectMainBranch(string name, ProjectMainBranchArgs args, CustomResourceOptions? opts = null)
public ProjectMainBranch(String name, ProjectMainBranchArgs args)
public ProjectMainBranch(String name, ProjectMainBranchArgs args, CustomResourceOptions options)
type: sonarqube:ProjectMainBranch
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. ProjectMainBranchArgs
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. ProjectMainBranchArgs
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. ProjectMainBranchArgs
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. ProjectMainBranchArgs
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. ProjectMainBranchArgs
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 projectMainBranchResource = new Sonarqube.ProjectMainBranch("projectMainBranchResource", new()
{
    Project = "string",
    Name = "string",
    ProjectMainBranchId = "string",
});
Copy
example, err := sonarqube.NewProjectMainBranch(ctx, "projectMainBranchResource", &sonarqube.ProjectMainBranchArgs{
Project: pulumi.String("string"),
Name: pulumi.String("string"),
ProjectMainBranchId: pulumi.String("string"),
})
Copy
var projectMainBranchResource = new ProjectMainBranch("projectMainBranchResource", ProjectMainBranchArgs.builder()
    .project("string")
    .name("string")
    .projectMainBranchId("string")
    .build());
Copy
project_main_branch_resource = sonarqube.ProjectMainBranch("projectMainBranchResource",
    project="string",
    name="string",
    project_main_branch_id="string")
Copy
const projectMainBranchResource = new sonarqube.ProjectMainBranch("projectMainBranchResource", {
    project: "string",
    name: "string",
    projectMainBranchId: "string",
});
Copy
type: sonarqube:ProjectMainBranch
properties:
    name: string
    project: string
    projectMainBranchId: string
Copy

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

Project This property is required. string
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
Name string
The name you want the main branch to have.
ProjectMainBranchId string
The ID of this resource.
Project This property is required. string
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
Name string
The name you want the main branch to have.
ProjectMainBranchId string
The ID of this resource.
project This property is required. String
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
name String
The name you want the main branch to have.
projectMainBranchId String
The ID of this resource.
project This property is required. string
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
name string
The name you want the main branch to have.
projectMainBranchId string
The ID of this resource.
project This property is required. str
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
name str
The name you want the main branch to have.
project_main_branch_id str
The ID of this resource.
project This property is required. String
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
name String
The name you want the main branch to have.
projectMainBranchId String
The ID of this resource.

Outputs

All input properties are implicitly available as output properties. Additionally, the ProjectMainBranch 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 ProjectMainBranch Resource

Get an existing ProjectMainBranch 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?: ProjectMainBranchState, opts?: CustomResourceOptions): ProjectMainBranch
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        name: Optional[str] = None,
        project: Optional[str] = None,
        project_main_branch_id: Optional[str] = None) -> ProjectMainBranch
func GetProjectMainBranch(ctx *Context, name string, id IDInput, state *ProjectMainBranchState, opts ...ResourceOption) (*ProjectMainBranch, error)
public static ProjectMainBranch Get(string name, Input<string> id, ProjectMainBranchState? state, CustomResourceOptions? opts = null)
public static ProjectMainBranch get(String name, Output<String> id, ProjectMainBranchState state, CustomResourceOptions options)
resources:  _:    type: sonarqube:ProjectMainBranch    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:
Name string
The name you want the main branch to have.
Project string
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
ProjectMainBranchId string
The ID of this resource.
Name string
The name you want the main branch to have.
Project string
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
ProjectMainBranchId string
The ID of this resource.
name String
The name you want the main branch to have.
project String
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
projectMainBranchId String
The ID of this resource.
name string
The name you want the main branch to have.
project string
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
projectMainBranchId string
The ID of this resource.
name str
The name you want the main branch to have.
project str
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
project_main_branch_id str
The ID of this resource.
name String
The name you want the main branch to have.
project String
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
projectMainBranchId String
The ID of this resource.

Package Details

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