Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. const utils = require("./utils");
  2.  
  3. const newDomain = "";
  4. const domains = [""];
  5.  
  6. const main = async () => {
  7. try {
  8. for (let i = 0; i < domains.length; i++) {
  9. const domain = domains[i];
  10. let basePaths = await utils.run(
  11. `aws apigateway get-base-path-mappings --domain-name ${domain}`
  12. );
  13. basePaths = basePaths ? JSON.parse(basePaths) : basePaths;
  14. for (let j = 0; j < basePaths.items.length; j++) {
  15. const basePath = basePaths.items[j];
  16. await utils.run(
  17. `aws apigateway create-base-path-mapping --domain-name ${newDomain} --rest-api-id ${
  18. basePath.restApiId
  19. } --stage ${basePath.stage} --base-path ${basePath.basePath}`
  20. );
  21. }
  22. }
  23. } catch (error) {
  24. console.log({ error });
  25. }
  26. };
  27.  
  28. main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement