BranchPolicyMinReviewers

Manages a minimum reviewer branch policy within Azure DevOps.

Example Usage

using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;

class MyStack : Stack
{
    public MyStack()
    {
        var project = new AzureDevOps.Core.Project("project", new AzureDevOps.Core.ProjectArgs
        {
            ProjectName = "Sample Project",
        });
        var git = new AzureDevOps.Repository.Git("git", new AzureDevOps.Repository.GitArgs
        {
            ProjectId = project.Id,
            Initialization = new AzureDevOps.Repository.Inputs.GitInitializationArgs
            {
                InitType = "Clean",
            },
        });
        var branchPolicyMinReviewers = new AzureDevOps.Policy.BranchPolicyMinReviewers("branchPolicyMinReviewers", new AzureDevOps.Policy.BranchPolicyMinReviewersArgs
        {
            ProjectId = project.Id,
            Enabled = true,
            Blocking = true,
            Settings = new AzureDevOps.Policy.Inputs.BranchPolicyMinReviewersSettingsArgs
            {
                ReviewerCount = 2,
                SubmitterCanVote = false,
                Scope = 
                {
                    
                    {
                        { "repositoryId", git.Id },
                        { "repositoryRef", git.DefaultBranch },
                        { "matchType", "Exact" },
                    },
                    
                    {
                        { "repositoryId", git.Id },
                        { "repositoryRef", "refs/heads/releases" },
                        { "matchType", "Prefix" },
                    },
                },
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-azuredevops/sdk/go/azuredevops/Core"
    "github.com/pulumi/pulumi-azuredevops/sdk/go/azuredevops/Policy"
    "github.com/pulumi/pulumi-azuredevops/sdk/go/azuredevops/Repository"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        project, err := Core.NewProject(ctx, "project", &Core.ProjectArgs{
            ProjectName: pulumi.String("Sample Project"),
        })
        if err != nil {
            return err
        }
        git, err := Repository.NewGit(ctx, "git", &Repository.GitArgs{
            ProjectId: project.ID(),
            Initialization: &Repository.GitInitializationArgs{
                InitType: pulumi.String("Clean"),
            },
        })
        if err != nil {
            return err
        }
        branchPolicyMinReviewers, err := Policy.NewBranchPolicyMinReviewers(ctx, "branchPolicyMinReviewers", &Policy.BranchPolicyMinReviewersArgs{
            ProjectId: project.ID(),
            Enabled:   pulumi.Bool(true),
            Blocking:  pulumi.Bool(true),
            Settings: &Policy.BranchPolicyMinReviewersSettingsArgs{
                ReviewerCount:    pulumi.Int(2),
                SubmitterCanVote: pulumi.Bool(false),
                Scope: []interface{}{
                    map[string]interface{}{
                        "repositoryId":  git.ID(),
                        "repositoryRef": git.DefaultBranch,
                        "matchType":     "Exact",
                    },
                    map[string]interface{}{
                        "repositoryId":  git.ID(),
                        "repositoryRef": "refs/heads/releases",
                        "matchType":     "Prefix",
                    },
                },
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_azuredevops as azuredevops

project = azuredevops.core.Project("project", project_name="Sample Project")
git = azuredevops.repository.Git("git",
    project_id=project.id,
    initialization={
        "initType": "Clean",
    })
branch_policy_min_reviewers = azuredevops.policy.BranchPolicyMinReviewers("branchPolicyMinReviewers",
    project_id=project.id,
    enabled=True,
    blocking=True,
    settings={
        "reviewerCount": 2,
        "submitterCanVote": False,
        "scope": [
            {
                "repositoryId": git.id,
                "repositoryRef": git.default_branch,
                "matchType": "Exact",
            },
            {
                "repositoryId": git.id,
                "repositoryRef": "refs/heads/releases",
                "matchType": "Prefix",
            },
        ],
    })
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";

const project = new azuredevops.Core.Project("project", {projectName: "Sample Project"});
const git = new azuredevops.Repository.Git("git", {
    projectId: project.id,
    initialization: {
        initType: "Clean",
    },
});
const branchPolicyMinReviewers = new azuredevops.Policy.BranchPolicyMinReviewers("branchPolicyMinReviewers", {
    projectId: project.id,
    enabled: true,
    blocking: true,
    settings: {
        reviewerCount: 2,
        submitterCanVote: false,
        scope: [
            {
                repositoryId: git.id,
                repositoryRef: git.defaultBranch,
                matchType: "Exact",
            },
            {
                repositoryId: git.id,
                repositoryRef: "refs/heads/releases",
                matchType: "Prefix",
            },
        ],
    },
});

Create a BranchPolicyMinReviewers Resource

def BranchPolicyMinReviewers(resource_name, opts=None, blocking=None, enabled=None, project_id=None, settings=None, __props__=None);
name string
The unique name of the resource.
args BranchPolicyMinReviewersArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args BranchPolicyMinReviewersArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args BranchPolicyMinReviewersArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

BranchPolicyMinReviewers Resource Properties

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

Inputs

The BranchPolicyMinReviewers resource accepts the following input properties:

ProjectId string

The ID of the project in which the policy will be created.

Settings Pulumi.AzureDevOps.Policy.Inputs.BranchPolicyMinReviewersSettingsArgs

Configuration for the policy. This block must be defined exactly once.

Blocking bool

A flag indicating if the policy should be blocking. Defaults to true.

Enabled bool

A flag indicating if the policy should be enabled. Defaults to true.

ProjectId string

The ID of the project in which the policy will be created.

Settings BranchPolicyMinReviewersSettings

Configuration for the policy. This block must be defined exactly once.

Blocking bool

A flag indicating if the policy should be blocking. Defaults to true.

Enabled bool

A flag indicating if the policy should be enabled. Defaults to true.

projectId string

The ID of the project in which the policy will be created.

settings BranchPolicyMinReviewersSettings

Configuration for the policy. This block must be defined exactly once.

blocking boolean

A flag indicating if the policy should be blocking. Defaults to true.

enabled boolean

A flag indicating if the policy should be enabled. Defaults to true.

project_id str

The ID of the project in which the policy will be created.

settings Dict[BranchPolicyMinReviewersSettings]

Configuration for the policy. This block must be defined exactly once.

blocking bool

A flag indicating if the policy should be blocking. Defaults to true.

enabled bool

A flag indicating if the policy should be enabled. Defaults to true.

Outputs

All input properties are implicitly available as output properties. Additionally, the BranchPolicyMinReviewers 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing BranchPolicyMinReviewers Resource

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

static get(resource_name, id, opts=None, blocking=None, enabled=None, project_id=None, settings=None, __props__=None);
func GetBranchPolicyMinReviewers(ctx *Context, name string, id IDInput, state *BranchPolicyMinReviewersState, opts ...ResourceOption) (*BranchPolicyMinReviewers, error)
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.

The following state arguments are supported:

Blocking bool

A flag indicating if the policy should be blocking. Defaults to true.

Enabled bool

A flag indicating if the policy should be enabled. Defaults to true.

ProjectId string

The ID of the project in which the policy will be created.

Settings Pulumi.AzureDevOps.Policy.Inputs.BranchPolicyMinReviewersSettingsArgs

Configuration for the policy. This block must be defined exactly once.

Blocking bool

A flag indicating if the policy should be blocking. Defaults to true.

Enabled bool

A flag indicating if the policy should be enabled. Defaults to true.

ProjectId string

The ID of the project in which the policy will be created.

Settings BranchPolicyMinReviewersSettings

Configuration for the policy. This block must be defined exactly once.

blocking boolean

A flag indicating if the policy should be blocking. Defaults to true.

enabled boolean

A flag indicating if the policy should be enabled. Defaults to true.

projectId string

The ID of the project in which the policy will be created.

settings BranchPolicyMinReviewersSettings

Configuration for the policy. This block must be defined exactly once.

blocking bool

A flag indicating if the policy should be blocking. Defaults to true.

enabled bool

A flag indicating if the policy should be enabled. Defaults to true.

project_id str

The ID of the project in which the policy will be created.

settings Dict[BranchPolicyMinReviewersSettings]

Configuration for the policy. This block must be defined exactly once.

Supporting Types

BranchPolicyMinReviewersSettings

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

ReviewerCount int

The number of reviewrs needed to approve.

Scopes List<Pulumi.AzureDevOps.Policy.Inputs.BranchPolicyMinReviewersSettingsScopeArgs>

Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.

SubmitterCanVote bool

Controls whether or not the submitter’s vote counts. Defaults to false.

ReviewerCount int

The number of reviewrs needed to approve.

Scopes []BranchPolicyMinReviewersSettingsScope

Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.

SubmitterCanVote bool

Controls whether or not the submitter’s vote counts. Defaults to false.

reviewerCount number

The number of reviewrs needed to approve.

scopes BranchPolicyMinReviewersSettingsScope[]

Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.

submitterCanVote boolean

Controls whether or not the submitter’s vote counts. Defaults to false.

reviewerCount float

The number of reviewrs needed to approve.

scopes List[BranchPolicyMinReviewersSettingsScope]

Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.

submitterCanVote bool

Controls whether or not the submitter’s vote counts. Defaults to false.

BranchPolicyMinReviewersSettingsScope

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

MatchType string

The match type to use when applying the policy. Supported values are Exact (default) or Prefix.

RepositoryId string

The repository ID. Needed only if the scope of the policy will be limited to a single repository.

RepositoryRef string

The ref pattern to use for the match. If match_type is Exact, this should be a qualified ref such as refs/heads/master. If match_type is Prefix, this should be a ref path such as refs/heads/releases.

MatchType string

The match type to use when applying the policy. Supported values are Exact (default) or Prefix.

RepositoryId string

The repository ID. Needed only if the scope of the policy will be limited to a single repository.

RepositoryRef string

The ref pattern to use for the match. If match_type is Exact, this should be a qualified ref such as refs/heads/master. If match_type is Prefix, this should be a ref path such as refs/heads/releases.

matchType string

The match type to use when applying the policy. Supported values are Exact (default) or Prefix.

repositoryId string

The repository ID. Needed only if the scope of the policy will be limited to a single repository.

repositoryRef string

The ref pattern to use for the match. If match_type is Exact, this should be a qualified ref such as refs/heads/master. If match_type is Prefix, this should be a ref path such as refs/heads/releases.

matchType str

The match type to use when applying the policy. Supported values are Exact (default) or Prefix.

repositoryId str

The repository ID. Needed only if the scope of the policy will be limited to a single repository.

repositoryRef str

The ref pattern to use for the match. If match_type is Exact, this should be a qualified ref such as refs/heads/master. If match_type is Prefix, this should be a ref path such as refs/heads/releases.

Package Details

Repository
https://github.com/pulumi/pulumi-azuredevops
License
Apache-2.0
Notes
This Pulumi package is based on the azuredevops Terraform Provider.