This page documents the language specification for the azuredevops package. If you're looking for help working with the inputs, outputs, or functions of azuredevops resources in a Pulumi program, please see the resource documentation for examples and API reference.

policy

This provider is a derived work of the Terraform Provider distributed under MPL 2.0. If you encounter a bug or missing feature, first check the pulumi/pulumi-azuredevops repo; however, if that doesn’t turn up anything, please consult the source terraform-providers/terraform-provider-azuredevops repo.

class pulumi_azuredevops.policy.BranchPolicyBuildValidation(resource_name, opts=None, blocking=None, enabled=None, project_id=None, settings=None, __props__=None, __name__=None, __opts__=None)

Manages a build validation branch policy within Azure DevOps.

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",
    })
build_definition = azuredevops.build.BuildDefinition("buildDefinition",
    project_id=project.id,
    repository={
        "repoType": "TfsGit",
        "repoId": git.id,
        "ymlPath": "azure-pipelines.yml",
    })
branch_policy_build_validation = azuredevops.policy.BranchPolicyBuildValidation("branchPolicyBuildValidation",
    project_id=project.id,
    enabled=True,
    blocking=True,
    settings={
        "display_name": "Don't break the build!",
        "buildDefinitionId": build_definition.id,
        "validDuration": 720,
        "scope": [
            {
                "repositoryId": git.id,
                "repositoryRef": git.default_branch,
                "matchType": "Exact",
            },
            {
                "repositoryId": git.id,
                "repositoryRef": "refs/heads/releases",
                "matchType": "Prefix",
            },
        ],
    })
Parameters
  • resource_name (str) – The name of the resource.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • blocking (pulumi.Input[bool]) – A flag indicating if the policy should be blocking. Defaults to true.

  • enabled (pulumi.Input[bool]) – A flag indicating if the policy should be enabled. Defaults to true.

  • project_id (pulumi.Input[str]) – The ID of the project in which the policy will be created.

  • settings (pulumi.Input[dict]) – Configuration for the policy. This block must be defined exactly once.

The settings object supports the following:

  • buildDefinitionId (pulumi.Input[float]) - The ID of the build to monitor for the policy.

  • display_name (pulumi.Input[str]) - The display name for the policy.

  • manualQueueOnly (pulumi.Input[bool]) - If set to true, the build will need to be manually queued. Defaults to false

  • queueOnSourceUpdateOnly (pulumi.Input[bool]) - True if the build should queue on source updates only. Defaults to true.

  • scopes (pulumi.Input[list]) - Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.

    • matchType (pulumi.Input[str]) - The match type to use when applying the policy. Supported values are Exact (default) or Prefix.

    • repositoryId (pulumi.Input[str]) - The repository ID. Needed only if the scope of the policy will be limited to a single repository.

    • repositoryRef (pulumi.Input[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.

  • validDuration (pulumi.Input[float]) - The number of minutes for which the build is valid. If 0, the build will not expire. Defaults to 720 (12 hours).

blocking: pulumi.Output[bool] = None

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

enabled: pulumi.Output[bool] = None

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

project_id: pulumi.Output[str] = None

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

settings: pulumi.Output[dict] = None

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

  • buildDefinitionId (float) - The ID of the build to monitor for the policy.

  • display_name (str) - The display name for the policy.

  • manualQueueOnly (bool) - If set to true, the build will need to be manually queued. Defaults to false

  • queueOnSourceUpdateOnly (bool) - True if the build should queue on source updates only. Defaults to true.

  • scopes (list) - Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.

    • 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.

  • validDuration (float) - The number of minutes for which the build is valid. If 0, the build will not expire. Defaults to 720 (12 hours).

static get(resource_name, id, opts=None, blocking=None, enabled=None, project_id=None, settings=None)

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

Parameters
  • resource_name (str) – The unique name of the resulting resource.

  • id (str) – The unique provider ID of the resource to lookup.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • blocking (pulumi.Input[bool]) – A flag indicating if the policy should be blocking. Defaults to true.

  • enabled (pulumi.Input[bool]) – A flag indicating if the policy should be enabled. Defaults to true.

  • project_id (pulumi.Input[str]) – The ID of the project in which the policy will be created.

  • settings (pulumi.Input[dict]) – Configuration for the policy. This block must be defined exactly once.

The settings object supports the following:

  • buildDefinitionId (pulumi.Input[float]) - The ID of the build to monitor for the policy.

  • display_name (pulumi.Input[str]) - The display name for the policy.

  • manualQueueOnly (pulumi.Input[bool]) - If set to true, the build will need to be manually queued. Defaults to false

  • queueOnSourceUpdateOnly (pulumi.Input[bool]) - True if the build should queue on source updates only. Defaults to true.

  • scopes (pulumi.Input[list]) - Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.

    • matchType (pulumi.Input[str]) - The match type to use when applying the policy. Supported values are Exact (default) or Prefix.

    • repositoryId (pulumi.Input[str]) - The repository ID. Needed only if the scope of the policy will be limited to a single repository.

    • repositoryRef (pulumi.Input[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.

  • validDuration (pulumi.Input[float]) - The number of minutes for which the build is valid. If 0, the build will not expire. Defaults to 720 (12 hours).

translate_output_property(prop)

Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

translate_input_property(prop)

Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

class pulumi_azuredevops.policy.BranchPolicyMinReviewers(resource_name, opts=None, blocking=None, enabled=None, project_id=None, settings=None, __props__=None, __name__=None, __opts__=None)

Manages a minimum reviewer branch policy within Azure DevOps.

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",
            },
        ],
    })
