Skip to content

Commit

Permalink
Merge pull request #6056 from elysahall/awsdocs-03-31
Browse files Browse the repository at this point in the history
New CLI examples for codecommit, ec2, elasticache, securityhub, iot, …
  • Loading branch information
vz10 authored Apr 2, 2021
2 parents bd43b4d + d413da8 commit bf00cdd
Show file tree
Hide file tree
Showing 71 changed files with 1,756 additions and 681 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The following ``associate-approval-rule-template-with-repository`` example assoc

aws codecommit associate-approval-rule-template-with-repository \
--repository-name MyDemoRepo \
--approval-rule-template-name 2-approver-rule-for-master
--approval-rule-template-name 2-approver-rule-for-main

This command produces no output.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Note: Approval rule templates are specific to the AWS Region where they are crea

aws codecommit batch-associate-approval-rule-template-with-repositories \
--repository-names MyDemoRepo, MyOtherDemoRepo \
--approval-rule-template-name 2-approver-rule-for-master
--approval-rule-template-name 2-approver-rule-for-main

Output::

Expand Down
7 changes: 3 additions & 4 deletions awscli/examples/codecommit/batch-describe-merge-conflicts.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
**To get information about merge conflicts in all files or a subset of files in a merge between two commit specifiers**

The following ``batch-describe-merge-conflicts`` example determines the merge conflicts for merging a source branch named ``feature-randomizationfeature`` with a destination branch named ``master`` using the ``THREE_WAY_MERGE`` strategy in a repository named ``MyDemoRepo``. ::
The following ``batch-describe-merge-conflicts`` example determines the merge conflicts for merging a source branch named ``feature-randomizationfeature`` with a destination branch named ``main`` using the ``THREE_WAY_MERGE`` strategy in a repository named ``MyDemoRepo``. ::

aws codecommit batch-describe-merge-conflicts \
--source-commit-specifier feature-randomizationfeature \
--destination-commit-specifier master \
--destination-commit-specifier main \
--merge-option THREE_WAY_MERGE \
--repository-name MyDemoRepo

Expand Down Expand Up @@ -67,5 +67,4 @@ Output::
"baseCommitId": "767b6958EXAMPLE"
}


For more information, see `Resolve Conflicts in a Pull Request <https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-resolve-conflict-pull-request.html#batch-describe-merge-conflicts>`__ in the *AWS CodeCommit User Guide*.
For more information, see `Resolve Conflicts in a Pull Request <https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-resolve-conflict-pull-request.html#batch-describe-merge-conflicts>`__ in the *AWS CodeCommit User Guide*.
28 changes: 14 additions & 14 deletions awscli/examples/codecommit/batch-get-repositories.rst
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
**To view details about multiple repositories**

This example shows details about multiple AWS CodeCommit repositories.
This example shows details about multiple AWS CodeCommit repositories. ::

Command::

aws codecommit batch-get-repositories --repository-names MyDemoRepo MyOtherDemoRepo
aws codecommit batch-get-repositories \
--repository-names MyDemoRepo MyOtherDemoRepo

Output::

{
{
"repositoriesNotFound": [],
"repositories": [
{
"creationDate": 1429203623.625,
"defaultBranch": "master",
"defaultBranch": "main",
"repositoryName": "MyDemoRepo",
"cloneUrlSsh": "ssh://ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos//v1/repos/MyDemoRepo",
"cloneUrlSsh": "ssh://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo",
"lastModifiedDate": 1430783812.0869999,
"repositoryDescription": "My demonstration repository",
"cloneUrlHttp": "https://codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo",
"cloneUrlHttp": "https://codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo",
"repositoryId": "f7579e13-b83e-4027-aaef-650c0EXAMPLE",
"Arn": "arn:aws:codecommit:us-east-1:111111111111EXAMPLE:MyDemoRepo",
"Arn": "arn:aws:codecommit:us-east-2:111111111111:MyDemoRepo"
"accountId": "111111111111"
},
{
"creationDate": 1429203623.627,
"defaultBranch": "master",
"defaultBranch": "main",
"repositoryName": "MyOtherDemoRepo",
"cloneUrlSsh": "ssh://ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos//v1/repos/MyOtherDemoRepo",
"cloneUrlSsh": "ssh://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyOtherDemoRepo",
"lastModifiedDate": 1430783812.0889999,
"repositoryDescription": "My other demonstration repository",
"cloneUrlHttp": "https://codecommit.us-east-1.amazonaws.com/v1/repos/MyOtherDemoRepo",
"cloneUrlHttp": "https://codecommit.us-east-2.amazonaws.com/v1/repos/MyOtherDemoRepo",
"repositoryId": "cfc29ac4-b0cb-44dc-9990-f6f51EXAMPLE",
"Arn": "arn:aws:codecommit:us-east-1:111111111111EXAMPLE:MyOtherDemoRepo",
"Arn": "arn:aws:codecommit:us-east-2:111111111111:MyOtherDemoRepo"
"accountId": "111111111111"
}
],
"repositoriesNotFound": []
}
}
16 changes: 8 additions & 8 deletions awscli/examples/codecommit/create-approval-rule-template.rst
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
**To create an approval rule template**

The following ``create-approval-rule-template`` example creates an approval rule template named ``2-approver-rule-for-master ``. The template requires two users who assume the role of ``CodeCommitReview`` to approve any pull request before it can be merged to the ``master`` branch. ::
The following ``create-approval-rule-template`` example creates an approval rule template named ``2-approver-rule-for-main ``. The template requires two users who assume the role of ``CodeCommitReview`` to approve any pull request before it can be merged to the ``main`` branch. ::

aws codecommit create-approval-rule-template \
--approval-rule-template-name 2-approver-rule-for-master \
--approval-rule-template-description "Requires two developers from the team to approve the pull request if the destination branch is master" \
--approval-rule-template-content "{\"Version\": \"2018-11-08\",\"DestinationReferences\": [\"refs/heads/master\"],\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}"
--approval-rule-template-name 2-approver-rule-for-main \
--approval-rule-template-description "Requires two developers from the team to approve the pull request if the destination branch is main" \
--approval-rule-template-content "{\"Version\": \"2018-11-08\",\"DestinationReferences\": [\"refs/heads/main\"],\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}"

Output::

{
"approvalRuleTemplate": {
"approvalRuleTemplateName": "2-approver-rule-for-master",
"approvalRuleTemplateName": "2-approver-rule-for-main",
"creationDate": 1571356106.936,
"approvalRuleTemplateId": "dd8b17fe-EXAMPLE",
"approvalRuleTemplateContent": "{\"Version\": \"2018-11-08\",\"DestinationReferences\": [\"refs/heads/master\"],\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}",
"approvalRuleTemplateContent": "{\"Version\": \"2018-11-08\",\"DestinationReferences\": [\"refs/heads/main\"],\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}",
"lastModifiedUser": "arn:aws:iam::123456789012:user/Mary_Major",
"approvalRuleTemplateDescription": "Requires two developers from the team to approve the pull request if the destination branch is master",
"approvalRuleTemplateDescription": "Requires two developers from the team to approve the pull request if the destination branch is main",
"lastModifiedDate": 1571356106.936,
"ruleContentSha256": "4711b576EXAMPLE"
}
}

For more information, see `Create an Approval Rule Template <https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-create-template.html#create-template-cli>`__ in the *AWS CodeCommit User Guide*.
For more information, see `Create an Approval Rule Template <https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-create-template.html#create-template-cli>`__ in the *AWS CodeCommit User Guide*.
11 changes: 6 additions & 5 deletions awscli/examples/codecommit/create-commit.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
**To create a commit**

The following ``create-commit`` example demonstrates how to create an initial commit for a repository that adds a ``readme.md`` file to a repository named ``MyDemoRepo`` in the ``master`` branch. ::
The following ``create-commit`` example demonstrates how to create an initial commit for a repository that adds a ``readme.md`` file to a repository named ``MyDemoRepo`` in the ``main`` branch. ::

aws codecommit create-commit --repository-name MyDemoRepo --branch-name master --put-files "filePath=readme.md,fileContent='Welcome to our team repository.'"
aws codecommit create-commit \
--repository-name MyDemoRepo \
--branch-name main \
--put-files "filePath=readme.md,fileContent='Welcome to our team repository.'"

Output::

Expand All @@ -20,6 +23,4 @@ Output::
"filesUpdated": []
}

For more information, see `Create a Commit in AWS CodeCommit`_ in the *AWS CodeCommit User Guide*.

