# Path: stacker_blueprints/rds/base.py
# class MasterInstance(BaseRDS):
#     """Blueprint for a generic Master RDS Database Instance.
# 
#     Subclasses should be created for each RDS engine for better validation of
#     things like engine version.
#     """
# 
#     def defined_variables(self):
#         variables = super(MasterInstance, self).defined_variables()
#         additional = {
#             "BackupRetentionPeriod": {
#                 "type": int,
#                 "description": "Number of days to retain database backups.",
#                 "validator": validate_backup_retention_period,
#                 "default": 7,
#             },
#             "MasterUser": {
#                 "type": str,
#                 "description": "Name of the master user in the db.",
#             },
#             "MasterUserPassword": {
#                 "type": CFNString,
#                 "no_echo": True,
#                 "description": "Master user password."
#             },
#             "PreferredBackupWindow": {
#                 "type": str,
#                 "description": "A (minimum 30 minute) window in HH:MM-HH:MM "
#                                "format in UTC for backups. Default: 4am-5am "
#                                "PST",
#                 "default": "12:00-13:00"
#             },
#             "DatabaseName": {
#                 "type": str,
#                 "description": "Initial db to create in database."
#             },
#             "MultiAZ": {
#                 "type": bool,
#                 "description": "Set to 'false' to disable MultiAZ support.",
#                 "default": True
#             },
#             "KmsKeyid": {
#                 "type": str,
#                 "description": "Requires that StorageEncrypted is true. "
#                                "Should be an ARN to the KMS key that should "
#                                "be used to encrypt the storage.",
#                 "default": "",
#             },
#             "EngineMajorVersion": {
#                 "type": str,
#                 "description": "Major Version for the engine. Basically the "
#                                "first two parts of the EngineVersion you "
#                                "choose."
#             },
#             "EngineVersion": {
#                 "type": str,
#                 "description": "Database engine version for the RDS Instance.",
#             },
#             "StorageEncrypted": {
#                 "type": bool,
#                 "description": "Set to 'false' to disable encrypted storage.",
#                 "default": True,
#             },
# 
#         }
#         variables.update(additional)
#         return variables
# 
#     def get_common_attrs(self):
#         variables = self.get_variables()
#         return {
#             "AllocatedStorage": variables["AllocatedStorage"],
#             "AllowMajorVersionUpgrade": variables["AllowMajorVersionUpgrade"],
#             "AutoMinorVersionUpgrade": variables["AutoMinorVersionUpgrade"],
#             "BackupRetentionPeriod": variables["BackupRetentionPeriod"],
#             "DBName": variables["DatabaseName"],
#             "DBInstanceClass": variables["InstanceType"],
#             "DBInstanceIdentifier": (
#                 variables["DBInstanceIdentifier"]
#                 or validate_db_instance_identifier(
#                     self.context.get_fqn(self.name),
#                     allow_empty=False
#                 )
#             ),
#             "DBSnapshotIdentifier": self.get_db_snapshot_identifier(),
#             "DBParameterGroupName": Ref("ParameterGroup"),
#             "DBSubnetGroupName": Ref(SUBNET_GROUP),
#             "Engine": self.engine() or variables["Engine"],
#             "EngineVersion": variables["EngineVersion"],
#             # NoValue for now
#             "LicenseModel": Ref("AWS::NoValue"),
#             "MasterUsername": variables["MasterUser"],
#             "MasterUserPassword": Ref("MasterUserPassword"),
#             "MultiAZ": variables["MultiAZ"],
#             "OptionGroupName": Ref("OptionGroup"),
#             "PreferredBackupWindow": variables["PreferredBackupWindow"],
#             "PreferredMaintenanceWindow":
#                 variables["PreferredMaintenanceWindow"],
#             "StorageEncrypted": variables["StorageEncrypted"],
#             "VPCSecurityGroups": [self.security_group, ],
#             "Tags": self.get_tags(),
#         }
# 
# class ReadReplica(BaseRDS):
#     """Blueprint for a Read replica RDS Database Instance."""
# 
#     def defined_variables(self):
#         variables = super(ReadReplica, self).defined_variables()
#         additional = {
#             "MasterDatabaseId": {
#                 "type": str,
#                 "description": "ID of the master database to create a read "
#                                "replica of."
#             },
#             "EngineMajorVersion": {
#                 "type": str,
#                 "description": "Major Version for the engine. Basically the "
#                                "first two parts of the EngineVersion you "
#                                "choose."
#             },
#             "EngineVersion": {
#                 "type": str,
#                 "description": "Database engine version for the RDS Instance.",
#             },
#             "StorageEncrypted": {
#                 "type": bool,
#                 "description": "Set to 'false' to disable encrypted storage.",
#                 "default": True,
#             },
#         }
#         variables.update(additional)
#         return variables
# 
#     def get_common_attrs(self):
#         variables = self.get_variables()
# 
#         return {
#             "SourceDBInstanceIdentifier": variables["MasterDatabaseId"],
#             "AllocatedStorage": variables["AllocatedStorage"],
#             "AllowMajorVersionUpgrade": variables["AllowMajorVersionUpgrade"],
#             "AutoMinorVersionUpgrade": variables["AutoMinorVersionUpgrade"],
#             "DBInstanceClass": variables["InstanceType"],
#             "DBInstanceIdentifier": (
#                 variables["DBInstanceIdentifier"]
#                 or validate_db_instance_identifier(
#                     self.context.get_fqn(self.name),
#                     allow_empty=False
#                 )
#             ),
#             "DBParameterGroupName": Ref("ParameterGroup"),
#             "Engine": self.engine() or variables["Engine"],
#             "EngineVersion": variables["EngineVersion"],
#             "OptionGroupName": Ref("OptionGroup"),
#             "PreferredMaintenanceWindow":
#                 variables["PreferredMaintenanceWindow"],
#             "VPCSecurityGroups": [self.security_group, ],
#             "Tags": self.get_tags(),
#         }


