UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

313 lines (312 loc) • 10.8 kB
import * as pulumi from "@pulumi/pulumi"; /** * BranchRule is the protection rule to enforce pre-defined rules on designated branches within a repository. * * To get more information about BranchRule, see: * * * [API documentation](https://cloud.google.com/secure-source-manager/docs/reference/rest/v1/projects.locations.repositories.branchRules) * * How-to Guides * * [Official Documentation](https://cloud.google.com/secure-source-manager/docs/overview) * * ## Example Usage * * ### Secure Source Manager Branch Rule Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.securesourcemanager.Instance("instance", { * location: "us-central1", * instanceId: "my-basic-instance", * deletionPolicy: "PREVENT", * }); * const repository = new gcp.securesourcemanager.Repository("repository", { * repositoryId: "my-basic-repository", * location: instance.location, * instance: instance.name, * deletionPolicy: "PREVENT", * }); * const basic = new gcp.securesourcemanager.BranchRule("basic", { * branchRuleId: "my-basic-branchrule", * repositoryId: repository.repositoryId, * location: repository.location, * includePattern: "main", * }); * ``` * ### Secure Source Manager Branch Rule With Fields * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.securesourcemanager.Instance("instance", { * location: "us-central1", * instanceId: "my-initial-instance", * deletionPolicy: "PREVENT", * }); * const repository = new gcp.securesourcemanager.Repository("repository", { * repositoryId: "my-initial-repository", * instance: instance.name, * location: instance.location, * deletionPolicy: "PREVENT", * }); * const _default = new gcp.securesourcemanager.BranchRule("default", { * branchRuleId: "my-initial-branchrule", * location: repository.location, * repositoryId: repository.repositoryId, * includePattern: "test", * minimumApprovalsCount: 2, * minimumReviewsCount: 2, * requireCommentsResolved: true, * requireLinearHistory: true, * requirePullRequest: true, * disabled: false, * allowStaleReviews: false, * }); * ``` * * ## Import * * BranchRule can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/branchRules/{{branch_rule_id}}` * * * `{{project}}/{{location}}/{{repository_id}}/{{branch_rule_id}}` * * * `{{location}}/{{repository_id}}/{{branch_rule_id}}` * * * `{{branch_rule_id}}` * * When using the `pulumi import` command, BranchRule can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:securesourcemanager/branchRule:BranchRule default projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/branchRules/{{branch_rule_id}} * ``` * * ```sh * $ pulumi import gcp:securesourcemanager/branchRule:BranchRule default {{project}}/{{location}}/{{repository_id}}/{{branch_rule_id}} * ``` * * ```sh * $ pulumi import gcp:securesourcemanager/branchRule:BranchRule default {{location}}/{{repository_id}}/{{branch_rule_id}} * ``` * * ```sh * $ pulumi import gcp:securesourcemanager/branchRule:BranchRule default {{branch_rule_id}} * ``` */ export declare class BranchRule extends pulumi.CustomResource { /** * Get an existing BranchRule resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: BranchRuleState, opts?: pulumi.CustomResourceOptions): BranchRule; /** * Returns true if the given object is an instance of BranchRule. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is BranchRule; /** * Determines if allow stale reviews or approvals before merging to the branch. */ readonly allowStaleReviews: pulumi.Output<boolean | undefined>; /** * The ID for the BranchRule. */ readonly branchRuleId: pulumi.Output<string>; /** * Time the BranchRule was created in UTC. */ readonly createTime: pulumi.Output<string>; /** * Determines if the branch rule is disabled or not. */ readonly disabled: pulumi.Output<boolean | undefined>; /** * The BranchRule matches branches based on the specified regular expression. Use .* to match all branches. */ readonly includePattern: pulumi.Output<string>; /** * The location for the Repository. */ readonly location: pulumi.Output<string>; /** * The minimum number of approvals required for the branch rule to be matched. */ readonly minimumApprovalsCount: pulumi.Output<number | undefined>; /** * The minimum number of reviews required for the branch rule to be matched. */ readonly minimumReviewsCount: pulumi.Output<number | undefined>; /** * The resource name for the BranchRule. */ readonly name: pulumi.Output<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output<string>; /** * The ID for the Repository. */ readonly repositoryId: pulumi.Output<string>; /** * Determines if require comments resolved before merging to the branch. */ readonly requireCommentsResolved: pulumi.Output<boolean | undefined>; /** * Determines if require linear history before merging to the branch. */ readonly requireLinearHistory: pulumi.Output<boolean | undefined>; /** * Determines if the branch rule requires a pull request or not. */ readonly requirePullRequest: pulumi.Output<boolean | undefined>; /** * Unique identifier of the BranchRule. */ readonly uid: pulumi.Output<string>; /** * Time the BranchRule was updated in UTC. */ readonly updateTime: pulumi.Output<string>; /** * Create a BranchRule resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: BranchRuleArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering BranchRule resources. */ export interface BranchRuleState { /** * Determines if allow stale reviews or approvals before merging to the branch. */ allowStaleReviews?: pulumi.Input<boolean>; /** * The ID for the BranchRule. */ branchRuleId?: pulumi.Input<string>; /** * Time the BranchRule was created in UTC. */ createTime?: pulumi.Input<string>; /** * Determines if the branch rule is disabled or not. */ disabled?: pulumi.Input<boolean>; /** * The BranchRule matches branches based on the specified regular expression. Use .* to match all branches. */ includePattern?: pulumi.Input<string>; /** * The location for the Repository. */ location?: pulumi.Input<string>; /** * The minimum number of approvals required for the branch rule to be matched. */ minimumApprovalsCount?: pulumi.Input<number>; /** * The minimum number of reviews required for the branch rule to be matched. */ minimumReviewsCount?: pulumi.Input<number>; /** * The resource name for the BranchRule. */ name?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * The ID for the Repository. */ repositoryId?: pulumi.Input<string>; /** * Determines if require comments resolved before merging to the branch. */ requireCommentsResolved?: pulumi.Input<boolean>; /** * Determines if require linear history before merging to the branch. */ requireLinearHistory?: pulumi.Input<boolean>; /** * Determines if the branch rule requires a pull request or not. */ requirePullRequest?: pulumi.Input<boolean>; /** * Unique identifier of the BranchRule. */ uid?: pulumi.Input<string>; /** * Time the BranchRule was updated in UTC. */ updateTime?: pulumi.Input<string>; } /** * The set of arguments for constructing a BranchRule resource. */ export interface BranchRuleArgs { /** * Determines if allow stale reviews or approvals before merging to the branch. */ allowStaleReviews?: pulumi.Input<boolean>; /** * The ID for the BranchRule. */ branchRuleId: pulumi.Input<string>; /** * Determines if the branch rule is disabled or not. */ disabled?: pulumi.Input<boolean>; /** * The BranchRule matches branches based on the specified regular expression. Use .* to match all branches. */ includePattern: pulumi.Input<string>; /** * The location for the Repository. */ location: pulumi.Input<string>; /** * The minimum number of approvals required for the branch rule to be matched. */ minimumApprovalsCount?: pulumi.Input<number>; /** * The minimum number of reviews required for the branch rule to be matched. */ minimumReviewsCount?: pulumi.Input<number>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * The ID for the Repository. */ repositoryId: pulumi.Input<string>; /** * Determines if require comments resolved before merging to the branch. */ requireCommentsResolved?: pulumi.Input<boolean>; /** * Determines if require linear history before merging to the branch. */ requireLinearHistory?: pulumi.Input<boolean>; /** * Determines if the branch rule requires a pull request or not. */ requirePullRequest?: pulumi.Input<boolean>; }