Source code for oasislmf.cli.api
from argparse import RawDescriptionHelpFormatter
from .command import OasisBaseCommand, OasisComputationCommand
[docs]
class ServerInfoApiCmd(OasisComputationCommand):
"""Print version/info details of the connected Oasis Platform API server"""
[docs]
computation_name = 'PlatformServerInfo'
[docs]
class ListApiCmd(OasisComputationCommand):
"""Issue API GET requests via the command line"""
[docs]
computation_name = 'PlatformList'
[docs]
class RunApiCmd(OasisComputationCommand):
"""Run a model via the Oasis Platform API end to end"""
[docs]
computation_name = 'PlatformRun'
[docs]
class RunLossApiCmd(OasisComputationCommand):
"""Run a model via the Oasis Platform API end to end"""
[docs]
computation_name = 'PlatformRunLosses'
[docs]
class DeleteApiCmd(OasisComputationCommand):
"""Delete items from the Platform API"""
[docs]
computation_name = 'PlatformDelete'
[docs]
class GetApiCmd(OasisComputationCommand):
"""Download files from the Oasis Platform API"""
[docs]
computation_name = 'PlatformGet'
[docs]
class PostApiCmd(OasisComputationCommand):
"""Upload file(s) to the Platform API"""
[docs]
formatter_class = RawDescriptionHelpFormatter
[docs]
computation_name = 'PlatformPost'
[docs]
class ValidateApiCmd(OasisComputationCommand):
"""Validate (or fetch the validation status of) a portfolio's OED exposure files"""
[docs]
computation_name = 'PlatformValidate'
[docs]
class ExposureRunApiCmd(OasisComputationCommand):
"""Run `oasislmf exposure run` on the server against a portfolio's exposure files"""
[docs]
computation_name = 'PlatformExposureRun'
[docs]
class CombineApiCmd(OasisComputationCommand):
"""Combine the ORD output of multiple RUN_COMPLETED analyses"""
[docs]
computation_name = 'PlatformCombine'
[docs]
class CancelApiCmd(OasisComputationCommand):
"""Cancel a running analysis (input generation or execution)"""
[docs]
computation_name = 'PlatformCancel'
[docs]
class ReconnectApiCmd(OasisComputationCommand):
"""Reconnect to an in-progress (or finished) analysis and resume polling for status"""
[docs]
computation_name = 'PlatformReconnect'
[docs]
class SubTasksApiCmd(OasisComputationCommand):
"""List the sub-tasks of an analysis run"""
[docs]
computation_name = 'PlatformSubTasks'
[docs]
class PlotApiCmd(OasisComputationCommand):
"""Plot a Gantt chart of an analysis's sub-tasks, with a status summary"""
[docs]
computation_name = 'PlatformPlot'
[docs]
class ApiCmd(OasisBaseCommand):
[docs]
sub_commands = {
'server-info': ServerInfoApiCmd,
'list': ListApiCmd,
'run': RunApiCmd,
'generate-oasis-files': RunInputApiCmd,
'generate-losses': RunLossApiCmd,
'delete': DeleteApiCmd,
'get': GetApiCmd,
'post': PostApiCmd,
'validate': ValidateApiCmd,
'exposure-run': ExposureRunApiCmd,
'exposure-transform': ExposureTransformApiCmd,
'combine': CombineApiCmd,
'cancel': CancelApiCmd,
'sub-tasks': SubTasksApiCmd,
'plot': PlotApiCmd,
'reconnect': ReconnectApiCmd,
}