Skip to content

Commit

Permalink
get service endpoint in wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
circulon committed Jul 11, 2024
1 parent 8662f8f commit 3ff604a
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/aws/acm-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class ACMWrapper {
credentials,
region: isEdge ? Globals.defaultRegion : Globals.getRegion(),
retryStrategy: Globals.getRetryStrategy(),
requestHandler: Globals.getRequestHandler()
requestHandler: Globals.getRequestHandler(),
endpoint: Globals.getServiceEndpoint("acm")
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/aws/api-gateway-v1-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ import { getAWSPagedResults } from "../utils";
class APIGatewayV1Wrapper extends APIGatewayBase {
public readonly apiGateway: APIGatewayClient;


constructor (credentials?: any) {
super();
this.apiGateway = new APIGatewayClient({
credentials,
region: Globals.getRegion(),
retryStrategy: Globals.getRetryStrategy(),
requestHandler: Globals.getRequestHandler()
requestHandler: Globals.getRequestHandler(),
endpoint: Globals.getServiceEndpoint("apigateway")
});
}

Expand Down
3 changes: 2 additions & 1 deletion src/aws/api-gateway-v2-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class APIGatewayV2Wrapper extends APIGatewayBase {
credentials,
region: Globals.getRegion(),
retryStrategy: Globals.getRetryStrategy(),
requestHandler: Globals.getRequestHandler()
requestHandler: Globals.getRequestHandler(),
endpoint: Globals.getServiceEndpoint("apigatewayv2")
});
}

Expand Down
3 changes: 2 additions & 1 deletion src/aws/cloud-formation-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class CloudFormationWrapper {
credentials,
region: Globals.getRegion(),
retryStrategy: Globals.getRetryStrategy(),
requestHandler: Globals.getRequestHandler()
requestHandler: Globals.getRequestHandler(),
endpoint: Globals.getServiceEndpoint("cloudformation")
});
}

Expand Down
9 changes: 6 additions & 3 deletions src/aws/route53-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@ class Route53Wrapper {

constructor (credentials?: any, region?: string) {
// not null and not undefined
const serviceEndpoint = Globals.getServiceEndpoint("route53");
if (credentials) {
this.region = region || Globals.getRegion();
this.route53 = new Route53Client({
credentials,
region: this.region,
retryStrategy: Globals.getRetryStrategy(),
requestHandler: Globals.getRequestHandler()
requestHandler: Globals.getRequestHandler(),
endpoint: serviceEndpoint
});
} else {
this.region = Globals.getRegion();
this.route53 = new Route53Client({
region: this.region,
retryStrategy: Globals.getRetryStrategy(),
requestHandler: Globals.getRequestHandler()
requestHandler: Globals.getRequestHandler(),
endpoint: serviceEndpoint
});
}
}
Expand Down Expand Up @@ -59,7 +62,7 @@ class Route53Wrapper {
"NextMarker",
new ListHostedZonesCommand({})
);
Logging.logInfo(`Founded hosted zones list: ${hostedZones.map((zone) => zone.Name)}.`);
Logging.logInfo(`Found hosted zones list: ${hostedZones.map((zone) => zone.Name)}.`);
} catch (err) {
throw new Error(`Unable to list hosted zones in Route53.\n${err.message}`);
}
Expand Down
3 changes: 2 additions & 1 deletion src/aws/s3-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class S3Wrapper {
this.s3 = new S3Client({
credentials,
region: Globals.getRegion(),
requestHandler: Globals.getRequestHandler()
requestHandler: Globals.getRequestHandler(),
endpoint: Globals.getServiceEndpoint("s3")
});
}

Expand Down

0 comments on commit 3ff604a

Please sign in to comment.