Skip to content

Commit 5ea438f

Browse files
authored
Merge branch 'main' into hello-bedrock-runtime
2 parents d9a171d + f75c558 commit 5ea438f

File tree

88 files changed

+2163
-110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+2163
-110
lines changed

.doc_gen/metadata/iam_metadata.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,15 @@ iam_UpdateAccessKey:
889889
- description:
890890
snippet_tags:
891891
- iam.cpp.update_access_key.code
892+
Bash:
893+
versions:
894+
- sdk_version: 2
895+
github: aws-cli/bash-linux/iam
896+
sdkguide:
897+
excerpts:
898+
- description:
899+
snippet_tags:
900+
- aws-cli.bash-linux.iam.UpdateAccessKey
892901
services:
893902
iam: {UpdateAccessKey}
894903
iam_Scenario_ManageAccessKeys:

.doc_gen/metadata/s3_metadata.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,18 @@ s3_CopyObject:
293293
- description: Copy the object.
294294
snippet_tags:
295295
- s3.JavaScript.buckets.copyObjectV3
296+
- description: Copy the object on condition its ETag does not match the one provided.
297+
snippet_files:
298+
- javascriptv3/example_code/s3/actions/copy-object-conditional-request-if-match.js
299+
- description: Copy the object on condition its ETag does not match the one provided.
300+
snippet_files:
301+
- javascriptv3/example_code/s3/actions/copy-object-conditional-request-if-none-match.js
302+
- description: Copy the object using on condition it has been created or modified in a given timeframe.
303+
snippet_files:
304+
- javascriptv3/example_code/s3/actions/copy-object-conditional-request-if-modified-since.js
305+
- description: Copy the object using on condition it has not been created or modified in a given timeframe.
306+
snippet_files:
307+
- javascriptv3/example_code/s3/actions/copy-object-conditional-request-if-unmodified-since.js
296308
PHP:
297309
versions:
298310
- sdk_version: 3
@@ -951,6 +963,18 @@ s3_GetObject:
951963
- description: Download the object.
952964
snippet_tags:
953965
- s3.JavaScript.buckets.getobjectV3
966+
- description: Download the object on condition its ETag does not match the one provided.
967+
snippet_files:
968+
- javascriptv3/example_code/s3/actions/get-object-conditional-request-if-match.js
969+
- description: Download the object on condition its ETag does not match the one provided.
970+
snippet_files:
971+
- javascriptv3/example_code/s3/actions/get-object-conditional-request-if-none-match.js
972+
- description: Download the object using on condition it has been created or modified in a given timeframe.
973+
snippet_files:
974+
- javascriptv3/example_code/s3/actions/get-object-conditional-request-if-modified-since.js
975+
- description: Download the object using on condition it has not been created or modified in a given timeframe.
976+
snippet_files:
977+
- javascriptv3/example_code/s3/actions/get-object-conditional-request-if-unmodified-since.js
954978
Ruby:
955979
versions:
956980
- sdk_version: 3
@@ -1602,6 +1626,9 @@ s3_PutObject:
16021626
- description: Upload the object.
16031627
snippet_tags:
16041628
- s3.JavaScript.buckets.uploadV3
1629+
- description: Upload the object on condition its ETag matches the one provided.
1630+
snippet_files:
1631+
- javascriptv3/example_code/s3/actions/get-object-conditional-request-if-match.js
16051632
Ruby:
16061633
versions:
16071634
- sdk_version: 3
@@ -3617,6 +3644,29 @@ s3_Scenario_ConditionalRequests:
36173644
- description: A wrapper class for S3 functions.
36183645
snippet_tags:
36193646
- S3ConditionalRequests.dotnetv3.S3ActionsWrapper
3647+
JavaScript:
3648+
versions:
3649+
- sdk_version: 3
3650+
github: javascriptv3/example_code/s3/scenarios/conditional-requests
3651+
sdkguide:
3652+
excerpts:
3653+
- description: |
3654+
Entrypoint for the workflow (<noloc>index.js</noloc>). This orchestrates all of the steps.
3655+
Visit GitHub to see the implementation details for Scenario, ScenarioInput, ScenarioOutput, and ScenarioAction.
3656+
snippet_files:
3657+
- javascriptv3/example_code/s3/scenarios/conditional-requests/index.js
3658+
- description: Output welcome messages to the console (<noloc>welcome.steps.js</noloc>).
3659+
snippet_files:
3660+
- javascriptv3/example_code/s3/scenarios/conditional-requests/welcome.steps.js
3661+
- description: Deploy buckets and objects (<noloc>setup.steps.js</noloc>).
3662+
snippet_files:
3663+
- javascriptv3/example_code/s3/scenarios/conditional-requests/setup.steps.js
3664+
- description: Get, copy, and put objects using S3 conditional requests (<noloc>repl.steps.js</noloc>).
3665+
snippet_files:
3666+
- javascriptv3/example_code/s3/scenarios/conditional-requests/repl.steps.js
3667+
- description: Destroy all created resources (<noloc>clean.steps.js</noloc>).
3668+
snippet_files:
3669+
- javascriptv3/example_code/s3/scenarios/conditional-requests/clean.steps.js
36203670
services:
36213671
s3: {GetObject, PutObject, CopyObject}
36223672
s3_Scenario_DownloadS3Directory:

