-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from stat-kwon/master
refactor: change all apis for SpaceONE 2.0
- Loading branch information
Showing
58 changed files
with
1,487 additions
and
2,292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,20 +17,15 @@ | |
from setuptools import setup, find_packages | ||
|
||
setup( | ||
name='spaceone-dashboard', | ||
version=os.environ.get('PACKAGE_VERSION'), | ||
description='SpaceONE dashboard service', | ||
long_description='', | ||
url='https://www.spaceone.dev/', | ||
author='MEGAZONE SpaceONE Team', | ||
author_email='[email protected]', | ||
license='Apache License 2.0', | ||
name="spaceone-dashboard", | ||
version=os.environ.get("PACKAGE_VERSION"), | ||
description="SpaceONE dashboard service", | ||
long_description="", | ||
url="https://www.spaceone.dev/", | ||
author="MEGAZONE SpaceONE Team", | ||
author_email="[email protected]", | ||
license="Apache License 2.0", | ||
packages=find_packages(), | ||
install_requires=[ | ||
'spaceone-core', | ||
'spaceone-api', | ||
'mongoengine', | ||
'boto3' | ||
], | ||
install_requires=["spaceone-core", "spaceone-api", "mongoengine", "boto3"], | ||
zip_safe=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__path__ = __import__('pkgutil').extend_path(__path__, __name__) | ||
__path__ = __import__("pkgutil").extend_path(__path__, __name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,53 @@ | ||
# Database Settings | ||
DATABASES = { | ||
'default': { | ||
'db': 'dashboard', | ||
'host': 'localhost', | ||
'port': 27017, | ||
'username': '', | ||
'password': '' | ||
"default": { | ||
"db": "dashboard", | ||
"host": "localhost", | ||
"port": 27017, | ||
"username": "", | ||
"password": "", | ||
} | ||
} | ||
|
||
# Cache Settings | ||
CACHES = { | ||
'default': { | ||
"default": { | ||
# Redis Example | ||
# 'backend': 'spaceone.core.cache.redis_cache.RedisCache', | ||
# 'host': '<host>', | ||
# 'port': 6379, | ||
# 'db': 0 | ||
} | ||
} | ||
|
||
# Handler Configuration | ||
HANDLERS = { | ||
'authentication': [ | ||
"authentication": [ | ||
# Default Authentication Handler | ||
# { | ||
# 'backend': 'spaceone.core.handler.authentication_handler.AuthenticationGRPCHandler', | ||
# 'uri': 'grpc://identity:50051/v1/Domain/get_public_key' | ||
# } | ||
], | ||
'authorization': [ | ||
"authorization": [ | ||
# Default Authorization Handler | ||
# { | ||
# 'backend': 'spaceone.core.handler.authorization_handler.AuthorizationGRPCHandler', | ||
# 'uri': 'grpc://identity:50051/v1/Authorization/verify' | ||
# } | ||
], | ||
'mutation': [], | ||
'event': [] | ||
"mutation": [], | ||
"event": [], | ||
} | ||
|
||
# Connector Settings | ||
CONNECTORS = { | ||
'SpaceConnector': { | ||
'backend': 'spaceone.core.connector.space_connector.SpaceConnector', | ||
'endpoints': { | ||
'identity': 'grpc://identity:50051', | ||
} | ||
"SpaceConnector": { | ||
"backend": "spaceone.core.connector.space_connector:SpaceConnector", | ||
"endpoints": { | ||
"identity": "grpc://identity:50051", | ||
}, | ||
} | ||
} | ||
|
||
# Log Settings | ||
LOG = { | ||
} | ||
LOG = {} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from spaceone.dashboard.error.common_dashboard import * | ||
from spaceone.dashboard.error.dashboard import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
from spaceone.dashboard.info.dashboard_info import * | ||
from spaceone.dashboard.info.dashboard_version_info import * | ||
from spaceone.dashboard.info.common_info import * | ||
from spaceone.dashboard.info.domain_dashboard_info import * | ||
from spaceone.dashboard.info.domain_dashboard_version_info import * | ||
from spaceone.dashboard.info.project_dashboard_info import * | ||
from spaceone.dashboard.info.project_dashboard_version_info import * | ||
from spaceone.dashboard.info.custom_widget_info import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import functools | ||
from spaceone.api.dashboard.v1 import dashboard_pb2 | ||
from spaceone.core.pygrpc.message_type import * | ||
from spaceone.core import utils | ||
from spaceone.dashboard.model.dashboard_model import Dashboard | ||
|
||
__all__ = ["DashboardInfo", "DashboardsInfo"] | ||
|
||
|
||
def DashboardInfo(dashboard_vo: Dashboard, minimal=False): | ||
info = { | ||
"dashboard_id": dashboard_vo.dashboard_id, | ||
"name": dashboard_vo.name, | ||
"dashboard_type": dashboard_vo.dashboard_type, | ||
"version": dashboard_vo.version, | ||
"labels": change_list_value_type(dashboard_vo.labels), | ||
"resource_group": dashboard_vo.resource_group, | ||
"user_id": dashboard_vo.user_id, | ||
"project_id": dashboard_vo.project_id, | ||
"workspace_id": dashboard_vo.workspace_id, | ||
"domain_id": dashboard_vo.domain_id, | ||
} | ||
|
||
if not minimal: | ||
info.update( | ||
{ | ||
"layouts": change_list_value_type(dashboard_vo.layouts) | ||
if dashboard_vo.layouts | ||
else None, | ||
"variables": change_struct_type(dashboard_vo.variables), | ||
"settings": change_struct_type(dashboard_vo.settings), | ||
"variables_schema": change_struct_type(dashboard_vo.variables_schema), | ||
"tags": change_struct_type(dashboard_vo.tags), | ||
"created_at": utils.datetime_to_iso8601(dashboard_vo.created_at), | ||
"updated_at": utils.datetime_to_iso8601(dashboard_vo.updated_at), | ||
} | ||
) | ||
|
||
return dashboard_pb2.DashboardInfo(**info) | ||
|
||
|
||
def DashboardsInfo(dashboard_vos, total_count, **kwargs): | ||
return dashboard_pb2.DashboardsInfo( | ||
results=list(map(functools.partial(DashboardInfo, **kwargs), dashboard_vos)), | ||
total_count=total_count, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import functools | ||
from spaceone.api.dashboard.v1 import dashboard_pb2 | ||
from spaceone.core.pygrpc.message_type import * | ||
from spaceone.core import utils | ||
from spaceone.dashboard.model import DashboardVersion | ||
|
||
__all__ = ["DashboardVersionInfo", "DashboardVersionsInfo"] | ||
|
||
|
||
def DashboardVersionInfo( | ||
dashboard_version_vo: DashboardVersion, minimal=False, latest_version=None | ||
): | ||
info = { | ||
"dashboard_id": dashboard_version_vo.dashboard_id, | ||
"version": dashboard_version_vo.version, | ||
"created_at": utils.datetime_to_iso8601(dashboard_version_vo.created_at), | ||
"domain_id": dashboard_version_vo.domain_id, | ||
} | ||
|
||
if latest_version: | ||
if latest_version == dashboard_version_vo.version: | ||
info.update({"latest": True}) | ||
else: | ||
info.update({"latest": False}) | ||
|
||
if not minimal: | ||
info.update( | ||
{ | ||
"layouts": change_list_value_type(dashboard_version_vo.layouts) | ||
if dashboard_version_vo.layouts | ||
else None, | ||
"variables": change_struct_type(dashboard_version_vo.variables), | ||
"settings": change_struct_type(dashboard_version_vo.settings), | ||
"variables_schema": change_struct_type( | ||
dashboard_version_vo.variables_schema | ||
), | ||
} | ||
) | ||
|
||
return dashboard_pb2.DashboardVersionInfo(**info) | ||
|
||
|
||
def DashboardVersionsInfo(dashboard_version_vos, total_count, **kwargs): | ||
return dashboard_pb2.DashboardVersionsInfo( | ||
results=list( | ||
map( | ||
functools.partial(DashboardVersionInfo, **kwargs), | ||
dashboard_version_vos, | ||
) | ||
), | ||
total_count=total_count, | ||
) |
Oops, something went wrong.