New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): add AccountIdEndpointMode config option #6036
base: main
Are you sure you want to change the base?
Conversation
if (isAwsService(settings, model) && target.equals(LanguageTarget.NODE)) { | ||
writer.addDependency(AwsDependency.AWS_SDK_CORE); | ||
writer.addImport("emitWarningIfUnsupportedVersion", "awsCheckVersion", AwsDependency.AWS_SDK_CORE); | ||
writer.write("awsCheckVersion(process.version);"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
want to confirm importing /core
here is okay, since a chunk of this work will be placed in /core
itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outdated question^
switch (target) { | ||
case BROWSER: | ||
runtimeConfigs.put("accountIdEndpointMode", writer -> { | ||
writer.addDependency(TypeScriptDependency.CONFIG_RESOLVER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this dependency should be for core
instead, if we were to place defaults and resolver in core
instead of the config-resolver
package.
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix copyright statements to the short version
import java.util.Map; | ||
import java.util.function.Consumer; | ||
import java.util.logging.Logger; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put these on the top, remove spacing between import statements
if (isAwsService(settings, model)) { | ||
ServiceShape service = settings.getService(model); | ||
EndpointRuleSetTrait endpointRuleSetTrait = service.getTrait(EndpointRuleSetTrait.class) | ||
.orElseThrow(() -> new RuntimeException("service missing EndpointRuleSetTrait")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possibly don't throw here
RuleSetParameterFinder ruleSetParameterFinder = new RuleSetParameterFinder(service); | ||
if (ruleSetParameterFinder.getBuiltInParams().containsKey("AccountIdEndpointMode")) { | ||
writer.writeDocs("Defines if the AWS AccountId will be used for endpoint routing.") | ||
.write("accountIdEndpointMode?: AccountIdEndpointMode | __Provider<AccountIdEndpointMode>;\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to import this type with the writer
} | ||
|
||
@Override | ||
public void prepareCustomizations( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this entire function can be omitted
writer.addDependency(TypeScriptDependency.CONFIG_RESOLVER); | ||
writer.addImport("DEFAULT_ACCOUNT_ID_ENDPOINT_MODE", "DEFAULT_ACCOUNT_ID_ENDPOINT_MODE", | ||
TypeScriptDependency.CONFIG_RESOLVER); | ||
writer.write("(() => Promise.resolve(DEFAULT_ACCOUNT_ID_ENDPOINT_MODE))"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async () => val
Map<String, Consumer<TypeScriptWriter>> runtimeConfigs = new HashMap<>(); | ||
if (isAwsService(settings, model)) { | ||
EndpointRuleSetTrait endpointRuleSetTrait = service.getTrait(EndpointRuleSetTrait.class) | ||
.orElseThrow(() -> new RuntimeException("service missing EndpointRuleSetTrait")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont throw here either
Issue
Internal JS-4633
Part 3
Description
Adds support for
AccountIdEndpointMode
config option. (client config, env, config file)Testing
Checklist
@public
tag and enable doc generation on the package?By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.