• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

intuit / Trapheus / 7ecf2541-e446-4544-a68f-78cc8fdb3252

04 Oct 2023 08:10AM CUT coverage: 95.298%. Remained the same
7ecf2541-e446-4544-a68f-78cc8fdb3252

push

circleci

github-actions[bot]
docs: Added README."fr".md translation via https://github.com/dephraiim/translate-readme

527 of 553 relevant lines covered (95.3%)

0.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/rename/rename_function.py
1
import os
1✔
2
import boto3
1✔
3
import constants
1✔
4
import custom_exceptions
1✔
5
import utility as util
1✔
6

7
def lambda_rename_dbinstance(event, context):
1✔
8
    """Handles rename of a DB instance"""
9
    region = os.environ['Region']
1✔
10
    rds = boto3.client('rds', region)
1✔
11
    result = {}
1✔
12
    original_instance_identifier = ''
1✔
13
    modified_instance_identifier = ''
1✔
14
    try:
1✔
15
        if event.get('Error') == 'InstanceRestoreException' and \
1✔
16
                'Identifier' in event.get('Cause'):
17
            #rename revert scenario in case of db restore failure
18
            response = util.get_identifier_from_error(event)
1✔
19
            modified_instance_identifier = response["modified_identifier"]
1✔
20
            original_instance_identifier = response["original_identifier"]
1✔
21

22
        else:
23
            original_instance_identifier = event['identifier']
1✔
24
            modified_instance_identifier = event['identifier'] + '-temp'
1✔
25

26
        rds.modify_db_instance(
1✔
27
            DBInstanceIdentifier = original_instance_identifier,
28
            ApplyImmediately = True,
29
            NewDBInstanceIdentifier = modified_instance_identifier)
30

31
        result['taskname'] = constants.RENAME
1✔
32
        result['identifier'] = modified_instance_identifier
1✔
33
        return result
1✔
34

35
    except Exception as error:
1✔
36
        error_message = util.get_error_message(original_instance_identifier, error)
1✔
37
        if constants.RATE_EXCEEDED in str(error):
1✔
38
            raise custom_exceptions.RateExceededException(error_message)
1✔
39
        else:
40
            raise custom_exceptions.RenameException(error_message)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc