Debian Codegraph @

crt/aws-c-sdkutils/tests/resources/test-cases/parse-arn.json

raw symbols SCIP
1 {
2 "version": "1.0",
3 "testCases": [
4 {
5 "documentation": "arn + region resolution",
6 "params": {
7 "Bucket": "arn:aws:s3:us-east-2:012345678:outpost:op-1234",
8 "Region": "us-east-2"
9 },
10 "expect": {
11 "endpoint": {
12 "url": "https://op-1234-012345678.us-east-2.amazonaws.com"
13 }
14 }
15 },
16 {
17 "documentation": "arn, unset outpost id",
18 "params": {
19 "Bucket": "arn:aws:s3:us-east-2:012345678:outpost",
20 "Region": "us-east-2"
21 },
22 "expect": {
23 "error": "Invalid ARN: outpostId was not set"
24 }
25 },
26 {
27 "documentation": "arn, empty outpost id (tests that empty strings are handled properly during matching)",
28 "params": {
29 "Bucket": "arn:aws:s3:us-east-2:012345678:outpost::",
30 "Region": "us-east-2"
31 },
32 "expect": {
33 "error": "OutpostId was empty"
34 }
35 },
36 {
37 "documentation": "arn, empty outpost id (tests that ARN parsing considers a trailing colon)",
38 "params": {
39 "Bucket": "arn:aws:s3:us-east-2:012345678:outpost:",
40 "Region": "us-east-2"
41 },
42 "expect": {
43 "error": "OutpostId was empty"
44 }
45 },
46 {
47 "documentation": "valid hostlabel + region resolution",
48 "params": {
49 "Bucket": "mybucket",
50 "Region": "us-east-2"
51 },
52 "expect": {
53 "endpoint": {
54 "url": "https://mybucket.us-east-2.amazonaws.com"
55 }
56 }
57 },
58 {
59 "documentation": "not a valid hostlabel + region resolution",
60 "params": {
61 "Bucket": "99_a",
62 "Region": "us-east-2"
63 },
64 "expect": {
65 "endpoint": {
66 "url": "https://us-east-2.amazonaws.com/99_a"
67 }
68 }
69 },
70 {
71 "documentation": "no bucket",
72 "params": {
73 "Region": "us-east-2"
74 },
75 "expect": {
76 "endpoint": {
77 "url": "https://us-east-2.amazonaws.com"
78 }
79 }
80 },
81 {
82 "documentation": "a string that is not a 6-part ARN",
83 "params": {
84 "TestCaseId": "invalid-arn",
85 "Bucket": "asdf"
86 },
87 "expect": {
88 "error": "Test case passed: `asdf` is not a valid ARN."
89 }
90 },
91 {
92 "documentation": "resource id MUST not be null",
93 "params": {
94 "TestCaseId": "invalid-arn",
95 "Bucket": "arn:aws:s3:us-west-2:123456789012:"
96 },
97 "expect": {
98 "error": "Test case passed: `arn:aws:s3:us-west-2:123456789012:` is not a valid ARN."
99 }
100 },
101 {
102 "documentation": "service MUST not be null",
103 "params": {
104 "TestCaseId": "invalid-arn",
105 "Bucket": "arn:aws::us-west-2:123456789012:resource-id"
106 },
107 "expect": {
108 "error": "Test case passed: `arn:aws::us-west-2:123456789012:resource-id` is not a valid ARN."
109 }
110 },
111 {
112 "documentation": "partition MUST not be null",
113 "params": {
114 "TestCaseId": "invalid-arn",
115 "Bucket": "arn::s3:us-west-2:123456789012:resource-id"
116 },
117 "expect": {
118 "error": "Test case passed: `arn::s3:us-west-2:123456789012:resource-id` is not a valid ARN."
119 }
120 },
121 {
122 "documentation": "region MAY be null",
123 "params": {
124 "TestCaseId": "valid-arn",
125 "Bucket": "arn:aws:s3::123456789012:resource-id"
126 },
127 "expect": {
128 "error": "Test case passed: A valid ARN was parsed: service: `s3`, partition: `aws, region: ``, accountId: `123456789012`, resource: `resource-id`"
129 }
130 },
131 {
132 "documentation": "accountId MAY be null",
133 "params": {
134 "TestCaseId": "valid-arn",
135 "Bucket": "arn:aws:s3:us-east-1::resource-id"
136 },
137 "expect": {
138 "error": "Test case passed: A valid ARN was parsed: service: `s3`, partition: `aws, region: `us-east-1`, accountId: ``, resource: `resource-id`"
139 }
140 },
141 {
142 "documentation": "accountId MAY be non-numeric",
143 "params": {
144 "TestCaseId": "valid-arn",
145 "Bucket": "arn:aws:s3:us-east-1:abcd:resource-id"
146 },
147 "expect": {
148 "error": "Test case passed: A valid ARN was parsed: service: `s3`, partition: `aws, region: `us-east-1`, accountId: `abcd`, resource: `resource-id`"
149 }
150 }
151 ]
152 }