diff --git a/src/zenml/client.py b/src/zenml/client.py index 995f2d8bdb..1341cc3c76 100644 --- a/src/zenml/client.py +++ b/src/zenml/client.py @@ -1702,6 +1702,7 @@ def list_services( updated: Optional[datetime] = None, type: Optional[str] = None, flavor: Optional[str] = None, + user: Optional[Union[UUID, str]] = None, workspace_id: Optional[Union[str, UUID]] = None, user_id: Optional[Union[str, UUID]] = None, hydrate: bool = False, @@ -1727,6 +1728,7 @@ def list_services( flavor: Use the service flavor for filtering workspace_id: The id of the workspace to filter by. user_id: The id of the user to filter by. + user: Filter by user name/ID. hydrate: Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. running: Use the running status for filtering @@ -1753,6 +1755,7 @@ def list_services( flavor=flavor, workspace_id=workspace_id, user_id=user_id, + user=user, running=running, name=service_name, pipeline_name=pipeline_name, @@ -2249,6 +2252,7 @@ def list_flavors( type: Optional[str] = None, integration: Optional[str] = None, user_id: Optional[Union[str, UUID]] = None, + user: Optional[Union[UUID, str]] = None, hydrate: bool = False, ) -> Page[FlavorResponse]: """Fetches all the flavor models. @@ -2262,6 +2266,7 @@ def list_flavors( created: Use to flavors by time of creation updated: Use the last updated date for filtering user_id: The id of the user to filter by. + user: Filter by user name/ID. name: The name of the flavor to filter by. type: The type of the flavor to filter by. integration: The integration of the flavor to filter by. @@ -2277,6 +2282,7 @@ def list_flavors( sort_by=sort_by, logical_operator=logical_operator, user_id=user_id, + user=user, name=name, type=type, integration=integration, @@ -2661,6 +2667,7 @@ def list_builds( updated: Optional[Union[datetime, str]] = None, workspace_id: Optional[Union[str, UUID]] = None, user_id: Optional[Union[str, UUID]] = None, + user: Optional[Union[UUID, str]] = None, pipeline_id: Optional[Union[str, UUID]] = None, stack_id: Optional[Union[str, UUID]] = None, is_local: Optional[bool] = None, @@ -2682,6 +2689,7 @@ def list_builds( updated: Use the last updated date for filtering workspace_id: The id of the workspace to filter by. user_id: The id of the user to filter by. + user: Filter by user name/ID. pipeline_id: The id of the pipeline to filter by. stack_id: The id of the stack to filter by. is_local: Use to filter local builds. @@ -2705,6 +2713,7 @@ def list_builds( updated=updated, workspace_id=workspace_id, user_id=user_id, + user=user, pipeline_id=pipeline_id, stack_id=stack_id, is_local=is_local, @@ -2771,7 +2780,7 @@ def get_event_source( allow_name_prefix_match: bool = True, hydrate: bool = True, ) -> EventSourceResponse: - """Get a event source by name, ID or prefix. + """Get an event source by name, ID or prefix. Args: name_id_or_prefix: The name, ID or prefix of the stack. @@ -2804,6 +2813,7 @@ def list_event_sources( event_source_type: Optional[str] = None, workspace_id: Optional[Union[str, UUID]] = None, user_id: Optional[Union[str, UUID]] = None, + user: Optional[Union[UUID, str]] = None, hydrate: bool = False, ) -> Page[EventSourceResponse]: """Lists all event_sources. @@ -2818,6 +2828,7 @@ def list_event_sources( updated: Use the last updated date for filtering workspace_id: The id of the workspace to filter by. user_id: The id of the user to filter by. + user: Filter by user name/ID. name: The name of the event_source to filter by. flavor: The flavor of the event_source to filter by. event_source_type: The subtype of the event_source to filter by. @@ -2834,6 +2845,7 @@ def list_event_sources( logical_operator=logical_operator, workspace_id=workspace_id, user_id=user_id, + user=user, name=name, flavor=flavor, plugin_subtype=event_source_type, @@ -3001,6 +3013,7 @@ def list_actions( action_type: Optional[str] = None, workspace_id: Optional[Union[str, UUID]] = None, user_id: Optional[Union[str, UUID]] = None, + user: Optional[Union[UUID, str]] = None, hydrate: bool = False, ) -> Page[ActionResponse]: """List actions. @@ -3015,6 +3028,7 @@ def list_actions( updated: Use the last updated date for filtering workspace_id: The id of the workspace to filter by. user_id: The id of the user to filter by. + user: Filter by user name/ID. name: The name of the action to filter by. flavor: The flavor of the action to filter by. action_type: The type of the action to filter by. @@ -3031,6 +3045,7 @@ def list_actions( logical_operator=logical_operator, workspace_id=workspace_id, user_id=user_id, + user=user, name=name, id=id, flavor=flavor, @@ -3179,6 +3194,7 @@ def list_triggers( action_subtype: Optional[str] = None, workspace_id: Optional[Union[str, UUID]] = None, user_id: Optional[Union[str, UUID]] = None, + user: Optional[Union[UUID, str]] = None, hydrate: bool = False, ) -> Page[TriggerResponse]: """Lists all triggers. @@ -3193,6 +3209,7 @@ def list_triggers( updated: Use the last updated date for filtering workspace_id: The id of the workspace to filter by. user_id: The id of the user to filter by. + user: Filter by user name/ID. name: The name of the trigger to filter by. event_source_id: The event source associated with the trigger. action_id: The action associated with the trigger. @@ -3215,6 +3232,7 @@ def list_triggers( logical_operator=logical_operator, workspace_id=workspace_id, user_id=user_id, + user=user, name=name, event_source_id=event_source_id, action_id=action_id, @@ -3365,6 +3383,7 @@ def list_deployments( updated: Optional[Union[datetime, str]] = None, workspace_id: Optional[Union[str, UUID]] = None, user_id: Optional[Union[str, UUID]] = None, + user: Optional[Union[UUID, str]] = None, pipeline_id: Optional[Union[str, UUID]] = None, stack_id: Optional[Union[str, UUID]] = None, build_id: Optional[Union[str, UUID]] = None, @@ -3383,6 +3402,7 @@ def list_deployments( updated: Use the last updated date for filtering workspace_id: The id of the workspace to filter by. user_id: The id of the user to filter by. + user: Filter by user name/ID. pipeline_id: The id of the pipeline to filter by. stack_id: The id of the stack to filter by. build_id: The id of the build to filter by. @@ -3403,6 +3423,7 @@ def list_deployments( updated=updated, workspace_id=workspace_id, user_id=user_id, + user=user, pipeline_id=pipeline_id, stack_id=stack_id, build_id=build_id, @@ -3650,6 +3671,7 @@ def list_schedules( name: Optional[str] = None, workspace_id: Optional[Union[str, UUID]] = None, user_id: Optional[Union[str, UUID]] = None, + user: Optional[Union[UUID, str]] = None, pipeline_id: Optional[Union[str, UUID]] = None, orchestrator_id: Optional[Union[str, UUID]] = None, active: Optional[Union[str, bool]] = None, @@ -3674,6 +3696,7 @@ def list_schedules( name: The name of the stack to filter by. workspace_id: The id of the workspace to filter by. user_id: The id of the user to filter by. + user: Filter by user name/ID. pipeline_id: The id of the pipeline to filter by. orchestrator_id: The id of the orchestrator to filter by. active: Use to filter by active status. @@ -3700,6 +3723,7 @@ def list_schedules( name=name, workspace_id=workspace_id, user_id=user_id, + user=user, pipeline_id=pipeline_id, orchestrator_id=orchestrator_id, active=active, @@ -3940,6 +3964,7 @@ def list_run_steps( original_step_run_id: Optional[Union[str, UUID]] = None, workspace_id: Optional[Union[str, UUID]] = None, user_id: Optional[Union[str, UUID]] = None, + user: Optional[Union[UUID, str]] = None, model_version_id: Optional[Union[str, UUID]] = None, model: Optional[Union[UUID, str]] = None, hydrate: bool = False, @@ -3958,6 +3983,7 @@ def list_run_steps( end_time: Use to filter by the time when the step finished running workspace_id: The id of the workspace to filter by. user_id: The id of the user to filter by. + user: Filter by user name/ID. pipeline_run_id: The id of the pipeline run to filter by. deployment_id: The id of the deployment to filter by. original_step_run_id: The id of the original step run to filter by. @@ -3992,6 +4018,7 @@ def list_run_steps( name=name, workspace_id=workspace_id, user_id=user_id, + user=user, model_version_id=model_version_id, model=model, ) @@ -4664,6 +4691,7 @@ def list_secrets( scope: Optional[SecretScope] = None, workspace_id: Optional[Union[str, UUID]] = None, user_id: Optional[Union[str, UUID]] = None, + user: Optional[Union[UUID, str]] = None, hydrate: bool = False, ) -> Page[SecretResponse]: """Fetches all the secret models. @@ -4683,6 +4711,7 @@ def list_secrets( scope: The scope of the secret to filter by. workspace_id: The id of the workspace to filter by. user_id: The id of the user to filter by. + user: Filter by user name/ID. hydrate: Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. @@ -4699,6 +4728,7 @@ def list_secrets( sort_by=sort_by, logical_operator=logical_operator, user_id=user_id, + user=user, workspace_id=workspace_id, name=name, scope=scope, @@ -5013,6 +5043,7 @@ def list_code_repositories( name: Optional[str] = None, workspace_id: Optional[Union[str, UUID]] = None, user_id: Optional[Union[str, UUID]] = None, + user: Optional[Union[UUID, str]] = None, hydrate: bool = False, ) -> Page[CodeRepositoryResponse]: """List all code repositories. @@ -5028,6 +5059,7 @@ def list_code_repositories( name: The name of the code repository to filter by. workspace_id: The id of the workspace to filter by. user_id: The id of the user to filter by. + user: Filter by user name/ID. hydrate: Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. @@ -5045,6 +5077,7 @@ def list_code_repositories( name=name, workspace_id=workspace_id, user_id=user_id, + user=user, ) filter_model.set_scope_workspace(self.active_workspace.id) return self.zen_store.list_code_repositories( @@ -5405,6 +5438,7 @@ def list_service_connectors( resource_id: Optional[str] = None, workspace_id: Optional[Union[str, UUID]] = None, user_id: Optional[Union[str, UUID]] = None, + user: Optional[Union[UUID, str]] = None, labels: Optional[Dict[str, Optional[str]]] = None, secret_id: Optional[Union[str, UUID]] = None, hydrate: bool = False, @@ -5427,6 +5461,7 @@ def list_service_connectors( they can give access to. workspace_id: The id of the workspace to filter by. user_id: The id of the user to filter by. + user: Filter by user name/ID. name: The name of the service connector to filter by. labels: The labels of the service connector to filter by. secret_id: Filter by the id of the secret that is referenced by the @@ -5444,6 +5479,7 @@ def list_service_connectors( logical_operator=logical_operator, workspace_id=workspace_id or self.active_workspace.id, user_id=user_id, + user=user, name=name, connector_type=connector_type, auth_method=auth_method, @@ -6596,6 +6632,7 @@ def list_authorized_devices( client_id: Union[UUID, str, None] = None, status: Union[OAuthDeviceStatus, str, None] = None, trusted_device: Union[bool, str, None] = None, + user: Optional[Union[UUID, str]] = None, failed_auth_attempts: Union[int, str, None] = None, last_login: Optional[Union[datetime, str, None]] = None, hydrate: bool = False, @@ -6613,6 +6650,7 @@ def list_authorized_devices( expires: Use the expiration date for filtering. client_id: Use the client id for filtering. status: Use the status for filtering. + user: Filter by user name/ID. trusted_device: Use the trusted device flag for filtering. failed_auth_attempts: Use the failed auth attempts for filtering. last_login: Use the last login date for filtering. @@ -6632,6 +6670,7 @@ def list_authorized_devices( updated=updated, expires=expires, client_id=client_id, + user=user, status=status, trusted_device=trusted_device, failed_auth_attempts=failed_auth_attempts, @@ -6730,7 +6769,7 @@ def get_trigger_execution( trigger_execution_id: UUID, hydrate: bool = True, ) -> TriggerExecutionResponse: - """Get an trigger execution by ID. + """Get a trigger execution by ID. Args: trigger_execution_id: The ID of the trigger execution to get. @@ -6751,6 +6790,7 @@ def list_trigger_executions( size: int = PAGE_SIZE_DEFAULT, logical_operator: LogicalOperators = LogicalOperators.AND, trigger_id: Optional[UUID] = None, + user: Optional[Union[UUID, str]] = None, hydrate: bool = False, ) -> Page[TriggerExecutionResponse]: """List all trigger executions matching the given filter criteria. @@ -6761,6 +6801,7 @@ def list_trigger_executions( size: The maximum size of all pages. logical_operator: Which logical operator to use [and, or]. trigger_id: ID of the trigger to filter by. + user: Filter by user name/ID. hydrate: Flag deciding whether to hydrate the output model(s) by including metadata fields in the response. @@ -6772,6 +6813,7 @@ def list_trigger_executions( sort_by=sort_by, page=page, size=size, + user=user, logical_operator=logical_operator, ) filter_model.set_scope_workspace(self.active_workspace.id) diff --git a/src/zenml/models/v2/base/scoped.py b/src/zenml/models/v2/base/scoped.py index 75e3934b53..19d3cf7b08 100644 --- a/src/zenml/models/v2/base/scoped.py +++ b/src/zenml/models/v2/base/scoped.py @@ -335,6 +335,7 @@ class WorkspaceScopedFilter(UserScopedFilter): CLI_EXCLUDE_FIELDS: ClassVar[List[str]] = [ *UserScopedFilter.CLI_EXCLUDE_FIELDS, "workspace_id", + "workspace", "scope_workspace", ] CUSTOM_SORTING_OPTIONS: ClassVar[List[str]] = [