Skip to content

Commit 36ce8e8

Browse files
authored
More may apiview fixes (#35541)
* experimental project and renaming conn operations * analysis
1 parent 19bac3b commit 36ce8e8

File tree

7 files changed

+23
-21
lines changed

7 files changed

+23
-21
lines changed

sdk/ml/azure-ai-ml/azure/ai/ml/_ml_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
BatchEndpointOperations,
7979
ComponentOperations,
8080
ComputeOperations,
81-
ConnectionsOperations,
81+
WorkspaceConnectionsOperations,
8282
DataOperations,
8383
DatastoreOperations,
8484
EnvironmentOperations,
@@ -493,7 +493,7 @@ def __init__(
493493
)
494494
self._operation_container.add(AzureMLResourceType.REGISTRY, self._registries) # type: ignore[arg-type]
495495

496-
self._connections = ConnectionsOperations(
496+
self._connections = WorkspaceConnectionsOperations(
497497
self._operation_scope,
498498
self._operation_config,
499499
self._service_client_04_2024_preview,
@@ -934,11 +934,11 @@ def feature_store_entities(self) -> FeatureStoreEntityOperations:
934934

935935
@property
936936
@experimental
937-
def connections(self) -> ConnectionsOperations:
937+
def connections(self) -> WorkspaceConnectionsOperations:
938938
"""A collection of connection related operations.
939939
940940
:return: Connections operations
941-
:rtype: ~azure.ai.ml.operations.ConnectionsOperations
941+
:rtype: ~azure.ai.ml.operations.WorkspaceConnectionsOperations
942942
"""
943943
return self._connections
944944

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/_ai_workspaces/project.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55

66
from typing import Any, Dict, Optional
77

8+
from azure.ai.ml._utils._experimental import experimental
89
from azure.ai.ml._schema.workspace import ProjectSchema
910
from azure.ai.ml.constants._common import WorkspaceKind
1011
from azure.ai.ml.entities import Workspace
1112

1213

1314
# Effectively a lightweight wrapper around a v2 SDK workspace
15+
@experimental
1416
class Project(Workspace):
1517
"""A Project is a lightweight object for orchestrating AI applications, and is parented by a hub.
1618
Unlike a standard workspace, a project does not have a variety of sub-resources directly associated with it.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from ._online_endpoint_operations import OnlineEndpointOperations
2828
from ._registry_operations import RegistryOperations
2929
from ._schedule_operations import ScheduleOperations
30-
from ._connections_operations import ConnectionsOperations
30+
from ._workspace_connections_operations import WorkspaceConnectionsOperations
3131
from ._workspace_operations import WorkspaceOperations
3232
from ._workspace_outbound_rule_operations import WorkspaceOutboundRuleOperations
3333
from ._evaluator_operations import EvaluatorOperations
@@ -49,7 +49,7 @@
4949
"DataOperations",
5050
"EnvironmentOperations",
5151
"ComponentOperations",
52-
"ConnectionsOperations",
52+
"WorkspaceConnectionsOperations",
5353
"RegistryOperations",
5454
"ScheduleOperations",
5555
"WorkspaceOutboundRuleOperations",

sdk/ml/azure-ai-ml/azure/ai/ml/operations/_azure_openai_deployment_operations.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from azure.ai.ml._scope_dependent_operations import OperationConfig, OperationScope, _ScopeDependentOperations
1212
from azure.ai.ml.entities._autogen_entities.models import AzureOpenAIDeployment
1313

14-
from ._connections_operations import ConnectionsOperations
14+
from ._workspace_connections_operations import WorkspaceConnectionsOperations
1515

1616
module_logger = logging.getLogger(__name__)
1717

@@ -29,11 +29,11 @@ def __init__(
2929
operation_scope: OperationScope,
3030
operation_config: OperationConfig,
3131
service_client: ServiceClient2020404Preview,
32-
connections_operations: ConnectionsOperations,
32+
connections_operations: WorkspaceConnectionsOperations,
3333
):
3434
super().__init__(operation_scope, operation_config)
3535
self._service_client = service_client.connection
36-
self._connections_operations = connections_operations
36+
self._workspace_connections_operations = connections_operations
3737

3838
def list(self, connection_name: str, **kwargs) -> Iterable[AzureOpenAIDeployment]:
3939
"""List Azure OpenAI deployments of the workspace.
@@ -43,7 +43,7 @@ def list(self, connection_name: str, **kwargs) -> Iterable[AzureOpenAIDeployment
4343
:return: A list of Azure OpenAI deployments
4444
:rtype: ~typing.Iterable[~azure.ai.ml.entities.AzureOpenAIDeployment]
4545
"""
46-
connection = self._connections_operations.get(connection_name)
46+
connection = self._workspace_connections_operations.get(connection_name)
4747

4848
def _from_rest_add_connection_name(obj):
4949
from_rest_deployment = AzureOpenAIDeployment._from_rest_object(obj)

sdk/ml/azure-ai-ml/azure/ai/ml/operations/_connections_operations.py renamed to sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_connections_operations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
module_logger = ops_logger.module_logger
2727

2828

29-
class ConnectionsOperations(_ScopeDependentOperations):
30-
"""ConnectionsOperations.
29+
class WorkspaceConnectionsOperations(_ScopeDependentOperations):
30+
"""WorkspaceConnectionsOperations.
3131
3232
You should not instantiate this class directly. Instead, you should create
3333
an MLClient instance that instantiates it for you and attaches it as an attribute.
@@ -42,7 +42,7 @@ def __init__(
4242
credentials: Optional[TokenCredential] = None,
4343
**kwargs: Dict,
4444
):
45-
super(ConnectionsOperations, self).__init__(operation_scope, operation_config)
45+
super(WorkspaceConnectionsOperations, self).__init__(operation_scope, operation_config)
4646
ops_logger.update_info(kwargs)
4747
self._all_operations = all_operations
4848
self._operation = service_client.workspace_connections

sdk/ml/azure-ai-ml/tests/connection/unittests/test_connection_operations.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from azure.ai.ml._scope_dependent_operations import OperationConfig, OperationScope
99
from azure.ai.ml._utils.utils import camel_to_snake
1010
from azure.ai.ml.entities import PatTokenConfiguration, Connection
11-
from azure.ai.ml.operations import ConnectionsOperations
11+
from azure.ai.ml.operations import WorkspaceConnectionsOperations
1212

1313

1414
@pytest.fixture
@@ -23,8 +23,8 @@ def mock_workspace_connection_operation(
2323
mock_aml_services_2022_01_01_preview: Mock,
2424
mock_machinelearning_client: Mock,
2525
mock_credential: Mock,
26-
) -> ConnectionsOperations:
27-
yield ConnectionsOperations(
26+
) -> WorkspaceConnectionsOperations:
27+
yield WorkspaceConnectionsOperations(
2828
operation_scope=mock_workspace_scope,
2929
operation_config=mock_operation_config,
3030
service_client=mock_aml_services_2022_01_01_preview,
@@ -39,15 +39,15 @@ class TestWorkspaceConnectionsOperation:
3939
@pytest.mark.parametrize(
4040
"arg", [ConnectionCategory.GIT, ConnectionCategory.PYTHON_FEED, ConnectionCategory.CONTAINER_REGISTRY]
4141
)
42-
def test_list(self, arg: str, mock_workspace_connection_operation: ConnectionsOperations) -> None:
42+
def test_list(self, arg: str, mock_workspace_connection_operation: WorkspaceConnectionsOperations) -> None:
4343
mock_workspace_connection_operation.list(connection_type=arg)
4444
mock_workspace_connection_operation._operation.list.assert_called_once()
4545

4646
@patch.object(Connection, "_from_rest_object")
4747
def test_get(
4848
self,
4949
mock_from_rest,
50-
mock_workspace_connection_operation: ConnectionsOperations,
50+
mock_workspace_connection_operation: WorkspaceConnectionsOperations,
5151
) -> None:
5252
mock_from_rest.return_value = Connection(
5353
target="dummy_target",
@@ -62,7 +62,7 @@ def test_get(
6262
def test_create_or_update(
6363
self,
6464
mock_from_rest,
65-
mock_workspace_connection_operation: ConnectionsOperations,
65+
mock_workspace_connection_operation: WorkspaceConnectionsOperations,
6666
):
6767
mock_from_rest.return_value = Connection(
6868
target="dummy_target",
@@ -77,7 +77,7 @@ def test_create_or_update(
7777

7878
def test_delete(
7979
self,
80-
mock_workspace_connection_operation: ConnectionsOperations,
80+
mock_workspace_connection_operation: WorkspaceConnectionsOperations,
8181
) -> None:
8282
mock_workspace_connection_operation.delete("randstr")
8383
mock_workspace_connection_operation._operation.delete.assert_called_once()

sdk/ml/azure-ai-ml/tests/feature_store/unittests/test_feature_store_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def test_update_with_role_assignments(
278278
return_value=None,
279279
)
280280
mocker.patch(
281-
"azure.ai.ml.operations._connections_operations.ConnectionsOperations.get",
281+
"azure.ai.ml.operations._workspace_connections_operations.WorkspaceConnectionsOperations.get",
282282
return_value=None,
283283
)
284284

0 commit comments

Comments
 (0)