Skip to content

Commit

Permalink
Merge pull request #12 from jihyungSong/master
Browse files Browse the repository at this point in the history
refactor: Add get_plugin_metadata interface and info
  • Loading branch information
jihyungSong authored Jun 2, 2023
2 parents cf929f4 + 8becc2b commit 5b717fd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/spaceone/plugin/api/v1/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ def get_plugin_endpoint(self, request, context):
endpoint = plugin_svc.get_plugin_endpoint(params)
return self.locator.get_info('PluginEndpoint', endpoint)

def get_plugin_metadata(self, request, context):
"""Get Plugin Metadata.
Returns:
metadata(dict)
Raises:
ERROR_NOT_FOUND:
"""
params, metadata = self.parse_request(request, context)

with self.locator.get_service('PluginService', metadata) as plugin_svc:
metadata = plugin_svc.get_plugin_metadata(params)
return self.locator.get_info('PluginMetadata', metadata)

def notify_failure(self, request, context):
params, metadata = self.parse_request(request, context)

Expand Down
4 changes: 4 additions & 0 deletions src/spaceone/plugin/info/plugin_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ def PluginsInfo(plugin_vo: InstalledPluginRef, total_count):

def PluginEndpoint(endpoint):
return plugin_pb2.PluginEndpoint(**endpoint)


def PluginMetadata(metadata):
return plugin_pb2.PluginMetadata(**metadata)

0 comments on commit 5b717fd

Please sign in to comment.