Parameters
  • resource_name (str) – The name of the resource.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • blocking (pulumi.Input[bool]) – A flag indicating if the policy should be blocking. Defaults to true.

  • enabled (pulumi.Input[bool]) – A flag indicating if the policy should be enabled. Defaults to true.

  • project_id (pulumi.Input[str]) – The ID of the project in which the policy will be created.

  • settings (pulumi.Input[dict]) – Configuration for the policy. This block must be defined exactly once.

The settings object supports the following:

  • reviewerCount (pulumi.Input[float]) - The number of reviewrs needed to approve.

  • scopes (pulumi.Input[list]) - Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.

    • matchType (pulumi.Input[str]) - The match type to use when applying the policy. Supported values are Exact (default) or Prefix.

    • repositoryId (pulumi.Input[str]) - The repository ID. Needed only if the scope of the policy will be limited to a single repository.

    • repositoryRef (pulumi.Input[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.

  • submitterCanVote (pulumi.Input[bool]) - Controls whether or not the submitter’s vote counts. Defaults to false.

blocking: pulumi.Output[bool] = None

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

enabled: pulumi.Output[bool] = None

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

project_id: pulumi.Output[str] = None

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

settings: pulumi.Output[dict] = None

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

  • reviewerCount (float) - The number of reviewrs needed to approve.

  • scopes (list) - Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.

    • 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.

  • submitterCanVote (bool) - Controls whether or not the submitter’s vote counts. Defaults to false.

static get(resource_name, id, opts=None, blocking=None, enabled=None, project_id=None, settings=None)

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

Parameters
  • resource_name (str) – The unique name of the resulting resource.

  • id (str) – The unique provider ID of the resource to lookup.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • blocking (pulumi.Input[bool]) – A flag indicating if the policy should be blocking. Defaults to true.

  • enabled (pulumi.Input[bool]) – A flag indicating if the policy should be enabled. Defaults to true.

  • project_id (pulumi.Input[str]) – The ID of the project in which the policy will be created.

  • settings (pulumi.Input[dict]) – Configuration for the policy. This block must be defined exactly once.

The settings object supports the following:

  • reviewerCount (pulumi.Input[float]) - The number of reviewrs needed to approve.

  • scopes (pulumi.Input[list]) - Controls which repositories and branches the policy will be enabled for. This block must be defined at least once.

    • matchType (pulumi.Input[str]) - The match type to use when applying the policy. Supported values are Exact (default) or Prefix.

    • repositoryId (pulumi.Input[str]) - The repository ID. Needed only if the scope of the policy will be limited to a single repository.

    • repositoryRef (pulumi.Input[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.

  • submitterCanVote (pulumi.Input[bool]) - Controls whether or not the submitter’s vote counts. Defaults to false.

translate_output_property(prop)

Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

translate_input_property(prop)

Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str