in src/credentials_rotators/npm/lambda_functions/secret_rotator.py [0:0]
def rotate(self):
"""
Raises:
ResourceNotFoundException: If the secret with the specified arn and stage does not exist
ValueError: If the secret is not properly configured for rotation
KeyError: If the event parameters do not contain the expected keys
"""
self.check_secret_versions()
## process the current rotation step
if self.step == "createSecret":
self.create_secret()
elif self.step == "setSecret":
self.set_secret()
elif self.step == "testSecret":
self.test_secret()
elif self.step == "finishSecret":
self.finish_secret()
else:
# should not be any other value unless there is an API change
# https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets-lambda-function-overview.html
raise ValueError("Invalid step parameter")