Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

making workspace connections prop ga (#36781) #36849

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion sdk/ml/azure-ai-ml/azure/ai/ml/_ml_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,6 @@ def feature_store_entities(self) -> FeatureStoreEntityOperations:
return self._featurestoreentities

@property
@experimental
def connections(self) -> WorkspaceConnectionsOperations:
"""A collection of connection related operations.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,7 @@ def _to_dict(self) -> Dict:
return res

@classmethod
def _from_rest_object(cls, rest_obj: RestWorkspaceConnection) -> Optional["WorkspaceConnection"]:
if not rest_obj:
return None

def _from_rest_object(cls, rest_obj: RestWorkspaceConnection) -> "WorkspaceConnection":
conn_class = cls._get_entity_class_from_rest_obj(rest_obj)

popped_metadata = conn_class._get_required_metadata_fields()
Expand Down Expand Up @@ -456,7 +453,7 @@ def _from_rest_object(cls, rest_obj: RestWorkspaceConnection) -> Optional["Works
# No default in pop, this should fail if we somehow don't get a resource ID
rest_kwargs["ai_services_resource_id"] = rest_kwargs.pop(camel_to_snake(CONNECTION_RESOURCE_ID_KEY))
connection = conn_class(**rest_kwargs)
return cast(Optional["WorkspaceConnection"], connection)
return cast(WorkspaceConnection, connection)

def _validate(self) -> str:
return str(self.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from azure.ai.ml._utils.utils import _snake_to_camel
from azure.ai.ml.entities._workspace.connections.workspace_connection import WorkspaceConnection
from azure.core.credentials import TokenCredential
from azure.core.tracing.decorator import distributed_trace
from azure.ai.ml.entities._credentials import (
ApiKeyConfiguration,
)
Expand Down Expand Up @@ -70,6 +71,7 @@ def _try_fill_api_key(self, connection: WorkspaceConnection) -> None:
if list_secrets_response.properties.credentials is not None:
connection.credentials.key = list_secrets_response.properties.credentials.key

@distributed_trace
@monitor_with_activity(ops_logger, "WorkspaceConnections.Get", ActivityType.PUBLICAPI)
def get(self, name: str, *, populate_secrets: bool = False, **kwargs: Dict) -> WorkspaceConnection:
"""Get a connection by name.
Expand Down Expand Up @@ -98,10 +100,11 @@ def get(self, name: str, *, populate_secrets: bool = False, **kwargs: Dict) -> W
self._try_fill_api_key(connection)
return connection # type: ignore[return-value]

@distributed_trace
@monitor_with_activity(ops_logger, "WorkspaceConnections.CreateOrUpdate", ActivityType.PUBLICAPI)
def create_or_update(
self, workspace_connection: WorkspaceConnection, *, populate_secrets: bool = False, **kwargs: Any
) -> Optional[WorkspaceConnection]:
) -> WorkspaceConnection:
"""Create or update a connection.

:param workspace_connection: Definition of a Workspace Connection or one of its subclasses
Expand All @@ -126,8 +129,9 @@ def create_or_update(
self._try_fill_api_key(conn)
return conn

@distributed_trace
@monitor_with_activity(ops_logger, "WorkspaceConnections.Delete", ActivityType.PUBLICAPI)
def delete(self, name: str) -> None:
def delete(self, name: str, **kwargs: Any) -> None:
"""Delete the connection.

:param name: Name of the connection.
Expand All @@ -138,8 +142,10 @@ def delete(self, name: str) -> None:
connection_name=name,
workspace_name=self._workspace_name,
**self._scope_kwargs,
**kwargs,
)

@distributed_trace
@monitor_with_activity(ops_logger, "WorkspaceConnections.List", ActivityType.PUBLICAPI)
def list(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def feature_set_validation(fset: FeatureSet):
# ---------------------------------------------------------------------------------------------------------------#
# NOTE Please enable materialization store on test featurestore 'sdk_vnext_cli_fs' to run this test in live mode.
# ---------------------------------------------------------------------------------------------------------------#
@pytest.mark.skip(reason="request header size being too large.")
def test_list_materialization_jobs(
self, feature_store_client: MLClient, tmp_path: Path, randstr: Callable[[], str]
) -> None:
Expand Down