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

Modularize RestApi code #1

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Refactor Sam API provider
  • Loading branch information
viksrivat committed Jun 25, 2019
commit 145162e71712acc7cf4d75a465ebcd1543ba6129
245 changes: 0 additions & 245 deletions samcli/commands/local/lib/api_provider.py

This file was deleted.

12 changes: 6 additions & 6 deletions samcli/commands/local/lib/local_api_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging

from samcli.local.apigw.local_apigw_service import LocalApigwService, Route
from samcli.commands.local.lib.sam_api_provider import SamApiProvider
from samcli.commands.local.lib.sam_api_provider import ApiProvider
from samcli.commands.local.lib.exceptions import NoApisDefined

LOG = logging.getLogger(__name__)
Expand Down Expand Up @@ -38,9 +38,9 @@ def __init__(self,
self.static_dir = static_dir

self.cwd = lambda_invoke_context.get_cwd()
self.api_provider = SamApiProvider(lambda_invoke_context.template,
parameter_overrides=lambda_invoke_context.parameter_overrides,
cwd=self.cwd)
self.api_provider = ApiProvider(lambda_invoke_context.template,
parameter_overrides=lambda_invoke_context.parameter_overrides,
cwd=self.cwd)
self.lambda_runner = lambda_invoke_context.local_lambda_runner
self.stderr_stream = lambda_invoke_context.stderr

Expand Down Expand Up @@ -89,7 +89,7 @@ def _make_routing_list(api_provider):

Parameters
----------
api_provider : samcli.commands.local.lib.sam_api_provider.SamApiProvider
api_provider : samcli.commands.local.lib.sam_api_provider.ApiProvider

Returns
-------
Expand All @@ -116,7 +116,7 @@ def _print_routes(api_provider, host, port):
Mounting Product at http://127.0.0.1:3000/path1/bar [GET, POST, DELETE]
Mounting Product at http://127.0.0.1:3000/path2/bar [HEAD]

:param samcli.commands.local.lib.provider.ApiProvider api_provider: API Provider that can return a list of APIs
:param samcli.commands.local.lib.provider.AbstractApiProvider api_provider: API Provider that can return a list of APIs
:param string host: Host name where the service is running
:param int port: Port number where the service is running
:returns list(string): List of lines that were printed to the console. Helps with testing
Expand Down
2 changes: 1 addition & 1 deletion samcli/commands/local/lib/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def __hash__(self):
Cors = namedtuple("Cors", ["AllowOrigin", "AllowMethods", "AllowHeaders"])


class ApiProvider(object):
class AbstractApiProvider(object):
"""
Abstract base class to return APIs and the functions they route to
"""
Expand Down
Loading