.. _`Create a Commit in AWS CodeCommit`: https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-create-commit.html#how-to-create-commit-cli
For more information, see `Create a Commit in AWS CodeCommit <https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-create-commit.html#how-to-create-commit-cli>`__ in the *AWS CodeCommit User Guide*.
45 changes: 30 additions & 15 deletions awscli/examples/codecommit/create-pull-request.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**To create a pull request**

The following ``create-pull-request`` example creates a pull request named 'My Pull Request' with a description of 'Please review these changes by Tuesday' that targets the 'MyNewBranch' source branch and is to be merged to the default branch 'master' in an AWS CodeCommit repository named 'MyDemoRepo'. ::
The following ``create-pull-request`` example creates a pull request named 'Pronunciation difficulty analyzer' with a description of 'Please review these changes by Tuesday' that targets the 'jane-branch' source branch and is to be merged to the default branch 'main' in an AWS CodeCommit repository named 'MyDemoRepo'. ::

aws codecommit create-pull-request \
--title "My Pull Request" \
Expand All @@ -11,26 +11,41 @@ The following ``create-pull-request`` example creates a pull request named 'My P
Output::

{
"pullRequest": {
"pullRequest": {
"approvalRules": [
{
"approvalRuleContent": "{\"Version\": \"2018-11-08\",\"DestinationReferences\": [\"refs/heads/main\"],\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}",
"approvalRuleId": "dd8b17fe-EXAMPLE",
"approvalRuleName": "2-approver-rule-for-main",
"creationDate": 1571356106.936,
"lastModifiedDate": 571356106.936,
"lastModifiedUser": "arn:aws:iam::123456789012:user/Mary_Major",
"originApprovalRuleTemplate": {
"approvalRuleTemplateId": "dd3d22fe-EXAMPLE",
"approvalRuleTemplateName": "2-approver-rule-for-main"
},
"ruleContentSha256": "4711b576EXAMPLE"
}
],
"authorArn": "arn:aws:iam::111111111111:user/Jane_Doe",
"clientRequestToken": "123Example",
"creationDate": 1508962823.285,
"description": "Please review these changes by Tuesday",
"lastActivityDate": 1508962823.285,
"pullRequestId": "42",
"pullRequestStatus": "OPEN",
"pullRequestTargets": [
{
"title": "Pronunciation difficulty analyzer",
"pullRequestTargets": [
{
"destinationCommit": "5d036259EXAMPLE",
"destinationReference": "refs/heads/master",
"mergeMetadata": {
"isMerged": false,
},
"destinationReference": "refs/heads/main",
"repositoryName": "MyDemoRepo",
"sourceCommit": "317f8570EXAMPLE",
"sourceReference": "refs/heads/MyNewBranch"
"sourceReference": "refs/heads/jane-branch",
"mergeMetadata": {
"isMerged": false
}
}
],
"title": "My Pull Request"
"lastActivityDate": 1508962823.285,
"pullRequestId": "42",
"clientRequestToken": "123Example",
"pullRequestStatus": "OPEN",
"creationDate": 1508962823.285
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
**To create an unreferenced commit that represents the result of merging two commit specifiers**

The following ``create-unreferenced-merge-commit`` example creates a commit that represents the results of a merge between a source branch named ``bugfix-1234`` with a destination branch named ``master`` using the THREE_WAY_MERGE strategy in a repository named ``MyDemoRepo``. ::
The following ``create-unreferenced-merge-commit`` example creates a commit that represents the results of a merge between a source branch named ``bugfix-1234`` with a destination branch named ``main`` using the THREE_WAY_MERGE strategy in a repository named ``MyDemoRepo``. ::

aws codecommit create-unreferenced-merge-commit \
--source-commit-specifier bugfix-1234 \
--destination-commit-specifier master \
--destination-commit-specifier main \
--merge-option THREE_WAY_MERGE \
--repository-name MyDemoRepo \
--name "Maria Garcia" \
Expand Down
30 changes: 18 additions & 12 deletions awscli/examples/codecommit/delete-comment-content.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
**To delete the content of a comment**

You can only delete the content of a comment if you created the comment. This example demonstrates how to delete the content of a comment with the system-generated ID of 'ff30b348EXAMPLEb9aa670f'::
You can only delete the content of a comment if you created the comment. This example demonstrates how to delete the content of a comment with the system-generated ID of ``ff30b348EXAMPLEb9aa670f``. ::

aws codecommit delete-comment-content --comment-id ff30b348EXAMPLEb9aa670f
aws codecommit delete-comment-content \
--comment-id ff30b348EXAMPLEb9aa670f

Output::

{
"comment": {
"creationDate": 1508369768.142,
"deleted": true,
"lastModifiedDate": 1508369842.278,
"clientRequestToken": "123Example",
"commentId": "ff30b348EXAMPLEb9aa670f",
"authorArn": "arn:aws:iam::111111111111:user/Li_Juan"
}
}
{
"comment": {
"creationDate": 1508369768.142,
"deleted": true,
"lastModifiedDate": 1508369842.278,
"clientRequestToken": "123Example",
"commentId": "ff30b348EXAMPLEb9aa670f",
"authorArn": "arn:aws:iam::111111111111:user/Li_Juan",
"callerReactions": [],
"reactionCounts":
{
"CLAP" : 1
}
}
}
12 changes: 7 additions & 5 deletions awscli/examples/codecommit/delete-file.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
**To delete a file**

The following ``delete-file`` example demonstrates how to delete a file named ``README.md`` from a branch named ``master`` with a most recent commit ID of ``c5709475EXAMPLE`` in a repository named ``MyDemoRepo``. ::
The following ``delete-file`` example demonstrates how to delete a file named ``README.md`` from a branch named ``main`` with a most recent commit ID of ``c5709475EXAMPLE`` in a repository named ``MyDemoRepo``. ::

aws codecommit delete-file --repository-name MyDemoRepo --branch-name master --file-path README.md --parent-commit-id c5709475EXAMPLE
aws codecommit delete-file \
--repository-name MyDemoRepo \
--branch-name main \
--file-path README.md \
--parent-commit-id c5709475EXAMPLE

Output::

Expand All @@ -13,6 +17,4 @@ Output::
"treeId":"6bc824cEXAMPLE"
}

For more information, see `Edit or Delete a File in AWS CodeCommit`_ in the *AWS CodeCommit API Reference* guide.

.. _`Edit or Delete a File in AWS CodeCommit`: https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-edit-file.html?shortFooter=true#how-to-edit-file-cli
For more information, see `Edit or Delete a File in AWS CodeCommit <https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-edit-file.html?shortFooter=true#how-to-edit-file-cli>`__ in the *AWS CodeCommit API Reference* guide.
2 changes: 1 addition & 1 deletion awscli/examples/codecommit/describe-merge-conflicts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The following ``describe-merge-conflicts`` example determines the merge conflict

aws codecommit describe-merge-conflicts \
--source-commit-specifier feature-randomizationfeature \
--destination-commit-specifier master \
--destination-commit-specifier main \
--merge-option THREE_WAY_MERGE \
--file-path readme.md \
--repository-name MyDemoRepo
Expand Down
35 changes: 21 additions & 14 deletions awscli/examples/codecommit/get-comment.rst
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
**To view details of a comment**

This example demonstrates how to view details of a comment with the system-generated comment ID of 'ff30b348EXAMPLEb9aa670f'::
This example demonstrates how to view details of a comment with the system-generated comment ID of ``ff30b348EXAMPLEb9aa670f``. ::

aws codecommit get-comment --comment-id ff30b348EXAMPLEb9aa670f
aws codecommit get-comment \
--comment-id ff30b348EXAMPLEb9aa670f

Output::

{
"comment": {
"authorArn": "arn:aws:iam::111111111111:user/Li_Juan",
"clientRequestToken": "123Example",
"commentId": "ff30b348EXAMPLEb9aa670f",
"content": "Whoops - I meant to add this comment to the line, but I don't see how to delete it.",
"creationDate": 1508369768.142,
"deleted": false,
"commentId": "",
"lastModifiedDate": 1508369842.278
}
}
{
"comment": {
"authorArn": "arn:aws:iam::111111111111:user/Li_Juan",
"clientRequestToken": "123Example",
"commentId": "ff30b348EXAMPLEb9aa670f",
"content": "Whoops - I meant to add this comment to the line, but I don't see how to delete it.",
"creationDate": 1508369768.142,
"deleted": false,
"commentId": "",
"lastModifiedDate": 1508369842.278,
"callerReactions": [],
"reactionCounts":
{
"SMILE" : 6,
"THUMBSUP" : 1
}
}
}
Loading

0 comments on commit bf00cdd

Please sign in to comment.