| 95 | } |
| 96 | |
| 97 | function getRegionConfig(awsRoot) { |
| 98 | const regionConfig = require(path.join(awsRoot, 'lib', 'region_config_data.json')); |
| 99 | |
| 100 | // We make a few amends to the official AWS endpoint config data. It describes the URLs |
| 101 | // that the SDK sends requests to, but that's only a subset of all valid URLs, so we add a |
| 102 | // couple of extra options that might be also relevant. |
| 103 | |
| 104 | // All based on https://docs.aws.amazon.com/general/latest/gr/rande.html |
| 105 | // See buildServers below to understand how this is all used. |
| 106 | |
| 107 | // EC2/autoscaling/ELB/EMR all allow both region-less and regioned URLs: |
| 108 | regionConfig.patterns['regionOrGeneral'] = { |
| 109 | "endpoint": "{service}.{region}.amazonaws.com", |
| 110 | "generalEndpoint": "{service}.amazonaws.com" |
| 111 | }; |
| 112 | regionConfig.rules['us-east-1/ec2'] = 'regionOrGeneral'; |
| 113 | regionConfig.rules['us-east-1/autoscaling'] = 'regionOrGeneral'; |
| 114 | regionConfig.rules['us-east-1/elasticloadbalancing'] = 'regionOrGeneral'; |
| 115 | regionConfig.rules['us-west-2/elasticmapreduce'] = 'regionOrGeneral'; |
| 116 | regionConfig.rules['*/rds'] = 'regionOrGeneral'; |
| 117 | |
| 118 | // S3 allows both - and .: s3.us-east-1.amazonaws.com or s3-us-east-1.amazonaws.com |
| 119 | regionConfig.patterns['s3signature'].endpoint = "{service}{dash-or-dot}{region}.amazonaws.com"; |
| 120 | |
| 121 | // S3 also has a general endpoint, resolving to us-east-1 |
| 122 | regionConfig.rules['us-east-1/s3'].endpoint = "{service}{dash-or-dot}{region}.amazonaws.com"; |
| 123 | regionConfig.rules['us-east-1/s3'].generalEndpoint = "{service}.amazonaws.com"; |
| 124 | |
| 125 | // Chime/health/support have special non-standard endpoints |
| 126 | regionConfig.rules['*/chime'] = { endpoint: "service.chime.aws.amazon.com" }; |
| 127 | regionConfig.rules['*/health'] = { endpoint: "https://health.us-east-1.amazonaws.com" }; |
| 128 | regionConfig.rules['*/support'] = { endpoint: "https://support.us-east-1.amazonaws.com" }; |
| 129 | |
| 130 | return regionConfig; |
| 131 | } |
| 132 | |
| 133 | let inputspec = process.argv[2]; |
| 134 | if (inputspec) { |