Skip to content
Open
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
28 changes: 13 additions & 15 deletions samtranslator/model/connector/connector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from collections import namedtuple
from dataclasses import dataclass
from typing import Any, Dict, Iterable, List, Optional

from typing_extensions import TypeGuard
Expand All @@ -16,20 +16,18 @@
from samtranslator.public.sdk.resource import SamResourceType
from samtranslator.utils.utils import as_array, insert_unique

# TODO: Switch to dataclass
ConnectorResourceReference = namedtuple(
"ConnectorResourceReference",
[
"logical_id",
"resource_type",
"arn",
"role_name",
"queue_url",
"resource_id",
"name",
"qualifier",
],
)
@dataclass(frozen=True)
class ConnectorResourceReference:
"""Reference to a connector resource with all its identifying properties."""

logical_id: str
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When looking at all places that reference this class, it seems like there's an instance where logical_id would be None:

return ConnectorResourceReference(
logical_id=None,
resource_type=resource_type,
arn=obj.get("Arn"),
role_name=obj.get("RoleName"),
queue_url=obj.get("QueueUrl"),
resource_id=obj.get("ResourceId"),
name=obj.get("Name"),
qualifier=obj.get("Qualifier"),
)

Should this be Optional[str]?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya ya, because id is not provided in the resource reference

resource_type: str
arn: Optional[str] = None
role_name: Optional[str] = None
queue_url: Optional[str] = None
resource_id: Optional[str] = None
name: Optional[str] = None
qualifier: Optional[str] = None

_SAM_TO_CFN_RESOURCE_TYPE = {
SamResourceType.Function.value: LambdaFunction.resource_type,
Expand Down