@@ -150,26 +150,59 @@ static void test_flb_aws_endpoint()
150150
151151 initialization_crutch ();
152152
153- endpoint = flb_aws_endpoint ("cloudwatch" , "ap-south-1" );
153+ /* NULL inputs should return NULL */
154+ endpoint = flb_aws_endpoint (NULL , "us-east-1" );
155+ TEST_CHECK (endpoint == NULL );
156+
157+ endpoint = flb_aws_endpoint ("s3" , NULL );
158+ TEST_CHECK (endpoint == NULL );
154159
155- TEST_CHECK (strcmp ("cloudwatch.ap-south-1.amazonaws.com" ,
156- endpoint ) == 0 );
160+ /* Standard commercial region */
161+ endpoint = flb_aws_endpoint ("cloudwatch" , "ap-south-1" );
162+ TEST_CHECK (strcmp ("cloudwatch.ap-south-1.amazonaws.com" , endpoint ) == 0 );
157163 flb_free (endpoint );
158164
159- /* China regions have a different TLD */
165+ /* China regions (.amazonaws.com.cn) */
160166 endpoint = flb_aws_endpoint ("cloudwatch" , "cn-north-1" );
167+ TEST_CHECK (strcmp ("cloudwatch.cn-north-1.amazonaws.com.cn" , endpoint ) == 0 );
168+ flb_free (endpoint );
161169
162- TEST_CHECK ( strcmp ( "cloudwatch. cn-north-1.amazonaws.com.cn" ,
163- endpoint ) == 0 );
170+ endpoint = flb_aws_endpoint ( "cloudwatch" , " cn-northwest-1" );
171+ TEST_CHECK ( strcmp ( "cloudwatch.cn-northwest-1.amazonaws.com.cn" , endpoint ) == 0 );
164172 flb_free (endpoint );
165173
166- /* EU Sovereign Cloud regions have a different domain */
174+ /* EU Sovereign Cloud (.amazonaws.eu) */
167175 endpoint = flb_aws_endpoint ("cloudwatch" , "eusc-de-east-1" );
176+ TEST_CHECK (strcmp ("cloudwatch.eusc-de-east-1.amazonaws.eu" , endpoint ) == 0 );
177+ flb_free (endpoint );
178+
179+ /* C2S isolated regions (.c2s.ic.gov) */
180+ endpoint = flb_aws_endpoint ("s3" , "us-iso-east-1" );
181+ TEST_CHECK (strcmp ("s3.us-iso-east-1.c2s.ic.gov" , endpoint ) == 0 );
182+ flb_free (endpoint );
168183
169- TEST_CHECK ( strcmp ( "cloudwatch.eusc-de-east-1.amazonaws.eu" ,
170- endpoint ) == 0 );
184+ endpoint = flb_aws_endpoint ( "s3" , "us-iso-west-1" );
185+ TEST_CHECK ( strcmp ( "s3.us-iso-west-1.c2s.ic.gov" , endpoint ) == 0 );
171186 flb_free (endpoint );
172187
188+ /* SC2S isolated regions (.sc2s.sgov.gov) */
189+ endpoint = flb_aws_endpoint ("s3" , "us-isob-east-1" );
190+ TEST_CHECK (strcmp ("s3.us-isob-east-1.sc2s.sgov.gov" , endpoint ) == 0 );
191+ flb_free (endpoint );
192+
193+ endpoint = flb_aws_endpoint ("s3" , "us-isob-west-1" );
194+ TEST_CHECK (strcmp ("s3.us-isob-west-1.sc2s.sgov.gov" , endpoint ) == 0 );
195+ flb_free (endpoint );
196+
197+ /* CSP isolated regions (.csp.hci.ic.gov) */
198+ endpoint = flb_aws_endpoint ("s3" , "us-isof-south-1" );
199+ TEST_CHECK (strcmp ("s3.us-isof-south-1.csp.hci.ic.gov" , endpoint ) == 0 );
200+ flb_free (endpoint );
201+
202+ /* ADC-E isolated regions (.cloud.adc-e.uk) */
203+ endpoint = flb_aws_endpoint ("s3" , "eu-isoe-west-1" );
204+ TEST_CHECK (strcmp ("s3.eu-isoe-west-1.cloud.adc-e.uk" , endpoint ) == 0 );
205+ flb_free (endpoint );
173206}
174207
175208static void test_flb_get_s3_key_multi_tag_exists ()
0 commit comments