from .base import MasterInstance, ReadReplica


class MySQLMixin(object):
    def engine(self):
        return "MySQL"


class MasterInstance(MySQLMixin, MasterInstance):
    pass



# Path: stacker_blueprints/rds/base.py
# class MasterInstance(BaseRDS):
#     """Blueprint for a generic Master RDS Database Instance.
# 
#     Subclasses should be created for each RDS engine for better validation of
#     things like engine version.
#     """
# 
#     def defined_variables(self):
#         variables = super(MasterInstance, self).defined_variables()
#         additional = {
#             "BackupRetentionPeriod": {
#                 "type": int,
#                 "description": "Number of days to retain database backups.",
#                 "validator": validate_backup_retention_period,
#                 "default": 7,
#             },
#             "MasterUser": {
#                 "type": str,
#                 "description": "Name of the master user in the db.",
#             },
#             "MasterUserPassword": {
#                 "type": CFNString,
#                 "no_echo": True,
#                 "description": "Master user password."
#             },
#             "PreferredBackupWindow": {
#                 "type": str,
#                 "description": "A (minimum 30 minute) window in HH:MM-HH:MM "
#                                "format in UTC for backups. Default: 4am-5am "
#                                "PST",
#                 "default": "12:00-13:00"
#             },
#             "DatabaseName": {
#                 "type": str,
#                 "description": "Initial db to create in database."
#             },
#             "MultiAZ": {
#                 "type": bool,
#                 "description": "Set to 'false' to disable MultiAZ support.",
#                 "default": True
#             },
#             "KmsKeyid": {
#                 "type": str,
#                 "description": "Requires that StorageEncrypted is true. "
#                                "Should be an ARN to the KMS key that should "
#                                "be used to encrypt the storage.",
#                 "default": "",
#             },
#             "EngineMajorVersion": {
#                 "type": str,
#                 "description": "Major Version for the engine. Basically the "
#                                "first two parts of the EngineVersion you "
#                                "choose."
#             },
#             "EngineVersion": {
#                 "type": str,
#                 "description": "Database engine version for the RDS Instance.",
#             },
#             "StorageEncrypted": {
#                 "type": bool,
#                 "description": "Set to 'false' to disable encrypted storage.",
#                 "default": True,
#             },
# 
#         }
#         variables.update(additional)
#         return variables
# 
#     def get_common_attrs(self):
#         variables = self.get_variables()
#         return {
#             "AllocatedStorage": variables["AllocatedStorage"],
#             "AllowMajorVersionUpgrade": variables["AllowMajorVersionUpgrade"],
#             "AutoMinorVersionUpgrade": variables["AutoMinorVersionUpgrade"],
#             "BackupRetentionPeriod": variables["BackupRetentionPeriod"],
#             "DBName": variables["DatabaseName"],
#             "DBInstanceClass": variables["InstanceType"],
#             "DBInstanceIdentifier": (
#                 variables["DBInstanceIdentifier"]
#                 or validate_db_instance_identifier(
#                     self.context.get_fqn(self.name),
#                     allow_empty=False
#                 )
#             ),
#             "DBSnapshotIdentifier": self.get_db_snapshot_identifier(),
#             "DBParameterGroupName": Ref("ParameterGroup"),
#             "DBSubnetGroupName": Ref(SUBNET_GROUP),
#             "Engine": self.engine() or variables["Engine"],
#             "EngineVersion": variables["EngineVersion"],
#             # NoValue for now
#             "LicenseModel": Ref("AWS::NoValue"),
#             "MasterUsername": variables["MasterUser"],
#             "MasterUserPassword": Ref("MasterUserPassword"),
#             "MultiAZ": variables["MultiAZ"],
#             "OptionGroupName": Ref("OptionGroup"),
#             "PreferredBackupWindow": variables["PreferredBackupWindow"],
#             "PreferredMaintenanceWindow":
#                 variables["PreferredMaintenanceWindow"],
#             "StorageEncrypted": variables["StorageEncrypted"],
#             "VPCSecurityGroups": [self.security_group, ],
#             "Tags": self.get_tags(),
#         }
# 
# class ReadReplica(BaseRDS):
#     """Blueprint for a Read replica RDS Database Instance."""
# 
#     def defined_variables(self):
#         variables = super(ReadReplica, self).defined_variables()
#         additional = {
#             "MasterDatabaseId": {
#                 "type": str,
#                 "description": "ID of the master database to create a read "
#                                "replica of."
#             },
#             "EngineMajorVersion": {
#                 "type": str,
#                 "description": "Major Version for the engine. Basically the "
#                                "first two parts of the EngineVersion you "
#                                "choose."
#             },
#             "EngineVersion": {
#                 "type": str,
#                 "description": "Database engine version for the RDS Instance.",
#             },
#             "StorageEncrypted": {
#                 "type": bool,
#                 "description": "Set to 'false' to disable encrypted storage.",
#                 "default": True,
#             },
#         }
#         variables.update(additional)
#         return variables
# 
#     def get_common_attrs(self):
#         variables = self.get_variables()
# 
#         return {
#             "SourceDBInstanceIdentifier": variables["MasterDatabaseId"],
#             "AllocatedStorage": variables["AllocatedStorage"],
#             "AllowMajorVersionUpgrade": variables["AllowMajorVersionUpgrade"],
#             "AutoMinorVersionUpgrade": variables["AutoMinorVersionUpgrade"],
#             "DBInstanceClass": variables["InstanceType"],
#             "DBInstanceIdentifier": (
#                 variables["DBInstanceIdentifier"]
#                 or validate_db_instance_identifier(
#                     self.context.get_fqn(self.name),
#                     allow_empty=False
#                 )
#             ),
#             "DBParameterGroupName": Ref("ParameterGroup"),
#             "Engine": self.engine() or variables["Engine"],
#             "EngineVersion": variables["EngineVersion"],
#             "OptionGroupName": Ref("OptionGroup"),
#             "PreferredMaintenanceWindow":
#                 variables["PreferredMaintenanceWindow"],
#             "VPCSecurityGroups": [self.security_group, ],
#             "Tags": self.get_tags(),
#         }


# Path: stacker_blueprints/rds/mysql.py
from .base import MasterInstance, ReadReplica



class MySQLMixin(object):
    def engine(self):
        return "MySQL"


class MasterInstance(MySQLMixin, MasterInstance):
    pass



class ReadReplica(MySQLMixin, ReadReplica):