Skip to main content

approval_rule_templates

Creates, updates, deletes, gets or lists an approval_rule_templates resource.

Overview

Nameapproval_rule_templates
TypeResource
Idaws.codecommit.approval_rule_templates

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
approval_rule_template_contentstringThe content of the approval rule template.
approval_rule_template_descriptionstringThe description of the approval rule template.
approval_rule_template_idstringThe system-generated ID of the approval rule template.
approval_rule_template_namestringThe name of the approval rule template.
creation_datestring (date-time)The date the approval rule template was created, in timestamp format.
last_modified_datestring (date-time)The date the approval rule template was most recently changed, in timestamp format.
last_modified_userstringThe Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
rule_content_sha_256stringThe SHA-256 hash signature for the content of the approval rule template.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_approval_rule_templateselectregionReturns information about a specified approval rule template.
list_approval_rule_templatesselectregionLists all approval rule templates in the specified Amazon Web Services Region in your Amazon Web Services account. If an Amazon Web Services Region is not specified, the Amazon Web Services Region where you are signed in is used.
create_approval_rule_templateinsertregion, approvalRuleTemplateName, approvalRuleTemplateContentCreates a template for approval rules that can then be associated with one or more repositories in your Amazon Web Services account. When you associate a template with a repository, CodeCommit creates an approval rule that matches the conditions of the template for all pull requests that meet the conditions of the template. For more information, see AssociateApprovalRuleTemplateWithRepository.
update_approval_rule_template_contentupdateregion, approvalRuleTemplateName, newRuleContentUpdates the content of an approval rule template. You can change the number of required approvals, the membership of the approval rule, and whether an approval pool is defined.
update_approval_rule_template_descriptionupdateregion, approvalRuleTemplateName, approvalRuleTemplateDescriptionUpdates the description for a specified approval rule template.
update_approval_rule_template_nameupdateregion, oldApprovalRuleTemplateName, newApprovalRuleTemplateNameUpdates the name of a specified approval rule template.
delete_approval_rule_templatedeleteregionDeletes a specified approval rule template. Deleting a template does not remove approval rules on pull requests already created with the template.

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.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Returns information about a specified approval rule template.

SELECT
approval_rule_template_content,
approval_rule_template_description,
approval_rule_template_id,
approval_rule_template_name,
creation_date,
last_modified_date,
last_modified_user,
rule_content_sha_256
FROM aws.codecommit.approval_rule_templates
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a template for approval rules that can then be associated with one or more repositories in your Amazon Web Services account. When you associate a template with a repository, CodeCommit creates an approval rule that matches the conditions of the template for all pull requests that meet the conditions of the template. For more information, see AssociateApprovalRuleTemplateWithRepository.

INSERT INTO aws.codecommit.approval_rule_templates (
approvalRuleTemplateName,
approvalRuleTemplateContent,
approvalRuleTemplateDescription,
region
)
SELECT
'{{ approvalRuleTemplateName }}' /* required */,
'{{ approvalRuleTemplateContent }}' /* required */,
'{{ approvalRuleTemplateDescription }}',
'{{ region }}'
RETURNING
approval_rule_template
;

UPDATE examples

Updates the content of an approval rule template. You can change the number of required approvals, the membership of the approval rule, and whether an approval pool is defined.

UPDATE aws.codecommit.approval_rule_templates
SET
approvalRuleTemplateName = '{{ approvalRuleTemplateName }}',
newRuleContent = '{{ newRuleContent }}',
existingRuleContentSha256 = '{{ existingRuleContentSha256 }}'
WHERE
region = '{{ region }}' --required
AND approvalRuleTemplateName = '{{ approvalRuleTemplateName }}' --required
AND newRuleContent = '{{ newRuleContent }}' --required
RETURNING
approval_rule_template;

DELETE examples

Deletes a specified approval rule template. Deleting a template does not remove approval rules on pull requests already created with the template.

DELETE FROM aws.codecommit.approval_rule_templates
WHERE region = '{{ region }}' --required
;