def _get_password_sql()

in lambda/python/cfn_example_functions/manage_user.py [0:0]


    def _get_password_sql(self):
        if self.password is None:
            return "PASSWORD DISABLE "
        else:
            # Escape single quotes to avoid SQL injections
            if not self.password.startswith('md5'):
                doc_link = "https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_USER.html#r_CREATE_USER-parameters"
                raise ValueError("Passwords should not be passed in as plaintext use the md5 approach instead. "
                                 f"See the Redshift CREATE USER documentation ({doc_link}).")
            self.password.replace("'", "''")
            return f"PASSWORD '{self.password}' "