Skip to content

Commit

Permalink
feat: initialize dashboard service using spaceone-core (#1)
Browse files Browse the repository at this point in the history
Signed-off-by: Seolmin Kwon <seolmin@megazone.com>
  • Loading branch information
stat-kwon committed Oct 25, 2022
1 parent ab29c51 commit ba34e52
Show file tree
Hide file tree
Showing 40 changed files with 331 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.swp
*.bak
.git
.gitignore
.dockerignore
dist
build
test
*.egg-info
__pycache__
.idea
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### Category
- [ ] New feature
- [ ] Bug fix
- [ ] Improvement
- [ ] Refactor
- [ ] etc

### Description

### Known issue
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.swp
*.bak
disk
build
*.egg-info
*.egg
*.whl
*.log
.idea
__pycache__
venv
local-conf.yml
test/reports
test/_trial_temp
.DS_Store
.venv/
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# dashboard
# dashboard
Core service for Dashboard
4 changes: 4 additions & 0 deletions pkg/pip_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
spaceone-core
spaceone-api
mongoengine
boto3
1 change: 1 addition & 0 deletions src/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

39 changes: 39 additions & 0 deletions src/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Copyright 2020 The SpaceONE Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from setuptools import setup, find_packages

with open('VERSION', 'r') as f:
VERSION = f.read().strip()
f.close()

setup(
name='spaceone-dashboard',
version=VERSION,
description='SpaceONE dashboard service',
long_description='',
url='https://www.spaceone.dev/',
author='MEGAZONE SpaceONE Team',
author_email='admin@spaceone.dev',
license='Apache License 2.0',
packages=find_packages(),
install_requires=[
'spaceone-core',
'spaceone-api',
'mongoengine',
'boto3'
],
zip_safe=False,
)
1 change: 1 addition & 0 deletions src/spaceone/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Empty file.
Empty file.
55 changes: 55 additions & 0 deletions src/spaceone/dashboard/conf/global_conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Database Settings
DATABASES = {
'default': {
'db': 'dashboard',
'host': 'localhost',
'port': 27017,
'username': '',
'password': ''
}
}

# Cache Settings
CACHES = {
'default': {
# Redis Example
# 'backend': 'spaceone.core.cache.redis_cache.RedisCache',
# 'host': '<host>',
# 'port': 6379,
# 'db': 0
}
}

# Handler Configuration
HANDLERS = {
'authentication': [
# Default Authentication Handler
# {
# 'backend': 'spaceone.core.handler.authentication_handler.AuthenticationGRPCHandler',
# 'uri': 'grpc://identity:50051/v1/Domain/get_public_key'
# }
],
'authorization': [
# Default Authorization Handler
# {
# 'backend': 'spaceone.core.handler.authorization_handler.AuthorizationGRPCHandler',
# 'uri': 'grpc://identity:50051/v1/Authorization/verify'
# }
],
'mutation': [],
'event': []
}

# Connector Settings
CONNECTORS = {
'SpaceConnector': {
'backend': 'spaceone.core.connector.space_connector.SpaceConnector',
'endpoints': {
'identity': 'grpc://identity:50051',
}
}
}

# Log Settings
LOG = {
}
5 changes: 5 additions & 0 deletions src/spaceone/dashboard/conf/proto_conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PROTO = {
'spaceone.dashboard.interface.grpc.v1.domain_dashboard': ['DomainDashboard'],
'spaceone.dashboard.interface.grpc.v1.project_dashboard': ['ProjectDashboard'],
'spaceone.dashboard.interface.grpc.v1.widget': ['Widget']
}
Empty file.
Empty file.
4 changes: 4 additions & 0 deletions src/spaceone/dashboard/info/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from spaceone.dashboard.info.common_info import *
from spaceone.dashboard.info.domain_dashboard_info import *
from spaceone.dashboard.info.project_dashboard_info import *
from spaceone.dashboard.info.widget_info import *
Empty file.
Empty file.
Empty file.
12 changes: 12 additions & 0 deletions src/spaceone/dashboard/info/widget_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from google.protobuf.empty_pb2 import Empty
from spaceone.core.pygrpc.message_type import *

__all__ = ['EmptyInfo', 'StatisticsInfo']


def EmptyInfo():
return Empty()


def StatisticsInfo(result):
return change_struct_type(result)
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
3 changes: 3 additions & 0 deletions src/spaceone/dashboard/manager/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from spaceone.dashboard.manager.domain_dashboard_manager import DomainDashboardManager
from spaceone.dashboard.manager.project_dashboard_manager import ProjectDashboardManager
from spaceone.dashboard.manager.widget_manager import WidgetManager
12 changes: 12 additions & 0 deletions src/spaceone/dashboard/manager/domain_dashboard_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import logging
from spaceone.core.manager import BaseManager
from spaceone.dashboard.model.domain_dashboard_model import DomainDashboard

_LOGGER = logging.getLogger(__name__)


class DomainDashboardManager(BaseManager):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.domain_dashboard_model: DomainDashboard = self.locator.get_model('DomainDashboard')
12 changes: 12 additions & 0 deletions src/spaceone/dashboard/manager/project_dashboard_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import logging
from spaceone.core.manager import BaseManager
from spaceone.dashboard.model.project_dashboard_model import ProjectDashboard

_LOGGER = logging.getLogger(__name__)


class ProjectDashboardManager(BaseManager):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.project_dashboard_model: ProjectDashboard = self.locator.get_model('ProjectDashboard')
12 changes: 12 additions & 0 deletions src/spaceone/dashboard/manager/widget_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import logging
from spaceone.core.manager import BaseManager
from spaceone.dashboard.model.widget_model import Widget

_LOGGER = logging.getLogger(__name__)


class WidgetManager(BaseManager):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.widget_model: Widget = self.locator.get_model('Widget')
3 changes: 3 additions & 0 deletions src/spaceone/dashboard/model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from spaceone.dashboard.model.domain_dashboard_model import DomainDashboard
from spaceone.dashboard.model.project_dashboard_model import ProjectDashboard
from spaceone.dashboard.model.widget_dashboard_model import WidgetDashboard
7 changes: 7 additions & 0 deletions src/spaceone/dashboard/model/domain_dashboard_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from mongoengine import StringField, ListField, DictField, DateTimeField

from spaceone.core.model.mongo_model import MongoModel


class DomainDashboard(MongoModel):
pass
7 changes: 7 additions & 0 deletions src/spaceone/dashboard/model/project_dashboard_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from mongoengine import StringField, ListField, DictField, DateTimeField

from spaceone.core.model.mongo_model import MongoModel


class ProjectDashboard(MongoModel):
pass
7 changes: 7 additions & 0 deletions src/spaceone/dashboard/model/widget_dashboard_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from mongoengine import StringField, ListField, DictField, DateTimeField

from spaceone.core.model.mongo_model import MongoModel


class WidgetDashboard(MongoModel):
pass
3 changes: 3 additions & 0 deletions src/spaceone/dashboard/service/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from spaceone.dashboard.service.domain_dashboard_service import DomainDashboardService
from spaceone.dashboard.service.project_dashboard_service import ProjectDashboardService
from spaceone.dashboard.service.widget_service import WidgetService
35 changes: 35 additions & 0 deletions src/spaceone/dashboard/service/domain_dashboard_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import logging

from spaceone.core.service import *
from spaceone.dashboard.manager import DomainDashboardManager

_LOGGER = logging.getLogger(__name__)


@authentication_handler
@authorization_handler
@mutation_handler
@event_handler
class DomainDashboardService(BaseService):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.domain_dashboard_mgr: DomainDashboardManager = self.locator.get_manager('DomainDashboardManager')

def create(self, params):
pass

def update(self, params):
pass

def delete(self, params):
pass

def get(self, params):
pass

def list(self, params):
pass

def stat(self, params):
pass
35 changes: 35 additions & 0 deletions src/spaceone/dashboard/service/project_dashboard_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import logging

from spaceone.core.service import *
from spaceone.dashboard.manager import ProjectDashboardManager

_LOGGER = logging.getLogger(__name__)


@authentication_handler
@authorization_handler
@mutation_handler
@event_handler
class ProjectDashboardService(BaseService):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.project_dashboard_mgr: ProjectDashboardManager = self.locator.get_manager('ProjectDashboardManager')

def create(self, params):
pass

def update(self, params):
pass

def delete(self, params):
pass

def get(self, params):
pass

def list(self, params):
pass

def stat(self, params):
pass
35 changes: 35 additions & 0 deletions src/spaceone/dashboard/service/widget_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import logging

from spaceone.core.service import *
from spaceone.dashboard.manager import WidgetManager

_LOGGER = logging.getLogger(__name__)


@authentication_handler
@authorization_handler
@mutation_handler
@event_handler
class WidgetService(BaseService):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.widget_mgr: WidgetManager = self.locator.get_manager('WidgetManager')

def create(self, params):
pass

def update(self, params):
pass

def delete(self, params):
pass

def get(self, params):
pass

def list(self, params):
pass

def stat(self, params):
pass
Empty file added test/__init__.py
Empty file.
Empty file added test/service/__init__.py
Empty file.

0 comments on commit ba34e52

Please sign in to comment.