@@ -53,6 +53,8 @@ public Endpoint ResolveEndpoint(EndpointParameters parameters)
53
53
[ "Endpoint" ] = parameters [ "Endpoint" ] ,
54
54
[ "AccountId" ] = parameters [ "AccountId" ] ,
55
55
[ "AccountIdEndpointMode" ] = parameters [ "AccountIdEndpointMode" ] ,
56
+ [ "ResourceArn" ] = parameters [ "ResourceArn" ] ,
57
+ [ "ResourceArnList" ] = parameters [ "ResourceArnList" ] ,
56
58
} ;
57
59
if ( IsSet ( refs [ "Endpoint" ] ) )
58
60
{
@@ -80,23 +82,15 @@ public Endpoint ResolveEndpoint(EndpointParameters parameters)
80
82
{
81
83
throw new AmazonClientException ( "Invalid Configuration: Dualstack and local endpoint are not supported" ) ;
82
84
}
83
- return new Endpoint ( "http://localhost:8000" , InterpolateJson ( @"{""authSchemes"":[{""name"":""sigv4"",""signingName"":""dynamodb"",""signingRegion"":""us-east-1""}]}" , refs ) , InterpolateJson ( @"" , refs ) ) ;
84
- }
85
- if ( IsSet ( refs [ "AccountIdEndpointMode" ] ) && Equals ( refs [ "AccountIdEndpointMode" ] , "required" ) && ! IsSet ( refs [ "AccountId" ] ) )
86
- {
87
- throw new AmazonClientException ( "AccountIdEndpointMode is required but no AccountID was provided or able to be loaded." ) ;
88
- }
89
- if ( IsSet ( refs [ "AccountId" ] ) && Equals ( GetAttr ( refs [ "PartitionResult" ] , "name" ) , "aws" ) && ! Equals ( refs [ "UseFIPS" ] , true ) && ! Equals ( refs [ "UseDualStack" ] , true ) && ! IsValidHostLabel ( ( string ) refs [ "AccountId" ] , false ) )
90
- {
91
- throw new AmazonClientException ( "Credentials-sourced account ID parameter is invalid" ) ;
85
+ return new Endpoint ( "http://localhost:8000" , InterpolateJson ( @"{""authSchemes"":[{""signingRegion"":""us-east-1"",""signingName"":""dynamodb"",""name"":""sigv4""}]}" , refs ) , InterpolateJson ( @"" , refs ) ) ;
92
86
}
93
87
if ( Equals ( refs [ "UseFIPS" ] , true ) && Equals ( refs [ "UseDualStack" ] , true ) )
94
88
{
95
89
if ( Equals ( GetAttr ( refs [ "PartitionResult" ] , "supportsFIPS" ) , true ) && Equals ( GetAttr ( refs [ "PartitionResult" ] , "supportsDualStack" ) , true ) )
96
90
{
97
- if ( IsSet ( refs [ "AccountIdEndpointMode" ] ) && Equals ( refs [ "AccountIdEndpointMode" ] , "disabled " ) )
91
+ if ( IsSet ( refs [ "AccountIdEndpointMode" ] ) && Equals ( refs [ "AccountIdEndpointMode" ] , "required " ) )
98
92
{
99
- return new Endpoint ( Interpolate ( @"https://dynamodb-fips.{Region}.{PartitionResult#dualStackDnsSuffix}" , refs ) , InterpolateJson ( @"" , refs ) , InterpolateJson ( @"" , refs ) ) ;
93
+ throw new AmazonClientException ( "Invalid Configuration: AccountIdEndpointMode is required and FIPS is enabled, but FIPS account endpoints are not supported" ) ;
100
94
}
101
95
return new Endpoint ( Interpolate ( @"https://dynamodb-fips.{Region}.{PartitionResult#dualStackDnsSuffix}" , refs ) , InterpolateJson ( @"" , refs ) , InterpolateJson ( @"" , refs ) ) ;
102
96
}
@@ -108,15 +102,15 @@ public Endpoint ResolveEndpoint(EndpointParameters parameters)
108
102
{
109
103
if ( Equals ( GetAttr ( refs [ "PartitionResult" ] , "name" ) , "aws-us-gov" ) )
110
104
{
111
- if ( IsSet ( refs [ "AccountIdEndpointMode" ] ) && Equals ( refs [ "AccountIdEndpointMode" ] , "disabled " ) )
105
+ if ( IsSet ( refs [ "AccountIdEndpointMode" ] ) && Equals ( refs [ "AccountIdEndpointMode" ] , "required " ) )
112
106
{
113
- return new Endpoint ( Interpolate ( @"https://dynamodb.{Region}.{PartitionResult#dnsSuffix}" , refs ) , InterpolateJson ( @"" , refs ) , InterpolateJson ( @"" , refs ) ) ;
107
+ throw new AmazonClientException ( "Invalid Configuration: AccountIdEndpointMode is required and FIPS is enabled, but FIPS account endpoints are not supported" ) ;
114
108
}
115
109
return new Endpoint ( Interpolate ( @"https://dynamodb.{Region}.{PartitionResult#dnsSuffix}" , refs ) , InterpolateJson ( @"" , refs ) , InterpolateJson ( @"" , refs ) ) ;
116
110
}
117
- if ( IsSet ( refs [ "AccountIdEndpointMode" ] ) && Equals ( refs [ "AccountIdEndpointMode" ] , "disabled " ) )
111
+ if ( IsSet ( refs [ "AccountIdEndpointMode" ] ) && Equals ( refs [ "AccountIdEndpointMode" ] , "required " ) )
118
112
{
119
- return new Endpoint ( Interpolate ( @"https://dynamodb-fips.{Region}.{PartitionResult#dnsSuffix}" , refs ) , InterpolateJson ( @"" , refs ) , InterpolateJson ( @"" , refs ) ) ;
113
+ throw new AmazonClientException ( "Invalid Configuration: AccountIdEndpointMode is required and FIPS is enabled, but FIPS account endpoints are not supported" ) ;
120
114
}
121
115
return new Endpoint ( Interpolate ( @"https://dynamodb-fips.{Region}.{PartitionResult#dnsSuffix}" , refs ) , InterpolateJson ( @"" , refs ) , InterpolateJson ( @"" , refs ) ) ;
122
116
}
@@ -126,21 +120,49 @@ public Endpoint ResolveEndpoint(EndpointParameters parameters)
126
120
{
127
121
if ( Equals ( GetAttr ( refs [ "PartitionResult" ] , "supportsDualStack" ) , true ) )
128
122
{
129
- if ( IsSet ( refs [ "AccountIdEndpointMode" ] ) && Equals ( refs [ "AccountIdEndpointMode" ] , "disabled " ) )
123
+ if ( IsSet ( refs [ "AccountIdEndpointMode" ] ) && Equals ( refs [ "AccountIdEndpointMode" ] , "required " ) )
130
124
{
131
- return new Endpoint ( Interpolate ( @"https://dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}" , refs ) , InterpolateJson ( @"" , refs ) , InterpolateJson ( @"" , refs ) ) ;
125
+ if ( ! Equals ( refs [ "UseFIPS" ] , true ) )
126
+ {
127
+ throw new AmazonClientException ( "Invalid Configuration: AccountIdEndpointMode is required and DualStack is enabled, but DualStack account endpoints are not supported" ) ;
128
+ }
129
+ throw new AmazonClientException ( "Invalid Configuration: AccountIdEndpointMode is required and FIPS is enabled, but FIPS account endpoints are not supported" ) ;
132
130
}
133
131
return new Endpoint ( Interpolate ( @"https://dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}" , refs ) , InterpolateJson ( @"" , refs ) , InterpolateJson ( @"" , refs ) ) ;
134
132
}
135
133
throw new AmazonClientException ( "DualStack is enabled but this partition does not support DualStack" ) ;
136
134
}
137
- if ( IsSet ( refs [ "AccountIdEndpointMode" ] ) && Equals ( refs [ "AccountIdEndpointMode" ] , "disabled" ) )
135
+ if ( IsSet ( refs [ "AccountIdEndpointMode" ] ) && ! Equals ( refs [ "AccountIdEndpointMode" ] , "disabled" ) && Equals ( GetAttr ( refs [ "PartitionResult" ] , "name" ) , "aws" ) && ! Equals ( refs [ "UseFIPS" ] , true ) && ! Equals ( refs [ "UseDualStack" ] , true ) && IsSet ( refs [ "ResourceArn" ] ) && ( refs [ "ParsedArn" ] = ParseArn ( ( string ) refs [ "ResourceArn" ] ) ) != null && Equals ( GetAttr ( refs [ "ParsedArn" ] , "service" ) , "dynamodb" ) && IsValidHostLabel ( ( string ) GetAttr ( refs [ "ParsedArn" ] , "region" ) , false ) && Equals ( GetAttr ( refs [ "ParsedArn" ] , "region" ) , Interpolate ( @"{Region}" , refs ) ) && IsValidHostLabel ( ( string ) GetAttr ( refs [ "ParsedArn" ] , "accountId" ) , false ) )
136
+ {
137
+ return new Endpoint ( Interpolate ( @"https://{ParsedArn#accountId}.ddb.{Region}.{PartitionResult#dnsSuffix}" , refs ) , InterpolateJson ( @"" , refs ) , InterpolateJson ( @"" , refs ) ) ;
138
+ }
139
+ if ( IsSet ( refs [ "AccountIdEndpointMode" ] ) && ! Equals ( refs [ "AccountIdEndpointMode" ] , "disabled" ) && Equals ( GetAttr ( refs [ "PartitionResult" ] , "name" ) , "aws" ) && ! Equals ( refs [ "UseFIPS" ] , true ) && ! Equals ( refs [ "UseDualStack" ] , true ) && IsSet ( refs [ "ResourceArnList" ] ) && ( refs [ "FirstArn" ] = GetAttr ( refs [ "ResourceArnList" ] , "[0]" ) ) != null && ( refs [ "ParsedArn" ] = ParseArn ( ( string ) refs [ "FirstArn" ] ) ) != null && Equals ( GetAttr ( refs [ "ParsedArn" ] , "service" ) , "dynamodb" ) && IsValidHostLabel ( ( string ) GetAttr ( refs [ "ParsedArn" ] , "region" ) , false ) && Equals ( GetAttr ( refs [ "ParsedArn" ] , "region" ) , Interpolate ( @"{Region}" , refs ) ) && IsValidHostLabel ( ( string ) GetAttr ( refs [ "ParsedArn" ] , "accountId" ) , false ) )
140
+ {
141
+ return new Endpoint ( Interpolate ( @"https://{ParsedArn#accountId}.ddb.{Region}.{PartitionResult#dnsSuffix}" , refs ) , InterpolateJson ( @"" , refs ) , InterpolateJson ( @"" , refs ) ) ;
142
+ }
143
+ if ( IsSet ( refs [ "AccountIdEndpointMode" ] ) && ! Equals ( refs [ "AccountIdEndpointMode" ] , "disabled" ) && Equals ( GetAttr ( refs [ "PartitionResult" ] , "name" ) , "aws" ) && ! Equals ( refs [ "UseFIPS" ] , true ) && ! Equals ( refs [ "UseDualStack" ] , true ) && IsSet ( refs [ "AccountId" ] ) )
138
144
{
139
- return new Endpoint ( Interpolate ( @"https://dynamodb.{Region}.{PartitionResult#dnsSuffix}" , refs ) , InterpolateJson ( @"" , refs ) , InterpolateJson ( @"" , refs ) ) ;
145
+ if ( IsValidHostLabel ( ( string ) refs [ "AccountId" ] , false ) )
146
+ {
147
+ return new Endpoint ( Interpolate ( @"https://{AccountId}.ddb.{Region}.{PartitionResult#dnsSuffix}" , refs ) , InterpolateJson ( @"" , refs ) , InterpolateJson ( @"" , refs ) ) ;
148
+ }
149
+ throw new AmazonClientException ( "Credentials-sourced account ID parameter is invalid" ) ;
140
150
}
141
- if ( IsSet ( refs [ "AccountId " ] ) && Equals ( GetAttr ( refs [ "PartitionResult " ] , "name" ) , "aws" ) && ! Equals ( refs [ "UseFIPS" ] , true ) && ! Equals ( refs [ "UseDualStack" ] , true ) )
151
+ if ( IsSet ( refs [ "AccountIdEndpointMode " ] ) && Equals ( refs [ "AccountIdEndpointMode " ] , "required" ) )
142
152
{
143
- return new Endpoint ( Interpolate ( @"https://{AccountId}.ddb.{Region}.{PartitionResult#dnsSuffix}" , refs ) , InterpolateJson ( @"" , refs ) , InterpolateJson ( @"" , refs ) ) ;
153
+ if ( ! Equals ( refs [ "UseFIPS" ] , true ) )
154
+ {
155
+ if ( ! Equals ( refs [ "UseDualStack" ] , true ) )
156
+ {
157
+ if ( Equals ( GetAttr ( refs [ "PartitionResult" ] , "name" ) , "aws" ) )
158
+ {
159
+ throw new AmazonClientException ( "AccountIdEndpointMode is required but no AccountID was provided or able to be loaded" ) ;
160
+ }
161
+ throw new AmazonClientException ( "Invalid Configuration: AccountIdEndpointMode is required but account endpoints are not supported in this partition" ) ;
162
+ }
163
+ throw new AmazonClientException ( "Invalid Configuration: AccountIdEndpointMode is required and DualStack is enabled, but DualStack account endpoints are not supported" ) ;
164
+ }
165
+ throw new AmazonClientException ( "Invalid Configuration: AccountIdEndpointMode is required and FIPS is enabled, but FIPS account endpoints are not supported" ) ;
144
166
}
145
167
return new Endpoint ( Interpolate ( @"https://dynamodb.{Region}.{PartitionResult#dnsSuffix}" , refs ) , InterpolateJson ( @"" , refs ) , InterpolateJson ( @"" , refs ) ) ;
146
168
}
0 commit comments