gitlab.ProjectApprovalRule
Explore with Pulumi AI
Example Usage
Create ProjectApprovalRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ProjectApprovalRule(name: string, args: ProjectApprovalRuleArgs, opts?: CustomResourceOptions);
@overload
def ProjectApprovalRule(resource_name: str,
args: ProjectApprovalRuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ProjectApprovalRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
approvals_required: Optional[int] = None,
project: Optional[str] = None,
applies_to_all_protected_branches: Optional[bool] = None,
disable_importing_default_any_approver_rule_on_create: Optional[bool] = None,
group_ids: Optional[Sequence[int]] = None,
name: Optional[str] = None,
protected_branch_ids: Optional[Sequence[int]] = None,
report_type: Optional[str] = None,
rule_type: Optional[str] = None,
user_ids: Optional[Sequence[int]] = None)
func NewProjectApprovalRule(ctx *Context, name string, args ProjectApprovalRuleArgs, opts ...ResourceOption) (*ProjectApprovalRule, error)
public ProjectApprovalRule(string name, ProjectApprovalRuleArgs args, CustomResourceOptions? opts = null)
public ProjectApprovalRule(String name, ProjectApprovalRuleArgs args)
public ProjectApprovalRule(String name, ProjectApprovalRuleArgs args, CustomResourceOptions options)
type: gitlab:ProjectApprovalRule
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 ProjectApprovalRuleArgs
- 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 ProjectApprovalRuleArgs
- 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 ProjectApprovalRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ProjectApprovalRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ProjectApprovalRuleArgs
- 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 projectApprovalRuleResource = new GitLab.ProjectApprovalRule("projectApprovalRuleResource", new()
{
ApprovalsRequired = 0,
Project = "string",
AppliesToAllProtectedBranches = false,
DisableImportingDefaultAnyApproverRuleOnCreate = false,
GroupIds = new[]
{
0,
},
Name = "string",
ProtectedBranchIds = new[]
{
0,
},
ReportType = "string",
RuleType = "string",
UserIds = new[]
{
0,
},
});
example, err := gitlab.NewProjectApprovalRule(ctx, "projectApprovalRuleResource", &gitlab.ProjectApprovalRuleArgs{
ApprovalsRequired: pulumi.Int(0),
Project: pulumi.String("string"),
AppliesToAllProtectedBranches: pulumi.Bool(false),
DisableImportingDefaultAnyApproverRuleOnCreate: pulumi.Bool(false),
GroupIds: pulumi.IntArray{
pulumi.Int(0),
},
Name: pulumi.String("string"),
ProtectedBranchIds: pulumi.IntArray{
pulumi.Int(0),
},
ReportType: pulumi.String("string"),
RuleType: pulumi.String("string"),
UserIds: pulumi.IntArray{
pulumi.Int(0),
},
})
var projectApprovalRuleResource = new ProjectApprovalRule("projectApprovalRuleResource", ProjectApprovalRuleArgs.builder()
.approvalsRequired(0)
.project("string")
.appliesToAllProtectedBranches(false)
.disableImportingDefaultAnyApproverRuleOnCreate(false)
.groupIds(0)
.name("string")
.protectedBranchIds(0)
.reportType("string")
.ruleType("string")
.userIds(0)
.build());
project_approval_rule_resource = gitlab.ProjectApprovalRule("projectApprovalRuleResource",
approvals_required=0,
project="string",
applies_to_all_protected_branches=False,
disable_importing_default_any_approver_rule_on_create=False,
group_ids=[0],
name="string",
protected_branch_ids=[0],
report_type="string",
rule_type="string",
user_ids=[0])
const projectApprovalRuleResource = new gitlab.ProjectApprovalRule("projectApprovalRuleResource", {
approvalsRequired: 0,
project: "string",
appliesToAllProtectedBranches: false,
disableImportingDefaultAnyApproverRuleOnCreate: false,
groupIds: [0],
name: "string",
protectedBranchIds: [0],
reportType: "string",
ruleType: "string",
userIds: [0],
});
type: gitlab:ProjectApprovalRule
properties:
appliesToAllProtectedBranches: false
approvalsRequired: 0
disableImportingDefaultAnyApproverRuleOnCreate: false
groupIds:
- 0
name: string
project: string
protectedBranchIds:
- 0
reportType: string
ruleType: string
userIds:
- 0
ProjectApprovalRule 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 ProjectApprovalRule resource accepts the following input properties:
- Approvals
Required int - The number of approvals required for this rule.
- Project string
- The name or id of the project to add the approval rules.
- Applies
To boolAll Protected Branches - Whether the rule is applied to all protected branches. If set to 'true', the value of
protected_branch_ids
is ignored. Default is 'false'. - Disable
Importing boolDefault Any Approver Rule On Create - When this flag is set, the default
any_approver
rule will not be imported if present. - Group
Ids List<int> - A list of group IDs whose members can approve of the merge request.
- Name string
- The name of the approval rule.
- Protected
Branch List<int>Ids - A list of protected branch IDs (not branch names) for which the rule applies.
- Report
Type string - Report type is required when the rule_type is
report_approver
. Valid values arecode_coverage
. - Rule
Type string - String, defaults to 'regular'. The type of rule.
any_approver
is a pre-configured default rule withapprovals_required
at0
. Valid values areregular
,any_approver
,report_approver
. - User
Ids List<int> - A list of specific User IDs to add to the list of approvers.
- Approvals
Required int - The number of approvals required for this rule.
- Project string
- The name or id of the project to add the approval rules.
- Applies
To boolAll Protected Branches - Whether the rule is applied to all protected branches. If set to 'true', the value of
protected_branch_ids
is ignored. Default is 'false'. - Disable
Importing boolDefault Any Approver Rule On Create - When this flag is set, the default
any_approver
rule will not be imported if present. - Group
Ids []int - A list of group IDs whose members can approve of the merge request.
- Name string
- The name of the approval rule.
- Protected
Branch []intIds - A list of protected branch IDs (not branch names) for which the rule applies.
- Report
Type string - Report type is required when the rule_type is
report_approver
. Valid values arecode_coverage
. - Rule
Type string - String, defaults to 'regular'. The type of rule.
any_approver
is a pre-configured default rule withapprovals_required
at0
. Valid values areregular
,any_approver
,report_approver
. - User
Ids []int - A list of specific User IDs to add to the list of approvers.
- approvals
Required Integer - The number of approvals required for this rule.
- project String
- The name or id of the project to add the approval rules.
- applies
To BooleanAll Protected Branches - Whether the rule is applied to all protected branches. If set to 'true', the value of
protected_branch_ids
is ignored. Default is 'false'. - disable
Importing BooleanDefault Any Approver Rule On Create - When this flag is set, the default
any_approver
rule will not be imported if present. - group
Ids List<Integer> - A list of group IDs whose members can approve of the merge request.
- name String
- The name of the approval rule.
- protected
Branch List<Integer>Ids - A list of protected branch IDs (not branch names) for which the rule applies.
- report
Type String - Report type is required when the rule_type is
report_approver
. Valid values arecode_coverage
. - rule
Type String - String, defaults to 'regular'. The type of rule.
any_approver
is a pre-configured default rule withapprovals_required
at0
. Valid values areregular
,any_approver
,report_approver
. - user
Ids List<Integer> - A list of specific User IDs to add to the list of approvers.
- approvals
Required number - The number of approvals required for this rule.
- project string
- The name or id of the project to add the approval rules.
- applies
To booleanAll Protected Branches - Whether the rule is applied to all protected branches. If set to 'true', the value of
protected_branch_ids
is ignored. Default is 'false'. - disable
Importing booleanDefault Any Approver Rule On Create - When this flag is set, the default
any_approver
rule will not be imported if present. - group
Ids number[] - A list of group IDs whose members can approve of the merge request.
- name string
- The name of the approval rule.
- protected
Branch number[]Ids - A list of protected branch IDs (not branch names) for which the rule applies.
- report
Type string - Report type is required when the rule_type is
report_approver
. Valid values arecode_coverage
. - rule
Type string - String, defaults to 'regular'. The type of rule.
any_approver
is a pre-configured default rule withapprovals_required
at0
. Valid values areregular
,any_approver
,report_approver
. - user
Ids number[] - A list of specific User IDs to add to the list of approvers.
- approvals_
required int - The number of approvals required for this rule.
- project str
- The name or id of the project to add the approval rules.
- applies_
to_ boolall_ protected_ branches - Whether the rule is applied to all protected branches. If set to 'true', the value of
protected_branch_ids
is ignored. Default is 'false'. - disable_
importing_ booldefault_ any_ approver_ rule_ on_ create - When this flag is set, the default
any_approver
rule will not be imported if present. - group_
ids Sequence[int] - A list of group IDs whose members can approve of the merge request.
- name str
- The name of the approval rule.
- protected_
branch_ Sequence[int]ids - A list of protected branch IDs (not branch names) for which the rule applies.
- report_
type str - Report type is required when the rule_type is
report_approver
. Valid values arecode_coverage
. - rule_
type str - String, defaults to 'regular'. The type of rule.
any_approver
is a pre-configured default rule withapprovals_required
at0
. Valid values areregular
,any_approver
,report_approver
. - user_
ids Sequence[int] - A list of specific User IDs to add to the list of approvers.
- approvals
Required Number - The number of approvals required for this rule.
- project String
- The name or id of the project to add the approval rules.
- applies
To BooleanAll Protected Branches - Whether the rule is applied to all protected branches. If set to 'true', the value of
protected_branch_ids
is ignored. Default is 'false'. - disable
Importing BooleanDefault Any Approver Rule On Create - When this flag is set, the default
any_approver
rule will not be imported if present. - group
Ids List<Number> - A list of group IDs whose members can approve of the merge request.
- name String
- The name of the approval rule.
- protected
Branch List<Number>Ids - A list of protected branch IDs (not branch names) for which the rule applies.
- report
Type String - Report type is required when the rule_type is
report_approver
. Valid values arecode_coverage
. - rule
Type String - String, defaults to 'regular'. The type of rule.
any_approver
is a pre-configured default rule withapprovals_required
at0
. Valid values areregular
,any_approver
,report_approver
. - user
Ids List<Number> - A list of specific User IDs to add to the list of approvers.
Outputs
All input properties are implicitly available as output properties. Additionally, the ProjectApprovalRule 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 ProjectApprovalRule Resource
Get an existing ProjectApprovalRule 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?: ProjectApprovalRuleState, opts?: CustomResourceOptions): ProjectApprovalRule
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
applies_to_all_protected_branches: Optional[bool] = None,
approvals_required: Optional[int] = None,
disable_importing_default_any_approver_rule_on_create: Optional[bool] = None,
group_ids: Optional[Sequence[int]] = None,
name: Optional[str] = None,
project: Optional[str] = None,
protected_branch_ids: Optional[Sequence[int]] = None,
report_type: Optional[str] = None,
rule_type: Optional[str] = None,
user_ids: Optional[Sequence[int]] = None) -> ProjectApprovalRule
func GetProjectApprovalRule(ctx *Context, name string, id IDInput, state *ProjectApprovalRuleState, opts ...ResourceOption) (*ProjectApprovalRule, error)
public static ProjectApprovalRule Get(string name, Input<string> id, ProjectApprovalRuleState? state, CustomResourceOptions? opts = null)
public static ProjectApprovalRule get(String name, Output<String> id, ProjectApprovalRuleState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Applies
To boolAll Protected Branches - Whether the rule is applied to all protected branches. If set to 'true', the value of
protected_branch_ids
is ignored. Default is 'false'. - Approvals
Required int - The number of approvals required for this rule.
- Disable
Importing boolDefault Any Approver Rule On Create - When this flag is set, the default
any_approver
rule will not be imported if present. - Group
Ids List<int> - A list of group IDs whose members can approve of the merge request.
- Name string
- The name of the approval rule.
- Project string
- The name or id of the project to add the approval rules.
- Protected
Branch List<int>Ids - A list of protected branch IDs (not branch names) for which the rule applies.
- Report
Type string - Report type is required when the rule_type is
report_approver
. Valid values arecode_coverage
. - Rule
Type string - String, defaults to 'regular'. The type of rule.
any_approver
is a pre-configured default rule withapprovals_required
at0
. Valid values areregular
,any_approver
,report_approver
. - User
Ids List<int> - A list of specific User IDs to add to the list of approvers.
- Applies
To boolAll Protected Branches - Whether the rule is applied to all protected branches. If set to 'true', the value of
protected_branch_ids
is ignored. Default is 'false'. - Approvals
Required int - The number of approvals required for this rule.
- Disable
Importing boolDefault Any Approver Rule On Create - When this flag is set, the default
any_approver
rule will not be imported if present. - Group
Ids []int - A list of group IDs whose members can approve of the merge request.
- Name string
- The name of the approval rule.
- Project string
- The name or id of the project to add the approval rules.
- Protected
Branch []intIds - A list of protected branch IDs (not branch names) for which the rule applies.
- Report
Type string - Report type is required when the rule_type is
report_approver
. Valid values arecode_coverage
. - Rule
Type string - String, defaults to 'regular'. The type of rule.
any_approver
is a pre-configured default rule withapprovals_required
at0
. Valid values areregular
,any_approver
,report_approver
. - User
Ids []int - A list of specific User IDs to add to the list of approvers.
- applies
To BooleanAll Protected Branches - Whether the rule is applied to all protected branches. If set to 'true', the value of
protected_branch_ids
is ignored. Default is 'false'. - approvals
Required Integer - The number of approvals required for this rule.
- disable
Importing BooleanDefault Any Approver Rule On Create - When this flag is set, the default
any_approver
rule will not be imported if present. - group
Ids List<Integer> - A list of group IDs whose members can approve of the merge request.
- name String
- The name of the approval rule.
- project String
- The name or id of the project to add the approval rules.
- protected
Branch List<Integer>Ids - A list of protected branch IDs (not branch names) for which the rule applies.
- report
Type String - Report type is required when the rule_type is
report_approver
. Valid values arecode_coverage
. - rule
Type String - String, defaults to 'regular'. The type of rule.
any_approver
is a pre-configured default rule withapprovals_required
at0
. Valid values areregular
,any_approver
,report_approver
. - user
Ids List<Integer> - A list of specific User IDs to add to the list of approvers.
- applies
To booleanAll Protected Branches - Whether the rule is applied to all protected branches. If set to 'true', the value of
protected_branch_ids
is ignored. Default is 'false'. - approvals
Required number - The number of approvals required for this rule.
- disable
Importing booleanDefault Any Approver Rule On Create - When this flag is set, the default
any_approver
rule will not be imported if present. - group
Ids number[] - A list of group IDs whose members can approve of the merge request.
- name string
- The name of the approval rule.
- project string
- The name or id of the project to add the approval rules.
- protected
Branch number[]Ids - A list of protected branch IDs (not branch names) for which the rule applies.
- report
Type string - Report type is required when the rule_type is
report_approver
. Valid values arecode_coverage
. - rule
Type string - String, defaults to 'regular'. The type of rule.
any_approver
is a pre-configured default rule withapprovals_required
at0
. Valid values areregular
,any_approver
,report_approver
. - user
Ids number[] - A list of specific User IDs to add to the list of approvers.
- applies_
to_ boolall_ protected_ branches - Whether the rule is applied to all protected branches. If set to 'true', the value of
protected_branch_ids
is ignored. Default is 'false'. - approvals_
required int - The number of approvals required for this rule.
- disable_
importing_ booldefault_ any_ approver_ rule_ on_ create - When this flag is set, the default
any_approver
rule will not be imported if present. - group_
ids Sequence[int] - A list of group IDs whose members can approve of the merge request.
- name str
- The name of the approval rule.
- project str
- The name or id of the project to add the approval rules.
- protected_
branch_ Sequence[int]ids - A list of protected branch IDs (not branch names) for which the rule applies.
- report_
type str - Report type is required when the rule_type is
report_approver
. Valid values arecode_coverage
. - rule_
type str - String, defaults to 'regular'. The type of rule.
any_approver
is a pre-configured default rule withapprovals_required
at0
. Valid values areregular
,any_approver
,report_approver
. - user_
ids Sequence[int] - A list of specific User IDs to add to the list of approvers.
- applies
To BooleanAll Protected Branches - Whether the rule is applied to all protected branches. If set to 'true', the value of
protected_branch_ids
is ignored. Default is 'false'. - approvals
Required Number - The number of approvals required for this rule.
- disable
Importing BooleanDefault Any Approver Rule On Create - When this flag is set, the default
any_approver
rule will not be imported if present. - group
Ids List<Number> - A list of group IDs whose members can approve of the merge request.
- name String
- The name of the approval rule.
- project String
- The name or id of the project to add the approval rules.
- protected
Branch List<Number>Ids - A list of protected branch IDs (not branch names) for which the rule applies.
- report
Type String - Report type is required when the rule_type is
report_approver
. Valid values arecode_coverage
. - rule
Type String - String, defaults to 'regular'. The type of rule.
any_approver
is a pre-configured default rule withapprovals_required
at0
. Valid values areregular
,any_approver
,report_approver
. - user
Ids List<Number> - A list of specific User IDs to add to the list of approvers.
Import
GitLab project approval rules can be imported using a key composed of <project-id>:<rule-id>
, e.g.
$ pulumi import gitlab:index/projectApprovalRule:ProjectApprovalRule example "12345:6"
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- GitLab pulumi/pulumi-gitlab
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
gitlab
Terraform Provider.