From ef3c8d3652ed011b8b89fb8ea26714b89737803a Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 2 Sep 2026 00:53:34 +0000 Subject: [PATCH] Configurations: 'specification/managedoperations/ManagedOps.Management/tspconfig.yaml', and CommitSHA: '53c0f6efe9872c971e8c365e3b0d41a6bd6efd3d' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6775368 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../azure-mgmt-managedops/CHANGELOG.md | 15 + .../azure-mgmt-managedops/README.md | 6 +- .../azure-mgmt-managedops/_metadata.json | 9 +- sdk/managedops/azure-mgmt-managedops/api.md | 869 ++++++++++++++++++ .../azure-mgmt-managedops/api.metadata.yml | 4 + .../apiview-properties.json | 6 +- .../azure/mgmt/managedops/_client.py | 14 +- .../azure/mgmt/managedops/_configuration.py | 10 +- .../azure/mgmt/managedops/_patch.py | 1 - .../mgmt/managedops/_utils/model_base.py | 614 +++++++++++-- .../mgmt/managedops/_utils/serialization.py | 144 ++- .../azure/mgmt/managedops/_version.py | 2 +- .../azure/mgmt/managedops/aio/_client.py | 14 +- .../mgmt/managedops/aio/_configuration.py | 10 +- .../azure/mgmt/managedops/aio/_patch.py | 1 - .../managedops/aio/operations/_operations.py | 85 +- .../mgmt/managedops/aio/operations/_patch.py | 1 - .../azure/mgmt/managedops/models/__init__.py | 6 + .../azure/mgmt/managedops/models/_enums.py | 16 + .../azure/mgmt/managedops/models/_models.py | 140 ++- .../azure/mgmt/managedops/models/_patch.py | 1 - .../mgmt/managedops/operations/_operations.py | 98 +- .../mgmt/managedops/operations/_patch.py | 1 - .../azure/mgmt/managedops/types.py | 428 +++++++++ .../managed_ops_create_or_update.py | 9 +- .../generated_samples/managed_ops_delete.py | 2 +- .../generated_samples/managed_ops_get.py | 2 +- .../generated_samples/managed_ops_list.py | 2 +- .../generated_samples/managed_ops_update.py | 4 +- .../generated_samples/operations_list.py | 2 +- ...managed_ops_mgmt_managed_ops_operations.py | 33 +- ...d_ops_mgmt_managed_ops_operations_async.py | 38 +- .../azure-mgmt-managedops/pyproject.toml | 4 +- .../azure-mgmt-managedops/tsp-location.yaml | 2 +- 34 files changed, 2358 insertions(+), 235 deletions(-) create mode 100644 sdk/managedops/azure-mgmt-managedops/api.md create mode 100644 sdk/managedops/azure-mgmt-managedops/api.metadata.yml create mode 100644 sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/types.py diff --git a/sdk/managedops/azure-mgmt-managedops/CHANGELOG.md b/sdk/managedops/azure-mgmt-managedops/CHANGELOG.md index ab1c05f2148c..dc9a37322ce1 100644 --- a/sdk/managedops/azure-mgmt-managedops/CHANGELOG.md +++ b/sdk/managedops/azure-mgmt-managedops/CHANGELOG.md @@ -1,5 +1,20 @@ # Release History +## 1.0.0b3 (2026-09-02) + +### Features Added + + - Model `AzureMonitorInformation` added property `error_details` + - Model `ChangeTrackingInformation` added property `error_details` + - Model `DefenderCspmInformation` added property `error_details` + - Model `DefenderForServersInformation` added property `error_details` + - Model `GuestConfigurationInformation` added property `error_details` + - Enum `ProvisioningState` added member `ACCEPTED` + - Model `UpdateManagerInformation` added property `error_details` + - Added model `ErrorDetails` + - Added enum `SkuName` + - Added enum `SkuTier` + ## 1.0.0b2 (2026-03-02) ### Features Added diff --git a/sdk/managedops/azure-mgmt-managedops/README.md b/sdk/managedops/azure-mgmt-managedops/README.md index 4bdc92bb59fa..5b899d4b85d2 100644 --- a/sdk/managedops/azure-mgmt-managedops/README.md +++ b/sdk/managedops/azure-mgmt-managedops/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Managedops Management Client Library. -This package has been tested with Python 3.9+. +This package has been tested with Python 3.10+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.9+ is required to use this package. +- Python 3.10+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. +By default, [Microsoft Entra](https://learn.microsoft.com/entra/fundamentals/what-is-entra) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/managedops/azure-mgmt-managedops/_metadata.json b/sdk/managedops/azure-mgmt-managedops/_metadata.json index 138f5fa7e92b..6198b31e8b43 100644 --- a/sdk/managedops/azure-mgmt-managedops/_metadata.json +++ b/sdk/managedops/azure-mgmt-managedops/_metadata.json @@ -1,10 +1,11 @@ { - "apiVersion": "2025-07-28-preview", + "apiVersion": "2026-01-06-preview", "apiVersions": { - "Microsoft.ManagedOps": "2025-07-28-preview" + "Microsoft.ManagedOps": "2026-01-06-preview" }, - "commit": "5dfb097302f2588f698e3a7c6d31f9194e64a2f9", + "commit": "53c0f6efe9872c971e8c365e3b0d41a6bd6efd3d", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/managedoperations/ManagedOps.Management", - "emitterVersion": "0.60.1" + "emitterVersion": "0.63.5", + "httpClientPythonVersion": "^0.36.0" } \ No newline at end of file diff --git a/sdk/managedops/azure-mgmt-managedops/api.md b/sdk/managedops/azure-mgmt-managedops/api.md new file mode 100644 index 000000000000..de864a00a122 --- /dev/null +++ b/sdk/managedops/azure-mgmt-managedops/api.md @@ -0,0 +1,869 @@ +```py +namespace azure.mgmt.managedops + + class azure.mgmt.managedops.ManagedOpsMgmtClient: implements ContextManager + managed_ops: ManagedOpsOperations + operations: Operations + + def __init__( + self, + credential: TokenCredential, + subscription_id: str, + base_url: Optional[str] = None, + *, + api_version: str = ..., + cloud_setting: Optional[AzureClouds] = ..., + polling_interval: Optional[int] = ..., + **kwargs: Any + ) -> None: ... + + def close(self) -> None: ... + + def send_request( + self, + request: HttpRequest, + *, + stream: bool = False, + **kwargs: Any + ) -> HttpResponse: ... + + +namespace azure.mgmt.managedops.aio + + class azure.mgmt.managedops.aio.ManagedOpsMgmtClient: implements AsyncContextManager + managed_ops: ManagedOpsOperations + operations: Operations + + def __init__( + self, + credential: AsyncTokenCredential, + subscription_id: str, + base_url: Optional[str] = None, + *, + api_version: str = ..., + cloud_setting: Optional[AzureClouds] = ..., + polling_interval: Optional[int] = ..., + **kwargs: Any + ) -> None: ... + + async def close(self) -> None: ... + + def send_request( + self, + request: HttpRequest, + *, + stream: bool = False, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: ... + + +namespace azure.mgmt.managedops.aio.operations + + class azure.mgmt.managedops.aio.operations.ManagedOpsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create_or_update( + self, + managed_ops_name: str, + resource: ManagedOp, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ManagedOp]: ... + + @overload + async def begin_create_or_update( + self, + managed_ops_name: str, + resource: ManagedOp, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ManagedOp]: ... + + @overload + async def begin_create_or_update( + self, + managed_ops_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ManagedOp]: ... + + @distributed_trace_async + async def begin_delete( + self, + managed_ops_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_update( + self, + managed_ops_name: str, + properties: ManagedOpUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ManagedOp]: ... + + @overload + async def begin_update( + self, + managed_ops_name: str, + properties: ManagedOpUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ManagedOp]: ... + + @overload + async def begin_update( + self, + managed_ops_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ManagedOp]: ... + + @distributed_trace_async + async def get( + self, + managed_ops_name: str, + **kwargs: Any + ) -> ManagedOp: ... + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged[ManagedOp]: ... + + + class azure.mgmt.managedops.aio.operations.Operations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged[Operation]: ... + + +namespace azure.mgmt.managedops.models + + class azure.mgmt.managedops.models.ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + INTERNAL = "Internal" + + + class azure.mgmt.managedops.models.AzureMonitorConfiguration(_Model): + azure_monitor_workspace_id: str + + @overload + def __init__( + self, + *, + azure_monitor_workspace_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.AzureMonitorInformation(_Model): + dcr_id: str + enablement_status: Union[str, EnablementState] + error_details: Optional[ErrorDetails] + + @overload + def __init__( + self, + *, + dcr_id: str, + enablement_status: Union[str, EnablementState], + error_details: Optional[ErrorDetails] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.ChangeTrackingConfiguration(_Model): + log_analytics_workspace_id: str + + @overload + def __init__( + self, + *, + log_analytics_workspace_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.ChangeTrackingInformation(_Model): + dcr_id: str + enablement_status: Union[str, EnablementState] + error_details: Optional[ErrorDetails] + + @overload + def __init__( + self, + *, + dcr_id: str, + enablement_status: Union[str, EnablementState], + error_details: Optional[ErrorDetails] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + APPLICATION = "Application" + KEY = "Key" + MANAGED_IDENTITY = "ManagedIdentity" + USER = "User" + + + class azure.mgmt.managedops.models.DefenderCspmInformation(_Model): + enablement_status: Union[str, EnablementState] + error_details: Optional[ErrorDetails] + + @overload + def __init__( + self, + *, + enablement_status: Union[str, EnablementState], + error_details: Optional[ErrorDetails] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.DefenderForServersInformation(_Model): + enablement_status: Union[str, EnablementState] + error_details: Optional[ErrorDetails] + + @overload + def __init__( + self, + *, + enablement_status: Union[str, EnablementState], + error_details: Optional[ErrorDetails] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.DesiredConfiguration(_Model): + azure_monitor_insights: AzureMonitorConfiguration + change_tracking_and_inventory: ChangeTrackingConfiguration + defender_cspm: Optional[Union[str, DesiredEnablementState]] + defender_for_servers: Optional[Union[str, DesiredEnablementState]] + user_assigned_managed_identity_id: str + + @overload + def __init__( + self, + *, + azure_monitor_insights: AzureMonitorConfiguration, + change_tracking_and_inventory: ChangeTrackingConfiguration, + defender_cspm: Optional[Union[str, DesiredEnablementState]] = ..., + defender_for_servers: Optional[Union[str, DesiredEnablementState]] = ..., + user_assigned_managed_identity_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.DesiredConfigurationUpdate(_Model): + defender_cspm: Optional[Union[str, DesiredEnablementState]] + defender_for_servers: Optional[Union[str, DesiredEnablementState]] + + @overload + def __init__( + self, + *, + defender_cspm: Optional[Union[str, DesiredEnablementState]] = ..., + defender_for_servers: Optional[Union[str, DesiredEnablementState]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.DesiredEnablementState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DISABLE = "Disable" + ENABLE = "Enable" + + + class azure.mgmt.managedops.models.EnablementState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DISABLED = "Disabled" + ENABLED = "Enabled" + FAILED = "Failed" + IN_PROGRESS = "InProgress" + + + class azure.mgmt.managedops.models.ErrorAdditionalInfo(_Model): + info: Optional[Any] + type: Optional[str] + + + class azure.mgmt.managedops.models.ErrorDetail(_Model): + additional_info: Optional[list[ErrorAdditionalInfo]] + code: Optional[str] + details: Optional[list[ErrorDetail]] + message: Optional[str] + target: Optional[str] + + + class azure.mgmt.managedops.models.ErrorDetails(_Model): + code: str + message: str + + @overload + def __init__( + self, + *, + code: str, + message: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.ErrorResponse(_Model): + error: Optional[ErrorDetail] + + @overload + def __init__( + self, + *, + error: Optional[ErrorDetail] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.GuestConfigurationInformation(_Model): + enablement_status: Union[str, EnablementState] + error_details: Optional[ErrorDetails] + + @overload + def __init__( + self, + *, + enablement_status: Union[str, EnablementState], + error_details: Optional[ErrorDetails] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.ManagedOp(ProxyResource): + id: str + name: str + properties: Optional[ManagedOpsProperties] + system_data: SystemData + type: str + + @overload + def __init__( + self, + *, + properties: Optional[ManagedOpsProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.ManagedOpUpdate(_Model): + properties: Optional[ManagedOpUpdateProperties] + + @overload + def __init__( + self, + *, + properties: Optional[ManagedOpUpdateProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.ManagedOpUpdateProperties(_Model): + desired_configuration: Optional[DesiredConfigurationUpdate] + + @overload + def __init__( + self, + *, + desired_configuration: Optional[DesiredConfigurationUpdate] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.ManagedOpsProperties(_Model): + desired_configuration: DesiredConfiguration + policy_assignment_properties: Optional[PolicyAssignmentProperties] + provisioning_state: Optional[Union[str, ProvisioningState]] + services: Optional[ServiceInformation] + sku: Optional[Sku] + + @overload + def __init__( + self, + *, + desired_configuration: DesiredConfiguration, + sku: Optional[Sku] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.Operation(_Model): + action_type: Optional[Union[str, ActionType]] + display: Optional[OperationDisplay] + is_data_action: Optional[bool] + name: Optional[str] + origin: Optional[Union[str, Origin]] + + @overload + def __init__( + self, + *, + display: Optional[OperationDisplay] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.OperationDisplay(_Model): + description: Optional[str] + operation: Optional[str] + provider: Optional[str] + resource: Optional[str] + + + class azure.mgmt.managedops.models.Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + SYSTEM = "system" + USER = "user" + USER_SYSTEM = "user,system" + + + class azure.mgmt.managedops.models.PolicyAssignmentProperties(_Model): + policy_initiative_assignment_id: str + + @overload + def __init__( + self, + *, + policy_initiative_assignment_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ACCEPTED = "Accepted" + CANCELED = "Canceled" + DELETING = "Deleting" + FAILED = "Failed" + PROVISIONING = "Provisioning" + SUCCEEDED = "Succeeded" + + + class azure.mgmt.managedops.models.ProxyResource(Resource): + id: str + name: str + system_data: SystemData + type: str + + + class azure.mgmt.managedops.models.Resource(_Model): + id: Optional[str] + name: Optional[str] + system_data: Optional[SystemData] + type: Optional[str] + + + class azure.mgmt.managedops.models.ServiceInformation(_Model): + azure_monitor_insights: Optional[AzureMonitorInformation] + azure_policy_and_machine_configuration: Optional[GuestConfigurationInformation] + azure_update_manager: Optional[UpdateManagerInformation] + change_tracking_and_inventory: Optional[ChangeTrackingInformation] + defender_cspm: Optional[DefenderCspmInformation] + defender_for_servers: Optional[DefenderForServersInformation] + + + class azure.mgmt.managedops.models.Sku(_Model): + name: Union[str, SkuName] + tier: Union[str, SkuTier] + + @overload + def __init__( + self, + *, + name: Union[str, SkuName], + tier: Union[str, SkuTier] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + MANAGED_OPS = "ManagedOps" + + + class azure.mgmt.managedops.models.SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ESSENTIAL = "Essential" + + + class azure.mgmt.managedops.models.SystemData(_Model): + created_at: Optional[datetime] + created_by: Optional[str] + created_by_type: Optional[Union[str, CreatedByType]] + last_modified_at: Optional[datetime] + last_modified_by: Optional[str] + last_modified_by_type: Optional[Union[str, CreatedByType]] + + @overload + def __init__( + self, + *, + created_at: Optional[datetime] = ..., + created_by: Optional[str] = ..., + created_by_type: Optional[Union[str, CreatedByType]] = ..., + last_modified_at: Optional[datetime] = ..., + last_modified_by: Optional[str] = ..., + last_modified_by_type: Optional[Union[str, CreatedByType]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.managedops.models.UpdateManagerInformation(_Model): + enablement_status: Union[str, EnablementState] + error_details: Optional[ErrorDetails] + + @overload + def __init__( + self, + *, + enablement_status: Union[str, EnablementState], + error_details: Optional[ErrorDetails] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + +namespace azure.mgmt.managedops.operations + + class azure.mgmt.managedops.operations.ManagedOpsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create_or_update( + self, + managed_ops_name: str, + resource: ManagedOp, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ManagedOp]: ... + + @overload + def begin_create_or_update( + self, + managed_ops_name: str, + resource: ManagedOp, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ManagedOp]: ... + + @overload + def begin_create_or_update( + self, + managed_ops_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ManagedOp]: ... + + @distributed_trace + def begin_delete( + self, + managed_ops_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_update( + self, + managed_ops_name: str, + properties: ManagedOpUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ManagedOp]: ... + + @overload + def begin_update( + self, + managed_ops_name: str, + properties: ManagedOpUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ManagedOp]: ... + + @overload + def begin_update( + self, + managed_ops_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ManagedOp]: ... + + @distributed_trace + def get( + self, + managed_ops_name: str, + **kwargs: Any + ) -> ManagedOp: ... + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged[ManagedOp]: ... + + + class azure.mgmt.managedops.operations.Operations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged[Operation]: ... + + +namespace azure.mgmt.managedops.types + + class azure.mgmt.managedops.types.AzureMonitorConfiguration(TypedDict, total=False): + key "azureMonitorWorkspaceId": Required[str] + azureMonitorWorkspaceId: str + + + class azure.mgmt.managedops.types.AzureMonitorInformation(TypedDict, total=False): + key "dcrId": Required[str] + key "enablementStatus": Required[Union[str, EnablementState]] + key "errorDetails": ForwardRef('ErrorDetails', module='types') + dcrId: str + enablementStatus: Union[str, EnablementState] + errorDetails: ErrorDetails + + + class azure.mgmt.managedops.types.ChangeTrackingConfiguration(TypedDict, total=False): + key "logAnalyticsWorkspaceId": Required[str] + logAnalyticsWorkspaceId: str + + + class azure.mgmt.managedops.types.ChangeTrackingInformation(TypedDict, total=False): + key "dcrId": Required[str] + key "enablementStatus": Required[Union[str, EnablementState]] + key "errorDetails": ForwardRef('ErrorDetails', module='types') + dcrId: str + enablementStatus: Union[str, EnablementState] + errorDetails: ErrorDetails + + + class azure.mgmt.managedops.types.DefenderCspmInformation(TypedDict, total=False): + key "enablementStatus": Required[Union[str, EnablementState]] + key "errorDetails": ForwardRef('ErrorDetails', module='types') + enablementStatus: Union[str, EnablementState] + errorDetails: ErrorDetails + + + class azure.mgmt.managedops.types.DefenderForServersInformation(TypedDict, total=False): + key "enablementStatus": Required[Union[str, EnablementState]] + key "errorDetails": ForwardRef('ErrorDetails', module='types') + enablementStatus: Union[str, EnablementState] + errorDetails: ErrorDetails + + + class azure.mgmt.managedops.types.DesiredConfiguration(TypedDict, total=False): + key "azureMonitorInsights": Required[AzureMonitorConfiguration] + key "changeTrackingAndInventory": Required[ChangeTrackingConfiguration] + key "defenderCspm": Union[str, DesiredEnablementState] + key "defenderForServers": Union[str, DesiredEnablementState] + key "userAssignedManagedIdentityId": Required[str] + azureMonitorInsights: AzureMonitorConfiguration + changeTrackingAndInventory: ChangeTrackingConfiguration + defenderCspm: Union[str, DesiredEnablementState] + defenderForServers: Union[str, DesiredEnablementState] + userAssignedManagedIdentityId: str + + + class azure.mgmt.managedops.types.DesiredConfigurationUpdate(TypedDict, total=False): + key "defenderCspm": Union[str, DesiredEnablementState] + key "defenderForServers": Union[str, DesiredEnablementState] + defenderCspm: Union[str, DesiredEnablementState] + defenderForServers: Union[str, DesiredEnablementState] + + + class azure.mgmt.managedops.types.ErrorDetails(TypedDict, total=False): + key "code": Required[str] + key "message": Required[str] + code: str + message: str + + + class azure.mgmt.managedops.types.GuestConfigurationInformation(TypedDict, total=False): + key "enablementStatus": Required[Union[str, EnablementState]] + key "errorDetails": ForwardRef('ErrorDetails', module='types') + enablementStatus: Union[str, EnablementState] + errorDetails: ErrorDetails + + + class azure.mgmt.managedops.types.ManagedOp(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('ManagedOpsProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: ManagedOpsProperties + systemData: SystemData + type: str + + + class azure.mgmt.managedops.types.ManagedOpUpdate(TypedDict, total=False): + key "properties": ForwardRef('ManagedOpUpdateProperties', module='types') + properties: ManagedOpUpdateProperties + + + class azure.mgmt.managedops.types.ManagedOpUpdateProperties(TypedDict, total=False): + key "desiredConfiguration": ForwardRef('DesiredConfigurationUpdate', module='types') + desiredConfiguration: DesiredConfigurationUpdate + + + class azure.mgmt.managedops.types.ManagedOpsProperties(TypedDict, total=False): + key "desiredConfiguration": Required[DesiredConfiguration] + key "policyAssignmentProperties": ForwardRef('PolicyAssignmentProperties', module='types') + key "provisioningState": Union[str, ProvisioningState] + key "services": ForwardRef('ServiceInformation', module='types') + key "sku": ForwardRef('Sku', module='types') + desiredConfiguration: DesiredConfiguration + policyAssignmentProperties: PolicyAssignmentProperties + provisioningState: Union[str, ProvisioningState] + services: ServiceInformation + sku: Sku + + + class azure.mgmt.managedops.types.PolicyAssignmentProperties(TypedDict, total=False): + key "policyInitiativeAssignmentId": Required[str] + policyInitiativeAssignmentId: str + + + class azure.mgmt.managedops.types.ProxyResource(Resource): + key "id": str + key "name": str + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + systemData: SystemData + type: str + + + class azure.mgmt.managedops.types.Resource(TypedDict, total=False): + key "id": str + key "name": str + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + systemData: SystemData + type: str + + + class azure.mgmt.managedops.types.ServiceInformation(TypedDict, total=False): + key "azureMonitorInsights": ForwardRef('AzureMonitorInformation', module='types') + key "azurePolicyAndMachineConfiguration": ForwardRef('GuestConfigurationInformation', module='types') + key "azureUpdateManager": ForwardRef('UpdateManagerInformation', module='types') + key "changeTrackingAndInventory": ForwardRef('ChangeTrackingInformation', module='types') + key "defenderCspm": ForwardRef('DefenderCspmInformation', module='types') + key "defenderForServers": ForwardRef('DefenderForServersInformation', module='types') + azureMonitorInsights: AzureMonitorInformation + azurePolicyAndMachineConfiguration: GuestConfigurationInformation + azureUpdateManager: UpdateManagerInformation + changeTrackingAndInventory: ChangeTrackingInformation + defenderCspm: DefenderCspmInformation + defenderForServers: DefenderForServersInformation + + + class azure.mgmt.managedops.types.Sku(TypedDict, total=False): + key "name": Required[Union[str, SkuName]] + key "tier": Required[Union[str, SkuTier]] + name: Union[str, SkuName] + tier: Union[str, SkuTier] + + + class azure.mgmt.managedops.types.SystemData(TypedDict, total=False): + key "createdAt": str + key "createdBy": str + key "createdByType": Union[str, CreatedByType] + key "lastModifiedAt": str + key "lastModifiedBy": str + key "lastModifiedByType": Union[str, CreatedByType] + createdAt: str + createdBy: str + createdByType: Union[str, CreatedByType] + lastModifiedAt: str + lastModifiedBy: str + lastModifiedByType: Union[str, CreatedByType] + + + class azure.mgmt.managedops.types.UpdateManagerInformation(TypedDict, total=False): + key "enablementStatus": Required[Union[str, EnablementState]] + key "errorDetails": ForwardRef('ErrorDetails', module='types') + enablementStatus: Union[str, EnablementState] + errorDetails: ErrorDetails + + +``` \ No newline at end of file diff --git a/sdk/managedops/azure-mgmt-managedops/api.metadata.yml b/sdk/managedops/azure-mgmt-managedops/api.metadata.yml new file mode 100644 index 000000000000..fd14bc173abc --- /dev/null +++ b/sdk/managedops/azure-mgmt-managedops/api.metadata.yml @@ -0,0 +1,4 @@ +apiMdSha256: 221e814ade7238b8b46caf679e4ba468e93564528767ed12a2705d32522d0553 +packageVersion: 1.0.0b3 +parserVersion: 0.3.31 +pythonVersion: 3.13.15 diff --git a/sdk/managedops/azure-mgmt-managedops/apiview-properties.json b/sdk/managedops/azure-mgmt-managedops/apiview-properties.json index f38ced93a164..f02d8b096739 100644 --- a/sdk/managedops/azure-mgmt-managedops/apiview-properties.json +++ b/sdk/managedops/azure-mgmt-managedops/apiview-properties.json @@ -11,6 +11,7 @@ "azure.mgmt.managedops.models.DesiredConfigurationUpdate": "Microsoft.ManagedOps.DesiredConfigurationUpdate", "azure.mgmt.managedops.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", "azure.mgmt.managedops.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.managedops.models.ErrorDetails": "Microsoft.ManagedOps.ErrorDetails", "azure.mgmt.managedops.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", "azure.mgmt.managedops.models.GuestConfigurationInformation": "Microsoft.ManagedOps.GuestConfigurationInformation", "azure.mgmt.managedops.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", @@ -29,6 +30,8 @@ "azure.mgmt.managedops.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", "azure.mgmt.managedops.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", "azure.mgmt.managedops.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.managedops.models.SkuName": "Microsoft.ManagedOps.SkuName", + "azure.mgmt.managedops.models.SkuTier": "Microsoft.ManagedOps.SkuTier", "azure.mgmt.managedops.models.ProvisioningState": "Microsoft.ManagedOps.ProvisioningState", "azure.mgmt.managedops.models.DesiredEnablementState": "Microsoft.ManagedOps.DesiredEnablementState", "azure.mgmt.managedops.models.EnablementState": "Microsoft.ManagedOps.EnablementState", @@ -44,5 +47,6 @@ "azure.mgmt.managedops.aio.operations.ManagedOpsOperations.begin_update": "Microsoft.ManagedOps.ManagedOps.update", "azure.mgmt.managedops.operations.ManagedOpsOperations.begin_delete": "Microsoft.ManagedOps.ManagedOps.delete", "azure.mgmt.managedops.aio.operations.ManagedOpsOperations.begin_delete": "Microsoft.ManagedOps.ManagedOps.delete" - } + }, + "CrossLanguageVersion": "88add912d73c" } \ No newline at end of file diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_client.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_client.py index 4ee1404f64d8..6743054cf81a 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_client.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,12 +21,17 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ManagedOpsOperations, Operations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class ManagedOpsMgmtClient: +class ManagedOpsMgmtClient: # pylint: disable=docstring-keyword-should-match-keyword-only """Managed Operations API. :ivar operations: Operations operations @@ -43,8 +48,9 @@ class ManagedOpsMgmtClient: None. :paramtype cloud_setting: ~azure.core.AzureClouds :keyword api_version: The API version to use for this operation. Known values are - "2025-07-28-preview" and None. Default value is "2025-07-28-preview". Note that overriding this - default value may result in unsupported behavior. + "2026-01-06-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_configuration.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_configuration.py index 84e81c8b0201..335defce4dc0 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_configuration.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_configuration.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -18,7 +19,7 @@ from azure.core.credentials import TokenCredential -class ManagedOpsMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes +class ManagedOpsMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Configuration for ManagedOpsMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -34,8 +35,9 @@ class ManagedOpsMgmtClientConfiguration: # pylint: disable=too-many-instance-at None. :type cloud_setting: ~azure.core.AzureClouds :keyword api_version: The API version to use for this operation. Known values are - "2025-07-28-preview" and None. Default value is "2025-07-28-preview". Note that overriding this - default value may result in unsupported behavior. + "2026-01-06-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ @@ -47,7 +49,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-07-28-preview") + api_version: str = kwargs.pop("api_version", "2026-01-06-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_patch.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_patch.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_utils/model_base.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_utils/model_base.py index c402af2afc63..35d5fc024978 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_utils/model_base.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -104,6 +109,29 @@ def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: return encoded +def _serialize_duration(td: timedelta, format: typing.Optional[str] = None): + """Serialize a timedelta to its wire representation. + + For the ``seconds``/``milliseconds`` encodings the value is converted to a + numeric value, otherwise it falls back to an ISO 8601 duration string. + + :param timedelta td: The timedelta to serialize. + :param str format: The duration encoding format. + :rtype: int or float or str + :return: serialized duration + """ + seconds = td.total_seconds() + if format == "duration-seconds-int": + return int(seconds) + if format == "duration-seconds-float": + return seconds + if format == "duration-milliseconds-int": + return int(seconds * 1000) + if format == "duration-milliseconds-float": + return seconds * 1000 + return _timedelta_as_isostr(td) + + def _serialize_datetime(o, format: typing.Optional[str] = None): if hasattr(o, "year") and hasattr(o, "hour"): if format == "rfc7231": @@ -130,7 +158,15 @@ def _is_readonly(p): class SdkJSONEncoder(JSONEncoder): - """A JSON encoder that's capable of serializing datetime objects and bytes.""" + """A JSON encoder that's capable of serializing datetime objects and bytes. + + :param args: Additional positional arguments passed to the base ``JSONEncoder``. + :type args: typing.Any + :keyword exclude_readonly: Whether to exclude readonly properties. Defaults to False. + :paramtype exclude_readonly: bool + :keyword format: The format to use for serialization. Defaults to None. + :paramtype format: typing.Optional[str] + """ def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): super().__init__(*args, **kwargs) @@ -296,6 +332,12 @@ def _deserialize_duration(attr): return isodate.parse_duration(attr) +def _deserialize_duration_numeric(attr, unit): + if isinstance(attr, timedelta): + return attr + return timedelta(**{unit: float(attr)}) + + def _deserialize_decimal(attr): if isinstance(attr, decimal.Decimal): return attr @@ -308,6 +350,12 @@ def _deserialize_int_as_str(attr): return int(attr) +def _deserialize_bool_as_str(attr): + if isinstance(attr, bool): + return attr + return attr.lower() == "true" + + _DESERIALIZE_MAPPING = { datetime: _deserialize_datetime, date: _deserialize_date, @@ -325,12 +373,18 @@ def _deserialize_int_as_str(attr): "unix-timestamp": _deserialize_datetime_unix_timestamp, "base64": _deserialize_bytes, "base64url": _deserialize_bytes_base64, + "duration-seconds-int": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-seconds-float": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-milliseconds-int": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), + "duration-milliseconds-float": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), } def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): if annotation is int and rf and rf._format == "str": return _deserialize_int_as_str + if annotation is bool and rf and rf._format == "str": + return _deserialize_bool_as_str if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) if rf and rf._format: @@ -420,21 +474,21 @@ def __ne__(self, other: typing.Any) -> bool: def keys(self) -> typing.KeysView[str]: """ - :returns: a set-like object providing a view on D's keys + :returns: a set-like object providing a view on the mapping's keys :rtype: ~typing.KeysView """ return self._data.keys() def values(self) -> typing.ValuesView[typing.Any]: """ - :returns: an object providing a view on D's values + :returns: an object providing a view on the mapping's values :rtype: ~typing.ValuesView """ return self._data.values() def items(self) -> typing.ItemsView[str, typing.Any]: """ - :returns: set-like object providing a view on D's items + :returns: a set-like object providing a view on the mapping's items :rtype: ~typing.ItemsView """ return self._data.items() @@ -444,7 +498,7 @@ def get(self, key: str, default: typing.Any = None) -> typing.Any: Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None - :returns: D[k] if k in D, else d. + :returns: The value for key if key is in the dictionary, else default. :rtype: any """ try: @@ -479,19 +533,19 @@ def popitem(self) -> tuple[str, typing.Any]: Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple - :raises KeyError: if D is empty. + :raises KeyError: if the dictionary is empty. """ return self._data.popitem() def clear(self) -> None: """ - Remove all items from D. + Remove all items from the dictionary. """ self._data.clear() def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ """ - Updates D from mapping/iterable E and F. + Update the dictionary from a mapping or an iterable of key-value pairs. :param any args: Either a mapping object or an iterable of key-value pairs. """ self._data.update(*args, **kwargs) @@ -504,10 +558,11 @@ def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: """ - Same as calling D.get(k, d), and setting D[k]=d if k not found + Return the value for key if key is in the dictionary; otherwise set the key to + default and return default. :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary - :returns: D[k] if k in D, else d. + :returns: The value for key if key is in the dictionary, else default. :rtype: any """ if default is _UNSET: @@ -515,6 +570,8 @@ def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: return self._data.setdefault(key, default) def __eq__(self, other: typing.Any) -> bool: + if isinstance(other, _MyMutableMapping): + return self._data == other._data try: other_model = self.__class__(other) except Exception: @@ -557,7 +614,7 @@ def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-m pass # Last, try datetime.timedelta try: - return _timedelta_as_isostr(o) + return _serialize_duration(o, format) except AttributeError: # This will be raised when it hits value.total_seconds in the method above pass @@ -583,6 +640,239 @@ def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typin return _serialize(value, rf._format) +# ============================================================================ +# Fast-path scalar deserializer functions for rest_field(deserializer=...) +# These are referenced from rest_field declarations to bypass the generic +# _deserialize -> _deserialize_with_callable chain. +# Only simple/primitive types — no models or container types. +# ============================================================================ + + +def _xml_deser_str(value): + if isinstance(value, ET.Element): + return value.text or "" + return str(value) if value is not None else None + + +def _xml_deser_int(value): + if isinstance(value, ET.Element): + return int(value.text) if value.text else None + return int(value) if value is not None else None + + +def _xml_deser_float(value): + if isinstance(value, ET.Element): + return float(value.text) if value.text else None + return float(value) if value is not None else None + + +def _xml_deser_bool(value): + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + if text in (True, False): + return text + return text.lower() == "true" + + +# pylint: disable=docstring-missing-param +def _xml_deser_bytes(value): + """Deserialize bytes from XML (base64).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes(text) + + +def _xml_deser_bytes_base64url(value): + """Deserialize bytes from XML (base64url).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes_base64(text) + + +def _xml_deser_datetime(value): + """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime(text) + + +def _xml_deser_datetime_rfc7231(value): + """Deserialize a datetime from XML (RFC7231 format).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_rfc7231(text) + + +def _xml_deser_datetime_unix_timestamp(value): + """Deserialize a datetime from XML (Unix timestamp).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_unix_timestamp(float(text)) + + +def _xml_deser_date(value): + """Deserialize a date from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_date(text) + + +def _xml_deser_time(value): + """Deserialize a time from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_time(text) + + +def _xml_deser_duration(value): + """Deserialize a timedelta from XML (ISO 8601 duration).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_duration(text) + + +def _xml_deser_decimal(value): + """Deserialize a Decimal from XML.""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_decimal(text) + + +def _xml_deser_enum_or_str(enum_cls, value): + """Deserialize a Union[EnumType, str] from XML.""" + text = value.text if isinstance(value, ET.Element) else value + if text is None: + return None + try: + return enum_cls(text) + except ValueError: + return text + + +def _extract_xml_model_type(rf_type): + """Extract the concrete Model class from a resolved rf._type partial chain. + + Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` + wrappers. Only handles Model and Optional[Model] — other composite + types (List, Dict, Union, etc.) return None and fall through to the + generic ``_deserialize`` path at runtime. + """ + if rf_type is None: + return None + if isinstance(rf_type, type) and _is_model(rf_type): + return rf_type + if not isinstance(rf_type, functools.partial): + return None + func = rf_type.func + args = rf_type.args + if func is _deserialize_with_optional and args: + return _extract_xml_model_type(args[0]) + if func is _deserialize_model and args: + cls = args[0] + return cls if isinstance(cls, type) and _is_model(cls) else None + return None + + +def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable + cls, attr_to_rest_field: dict +) -> list: + """Build a precomputed XML field plan for fast _init_from_xml iteration. + + Called once per model class in __new__. Returns a list of tuples: + (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) + + kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text + + For Model and Optional[Model] fields that lack a scalar + ``_deserializer``, this function precomputes the Model class as the + deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` + directly instead of going through the expensive + ``_get_deserialize_callable_from_annotation`` chain at runtime. + """ + model_meta = getattr(cls, "_xml", {}) + model_ns = model_meta.get("ns") or model_meta.get("namespace") + plan = [] + + for rf in attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + deser = rf._deserializer + + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + is_optional = rf._is_optional + + # For Model / Optional[Model] fields without a scalar deserializer, + # precompute the Model class as the deserializer. + if deser is None and rf._type is not None: + model_cls = _extract_xml_model_type(rf._type) + if model_cls is not None: + deser = model_cls + + if prop_meta.get("attribute", False): + plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) + elif prop_meta.get("unwrapped", False): + items_name = prop_meta.get("itemsName") + if items_name: + items_ns = prop_meta.get("itemsNs") + if items_ns is not None: + xml_ns = items_ns + if xml_ns: + items_name = "{" + xml_ns + "}" + items_name + else: + items_name = xml_name + plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) + elif prop_meta.get("text", False): + plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) + else: + plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) + + return plan + + +# pylint: enable=docstring-missing-param class Model(_MyMutableMapping): _is_model = True # label whether current class's _attr_to_rest_field has been calculated @@ -593,59 +883,10 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } - if args: # pylint: disable=too-many-nested-blocks + dict_to_pass: dict[str, typing.Any] = {} + if args: if isinstance(args[0], ET.Element): - existed_attr_keys = [] - model_meta = getattr(self, "_xml", {}) - - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - # unwrapped array could either use prop items meta/prop meta - if prop_meta.get("itemsName"): - xml_name = prop_meta.get("itemsName") - xml_ns = prop_meta.get("itemNs") - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = args[0].findall(xml_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) - continue - - # text element is primitive type - if prop_meta.get("text", False): - if args[0].text is not None: - dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) - continue - - # wrapped element could be normal property or array, it should only have one element - item = args[0].find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) - - # rest thing is additional properties - for e in args[0]: - if e.tag not in existed_attr_keys: - dict_to_pass[e.tag] = _convert_element(e) + dict_to_pass.update(self._init_from_xml(args[0])) else: dict_to_pass.update( {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} @@ -662,8 +903,117 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: if v is not None } ) + # Apply client default values for fields the caller didn't set so that + # defaults are part of `_data` and therefore included during serialization. + for rf in self._attr_to_rest_field.values(): + if rf._default is _UNSET: + continue + if rf._rest_name in dict_to_pass: + continue + dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) super().__init__(dict_to_pass) + def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements + self, element: ET.Element + ) -> dict[str, typing.Any]: + """Deserialize an XML element into a dict mapping rest field names to values. + + :param ET.Element element: The XML element to deserialize from. + :returns: A dictionary of rest_name to deserialized value pairs. + :rtype: dict + """ + result: dict[str, typing.Any] = {} + existed_attr_keys: list[str] = [] + + field_plan = getattr(self, "_xml_field_plan", None) + if field_plan: + for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: + if kind == 0: # wrapped element (most common) + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(item) + else: + result[rest_name] = _deserialize(rf_type, item) + elif kind == 1: # attribute + attr_val = element.get(xml_name) + if attr_val is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(attr_val) + else: + result[rest_name] = attr_val + elif kind == 2: # unwrapped array + items = element.findall(items_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(items_name) + if deser: + result[rest_name] = deser(items) + else: + result[rest_name] = _deserialize(rf_type, items) + elif not is_optional: + existed_attr_keys.append(items_name) + result[rest_name] = [] + elif kind == 3: # text + if element.text is not None: + if deser: + result[rest_name] = deser(element.text) + else: + result[rest_name] = element.text + else: + model_meta = getattr(self, "_xml", {}) + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and element.get(xml_name) is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + _items_name = prop_meta.get("itemsName") + if _items_name: + xml_name = _items_name + _items_ns = prop_meta.get("itemsNs") + if _items_ns is not None: + xml_ns = _items_ns + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = element.findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if element.text is not None: + result[rf._rest_name] = _deserialize(rf._type, element.text) + continue + + # wrapped element could be normal property or array + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in element: + if e.tag not in existed_attr_keys: + result[e.tag] = _convert_element(e) + + return result + def copy(self) -> "Model": return Model(self.__dict__) @@ -688,6 +1038,9 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: if not rf._rest_name_input: rf._rest_name_input = attr cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + # Build XML field plan for fast _init_from_xml (only for XML models) + if getattr(cls, "_xml", None): + cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") return super().__new__(cls) @@ -716,7 +1069,7 @@ def _deserialize(cls, data, exist_discriminators): model_meta = getattr(cls, "_xml", {}) prop_meta = getattr(discriminator, "_xml", {}) xml_name = prop_meta.get("name", discriminator._rest_name) - xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) if xml_ns: xml_name = "{" + xml_ns + "}" + xml_name @@ -889,6 +1242,8 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur # is it optional? try: if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if rf: + rf._is_optional = True if len(annotation.__args__) <= 2: # pyright: ignore if_obj_deserializer = _get_deserialize_callable_from_annotation( next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore @@ -981,16 +1336,20 @@ def _deserialize_with_callable( return float(value.text) if value.text else None if deserializer is bool: return value.text == "true" if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) if value.text else None if deserializer is None: return value if deserializer in [int, float, bool]: return deserializer(value) if isinstance(deserializer, CaseInsensitiveEnumMeta): try: - return deserializer(value) + return deserializer(value.text if isinstance(value, ET.Element) else value) except ValueError: # for unknown value, return raw value - return value + return value.text if isinstance(value, ET.Element) else value if isinstance(deserializer, type) and issubclass(deserializer, Model): return deserializer._deserialize(value, []) return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) @@ -1043,6 +1402,7 @@ def _failsafe_deserialize_xml( return None +# pylint: disable=too-many-instance-attributes class _RestField: def __init__( self, @@ -1055,6 +1415,7 @@ def __init__( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, ): self._type = type self._rest_name_input = name @@ -1062,10 +1423,12 @@ def __init__( self._is_discriminator = is_discriminator self._visibility = visibility self._is_model = False + self._is_optional = False self._default = default self._format = format self._is_multipart_file_input = is_multipart_file_input self._xml = xml if xml is not None else {} + self._deserializer = deserializer @property def _class_type(self) -> typing.Any: @@ -1085,7 +1448,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: @@ -1098,7 +1464,11 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # Return the value from _data directly (it's been deserialized in place) return obj._data.get(self._rest_name) - deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) + if self._deserializer: + deserialized = self._deserializer(item) + else: + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) # For mutable types, store the deserialized value back in _data # so mutations directly affect _data @@ -1144,6 +1514,7 @@ def rest_field( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, ) -> typing.Any: return _RestField( name=name, @@ -1153,6 +1524,7 @@ def rest_field( format=format, is_multipart_file_input=is_multipart_file_input, xml=xml, + deserializer=deserializer, ) @@ -1177,6 +1549,56 @@ def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore +def _get_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: + """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. + + :param dict meta: The metadata dictionary to extract namespace from. + :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. + :rtype: str or None + """ + ns = meta.get("ns") + if ns is None: + ns = meta.get("namespace") + return ns + + +def _resolve_xml_ns( + prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None +) -> typing.Optional[str]: + """Resolve XML namespace for a property, falling back to model namespace when appropriate. + + Checks the property metadata first; if no namespace is found and the model does not declare + an explicit prefix, falls back to the model-level namespace. + + :param dict prop_meta: The property metadata dictionary. + :param dict model_meta: The model metadata dictionary, used as fallback. + :returns: The resolved namespace string, or None. + :rtype: str or None + """ + ns = _get_xml_ns(prop_meta) + if ns is None and model_meta is not None and not model_meta.get("prefix"): + ns = _get_xml_ns(model_meta) + return ns + + +def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: + """Set an XML attribute on an element, handling namespace prefix registration. + + :param ET.Element element: The element to set the attribute on. + :param str name: The default attribute name (wire name). + :param any value: The attribute value. + :param dict prop_meta: The property metadata dictionary. + """ + xml_name = prop_meta.get("name", name) + _attr_ns = _get_xml_ns(prop_meta) + if _attr_ns: + _attr_prefix = prop_meta.get("prefix") + if _attr_prefix: + _safe_register_namespace(_attr_prefix, _attr_ns) + xml_name = "{" + _attr_ns + "}" + xml_name + element.set(xml_name, _get_primitive_type_value(value)) + + def _get_element( o: typing.Any, exclude_readonly: bool = False, @@ -1188,10 +1610,16 @@ def _get_element( # if prop is a model, then use the prop element directly, else generate a wrapper of model if wrapped_element is None: + # When serializing as an array item (parent_meta is set), check if the parent has an + # explicit itemsName. This ensures correct element names for unwrapped arrays (where + # the element tag is the property/items name, not the model type name). + _items_name = parent_meta.get("itemsName") if parent_meta is not None else None + element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) + _model_ns = _get_xml_ns(model_meta) wrapped_element = _create_xml_element( - model_meta.get("name", o.__class__.__name__), + element_name, model_meta.get("prefix"), - model_meta.get("ns"), + _model_ns, ) readonly_props = [] @@ -1213,7 +1641,9 @@ def _get_element( # additional properties will not have rest field, use the wire name as xml name prop_meta = {"name": k} - # if no ns for prop, use model's + # Propagate model namespace to properties only for old-style "ns"-keyed models. + # DPG-generated models use the "namespace" key and explicitly declare namespace on + # each property that needs it, so propagation is intentionally skipped for them. if prop_meta.get("ns") is None and model_meta.get("ns"): prop_meta["ns"] = model_meta.get("ns") prop_meta["prefix"] = model_meta.get("prefix") @@ -1225,12 +1655,7 @@ def _get_element( # text could only set on primitive type wrapped_element.text = _get_primitive_type_value(v) elif prop_meta.get("attribute", False): - xml_name = prop_meta.get("name", k) - if prop_meta.get("ns"): - ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore - xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore - # attribute should be primitive type - wrapped_element.set(xml_name, _get_primitive_type_value(v)) + _set_xml_attribute(wrapped_element, k, v, prop_meta) else: # other wrapped prop element wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) @@ -1239,6 +1664,7 @@ def _get_element( return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore if isinstance(o, dict): result = [] + _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None for k, v in o.items(): result.append( _get_wrapped_element( @@ -1246,7 +1672,7 @@ def _get_element( exclude_readonly, { "name": k, - "ns": parent_meta.get("ns") if parent_meta else None, + "ns": _dict_ns, "prefix": parent_meta.get("prefix") if parent_meta else None, }, ) @@ -1255,13 +1681,16 @@ def _get_element( # primitive case need to create element based on parent_meta if parent_meta: + _items_ns = parent_meta.get("itemsNs") + if _items_ns is None: + _items_ns = _get_xml_ns(parent_meta) return _get_wrapped_element( o, exclude_readonly, { "name": parent_meta.get("itemsName", parent_meta.get("name")), "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), - "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + "ns": _items_ns, }, ) @@ -1273,8 +1702,9 @@ def _get_wrapped_element( exclude_readonly: bool, meta: typing.Optional[dict[str, typing.Any]], ) -> ET.Element: + _meta_ns = _get_xml_ns(meta) if meta else None wrapped_element = _create_xml_element( - meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns ) if isinstance(v, (dict, list)): wrapped_element.extend(_get_element(v, exclude_readonly, meta)) @@ -1295,11 +1725,29 @@ def _get_primitive_type_value(v) -> str: return str(v) +def _safe_register_namespace(prefix: str, ns: str) -> None: + """Register an XML namespace prefix, handling reserved prefix patterns. + + Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for + auto-generated prefixes, causing register_namespace to raise ValueError. + Falls back to directly registering in the internal namespace map. + + :param str prefix: The namespace prefix to register. + :param str ns: The namespace URI. + """ + try: + ET.register_namespace(prefix, ns) + except ValueError: + _ns_map = getattr(ET, "_namespace_map", None) + if _ns_map is not None: + _ns_map[ns] = prefix + + def _create_xml_element( tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None ) -> ET.Element: if prefix and ns: - ET.register_namespace(prefix, ns) + _safe_register_namespace(prefix, ns) if ns: return ET.Element("{" + ns + "}" + tag) return ET.Element(tag) @@ -1310,6 +1758,8 @@ def _deserialize_xml( value: str, ) -> typing.Any: element = ET.fromstring(value) # nosec + if _is_model(deserializer): + return deserializer._deserialize(element, []) return _deserialize(deserializer, element) diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_utils/serialization.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_utils/serialization.py index 81ec1de5922b..ae08f9d89f74 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_utils/serialization.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] @@ -476,7 +480,11 @@ def _decode_attribute_map_key(key): class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" + """Request object model serializer. + + :param classes: Mapping of model names to model types, used to resolve models during serialization. + :type classes: typing.Optional[typing.Mapping[str, type]] + """ basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -516,6 +524,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "rfc-1123": Serializer.serialize_rfc, "unix-time": Serializer.serialize_unix, "duration": Serializer.serialize_duration, + "duration-seconds-int": Serializer.serialize_duration_seconds_int, + "duration-seconds-float": Serializer.serialize_duration_seconds_float, + "duration-milliseconds-int": Serializer.serialize_duration_milliseconds_int, + "duration-milliseconds-float": Serializer.serialize_duration_milliseconds_float, "date": Serializer.serialize_date, "time": Serializer.serialize_time, "decimal": Serializer.serialize_decimal, @@ -1105,6 +1117,61 @@ def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) + @staticmethod + def _serialize_duration_numeric(attr, scale, as_int): + """Serialize a TimeDelta into a numeric value scaled to the wire unit. + + :param TimeDelta attr: Object to be serialized. + :param int scale: Multiplier applied to total seconds (1 for seconds, 1000 for milliseconds). + :param bool as_int: Whether to truncate the result to an int. + :rtype: int or float + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + value = attr.total_seconds() * scale if isinstance(attr, datetime.timedelta) else attr + return int(value) if as_int else float(value) + + @staticmethod + def serialize_duration_seconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, True) + + @staticmethod + def serialize_duration_seconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, False) + + @staticmethod + def serialize_duration_milliseconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, True) + + @staticmethod + def serialize_duration_milliseconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, False) + @staticmethod def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. @@ -1377,6 +1444,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "rfc-1123": Deserializer.deserialize_rfc, "unix-time": Deserializer.deserialize_unix, "duration": Deserializer.deserialize_duration, + "duration-seconds-int": Deserializer.deserialize_duration_seconds, + "duration-seconds-float": Deserializer.deserialize_duration_seconds, + "duration-milliseconds-int": Deserializer.deserialize_duration_milliseconds, + "duration-milliseconds-float": Deserializer.deserialize_duration_milliseconds, "date": Deserializer.deserialize_date, "time": Deserializer.deserialize_time, "decimal": Deserializer.deserialize_decimal, @@ -1389,6 +1460,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: } self.deserialize_expected_types = { "duration": (isodate.Duration, datetime.timedelta), + "duration-seconds-int": (isodate.Duration, datetime.timedelta), + "duration-seconds-float": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-int": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-float": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } self.dependencies: dict[str, type] = dict(classes) if classes else {} @@ -1401,7 +1476,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: # Otherwise, result are unexpected self.additional_properties_detection = True - def __call__(self, target_obj, response_data, content_type=None): + def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements """Call the deserializer to process a REST response. :param str target_obj: Target data type to deserialize to. @@ -1411,6 +1486,27 @@ def __call__(self, target_obj, response_data, content_type=None): :return: Deserialized object. :rtype: object """ + # Fast path for header deserialization: response_data is a plain str or None + # and target_obj is a simple scalar type. This avoids the expensive + # _unpack_content → _deserialize → _classify_target → deserialize_data chain. + if response_data is None: + return None + if target_obj == "str" and isinstance(response_data, str): + return response_data + if isinstance(response_data, str): + if target_obj == "int": + return int(response_data) + if target_obj == "bool": + if response_data in ("true", "1", "True"): + return True + if response_data in ("false", "0", "False"): + return False + return bool(response_data) + if target_obj == "rfc-1123": + return Deserializer.deserialize_rfc(response_data) + if target_obj == "bytearray": + return Deserializer.deserialize_bytearray(response_data) + data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) @@ -1929,6 +2025,48 @@ def deserialize_duration(attr): raise DeserializationError(msg) from err return duration + @staticmethod + def _deserialize_duration_numeric(attr, unit): + """Deserialize a numeric duration value into a TimeDelta object. + + :param float attr: response value to be deserialized. + :param str unit: The wire unit, used as the ``timedelta`` keyword + (``"seconds"`` or ``"milliseconds"``). + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = datetime.timedelta(**{unit: float(attr)}) # type: ignore + except (ValueError, OverflowError, TypeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_duration_seconds(attr): + """Deserialize a numeric number of seconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "seconds") + + @staticmethod + def deserialize_duration_milliseconds(attr): + """Deserialize a numeric number of milliseconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "milliseconds") + @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_version.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_version.py index bbcd28b4aa67..c43fdbc2e239 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_version.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0b3" diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/_client.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/_client.py index b020f0067cba..b0b0ffa3f3e3 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/_client.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,12 +21,17 @@ from ._configuration import ManagedOpsMgmtClientConfiguration from .operations import ManagedOpsOperations, Operations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class ManagedOpsMgmtClient: +class ManagedOpsMgmtClient: # pylint: disable=docstring-keyword-should-match-keyword-only """Managed Operations API. :ivar operations: Operations operations @@ -43,8 +48,9 @@ class ManagedOpsMgmtClient: None. :paramtype cloud_setting: ~azure.core.AzureClouds :keyword api_version: The API version to use for this operation. Known values are - "2025-07-28-preview" and None. Default value is "2025-07-28-preview". Note that overriding this - default value may result in unsupported behavior. + "2026-01-06-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/_configuration.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/_configuration.py index 363f7b4c5b4f..944546546205 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/_configuration.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/_configuration.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -18,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class ManagedOpsMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes +class ManagedOpsMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Configuration for ManagedOpsMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -34,8 +35,9 @@ class ManagedOpsMgmtClientConfiguration: # pylint: disable=too-many-instance-at None. :type cloud_setting: ~azure.core.AzureClouds :keyword api_version: The API version to use for this operation. Known values are - "2025-07-28-preview" and None. Default value is "2025-07-28-preview". Note that overriding this - default value may result in unsupported behavior. + "2026-01-06-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ @@ -47,7 +49,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-07-28-preview") + api_version: str = kwargs.pop("api_version", "2026-01-06-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/_patch.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/_patch.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/operations/_operations.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/operations/_operations.py index 83d7a3401aad..7ea27fa17a79 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/operations/_operations.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/operations/_operations.py @@ -32,7 +32,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models as _models +from ... import models as _models, types as _types from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Deserializer, Serializer from ...operations._operations import ( @@ -47,11 +47,10 @@ T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] List = list -class Operations: +class Operations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -115,7 +114,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -128,7 +130,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -155,7 +160,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class ManagedOpsOperations: +class ManagedOpsOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -207,6 +212,7 @@ async def get(self, managed_ops_name: str, **kwargs: Any) -> _models.ManagedOp: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -228,7 +234,7 @@ async def get(self, managed_ops_name: str, **kwargs: Any) -> _models.ManagedOp: raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.ManagedOp, response.json()) @@ -238,7 +244,7 @@ async def get(self, managed_ops_name: str, **kwargs: Any) -> _models.ManagedOp: return deserialized # type: ignore async def _create_or_update_initial( - self, managed_ops_name: str, resource: Union[_models.ManagedOp, JSON, IO[bytes]], **kwargs: Any + self, managed_ops_name: str, resource: Union[_models.ManagedOp, _types.ManagedOp, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -275,6 +281,7 @@ async def _create_or_update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -301,7 +308,7 @@ async def _create_or_update_initial( ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -334,14 +341,19 @@ async def begin_create_or_update( @overload async def begin_create_or_update( - self, managed_ops_name: str, resource: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + managed_ops_name: str, + resource: _types.ManagedOp, + *, + content_type: str = "application/json", + **kwargs: Any ) -> AsyncLROPoller[_models.ManagedOp]: """Creates or updates the ManagedOps instance. :param managed_ops_name: Name of the resource. Required. :type managed_ops_name: str :param resource: Resource create parameters. Required. - :type resource: JSON + :type resource: ~azure.mgmt.managedops.types.ManagedOp :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -372,15 +384,16 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, managed_ops_name: str, resource: Union[_models.ManagedOp, JSON, IO[bytes]], **kwargs: Any + self, managed_ops_name: str, resource: Union[_models.ManagedOp, _types.ManagedOp, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ManagedOp]: """Creates or updates the ManagedOps instance. :param managed_ops_name: Name of the resource. Required. :type managed_ops_name: str - :param resource: Resource create parameters. Is one of the following types: ManagedOp, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.managedops.models.ManagedOp or JSON or IO[bytes] + :param resource: Resource create parameters. Is either a ManagedOp type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.managedops.models.ManagedOp or + ~azure.mgmt.managedops.types.ManagedOp or IO[bytes] :return: An instance of AsyncLROPoller that returns ManagedOp. The ManagedOp is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managedops.models.ManagedOp] @@ -485,7 +498,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -498,7 +514,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ManagedOp], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.ManagedOp], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -525,7 +544,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) async def _update_initial( - self, managed_ops_name: str, properties: Union[_models.ManagedOpUpdate, JSON, IO[bytes]], **kwargs: Any + self, + managed_ops_name: str, + properties: Union[_models.ManagedOpUpdate, _types.ManagedOpUpdate, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -562,6 +584,7 @@ async def _update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -586,7 +609,7 @@ async def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -619,14 +642,19 @@ async def begin_update( @overload async def begin_update( - self, managed_ops_name: str, properties: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + managed_ops_name: str, + properties: _types.ManagedOpUpdate, + *, + content_type: str = "application/json", + **kwargs: Any ) -> AsyncLROPoller[_models.ManagedOp]: """Updates the ManagedOps instance with the supplied fields. :param managed_ops_name: Name of the resource. Required. :type managed_ops_name: str :param properties: The resource properties to be updated. Required. - :type properties: JSON + :type properties: ~azure.mgmt.managedops.types.ManagedOpUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -657,15 +685,19 @@ async def begin_update( @distributed_trace_async async def begin_update( - self, managed_ops_name: str, properties: Union[_models.ManagedOpUpdate, JSON, IO[bytes]], **kwargs: Any + self, + managed_ops_name: str, + properties: Union[_models.ManagedOpUpdate, _types.ManagedOpUpdate, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.ManagedOp]: """Updates the ManagedOps instance with the supplied fields. :param managed_ops_name: Name of the resource. Required. :type managed_ops_name: str - :param properties: The resource properties to be updated. Is one of the following types: - ManagedOpUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.managedops.models.ManagedOpUpdate or JSON or IO[bytes] + :param properties: The resource properties to be updated. Is either a ManagedOpUpdate type or a + IO[bytes] type. Required. + :type properties: ~azure.mgmt.managedops.models.ManagedOpUpdate or + ~azure.mgmt.managedops.types.ManagedOpUpdate or IO[bytes] :return: An instance of AsyncLROPoller that returns ManagedOp. The ManagedOp is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.managedops.models.ManagedOp] @@ -748,6 +780,7 @@ async def _delete_initial(self, managed_ops_name: str, **kwargs: Any) -> AsyncIt } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -772,7 +805,7 @@ async def _delete_initial(self, managed_ops_name: str, **kwargs: Any) -> AsyncIt response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/operations/_patch.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/operations/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/operations/_patch.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/__init__.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/__init__.py index a3ee877a07e2..8bbf06144079 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/__init__.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/__init__.py @@ -24,6 +24,7 @@ DesiredConfigurationUpdate, ErrorAdditionalInfo, ErrorDetail, + ErrorDetails, ErrorResponse, GuestConfigurationInformation, ManagedOp, @@ -48,6 +49,8 @@ EnablementState, Origin, ProvisioningState, + SkuName, + SkuTier, ) from ._patch import __all__ as _patch_all from ._patch import * @@ -64,6 +67,7 @@ "DesiredConfigurationUpdate", "ErrorAdditionalInfo", "ErrorDetail", + "ErrorDetails", "ErrorResponse", "GuestConfigurationInformation", "ManagedOp", @@ -85,6 +89,8 @@ "EnablementState", "Origin", "ProvisioningState", + "SkuName", + "SkuTier", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/_enums.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/_enums.py index 04ec60563ad1..072798b514e3 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/_enums.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/_enums.py @@ -80,3 +80,19 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The resource has begun provisioning.""" DELETING = "Deleting" """The resource is being deleted.""" + ACCEPTED = "Accepted" + """The resource has been accepted for provisioning.""" + + +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The name of the SKU.""" + + MANAGED_OPS = "ManagedOps" + """ManagedOps SKU.""" + + +class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The pricing tier of the SKU.""" + + ESSENTIAL = "Essential" + """Essential tier.""" diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/_models.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/_models.py index 5db0b9193396..12a3f78e32d3 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/_models.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/_models.py @@ -17,7 +17,7 @@ from .. import models as _models -class AzureMonitorConfiguration(_Model): +class AzureMonitorConfiguration(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Configuration for the Azure Monitor Insights service. :ivar azure_monitor_workspace_id: Azure monitor workspace resource ID used by the service. @@ -48,7 +48,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AzureMonitorInformation(_Model): +class AzureMonitorInformation(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Azure Monitor Insights service information. :ivar dcr_id: ID of Data Collection Rule (DCR) associated with this service. Required. @@ -56,6 +56,8 @@ class AzureMonitorInformation(_Model): :ivar enablement_status: Indicates whether the service is enabled. Required. Known values are: "Enabled", "InProgress", "Failed", and "Disabled". :vartype enablement_status: str or ~azure.mgmt.managedops.models.EnablementState + :ivar error_details: Optional error message if the service is in Failed state. + :vartype error_details: ~azure.mgmt.managedops.models.ErrorDetails """ dcr_id: str = rest_field(name="dcrId", visibility=["read", "create", "update", "delete", "query"]) @@ -65,6 +67,10 @@ class AzureMonitorInformation(_Model): ) """Indicates whether the service is enabled. Required. Known values are: \"Enabled\", \"InProgress\", \"Failed\", and \"Disabled\".""" + error_details: Optional["_models.ErrorDetails"] = rest_field( + name="errorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional error message if the service is in Failed state.""" @overload def __init__( @@ -72,6 +78,7 @@ def __init__( *, dcr_id: str, enablement_status: Union[str, "_models.EnablementState"], + error_details: Optional["_models.ErrorDetails"] = None, ) -> None: ... @overload @@ -85,7 +92,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ChangeTrackingConfiguration(_Model): +class ChangeTrackingConfiguration(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Configuration for the Change Tracking and Inventory service. :ivar log_analytics_workspace_id: Log analytics workspace resource ID used by the service. @@ -116,7 +123,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ChangeTrackingInformation(_Model): +class ChangeTrackingInformation(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Change Tracking and Inventory service information. :ivar dcr_id: ID of Data Collection Rule (DCR) associated with this service. Required. @@ -124,6 +131,8 @@ class ChangeTrackingInformation(_Model): :ivar enablement_status: Indicates whether the service is enabled. Required. Known values are: "Enabled", "InProgress", "Failed", and "Disabled". :vartype enablement_status: str or ~azure.mgmt.managedops.models.EnablementState + :ivar error_details: Optional error message if the service is in Failed state. + :vartype error_details: ~azure.mgmt.managedops.models.ErrorDetails """ dcr_id: str = rest_field(name="dcrId", visibility=["read", "create", "update", "delete", "query"]) @@ -133,6 +142,10 @@ class ChangeTrackingInformation(_Model): ) """Indicates whether the service is enabled. Required. Known values are: \"Enabled\", \"InProgress\", \"Failed\", and \"Disabled\".""" + error_details: Optional["_models.ErrorDetails"] = rest_field( + name="errorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional error message if the service is in Failed state.""" @overload def __init__( @@ -140,6 +153,7 @@ def __init__( *, dcr_id: str, enablement_status: Union[str, "_models.EnablementState"], + error_details: Optional["_models.ErrorDetails"] = None, ) -> None: ... @overload @@ -153,12 +167,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DefenderCspmInformation(_Model): +class DefenderCspmInformation(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Defender Cloud Security Posture Management (CSPM) service information. :ivar enablement_status: Indicates whether the service is enabled. Required. Known values are: "Enabled", "InProgress", "Failed", and "Disabled". :vartype enablement_status: str or ~azure.mgmt.managedops.models.EnablementState + :ivar error_details: Optional error message if the service is in Failed state. + :vartype error_details: ~azure.mgmt.managedops.models.ErrorDetails """ enablement_status: Union[str, "_models.EnablementState"] = rest_field( @@ -166,12 +182,17 @@ class DefenderCspmInformation(_Model): ) """Indicates whether the service is enabled. Required. Known values are: \"Enabled\", \"InProgress\", \"Failed\", and \"Disabled\".""" + error_details: Optional["_models.ErrorDetails"] = rest_field( + name="errorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional error message if the service is in Failed state.""" @overload def __init__( self, *, enablement_status: Union[str, "_models.EnablementState"], + error_details: Optional["_models.ErrorDetails"] = None, ) -> None: ... @overload @@ -185,12 +206,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DefenderForServersInformation(_Model): +class DefenderForServersInformation(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Defender for Servers service information. :ivar enablement_status: Indicates whether the service is enabled. Required. Known values are: "Enabled", "InProgress", "Failed", and "Disabled". :vartype enablement_status: str or ~azure.mgmt.managedops.models.EnablementState + :ivar error_details: Optional error message if the service is in Failed state. + :vartype error_details: ~azure.mgmt.managedops.models.ErrorDetails """ enablement_status: Union[str, "_models.EnablementState"] = rest_field( @@ -198,12 +221,17 @@ class DefenderForServersInformation(_Model): ) """Indicates whether the service is enabled. Required. Known values are: \"Enabled\", \"InProgress\", \"Failed\", and \"Disabled\".""" + error_details: Optional["_models.ErrorDetails"] = rest_field( + name="errorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional error message if the service is in Failed state.""" @overload def __init__( self, *, enablement_status: Union[str, "_models.EnablementState"], + error_details: Optional["_models.ErrorDetails"] = None, ) -> None: ... @overload @@ -217,7 +245,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DesiredConfiguration(_Model): +class DesiredConfiguration(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Desired configuration input by the user. :ivar change_tracking_and_inventory: Configuration for the Change Tracking and Inventory @@ -283,7 +311,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DesiredConfigurationUpdate(_Model): +class DesiredConfigurationUpdate(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Updatable parameters in the Desired configuration input. :ivar defender_for_servers: Desired enablement state of the Defender For Servers service. Known @@ -368,7 +396,40 @@ class ErrorDetail(_Model): """The error additional info.""" -class ErrorResponse(_Model): +class ErrorDetails(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Details of an error encountered during enabling a service. + + :ivar code: Error code. Required. + :vartype code: str + :ivar message: Detailed error message. Required. + :vartype message: str + """ + + code: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error code. Required.""" + message: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Detailed error message. Required.""" + + @overload + def __init__( + self, + *, + code: str, + message: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorResponse(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Error response. :ivar error: The error object. @@ -396,12 +457,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GuestConfigurationInformation(_Model): +class GuestConfigurationInformation(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Azure Policy and Machine Configuration service information. :ivar enablement_status: Indicates whether the service is enabled. Required. Known values are: "Enabled", "InProgress", "Failed", and "Disabled". :vartype enablement_status: str or ~azure.mgmt.managedops.models.EnablementState + :ivar error_details: Optional error message if the service is in Failed state. + :vartype error_details: ~azure.mgmt.managedops.models.ErrorDetails """ enablement_status: Union[str, "_models.EnablementState"] = rest_field( @@ -409,12 +472,17 @@ class GuestConfigurationInformation(_Model): ) """Indicates whether the service is enabled. Required. Known values are: \"Enabled\", \"InProgress\", \"Failed\", and \"Disabled\".""" + error_details: Optional["_models.ErrorDetails"] = rest_field( + name="errorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional error message if the service is in Failed state.""" @overload def __init__( self, *, enablement_status: Union[str, "_models.EnablementState"], + error_details: Optional["_models.ErrorDetails"] = None, ) -> None: ... @overload @@ -473,7 +541,7 @@ class ProxyResource(Resource): """ -class ManagedOp(ProxyResource): +class ManagedOp(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """The Managed Operations resource. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -514,13 +582,13 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ManagedOpsProperties(_Model): +class ManagedOpsProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Properties of the ManagedOps resource. :ivar sku: Product plan details of this resource. :vartype sku: ~azure.mgmt.managedops.models.Sku :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", and "Deleting". + "Failed", "Canceled", "Provisioning", "Deleting", and "Accepted". :vartype provisioning_state: str or ~azure.mgmt.managedops.models.ProvisioningState :ivar desired_configuration: Desired configuration input by the user. Required. :vartype desired_configuration: ~azure.mgmt.managedops.models.DesiredConfiguration @@ -530,13 +598,13 @@ class ManagedOpsProperties(_Model): :vartype policy_assignment_properties: ~azure.mgmt.managedops.models.PolicyAssignmentProperties """ - sku: Optional["_models.Sku"] = rest_field(visibility=["read"]) + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create"]) """Product plan details of this resource.""" provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( name="provisioningState", visibility=["read"] ) """Provisioning state of the resource. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", - \"Provisioning\", and \"Deleting\".""" + \"Provisioning\", \"Deleting\", and \"Accepted\".""" desired_configuration: "_models.DesiredConfiguration" = rest_field( name="desiredConfiguration", visibility=["read", "create", "update"] ) @@ -553,6 +621,7 @@ def __init__( self, *, desired_configuration: "_models.DesiredConfiguration", + sku: Optional["_models.Sku"] = None, ) -> None: ... @overload @@ -566,7 +635,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ManagedOpUpdate(_Model): +class ManagedOpUpdate(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """ManagedOps model for update operations. :ivar properties: Updatable properties in the ManagedOps resource. @@ -596,7 +665,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ManagedOpUpdateProperties(_Model): +class ManagedOpUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Updatable properties in the ManagedOps resource. :ivar desired_configuration: Desired configuration input by the user. @@ -626,7 +695,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Operation(_Model): +class Operation(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """REST API Operation. :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: @@ -714,7 +783,7 @@ class OperationDisplay(_Model): views.""" -class PolicyAssignmentProperties(_Model): +class PolicyAssignmentProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Policy assignments created for managing services. :ivar policy_initiative_assignment_id: Policy initiative assignment ID. Required. @@ -788,26 +857,26 @@ class ServiceInformation(_Model): """Defender for Cloud's Cloud security posture management (CSPM) service information.""" -class Sku(_Model): +class Sku(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies the service plan for this resource. - :ivar name: Name of the SKU. Required. - :vartype name: str - :ivar tier: Pricing tier of the SKU. Required. - :vartype tier: str + :ivar name: Name of the SKU. Required. "ManagedOps" + :vartype name: str or ~azure.mgmt.managedops.models.SkuName + :ivar tier: Pricing tier of the SKU. Required. "Essential" + :vartype tier: str or ~azure.mgmt.managedops.models.SkuTier """ - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Name of the SKU. Required.""" - tier: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Pricing tier of the SKU. Required.""" + name: Union[str, "_models.SkuName"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the SKU. Required. \"ManagedOps\"""" + tier: Union[str, "_models.SkuTier"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Pricing tier of the SKU. Required. \"Essential\"""" @overload def __init__( self, *, - name: str, - tier: str, + name: Union[str, "_models.SkuName"], + tier: Union[str, "_models.SkuTier"], ) -> None: ... @overload @@ -821,7 +890,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SystemData(_Model): +class SystemData(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. @@ -888,12 +957,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class UpdateManagerInformation(_Model): +class UpdateManagerInformation(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Azure Update Manager service information. :ivar enablement_status: Indicates whether the service is enabled. Required. Known values are: "Enabled", "InProgress", "Failed", and "Disabled". :vartype enablement_status: str or ~azure.mgmt.managedops.models.EnablementState + :ivar error_details: Optional error message if the service is in Failed state. + :vartype error_details: ~azure.mgmt.managedops.models.ErrorDetails """ enablement_status: Union[str, "_models.EnablementState"] = rest_field( @@ -901,12 +972,17 @@ class UpdateManagerInformation(_Model): ) """Indicates whether the service is enabled. Required. Known values are: \"Enabled\", \"InProgress\", \"Failed\", and \"Disabled\".""" + error_details: Optional["_models.ErrorDetails"] = rest_field( + name="errorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional error message if the service is in Failed state.""" @overload def __init__( self, *, enablement_status: Union[str, "_models.EnablementState"], + error_details: Optional["_models.ErrorDetails"] = None, ) -> None: ... @overload diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/_patch.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/_patch.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/operations/_operations.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/operations/_operations.py index ce5ea4bedca5..d9b4e2427244 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/operations/_operations.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -31,14 +32,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models as _models +from .. import models as _models, types as _types from .._configuration import ManagedOpsMgmtClientConfiguration from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] List = list _SERIALIZER = Serializer() @@ -49,7 +49,7 @@ def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-28-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +68,7 @@ def build_managed_ops_get_request(managed_ops_name: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-28-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def build_managed_ops_create_or_update_request( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-28-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +123,7 @@ def build_managed_ops_list_request(subscription_id: str, **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-28-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,7 +148,7 @@ def build_managed_ops_update_request(managed_ops_name: str, subscription_id: str _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-28-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -174,7 +174,7 @@ def build_managed_ops_update_request(managed_ops_name: str, subscription_id: str def build_managed_ops_delete_request(managed_ops_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-28-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-06-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName}" path_format_arguments = { @@ -190,7 +190,7 @@ def build_managed_ops_delete_request(managed_ops_name: str, subscription_id: str return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -class Operations: +class Operations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -254,7 +254,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -267,7 +270,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -294,7 +300,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class ManagedOpsOperations: +class ManagedOpsOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -346,6 +352,7 @@ def get(self, managed_ops_name: str, **kwargs: Any) -> _models.ManagedOp: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -367,7 +374,7 @@ def get(self, managed_ops_name: str, **kwargs: Any) -> _models.ManagedOp: raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.ManagedOp, response.json()) @@ -377,7 +384,7 @@ def get(self, managed_ops_name: str, **kwargs: Any) -> _models.ManagedOp: return deserialized # type: ignore def _create_or_update_initial( - self, managed_ops_name: str, resource: Union[_models.ManagedOp, JSON, IO[bytes]], **kwargs: Any + self, managed_ops_name: str, resource: Union[_models.ManagedOp, _types.ManagedOp, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -414,6 +421,7 @@ def _create_or_update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -440,7 +448,7 @@ def _create_or_update_initial( ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -473,14 +481,19 @@ def begin_create_or_update( @overload def begin_create_or_update( - self, managed_ops_name: str, resource: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + managed_ops_name: str, + resource: _types.ManagedOp, + *, + content_type: str = "application/json", + **kwargs: Any ) -> LROPoller[_models.ManagedOp]: """Creates or updates the ManagedOps instance. :param managed_ops_name: Name of the resource. Required. :type managed_ops_name: str :param resource: Resource create parameters. Required. - :type resource: JSON + :type resource: ~azure.mgmt.managedops.types.ManagedOp :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -511,15 +524,16 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, managed_ops_name: str, resource: Union[_models.ManagedOp, JSON, IO[bytes]], **kwargs: Any + self, managed_ops_name: str, resource: Union[_models.ManagedOp, _types.ManagedOp, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ManagedOp]: """Creates or updates the ManagedOps instance. :param managed_ops_name: Name of the resource. Required. :type managed_ops_name: str - :param resource: Resource create parameters. Is one of the following types: ManagedOp, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.managedops.models.ManagedOp or JSON or IO[bytes] + :param resource: Resource create parameters. Is either a ManagedOp type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.managedops.models.ManagedOp or + ~azure.mgmt.managedops.types.ManagedOp or IO[bytes] :return: An instance of LROPoller that returns ManagedOp. The ManagedOp is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managedops.models.ManagedOp] @@ -624,7 +638,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -637,7 +654,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ManagedOp], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.ManagedOp], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -664,7 +684,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) def _update_initial( - self, managed_ops_name: str, properties: Union[_models.ManagedOpUpdate, JSON, IO[bytes]], **kwargs: Any + self, + managed_ops_name: str, + properties: Union[_models.ManagedOpUpdate, _types.ManagedOpUpdate, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -701,6 +724,7 @@ def _update_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -725,7 +749,7 @@ def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -758,14 +782,19 @@ def begin_update( @overload def begin_update( - self, managed_ops_name: str, properties: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + managed_ops_name: str, + properties: _types.ManagedOpUpdate, + *, + content_type: str = "application/json", + **kwargs: Any ) -> LROPoller[_models.ManagedOp]: """Updates the ManagedOps instance with the supplied fields. :param managed_ops_name: Name of the resource. Required. :type managed_ops_name: str :param properties: The resource properties to be updated. Required. - :type properties: JSON + :type properties: ~azure.mgmt.managedops.types.ManagedOpUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -796,15 +825,19 @@ def begin_update( @distributed_trace def begin_update( - self, managed_ops_name: str, properties: Union[_models.ManagedOpUpdate, JSON, IO[bytes]], **kwargs: Any + self, + managed_ops_name: str, + properties: Union[_models.ManagedOpUpdate, _types.ManagedOpUpdate, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.ManagedOp]: """Updates the ManagedOps instance with the supplied fields. :param managed_ops_name: Name of the resource. Required. :type managed_ops_name: str - :param properties: The resource properties to be updated. Is one of the following types: - ManagedOpUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.managedops.models.ManagedOpUpdate or JSON or IO[bytes] + :param properties: The resource properties to be updated. Is either a ManagedOpUpdate type or a + IO[bytes] type. Required. + :type properties: ~azure.mgmt.managedops.models.ManagedOpUpdate or + ~azure.mgmt.managedops.types.ManagedOpUpdate or IO[bytes] :return: An instance of LROPoller that returns ManagedOp. The ManagedOp is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.managedops.models.ManagedOp] @@ -887,6 +920,7 @@ def _delete_initial(self, managed_ops_name: str, **kwargs: Any) -> Iterator[byte } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -911,7 +945,7 @@ def _delete_initial(self, managed_ops_name: str, **kwargs: Any) -> Iterator[byte response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/operations/_patch.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/operations/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/operations/_patch.py +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/types.py b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/types.py new file mode 100644 index 000000000000..0874367a2a01 --- /dev/null +++ b/sdk/managedops/azure-mgmt-managedops/azure/mgmt/managedops/types.py @@ -0,0 +1,428 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING, Union +from typing_extensions import Required, TypedDict + +if TYPE_CHECKING: + from .models import CreatedByType, DesiredEnablementState, EnablementState, ProvisioningState, SkuName, SkuTier + + +class AzureMonitorConfiguration(TypedDict, total=False): + """Configuration for the Azure Monitor Insights service. + + :ivar azureMonitorWorkspaceId: Azure monitor workspace resource ID used by the service. + Required. + :vartype azureMonitorWorkspaceId: str + """ + + azureMonitorWorkspaceId: Required[str] + """Azure monitor workspace resource ID used by the service. Required.""" + + +class AzureMonitorInformation(TypedDict, total=False): + """Azure Monitor Insights service information. + + :ivar dcrId: ID of Data Collection Rule (DCR) associated with this service. Required. + :vartype dcrId: str + :ivar enablementStatus: Indicates whether the service is enabled. Required. Known values are: + "Enabled", "InProgress", "Failed", and "Disabled". + :vartype enablementStatus: Union[str, "EnablementState"] + :ivar errorDetails: Optional error message if the service is in Failed state. + :vartype errorDetails: "ErrorDetails" + """ + + dcrId: Required[str] + """ID of Data Collection Rule (DCR) associated with this service. Required.""" + enablementStatus: Required[Union[str, "EnablementState"]] + """Indicates whether the service is enabled. Required. Known values are: \"Enabled\", + \"InProgress\", \"Failed\", and \"Disabled\".""" + errorDetails: "ErrorDetails" + """Optional error message if the service is in Failed state.""" + + +class ChangeTrackingConfiguration(TypedDict, total=False): + """Configuration for the Change Tracking and Inventory service. + + :ivar logAnalyticsWorkspaceId: Log analytics workspace resource ID used by the service. + Required. + :vartype logAnalyticsWorkspaceId: str + """ + + logAnalyticsWorkspaceId: Required[str] + """Log analytics workspace resource ID used by the service. Required.""" + + +class ChangeTrackingInformation(TypedDict, total=False): + """Change Tracking and Inventory service information. + + :ivar dcrId: ID of Data Collection Rule (DCR) associated with this service. Required. + :vartype dcrId: str + :ivar enablementStatus: Indicates whether the service is enabled. Required. Known values are: + "Enabled", "InProgress", "Failed", and "Disabled". + :vartype enablementStatus: Union[str, "EnablementState"] + :ivar errorDetails: Optional error message if the service is in Failed state. + :vartype errorDetails: "ErrorDetails" + """ + + dcrId: Required[str] + """ID of Data Collection Rule (DCR) associated with this service. Required.""" + enablementStatus: Required[Union[str, "EnablementState"]] + """Indicates whether the service is enabled. Required. Known values are: \"Enabled\", + \"InProgress\", \"Failed\", and \"Disabled\".""" + errorDetails: "ErrorDetails" + """Optional error message if the service is in Failed state.""" + + +class DefenderCspmInformation(TypedDict, total=False): + """Defender Cloud Security Posture Management (CSPM) service information. + + :ivar enablementStatus: Indicates whether the service is enabled. Required. Known values are: + "Enabled", "InProgress", "Failed", and "Disabled". + :vartype enablementStatus: Union[str, "EnablementState"] + :ivar errorDetails: Optional error message if the service is in Failed state. + :vartype errorDetails: "ErrorDetails" + """ + + enablementStatus: Required[Union[str, "EnablementState"]] + """Indicates whether the service is enabled. Required. Known values are: \"Enabled\", + \"InProgress\", \"Failed\", and \"Disabled\".""" + errorDetails: "ErrorDetails" + """Optional error message if the service is in Failed state.""" + + +class DefenderForServersInformation(TypedDict, total=False): + """Defender for Servers service information. + + :ivar enablementStatus: Indicates whether the service is enabled. Required. Known values are: + "Enabled", "InProgress", "Failed", and "Disabled". + :vartype enablementStatus: Union[str, "EnablementState"] + :ivar errorDetails: Optional error message if the service is in Failed state. + :vartype errorDetails: "ErrorDetails" + """ + + enablementStatus: Required[Union[str, "EnablementState"]] + """Indicates whether the service is enabled. Required. Known values are: \"Enabled\", + \"InProgress\", \"Failed\", and \"Disabled\".""" + errorDetails: "ErrorDetails" + """Optional error message if the service is in Failed state.""" + + +class DesiredConfiguration(TypedDict, total=False): + """Desired configuration input by the user. + + :ivar changeTrackingAndInventory: Configuration for the Change Tracking and Inventory service. + Required. + :vartype changeTrackingAndInventory: "ChangeTrackingConfiguration" + :ivar azureMonitorInsights: Configuration for the Azure Monitor Insights service. Required. + :vartype azureMonitorInsights: "AzureMonitorConfiguration" + :ivar userAssignedManagedIdentityId: User assigned Managed Identity used to perform operations + on machines managed by Ops360. Required. + :vartype userAssignedManagedIdentityId: str + :ivar defenderForServers: Desired enablement state of the Defender For Servers service. Known + values are: "Enable" and "Disable". + :vartype defenderForServers: Union[str, "DesiredEnablementState"] + :ivar defenderCspm: Desired enablement state of the Defender Cloud Security Posture Management + (CSPM) service. Known values are: "Enable" and "Disable". + :vartype defenderCspm: Union[str, "DesiredEnablementState"] + """ + + changeTrackingAndInventory: Required["ChangeTrackingConfiguration"] + """Configuration for the Change Tracking and Inventory service. Required.""" + azureMonitorInsights: Required["AzureMonitorConfiguration"] + """Configuration for the Azure Monitor Insights service. Required.""" + userAssignedManagedIdentityId: Required[str] + """User assigned Managed Identity used to perform operations on machines managed by Ops360. + Required.""" + defenderForServers: Union[str, "DesiredEnablementState"] + """Desired enablement state of the Defender For Servers service. Known values are: \"Enable\" and + \"Disable\".""" + defenderCspm: Union[str, "DesiredEnablementState"] + """Desired enablement state of the Defender Cloud Security Posture Management (CSPM) service. + Known values are: \"Enable\" and \"Disable\".""" + + +class DesiredConfigurationUpdate(TypedDict, total=False): + """Updatable parameters in the Desired configuration input. + + :ivar defenderForServers: Desired enablement state of the Defender For Servers service. Known + values are: "Enable" and "Disable". + :vartype defenderForServers: Union[str, "DesiredEnablementState"] + :ivar defenderCspm: Desired enablement state of the Defender Cloud Security Posture Management + (CSPM) service. Known values are: "Enable" and "Disable". + :vartype defenderCspm: Union[str, "DesiredEnablementState"] + """ + + defenderForServers: Union[str, "DesiredEnablementState"] + """Desired enablement state of the Defender For Servers service. Known values are: \"Enable\" and + \"Disable\".""" + defenderCspm: Union[str, "DesiredEnablementState"] + """Desired enablement state of the Defender Cloud Security Posture Management (CSPM) service. + Known values are: \"Enable\" and \"Disable\".""" + + +class ErrorDetails(TypedDict, total=False): + """Details of an error encountered during enabling a service. + + :ivar code: Error code. Required. + :vartype code: str + :ivar message: Detailed error message. Required. + :vartype message: str + """ + + code: Required[str] + """Error code. Required.""" + message: Required[str] + """Detailed error message. Required.""" + + +class GuestConfigurationInformation(TypedDict, total=False): + """Azure Policy and Machine Configuration service information. + + :ivar enablementStatus: Indicates whether the service is enabled. Required. Known values are: + "Enabled", "InProgress", "Failed", and "Disabled". + :vartype enablementStatus: Union[str, "EnablementState"] + :ivar errorDetails: Optional error message if the service is in Failed state. + :vartype errorDetails: "ErrorDetails" + """ + + enablementStatus: Required[Union[str, "EnablementState"]] + """Indicates whether the service is enabled. Required. Known values are: \"Enabled\", + \"InProgress\", \"Failed\", and \"Disabled\".""" + errorDetails: "ErrorDetails" + """Optional error message if the service is in Failed state.""" + + +class Resource(TypedDict, total=False): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype systemData: "SystemData" + """ + + id: str + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: str + """The name of the resource.""" + type: str + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + systemData: "SystemData" + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class ProxyResource(Resource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype systemData: "SystemData" + """ + + +class ManagedOp(ProxyResource): + """The Managed Operations resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype systemData: "SystemData" + :ivar properties: The resource-specific properties for this resource. + :vartype properties: "ManagedOpsProperties" + """ + + properties: "ManagedOpsProperties" + """The resource-specific properties for this resource.""" + + +class ManagedOpsProperties(TypedDict, total=False): + """Properties of the ManagedOps resource. + + :ivar sku: Product plan details of this resource. + :vartype sku: "Sku" + :ivar provisioningState: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Deleting", and "Accepted". + :vartype provisioningState: Union[str, "ProvisioningState"] + :ivar desiredConfiguration: Desired configuration input by the user. Required. + :vartype desiredConfiguration: "DesiredConfiguration" + :ivar services: Services provisioned by this resource. + :vartype services: "ServiceInformation" + :ivar policyAssignmentProperties: Policy assignments created for managing services. + :vartype policyAssignmentProperties: "PolicyAssignmentProperties" + """ + + sku: "Sku" + """Product plan details of this resource.""" + provisioningState: Union[str, "ProvisioningState"] + """Provisioning state of the resource. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", + \"Provisioning\", \"Deleting\", and \"Accepted\".""" + desiredConfiguration: Required["DesiredConfiguration"] + """Desired configuration input by the user. Required.""" + services: "ServiceInformation" + """Services provisioned by this resource.""" + policyAssignmentProperties: "PolicyAssignmentProperties" + """Policy assignments created for managing services.""" + + +class ManagedOpUpdate(TypedDict, total=False): + """ManagedOps model for update operations. + + :ivar properties: Updatable properties in the ManagedOps resource. + :vartype properties: "ManagedOpUpdateProperties" + """ + + properties: "ManagedOpUpdateProperties" + """Updatable properties in the ManagedOps resource.""" + + +class ManagedOpUpdateProperties(TypedDict, total=False): + """Updatable properties in the ManagedOps resource. + + :ivar desiredConfiguration: Desired configuration input by the user. + :vartype desiredConfiguration: "DesiredConfigurationUpdate" + """ + + desiredConfiguration: "DesiredConfigurationUpdate" + """Desired configuration input by the user.""" + + +class PolicyAssignmentProperties(TypedDict, total=False): + """Policy assignments created for managing services. + + :ivar policyInitiativeAssignmentId: Policy initiative assignment ID. Required. + :vartype policyInitiativeAssignmentId: str + """ + + policyInitiativeAssignmentId: Required[str] + """Policy initiative assignment ID. Required.""" + + +class ServiceInformation(TypedDict, total=False): + """Services provisioned by this resource. + + :ivar changeTrackingAndInventory: Change Tracking and Inventory service information. + :vartype changeTrackingAndInventory: "ChangeTrackingInformation" + :ivar azureMonitorInsights: Azure Monitor Insights service information. + :vartype azureMonitorInsights: "AzureMonitorInformation" + :ivar azureUpdateManager: Azure Update Manager service information. + :vartype azureUpdateManager: "UpdateManagerInformation" + :ivar azurePolicyAndMachineConfiguration: Azure Policy and Machine Configuration service + information. + :vartype azurePolicyAndMachineConfiguration: "GuestConfigurationInformation" + :ivar defenderForServers: Defender for Servers service information. + :vartype defenderForServers: "DefenderForServersInformation" + :ivar defenderCspm: Defender for Cloud's Cloud security posture management (CSPM) service + information. + :vartype defenderCspm: "DefenderCspmInformation" + """ + + changeTrackingAndInventory: "ChangeTrackingInformation" + """Change Tracking and Inventory service information.""" + azureMonitorInsights: "AzureMonitorInformation" + """Azure Monitor Insights service information.""" + azureUpdateManager: "UpdateManagerInformation" + """Azure Update Manager service information.""" + azurePolicyAndMachineConfiguration: "GuestConfigurationInformation" + """Azure Policy and Machine Configuration service information.""" + defenderForServers: "DefenderForServersInformation" + """Defender for Servers service information.""" + defenderCspm: "DefenderCspmInformation" + """Defender for Cloud's Cloud security posture management (CSPM) service information.""" + + +class Sku(TypedDict, total=False): + """Specifies the service plan for this resource. + + :ivar name: Name of the SKU. Required. "ManagedOps" + :vartype name: Union[str, "SkuName"] + :ivar tier: Pricing tier of the SKU. Required. "Essential" + :vartype tier: Union[str, "SkuTier"] + """ + + name: Required[Union[str, "SkuName"]] + """Name of the SKU. Required. \"ManagedOps\"""" + tier: Required[Union[str, "SkuTier"]] + """Pricing tier of the SKU. Required. \"Essential\"""" + + +class SystemData(TypedDict, total=False): + """Metadata pertaining to creation and last modification of the resource. + + :ivar createdBy: The identity that created the resource. + :vartype createdBy: str + :ivar createdByType: The type of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + :vartype createdByType: Union[str, "CreatedByType"] + :ivar createdAt: The timestamp of resource creation (UTC). + :vartype createdAt: str + :ivar lastModifiedBy: The identity that last modified the resource. + :vartype lastModifiedBy: str + :ivar lastModifiedByType: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype lastModifiedByType: Union[str, "CreatedByType"] + :ivar lastModifiedAt: The timestamp of resource last modification (UTC). + :vartype lastModifiedAt: str + """ + + createdBy: str + """The identity that created the resource.""" + createdByType: Union[str, "CreatedByType"] + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + createdAt: str + """The timestamp of resource creation (UTC).""" + lastModifiedBy: str + """The identity that last modified the resource.""" + lastModifiedByType: Union[str, "CreatedByType"] + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + lastModifiedAt: str + """The timestamp of resource last modification (UTC).""" + + +class UpdateManagerInformation(TypedDict, total=False): + """Azure Update Manager service information. + + :ivar enablementStatus: Indicates whether the service is enabled. Required. Known values are: + "Enabled", "InProgress", "Failed", and "Disabled". + :vartype enablementStatus: Union[str, "EnablementState"] + :ivar errorDetails: Optional error message if the service is in Failed state. + :vartype errorDetails: "ErrorDetails" + """ + + enablementStatus: Required[Union[str, "EnablementState"]] + """Indicates whether the service is enabled. Required. Known values are: \"Enabled\", + \"InProgress\", \"Failed\", and \"Disabled\".""" + errorDetails: "ErrorDetails" + """Optional error message if the service is in Failed state.""" diff --git a/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_create_or_update.py b/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_create_or_update.py index 1f67aa130df3..f1d56245fe67 100644 --- a/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_create_or_update.py +++ b/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_create_or_update.py @@ -37,19 +37,20 @@ def main(): "properties": { "desiredConfiguration": { "azureMonitorInsights": { - "azureMonitorWorkspaceId": "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/example" + "azureMonitorWorkspaceId": "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace" }, "changeTrackingAndInventory": { - "logAnalyticsWorkspaceId": "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/00000000-0000-0000-0000-000000000000-Default" + "logAnalyticsWorkspaceId": "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/myLogAnalyticsWorkspace" }, "userAssignedManagedIdentityId": "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myManagedIdentity", - } + }, + "sku": {"name": "ManagedOps", "tier": "Essential"}, } }, ).result() print(response) -# x-ms-original-file: 2025-07-28-preview/ManagedOps_CreateOrUpdate.json +# x-ms-original-file: 2026-01-06-preview/ManagedOps_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_delete.py b/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_delete.py index b66625073a59..642f62e07322 100644 --- a/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_delete.py +++ b/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: 2025-07-28-preview/ManagedOps_Delete.json +# x-ms-original-file: 2026-01-06-preview/ManagedOps_Delete.json if __name__ == "__main__": main() diff --git a/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_get.py b/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_get.py index 4e17141a3e37..726a0a32c82f 100644 --- a/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_get.py +++ b/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: 2025-07-28-preview/ManagedOps_Get.json +# x-ms-original-file: 2026-01-06-preview/ManagedOps_Get.json if __name__ == "__main__": main() diff --git a/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_list.py b/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_list.py index f66d510a485a..35f3639d26e1 100644 --- a/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_list.py +++ b/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2025-07-28-preview/ManagedOps_List.json +# x-ms-original-file: 2026-01-06-preview/ManagedOps_List.json if __name__ == "__main__": main() diff --git a/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_update.py b/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_update.py index be3a41452162..d68b41d471da 100644 --- a/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_update.py +++ b/sdk/managedops/azure-mgmt-managedops/generated_samples/managed_ops_update.py @@ -32,11 +32,11 @@ def main(): response = client.managed_ops.begin_update( managed_ops_name="default", - properties={"properties": {"desiredConfiguration": {"defenderCspm": "Enable", "defenderForServers": "Enable"}}}, + properties={"properties": {"desiredConfiguration": {"defenderCspm": "str", "defenderForServers": "str"}}}, ).result() print(response) -# x-ms-original-file: 2025-07-28-preview/ManagedOps_Update.json +# x-ms-original-file: 2026-01-06-preview/ManagedOps_Update.json if __name__ == "__main__": main() diff --git a/sdk/managedops/azure-mgmt-managedops/generated_samples/operations_list.py b/sdk/managedops/azure-mgmt-managedops/generated_samples/operations_list.py index fa3f770db958..8cd0b0230f83 100644 --- a/sdk/managedops/azure-mgmt-managedops/generated_samples/operations_list.py +++ b/sdk/managedops/azure-mgmt-managedops/generated_samples/operations_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2025-07-28-preview/Operations_List.json +# x-ms-original-file: 2026-01-06-preview/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/managedops/azure-mgmt-managedops/generated_tests/test_managed_ops_mgmt_managed_ops_operations.py b/sdk/managedops/azure-mgmt-managedops/generated_tests/test_managed_ops_mgmt_managed_ops_operations.py index 08a1cee5f87d..5f820d8a241a 100644 --- a/sdk/managedops/azure-mgmt-managedops/generated_tests/test_managed_ops_mgmt_managed_ops_operations.py +++ b/sdk/managedops/azure-mgmt-managedops/generated_tests/test_managed_ops_mgmt_managed_ops_operations.py @@ -41,18 +41,35 @@ def test_managed_ops_begin_create_or_update(self, resource_group): "azureMonitorInsights": {"azureMonitorWorkspaceId": "str"}, "changeTrackingAndInventory": {"logAnalyticsWorkspaceId": "str"}, "userAssignedManagedIdentityId": "str", - "defenderCspm": "Enable", - "defenderForServers": "Enable", + "defenderCspm": "str", + "defenderForServers": "str", }, "policyAssignmentProperties": {"policyInitiativeAssignmentId": "str"}, "provisioningState": "str", "services": { - "azureMonitorInsights": {"dcrId": "str", "enablementStatus": "Enabled"}, - "azurePolicyAndMachineConfiguration": {"enablementStatus": "Enabled"}, - "azureUpdateManager": {"enablementStatus": "Enabled"}, - "changeTrackingAndInventory": {"dcrId": "str", "enablementStatus": "Enabled"}, - "defenderCspm": {"enablementStatus": "Enabled"}, - "defenderForServers": {"enablementStatus": "Enabled"}, + "azureMonitorInsights": { + "dcrId": "str", + "enablementStatus": "str", + "errorDetails": {"code": "str", "message": "str"}, + }, + "azurePolicyAndMachineConfiguration": { + "enablementStatus": "str", + "errorDetails": {"code": "str", "message": "str"}, + }, + "azureUpdateManager": { + "enablementStatus": "str", + "errorDetails": {"code": "str", "message": "str"}, + }, + "changeTrackingAndInventory": { + "dcrId": "str", + "enablementStatus": "str", + "errorDetails": {"code": "str", "message": "str"}, + }, + "defenderCspm": {"enablementStatus": "str", "errorDetails": {"code": "str", "message": "str"}}, + "defenderForServers": { + "enablementStatus": "str", + "errorDetails": {"code": "str", "message": "str"}, + }, }, "sku": {"name": "str", "tier": "str"}, }, diff --git a/sdk/managedops/azure-mgmt-managedops/generated_tests/test_managed_ops_mgmt_managed_ops_operations_async.py b/sdk/managedops/azure-mgmt-managedops/generated_tests/test_managed_ops_mgmt_managed_ops_operations_async.py index 9d3c7338e48c..e169c981bd64 100644 --- a/sdk/managedops/azure-mgmt-managedops/generated_tests/test_managed_ops_mgmt_managed_ops_operations_async.py +++ b/sdk/managedops/azure-mgmt-managedops/generated_tests/test_managed_ops_mgmt_managed_ops_operations_async.py @@ -43,18 +43,38 @@ async def test_managed_ops_begin_create_or_update(self, resource_group): "azureMonitorInsights": {"azureMonitorWorkspaceId": "str"}, "changeTrackingAndInventory": {"logAnalyticsWorkspaceId": "str"}, "userAssignedManagedIdentityId": "str", - "defenderCspm": "Enable", - "defenderForServers": "Enable", + "defenderCspm": "str", + "defenderForServers": "str", }, "policyAssignmentProperties": {"policyInitiativeAssignmentId": "str"}, "provisioningState": "str", "services": { - "azureMonitorInsights": {"dcrId": "str", "enablementStatus": "Enabled"}, - "azurePolicyAndMachineConfiguration": {"enablementStatus": "Enabled"}, - "azureUpdateManager": {"enablementStatus": "Enabled"}, - "changeTrackingAndInventory": {"dcrId": "str", "enablementStatus": "Enabled"}, - "defenderCspm": {"enablementStatus": "Enabled"}, - "defenderForServers": {"enablementStatus": "Enabled"}, + "azureMonitorInsights": { + "dcrId": "str", + "enablementStatus": "str", + "errorDetails": {"code": "str", "message": "str"}, + }, + "azurePolicyAndMachineConfiguration": { + "enablementStatus": "str", + "errorDetails": {"code": "str", "message": "str"}, + }, + "azureUpdateManager": { + "enablementStatus": "str", + "errorDetails": {"code": "str", "message": "str"}, + }, + "changeTrackingAndInventory": { + "dcrId": "str", + "enablementStatus": "str", + "errorDetails": {"code": "str", "message": "str"}, + }, + "defenderCspm": { + "enablementStatus": "str", + "errorDetails": {"code": "str", "message": "str"}, + }, + "defenderForServers": { + "enablementStatus": "str", + "errorDetails": {"code": "str", "message": "str"}, + }, }, "sku": {"name": "str", "tier": "str"}, }, @@ -89,7 +109,7 @@ async def test_managed_ops_begin_update(self, resource_group): await self.client.managed_ops.begin_update( managed_ops_name="str", properties={ - "properties": {"desiredConfiguration": {"defenderCspm": "Enable", "defenderForServers": "Enable"}} + "properties": {"desiredConfiguration": {"defenderCspm": "str", "defenderForServers": "str"}} }, ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/managedops/azure-mgmt-managedops/pyproject.toml b/sdk/managedops/azure-mgmt-managedops/pyproject.toml index 57feb9955123..a8f03a8e8056 100644 --- a/sdk/managedops/azure-mgmt-managedops/pyproject.toml +++ b/sdk/managedops/azure-mgmt-managedops/pyproject.toml @@ -17,13 +17,13 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = [ "azure", "azure sdk", diff --git a/sdk/managedops/azure-mgmt-managedops/tsp-location.yaml b/sdk/managedops/azure-mgmt-managedops/tsp-location.yaml index 3038f8b6bb68..9aef2b010d8b 100644 --- a/sdk/managedops/azure-mgmt-managedops/tsp-location.yaml +++ b/sdk/managedops/azure-mgmt-managedops/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/managedoperations/ManagedOps.Management -commit: 5dfb097302f2588f698e3a7c6d31f9194e64a2f9 +commit: 53c0f6efe9872c971e8c365e3b0d41a6bd6efd3d repo: Azure/azure-rest-api-specs additionalDirectories: