diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/__init__.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/__init__.py index f6acc11aa4e..6439dd20eb7 100644 --- a/src/healthcareapis/azext_healthcareapis/aaz/latest/__init__.py +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/__init__.py @@ -8,3 +8,4 @@ # pylint: skip-file # flake8: noqa +from ._clients import * diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/_clients.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/_clients.py new file mode 100644 index 00000000000..d6062877aac --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/_clients.py @@ -0,0 +1,46 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_client("AAZHealthdataaiservicesDeidservicesDataPlaneClient_healthcareapis") +class AAZHealthdataaiservicesDeidservicesDataPlaneClient(AAZBaseClient): + _CLOUD_HOST_TEMPLATES = { + CloudNameEnum.AzureCloud: "https://{endpoint}", + } + + _AAD_CREDENTIAL_SCOPES = [ + "https://deid.azure.com/.default", + ] + + @classmethod + def _build_base_url(cls, ctx, **kwargs): + endpoint = None + if not endpoint: + endpoint = cls._CLOUD_HOST_TEMPLATES.get(ctx.cli_ctx.cloud.name, None) + return endpoint + + @classmethod + def _build_configuration(cls, ctx, credential, **kwargs): + return AAZClientConfiguration( + credential=credential, + credential_scopes=cls._AAD_CREDENTIAL_SCOPES, + **kwargs + ) + + +class _AAZHealthdataaiservicesDeidservicesDataPlaneClientHelper: + """Helper class for AAZHealthdataaiservicesDeidservicesDataPlaneClient""" + + +__all__ = [ + "AAZHealthdataaiservicesDeidservicesDataPlaneClient", +] diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/__cmd_group.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/__cmd_group.py new file mode 100644 index 00000000000..e00d08b8be1 --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "health-data-ai-services", +) +class __CMDGroup(AAZCommandGroup): + """Manage Health Data Ai Services + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/__init__.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/__init__.py new file mode 100644 index 00000000000..5a9d61963d6 --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/__init__.py @@ -0,0 +1,11 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/__cmd_group.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/__cmd_group.py new file mode 100644 index 00000000000..d235d90e98e --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "health-data-ai-services deid-services", +) +class __CMDGroup(AAZCommandGroup): + """Manage Deid Services + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/__init__.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/__init__.py new file mode 100644 index 00000000000..0d49cd7bc69 --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/__init__.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._deid import * diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/_deid.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/_deid.py new file mode 100644 index 00000000000..bdfe27886b6 --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/_deid.py @@ -0,0 +1,271 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "health-data-ai-services deid-services deid", +) +class Deid(AAZCommand): + """A remote procedure call (RPC) operation. + """ + + _aaz_info = { + "version": "2024-11-15", + "resources": [ + ["data-plane:healthdataaiservices.deidservices", "/deid", "2024-11-15"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "Client" + + _args_schema = cls._args_schema + _args_schema.endpoint = AAZStrArg( + options=["--endpoint"], + arg_group="Client", + help="Url of your De-identification Service.", + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.customizations = AAZObjectArg( + options=["--customizations"], + arg_group="Body", + help="Customization parameters to override default service behaviors.", + ) + _args_schema.input_text = AAZStrArg( + options=["--input-text"], + arg_group="Body", + help="Input text to de-identify.", + required=True, + fmt=AAZStrArgFormat( + max_length=48000, + ), + ) + _args_schema.operation = AAZStrArg( + options=["--operation"], + arg_group="Body", + help="Operation to perform on the input documents.", + default="Surrogate", + enum={"Redact": "Redact", "Surrogate": "Surrogate", "Tag": "Tag"}, + ) + + customizations = cls._args_schema.customizations + customizations.redaction_format = AAZStrArg( + options=["redaction-format"], + help="Format of the redacted output. Only valid when Operation is Redact. Please refer to https://learn.microsoft.com/azure/healthcare-apis/deidentification/redaction-format for more details.", + fmt=AAZStrArgFormat( + max_length=16, + min_length=1, + ), + ) + customizations.surrogate_locale = AAZStrArg( + options=["surrogate-locale"], + help="Locale in which the output surrogates are written.", + default="en-US", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DeidentifyText(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class DeidentifyText(AAZHttpOperation): + CLIENT_TYPE = "AAZHealthdataaiservicesDeidservicesDataPlaneClient_healthcareapis" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/deid", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "endpoint", self.ctx.args.endpoint, + skip_quote=True, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-11-15", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("customizations", AAZObjectType, ".customizations") + _builder.set_prop("inputText", AAZStrType, ".input_text", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("operation", AAZStrType, ".operation") + + customizations = _builder.get(".customizations") + if customizations is not None: + customizations.set_prop("redactionFormat", AAZStrType, ".redaction_format") + customizations.set_prop("surrogateLocale", AAZStrType, ".surrogate_locale") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.output_text = AAZStrType( + serialized_name="outputText", + ) + _schema_on_200.tagger_result = AAZObjectType( + serialized_name="taggerResult", + ) + + tagger_result = cls._schema_on_200.tagger_result + tagger_result.entities = AAZListType( + flags={"required": True}, + ) + + entities = cls._schema_on_200.tagger_result.entities + entities.Element = AAZObjectType() + + _element = cls._schema_on_200.tagger_result.entities.Element + _element.category = AAZStrType( + flags={"required": True}, + ) + _element.confidence_score = AAZFloatType( + serialized_name="confidenceScore", + ) + _element.length = AAZObjectType( + flags={"required": True}, + ) + _DeidHelper._build_schema_stringindex_read(_element.length) + _element.offset = AAZObjectType( + flags={"required": True}, + ) + _DeidHelper._build_schema_stringindex_read(_element.offset) + _element.text = AAZStrType() + + return cls._schema_on_200 + + +class _DeidHelper: + """Helper class for Deid""" + + _schema_stringindex_read = None + + @classmethod + def _build_schema_stringindex_read(cls, _schema): + if cls._schema_stringindex_read is not None: + _schema.code_point = cls._schema_stringindex_read.code_point + _schema.utf16 = cls._schema_stringindex_read.utf16 + _schema.utf8 = cls._schema_stringindex_read.utf8 + return + + cls._schema_stringindex_read = _schema_stringindex_read = AAZObjectType() + + stringindex_read = _schema_stringindex_read + stringindex_read.code_point = AAZIntType( + serialized_name="codePoint", + flags={"required": True}, + ) + stringindex_read.utf16 = AAZIntType( + flags={"required": True}, + ) + stringindex_read.utf8 = AAZIntType( + flags={"required": True}, + ) + + _schema.code_point = cls._schema_stringindex_read.code_point + _schema.utf16 = cls._schema_stringindex_read.utf16 + _schema.utf8 = cls._schema_stringindex_read.utf8 + + +__all__ = ["Deid"] diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/__cmd_group.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/__cmd_group.py new file mode 100644 index 00000000000..3d7f5719c0e --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "health-data-ai-services deid-services job", +) +class __CMDGroup(AAZCommandGroup): + """Manage Job + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/__init__.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/__init__.py new file mode 100644 index 00000000000..e33b66a0f4a --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._cancel import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_cancel.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_cancel.py new file mode 100644 index 00000000000..52d0e10f9ee --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_cancel.py @@ -0,0 +1,308 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "health-data-ai-services deid-services job cancel", +) +class Cancel(AAZCommand): + """Cancels a job that is in progress. The job will be marked as canceled and the service will stop processing the job. The service will not delete any documents that have already been processed. If the job is already complete, this will have no effect. + """ + + _aaz_info = { + "version": "2024-11-15", + "resources": [ + ["data-plane:healthdataaiservices.deidservices", "/jobs/{}:cancel", "2024-11-15"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "Client" + + _args_schema = cls._args_schema + _args_schema.endpoint = AAZStrArg( + options=["--endpoint"], + arg_group="Client", + help="Url of your De-identification Service.", + required=True, + ) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["--name"], + help="The name of a job.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9][a-zA-Z0-9-_]+[a-zA-Z0-9]$", + max_length=36, + min_length=3, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.CancelJob(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class CancelJob(AAZHttpOperation): + CLIENT_TYPE = "AAZHealthdataaiservicesDeidservicesDataPlaneClient_healthcareapis" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/jobs/{name}:cancel", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "endpoint", self.ctx.args.endpoint, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "name", self.ctx.args.name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-11-15", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.created_at = AAZStrType( + serialized_name="createdAt", + flags={"read_only": True}, + ) + _schema_on_200.customizations = AAZObjectType() + _schema_on_200.error = AAZObjectType( + flags={"read_only": True}, + ) + _CancelHelper._build_schema_azure_core_foundations_error_read(_schema_on_200.error) + _schema_on_200.last_updated_at = AAZStrType( + serialized_name="lastUpdatedAt", + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.operation = AAZStrType() + _schema_on_200.source_location = AAZObjectType( + serialized_name="sourceLocation", + flags={"required": True}, + ) + _schema_on_200.started_at = AAZStrType( + serialized_name="startedAt", + flags={"read_only": True}, + ) + _schema_on_200.status = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.summary = AAZObjectType( + flags={"read_only": True}, + ) + _schema_on_200.target_location = AAZObjectType( + serialized_name="targetLocation", + flags={"required": True}, + ) + + customizations = cls._schema_on_200.customizations + customizations.redaction_format = AAZStrType( + serialized_name="redactionFormat", + ) + customizations.surrogate_locale = AAZStrType( + serialized_name="surrogateLocale", + ) + + source_location = cls._schema_on_200.source_location + source_location.extensions = AAZListType() + source_location.location = AAZStrType( + flags={"required": True}, + ) + source_location.prefix = AAZStrType( + flags={"required": True}, + ) + + extensions = cls._schema_on_200.source_location.extensions + extensions.Element = AAZStrType() + + summary = cls._schema_on_200.summary + summary.bytes_processed = AAZIntType( + serialized_name="bytesProcessed", + flags={"required": True}, + ) + summary.canceled = AAZIntType( + flags={"required": True}, + ) + summary.failed = AAZIntType( + flags={"required": True}, + ) + summary.successful = AAZIntType( + flags={"required": True}, + ) + summary.total = AAZIntType( + flags={"required": True}, + ) + + target_location = cls._schema_on_200.target_location + target_location.location = AAZStrType( + flags={"required": True}, + ) + target_location.overwrite = AAZBoolType() + target_location.prefix = AAZStrType( + flags={"required": True}, + ) + + return cls._schema_on_200 + + +class _CancelHelper: + """Helper class for Cancel""" + + _schema_azure_core_foundations_error_read = None + + @classmethod + def _build_schema_azure_core_foundations_error_read(cls, _schema): + if cls._schema_azure_core_foundations_error_read is not None: + _schema.code = cls._schema_azure_core_foundations_error_read.code + _schema.details = cls._schema_azure_core_foundations_error_read.details + _schema.innererror = cls._schema_azure_core_foundations_error_read.innererror + _schema.message = cls._schema_azure_core_foundations_error_read.message + _schema.target = cls._schema_azure_core_foundations_error_read.target + return + + cls._schema_azure_core_foundations_error_read = _schema_azure_core_foundations_error_read = AAZObjectType( + flags={"read_only": True} + ) + + azure_core_foundations_error_read = _schema_azure_core_foundations_error_read + azure_core_foundations_error_read.code = AAZStrType( + flags={"required": True}, + ) + azure_core_foundations_error_read.details = AAZListType() + azure_core_foundations_error_read.innererror = AAZObjectType() + cls._build_schema_azure_core_foundations_innererror_read(azure_core_foundations_error_read.innererror) + azure_core_foundations_error_read.message = AAZStrType( + flags={"required": True}, + ) + azure_core_foundations_error_read.target = AAZStrType() + + details = _schema_azure_core_foundations_error_read.details + details.Element = AAZObjectType() + cls._build_schema_azure_core_foundations_error_read(details.Element) + + _schema.code = cls._schema_azure_core_foundations_error_read.code + _schema.details = cls._schema_azure_core_foundations_error_read.details + _schema.innererror = cls._schema_azure_core_foundations_error_read.innererror + _schema.message = cls._schema_azure_core_foundations_error_read.message + _schema.target = cls._schema_azure_core_foundations_error_read.target + + _schema_azure_core_foundations_innererror_read = None + + @classmethod + def _build_schema_azure_core_foundations_innererror_read(cls, _schema): + if cls._schema_azure_core_foundations_innererror_read is not None: + _schema.code = cls._schema_azure_core_foundations_innererror_read.code + _schema.innererror = cls._schema_azure_core_foundations_innererror_read.innererror + return + + cls._schema_azure_core_foundations_innererror_read = _schema_azure_core_foundations_innererror_read = AAZObjectType() + + azure_core_foundations_innererror_read = _schema_azure_core_foundations_innererror_read + azure_core_foundations_innererror_read.code = AAZStrType() + azure_core_foundations_innererror_read.innererror = AAZObjectType() + cls._build_schema_azure_core_foundations_innererror_read(azure_core_foundations_innererror_read.innererror) + + _schema.code = cls._schema_azure_core_foundations_innererror_read.code + _schema.innererror = cls._schema_azure_core_foundations_innererror_read.innererror + + +__all__ = ["Cancel"] diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_create.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_create.py new file mode 100644 index 00000000000..59e0a624fa6 --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_create.py @@ -0,0 +1,452 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "health-data-ai-services deid-services job create", +) +class Create(AAZCommand): + """Create resource create or replace operation template. + """ + + _aaz_info = { + "version": "2024-11-15", + "resources": [ + ["data-plane:healthdataaiservices.deidservices", "/jobs/{}", "2024-11-15"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "Client" + + _args_schema = cls._args_schema + _args_schema.endpoint = AAZStrArg( + options=["--endpoint"], + arg_group="Client", + help="Url of your De-identification Service.", + required=True, + ) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["--name"], + help="The name of a job.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9][a-zA-Z0-9-_]+[a-zA-Z0-9]$", + max_length=36, + min_length=3, + ), + ) + + # define Arg Group "Resource" + + _args_schema = cls._args_schema + _args_schema.customizations = AAZObjectArg( + options=["--customizations"], + arg_group="Resource", + help="Customization parameters to override default service behaviors.", + ) + _args_schema.operation = AAZStrArg( + options=["--operation"], + arg_group="Resource", + help="Operation to perform on the input documents.", + default="Surrogate", + enum={"Redact": "Redact", "Surrogate": "Surrogate", "Tag": "Tag"}, + ) + _args_schema.source_location = AAZObjectArg( + options=["--source-location"], + arg_group="Resource", + help="Storage location to perform the operation on.", + required=True, + ) + _args_schema.target_location = AAZObjectArg( + options=["--target-location"], + arg_group="Resource", + help="Target location to store output of operation.", + required=True, + ) + + customizations = cls._args_schema.customizations + customizations.redaction_format = AAZStrArg( + options=["redaction-format"], + help="Format of the redacted output. Only valid when Operation is Redact. Please refer to https://learn.microsoft.com/azure/healthcare-apis/deidentification/redaction-format for more details.", + fmt=AAZStrArgFormat( + max_length=16, + min_length=1, + ), + ) + customizations.surrogate_locale = AAZStrArg( + options=["surrogate-locale"], + help="Locale in which the output surrogates are written.", + default="en-US", + ) + + source_location = cls._args_schema.source_location + source_location.extensions = AAZListArg( + options=["extensions"], + help="List of extensions to filter path by.", + default=["*"], + fmt=AAZListArgFormat( + min_length=1, + ), + ) + source_location.location = AAZStrArg( + options=["location"], + help="URL to storage location.", + required=True, + ) + source_location.prefix = AAZStrArg( + options=["prefix"], + help="Prefix to filter path by.", + required=True, + fmt=AAZStrArgFormat( + max_length=1024, + ), + ) + + extensions = cls._args_schema.source_location.extensions + extensions.Element = AAZStrArg() + + target_location = cls._args_schema.target_location + target_location.location = AAZStrArg( + options=["location"], + help="URL to storage location.", + required=True, + ) + target_location.overwrite = AAZBoolArg( + options=["overwrite"], + help="When set to true during a job, the service will overwrite the output location if it already exists.", + default=False, + ) + target_location.prefix = AAZStrArg( + options=["prefix"], + help="Replaces the input prefix of a file path with the output prefix, preserving the rest of the path structure. Example: File full path: documents/user/note.txt Input Prefix: \"documents/user/\" Output Prefix: \"output_docs/\" Output file: \"output_docs/note.txt\"", + required=True, + fmt=AAZStrArgFormat( + max_length=1024, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.DeidentifyDocuments(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class DeidentifyDocuments(AAZHttpOperation): + CLIENT_TYPE = "AAZHealthdataaiservicesDeidservicesDataPlaneClient_healthcareapis" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_201_200, + self.on_error, + lro_options={"final-state-via": "original-uri"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [201, 200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_201_200, + self.on_error, + lro_options={"final-state-via": "original-uri"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/jobs/{name}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "endpoint", self.ctx.args.endpoint, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "name", self.ctx.args.name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-11-15", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("customizations", AAZObjectType, ".customizations") + _builder.set_prop("operation", AAZStrType, ".operation") + _builder.set_prop("sourceLocation", AAZObjectType, ".source_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("targetLocation", AAZObjectType, ".target_location", typ_kwargs={"flags": {"required": True}}) + + customizations = _builder.get(".customizations") + if customizations is not None: + customizations.set_prop("redactionFormat", AAZStrType, ".redaction_format") + customizations.set_prop("surrogateLocale", AAZStrType, ".surrogate_locale") + + source_location = _builder.get(".sourceLocation") + if source_location is not None: + source_location.set_prop("extensions", AAZListType, ".extensions") + source_location.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + source_location.set_prop("prefix", AAZStrType, ".prefix", typ_kwargs={"flags": {"required": True}}) + + extensions = _builder.get(".sourceLocation.extensions") + if extensions is not None: + extensions.set_elements(AAZStrType, ".") + + target_location = _builder.get(".targetLocation") + if target_location is not None: + target_location.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + target_location.set_prop("overwrite", AAZBoolType, ".overwrite") + target_location.set_prop("prefix", AAZStrType, ".prefix", typ_kwargs={"flags": {"required": True}}) + + return self.serialize_content(_content_value) + + def on_201_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_201_200 + ) + + _schema_on_201_200 = None + + @classmethod + def _build_schema_on_201_200(cls): + if cls._schema_on_201_200 is not None: + return cls._schema_on_201_200 + + cls._schema_on_201_200 = AAZObjectType() + + _schema_on_201_200 = cls._schema_on_201_200 + _schema_on_201_200.created_at = AAZStrType( + serialized_name="createdAt", + flags={"read_only": True}, + ) + _schema_on_201_200.customizations = AAZObjectType() + _schema_on_201_200.error = AAZObjectType( + flags={"read_only": True}, + ) + _CreateHelper._build_schema_azure_core_foundations_error_read(_schema_on_201_200.error) + _schema_on_201_200.last_updated_at = AAZStrType( + serialized_name="lastUpdatedAt", + flags={"read_only": True}, + ) + _schema_on_201_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_201_200.operation = AAZStrType() + _schema_on_201_200.source_location = AAZObjectType( + serialized_name="sourceLocation", + flags={"required": True}, + ) + _schema_on_201_200.started_at = AAZStrType( + serialized_name="startedAt", + flags={"read_only": True}, + ) + _schema_on_201_200.status = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_201_200.summary = AAZObjectType( + flags={"read_only": True}, + ) + _schema_on_201_200.target_location = AAZObjectType( + serialized_name="targetLocation", + flags={"required": True}, + ) + + customizations = cls._schema_on_201_200.customizations + customizations.redaction_format = AAZStrType( + serialized_name="redactionFormat", + ) + customizations.surrogate_locale = AAZStrType( + serialized_name="surrogateLocale", + ) + + source_location = cls._schema_on_201_200.source_location + source_location.extensions = AAZListType() + source_location.location = AAZStrType( + flags={"required": True}, + ) + source_location.prefix = AAZStrType( + flags={"required": True}, + ) + + extensions = cls._schema_on_201_200.source_location.extensions + extensions.Element = AAZStrType() + + summary = cls._schema_on_201_200.summary + summary.bytes_processed = AAZIntType( + serialized_name="bytesProcessed", + flags={"required": True}, + ) + summary.canceled = AAZIntType( + flags={"required": True}, + ) + summary.failed = AAZIntType( + flags={"required": True}, + ) + summary.successful = AAZIntType( + flags={"required": True}, + ) + summary.total = AAZIntType( + flags={"required": True}, + ) + + target_location = cls._schema_on_201_200.target_location + target_location.location = AAZStrType( + flags={"required": True}, + ) + target_location.overwrite = AAZBoolType() + target_location.prefix = AAZStrType( + flags={"required": True}, + ) + + return cls._schema_on_201_200 + + +class _CreateHelper: + """Helper class for Create""" + + _schema_azure_core_foundations_error_read = None + + @classmethod + def _build_schema_azure_core_foundations_error_read(cls, _schema): + if cls._schema_azure_core_foundations_error_read is not None: + _schema.code = cls._schema_azure_core_foundations_error_read.code + _schema.details = cls._schema_azure_core_foundations_error_read.details + _schema.innererror = cls._schema_azure_core_foundations_error_read.innererror + _schema.message = cls._schema_azure_core_foundations_error_read.message + _schema.target = cls._schema_azure_core_foundations_error_read.target + return + + cls._schema_azure_core_foundations_error_read = _schema_azure_core_foundations_error_read = AAZObjectType( + flags={"read_only": True} + ) + + azure_core_foundations_error_read = _schema_azure_core_foundations_error_read + azure_core_foundations_error_read.code = AAZStrType( + flags={"required": True}, + ) + azure_core_foundations_error_read.details = AAZListType() + azure_core_foundations_error_read.innererror = AAZObjectType() + cls._build_schema_azure_core_foundations_innererror_read(azure_core_foundations_error_read.innererror) + azure_core_foundations_error_read.message = AAZStrType( + flags={"required": True}, + ) + azure_core_foundations_error_read.target = AAZStrType() + + details = _schema_azure_core_foundations_error_read.details + details.Element = AAZObjectType() + cls._build_schema_azure_core_foundations_error_read(details.Element) + + _schema.code = cls._schema_azure_core_foundations_error_read.code + _schema.details = cls._schema_azure_core_foundations_error_read.details + _schema.innererror = cls._schema_azure_core_foundations_error_read.innererror + _schema.message = cls._schema_azure_core_foundations_error_read.message + _schema.target = cls._schema_azure_core_foundations_error_read.target + + _schema_azure_core_foundations_innererror_read = None + + @classmethod + def _build_schema_azure_core_foundations_innererror_read(cls, _schema): + if cls._schema_azure_core_foundations_innererror_read is not None: + _schema.code = cls._schema_azure_core_foundations_innererror_read.code + _schema.innererror = cls._schema_azure_core_foundations_innererror_read.innererror + return + + cls._schema_azure_core_foundations_innererror_read = _schema_azure_core_foundations_innererror_read = AAZObjectType() + + azure_core_foundations_innererror_read = _schema_azure_core_foundations_innererror_read + azure_core_foundations_innererror_read.code = AAZStrType() + azure_core_foundations_innererror_read.innererror = AAZObjectType() + cls._build_schema_azure_core_foundations_innererror_read(azure_core_foundations_innererror_read.innererror) + + _schema.code = cls._schema_azure_core_foundations_innererror_read.code + _schema.innererror = cls._schema_azure_core_foundations_innererror_read.innererror + + +__all__ = ["Create"] diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_delete.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_delete.py new file mode 100644 index 00000000000..ab9df03a503 --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_delete.py @@ -0,0 +1,139 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "health-data-ai-services deid-services job delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the record of the job from the service. Does not delete any documents. + """ + + _aaz_info = { + "version": "2024-11-15", + "resources": [ + ["data-plane:healthdataaiservices.deidservices", "/jobs/{}", "2024-11-15"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "Client" + + _args_schema = cls._args_schema + _args_schema.endpoint = AAZStrArg( + options=["--endpoint"], + arg_group="Client", + help="Url of your De-identification Service.", + required=True, + ) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["--name"], + help="The name of a job.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9][a-zA-Z0-9-_]+[a-zA-Z0-9]$", + max_length=36, + min_length=3, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DeleteJob(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class DeleteJob(AAZHttpOperation): + CLIENT_TYPE = "AAZHealthdataaiservicesDeidservicesDataPlaneClient_healthcareapis" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/jobs/{name}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "endpoint", self.ctx.args.endpoint, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "name", self.ctx.args.name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-11-15", + required=True, + ), + } + return parameters + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_list.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_list.py new file mode 100644 index 00000000000..f1cdf5bfe69 --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_list.py @@ -0,0 +1,321 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "health-data-ai-services deid-services job list", +) +class List(AAZCommand): + """List list operation template. + """ + + _aaz_info = { + "version": "2024-11-15", + "resources": [ + ["data-plane:healthdataaiservices.deidservices", "/jobs", "2024-11-15"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "Client" + + _args_schema = cls._args_schema + _args_schema.endpoint = AAZStrArg( + options=["--endpoint"], + arg_group="Client", + help="Url of your De-identification Service.", + required=True, + ) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.continuation_token = AAZStrArg( + options=["--continuation-token"], + help="Token to continue a previous query.", + ) + _args_schema.maxpagesize = AAZIntArg( + options=["--maxpagesize"], + help="The maximum number of result items per page.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ListJobs(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class ListJobs(AAZHttpOperation): + CLIENT_TYPE = "AAZHealthdataaiservicesDeidservicesDataPlaneClient_healthcareapis" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/jobs", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "endpoint", self.ctx.args.endpoint, + skip_quote=True, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "continuationToken", self.ctx.args.continuation_token, + ), + **self.serialize_query_param( + "maxpagesize", self.ctx.args.maxpagesize, + ), + **self.serialize_query_param( + "api-version", "2024-11-15", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.created_at = AAZStrType( + serialized_name="createdAt", + flags={"read_only": True}, + ) + _element.customizations = AAZObjectType() + _element.error = AAZObjectType( + flags={"read_only": True}, + ) + _ListHelper._build_schema_azure_core_foundations_error_read(_element.error) + _element.last_updated_at = AAZStrType( + serialized_name="lastUpdatedAt", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.operation = AAZStrType() + _element.source_location = AAZObjectType( + serialized_name="sourceLocation", + flags={"required": True}, + ) + _element.started_at = AAZStrType( + serialized_name="startedAt", + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.summary = AAZObjectType( + flags={"read_only": True}, + ) + _element.target_location = AAZObjectType( + serialized_name="targetLocation", + flags={"required": True}, + ) + + customizations = cls._schema_on_200.value.Element.customizations + customizations.redaction_format = AAZStrType( + serialized_name="redactionFormat", + ) + customizations.surrogate_locale = AAZStrType( + serialized_name="surrogateLocale", + ) + + source_location = cls._schema_on_200.value.Element.source_location + source_location.extensions = AAZListType() + source_location.location = AAZStrType( + flags={"required": True}, + ) + source_location.prefix = AAZStrType( + flags={"required": True}, + ) + + extensions = cls._schema_on_200.value.Element.source_location.extensions + extensions.Element = AAZStrType() + + summary = cls._schema_on_200.value.Element.summary + summary.bytes_processed = AAZIntType( + serialized_name="bytesProcessed", + flags={"required": True}, + ) + summary.canceled = AAZIntType( + flags={"required": True}, + ) + summary.failed = AAZIntType( + flags={"required": True}, + ) + summary.successful = AAZIntType( + flags={"required": True}, + ) + summary.total = AAZIntType( + flags={"required": True}, + ) + + target_location = cls._schema_on_200.value.Element.target_location + target_location.location = AAZStrType( + flags={"required": True}, + ) + target_location.overwrite = AAZBoolType() + target_location.prefix = AAZStrType( + flags={"required": True}, + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + _schema_azure_core_foundations_error_read = None + + @classmethod + def _build_schema_azure_core_foundations_error_read(cls, _schema): + if cls._schema_azure_core_foundations_error_read is not None: + _schema.code = cls._schema_azure_core_foundations_error_read.code + _schema.details = cls._schema_azure_core_foundations_error_read.details + _schema.innererror = cls._schema_azure_core_foundations_error_read.innererror + _schema.message = cls._schema_azure_core_foundations_error_read.message + _schema.target = cls._schema_azure_core_foundations_error_read.target + return + + cls._schema_azure_core_foundations_error_read = _schema_azure_core_foundations_error_read = AAZObjectType( + flags={"read_only": True} + ) + + azure_core_foundations_error_read = _schema_azure_core_foundations_error_read + azure_core_foundations_error_read.code = AAZStrType( + flags={"required": True}, + ) + azure_core_foundations_error_read.details = AAZListType() + azure_core_foundations_error_read.innererror = AAZObjectType() + cls._build_schema_azure_core_foundations_innererror_read(azure_core_foundations_error_read.innererror) + azure_core_foundations_error_read.message = AAZStrType( + flags={"required": True}, + ) + azure_core_foundations_error_read.target = AAZStrType() + + details = _schema_azure_core_foundations_error_read.details + details.Element = AAZObjectType() + cls._build_schema_azure_core_foundations_error_read(details.Element) + + _schema.code = cls._schema_azure_core_foundations_error_read.code + _schema.details = cls._schema_azure_core_foundations_error_read.details + _schema.innererror = cls._schema_azure_core_foundations_error_read.innererror + _schema.message = cls._schema_azure_core_foundations_error_read.message + _schema.target = cls._schema_azure_core_foundations_error_read.target + + _schema_azure_core_foundations_innererror_read = None + + @classmethod + def _build_schema_azure_core_foundations_innererror_read(cls, _schema): + if cls._schema_azure_core_foundations_innererror_read is not None: + _schema.code = cls._schema_azure_core_foundations_innererror_read.code + _schema.innererror = cls._schema_azure_core_foundations_innererror_read.innererror + return + + cls._schema_azure_core_foundations_innererror_read = _schema_azure_core_foundations_innererror_read = AAZObjectType() + + azure_core_foundations_innererror_read = _schema_azure_core_foundations_innererror_read + azure_core_foundations_innererror_read.code = AAZStrType() + azure_core_foundations_innererror_read.innererror = AAZObjectType() + cls._build_schema_azure_core_foundations_innererror_read(azure_core_foundations_innererror_read.innererror) + + _schema.code = cls._schema_azure_core_foundations_innererror_read.code + _schema.innererror = cls._schema_azure_core_foundations_innererror_read.innererror + + +__all__ = ["List"] diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_show.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_show.py new file mode 100644 index 00000000000..57abda954a7 --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_show.py @@ -0,0 +1,308 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "health-data-ai-services deid-services job show", +) +class Show(AAZCommand): + """Get read operation template. + """ + + _aaz_info = { + "version": "2024-11-15", + "resources": [ + ["data-plane:healthdataaiservices.deidservices", "/jobs/{}", "2024-11-15"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "Client" + + _args_schema = cls._args_schema + _args_schema.endpoint = AAZStrArg( + options=["--endpoint"], + arg_group="Client", + help="Url of your De-identification Service.", + required=True, + ) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["--name"], + help="The name of a job.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9][a-zA-Z0-9-_]+[a-zA-Z0-9]$", + max_length=36, + min_length=3, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.GetJob(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class GetJob(AAZHttpOperation): + CLIENT_TYPE = "AAZHealthdataaiservicesDeidservicesDataPlaneClient_healthcareapis" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/jobs/{name}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "endpoint", self.ctx.args.endpoint, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "name", self.ctx.args.name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-11-15", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.created_at = AAZStrType( + serialized_name="createdAt", + flags={"read_only": True}, + ) + _schema_on_200.customizations = AAZObjectType() + _schema_on_200.error = AAZObjectType( + flags={"read_only": True}, + ) + _ShowHelper._build_schema_azure_core_foundations_error_read(_schema_on_200.error) + _schema_on_200.last_updated_at = AAZStrType( + serialized_name="lastUpdatedAt", + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.operation = AAZStrType() + _schema_on_200.source_location = AAZObjectType( + serialized_name="sourceLocation", + flags={"required": True}, + ) + _schema_on_200.started_at = AAZStrType( + serialized_name="startedAt", + flags={"read_only": True}, + ) + _schema_on_200.status = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.summary = AAZObjectType( + flags={"read_only": True}, + ) + _schema_on_200.target_location = AAZObjectType( + serialized_name="targetLocation", + flags={"required": True}, + ) + + customizations = cls._schema_on_200.customizations + customizations.redaction_format = AAZStrType( + serialized_name="redactionFormat", + ) + customizations.surrogate_locale = AAZStrType( + serialized_name="surrogateLocale", + ) + + source_location = cls._schema_on_200.source_location + source_location.extensions = AAZListType() + source_location.location = AAZStrType( + flags={"required": True}, + ) + source_location.prefix = AAZStrType( + flags={"required": True}, + ) + + extensions = cls._schema_on_200.source_location.extensions + extensions.Element = AAZStrType() + + summary = cls._schema_on_200.summary + summary.bytes_processed = AAZIntType( + serialized_name="bytesProcessed", + flags={"required": True}, + ) + summary.canceled = AAZIntType( + flags={"required": True}, + ) + summary.failed = AAZIntType( + flags={"required": True}, + ) + summary.successful = AAZIntType( + flags={"required": True}, + ) + summary.total = AAZIntType( + flags={"required": True}, + ) + + target_location = cls._schema_on_200.target_location + target_location.location = AAZStrType( + flags={"required": True}, + ) + target_location.overwrite = AAZBoolType() + target_location.prefix = AAZStrType( + flags={"required": True}, + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_azure_core_foundations_error_read = None + + @classmethod + def _build_schema_azure_core_foundations_error_read(cls, _schema): + if cls._schema_azure_core_foundations_error_read is not None: + _schema.code = cls._schema_azure_core_foundations_error_read.code + _schema.details = cls._schema_azure_core_foundations_error_read.details + _schema.innererror = cls._schema_azure_core_foundations_error_read.innererror + _schema.message = cls._schema_azure_core_foundations_error_read.message + _schema.target = cls._schema_azure_core_foundations_error_read.target + return + + cls._schema_azure_core_foundations_error_read = _schema_azure_core_foundations_error_read = AAZObjectType( + flags={"read_only": True} + ) + + azure_core_foundations_error_read = _schema_azure_core_foundations_error_read + azure_core_foundations_error_read.code = AAZStrType( + flags={"required": True}, + ) + azure_core_foundations_error_read.details = AAZListType() + azure_core_foundations_error_read.innererror = AAZObjectType() + cls._build_schema_azure_core_foundations_innererror_read(azure_core_foundations_error_read.innererror) + azure_core_foundations_error_read.message = AAZStrType( + flags={"required": True}, + ) + azure_core_foundations_error_read.target = AAZStrType() + + details = _schema_azure_core_foundations_error_read.details + details.Element = AAZObjectType() + cls._build_schema_azure_core_foundations_error_read(details.Element) + + _schema.code = cls._schema_azure_core_foundations_error_read.code + _schema.details = cls._schema_azure_core_foundations_error_read.details + _schema.innererror = cls._schema_azure_core_foundations_error_read.innererror + _schema.message = cls._schema_azure_core_foundations_error_read.message + _schema.target = cls._schema_azure_core_foundations_error_read.target + + _schema_azure_core_foundations_innererror_read = None + + @classmethod + def _build_schema_azure_core_foundations_innererror_read(cls, _schema): + if cls._schema_azure_core_foundations_innererror_read is not None: + _schema.code = cls._schema_azure_core_foundations_innererror_read.code + _schema.innererror = cls._schema_azure_core_foundations_innererror_read.innererror + return + + cls._schema_azure_core_foundations_innererror_read = _schema_azure_core_foundations_innererror_read = AAZObjectType() + + azure_core_foundations_innererror_read = _schema_azure_core_foundations_innererror_read + azure_core_foundations_innererror_read.code = AAZStrType() + azure_core_foundations_innererror_read.innererror = AAZObjectType() + cls._build_schema_azure_core_foundations_innererror_read(azure_core_foundations_innererror_read.innererror) + + _schema.code = cls._schema_azure_core_foundations_innererror_read.code + _schema.innererror = cls._schema_azure_core_foundations_innererror_read.innererror + + +__all__ = ["Show"] diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_update.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_update.py new file mode 100644 index 00000000000..72668a39b4f --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/_update.py @@ -0,0 +1,649 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "health-data-ai-services deid-services job update", +) +class Update(AAZCommand): + """Update resource create or replace operation template. + """ + + _aaz_info = { + "version": "2024-11-15", + "resources": [ + ["data-plane:healthdataaiservices.deidservices", "/jobs/{}", "2024-11-15"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "Client" + + _args_schema = cls._args_schema + _args_schema.endpoint = AAZStrArg( + options=["--endpoint"], + arg_group="Client", + help="Url of your De-identification Service.", + required=True, + ) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["--name"], + help="The name of a job.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9][a-zA-Z0-9-_]+[a-zA-Z0-9]$", + max_length=36, + min_length=3, + ), + ) + + # define Arg Group "Resource" + + _args_schema = cls._args_schema + _args_schema.customizations = AAZObjectArg( + options=["--customizations"], + arg_group="Resource", + help="Customization parameters to override default service behaviors.", + nullable=True, + ) + _args_schema.operation = AAZStrArg( + options=["--operation"], + arg_group="Resource", + help="Operation to perform on the input documents.", + nullable=True, + enum={"Redact": "Redact", "Surrogate": "Surrogate", "Tag": "Tag"}, + ) + _args_schema.source_location = AAZObjectArg( + options=["--source-location"], + arg_group="Resource", + help="Storage location to perform the operation on.", + ) + _args_schema.target_location = AAZObjectArg( + options=["--target-location"], + arg_group="Resource", + help="Target location to store output of operation.", + ) + + customizations = cls._args_schema.customizations + customizations.redaction_format = AAZStrArg( + options=["redaction-format"], + help="Format of the redacted output. Only valid when Operation is Redact. Please refer to https://learn.microsoft.com/azure/healthcare-apis/deidentification/redaction-format for more details.", + nullable=True, + fmt=AAZStrArgFormat( + max_length=16, + min_length=1, + ), + ) + customizations.surrogate_locale = AAZStrArg( + options=["surrogate-locale"], + help="Locale in which the output surrogates are written.", + nullable=True, + ) + + source_location = cls._args_schema.source_location + source_location.extensions = AAZListArg( + options=["extensions"], + help="List of extensions to filter path by.", + nullable=True, + fmt=AAZListArgFormat( + min_length=1, + ), + ) + source_location.location = AAZStrArg( + options=["location"], + help="URL to storage location.", + ) + source_location.prefix = AAZStrArg( + options=["prefix"], + help="Prefix to filter path by.", + fmt=AAZStrArgFormat( + max_length=1024, + ), + ) + + extensions = cls._args_schema.source_location.extensions + extensions.Element = AAZStrArg( + nullable=True, + ) + + target_location = cls._args_schema.target_location + target_location.location = AAZStrArg( + options=["location"], + help="URL to storage location.", + ) + target_location.overwrite = AAZBoolArg( + options=["overwrite"], + help="When set to true during a job, the service will overwrite the output location if it already exists.", + nullable=True, + ) + target_location.prefix = AAZStrArg( + options=["prefix"], + help="Replaces the input prefix of a file path with the output prefix, preserving the rest of the path structure. Example: File full path: documents/user/note.txt Input Prefix: \"documents/user/\" Output Prefix: \"output_docs/\" Output file: \"output_docs/note.txt\"", + fmt=AAZStrArgFormat( + max_length=1024, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.GetJob(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + yield self.DeidentifyDocuments(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class GetJob(AAZHttpOperation): + CLIENT_TYPE = "AAZHealthdataaiservicesDeidservicesDataPlaneClient_healthcareapis" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/jobs/{name}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "endpoint", self.ctx.args.endpoint, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "name", self.ctx.args.name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-11-15", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.created_at = AAZStrType( + serialized_name="createdAt", + flags={"read_only": True}, + ) + _schema_on_200.customizations = AAZObjectType() + _schema_on_200.error = AAZObjectType( + flags={"read_only": True}, + ) + _UpdateHelper._build_schema_azure_core_foundations_error_read(_schema_on_200.error) + _schema_on_200.last_updated_at = AAZStrType( + serialized_name="lastUpdatedAt", + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.operation = AAZStrType() + _schema_on_200.source_location = AAZObjectType( + serialized_name="sourceLocation", + flags={"required": True}, + ) + _schema_on_200.started_at = AAZStrType( + serialized_name="startedAt", + flags={"read_only": True}, + ) + _schema_on_200.status = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.summary = AAZObjectType( + flags={"read_only": True}, + ) + _schema_on_200.target_location = AAZObjectType( + serialized_name="targetLocation", + flags={"required": True}, + ) + + customizations = cls._schema_on_200.customizations + customizations.redaction_format = AAZStrType( + serialized_name="redactionFormat", + ) + customizations.surrogate_locale = AAZStrType( + serialized_name="surrogateLocale", + ) + + source_location = cls._schema_on_200.source_location + source_location.extensions = AAZListType() + source_location.location = AAZStrType( + flags={"required": True}, + ) + source_location.prefix = AAZStrType( + flags={"required": True}, + ) + + extensions = cls._schema_on_200.source_location.extensions + extensions.Element = AAZStrType() + + summary = cls._schema_on_200.summary + summary.bytes_processed = AAZIntType( + serialized_name="bytesProcessed", + flags={"required": True}, + ) + summary.canceled = AAZIntType( + flags={"required": True}, + ) + summary.failed = AAZIntType( + flags={"required": True}, + ) + summary.successful = AAZIntType( + flags={"required": True}, + ) + summary.total = AAZIntType( + flags={"required": True}, + ) + + target_location = cls._schema_on_200.target_location + target_location.location = AAZStrType( + flags={"required": True}, + ) + target_location.overwrite = AAZBoolType() + target_location.prefix = AAZStrType( + flags={"required": True}, + ) + + return cls._schema_on_200 + + class DeidentifyDocuments(AAZHttpOperation): + CLIENT_TYPE = "AAZHealthdataaiservicesDeidservicesDataPlaneClient_healthcareapis" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_201_200, + self.on_error, + lro_options={"final-state-via": "original-uri"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [201, 200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_201_200, + self.on_error, + lro_options={"final-state-via": "original-uri"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/jobs/{name}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "endpoint", self.ctx.args.endpoint, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "name", self.ctx.args.name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-11-15", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_201_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_201_200 + ) + + _schema_on_201_200 = None + + @classmethod + def _build_schema_on_201_200(cls): + if cls._schema_on_201_200 is not None: + return cls._schema_on_201_200 + + cls._schema_on_201_200 = AAZObjectType() + + _schema_on_201_200 = cls._schema_on_201_200 + _schema_on_201_200.created_at = AAZStrType( + serialized_name="createdAt", + flags={"read_only": True}, + ) + _schema_on_201_200.customizations = AAZObjectType() + _schema_on_201_200.error = AAZObjectType( + flags={"read_only": True}, + ) + _UpdateHelper._build_schema_azure_core_foundations_error_read(_schema_on_201_200.error) + _schema_on_201_200.last_updated_at = AAZStrType( + serialized_name="lastUpdatedAt", + flags={"read_only": True}, + ) + _schema_on_201_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_201_200.operation = AAZStrType() + _schema_on_201_200.source_location = AAZObjectType( + serialized_name="sourceLocation", + flags={"required": True}, + ) + _schema_on_201_200.started_at = AAZStrType( + serialized_name="startedAt", + flags={"read_only": True}, + ) + _schema_on_201_200.status = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_201_200.summary = AAZObjectType( + flags={"read_only": True}, + ) + _schema_on_201_200.target_location = AAZObjectType( + serialized_name="targetLocation", + flags={"required": True}, + ) + + customizations = cls._schema_on_201_200.customizations + customizations.redaction_format = AAZStrType( + serialized_name="redactionFormat", + ) + customizations.surrogate_locale = AAZStrType( + serialized_name="surrogateLocale", + ) + + source_location = cls._schema_on_201_200.source_location + source_location.extensions = AAZListType() + source_location.location = AAZStrType( + flags={"required": True}, + ) + source_location.prefix = AAZStrType( + flags={"required": True}, + ) + + extensions = cls._schema_on_201_200.source_location.extensions + extensions.Element = AAZStrType() + + summary = cls._schema_on_201_200.summary + summary.bytes_processed = AAZIntType( + serialized_name="bytesProcessed", + flags={"required": True}, + ) + summary.canceled = AAZIntType( + flags={"required": True}, + ) + summary.failed = AAZIntType( + flags={"required": True}, + ) + summary.successful = AAZIntType( + flags={"required": True}, + ) + summary.total = AAZIntType( + flags={"required": True}, + ) + + target_location = cls._schema_on_201_200.target_location + target_location.location = AAZStrType( + flags={"required": True}, + ) + target_location.overwrite = AAZBoolType() + target_location.prefix = AAZStrType( + flags={"required": True}, + ) + + return cls._schema_on_201_200 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("customizations", AAZObjectType, ".customizations") + _builder.set_prop("operation", AAZStrType, ".operation") + _builder.set_prop("sourceLocation", AAZObjectType, ".source_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("targetLocation", AAZObjectType, ".target_location", typ_kwargs={"flags": {"required": True}}) + + customizations = _builder.get(".customizations") + if customizations is not None: + customizations.set_prop("redactionFormat", AAZStrType, ".redaction_format") + customizations.set_prop("surrogateLocale", AAZStrType, ".surrogate_locale") + + source_location = _builder.get(".sourceLocation") + if source_location is not None: + source_location.set_prop("extensions", AAZListType, ".extensions") + source_location.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + source_location.set_prop("prefix", AAZStrType, ".prefix", typ_kwargs={"flags": {"required": True}}) + + extensions = _builder.get(".sourceLocation.extensions") + if extensions is not None: + extensions.set_elements(AAZStrType, ".") + + target_location = _builder.get(".targetLocation") + if target_location is not None: + target_location.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + target_location.set_prop("overwrite", AAZBoolType, ".overwrite") + target_location.set_prop("prefix", AAZStrType, ".prefix", typ_kwargs={"flags": {"required": True}}) + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_azure_core_foundations_error_read = None + + @classmethod + def _build_schema_azure_core_foundations_error_read(cls, _schema): + if cls._schema_azure_core_foundations_error_read is not None: + _schema.code = cls._schema_azure_core_foundations_error_read.code + _schema.details = cls._schema_azure_core_foundations_error_read.details + _schema.innererror = cls._schema_azure_core_foundations_error_read.innererror + _schema.message = cls._schema_azure_core_foundations_error_read.message + _schema.target = cls._schema_azure_core_foundations_error_read.target + return + + cls._schema_azure_core_foundations_error_read = _schema_azure_core_foundations_error_read = AAZObjectType( + flags={"read_only": True} + ) + + azure_core_foundations_error_read = _schema_azure_core_foundations_error_read + azure_core_foundations_error_read.code = AAZStrType( + flags={"required": True}, + ) + azure_core_foundations_error_read.details = AAZListType() + azure_core_foundations_error_read.innererror = AAZObjectType() + cls._build_schema_azure_core_foundations_innererror_read(azure_core_foundations_error_read.innererror) + azure_core_foundations_error_read.message = AAZStrType( + flags={"required": True}, + ) + azure_core_foundations_error_read.target = AAZStrType() + + details = _schema_azure_core_foundations_error_read.details + details.Element = AAZObjectType() + cls._build_schema_azure_core_foundations_error_read(details.Element) + + _schema.code = cls._schema_azure_core_foundations_error_read.code + _schema.details = cls._schema_azure_core_foundations_error_read.details + _schema.innererror = cls._schema_azure_core_foundations_error_read.innererror + _schema.message = cls._schema_azure_core_foundations_error_read.message + _schema.target = cls._schema_azure_core_foundations_error_read.target + + _schema_azure_core_foundations_innererror_read = None + + @classmethod + def _build_schema_azure_core_foundations_innererror_read(cls, _schema): + if cls._schema_azure_core_foundations_innererror_read is not None: + _schema.code = cls._schema_azure_core_foundations_innererror_read.code + _schema.innererror = cls._schema_azure_core_foundations_innererror_read.innererror + return + + cls._schema_azure_core_foundations_innererror_read = _schema_azure_core_foundations_innererror_read = AAZObjectType() + + azure_core_foundations_innererror_read = _schema_azure_core_foundations_innererror_read + azure_core_foundations_innererror_read.code = AAZStrType() + azure_core_foundations_innererror_read.innererror = AAZObjectType() + cls._build_schema_azure_core_foundations_innererror_read(azure_core_foundations_innererror_read.innererror) + + _schema.code = cls._schema_azure_core_foundations_innererror_read.code + _schema.innererror = cls._schema_azure_core_foundations_innererror_read.innererror + + +__all__ = ["Update"] diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/document/__cmd_group.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/document/__cmd_group.py new file mode 100644 index 00000000000..120491166bb --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/document/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "health-data-ai-services deid-services job document", +) +class __CMDGroup(AAZCommandGroup): + """Manage Document + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/document/__init__.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/document/__init__.py new file mode 100644 index 00000000000..d63ae5a6fc9 --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/document/__init__.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._list import * diff --git a/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/document/_list.py b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/document/_list.py new file mode 100644 index 00000000000..b7b0de65b4e --- /dev/null +++ b/src/healthcareapis/azext_healthcareapis/aaz/latest/health_data_ai_services/deid_services/job/document/_list.py @@ -0,0 +1,287 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "health-data-ai-services deid-services job document list", +) +class List(AAZCommand): + """List list operation template. + """ + + _aaz_info = { + "version": "2024-11-15", + "resources": [ + ["data-plane:healthdataaiservices.deidservices", "/jobs/{}/documents", "2024-11-15"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "Client" + + _args_schema = cls._args_schema + _args_schema.endpoint = AAZStrArg( + options=["--endpoint"], + arg_group="Client", + help="Url of your De-identification Service.", + required=True, + ) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["--name"], + help="The name of a job.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9][a-zA-Z0-9-_]+[a-zA-Z0-9]$", + max_length=36, + min_length=3, + ), + ) + _args_schema.continuation_token = AAZStrArg( + options=["--continuation-token"], + help="Token to continue a previous query.", + ) + _args_schema.maxpagesize = AAZIntArg( + options=["--maxpagesize"], + help="The maximum number of result items per page.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ListJobDocuments(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class ListJobDocuments(AAZHttpOperation): + CLIENT_TYPE = "AAZHealthdataaiservicesDeidservicesDataPlaneClient_healthcareapis" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/jobs/{name}/documents", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "endpoint", self.ctx.args.endpoint, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "name", self.ctx.args.name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "continuationToken", self.ctx.args.continuation_token, + ), + **self.serialize_query_param( + "maxpagesize", self.ctx.args.maxpagesize, + ), + **self.serialize_query_param( + "api-version", "2024-11-15", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.error = AAZObjectType() + _ListHelper._build_schema_azure_core_foundations_error_read(_element.error) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.input = AAZObjectType( + flags={"required": True}, + ) + _ListHelper._build_schema_deidentificationdocumentlocation_read(_element.input) + _element.output = AAZObjectType() + _ListHelper._build_schema_deidentificationdocumentlocation_read(_element.output) + _element.status = AAZStrType( + flags={"required": True}, + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + _schema_azure_core_foundations_error_read = None + + @classmethod + def _build_schema_azure_core_foundations_error_read(cls, _schema): + if cls._schema_azure_core_foundations_error_read is not None: + _schema.code = cls._schema_azure_core_foundations_error_read.code + _schema.details = cls._schema_azure_core_foundations_error_read.details + _schema.innererror = cls._schema_azure_core_foundations_error_read.innererror + _schema.message = cls._schema_azure_core_foundations_error_read.message + _schema.target = cls._schema_azure_core_foundations_error_read.target + return + + cls._schema_azure_core_foundations_error_read = _schema_azure_core_foundations_error_read = AAZObjectType() + + azure_core_foundations_error_read = _schema_azure_core_foundations_error_read + azure_core_foundations_error_read.code = AAZStrType( + flags={"required": True}, + ) + azure_core_foundations_error_read.details = AAZListType() + azure_core_foundations_error_read.innererror = AAZObjectType() + cls._build_schema_azure_core_foundations_innererror_read(azure_core_foundations_error_read.innererror) + azure_core_foundations_error_read.message = AAZStrType( + flags={"required": True}, + ) + azure_core_foundations_error_read.target = AAZStrType() + + details = _schema_azure_core_foundations_error_read.details + details.Element = AAZObjectType() + cls._build_schema_azure_core_foundations_error_read(details.Element) + + _schema.code = cls._schema_azure_core_foundations_error_read.code + _schema.details = cls._schema_azure_core_foundations_error_read.details + _schema.innererror = cls._schema_azure_core_foundations_error_read.innererror + _schema.message = cls._schema_azure_core_foundations_error_read.message + _schema.target = cls._schema_azure_core_foundations_error_read.target + + _schema_azure_core_foundations_innererror_read = None + + @classmethod + def _build_schema_azure_core_foundations_innererror_read(cls, _schema): + if cls._schema_azure_core_foundations_innererror_read is not None: + _schema.code = cls._schema_azure_core_foundations_innererror_read.code + _schema.innererror = cls._schema_azure_core_foundations_innererror_read.innererror + return + + cls._schema_azure_core_foundations_innererror_read = _schema_azure_core_foundations_innererror_read = AAZObjectType() + + azure_core_foundations_innererror_read = _schema_azure_core_foundations_innererror_read + azure_core_foundations_innererror_read.code = AAZStrType() + azure_core_foundations_innererror_read.innererror = AAZObjectType() + cls._build_schema_azure_core_foundations_innererror_read(azure_core_foundations_innererror_read.innererror) + + _schema.code = cls._schema_azure_core_foundations_innererror_read.code + _schema.innererror = cls._schema_azure_core_foundations_innererror_read.innererror + + _schema_deidentificationdocumentlocation_read = None + + @classmethod + def _build_schema_deidentificationdocumentlocation_read(cls, _schema): + if cls._schema_deidentificationdocumentlocation_read is not None: + _schema.etag = cls._schema_deidentificationdocumentlocation_read.etag + _schema.location = cls._schema_deidentificationdocumentlocation_read.location + return + + cls._schema_deidentificationdocumentlocation_read = _schema_deidentificationdocumentlocation_read = AAZObjectType() + + deidentificationdocumentlocation_read = _schema_deidentificationdocumentlocation_read + deidentificationdocumentlocation_read.etag = AAZStrType( + flags={"read_only": True}, + ) + deidentificationdocumentlocation_read.location = AAZStrType( + flags={"required": True}, + ) + + _schema.etag = cls._schema_deidentificationdocumentlocation_read.etag + _schema.location = cls._schema_deidentificationdocumentlocation_read.location + + +__all__ = ["List"] diff --git a/src/healthcareapis/azext_healthcareapis/azext_metadata.json b/src/healthcareapis/azext_healthcareapis/azext_metadata.json index 044fb106bfe..b9c3b873766 100644 --- a/src/healthcareapis/azext_healthcareapis/azext_metadata.json +++ b/src/healthcareapis/azext_healthcareapis/azext_metadata.json @@ -1,3 +1,3 @@ { - "azext.minCliCoreVersion": "2.66.0" + "azext.minCliCoreVersion": "2.70.0" } \ No newline at end of file diff --git a/src/service_name.json b/src/service_name.json index df3ed850888..66c3fd992dc 100644 --- a/src/service_name.json +++ b/src/service_name.json @@ -308,6 +308,11 @@ "Command": "az healthcareapis", "AzureServiceName": "Health Data Services", "URL": "https://learn.microsoft.com/azure/healthcare-apis/healthcare-apis-overview" + }, + { + "Command": "az health-data-ai-services", + "AzureServiceName": "Health Data AI Services", + "URL": "https://learn.microsoft.com/azure/healthcare-apis/healthcare-apis-overview" }, { "Command": "az hpc-cache",