Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5947e8b
get other conn types in list op
MilesHolland Jan 12, 2024
4f006da
accept empty connections in rest-local conversion
MilesHolland Jan 25, 2024
e319d40
Merge branch 'main' of https://github.com/azure/azure-sdk-for-python
MilesHolland Jan 25, 2024
e5af527
Merge branch 'main' into connections-jan-asks
MilesHolland Jan 25, 2024
9318317
azure blob base changes
MilesHolland Jan 31, 2024
d986da9
Merge branch 'main' into connections-jan-asks
MilesHolland Jan 31, 2024
1b6d921
partial replacement of if-else with maps in wc
MilesHolland Feb 2, 2024
6263dc6
more if-else removal refactors
MilesHolland Feb 5, 2024
4b6f2dc
Merge branch 'main' into connections-jan-asks
MilesHolland Feb 5, 2024
5882887
solidify connection changes
MilesHolland Feb 6, 2024
47c9b51
run black on v2
MilesHolland Feb 6, 2024
de24812
Merge branch 'main' into connections-jan-asks
MilesHolland Feb 6, 2024
5c8930f
initial self review
MilesHolland Feb 6, 2024
4b4c988
spelling
MilesHolland Feb 6, 2024
6f539fd
rerun black and ai nit
MilesHolland Feb 6, 2024
ea5b62f
more nits, and push flag to v2
MilesHolland Feb 7, 2024
7d4ca46
e2e test
MilesHolland Feb 7, 2024
d87bba7
Merge branch 'main' into connections-jan-asks
MilesHolland Feb 7, 2024
663ea4c
e2e test recordings and use 2024 restclient
MilesHolland Feb 7, 2024
a3907f9
analyze ci issues
MilesHolland Feb 7, 2024
2e85ab2
Merge branch 'main' into connections-jan-asks
MilesHolland Feb 7, 2024
5aa8207
mypy fixes
MilesHolland Feb 8, 2024
7795de7
more mypy
MilesHolland Feb 8, 2024
ec10c08
Merge branch 'connections-jan-asks' of github.com:MilesHolland/azure-…
MilesHolland Feb 8, 2024
0e2d312
remove 2024 conn dep until CI wakes up
MilesHolland Feb 8, 2024
31939b5
skip problematic test
MilesHolland Feb 8, 2024
e3be48b
try bumping mindep
MilesHolland Feb 8, 2024
710b06a
remove skip
MilesHolland Feb 8, 2024
b922eec
undo 1.14.0 dep
MilesHolland Feb 8, 2024
9d800cb
add back in 1.14 dep
MilesHolland Feb 8, 2024
a408731
comments
MilesHolland Feb 12, 2024
10922a1
linting
MilesHolland Feb 12, 2024
d2c66ed
remove extra line
MilesHolland Feb 12, 2024
dba0cbd
more linting
MilesHolland Feb 13, 2024
66e202c
run black
MilesHolland Feb 13, 2024
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
more mypy
  • Loading branch information
MilesHolland committed Feb 8, 2024
commit 7795de7bae60e3831c0aba56377c118cd5f4e8cb
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,11 @@ def container_name(self) -> str:
"""The container name of the connection.

:return: the container name of the connection.
:rtype: Optional[str]
:rtype: str
"""
if self._workspace_connection.tags is not None and CONNECTION_CONTAINER_NAME_KEY in self._workspace_connection.tags:
return self._workspace_connection.tags[CONNECTION_CONTAINER_NAME_KEY]
return None
return ""

@container_name.setter
def container_name(self, value: str) -> None:
Expand All @@ -376,11 +376,11 @@ def account_name(self) -> str:
"""The account name of the connection.

:return: the account name of the connection.
:rtype: Optional[str]
:rtype: str
"""
if self._workspace_connection.tags is not None and CONNECTION_ACCOUNT_NAME_KEY in self._workspace_connection.tags:
return self._workspace_connection.tags[CONNECTION_ACCOUNT_NAME_KEY]
return None
return ""

@account_name.setter
def account_name(self, value: str) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ def credentials(
ServicePrincipalConfiguration,
AccessKeyConfiguration,
ApiKeyConfiguration,
None,
]:
"""Credentials for workspace connection.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ def __init__(
kwargs.pop("type", None) # make sure we never somehow use wrong type
super().__init__(target=target, type=camel_to_snake(ConnectionCategory.AZURE_OPEN_AI), credentials=credentials, from_child=True, **kwargs)

if self.tags is not None:
self.tags[CONNECTION_API_VERSION_KEY] = api_version
self.tags[CONNECTION_API_TYPE_KEY] = api_type
if not hasattr(self, 'tags') or self.tags is None:
self.tags = {}
self.tags[CONNECTION_API_VERSION_KEY] = api_version
self.tags[CONNECTION_API_TYPE_KEY] = api_type

@classmethod
def _get_required_metadata_fields(cls) -> List[str]:
Expand All @@ -76,7 +77,7 @@ def api_version(self) -> Optional[str]:
"""The API version of the workspace connection.

:return: The API version of the workspace connection.
:rtype: str
:rtype: Optional[str]
"""
if self.tags is not None and CONNECTION_API_VERSION_KEY in self.tags:
res: str = self.tags[CONNECTION_API_VERSION_KEY]
Expand All @@ -90,15 +91,16 @@ def api_version(self, value: str) -> None:
:param value: The new api version to set.
:type value: str
"""
if self.tags is not None:
self.tags[CONNECTION_API_VERSION_KEY] = value
if not hasattr(self, 'tags') or self.tags is None:
self.tags = {}
self.tags[CONNECTION_API_VERSION_KEY] = value

