Skip to content

Allow user to customize naming convention#1927

Open
MacHu-GWU wants to merge 7 commits into
aws:masterfrom
MacHu-GWU:allow-user-to-customize-naming-convention
Open

Allow user to customize naming convention#1927
MacHu-GWU wants to merge 7 commits into
aws:masterfrom
MacHu-GWU:allow-user-to-customize-naming-convention

Conversation

@MacHu-GWU
Copy link
Copy Markdown

Issue #, if available:

#1926

Description of changes:

Replace the hard coded naming convention string template %s-%s-%s (...) with constant variable in constants.py module.

# content of constants.py
DEFAULT_LAMBDA_NAME_PREFIX_CONVENTION = "{app_name}-{chalice_stage}"
DEFAULT_LAMBDA_FUNC_NAME_CONVENTION = "{app_name}-{chalice_stage}-{func_name}"
DEFAULT_LAMBDA_LAYER_NAME_CONVENTION = "{app_name}-{chalice_stage}-{layer_name}"
DEFAULT_LAMBDA_ROLE_NAME_CONVENTION = "{app_name}-{chalice_stage}-{func_name}"
DEFAULT_LAMBDA_DEFAULT_ROLE_NAME_CONVENTION = "{app_name}-{chalice_stage}"
DEFAULT_EVENT_RULE_NAME_CONVENTION = "{app_name}-{chalice_stage}-{resource_name}"

As a result, user can do this to customize the function naming convention

# monkey patch
from chalice import constants
constants.DEFAULT_LAMBDA_FUNC_NAME_CONVENTION = "{chalice_stage}-{app_name}-{func_name}"

from chalice import Chalice

...

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant