Skip to content

Commit

Permalink
Revert AWS clients changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rddimon committed Dec 7, 2023
1 parent 5e83376 commit ab368fe
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/aws/acm-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ class ACMWrapper {

constructor (credentials: any, endpointType: string) {
const isEdge = endpointType === Globals.endpointTypes.edge;
this.acm = new ACMClient([{
this.acm = new ACMClient({
credentials,
region: isEdge ? Globals.defaultRegion : Globals.getRegion(),
retryStrategy: Globals.getRetryStrategy(),
requestHandler: Globals.getRequestHandler()
}]);
});
}

public async getCertArn (domain: DomainConfig): Promise<string> {
Expand Down
4 changes: 2 additions & 2 deletions src/aws/api-gateway-v1-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ class APIGatewayV1Wrapper extends APIGatewayBase {

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

public async createCustomDomain (domain: DomainConfig): Promise<DomainInfo> {
Expand Down
4 changes: 2 additions & 2 deletions src/aws/api-gateway-v2-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ class APIGatewayV2Wrapper extends APIGatewayBase {

constructor (credentials?: any) {
super();
this.apiGateway = new ApiGatewayV2Client([{
this.apiGateway = new ApiGatewayV2Client({
credentials,
region: Globals.getRegion(),
retryStrategy: Globals.getRetryStrategy(),
requestHandler: Globals.getRequestHandler()
}]);
});
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/aws/cloud-formation-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ class CloudFormationWrapper {
// for the CloudFormation stack we should use the `base` stage not the plugin custom stage
const defaultStackName = Globals.serverless.service.service + "-" + Globals.getBaseStage();
this.stackName = Globals.serverless.service.provider.stackName || defaultStackName;
this.cloudFormation = new CloudFormationClient([{
this.cloudFormation = new CloudFormationClient({
credentials,
region: Globals.getRegion(),
retryStrategy: Globals.getRetryStrategy(),
requestHandler: Globals.getRequestHandler()
}]);
});
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/aws/route53-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ class Route53Wrapper {
// not null and not undefined
if (credentials) {
this.region = region || Globals.getRegion();
this.route53 = new Route53Client([{
this.route53 = new Route53Client({
credentials,
region: this.region,
retryStrategy: Globals.getRetryStrategy(),
requestHandler: Globals.getRequestHandler()
}]);
});
} else {
this.region = Globals.getRegion();
this.route53 = new Route53Client([{
this.route53 = new Route53Client({
region: this.region,
retryStrategy: Globals.getRetryStrategy(),
requestHandler: Globals.getRequestHandler()
}]);
});
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/aws/s3-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ class S3Wrapper {
public s3: S3Client;

constructor (credentials?: any) {
this.s3 = new S3Client([{
this.s3 = new S3Client({
credentials,
region: Globals.getRegion(),
requestHandler: Globals.getRequestHandler()
}]);
});
}

/**
Expand Down
8 changes: 4 additions & 4 deletions test/unit-tests/aws/acm-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ const certTestData = {
};

describe("ACM Wrapper checks", () => {
it("Initialization edge", () => {
it("Initialization edge", async () => {
const acmWrapper = new ACMWrapper(null, Globals.endpointTypes.edge);
const actualResult = acmWrapper.acm.config[0].region;
const actualResult = await acmWrapper.acm.config.region();
expect(actualResult).to.equal(Globals.defaultRegion);
});

it("Initialization regional", () => {
it("Initialization regional", async () => {
const acmWrapper = new ACMWrapper(null, Globals.endpointTypes.regional);
const actualResult = acmWrapper.acm.config[0].region;
const actualResult = await acmWrapper.acm.config.region();
expect(actualResult).to.equal(Globals.currentRegion);
});

Expand Down
4 changes: 2 additions & 2 deletions test/unit-tests/aws/api-gateway-v1-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ describe("API Gateway V1 wrapper checks", () => {
consoleOutput.length = 0;
});

it("Initialization", () => {
it("Initialization", async () => {
const apiGatewayV1Wrapper = new APIGatewayV1Wrapper();
const actualResult = apiGatewayV1Wrapper.apiGateway.config[0].region;
const actualResult = await apiGatewayV1Wrapper.apiGateway.config.region();
expect(actualResult).to.equal(Globals.currentRegion);
});

Expand Down
4 changes: 2 additions & 2 deletions test/unit-tests/aws/api-gateway-v2-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ describe("API Gateway V2 wrapper checks", () => {
consoleOutput.length = 0;
});

it("Initialization", () => {
it("Initialization", async () => {
const apiGatewayV2Wrapper = new APIGatewayV2Wrapper();
const actualResult = apiGatewayV2Wrapper.apiGateway.config[0].region;
const actualResult = await apiGatewayV2Wrapper.apiGateway.config.region();
expect(actualResult).to.equal(Globals.currentRegion);
});

Expand Down
4 changes: 2 additions & 2 deletions test/unit-tests/aws/cloud-formation-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ describe("Cloud Formation wrapper checks", () => {
Globals.serverless.service.provider.apiGateway.websocketApiId = null;
});

it("Initialization", () => {
it("Initialization", async () => {
const cloudFormationWrapper = new CloudFormationWrapper();
const actualResult = cloudFormationWrapper.cloudFormation.config[0].region;
const actualResult = await cloudFormationWrapper.cloudFormation.config.region();
expect(actualResult).to.equal(Globals.currentRegion);
expect(cloudFormationWrapper.stackName).to.equal(Globals.serverless.service.provider.stackName);
});
Expand Down
10 changes: 5 additions & 5 deletions test/unit-tests/aws/route53-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ describe("Route53 wrapper checks", () => {
consoleOutput.length = 0;
});

it("Initialization", () => {
it("Initialization", async() => {
const route53Wrapper = new Route53Wrapper();
const actualResult = route53Wrapper.route53.config[0].region;
const actualResult = await route53Wrapper.route53.config.region();
expect(actualResult).to.equal(Globals.currentRegion);
});

it("Initialization profile", () => {
it("Initialization profile", async () => {
const credentials = {
accessKeyId: "test_key_id",
secretAccessKey: "test_access_key",
Expand All @@ -30,10 +30,10 @@ describe("Route53 wrapper checks", () => {
const regionName = "test-region";
const route53Wrapper = new Route53Wrapper(credentials, regionName);

const actualRegion = route53Wrapper.route53.config[0].region;
const actualRegion = await route53Wrapper.route53.config.region();
expect(actualRegion).to.equal(regionName);

const actualCredentials = route53Wrapper.route53.config[0].credentials;
const actualCredentials = await route53Wrapper.route53.config.credentials();
expect(actualCredentials).to.equal(credentials);
});

Expand Down
4 changes: 2 additions & 2 deletions test/unit-tests/aws/s3-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ describe("S3 wrapper checks", () => {
consoleOutput.length = 0;
});

it("Initialization", () => {
it("Initialization", async () => {
const s3Wrapper = new S3Wrapper();
const actualResult = s3Wrapper.s3.config[0].region;
const actualResult = await s3Wrapper.s3.config.region();
expect(actualResult).to.equal(Globals.currentRegion);
});

Expand Down

0 comments on commit ab368fe

Please sign in to comment.