@property
def api_type(self) -> Optional[str]:
"""The API type of the workspace connection.

:return: The API type of the workspace connection.
:rtype: str
:rtype: Optional[str]
"""
if self.tags is not None and CONNECTION_API_TYPE_KEY in self.tags:
res: str = self.tags[CONNECTION_API_TYPE_KEY]
Expand All @@ -112,8 +114,9 @@ def api_type(self, value: str) -> None:
:param value: The new api type to set.
:type value: str
"""
if self.tags is not None:
self.tags[CONNECTION_API_TYPE_KEY] = value
if not hasattr(self, 'tags') or self.tags is None:
self.tags = {}
self.tags[CONNECTION_API_TYPE_KEY] = value


@experimental
Expand Down Expand Up @@ -144,8 +147,9 @@ def __init__(
kwargs.pop("type", None) # make sure we never somehow use wrong type
super().__init__(target=target, type=camel_to_snake(ConnectionCategory.COGNITIVE_SEARCH), credentials=credentials, from_child=True, **kwargs)

if self.tags is not None:
self.tags[CONNECTION_API_VERSION_KEY] = api_version
if not hasattr(self, 'tags') or self.tags is None:
self.tags = {}
self.tags[CONNECTION_API_VERSION_KEY] = api_version

@classmethod
def _get_required_metadata_fields(cls) -> List[str]:
Expand All @@ -160,7 +164,7 @@ def api_version(self) -> Optional[str]:
"""The API version of the workspace connection.

:return: The API version of the workspace connection.
:rtype: str
:rtype: Optional[str]
"""
if self.tags is not None and CONNECTION_API_VERSION_KEY in self.tags:
res: str = self.tags[CONNECTION_API_VERSION_KEY]
Expand All @@ -174,8 +178,9 @@ def api_version(self, value: str) -> None:
:param value: The new api version to set.
:type value: str
"""
if self.tags is not None:
self.tags[CONNECTION_API_VERSION_KEY] = value
if not hasattr(self, 'tags') or self.tags is None:
self.tags = {}
self.tags[CONNECTION_API_VERSION_KEY] = value


@experimental
Expand Down Expand Up @@ -209,9 +214,10 @@ def __init__(
kwargs.pop("type", None) # make sure we never somehow use wrong type
super().__init__(target=target, type=camel_to_snake(ConnectionCategory.COGNITIVE_SERVICE), credentials=credentials, from_child=True, **kwargs)

if self.tags is not None:
self.tags[CONNECTION_API_VERSION_KEY] = api_version
self.tags[CONNECTION_KIND_KEY] = kind
if not hasattr(self, 'tags') or self.tags is None:
self.tags = {}
self.tags[CONNECTION_API_VERSION_KEY] = api_version
self.tags[CONNECTION_KIND_KEY] = kind

@classmethod
def _get_required_metadata_fields(cls) -> List[str]:
Expand All @@ -226,7 +232,7 @@ def api_version(self) -> Optional[str]:
"""The API version of the workspace connection.

:return: The API version of the workspace connection.
:rtype: str
:rtype: Optional[str]
"""
if self.tags is not None and CONNECTION_API_VERSION_KEY in self.tags:
res: str = self.tags[CONNECTION_API_VERSION_KEY]
Expand All @@ -240,15 +246,16 @@ def api_version(self, value: str) -> None:
:param value: The new api version to set.
:type value: str
"""
if self.tags is not None:
self.tags[CONNECTION_API_VERSION_KEY] = value
if not hasattr(self, 'tags') or self.tags is None:
self.tags = {}
self.tags[CONNECTION_API_VERSION_KEY] = value

@property
def kind(self) -> Optional[str]:
"""The kind of the workspace connection.

:return: The kind of the workspace connection.
:rtype: str
:rtype: Optional[str]
"""
if self.tags is not None and CONNECTION_KIND_KEY in self.tags:
res: str = self.tags[CONNECTION_KIND_KEY]
Expand All @@ -262,6 +269,8 @@ def kind(self, value: str) -> None:
:param value: The new kind to set.
:type value: str
"""
if self.tags is None:
self.tags = {}
self.tags[CONNECTION_KIND_KEY] = value


Expand Down Expand Up @@ -299,6 +308,8 @@ def __init__(
target=target, type=camel_to_snake(ConnectionCategory.AZURE_BLOB), credentials=kwargs.pop("credentials", None), from_child=True, **kwargs
)

if not hasattr(self, 'tags') or self.tags is None:
self.tags = {}
self.tags[CONNECTION_CONTAINER_NAME_KEY] = container_name
self.tags[CONNECTION_ACCOUNT_NAME_KEY] = account_name

Expand All @@ -319,7 +330,18 @@ def container_name(self) -> str:
"""
if self.tags is not None and CONNECTION_CONTAINER_NAME_KEY in self.tags:
return self.tags[CONNECTION_CONTAINER_NAME_KEY]
return None
return ""

@container_name.setter
def container_name(self, value: str) -> None:
"""Set the container name of the workspace connection.

:param value: The new container name to set.
:type value: str
"""
if self.tags is None:
self.tags = {}
self.tags[CONNECTION_CONTAINER_NAME_KEY] = value

@property
def account_name(self) -> str:
Expand All @@ -330,4 +352,15 @@ def account_name(self) -> str:
"""
if self.tags is not None and CONNECTION_ACCOUNT_NAME_KEY in self.tags:
return self.tags[CONNECTION_ACCOUNT_NAME_KEY]
return None
return ""

@account_name.setter
def account_name(self, value: str) -> None:
"""Set the account name of the workspace connection.

:param value: The new account name to set.
:type value: str
"""
if self.tags is None:
self.tags = {}
self.tags[CONNECTION_ACCOUNT_NAME_KEY] = value