Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add aliases in global_conf #42

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 84 additions & 74 deletions src/spacectl/conf/global_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,94 +3,104 @@

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SRC_DIR = os.path.dirname(BASE_DIR)
DEFAULT_TEMPLATE_DIR = os.path.join(BASE_DIR, 'template')
ASSET_DIR = os.path.join(BASE_DIR, 'asset')
DEFAULT_TEMPLATE_DIR = os.path.join(BASE_DIR, "template")
ASSET_DIR = os.path.join(BASE_DIR, "asset")

HOME_DIR = str(Path.home())
CONFIG_DIR = os.path.join(HOME_DIR, '.spaceone')
TEMPLATE_DIR = os.path.join(CONFIG_DIR, 'template')
ENVIRONMENT_CONF_PATH = os.path.join(CONFIG_DIR, 'environment.yml')
ENVIRONMENT_DIR = os.path.join(CONFIG_DIR, 'environments')

DEFAULT_ENVIRONMENT = 'default'
DEFAULT_PARSER = 'spacectl.lib.parser.default.DefaultParser'
CONFIG_DIR = os.path.join(HOME_DIR, ".spaceone")
TEMPLATE_DIR = os.path.join(CONFIG_DIR, "template")
ENVIRONMENT_CONF_PATH = os.path.join(CONFIG_DIR, "environment.yml")
ENVIRONMENT_DIR = os.path.join(CONFIG_DIR, "environments")

DEFAULT_ENVIRONMENT = "default"
DEFAULT_PARSER = "spacectl.lib.parser.default.DefaultParser"
RESOURCE_ALIAS = {
# Identity
'domain': ['identity', 'Domain'],
'domain_owner': ['identity', 'DomainOwner'],
'project': ['identity', 'Project'],
'project_group': ['identity', 'ProjectGroup'],
'pg': ['identity', 'ProjectGroup'],
'user': ['identity', 'User'],
'api_key': ['identity', 'APIKey'],
'policy': ['identity', 'Policy'],
'role': ['identity', 'Role'],
'provider': ['identity', 'Provider'],
'service_account': ['identity', 'ServiceAccount'],
'sa': ['identity', 'ServiceAccount'],
'endpoint': ['identity', 'Endpoint'],

"domain": ["identity", "Domain"],
"endpoint": ["identity", "Endpoint"],
"workspace": ["identity", "Workspace"],
"project": ["identity", "Project"],
"project_group": ["identity", "ProjectGroup"],
"pg": ["identity", "ProjectGroup"],
"user": ["identity", "User"],
"api_key": ["identity", "APIKey"],
"policy": ["identity", "Policy"],
"role": ["identity", "Role"],
"role_binding": ["identity", "RoleBinding"],
"rb": ["identity", "RoleBinding"],
"user_profile": ["identity", "UserProfile"],
"up": ["identity", "UserProfile"],
"workspace_user": ["identity", "WorkspaceUser"],
"wu": ["identity", "WorkspaceUser"],
"user_group": ["identity", "UserGroup"],
"ug": ["identity", "UserGroup"],
"app": ["identity", "App"],
"token": ["identity", "Token"],
"provider": ["identity", "Provider"],
"service_account": ["identity", "ServiceAccount"],
"sa": ["identity", "ServiceAccount"],
"trusted_account": ["identity", "TrustedAccount"],
"ta": ["identity", "TrustedAccount"],
# Secret
"secret": ["secret", "Secret"],
"ts": ["secret", "TrustedSecret"],
# Inventory
'region': ['inventory', 'Region'],
'cloud_service': ['inventory', 'CloudService'],
'cloud_service_type': ['inventory', 'CloudServiceType'],
'cs': ['inventory', 'CloudService'],
'cloud_service_query_set': ['inventory', 'CloudServiceQuerySet'],
'cloud_service_stats': ['inventory', 'CloudServiceStats'],
'resource_group': ['inventory', 'ResourceGroup'],
'rg': ['inventory', 'ResourceGroup'],
'collector': ['inventory', 'Collector'],

"region": ["inventory", "Region"],
"cloud_service": ["inventory", "CloudService"],
"cs": ["inventory", "CloudService"],
"cloud_service_type": ["inventory", "CloudServiceType"],
"cst": ["inventory", "CloudServiceType"],
"cloud_service_report": ["inventory", "CloudServiceReport"],
"csr": ["inventory", "CloudServiceReport"],
"cloud_service_query_set": ["inventory", "CloudServiceQuerySet"],
"cloud_service_stats": ["inventory", "CloudServiceStats"],
"change_history": ["inventory", "ChangeHistory"],
"note": ["inventory", "Note"],
"collector": ["inventory", "Collector"],
"collector_rule": ["inventory", "CollectorRule"],
"cr": ["inventory", "CollectorRule"],
# Config
'user_config': ['config', 'UserConfig'],
'domain_config': ['config', 'UserConfig'],

"user_config": ["config", "UserConfig"],
"domain_config": ["config", "UserConfig"],
# Repository
'repository': ['repository', 'Repository'],
'repo': ['repository', 'Repository'],
'plugin': ['repository', 'Plugin'],
'schema': ['repository', 'Schema'],

# Secret
'secret': ['secret', 'Secret'],

"repository": ["repository", "Repository"],
"repo": ["repository", "Repository"],
"plugin": ["repository", "Plugin"],
# Monitoring
'metric': ['monitoring', 'Metric'],
'log': ['monitoring', 'Log'],
'project_alert_config': ['monitoring', 'ProjectAlertConfig'],
'escalation_policy': ['monitoring', 'EscalationPolicy'],
'webhook': ['monitoring', 'Webhook'],
'maintenance_window': ['monitoring', 'MaintenanceWindow'],
'alert': ['monitoring', 'Alert'],
'event': ['monitoring', 'Event'],

"metric": ["monitoring", "Metric"],
"log": ["monitoring", "Log"],
"escalation_policy": ["monitoring", "EscalationPolicy"],
"ep": ["monitoring", "EscalationPolicy"],
"event_rule": ["monitoring", "EventRule"],
"er": ["monitoring", "EventRule"],
"webhook": ["monitoring", "Webhook"],
"maintenance_window": ["monitoring", "MaintenanceWindow"],
"alert": ["monitoring", "Alert"],
"event": ["monitoring", "Event"],
# Notification
'protocol': ['notification', 'Protocol'],
'project_channel': ['notification', 'ProjectChannel'],
'ph': ['notification', 'ProjectChannel'],
'user_channel': ['notification', 'UserChannel'],
'uh': ['notification', 'UserChannel'],
'notification': ['notification', 'Notification'],
'noti': ['notification', 'Notification'],

"protocol": ["notification", "Protocol"],
"project_channel": ["notification", "ProjectChannel"],
"ph": ["notification", "ProjectChannel"],
"user_channel": ["notification", "UserChannel"],
"uh": ["notification", "UserChannel"],
"notification": ["notification", "Notification"],
"noti": ["notification", "Notification"],
# Cost Analysis
'cost': ['cost_analysis', 'Cost'],
'budget': ['cost_analysis', 'Budget'],
'budget_usage': ['cost_analysis', 'BudgetUsage'],

"cost": ["cost_analysis", "Cost"],
"ds": ["cost_analysis", "DataSource"],
"dsr": ["cost_analysis", "DataSourceRule"],
"budget": ["cost_analysis", "Budget"],
"budget_usage": ["cost_analysis", "BudgetUsage"],
"cost_query_set": ["cost_analysis", "CostQuerySet"],
# Board
'board': ['board', 'Board'],
'post': ['board', 'Post'],

"board": ["board", "Board"],
# File Manager
'file': ['file_manager', 'File'],
'global_file': ['file_manager', 'GlobalFile'],

"file": ["file_manager", "File"],
# Dashboard
'cw': ['dashboard', 'CustomWidget'],
'domain_dashboard': ['dashboard', 'DomainDashboard'],
'project_dashboard': ['dashboard', 'ProjectDashboard']
"public_dashboard": ["dashboard", "PublicDashboard"],
"pub_d": ["dashboard", "PublicDashboard"],
"private_dashboard": ["dashboard", "PrivateDashboard"],
"pri_d": ["dashboard", "PrivateDashboard"],
}

EXCLUDE_APIS = [
Expand Down