approval_rule_templates
Creates, updates, deletes, gets or lists an approval_rule_templates resource.
Overview
| Name | approval_rule_templates |
| Type | Resource |
| Id | aws.codecommit.approval_rule_templates |
Fields
The following fields are returned by SELECT queries:
- get_approval_rule_template
- list_approval_rule_templates
| Name | Datatype | Description |
|---|---|---|
approval_rule_template_content | string | The content of the approval rule template. |
approval_rule_template_description | string | The description of the approval rule template. |
approval_rule_template_id | string | The system-generated ID of the approval rule template. |
approval_rule_template_name | string | The name of the approval rule template. |
creation_date | string (date-time) | The date the approval rule template was created, in timestamp format. |
last_modified_date | string (date-time) | The date the approval rule template was most recently changed, in timestamp format. |
last_modified_user | string | The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template. |
rule_content_sha_256 | string | The SHA-256 hash signature for the content of the approval rule template. |
| Name | Datatype | Description |
|---|---|---|
approval_rule_template_name | string | The names of all the approval rule templates found in the Amazon Web Services Region for your Amazon Web Services account. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_approval_rule_template | select | region | Returns information about a specified approval rule template. | |
list_approval_rule_templates | select | region | Lists 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_template | insert | region, approvalRuleTemplateName, approvalRuleTemplateContent | 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. | |
update_approval_rule_template_content | update | region, approvalRuleTemplateName, newRuleContent | 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_approval_rule_template_description | update | region, approvalRuleTemplateName, approvalRuleTemplateDescription | Updates the description for a specified approval rule template. | |
update_approval_rule_template_name | update | region, oldApprovalRuleTemplateName, newApprovalRuleTemplateName | Updates the name of a specified approval rule template. | |
delete_approval_rule_template | delete | region | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_approval_rule_template
- list_approval_rule_templates
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
;
Lists 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.
SELECT
approval_rule_template_name
FROM aws.codecommit.approval_rule_templates
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_approval_rule_template
- Manifest
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
;
# Description fields are for documentation purposes
- name: approval_rule_templates
props:
- name: region
value: "{{ region }}"
description: Required parameter for the approval_rule_templates resource.
- name: approvalRuleTemplateName
value: "{{ approvalRuleTemplateName }}"
description: |
The name of the approval rule template. Provide descriptive names, because this name is applied to the approval rules created automatically in associated repositories.
- name: approvalRuleTemplateContent
value: "{{ approvalRuleTemplateContent }}"
description: |
The content of the approval rule that is created on pull requests in associated repositories. If you specify one or more destination references (branches), approval rules are created in an associated repository only if their destination references (branches) match those specified in the template. When you create the content of the approval rule template, you can specify approvers in an approval pool in one of two ways: CodeCommitApprovers: This option only requires an Amazon Web Services account and a resource. It can be used for both IAM users and federated access users whose name matches the provided resource name. This is a very powerful option that offers a great deal of flexibility. For example, if you specify the Amazon Web Services account 123456789012 and Mary_Major, all of the following are counted as approvals coming from that user: An IAM user in the account (arn:aws:iam::123456789012:user/Mary_Major) A federated user identified in IAM as Mary_Major (arn:aws:sts::123456789012:federated-user/Mary_Major) This option does not recognize an active session of someone assuming the role of CodeCommitReview with a role session name of Mary_Major (arn:aws:sts::123456789012:assumed-role/CodeCommitReview/Mary_Major) unless you include a wildcard (*Mary_Major). Fully qualified ARN: This option allows you to specify the fully qualified Amazon Resource Name (ARN) of the IAM user or role. For more information about IAM ARNs, wildcards, and formats, see IAM Identifiers in the IAM User Guide.
- name: approvalRuleTemplateDescription
value: "{{ approvalRuleTemplateDescription }}"
description: |
The description of the approval rule template. Consider providing a description that explains what this template does and when it might be appropriate to associate it with repositories.
UPDATE examples
- update_approval_rule_template_content
- update_approval_rule_template_description
- update_approval_rule_template_name
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;
Updates the description for a specified approval rule template.
UPDATE aws.codecommit.approval_rule_templates
SET
approvalRuleTemplateName = '{{ approvalRuleTemplateName }}',
approvalRuleTemplateDescription = '{{ approvalRuleTemplateDescription }}'
WHERE
region = '{{ region }}' --required
AND approvalRuleTemplateName = '{{ approvalRuleTemplateName }}' --required
AND approvalRuleTemplateDescription = '{{ approvalRuleTemplateDescription }}' --required
RETURNING
approval_rule_template;
Updates the name of a specified approval rule template.
UPDATE aws.codecommit.approval_rule_templates
SET
oldApprovalRuleTemplateName = '{{ oldApprovalRuleTemplateName }}',
newApprovalRuleTemplateName = '{{ newApprovalRuleTemplateName }}'
WHERE
region = '{{ region }}' --required
AND oldApprovalRuleTemplateName = '{{ oldApprovalRuleTemplateName }}' --required
AND newApprovalRuleTemplateName = '{{ newApprovalRuleTemplateName }}' --required
RETURNING
approval_rule_template;
DELETE examples
- delete_approval_rule_template
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
;