Skip to content

Commit e668d6c

Browse files
committed
more cleanups
1 parent e232449 commit e668d6c

2 files changed

Lines changed: 1 addition & 45 deletions

File tree

aws-proxy/aws_proxy/client/utils.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
11
from typing import Union
22

3-
import requests
4-
from localstack.config import get_edge_url
53
from localstack.utils.functions import run_safe
64
from localstack.utils.strings import to_str, truncate
75

8-
from aws_proxy.config import HANDLER_PATH_PROXY
9-
from aws_proxy.shared.models import ReplicateStateRequest
10-
11-
12-
def post_request_to_instance(request: ReplicateStateRequest = None):
13-
url = f"{get_edge_url()}{HANDLER_PATH_PROXY}"
14-
response = requests.post(url, json=request or {})
15-
if not response.ok:
16-
raise Exception(f"Invocation failed (code {response.status_code}): {response.content}")
17-
return response
18-
196

207
# TODO: add to common utils
218
def truncate_content(content: Union[str, bytes], max_length: int = None):

aws-proxy/aws_proxy/shared/models.py

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,9 @@
11
import logging
2-
from abc import ABC, abstractmethod
3-
from typing import Any, Dict, List, Optional, TypedDict, Union
2+
from typing import Dict, List, TypedDict, Union
43

54
LOG = logging.getLogger(__name__)
65

76

8-
class ReplicateStateRequest(TypedDict):
9-
"""
10-
Represents a request sent from the CLI to the extension request
11-
handler to inject additional resource state properties.
12-
Using upper-case property names, to stay in line with CloudFormation/CloudControl resource models.
13-
"""
14-
15-
# resource type name (e.g., "AWS::S3::Bucket")
16-
Type: str
17-
# identifier of the resource
18-
PhysicalResourceId: Optional[str]
19-
# resource properties
20-
Properties: Dict[str, Any]
21-
22-
23-
class ResourceReplicator(ABC):
24-
"""
25-
Interface for resource replicator, to effect the creation of a cloned resource inside LocalStack.
26-
This interface has a client-side and a server-side implementation.
27-
"""
28-
29-
@abstractmethod
30-
def create(self, resource: Dict):
31-
"""Create the resource specified via the given resource dict."""
32-
33-
@abstractmethod
34-
def create_all(self):
35-
"""Scrape and replicate all resources from the source AWS account into LocalStack."""
36-
37-
387
class ProxyServiceConfig(TypedDict, total=False):
398
# list of regexes identifying resources to be proxied requests to
409
resources: Union[str, List[str]]

0 commit comments

Comments
 (0)