Commit 9fdc363
authored
feat: Support credentials provider name for BedrockAgentCore Identity (#534)
*Description of changes:*
Bedrock AgentCore data plane calls do not provide credential ARNs but
instead provide credential provider names (see
[GetResourceOauth2Token](https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_GetResourceOauth2Token.html#API_GetResourceOauth2Token_RequestSyntax)
and
[GetResourceApiKey](https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_GetResourceApiKey.html)).
This PR adds logic to also handle names for credential providers.
- Renamed `AWS_AUTH_CREDENTIAL_PROVIDER_ARN` to
`AWS_AUTH_CREDENTIAL_PROVIDER` to support both ARN and name formats
- Added mapping for `resourceCredentialProviderName` field in
BedrockAgentCore patch
- Enhanced credential provider type detection logic to handle name-only
identifiers using RPC method context
- Added tests for both ARN and name-based credential provider scenarios
```
{
"name": "Bedrock AgentCore.GetResourceOauth2Token",
"context": {
"trace_id": "0x690c16ee2f248a4e86e5c13e2e626e20",
"span_id": "0x1ed2e8bf53fa45fd",
"trace_state": "[]"
},
"kind": "SpanKind.CLIENT",
"parent_id": "0x914729048ec3381b",
"start_time": "2025-11-06T03:33:02.736876Z",
"end_time": "2025-11-06T03:33:02.739796Z",
"status": {
"status_code": "OK",
},
"attributes": {
"rpc.system": "aws-api",
"rpc.service": "Bedrock AgentCore",
"rpc.method": "GetResourceOauth2Token",
"aws.region": "us-east-1",
"server.address": "bedrock-agentcore.us-east-1.amazonaws.com",
"server.port": 443,
"aws.auth.region": "us-east-1",
"aws.auth.account.access_key": "[REDACTED]",
"aws.auth.credential_provider": "test-oauth2-provider",
"aws.local.operation": "GET /server_request",
"aws.local.service": "UnknownService",
"aws.remote.service": "AWS::BedrockAgentCore",
"aws.remote.operation": "GetResourceOauth2Token",
"aws.remote.resource.type": "AWS::BedrockAgentCore::OAuth2CredentialProvider",
"aws.remote.resource.identifier": "test-oauth2-provider",
"aws.remote.resource.cfn.primary.identifier": "test-oauth2-provider",
"aws.remote.resource.account.access_key": "[REDACTED]",
"aws.remote.resource.region": "us-east-1",
"aws.span.kind": "CLIENT"
},
"links": [],
"resource": {
"attributes": {
"telemetry.sdk.language": "python",
"telemetry.sdk.name": "opentelemetry",
"telemetry.sdk.version": "1.37.0",
"service.name": "unknown_service",
"telemetry.auto.version": "0.13.0.dev0-aws",
"aws.local.service": "UnknownService"
},
"schema_url": ""
}
}
```
```
{
"name": "Bedrock AgentCore.GetResourceApiKey",
"context": {
"trace_id": "0x690c1776b6a22c4ac0d6cb9315a4b730",
"span_id": "0x036b363af6af6695",
"trace_state": "[]"
},
"kind": "SpanKind.CLIENT",
"parent_id": "0xb4c143957c6cb110",
"start_time": "2025-11-06T03:35:18.490547Z",
"end_time": "2025-11-06T03:35:18.628436Z",
"status": {
"status_code": "OK"
},
"attributes": {
"rpc.system": "aws-api",
"rpc.service": "Bedrock AgentCore",
"rpc.method": "GetResourceApiKey",
"aws.region": "us-east-1",
"server.address": "bedrock-agentcore.us-east-1.amazonaws.com",
"server.port": 443,
"aws.auth.region": "us-east-1",
"aws.auth.account.access_key": "[REDACTED]",
"aws.auth.credential_provider": "test-api-key-provider",
"aws.local.operation": "GET /server_request",
"aws.request_id": "5c0130a2-d29e-468a-abd4-86c73ff13f98",
"retry_attempts": 0,
"http.status_code": 200,
"aws.local.service": "UnknownService",
"aws.remote.service": "AWS::BedrockAgentCore",
"aws.remote.operation": "GetResourceApiKey",
"aws.remote.resource.type": "AWS::BedrockAgentCore::APIKeyCredentialProvider",
"aws.remote.resource.identifier": "test-api-key-provider",
"aws.remote.resource.cfn.primary.identifier": "test-api-key-provider",
"aws.remote.resource.account.access_key": "[REDACTED]",
"aws.remote.resource.region": "us-east-1",
"aws.span.kind": "CLIENT"
},
"links": [],
"resource": {
"attributes": {
"telemetry.sdk.language": "python",
"telemetry.sdk.name": "opentelemetry",
"telemetry.sdk.version": "1.37.0",
"service.name": "unknown_service",
"telemetry.auto.version": "0.13.0.dev0-aws",
"aws.local.service": "UnknownService"
},
"schema_url": ""
}
}
```
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.1 parent 050878f commit 9fdc363
File tree
9 files changed
+314
-43
lines changed- aws-opentelemetry-distro
- src/amazon/opentelemetry/distro
- patches
- tests/amazon/opentelemetry/distro
- patches
- contract-tests
- images/applications/botocore
- tests/test/amazon/botocore
9 files changed
+314
-43
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
Lines changed: 43 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
741 | 741 | | |
742 | 742 | | |
743 | 743 | | |
744 | | - | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
745 | 747 | | |
746 | 748 | | |
747 | 749 | | |
| |||
763 | 765 | | |
764 | 766 | | |
765 | 767 | | |
766 | | - | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
767 | 771 | | |
768 | 772 | | |
769 | 773 | | |
| |||
778 | 782 | | |
779 | 783 | | |
780 | 784 | | |
781 | | - | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
782 | 788 | | |
783 | 789 | | |
784 | 790 | | |
| |||
797 | 803 | | |
798 | 804 | | |
799 | 805 | | |
800 | | - | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
801 | 809 | | |
802 | 810 | | |
803 | 811 | | |
| |||
807 | 815 | | |
808 | 816 | | |
809 | 817 | | |
810 | | - | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
811 | 821 | | |
812 | 822 | | |
813 | 823 | | |
| |||
829 | 839 | | |
830 | 840 | | |
831 | 841 | | |
832 | | - | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
833 | 845 | | |
834 | 846 | | |
835 | 847 | | |
| |||
844 | 856 | | |
845 | 857 | | |
846 | 858 | | |
847 | | - | |
848 | 859 | | |
849 | | - | |
| 860 | + | |
| 861 | + | |
850 | 862 | | |
851 | | - | |
852 | | - | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
853 | 866 | | |
854 | | - | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
855 | 872 | | |
856 | | - | |
| 873 | + | |
857 | 874 | | |
858 | | - | |
859 | 875 | | |
860 | | - | |
861 | | - | |
862 | | - | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
863 | 886 | | |
864 | 887 | | |
865 | 888 | | |
| |||
878 | 901 | | |
879 | 902 | | |
880 | 903 | | |
881 | | - | |
882 | | - | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
883 | 907 | | |
884 | 908 | | |
885 | 909 | | |
| |||
890 | 914 | | |
891 | 915 | | |
892 | 916 | | |
893 | | - | |
894 | | - | |
895 | | - | |
896 | | - | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | 917 | | |
902 | 918 | | |
903 | 919 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
Lines changed: 20 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
34 | 42 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
266 | 267 | | |
267 | 268 | | |
268 | 269 | | |
269 | | - | |
| 270 | + | |
270 | 271 | | |
271 | 272 | | |
272 | 273 | | |
273 | 274 | | |
274 | 275 | | |
275 | 276 | | |
276 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
277 | 288 | | |
278 | 289 | | |
279 | 290 | | |
| |||
0 commit comments