.github/workflows/validate-doc-metadata.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: checkout repo content
1717
uses: actions/checkout@v4
1818
- name: validate metadata
19-
uses: awsdocs/aws-doc-sdk-examples-tools@2025.05.1
19+
uses: awsdocs/aws-doc-sdk-examples-tools@2025.07.0
2020
with:
2121
doc_gen_only: "False"
2222
strict_titles: "True"

aws-cli/bash-linux/iam/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,15 @@ Code excerpts that show you how to call individual service functions.
4545
- [CreatePolicy](iam_operations.sh#L421)
4646
- [CreateRole](iam_operations.sh#L342)
4747
- [CreateUser](iam_operations.sh#L113)
48-
- [DeleteAccessKey](iam_operations.sh#L787)
48+
- [DeleteAccessKey](iam_operations.sh#L904)
4949
- [DeletePolicy](iam_operations.sh#L646)
5050
- [DeleteRole](iam_operations.sh#L716)
51-
- [DeleteUser](iam_operations.sh#L868)
51+
- [DeleteUser](iam_operations.sh#L985)
5252
- [DetachRolePolicy](iam_operations.sh#L571)
5353
- [GetUser](iam_operations.sh#L17)
5454
- [ListAccessKeys](iam_operations.sh#L273)
5555
- [ListUsers](iam_operations.sh#L56)
56+
- [UpdateAccessKey](iam_operations.sh#L787)
5657

5758

5859
<!--custom.examples.start-->
@@ -110,4 +111,4 @@ in the `aws-cli` folder.
110111

111112
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
112113

113-
SPDX-License-Identifier: Apache-2.0
114+
SPDX-License-Identifier: Apache-2.0

aws-cli/bash-linux/iam/iam_create_user_assume_role_scenario.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,15 @@ function clean_up() {
351351
fi
352352
fi
353353

354+
if [ -n "$access_key_name" ]; then
355+
if (iam_update_access_key -u "$user_name" -k "$access_key_name" -d); then
356+
echo "Deactivated access key $access_key_name"
357+
else
358+
errecho "The access key failed to deactivate."
359+
result=1
360+
fi
361+
fi
362+
354363
if [ -n "$access_key_name" ]; then
355364
if (iam_delete_access_key -u "$user_name" -k "$access_key_name"); then
356365
echo "Deleted access key $access_key_name"

aws-cli/bash-linux/iam/iam_operations.sh

Lines changed: 122 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ function iam_create_user() {
133133
# bashsupport disable=BP5008
134134
function usage() {
135135
echo "function iam_create_user"
136-
echo "Creates an WS Identity and Access Management (IAM) user. You must supply a username:"
136+
echo "Creates an AWS Identity and Access Management (IAM) user. You must supply a username:"
137137
echo " -u user_name The name of the user. It must be unique within the account."
138138
echo ""
139139
}
@@ -663,7 +663,7 @@ function iam_delete_policy() {
663663
# bashsupport disable=BP5008
664664
function usage() {
665665
echo "function iam_delete_policy"
666-
echo "Deletes an WS Identity and Access Management (IAM) policy"
666+
echo "Deletes an AWS Identity and Access Management (IAM) policy"
667667
echo " -n policy_arn -- The name of the IAM policy arn."
668668
echo ""
669669
}
@@ -733,7 +733,7 @@ function iam_delete_role() {
733733
# bashsupport disable=BP5008
734734
function usage() {
735735
echo "function iam_delete_role"
736-
echo "Deletes an WS Identity and Access Management (IAM) role"
736+
echo "Deletes an AWS Identity and Access Management (IAM) role"
737737
echo " -n role_name -- The name of the IAM role."
738738
echo ""
739739
}
@@ -784,6 +784,123 @@ function iam_delete_role() {
784784
}
785785
# snippet-end:[aws-cli.bash-linux.iam.DeleteRole]
786786

787+
# snippet-start:[aws-cli.bash-linux.iam.UpdateAccessKey]
788+
###############################################################################
789+
# function iam_update_access_key
790+
#
791+
# This function can activate or deactivate an IAM access key for the specified IAM user.
792+
#
793+
# Parameters:
794+
# -u user_name -- The name of the user.
795+
# -k access_key -- The access key to update.
796+
# -a -- Activate the selected access key.
797+
# -d -- Deactivate the selected access key.
798+
#
799+
# Example:
800+
# # To deactivate the selected access key for IAM user Bob
801+
# iam_update_access_key -u Bob -k AKIAIOSFODNN7EXAMPLE -d
802+
#
803+
# Returns:
804+
# 0 - If successful.
805+
# 1 - If it fails.
806+
###############################################################################
807+
function iam_update_access_key() {
808+
local user_name access_key status response
809+
local option OPTARG # Required to use getopts command in a function.
810+
local activate_flag=false deactivate_flag=false
811+
812+
# bashsupport disable=BP5008
813+
function usage() {
814+
echo "function iam_update_access_key"
815+
echo "Updates the status of an AWS Identity and Access Management (IAM) access key for the specified IAM user"
816+
echo " -u user_name The name of the user."
817+
echo " -k access_key The access key to update."
818+
echo " -a Activate the access key."
819+
echo " -d Deactivate the access key."
820+
echo ""
821+
}
822+
823+
# Retrieve the calling parameters.
824+
while getopts "u:k:adh" option; do
825+
case "${option}" in
826+
u) user_name="${OPTARG}" ;;
827+
k) access_key="${OPTARG}" ;;
828+
a) activate_flag=true ;;
829+
d) deactivate_flag=true ;;
830+
h)
831+
usage
832+
return 0
833+
;;
834+
\?)
835+
echo "Invalid parameter"
836+
usage
837+
return 1
838+
;;
839+
esac
840+
done
841+
export OPTIND=1
842+
843+
# Validate input parameters
844+
if [[ -z "$user_name" ]]; then
845+
errecho "ERROR: You must provide a username with the -u parameter."
846+
usage
847+
return 1
848+
fi
849+
850+
if [[ -z "$access_key" ]]; then
851+
errecho "ERROR: You must provide an access key with the -k parameter."
852+
usage
853+
return 1
854+
fi
855+
856+
# Ensure that only -a or -d is specified
857+
if [[ "$activate_flag" == true && "$deactivate_flag" == true ]]; then
858+
errecho "ERROR: You cannot specify both -a (activate) and -d (deactivate) at the same time."
859+
usage
860+
return 1
861+
fi
862+
863+
# If neither -a nor -d is provided, return an error
864+
if [[ "$activate_flag" == false && "$deactivate_flag" == false ]]; then
865+
errecho "ERROR: You must specify either -a (activate) or -d (deactivate)."
866+
usage
867+
return 1
868+
fi
869+
870+
# Determine the status based on the flag
871+
if [[ "$activate_flag" == true ]]; then
872+
status="Active"
873+
elif [[ "$deactivate_flag" == true ]]; then
874+
status="Inactive"
875+
fi
876+
877+
iecho "Parameters:\n"
878+
iecho " Username: $user_name"
879+
iecho " Access key: $access_key"
880+
iecho " New status: $status"
881+
iecho ""
882+
883+
# Update the access key status
884+
response=$(aws iam update-access-key \
885+
--user-name "$user_name" \
886+
--access-key-id "$access_key" \
887+
--status "$status" 2>&1)
888+
889+
local error_code=${?}
890+
891+
if [[ $error_code -ne 0 ]]; then
892+
aws_cli_error_log $error_code
893+
errecho "ERROR: AWS reports update-access-key operation failed.\n$response"
894+
return 1
895+
fi
896+
897+
iecho "update-access-key response: $response"
898+
iecho
899+
900+
return 0
901+
}
902+
# snippet-end:[aws-cli.bash-linux.iam.UpdateAccessKey]
903+
787904
# snippet-start:[aws-cli.bash-linux.iam.DeleteAccessKey]
788905
###############################################################################
789906
# function iam_delete_access_key
@@ -805,7 +922,7 @@ function iam_delete_access_key() {
805922
# bashsupport disable=BP5008
806923
function usage() {
807924
echo "function iam_delete_access_key"
808-
echo "Deletes an WS Identity and Access Management (IAM) access key for the specified IAM user"
925+
echo "Deletes an AWS Identity and Access Management (IAM) access key for the specified IAM user"
809926
echo " -u user_name The name of the user."
810927
echo " -k access_key The access key to delete."
811928
echo ""
@@ -885,7 +1002,7 @@ function iam_delete_user() {
8851002
# bashsupport disable=BP5008
8861003
function usage() {
8871004
echo "function iam_delete_user"
888-
echo "Deletes an WS Identity and Access Management (IAM) user. You must supply a username:"
1005+
echo "Deletes an AWS Identity and Access Management (IAM) user. You must supply a username:"
8891006
echo " -u user_name The name of the user."
8901007
echo ""
8911008
}

javascriptv3/example_code/bedrock-agent-runtime/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "Apache-2.0",
66
"type": "module",
77
"scripts": {
8-
"test": "vitest run **/*.unit.test.js"
8+
"integration-test": "vitest run integration --reporter=junit --outputFile=test_results/bedrock-agent-runtime-test-results.junit.xml"
99
},
1010
"dependencies": {
1111
"@aws-sdk/client-bedrock-agent-runtime": "^3.675.0"

javascriptv3/example_code/bedrock-agent/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"license": "Apache-2.0",
66
"type": "module",
77
"scripts": {
8-
"test": "vitest run **/*.unit.test.js",
9-
"integration-test": "vitest run **/*.integration.test.js --reporter=junit --outputFile=test_results/$npm_package_name.junit.xml"
8+
"integration-test": "vitest run integration --reporter=junit --outputFile=test_results/bedrock-agent-test-results.junit.xml"
109
},
1110
"dependencies": {
1211
"@aws-sdk/client-bedrock-agent": "^3.515.0"

javascriptv3/example_code/bedrock-runtime/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "Apache-2.0",
66
"type": "module",
77
"scripts": {
8-
"integration-test": "vitest run **/*.integration.test.js --reporter=junit --outputFile=test_results/$npm_package_name.junit.xml"
8+
"integration-test": "vitest run integration --reporter=junit --outputFile=test_results/bedrock-runtime-test-results.junit.xml"
99
},
1010
"devDependencies": {
1111
"vitest": "^1.6.0"

javascriptv3/example_code/bedrock/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "Apache-2.0",
66
"type": "module",
77
"scripts": {
8-
"integration-test": "vitest run **/*.integration.test.js --reporter=junit --outputFile=test_results/$npm_package_name.junit.xml"
8+
"integration-test": "vitest run integration --reporter=junit --outputFile=test_results/bedrock-test-results.junit.xml"
99
},
1010
"dependencies": {
1111
"@aws-sdk/client-bedrock": "^3.485.0"

0 commit comments

Comments
 (0)