Skip to content

Commit

Permalink
fix(client-workspaces-thin-client): add compatibility alias (#5555)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe authored Dec 7, 2023
1 parent 2121fd5 commit b0756b9
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 1 deletion.
14 changes: 14 additions & 0 deletions clients/client-workspaces-thin-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,17 @@ export * from "./models";
import "@aws-sdk/util-endpoints";

export { WorkSpacesThinClientServiceException } from "./models/WorkSpacesThinClientServiceException";

import { WorkSpacesThinClient } from "./WorkSpacesThinClient";

/**
* @deprecated use {WorkSpacesThinClient} (renamed) instead.
* The aggregated client is called WorkSpacesThinClient,
* and the barebones client is called WorkSpacesThinClientClient.
*
* Due to some code generation issues with the word "Client" in the service name,
* we are maintaining a few backwards compatible aliases here.
*/
export const WorkSpacesThin = WorkSpacesThinClient;

export type { WorkSpacesThinClientPaginationConfiguration as WorkSpacesThinPaginationConfiguration } from "./pagination/Interfaces";
2 changes: 1 addition & 1 deletion codegen/config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<!-- Files must contain a copyright header. -->
<module name="RegexpHeader">
<property name="header"
value="/\*\n \* Copyright( 20(19|20|21|22)|) Amazon\.com, Inc\. or its affiliates\. All Rights Reserved\.\n"/>
value="/\*\n \* Copyright( 20(19|20|21|22|23)|) Amazon\.com, Inc\. or its affiliates\. All Rights Reserved\.\n"/>
<property name="fileExtensions" value="java"/>
</module>

Expand Down
33 changes: 33 additions & 0 deletions scripts/generate-clients/customizations/workspaces-thin-client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const fs = require("fs");
const path = require("path");

const root = path.join(__dirname, "..", "..", "..");

const indexTs = path.join(root, "clients", "client-workspaces-thin-client", "src", "index.ts");

/**
* Exports aliases from the index of WorkSpacesThinClient.
*/
module.exports = function () {
const indexContents = fs.readFileSync(indexTs, "utf-8");
if (!indexContents.includes(`backwards compatible aliases`))
fs.writeFileSync(
indexTs,
indexContents +
`
import { WorkSpacesThinClient } from "./WorkSpacesThinClient";
/**
* @deprecated use {WorkSpacesThinClient} (renamed) instead.
* The aggregated client is called WorkSpacesThinClient,
* and the barebones client is called WorkSpacesThinClientClient.
*
* Due to some code generation issues with the word "Client" in the service name,
* we are maintaining a few backwards compatible aliases here.
*/
export const WorkSpacesThin = WorkSpacesThinClient;
export type { WorkSpacesThinClientPaginationConfiguration as WorkSpacesThinPaginationConfiguration } from "./pagination/Interfaces";
`
);
};
2 changes: 2 additions & 0 deletions scripts/generate-clients/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ const {
emptyDirSync(TEMP_CODE_GEN_INPUT_DIR);
rmdirSync(TEMP_CODE_GEN_INPUT_DIR);
}

require("./customizations/workspaces-thin-client")();
} catch (e) {
console.log(e);
process.exit(1);
Expand Down
4 changes: 4 additions & 0 deletions scripts/generate-clients/single-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const { solo } = yargs(process.argv.slice(2))
);
await codeOrdering(join(SDK_CLIENTS_DIR, `client-${solo}`));

if (solo === "workspaces-thin-client") {
require("./customizations/workspaces-thin-client")();
}

// post-generation transforms
const clientFolder = join(SDK_CLIENTS_DIR, `client-${solo}`);
const libFolder = join(SDK_CLIENTS_DIR, "..", "lib", `lib-${solo}`);
Expand Down

0 comments on commit b0756b9

Please sign in to comment.