2022-09-19 12:11:55 +00:00
|
|
|
from .base import BaseType
|
2022-09-18 16:07:59 +00:00
|
|
|
|
2022-09-19 12:11:55 +00:00
|
|
|
|
|
|
|
class DatabaseTypes(BaseType):
|
2022-09-18 16:07:59 +00:00
|
|
|
MYSQL = 'mysql', 'MySQL'
|
|
|
|
MARIADB = 'mariadb', 'MariaDB'
|
|
|
|
POSTGRESQL = 'postgresql', 'PostgreSQL'
|
|
|
|
ORACLE = 'oracle', 'Oracle'
|
|
|
|
SQLSERVER = 'sqlserver', 'SQLServer'
|
2023-10-08 12:03:15 +00:00
|
|
|
DB2 = 'db2', 'DB2'
|
2024-05-14 13:32:02 +00:00
|
|
|
DAMENG = 'dameng', 'Dameng'
|
2022-12-06 09:13:37 +00:00
|
|
|
CLICKHOUSE = 'clickhouse', 'ClickHouse'
|
2022-09-18 16:07:59 +00:00
|
|
|
MONGODB = 'mongodb', 'MongoDB'
|
|
|
|
REDIS = 'redis', 'Redis'
|
|
|
|
|
2022-09-19 12:11:55 +00:00
|
|
|
@classmethod
|
|
|
|
def _get_base_constrains(cls) -> dict:
|
2022-09-18 16:07:59 +00:00
|
|
|
return {
|
2022-09-19 12:11:55 +00:00
|
|
|
'*': {
|
2022-09-21 11:03:06 +00:00
|
|
|
'charset_enabled': False,
|
2022-09-19 12:11:55 +00:00
|
|
|
'domain_enabled': True,
|
|
|
|
'su_enabled': False,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def _get_automation_constrains(cls) -> dict:
|
|
|
|
constrains = {
|
|
|
|
'*': {
|
2022-09-26 10:03:48 +00:00
|
|
|
'ansible_enabled': True,
|
|
|
|
'ansible_config': {
|
|
|
|
'ansible_connection': 'local',
|
|
|
|
},
|
2023-01-16 11:02:09 +00:00
|
|
|
'ping_enabled': True,
|
2023-02-08 10:13:05 +00:00
|
|
|
'gather_facts_enabled': False,
|
2022-09-19 12:11:55 +00:00
|
|
|
'gather_accounts_enabled': True,
|
|
|
|
'verify_account_enabled': True,
|
2022-10-13 09:47:29 +00:00
|
|
|
'change_secret_enabled': True,
|
2023-01-16 11:02:09 +00:00
|
|
|
'push_account_enabled': True,
|
2024-06-12 11:23:40 +00:00
|
|
|
'remove_account_enabled': True,
|
2023-01-16 11:02:09 +00:00
|
|
|
},
|
|
|
|
cls.REDIS: {
|
2023-01-29 05:31:11 +00:00
|
|
|
'ansible_enabled': False,
|
2023-02-21 12:06:45 +00:00
|
|
|
'ping_enabled': False,
|
|
|
|
'gather_facts_enabled': False,
|
|
|
|
'gather_accounts_enabled': False,
|
|
|
|
'verify_account_enabled': False,
|
|
|
|
'change_secret_enabled': False,
|
|
|
|
'push_account_enabled': False,
|
2023-01-16 11:02:09 +00:00
|
|
|
},
|
2023-10-08 12:03:15 +00:00
|
|
|
cls.DB2: {
|
|
|
|
'ansible_enabled': False,
|
|
|
|
'ping_enabled': False,
|
|
|
|
'gather_facts_enabled': False,
|
|
|
|
'gather_accounts_enabled': False,
|
|
|
|
'verify_account_enabled': False,
|
|
|
|
'change_secret_enabled': False,
|
|
|
|
'push_account_enabled': False,
|
|
|
|
},
|
2024-05-14 13:32:02 +00:00
|
|
|
cls.DAMENG: {
|
|
|
|
'ansible_enabled': False,
|
|
|
|
'ping_enabled': False,
|
|
|
|
'gather_facts_enabled': False,
|
|
|
|
'gather_accounts_enabled': False,
|
|
|
|
'verify_account_enabled': False,
|
|
|
|
'change_secret_enabled': False,
|
|
|
|
'push_account_enabled': False,
|
|
|
|
},
|
2023-01-16 11:02:09 +00:00
|
|
|
cls.CLICKHOUSE: {
|
2023-01-29 05:31:11 +00:00
|
|
|
'ansible_enabled': False,
|
2023-02-21 12:06:45 +00:00
|
|
|
'ping_enabled': False,
|
|
|
|
'gather_facts_enabled': False,
|
|
|
|
'gather_accounts_enabled': False,
|
|
|
|
'verify_account_enabled': False,
|
|
|
|
'change_secret_enabled': False,
|
|
|
|
'push_account_enabled': False,
|
2023-01-16 11:02:09 +00:00
|
|
|
},
|
2022-09-18 16:07:59 +00:00
|
|
|
}
|
2022-09-19 12:11:55 +00:00
|
|
|
return constrains
|
2022-09-18 16:07:59 +00:00
|
|
|
|
|
|
|
@classmethod
|
2022-09-19 12:11:55 +00:00
|
|
|
def _get_protocol_constrains(cls) -> dict:
|
|
|
|
return {
|
|
|
|
'*': {
|
|
|
|
'choices': '__self__',
|
2022-09-18 16:07:59 +00:00
|
|
|
}
|
2022-09-19 12:11:55 +00:00
|
|
|
}
|
|
|
|
|
2022-09-22 07:24:32 +00:00
|
|
|
@classmethod
|
|
|
|
def internal_platforms(cls):
|
|
|
|
return {
|
|
|
|
cls.MYSQL: [{'name': 'MySQL'}],
|
|
|
|
cls.MARIADB: [{'name': 'MariaDB'}],
|
|
|
|
cls.POSTGRESQL: [{'name': 'PostgreSQL'}],
|
|
|
|
cls.ORACLE: [{'name': 'Oracle'}],
|
|
|
|
cls.SQLSERVER: [{'name': 'SQLServer'}],
|
2023-10-08 12:03:15 +00:00
|
|
|
cls.DB2: [{'name': 'DB2'}],
|
2024-05-14 13:32:02 +00:00
|
|
|
cls.DAMENG: [{'name': 'Dameng'}],
|
2023-01-29 05:31:11 +00:00
|
|
|
cls.CLICKHOUSE: [{'name': 'ClickHouse'}],
|
2022-09-22 07:24:32 +00:00
|
|
|
cls.MONGODB: [{'name': 'MongoDB'}],
|
2023-02-14 05:44:14 +00:00
|
|
|
cls.REDIS: [
|
|
|
|
{
|
|
|
|
'name': 'Redis',
|
|
|
|
'protocols_setting': {
|
|
|
|
'redis': {'auth_username': False}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'name': 'Redis6+',
|
|
|
|
'protocols_setting': {
|
|
|
|
'redis': {'auth_username': True}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2022-09-22 07:24:32 +00:00
|
|
|
}
|
|
|
|
|
2022-12-19 03:35:50 +00:00
|
|
|
@classmethod
|
|
|
|
def get_community_types(cls):
|
|
|
|
return [
|
|
|
|
cls.MYSQL, cls.MARIADB, cls.MONGODB, cls.REDIS
|
|
|
|
]
|