BranchPolicyMinReviewers
Manages a minimum reviewer branch policy within Azure DevOps.
Relevant Links
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
new BranchPolicyMinReviewers(name: string, args: BranchPolicyMinReviewersArgs, opts?: CustomResourceOptions);def BranchPolicyMinReviewers(resource_name, opts=None, blocking=None, enabled=None, project_id=None, settings=None, __props__=None);func NewBranchPolicyMinReviewers(ctx *Context, name string, args BranchPolicyMinReviewersArgs, opts ...ResourceOption) (*BranchPolicyMinReviewers, error)public BranchPolicyMinReviewers(string name, BranchPolicyMinReviewersArgs args, CustomResourceOptions? opts = null)- 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:
- Project
Id string The ID of the project in which the policy will be created.
- Settings
Pulumi.
Azure Dev Ops. Policy. Inputs. Branch Policy Min Reviewers Settings Args 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 string The ID of the project in which the policy will be created.
- Settings
Branch
Policy Min Reviewers Settings 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 string The ID of the project in which the policy will be created.
- settings
Branch
Policy Min Reviewers Settings 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[Branch
Policy Min Reviewers Settings] 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:
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.
public static get(name: string, id: Input<ID>, state?: BranchPolicyMinReviewersState, opts?: CustomResourceOptions): BranchPolicyMinReviewersstatic 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)public static BranchPolicyMinReviewers Get(string name, Input<string> id, BranchPolicyMinReviewersState? state, CustomResourceOptions? opts = null)- 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.- Project
Id string The ID of the project in which the policy will be created.
- Settings
Pulumi.
Azure Dev Ops. Policy. Inputs. Branch Policy Min Reviewers Settings Args 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 string The ID of the project in which the policy will be created.
- Settings
Branch
Policy Min Reviewers Settings 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 string The ID of the project in which the policy will be created.
- settings
Branch
Policy Min Reviewers Settings 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[Branch
Policy Min Reviewers Settings] Configuration for the policy. This block must be defined exactly once.
Supporting Types
BranchPolicyMinReviewersSettings
- Reviewer
Count int The number of reviewrs needed to approve.
- Scopes
List<Pulumi.
Azure Dev Ops. Policy. Inputs. Branch Policy Min Reviewers Settings Scope Args> Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.
- Submitter
Can boolVote Controls whether or not the submitter’s vote counts. Defaults to
false.
- Reviewer
Count int The number of reviewrs needed to approve.
- Scopes
[]Branch
Policy Min Reviewers Settings Scope Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.
- Submitter
Can boolVote Controls whether or not the submitter’s vote counts. Defaults to
false.
- reviewer
Count number The number of reviewrs needed to approve.
- scopes
Branch
Policy Min Reviewers Settings Scope[] Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.
- submitter
Can booleanVote Controls whether or not the submitter’s vote counts. Defaults to
false.
- reviewer
Count float The number of reviewrs needed to approve.
- scopes
List[Branch
Policy Min Reviewers Settings Scope] Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.
- submitter
Can boolVote Controls whether or not the submitter’s vote counts. Defaults to
false.
BranchPolicyMinReviewersSettingsScope
- Match
Type string The match type to use when applying the policy. Supported values are
Exact(default) orPrefix.- Repository
Id string The repository ID. Needed only if the scope of the policy will be limited to a single repository.
- Repository
Ref string The ref pattern to use for the match. If
match_typeisExact, this should be a qualified ref such asrefs/heads/master. Ifmatch_typeisPrefix, this should be a ref path such asrefs/heads/releases.
- Match
Type string The match type to use when applying the policy. Supported values are
Exact(default) orPrefix.- Repository
Id string The repository ID. Needed only if the scope of the policy will be limited to a single repository.
- Repository
Ref string The ref pattern to use for the match. If
match_typeisExact, this should be a qualified ref such asrefs/heads/master. Ifmatch_typeisPrefix, this should be a ref path such asrefs/heads/releases.
- match
Type string The match type to use when applying the policy. Supported values are
Exact(default) orPrefix.- repository
Id string The repository ID. Needed only if the scope of the policy will be limited to a single repository.
- repository
Ref string The ref pattern to use for the match. If
match_typeisExact, this should be a qualified ref such asrefs/heads/master. Ifmatch_typeisPrefix, this should be a ref path such asrefs/heads/releases.
- match
Type str The match type to use when applying the policy. Supported values are
Exact(default) orPrefix.- repository
Id str The repository ID. Needed only if the scope of the policy will be limited to a single repository.
- repository
Ref str The ref pattern to use for the match. If
match_typeisExact, this should be a qualified ref such asrefs/heads/master. Ifmatch_typeisPrefix, this should be a ref path such asrefs/heads/releases.
Package Details
- Repository
- https://github.com/pulumi/pulumi-azuredevops
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azuredevopsTerraform Provider.