Skip to content

Commit

Permalink
feat(client-taxsettings): Set default endpoint for aws partition. Req…
Browse files Browse the repository at this point in the history
…uests from all regions in aws partition will be forward to us-east-1 endpoint.
  • Loading branch information
awstools committed Jul 18, 2024
1 parent a867f6e commit 7927892
Show file tree
Hide file tree
Showing 4 changed files with 387 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function createAwsAuthSigv4HttpAuthOption(authParameters: TaxSettingsHttpAuthSch
name: "tax",
region: authParameters.region,
},
propertiesExtractor: (config: TaxSettingsClientConfig, context) => ({
propertiesExtractor: (config: Partial<TaxSettingsClientConfig>, context) => ({
/**
* @internal
*/
Expand Down
4 changes: 2 additions & 2 deletions clients/client-taxsettings/src/endpoint/EndpointParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { Endpoint, EndpointParameters as __EndpointParameters, EndpointV2, Provi
* @public
*/
export interface ClientInputEndpointParameters {
region?: string | Provider<string>;
useDualstackEndpoint?: boolean | Provider<boolean>;
useFipsEndpoint?: boolean | Provider<boolean>;
endpoint?: string | Provider<string> | Endpoint | Provider<Endpoint> | EndpointV2 | Provider<EndpointV2>;
region?: string | Provider<string>;
}

export type ClientResolvedEndpointParameters = ClientInputEndpointParameters & {
Expand All @@ -34,8 +34,8 @@ export const commonParams = {
} as const;

export interface EndpointParameters extends __EndpointParameters {
Region?: string;
UseDualStack?: boolean;
UseFIPS?: boolean;
Endpoint?: string;
Region?: string;
}
46 changes: 24 additions & 22 deletions clients/client-taxsettings/src/endpoint/ruleset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,29 @@ import { RuleSetObject } from "@smithy/types";
or see "smithy.rules#endpointRuleSet"
in codegen/sdk-codegen/aws-models/taxsettings.json */

const s="required",
t="fn",
u="argv",
v="ref";
const u="required",
v="fn",
w="argv",
x="ref";
const a=true,
b="isSet",
c="booleanEquals",
d="error",
e="endpoint",
f="tree",
g="PartitionResult",
h={[s]:false,"type":"String"},
i={[s]:true,"default":false,"type":"Boolean"},
j={[v]:"Endpoint"},
k={[t]:c,[u]:[{[v]:"UseFIPS"},true]},
l={[t]:c,[u]:[{[v]:"UseDualStack"},true]},
m={},
n={[t]:"getAttr",[u]:[{[v]:g},"supportsFIPS"]},
o={[t]:c,[u]:[true,{[t]:"getAttr",[u]:[{[v]:g},"supportsDualStack"]}]},
p=[k],
q=[l],
r=[{[v]:"Region"}];
const _data={version:"1.0",parameters:{Region:h,UseDualStack:i,UseFIPS:i,Endpoint:h},rules:[{conditions:[{[t]:b,[u]:[j]}],rules:[{conditions:p,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:d},{rules:[{conditions:q,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:d},{endpoint:{url:j,properties:m,headers:m},type:e}],type:f}],type:f},{rules:[{conditions:[{[t]:b,[u]:r}],rules:[{conditions:[{[t]:"aws.partition",[u]:r,assign:g}],rules:[{conditions:[k,l],rules:[{conditions:[{[t]:c,[u]:[a,n]},o],rules:[{rules:[{endpoint:{url:"https://tax-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:m,headers:m},type:e}],type:f}],type:f},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:d}],type:f},{conditions:p,rules:[{conditions:[{[t]:c,[u]:[n,a]}],rules:[{rules:[{endpoint:{url:"https://tax-fips.{Region}.{PartitionResult#dnsSuffix}",properties:m,headers:m},type:e}],type:f}],type:f},{error:"FIPS is enabled but this partition does not support FIPS",type:d}],type:f},{conditions:q,rules:[{conditions:[o],rules:[{rules:[{endpoint:{url:"https://tax.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:m,headers:m},type:e}],type:f}],type:f},{error:"DualStack is enabled but this partition does not support DualStack",type:d}],type:f},{rules:[{endpoint:{url:"https://tax.{Region}.{PartitionResult#dnsSuffix}",properties:m,headers:m},type:e}],type:f}],type:f}],type:f},{error:"Invalid Configuration: Missing Region",type:d}],type:f}]};
b=false,
c="isSet",
d="booleanEquals",
e="error",
f="endpoint",
g="tree",
h="PartitionResult",
i={[u]:true,"default":false,"type":"Boolean"},
j={[u]:false,"type":"String"},
k={[x]:"Endpoint"},
l={[v]:d,[w]:[{[x]:"UseFIPS"},true]},
m={[x]:"UseFIPS"},
n={[v]:d,[w]:[{[x]:"UseDualStack"},true]},
o={[x]:"UseDualStack"},
p={},
q={[v]:"getAttr",[w]:[{[x]:h},"supportsFIPS"]},
r={[v]:d,[w]:[true,{[v]:"getAttr",[w]:[{[x]:h},"supportsDualStack"]}]},
s={"authSchemes":[{"name":"sigv4","signingRegion":"{PartitionResult#implicitGlobalRegion}"}]},
t=[{[x]:"Region"}];
const _data={version:"1.0",parameters:{UseDualStack:i,UseFIPS:i,Endpoint:j,Region:j},rules:[{conditions:[{[v]:c,[w]:[k]}],rules:[{conditions:[l],error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:e},{rules:[{conditions:[n],error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:e},{endpoint:{url:k,properties:p,headers:p},type:f}],type:g}],type:g},{rules:[{conditions:[{[v]:c,[w]:t}],rules:[{conditions:[{[v]:"aws.partition",[w]:t,assign:h}],rules:[{conditions:[l,n],rules:[{conditions:[{[v]:d,[w]:[a,q]},r],rules:[{endpoint:{url:"https://tax-fips.{PartitionResult#implicitGlobalRegion}.{PartitionResult#dualStackDnsSuffix}",properties:s,headers:p},type:f}],type:g},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:e}],type:g},{conditions:[l,{[v]:d,[w]:[o,b]}],rules:[{conditions:[{[v]:d,[w]:[q,a]}],rules:[{endpoint:{url:"https://tax-fips.{PartitionResult#implicitGlobalRegion}.{PartitionResult#dnsSuffix}",properties:s,headers:p},type:f}],type:g},{error:"FIPS is enabled but this partition does not support FIPS",type:e}],type:g},{conditions:[{[v]:d,[w]:[m,b]},n],rules:[{conditions:[r],rules:[{endpoint:{url:"https://tax.{PartitionResult#implicitGlobalRegion}.{PartitionResult#dualStackDnsSuffix}",properties:s,headers:p},type:f}],type:g},{error:"DualStack is enabled but this partition does not support DualStack",type:e}],type:g},{endpoint:{url:"https://tax.{PartitionResult#implicitGlobalRegion}.{PartitionResult#dnsSuffix}",properties:s,headers:p},type:f}],type:g}],type:g},{error:"Invalid Configuration: Missing Region",type:e}],type:g}]};
export const ruleSet: RuleSetObject = _data;
Loading

0 comments on commit 7927892

Please sign in to comment.