Skip to content

Commit 0ee3610

Browse files
authored
revert connection name (#35578)
* revert connection name * rename files and schema class * fake * undo fake * rename create field * run black
1 parent 17daed1 commit 0ee3610

File tree

17 files changed

+178
-154
lines changed

17 files changed

+178
-154
lines changed

sdk/ml/azure-ai-ml/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
### Breaking Changes
3535

36-
- WorkspaceConnection and subclasses renamed to just Connection
3736
- Removed WorkspaceHubConfig entity, and renamed WorkspaceHub to Hub.
3837
- workspace_hub input of Workspace class hidden, renamed to hub_id, and re-surfaced in child class Project.
3938
- Removed Workspace Hub Operations from ML Client.

sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/connections/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
66

7-
from .connection import ConnectionSchema
7+
from .workspace_connection import WorkspaceConnectionSchema
88
from .connection_subtypes import (
99
AzureBlobStoreConnectionSchema,
1010
MicrosoftOneLakeConnectionSchema,
@@ -21,7 +21,7 @@
2121
)
2222

2323
__all__ = [
24-
"ConnectionSchema",
24+
"WorkspaceConnectionSchema",
2525
"AzureBlobStoreConnectionSchema",
2626
"MicrosoftOneLakeConnectionSchema",
2727
"AzureOpenAIConnectionSchema",

sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/connections/connection_subtypes.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
AadCredentialConfigurationSchema,
2121
)
2222
from azure.ai.ml.entities import AadCredentialConfiguration
23-
from .connection import ConnectionSchema
23+
from .workspace_connection import WorkspaceConnectionSchema
2424

2525

2626
# pylint: disable-next=name-too-long
27-
class AzureBlobStoreConnectionSchema(ConnectionSchema):
27+
class AzureBlobStoreConnectionSchema(WorkspaceConnectionSchema):
2828
# type and credentials limited
2929
type = StringTransformedEnum(
3030
allowed_values=ConnectionCategory.AZURE_BLOB, casing_transform=camel_to_snake, required=True
@@ -52,7 +52,7 @@ def make(self, data, **kwargs):
5252

5353

5454
# pylint: disable-next=name-too-long
55-
class MicrosoftOneLakeConnectionSchema(ConnectionSchema):
55+
class MicrosoftOneLakeConnectionSchema(WorkspaceConnectionSchema):
5656
type = StringTransformedEnum(
5757
allowed_values=ConnectionCategory.AZURE_ONE_LAKE, casing_transform=camel_to_snake, required=True
5858
)
@@ -93,7 +93,7 @@ def make(self, data, **kwargs):
9393

9494

9595
# pylint: disable-next=name-too-long
96-
class AzureOpenAIConnectionSchema(ConnectionSchema):
96+
class AzureOpenAIConnectionSchema(WorkspaceConnectionSchema):
9797
# type and credentials limited
9898
type = StringTransformedEnum(
9999
allowed_values=ConnectionCategory.AZURE_OPEN_AI, casing_transform=camel_to_snake, required=True
@@ -112,7 +112,7 @@ def make(self, data, **kwargs):
112112

113113

114114
# pylint: disable-next=name-too-long
115-
class AzureAIServicesConnectionSchema(ConnectionSchema):
115+
class AzureAIServicesConnectionSchema(WorkspaceConnectionSchema):
116116
# type and credentials limited
117117
type = StringTransformedEnum(
118118
allowed_values=ConnectionTypes.AZURE_AI_SERVICES, casing_transform=camel_to_snake, required=True
@@ -129,7 +129,7 @@ def make(self, data, **kwargs):
129129

130130

131131
# pylint: disable-next=name-too-long
132-
class AzureAISearchConnectionSchema(ConnectionSchema):
132+
class AzureAISearchConnectionSchema(WorkspaceConnectionSchema):
133133
# type and credentials limited
134134
type = StringTransformedEnum(
135135
allowed_values=ConnectionTypes.AZURE_SEARCH, casing_transform=camel_to_snake, required=True
@@ -145,7 +145,7 @@ def make(self, data, **kwargs):
145145

146146

147147
# pylint: disable-next=name-too-long
148-
class AzureContentSafetyConnectionSchema(ConnectionSchema):
148+
class AzureContentSafetyConnectionSchema(WorkspaceConnectionSchema):
149149
# type and credentials limited
150150
type = StringTransformedEnum(
151151
allowed_values=ConnectionTypes.AZURE_CONTENT_SAFETY, casing_transform=camel_to_snake, required=True
@@ -161,7 +161,7 @@ def make(self, data, **kwargs):
161161

162162

163163
# pylint: disable-next=name-too-long
164-
class AzureSpeechServicesConnectionSchema(ConnectionSchema):
164+
class AzureSpeechServicesConnectionSchema(WorkspaceConnectionSchema):
165165
# type and credentials limited
166166
type = StringTransformedEnum(
167167
allowed_values=ConnectionTypes.AZURE_SPEECH_SERVICES, casing_transform=camel_to_snake, required=True
@@ -176,7 +176,7 @@ def make(self, data, **kwargs):
176176
return AzureSpeechServicesConnection(**data)
177177

178178

179-
class APIKeyConnectionSchema(ConnectionSchema):
179+
class APIKeyConnectionSchema(WorkspaceConnectionSchema):
180180
# type and credentials limited
181181
type = StringTransformedEnum(
182182
allowed_values=ConnectionCategory.API_KEY, casing_transform=camel_to_snake, required=True
@@ -192,7 +192,7 @@ def make(self, data, **kwargs):
192192

193193

194194
# pylint: disable-next=name-too-long
195-
class OpenAIConnectionSchema(ConnectionSchema):
195+
class OpenAIConnectionSchema(WorkspaceConnectionSchema):
196196
# type and credentials limited
197197
type = StringTransformedEnum(
198198
allowed_values=ConnectionCategory.OPEN_AI, casing_transform=camel_to_snake, required=True
@@ -207,7 +207,7 @@ def make(self, data, **kwargs):
207207

208208

209209
# pylint: disable-next=name-too-long
210-
class SerpConnectionSchema(ConnectionSchema):
210+
class SerpConnectionSchema(WorkspaceConnectionSchema):
211211
# type and credentials limited
212212
type = StringTransformedEnum(allowed_values=ConnectionCategory.SERP, casing_transform=camel_to_snake, required=True)
213213
api_key = fields.Str(required=True)
@@ -220,7 +220,7 @@ def make(self, data, **kwargs):
220220

221221

222222
# pylint: disable-next=name-too-long
223-
class ServerlessConnectionSchema(ConnectionSchema):
223+
class ServerlessConnectionSchema(WorkspaceConnectionSchema):
224224
# type and credentials limited
225225
type = StringTransformedEnum(
226226
allowed_values=ConnectionCategory.SERVERLESS, casing_transform=camel_to_snake, required=True

sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/connections/connection.py renamed to sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/connections/workspace_connection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from azure.ai.ml.entities import NoneCredentialConfiguration, AadCredentialConfiguration
2828

2929

30-
class ConnectionSchema(ResourceSchema):
30+
class WorkspaceConnectionSchema(ResourceSchema):
3131
# Inherits name, id, tags, and description fields from ResourceSchema
3232
creation_context = NestedField(CreationContextSchema, dump_only=True)
3333
type = StringTransformedEnum(
@@ -73,7 +73,7 @@ class ConnectionSchema(ResourceSchema):
7373

7474
@post_load
7575
def make(self, data, **kwargs):
76-
from azure.ai.ml.entities import Connection
76+
from azure.ai.ml.entities import WorkspaceConnection
7777

7878
# Most non-subclassed connections default to a none credential if none
7979
# is provided. ALDS Gen 2 connections default to AAD with this code.
@@ -82,4 +82,4 @@ def make(self, data, **kwargs):
8282
and data.get("credentials", None) == NoneCredentialConfiguration()
8383
):
8484
data["credentials"] = AadCredentialConfiguration()
85-
return Connection(**data)
85+
return WorkspaceConnection(**data)

sdk/ml/azure-ai-ml/azure/ai/ml/entities/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
from ._system_data import SystemData
263263
from ._validation import ValidationResult
264264
from ._workspace.compute_runtime import ComputeRuntime
265-
from ._workspace.connections.connection import Connection
265+
from ._workspace.connections.workspace_connection import WorkspaceConnection
266266
from ._workspace.connections.connection_subtypes import (
267267
AzureBlobStoreConnection,
268268
MicrosoftOneLakeConnection,
@@ -359,7 +359,7 @@
359359
"ModelBatchDeploymentSettings",
360360
"Workspace",
361361
"WorkspaceKeys",
362-
"Connection",
362+
"WorkspaceConnection",
363363
"AzureBlobStoreConnection",
364364
"MicrosoftOneLakeConnection",
365365
"AzureOpenAIConnection",

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_indexes/model_config.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from dataclasses import dataclass
55
from typing import Any, Dict, Optional
66
from azure.ai.ml._utils.utils import camel_to_snake
7-
from azure.ai.ml.entities._workspace.connections.connection import Connection
7+
from azure.ai.ml.entities._workspace.connections.workspace_connection import WorkspaceConnection
88
from azure.ai.ml.entities._workspace.connections.connection_subtypes import (
99
AzureOpenAIConnection,
1010
AadCredentialConfiguration,
@@ -44,12 +44,15 @@ class ModelConfiguration:
4444

4545
@staticmethod
4646
def from_connection(
47-
connection: Connection, model_name: Optional[str] = None, deployment_name: Optional[str] = None, **model_kwargs
47+
connection: WorkspaceConnection,
48+
model_name: Optional[str] = None,
49+
deployment_name: Optional[str] = None,
50+
**model_kwargs
4851
) -> "ModelConfiguration":
4952
"""Create an model configuration from a Connection.
5053
51-
:param connection: The Connection object.
52-
:type connection: ~azure.ai.ml.entities.Connection
54+
:param connection: The WorkspaceConnection object.
55+
:type connection: ~azure.ai.ml.entities.WorkspaceConnection
5356
:param model_name: The name of the model.
5457
:type model_name: Optional[str]
5558
:param deployment_name: The name of the deployment.

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_load_functions.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
from azure.ai.ml.entities._resource import Resource
4545
from azure.ai.ml.entities._schedule.schedule import Schedule
4646
from azure.ai.ml.entities._validation import PathAwareSchemaValidatableMixin, ValidationResultBuilder
47-
from azure.ai.ml.entities._workspace.connections.connection import Connection
47+
from azure.ai.ml.entities._workspace.connections.workspace_connection import WorkspaceConnection
4848
from azure.ai.ml.entities._workspace.workspace import Workspace
4949
from azure.ai.ml.exceptions import ErrorCategory, ErrorTarget, ValidationErrorType, ValidationException
5050

@@ -810,7 +810,7 @@ def load_connection(
810810
relative_origin: Optional[str] = None,
811811
params_override: Optional[List[Dict]] = None,
812812
**kwargs: Any,
813-
) -> Connection:
813+
) -> WorkspaceConnection:
814814
"""Construct a connection object from yaml file.
815815
816816
:param source: The local yaml source of a connection object. Must be either a
@@ -832,7 +832,9 @@ def load_connection(
832832
:rtype: Connection
833833
834834
"""
835-
return cast(Connection, load_common(Connection, source, relative_origin, params_override, **kwargs))
835+
return cast(
836+
WorkspaceConnection, load_common(WorkspaceConnection, source, relative_origin, params_override, **kwargs)
837+
)
836838

837839

838840
# Unlike other aspects of connections, this wasn't made experimental, and thus couldn't just be replaced
@@ -842,7 +844,7 @@ def load_workspace_connection(
842844
*,
843845
relative_origin: Optional[str] = None,
844846
**kwargs: Any,
845-
) -> Connection:
847+
) -> WorkspaceConnection:
846848
"""Deprecated - use 'load_connection' instead. Construct a connection object from yaml file.
847849
848850
:param source: The local yaml source of a connection object. Must be either a

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_monitoring/signals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ class CustomMonitoringSignal(RestTranslatableMixin):
10161016
calculate the custom metrics.
10171017
:paramtype component_id: str
10181018
:keyword connection: Specify connection with environment variables and secret configs.
1019-
:paramtype connection: Optional[~azure.ai.ml.entities.Connection]
1019+
:paramtype connection: Optional[~azure.ai.ml.entities.WorkspaceConnection]
10201020
:keyword alert_enabled: Whether or not to enable alerts for the signal. Defaults to True.
10211021
:paramtype alert_enabled: bool
10221022
:keyword properties: A dictionary of custom properties for the signal.

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/connections/connection_subtypes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@
3939
ServerlessConnectionSchema,
4040
)
4141
from .one_lake_artifacts import OneLakeConnectionArtifact
42-
from .connection import Connection
42+
from .workspace_connection import WorkspaceConnection
4343

4444

4545
# Dev notes: Any new classes require modifying the elif chains in the following functions in the
4646
# WorkspaceConnection parent class: _from_rest_object, _get_entity_class_from_type, _get_schema_class_from_type
4747

4848

4949
@experimental
50-
class AzureBlobStoreConnection(Connection):
50+
class AzureBlobStoreConnection(WorkspaceConnection):
5151
"""A connection to an Azure Blob Store.
5252
5353
:param name: Name of the connection.
@@ -152,7 +152,7 @@ def account_name(self, value: str) -> None:
152152
# Due to this, we construct the target internally by composing more inputs
153153
# that are more user-accessible.
154154
@experimental
155-
class MicrosoftOneLakeConnection(Connection):
155+
class MicrosoftOneLakeConnection(WorkspaceConnection):
156156
"""A connection to a Microsoft One Lake. Connections of this type
157157
are further specified by their artifact class type, although
158158
the number of artifact classes is currently limited.
@@ -236,7 +236,7 @@ def _construct_target(cls, endpoint: str, workspace: str, artifact: OneLakeConne
236236

237237
# Not experimental since users should never see this,
238238
# No need to add an extra warning.
239-
class ApiOrAadConnection(Connection):
239+
class ApiOrAadConnection(WorkspaceConnection):
240240
"""Internal parent class for all connections that accept either an api key or
241241
entra ID as credentials. Entra ID credentials are implicitly assumed if no api key is provided.
242242

0 commit comments

Comments
 (0)