branch_rules
Creates, updates, deletes, gets or lists a branch_rules
resource.
Overview
Name | branch_rules |
Type | Resource |
Id | google.securesourcemanager.branch_rules |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Optional. A unique identifier for a BranchRule. The name should be of the format: projects/{project}/locations/{location}/repositories/{repository}/branchRules/{branch_rule} |
allowStaleReviews | boolean | Optional. Determines if allow stale reviews or approvals before merging to the branch. |
annotations | object | Optional. User annotations. These attributes can only be set and used by the user. See https://google.aip.dev/128#annotations for more details such as format and size limitations. |
createTime | string (google-datetime) | Output only. Create timestamp. |
disabled | boolean | Optional. Determines if the branch rule is disabled or not. |
etag | string | Optional. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. |
includePattern | string | Optional. The pattern of the branch that can match to this BranchRule. Specified as regex. .* for all branches. Examples: main, (main|release.*). Current MVP phase only support .* for wildcard. |
minimumApprovalsCount | integer (int32) | Optional. The minimum number of approvals required for the branch rule to be matched. |
minimumReviewsCount | integer (int32) | Optional. The minimum number of reviews required for the branch rule to be matched. |
requireCommentsResolved | boolean | Optional. Determines if require comments resolved before merging to the branch. |
requireLinearHistory | boolean | Optional. Determines if require linear history before merging to the branch. |
requirePullRequest | boolean | Optional. Determines if the branch rule requires a pull request or not. |
requiredStatusChecks | array | Optional. List of required status checks before merging to the branch. |
uid | string | Output only. Unique identifier of the repository. |
updateTime | string (google-datetime) | Output only. Update timestamp. |
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Optional. A unique identifier for a BranchRule. The name should be of the format: projects/{project}/locations/{location}/repositories/{repository}/branchRules/{branch_rule} |
allowStaleReviews | boolean | Optional. Determines if allow stale reviews or approvals before merging to the branch. |
annotations | object | Optional. User annotations. These attributes can only be set and used by the user. See https://google.aip.dev/128#annotations for more details such as format and size limitations. |
createTime | string (google-datetime) | Output only. Create timestamp. |
disabled | boolean | Optional. Determines if the branch rule is disabled or not. |
etag | string | Optional. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. |
includePattern | string | Optional. The pattern of the branch that can match to this BranchRule. Specified as regex. .* for all branches. Examples: main, (main|release.*). Current MVP phase only support .* for wildcard. |
minimumApprovalsCount | integer (int32) | Optional. The minimum number of approvals required for the branch rule to be matched. |
minimumReviewsCount | integer (int32) | Optional. The minimum number of reviews required for the branch rule to be matched. |
requireCommentsResolved | boolean | Optional. Determines if require comments resolved before merging to the branch. |
requireLinearHistory | boolean | Optional. Determines if require linear history before merging to the branch. |
requirePullRequest | boolean | Optional. Determines if the branch rule requires a pull request or not. |
requiredStatusChecks | array | Optional. List of required status checks before merging to the branch. |
uid | string | Output only. Unique identifier of the repository. |
updateTime | string (google-datetime) | Output only. Update timestamp. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectsId , locationsId , repositoriesId , branchRulesId | GetBranchRule gets a branch rule. | |
list | select | projectsId , locationsId , repositoriesId | pageSize , pageToken | ListBranchRules lists branch rules in a given repository. |
create | insert | projectsId , locationsId , repositoriesId | branchRuleId | CreateBranchRule creates a branch rule in a given repository. |
patch | update | projectsId , locationsId , repositoriesId , branchRulesId | validateOnly , updateMask | UpdateBranchRule updates a branch rule. |
delete | delete | projectsId , locationsId , repositoriesId , branchRulesId | allowMissing | DeleteBranchRule deletes a branch rule. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
branchRulesId | string | |
locationsId | string | |
projectsId | string | |
repositoriesId | string | |
allowMissing | boolean | |
branchRuleId | string | |
pageSize | integer (int32) | |
pageToken | string | |
updateMask | string (google-fieldmask) | |
validateOnly | boolean |
SELECT
examples
- get
- list
GetBranchRule gets a branch rule.
SELECT
name,
allowStaleReviews,
annotations,
createTime,
disabled,
etag,
includePattern,
minimumApprovalsCount,
minimumReviewsCount,
requireCommentsResolved,
requireLinearHistory,
requirePullRequest,
requiredStatusChecks,
uid,
updateTime
FROM google.securesourcemanager.branch_rules
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND repositoriesId = '{{ repositoriesId }}' -- required
AND branchRulesId = '{{ branchRulesId }}' -- required;
ListBranchRules lists branch rules in a given repository.
SELECT
name,
allowStaleReviews,
annotations,
createTime,
disabled,
etag,
includePattern,
minimumApprovalsCount,
minimumReviewsCount,
requireCommentsResolved,
requireLinearHistory,
requirePullRequest,
requiredStatusChecks,
uid,
updateTime
FROM google.securesourcemanager.branch_rules
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND repositoriesId = '{{ repositoriesId }}' -- required
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}';
INSERT
examples
- create
- Manifest
CreateBranchRule creates a branch rule in a given repository.
INSERT INTO google.securesourcemanager.branch_rules (
data__name,
data__annotations,
data__etag,
data__includePattern,
data__disabled,
data__requirePullRequest,
data__minimumReviewsCount,
data__minimumApprovalsCount,
data__requireCommentsResolved,
data__allowStaleReviews,
data__requireLinearHistory,
data__requiredStatusChecks,
projectsId,
locationsId,
repositoriesId,
branchRuleId
)
SELECT
'{{ name }}',
'{{ annotations }}',
'{{ etag }}',
'{{ includePattern }}',
{{ disabled }},
{{ requirePullRequest }},
{{ minimumReviewsCount }},
{{ minimumApprovalsCount }},
{{ requireCommentsResolved }},
{{ allowStaleReviews }},
{{ requireLinearHistory }},
'{{ requiredStatusChecks }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ repositoriesId }}',
'{{ branchRuleId }}'
RETURNING
name,
done,
error,
metadata,
response
;
# Description fields are for documentation purposes
- name: branch_rules
props:
- name: projectsId
value: string
description: Required parameter for the branch_rules resource.
- name: locationsId
value: string
description: Required parameter for the branch_rules resource.
- name: repositoriesId
value: string
description: Required parameter for the branch_rules resource.
- name: name
value: string
description: >
Optional. A unique identifier for a BranchRule. The name should be of the format: `projects/{project}/locations/{location}/repositories/{repository}/branchRules/{branch_rule}`
- name: annotations
value: object
description: >
Optional. User annotations. These attributes can only be set and used by the user. See https://google.aip.dev/128#annotations for more details such as format and size limitations.
- name: etag
value: string
description: >
Optional. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
- name: includePattern
value: string
description: >
Optional. The pattern of the branch that can match to this BranchRule. Specified as regex. .* for all branches. Examples: main, (main|release.*). Current MVP phase only support `.*` for wildcard.
- name: disabled
value: boolean
description: >
Optional. Determines if the branch rule is disabled or not.
- name: requirePullRequest
value: boolean
description: >
Optional. Determines if the branch rule requires a pull request or not.
- name: minimumReviewsCount
value: integer
description: >
Optional. The minimum number of reviews required for the branch rule to be matched.
- name: minimumApprovalsCount
value: integer
description: >
Optional. The minimum number of approvals required for the branch rule to be matched.
- name: requireCommentsResolved
value: boolean
description: >
Optional. Determines if require comments resolved before merging to the branch.
- name: allowStaleReviews
value: boolean
description: >
Optional. Determines if allow stale reviews or approvals before merging to the branch.
- name: requireLinearHistory
value: boolean
description: >
Optional. Determines if require linear history before merging to the branch.
- name: requiredStatusChecks
value: array
description: >
Optional. List of required status checks before merging to the branch.
- name: branchRuleId
value: string
UPDATE
examples
- patch
UpdateBranchRule updates a branch rule.
UPDATE google.securesourcemanager.branch_rules
SET
data__name = '{{ name }}',
data__annotations = '{{ annotations }}',
data__etag = '{{ etag }}',
data__includePattern = '{{ includePattern }}',
data__disabled = {{ disabled }},
data__requirePullRequest = {{ requirePullRequest }},
data__minimumReviewsCount = {{ minimumReviewsCount }},
data__minimumApprovalsCount = {{ minimumApprovalsCount }},
data__requireCommentsResolved = {{ requireCommentsResolved }},
data__allowStaleReviews = {{ allowStaleReviews }},
data__requireLinearHistory = {{ requireLinearHistory }},
data__requiredStatusChecks = '{{ requiredStatusChecks }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND repositoriesId = '{{ repositoriesId }}' --required
AND branchRulesId = '{{ branchRulesId }}' --required
AND validateOnly = {{ validateOnly}}
AND updateMask = '{{ updateMask}}'
RETURNING
name,
done,
error,
metadata,
response;
DELETE
examples
- delete
DeleteBranchRule deletes a branch rule.
DELETE FROM google.securesourcemanager.branch_rules
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND repositoriesId = '{{ repositoriesId }}' --required
AND branchRulesId = '{{ branchRulesId }}' --required
AND allowMissing = '{{ allowMissing }}';