diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/CHANGELOG.md b/sdk/servicenetworking/azure-mgmt-servicenetworking/CHANGELOG.md index 38973be5cdbc..fdcc4e0c2e5e 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/CHANGELOG.md +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/CHANGELOG.md @@ -1,5 +1,39 @@ # Release History +## 2.1.0 (2026-08-27) + +### Features Added + + - Client `ServiceNetworkingMgmtClient` added parameter `cloud_setting` in method `__init__` + - Client `ServiceNetworkingMgmtClient` added operation group `private_endpoint_connections_interface` + - Client `ServiceNetworkingMgmtClient` added operation group `private_link_resources_interface` + - Model `FrontendProperties` added property `association` + - Model `FrontendProperties` added property `public_network_access` + - Model `FrontendProperties` added property `security_policy_configurations` + - Model `FrontendUpdate` added property `properties` + - Enum `PolicyType` added member `IP_ACCESS_RULES` + - Model `SecurityPolicyConfigurations` added property `ip_access_rules_security_policy` + - Model `SecurityPolicyProperties` added property `ip_access_rules_policy` + - Model `SecurityPolicyUpdateProperties` added property `ip_access_rules_policy` + - Model `TrafficControllerProperties` added property `private_endpoint_connections` + - Added model `FrontendAssociation` + - Added model `FrontendUpdateProperties` + - Added model `IpAccessRule` + - Added enum `IpAccessRuleAction` + - Added model `IpAccessRulesPolicy` + - Added model `IpAccessRulesSecurityPolicy` + - Added model `PrivateEndpointConnection` + - Added model `PrivateEndpointConnectionProperties` + - Added model `PrivateEndpointReference` + - Added model `PrivateLinkResource` + - Added model `PrivateLinkResourceProperties` + - Added model `PrivateLinkServiceConnectionState` + - Added enum `PrivateLinkServiceConnectionStatus` + - Added model `ProxyResource` + - Added enum `PublicNetworkAccess` + - Added operation group `PrivateEndpointConnectionsInterfaceOperations` + - Added operation group `PrivateLinkResourcesInterfaceOperations` + ## 2.1.0b1 (2025-05-12) ### Features Added diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/MANIFEST.in b/sdk/servicenetworking/azure-mgmt-servicenetworking/MANIFEST.in index ecaa57859463..f3700ef82b90 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/MANIFEST.in +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/MANIFEST.in @@ -1,8 +1,7 @@ -include _meta.json -recursive-include tests *.py *.json -recursive-include samples *.py *.md include *.md -include azure/__init__.py -include azure/mgmt/__init__.py include LICENSE include azure/mgmt/servicenetworking/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include azure/__init__.py +include azure/mgmt/__init__.py diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/README.md b/sdk/servicenetworking/azure-mgmt-servicenetworking/README.md index 4fa916166af1..c2047700a5de 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/README.md +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Servicenetworking 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/servicenetworking/azure-mgmt-servicenetworking/_meta.json b/sdk/servicenetworking/azure-mgmt-servicenetworking/_meta.json deleted file mode 100644 index 3c2676f8bcb9..000000000000 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/_meta.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "commit": "8ab23bfef36dbedfe554f215d0771a4ef7d56d11", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "typespec_src": "specification/servicenetworking/ServiceNetworking.Management", - "@azure-tools/typespec-python": "0.43.0" -} \ No newline at end of file diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/_metadata.json b/sdk/servicenetworking/azure-mgmt-servicenetworking/_metadata.json new file mode 100644 index 000000000000..ba7b39a4c3ae --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/_metadata.json @@ -0,0 +1,11 @@ +{ + "apiVersion": "2026-03-01", + "apiVersions": { + "Microsoft.ServiceNetworking": "2026-03-01" + }, + "commit": "3fbff828a405632668f197b4c30466a0b8dc2cef", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "typespec_src": "specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/ServiceNetworking", + "emitterVersion": "0.63.5", + "httpClientPythonVersion": "^0.36.0" +} \ No newline at end of file diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/api.md b/sdk/servicenetworking/azure-mgmt-servicenetworking/api.md new file mode 100644 index 000000000000..849c4fa70bea --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/api.md @@ -0,0 +1,2152 @@ +```py +namespace azure.mgmt.servicenetworking + + class azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient: implements ContextManager + associations_interface: AssociationsInterfaceOperations + frontends_interface: FrontendsInterfaceOperations + operations: Operations + private_endpoint_connections_interface: PrivateEndpointConnectionsInterfaceOperations + private_link_resources_interface: PrivateLinkResourcesInterfaceOperations + security_policies_interface: SecurityPoliciesInterfaceOperations + traffic_controller_interface: TrafficControllerInterfaceOperations + + 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.servicenetworking.aio + + class azure.mgmt.servicenetworking.aio.ServiceNetworkingMgmtClient: implements AsyncContextManager + associations_interface: AssociationsInterfaceOperations + frontends_interface: FrontendsInterfaceOperations + operations: Operations + private_endpoint_connections_interface: PrivateEndpointConnectionsInterfaceOperations + private_link_resources_interface: PrivateLinkResourcesInterfaceOperations + security_policies_interface: SecurityPoliciesInterfaceOperations + traffic_controller_interface: TrafficControllerInterfaceOperations + + 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.servicenetworking.aio.operations + + class azure.mgmt.servicenetworking.aio.operations.AssociationsInterfaceOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + resource: Association, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[Association]: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + resource: Association, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[Association]: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[Association]: ... + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + **kwargs: Any + ) -> Association: ... + + @distributed_trace + def list_by_traffic_controller( + self, + resource_group_name: str, + traffic_controller_name: str, + **kwargs: Any + ) -> AsyncItemPaged[Association]: ... + + @overload + async def update( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + properties: AssociationUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Association: ... + + @overload + async def update( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + properties: AssociationUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Association: ... + + @overload + async def update( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Association: ... + + + class azure.mgmt.servicenetworking.aio.operations.FrontendsInterfaceOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + resource: Frontend, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[Frontend]: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + resource: Frontend, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[Frontend]: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[Frontend]: ... + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + **kwargs: Any + ) -> Frontend: ... + + @distributed_trace + def list_by_traffic_controller( + self, + resource_group_name: str, + traffic_controller_name: str, + **kwargs: Any + ) -> AsyncItemPaged[Frontend]: ... + + @overload + async def update( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + properties: FrontendUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Frontend: ... + + @overload + async def update( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + properties: FrontendUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Frontend: ... + + @overload + async def update( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Frontend: ... + + + class azure.mgmt.servicenetworking.aio.operations.Operations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged[Operation]: ... + + + class azure.mgmt.servicenetworking.aio.operations.PrivateEndpointConnectionsInterfaceOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-03-01', params_added_on={'2026-03-01': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'private_endpoint_connection_name']}, api_versions_list=['2026-03-01']) + async def begin_delete( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PrivateEndpointConnection]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PrivateEndpointConnection]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PrivateEndpointConnection]: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-03-01', params_added_on={'2026-03-01': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'private_endpoint_connection_name', 'accept']}, api_versions_list=['2026-03-01']) + async def get( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> PrivateEndpointConnection: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-03-01', params_added_on={'2026-03-01': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'accept']}, api_versions_list=['2026-03-01']) + def list_by_traffic_controller( + self, + resource_group_name: str, + traffic_controller_name: str, + **kwargs: Any + ) -> AsyncItemPaged[PrivateEndpointConnection]: ... + + + class azure.mgmt.servicenetworking.aio.operations.PrivateLinkResourcesInterfaceOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-03-01', params_added_on={'2026-03-01': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'private_link_resource_name', 'accept']}, api_versions_list=['2026-03-01']) + async def get( + self, + resource_group_name: str, + traffic_controller_name: str, + private_link_resource_name: str, + **kwargs: Any + ) -> PrivateLinkResource: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-03-01', params_added_on={'2026-03-01': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'accept']}, api_versions_list=['2026-03-01']) + def list_by_traffic_controller( + self, + resource_group_name: str, + traffic_controller_name: str, + **kwargs: Any + ) -> AsyncItemPaged[PrivateLinkResource]: ... + + + class azure.mgmt.servicenetworking.aio.operations.SecurityPoliciesInterfaceOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + resource: SecurityPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[SecurityPolicy]: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + resource: SecurityPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[SecurityPolicy]: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[SecurityPolicy]: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2024-05-01-preview', params_added_on={'2024-05-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'security_policy_name']}, api_versions_list=['2024-05-01-preview', '2025-01-01', '2025-03-01-preview', '2026-03-01']) + async def begin_delete( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2024-05-01-preview', params_added_on={'2024-05-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'security_policy_name', 'accept']}, api_versions_list=['2024-05-01-preview', '2025-01-01', '2025-03-01-preview', '2026-03-01']) + async def get( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + **kwargs: Any + ) -> SecurityPolicy: ... + + @distributed_trace + @api_version_validation(method_added_on='2024-05-01-preview', params_added_on={'2024-05-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'accept']}, api_versions_list=['2024-05-01-preview', '2025-01-01', '2025-03-01-preview', '2026-03-01']) + def list_by_traffic_controller( + self, + resource_group_name: str, + traffic_controller_name: str, + **kwargs: Any + ) -> AsyncItemPaged[SecurityPolicy]: ... + + @overload + async def update( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + properties: SecurityPolicyUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SecurityPolicy: ... + + @overload + async def update( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + properties: SecurityPolicyUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SecurityPolicy: ... + + @overload + async def update( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SecurityPolicy: ... + + + class azure.mgmt.servicenetworking.aio.operations.TrafficControllerInterfaceOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + resource: TrafficController, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[TrafficController]: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + resource: TrafficController, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[TrafficController]: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[TrafficController]: ... + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + traffic_controller_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + traffic_controller_name: str, + **kwargs: Any + ) -> TrafficController: ... + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncItemPaged[TrafficController]: ... + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged[TrafficController]: ... + + @overload + async def update( + self, + resource_group_name: str, + traffic_controller_name: str, + properties: TrafficControllerUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> TrafficController: ... + + @overload + async def update( + self, + resource_group_name: str, + traffic_controller_name: str, + properties: TrafficControllerUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> TrafficController: ... + + @overload + async def update( + self, + resource_group_name: str, + traffic_controller_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> TrafficController: ... + + +namespace azure.mgmt.servicenetworking.models + + class azure.mgmt.servicenetworking.models.ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + INTERNAL = "Internal" + + + class azure.mgmt.servicenetworking.models.Association(TrackedResource): + id: str + location: str + name: str + properties: Optional[AssociationProperties] + system_data: SystemData + tags: dict[str, str] + type: str + + @overload + def __init__( + self, + *, + location: str, + properties: Optional[AssociationProperties] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.AssociationProperties(_Model): + association_type: Union[str, AssociationType] + provisioning_state: Optional[Union[str, ProvisioningState]] + subnet: Optional[AssociationSubnet] + + @overload + def __init__( + self, + *, + association_type: Union[str, AssociationType], + subnet: Optional[AssociationSubnet] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.AssociationSubnet(_Model): + id: str + + @overload + def __init__( + self, + *, + id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.AssociationSubnetUpdate(_Model): + id: Optional[str] + + @overload + def __init__( + self, + *, + id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.AssociationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + SUBNETS = "subnets" + + + class azure.mgmt.servicenetworking.models.AssociationUpdate(_Model): + properties: Optional[AssociationUpdateProperties] + tags: Optional[dict[str, str]] + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[AssociationUpdateProperties] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.servicenetworking.models.AssociationUpdateProperties(_Model): + association_type: Optional[Union[str, AssociationType]] + subnet: Optional[AssociationSubnetUpdate] + + @overload + def __init__( + self, + *, + association_type: Optional[Union[str, AssociationType]] = ..., + subnet: Optional[AssociationSubnetUpdate] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + APPLICATION = "Application" + KEY = "Key" + MANAGED_IDENTITY = "ManagedIdentity" + USER = "User" + + + class azure.mgmt.servicenetworking.models.ErrorAdditionalInfo(_Model): + info: Optional[Any] + type: Optional[str] + + + class azure.mgmt.servicenetworking.models.ErrorDetail(_Model): + additional_info: Optional[list[ErrorAdditionalInfo]] + code: Optional[str] + details: Optional[list[ErrorDetail]] + message: Optional[str] + target: Optional[str] + + + class azure.mgmt.servicenetworking.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.servicenetworking.models.Frontend(TrackedResource): + id: str + location: str + name: str + properties: Optional[FrontendProperties] + system_data: SystemData + tags: dict[str, str] + type: str + + @overload + def __init__( + self, + *, + location: str, + properties: Optional[FrontendProperties] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.FrontendAssociation(_Model): + id: str + + @overload + def __init__( + self, + *, + id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.FrontendProperties(_Model): + association: Optional[FrontendAssociation] + fqdn: Optional[str] + provisioning_state: Optional[Union[str, ProvisioningState]] + public_network_access: Optional[Union[str, PublicNetworkAccess]] + security_policy_configurations: Optional[SecurityPolicyConfigurations] + + @overload + def __init__( + self, + *, + association: Optional[FrontendAssociation] = ..., + public_network_access: Optional[Union[str, PublicNetworkAccess]] = ..., + security_policy_configurations: Optional[SecurityPolicyConfigurations] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.FrontendUpdate(_Model): + properties: Optional[FrontendUpdateProperties] + tags: Optional[dict[str, str]] + + @overload + def __init__( + self, + *, + properties: Optional[FrontendUpdateProperties] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.FrontendUpdateProperties(_Model): + association: Optional[FrontendAssociation] + public_network_access: Optional[Union[str, PublicNetworkAccess]] + security_policy_configurations: Optional[SecurityPolicyConfigurations] + + @overload + def __init__( + self, + *, + association: Optional[FrontendAssociation] = ..., + public_network_access: Optional[Union[str, PublicNetworkAccess]] = ..., + security_policy_configurations: Optional[SecurityPolicyConfigurations] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.IpAccessRule(_Model): + action: Union[str, IpAccessRuleAction] + name: str + priority: int + source_address_prefixes: list[str] + + @overload + def __init__( + self, + *, + action: Union[str, IpAccessRuleAction], + name: str, + priority: int, + source_address_prefixes: list[str] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.IpAccessRuleAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ALLOW = "allow" + DENY = "deny" + + + class azure.mgmt.servicenetworking.models.IpAccessRulesPolicy(_Model): + rules: Optional[list[IpAccessRule]] + + @overload + def __init__( + self, + *, + rules: Optional[list[IpAccessRule]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.IpAccessRulesSecurityPolicy(_Model): + id: str + + @overload + def __init__( + self, + *, + id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.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.servicenetworking.models.OperationDisplay(_Model): + description: Optional[str] + operation: Optional[str] + provider: Optional[str] + resource: Optional[str] + + + class azure.mgmt.servicenetworking.models.Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + SYSTEM = "system" + USER = "user" + USER_SYSTEM = "user,system" + + + class azure.mgmt.servicenetworking.models.PolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + IP_ACCESS_RULES = "ipAccessRules" + WAF = "waf" + + + class azure.mgmt.servicenetworking.models.PrivateEndpointConnection(ProxyResource): + id: str + name: str + properties: Optional[PrivateEndpointConnectionProperties] + system_data: SystemData + type: str + + @overload + def __init__( + self, + *, + properties: Optional[PrivateEndpointConnectionProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.PrivateEndpointConnectionProperties(_Model): + private_endpoint: Optional[PrivateEndpointReference] + private_link_service_connection_state: PrivateLinkServiceConnectionState + provisioning_state: Optional[Union[str, ProvisioningState]] + + @overload + def __init__( + self, + *, + private_link_service_connection_state: PrivateLinkServiceConnectionState + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.PrivateEndpointReference(_Model): + id: Optional[str] + + + class azure.mgmt.servicenetworking.models.PrivateLinkResource(ProxyResource): + id: str + name: str + properties: Optional[PrivateLinkResourceProperties] + system_data: SystemData + type: str + + @overload + def __init__( + self, + *, + properties: Optional[PrivateLinkResourceProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.PrivateLinkResourceProperties(_Model): + group_id: Optional[str] + provisioning_state: Optional[Union[str, ProvisioningState]] + required_members: Optional[list[str]] + required_zone_names: Optional[list[str]] + + + class azure.mgmt.servicenetworking.models.PrivateLinkServiceConnectionState(_Model): + actions_required: Optional[str] + description: Optional[str] + status: Optional[Union[str, PrivateLinkServiceConnectionStatus]] + + @overload + def __init__( + self, + *, + actions_required: Optional[str] = ..., + description: Optional[str] = ..., + status: Optional[Union[str, PrivateLinkServiceConnectionStatus]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.PrivateLinkServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + APPROVED = "Approved" + DISCONNECTED = "Disconnected" + PENDING = "Pending" + REJECTED = "Rejected" + + + class azure.mgmt.servicenetworking.models.ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ACCEPTED = "Accepted" + CANCELED = "Canceled" + DELETING = "Deleting" + FAILED = "Failed" + PROVISIONING = "Provisioning" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + + + class azure.mgmt.servicenetworking.models.ProxyResource(Resource): + id: str + name: str + system_data: SystemData + type: str + + + class azure.mgmt.servicenetworking.models.PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DISABLED = "Disabled" + ENABLED = "Enabled" + + + class azure.mgmt.servicenetworking.models.Resource(_Model): + id: Optional[str] + name: Optional[str] + system_data: Optional[SystemData] + type: Optional[str] + + + class azure.mgmt.servicenetworking.models.ResourceId(_Model): + id: str + + @overload + def __init__( + self, + *, + id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.SecurityPolicy(TrackedResource): + id: str + location: str + name: str + properties: Optional[SecurityPolicyProperties] + system_data: SystemData + tags: dict[str, str] + type: str + + @overload + def __init__( + self, + *, + location: str, + properties: Optional[SecurityPolicyProperties] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.SecurityPolicyConfigurations(_Model): + ip_access_rules_security_policy: Optional[IpAccessRulesSecurityPolicy] + waf_security_policy: Optional[WafSecurityPolicy] + + @overload + def __init__( + self, + *, + ip_access_rules_security_policy: Optional[IpAccessRulesSecurityPolicy] = ..., + waf_security_policy: Optional[WafSecurityPolicy] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.SecurityPolicyProperties(_Model): + ip_access_rules_policy: Optional[IpAccessRulesPolicy] + policy_type: Optional[Union[str, PolicyType]] + provisioning_state: Optional[Union[str, ProvisioningState]] + waf_policy: Optional[WafPolicy] + + @overload + def __init__( + self, + *, + ip_access_rules_policy: Optional[IpAccessRulesPolicy] = ..., + waf_policy: Optional[WafPolicy] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.SecurityPolicyUpdate(_Model): + properties: Optional[SecurityPolicyUpdateProperties] + tags: Optional[dict[str, str]] + + @overload + def __init__( + self, + *, + properties: Optional[SecurityPolicyUpdateProperties] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.SecurityPolicyUpdateProperties(_Model): + ip_access_rules_policy: Optional[IpAccessRulesPolicy] + waf_policy: Optional[WafPolicy] + + @overload + def __init__( + self, + *, + ip_access_rules_policy: Optional[IpAccessRulesPolicy] = ..., + waf_policy: Optional[WafPolicy] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.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.servicenetworking.models.TrackedResource(Resource): + id: str + location: str + name: str + system_data: SystemData + tags: Optional[dict[str, str]] + type: str + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.TrafficController(TrackedResource): + id: str + location: str + name: str + properties: Optional[TrafficControllerProperties] + system_data: SystemData + tags: dict[str, str] + type: str + + @overload + def __init__( + self, + *, + location: str, + properties: Optional[TrafficControllerProperties] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.TrafficControllerProperties(_Model): + associations: Optional[list[ResourceId]] + configuration_endpoints: Optional[list[str]] + frontends: Optional[list[ResourceId]] + private_endpoint_connections: Optional[list[ResourceId]] + provisioning_state: Optional[Union[str, ProvisioningState]] + security_policies: Optional[list[ResourceId]] + security_policy_configurations: Optional[SecurityPolicyConfigurations] + + @overload + def __init__( + self, + *, + security_policy_configurations: Optional[SecurityPolicyConfigurations] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.TrafficControllerUpdate(_Model): + properties: Optional[TrafficControllerUpdateProperties] + tags: Optional[dict[str, str]] + + @overload + def __init__( + self, + *, + properties: Optional[TrafficControllerUpdateProperties] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.TrafficControllerUpdateProperties(_Model): + security_policy_configurations: Optional[SecurityPolicyConfigurations] + + @overload + def __init__( + self, + *, + security_policy_configurations: Optional[SecurityPolicyConfigurations] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.WafPolicy(_Model): + id: str + + @overload + def __init__( + self, + *, + id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.servicenetworking.models.WafSecurityPolicy(_Model): + id: str + + @overload + def __init__( + self, + *, + id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + +namespace azure.mgmt.servicenetworking.operations + + class azure.mgmt.servicenetworking.operations.AssociationsInterfaceOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + resource: Association, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[Association]: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + resource: Association, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[Association]: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[Association]: ... + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + **kwargs: Any + ) -> Association: ... + + @distributed_trace + def list_by_traffic_controller( + self, + resource_group_name: str, + traffic_controller_name: str, + **kwargs: Any + ) -> ItemPaged[Association]: ... + + @overload + def update( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + properties: AssociationUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Association: ... + + @overload + def update( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + properties: AssociationUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Association: ... + + @overload + def update( + self, + resource_group_name: str, + traffic_controller_name: str, + association_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Association: ... + + + class azure.mgmt.servicenetworking.operations.FrontendsInterfaceOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + resource: Frontend, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[Frontend]: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + resource: Frontend, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[Frontend]: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[Frontend]: ... + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + **kwargs: Any + ) -> Frontend: ... + + @distributed_trace + def list_by_traffic_controller( + self, + resource_group_name: str, + traffic_controller_name: str, + **kwargs: Any + ) -> ItemPaged[Frontend]: ... + + @overload + def update( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + properties: FrontendUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Frontend: ... + + @overload + def update( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + properties: FrontendUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Frontend: ... + + @overload + def update( + self, + resource_group_name: str, + traffic_controller_name: str, + frontend_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Frontend: ... + + + class azure.mgmt.servicenetworking.operations.Operations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged[Operation]: ... + + + class azure.mgmt.servicenetworking.operations.PrivateEndpointConnectionsInterfaceOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-03-01', params_added_on={'2026-03-01': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'private_endpoint_connection_name']}, api_versions_list=['2026-03-01']) + def begin_delete( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PrivateEndpointConnection]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PrivateEndpointConnection]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PrivateEndpointConnection]: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-03-01', params_added_on={'2026-03-01': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'private_endpoint_connection_name', 'accept']}, api_versions_list=['2026-03-01']) + def get( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> PrivateEndpointConnection: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-03-01', params_added_on={'2026-03-01': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'accept']}, api_versions_list=['2026-03-01']) + def list_by_traffic_controller( + self, + resource_group_name: str, + traffic_controller_name: str, + **kwargs: Any + ) -> ItemPaged[PrivateEndpointConnection]: ... + + + class azure.mgmt.servicenetworking.operations.PrivateLinkResourcesInterfaceOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-03-01', params_added_on={'2026-03-01': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'private_link_resource_name', 'accept']}, api_versions_list=['2026-03-01']) + def get( + self, + resource_group_name: str, + traffic_controller_name: str, + private_link_resource_name: str, + **kwargs: Any + ) -> PrivateLinkResource: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-03-01', params_added_on={'2026-03-01': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'accept']}, api_versions_list=['2026-03-01']) + def list_by_traffic_controller( + self, + resource_group_name: str, + traffic_controller_name: str, + **kwargs: Any + ) -> ItemPaged[PrivateLinkResource]: ... + + + class azure.mgmt.servicenetworking.operations.SecurityPoliciesInterfaceOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + resource: SecurityPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[SecurityPolicy]: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + resource: SecurityPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[SecurityPolicy]: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[SecurityPolicy]: ... + + @distributed_trace + @api_version_validation(method_added_on='2024-05-01-preview', params_added_on={'2024-05-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'security_policy_name']}, api_versions_list=['2024-05-01-preview', '2025-01-01', '2025-03-01-preview', '2026-03-01']) + def begin_delete( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @distributed_trace + @api_version_validation(method_added_on='2024-05-01-preview', params_added_on={'2024-05-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'security_policy_name', 'accept']}, api_versions_list=['2024-05-01-preview', '2025-01-01', '2025-03-01-preview', '2026-03-01']) + def get( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + **kwargs: Any + ) -> SecurityPolicy: ... + + @distributed_trace + @api_version_validation(method_added_on='2024-05-01-preview', params_added_on={'2024-05-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'traffic_controller_name', 'accept']}, api_versions_list=['2024-05-01-preview', '2025-01-01', '2025-03-01-preview', '2026-03-01']) + def list_by_traffic_controller( + self, + resource_group_name: str, + traffic_controller_name: str, + **kwargs: Any + ) -> ItemPaged[SecurityPolicy]: ... + + @overload + def update( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + properties: SecurityPolicyUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SecurityPolicy: ... + + @overload + def update( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + properties: SecurityPolicyUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SecurityPolicy: ... + + @overload + def update( + self, + resource_group_name: str, + traffic_controller_name: str, + security_policy_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SecurityPolicy: ... + + + class azure.mgmt.servicenetworking.operations.TrafficControllerInterfaceOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + resource: TrafficController, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[TrafficController]: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + resource: TrafficController, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[TrafficController]: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + traffic_controller_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[TrafficController]: ... + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + traffic_controller_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + traffic_controller_name: str, + **kwargs: Any + ) -> TrafficController: ... + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> ItemPaged[TrafficController]: ... + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> ItemPaged[TrafficController]: ... + + @overload + def update( + self, + resource_group_name: str, + traffic_controller_name: str, + properties: TrafficControllerUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> TrafficController: ... + + @overload + def update( + self, + resource_group_name: str, + traffic_controller_name: str, + properties: TrafficControllerUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> TrafficController: ... + + @overload + def update( + self, + resource_group_name: str, + traffic_controller_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> TrafficController: ... + + +namespace azure.mgmt.servicenetworking.types + + class azure.mgmt.servicenetworking.types.Association(TrackedResource): + key "id": str + key "location": Required[str] + key "name": str + key "properties": ForwardRef('AssociationProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + location: str + name: str + properties: AssociationProperties + systemData: SystemData + tags: dict[str, str] + type: str + + + class azure.mgmt.servicenetworking.types.AssociationProperties(TypedDict, total=False): + key "associationType": Required[Union[str, AssociationType]] + key "provisioningState": Union[str, ProvisioningState] + key "subnet": ForwardRef('AssociationSubnet', module='types') + associationType: Union[str, AssociationType] + provisioningState: Union[str, ProvisioningState] + subnet: AssociationSubnet + + + class azure.mgmt.servicenetworking.types.AssociationSubnet(TypedDict, total=False): + key "id": Required[str] + id: str + + + class azure.mgmt.servicenetworking.types.AssociationSubnetUpdate(TypedDict, total=False): + key "id": str + id: str + + + class azure.mgmt.servicenetworking.types.AssociationUpdate(TypedDict, total=False): + key "properties": ForwardRef('AssociationUpdateProperties', module='types') + properties: AssociationUpdateProperties + tags: dict[str, str] + + + class azure.mgmt.servicenetworking.types.AssociationUpdateProperties(TypedDict, total=False): + key "associationType": Union[str, AssociationType] + key "subnet": ForwardRef('AssociationSubnetUpdate', module='types') + associationType: Union[str, AssociationType] + subnet: AssociationSubnetUpdate + + + class azure.mgmt.servicenetworking.types.Frontend(TrackedResource): + key "id": str + key "location": Required[str] + key "name": str + key "properties": ForwardRef('FrontendProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + location: str + name: str + properties: FrontendProperties + systemData: SystemData + tags: dict[str, str] + type: str + + + class azure.mgmt.servicenetworking.types.FrontendAssociation(TypedDict, total=False): + key "id": Required[str] + id: str + + + class azure.mgmt.servicenetworking.types.FrontendProperties(TypedDict, total=False): + key "association": ForwardRef('FrontendAssociation', module='types') + key "fqdn": str + key "provisioningState": Union[str, ProvisioningState] + key "publicNetworkAccess": Union[str, PublicNetworkAccess] + key "securityPolicyConfigurations": ForwardRef('SecurityPolicyConfigurations', module='types') + association: FrontendAssociation + fqdn: str + provisioningState: Union[str, ProvisioningState] + publicNetworkAccess: Union[str, PublicNetworkAccess] + securityPolicyConfigurations: SecurityPolicyConfigurations + + + class azure.mgmt.servicenetworking.types.FrontendUpdate(TypedDict, total=False): + key "properties": ForwardRef('FrontendUpdateProperties', module='types') + properties: FrontendUpdateProperties + tags: dict[str, str] + + + class azure.mgmt.servicenetworking.types.FrontendUpdateProperties(TypedDict, total=False): + key "association": ForwardRef('FrontendAssociation', module='types') + key "publicNetworkAccess": Union[str, PublicNetworkAccess] + key "securityPolicyConfigurations": ForwardRef('SecurityPolicyConfigurations', module='types') + association: FrontendAssociation + publicNetworkAccess: Union[str, PublicNetworkAccess] + securityPolicyConfigurations: SecurityPolicyConfigurations + + + class azure.mgmt.servicenetworking.types.IpAccessRule(TypedDict, total=False): + key "action": Required[Union[str, IpAccessRuleAction]] + key "name": Required[str] + key "priority": Required[int] + key "sourceAddressPrefixes": Required[list[str]] + action: Union[str, IpAccessRuleAction] + name: str + priority: int + sourceAddressPrefixes: list[str] + + + class azure.mgmt.servicenetworking.types.IpAccessRulesPolicy(TypedDict, total=False): + rules: list[IpAccessRule] + + + class azure.mgmt.servicenetworking.types.IpAccessRulesSecurityPolicy(TypedDict, total=False): + key "id": Required[str] + id: str + + + class azure.mgmt.servicenetworking.types.PrivateEndpointConnection(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('PrivateEndpointConnectionProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: PrivateEndpointConnectionProperties + systemData: SystemData + type: str + + + class azure.mgmt.servicenetworking.types.PrivateEndpointConnectionProperties(TypedDict, total=False): + key "privateEndpoint": ForwardRef('PrivateEndpointReference', module='types') + key "privateLinkServiceConnectionState": Required[PrivateLinkServiceConnectionState] + key "provisioningState": Union[str, ProvisioningState] + privateEndpoint: PrivateEndpointReference + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState + provisioningState: Union[str, ProvisioningState] + + + class azure.mgmt.servicenetworking.types.PrivateEndpointReference(TypedDict, total=False): + key "id": str + id: str + + + class azure.mgmt.servicenetworking.types.PrivateLinkServiceConnectionState(TypedDict, total=False): + key "actionsRequired": str + key "description": str + key "status": Union[str, PrivateLinkServiceConnectionStatus] + actionsRequired: str + description: str + status: Union[str, PrivateLinkServiceConnectionStatus] + + + class azure.mgmt.servicenetworking.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.servicenetworking.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.servicenetworking.types.ResourceId(TypedDict, total=False): + key "id": Required[str] + id: str + + + class azure.mgmt.servicenetworking.types.SecurityPolicy(TrackedResource): + key "id": str + key "location": Required[str] + key "name": str + key "properties": ForwardRef('SecurityPolicyProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + location: str + name: str + properties: SecurityPolicyProperties + systemData: SystemData + tags: dict[str, str] + type: str + + + class azure.mgmt.servicenetworking.types.SecurityPolicyConfigurations(TypedDict, total=False): + key "ipAccessRulesSecurityPolicy": ForwardRef('IpAccessRulesSecurityPolicy', module='types') + key "wafSecurityPolicy": ForwardRef('WafSecurityPolicy', module='types') + ipAccessRulesSecurityPolicy: IpAccessRulesSecurityPolicy + wafSecurityPolicy: WafSecurityPolicy + + + class azure.mgmt.servicenetworking.types.SecurityPolicyProperties(TypedDict, total=False): + key "ipAccessRulesPolicy": ForwardRef('IpAccessRulesPolicy', module='types') + key "policyType": Union[str, PolicyType] + key "provisioningState": Union[str, ProvisioningState] + key "wafPolicy": ForwardRef('WafPolicy', module='types') + ipAccessRulesPolicy: IpAccessRulesPolicy + policyType: Union[str, PolicyType] + provisioningState: Union[str, ProvisioningState] + wafPolicy: WafPolicy + + + class azure.mgmt.servicenetworking.types.SecurityPolicyUpdate(TypedDict, total=False): + key "properties": ForwardRef('SecurityPolicyUpdateProperties', module='types') + properties: SecurityPolicyUpdateProperties + tags: dict[str, str] + + + class azure.mgmt.servicenetworking.types.SecurityPolicyUpdateProperties(TypedDict, total=False): + key "ipAccessRulesPolicy": ForwardRef('IpAccessRulesPolicy', module='types') + key "wafPolicy": ForwardRef('WafPolicy', module='types') + ipAccessRulesPolicy: IpAccessRulesPolicy + wafPolicy: WafPolicy + + + class azure.mgmt.servicenetworking.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.servicenetworking.types.TrackedResource(Resource): + key "id": str + key "location": Required[str] + key "name": str + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + location: str + name: str + systemData: SystemData + tags: dict[str, str] + type: str + + + class azure.mgmt.servicenetworking.types.TrafficController(TrackedResource): + key "id": str + key "location": Required[str] + key "name": str + key "properties": ForwardRef('TrafficControllerProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + location: str + name: str + properties: TrafficControllerProperties + systemData: SystemData + tags: dict[str, str] + type: str + + + class azure.mgmt.servicenetworking.types.TrafficControllerProperties(TypedDict, total=False): + key "provisioningState": Union[str, ProvisioningState] + key "securityPolicyConfigurations": ForwardRef('SecurityPolicyConfigurations', module='types') + associations: list[ResourceId] + configurationEndpoints: list[str] + frontends: list[ResourceId] + privateEndpointConnections: list[ResourceId] + provisioningState: Union[str, ProvisioningState] + securityPolicies: list[ResourceId] + securityPolicyConfigurations: SecurityPolicyConfigurations + + + class azure.mgmt.servicenetworking.types.TrafficControllerUpdate(TypedDict, total=False): + key "properties": ForwardRef('TrafficControllerUpdateProperties', module='types') + properties: TrafficControllerUpdateProperties + tags: dict[str, str] + + + class azure.mgmt.servicenetworking.types.TrafficControllerUpdateProperties(TypedDict, total=False): + key "securityPolicyConfigurations": ForwardRef('SecurityPolicyConfigurations', module='types') + securityPolicyConfigurations: SecurityPolicyConfigurations + + + class azure.mgmt.servicenetworking.types.WafPolicy(TypedDict, total=False): + key "id": Required[str] + id: str + + + class azure.mgmt.servicenetworking.types.WafSecurityPolicy(TypedDict, total=False): + key "id": Required[str] + id: str + + +``` \ No newline at end of file diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/api.metadata.yml b/sdk/servicenetworking/azure-mgmt-servicenetworking/api.metadata.yml new file mode 100644 index 000000000000..c5b8cb697eba --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/api.metadata.yml @@ -0,0 +1,3 @@ +apiMdSha256: e55c1016eeca2cd7718acccfae650679de66af2551725826673dec05b2e92525 +parserVersion: 0.3.31 +pythonVersion: 3.13.15 diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/apiview-properties.json b/sdk/servicenetworking/azure-mgmt-servicenetworking/apiview-properties.json index 882d102bf4c5..dbcf643eec6a 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/apiview-properties.json +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/apiview-properties.json @@ -13,6 +13,7 @@ "azure.mgmt.servicenetworking.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", "azure.mgmt.servicenetworking.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", "azure.mgmt.servicenetworking.models.Frontend": "Microsoft.ServiceNetworking.Frontend", + "azure.mgmt.servicenetworking.models.FrontendAssociation": "Microsoft.ServiceNetworking.FrontendAssociation", "azure.mgmt.servicenetworking.models.FrontendProperties": "Microsoft.ServiceNetworking.FrontendProperties", "azure.mgmt.servicenetworking.models.FrontendUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", "azure.mgmt.servicenetworking.models.FrontendUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", @@ -21,6 +22,13 @@ "azure.mgmt.servicenetworking.models.IpAccessRulesSecurityPolicy": "Microsoft.ServiceNetworking.IpAccessRulesSecurityPolicy", "azure.mgmt.servicenetworking.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", "azure.mgmt.servicenetworking.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.servicenetworking.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.servicenetworking.models.PrivateEndpointConnection": "Microsoft.ServiceNetworking.PrivateEndpointConnection", + "azure.mgmt.servicenetworking.models.PrivateEndpointConnectionProperties": "Microsoft.ServiceNetworking.PrivateEndpointConnectionProperties", + "azure.mgmt.servicenetworking.models.PrivateEndpointReference": "Microsoft.ServiceNetworking.PrivateEndpointReference", + "azure.mgmt.servicenetworking.models.PrivateLinkResource": "Microsoft.ServiceNetworking.PrivateLinkResource", + "azure.mgmt.servicenetworking.models.PrivateLinkResourceProperties": "Microsoft.ServiceNetworking.PrivateLinkResourceProperties", + "azure.mgmt.servicenetworking.models.PrivateLinkServiceConnectionState": "Microsoft.ServiceNetworking.PrivateLinkServiceConnectionState", "azure.mgmt.servicenetworking.models.ResourceId": "Microsoft.ServiceNetworking.ResourceId", "azure.mgmt.servicenetworking.models.SecurityPolicy": "Microsoft.ServiceNetworking.SecurityPolicy", "azure.mgmt.servicenetworking.models.SecurityPolicyConfigurations": "Microsoft.ServiceNetworking.SecurityPolicyConfigurations", @@ -37,31 +45,68 @@ "azure.mgmt.servicenetworking.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", "azure.mgmt.servicenetworking.models.AssociationType": "Microsoft.ServiceNetworking.AssociationType", "azure.mgmt.servicenetworking.models.ProvisioningState": "Microsoft.ServiceNetworking.ProvisioningState", + "azure.mgmt.servicenetworking.models.PublicNetworkAccess": "Microsoft.ServiceNetworking.PublicNetworkAccess", "azure.mgmt.servicenetworking.models.PolicyType": "Microsoft.ServiceNetworking.PolicyType", "azure.mgmt.servicenetworking.models.IpAccessRuleAction": "Microsoft.ServiceNetworking.IpAccessRuleAction", + "azure.mgmt.servicenetworking.models.PrivateLinkServiceConnectionStatus": "Microsoft.ServiceNetworking.PrivateLinkServiceConnectionStatus", "azure.mgmt.servicenetworking.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", "azure.mgmt.servicenetworking.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.associations_interface.get": "Microsoft.ServiceNetworking.AssociationsInterface.get", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.associations_interface.begin_create_or_update": "Microsoft.ServiceNetworking.AssociationsInterface.createOrUpdate", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.associations_interface.update": "Microsoft.ServiceNetworking.AssociationsInterface.update", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.associations_interface.begin_delete": "Microsoft.ServiceNetworking.AssociationsInterface.delete", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.associations_interface.list_by_traffic_controller": "Microsoft.ServiceNetworking.AssociationsInterface.listByTrafficController", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.frontends_interface.get": "Microsoft.ServiceNetworking.FrontendsInterface.get", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.frontends_interface.begin_create_or_update": "Microsoft.ServiceNetworking.FrontendsInterface.createOrUpdate", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.frontends_interface.update": "Microsoft.ServiceNetworking.FrontendsInterface.update", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.frontends_interface.begin_delete": "Microsoft.ServiceNetworking.FrontendsInterface.delete", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.frontends_interface.list_by_traffic_controller": "Microsoft.ServiceNetworking.FrontendsInterface.listByTrafficController", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.security_policies_interface.get": "Microsoft.ServiceNetworking.SecurityPoliciesInterface.get", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.security_policies_interface.begin_create_or_update": "Microsoft.ServiceNetworking.SecurityPoliciesInterface.createOrUpdate", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.security_policies_interface.update": "Microsoft.ServiceNetworking.SecurityPoliciesInterface.update", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.security_policies_interface.begin_delete": "Microsoft.ServiceNetworking.SecurityPoliciesInterface.delete", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.security_policies_interface.list_by_traffic_controller": "Microsoft.ServiceNetworking.SecurityPoliciesInterface.listByTrafficController", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.traffic_controller_interface.get": "Microsoft.ServiceNetworking.TrafficControllerInterface.get", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.traffic_controller_interface.begin_create_or_update": "Microsoft.ServiceNetworking.TrafficControllerInterface.createOrUpdate", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.traffic_controller_interface.update": "Microsoft.ServiceNetworking.TrafficControllerInterface.update", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.traffic_controller_interface.begin_delete": "Microsoft.ServiceNetworking.TrafficControllerInterface.delete", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.traffic_controller_interface.list_by_resource_group": "Microsoft.ServiceNetworking.TrafficControllerInterface.listByResourceGroup", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.traffic_controller_interface.list_by_subscription": "Microsoft.ServiceNetworking.TrafficControllerInterface.listBySubscription", - "azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient.operations.list": "Azure.ResourceManager.Operations.list" - } + "azure.mgmt.servicenetworking.operations.AssociationsInterfaceOperations.get": "Microsoft.ServiceNetworking.AssociationsInterface.get", + "azure.mgmt.servicenetworking.aio.operations.AssociationsInterfaceOperations.get": "Microsoft.ServiceNetworking.AssociationsInterface.get", + "azure.mgmt.servicenetworking.operations.AssociationsInterfaceOperations.begin_create_or_update": "Microsoft.ServiceNetworking.AssociationsInterface.createOrUpdate", + "azure.mgmt.servicenetworking.aio.operations.AssociationsInterfaceOperations.begin_create_or_update": "Microsoft.ServiceNetworking.AssociationsInterface.createOrUpdate", + "azure.mgmt.servicenetworking.operations.AssociationsInterfaceOperations.update": "Microsoft.ServiceNetworking.AssociationsInterface.update", + "azure.mgmt.servicenetworking.aio.operations.AssociationsInterfaceOperations.update": "Microsoft.ServiceNetworking.AssociationsInterface.update", + "azure.mgmt.servicenetworking.operations.AssociationsInterfaceOperations.begin_delete": "Microsoft.ServiceNetworking.AssociationsInterface.delete", + "azure.mgmt.servicenetworking.aio.operations.AssociationsInterfaceOperations.begin_delete": "Microsoft.ServiceNetworking.AssociationsInterface.delete", + "azure.mgmt.servicenetworking.operations.AssociationsInterfaceOperations.list_by_traffic_controller": "Microsoft.ServiceNetworking.AssociationsInterface.listByTrafficController", + "azure.mgmt.servicenetworking.aio.operations.AssociationsInterfaceOperations.list_by_traffic_controller": "Microsoft.ServiceNetworking.AssociationsInterface.listByTrafficController", + "azure.mgmt.servicenetworking.operations.FrontendsInterfaceOperations.get": "Microsoft.ServiceNetworking.FrontendsInterface.get", + "azure.mgmt.servicenetworking.aio.operations.FrontendsInterfaceOperations.get": "Microsoft.ServiceNetworking.FrontendsInterface.get", + "azure.mgmt.servicenetworking.operations.FrontendsInterfaceOperations.begin_create_or_update": "Microsoft.ServiceNetworking.FrontendsInterface.createOrUpdate", + "azure.mgmt.servicenetworking.aio.operations.FrontendsInterfaceOperations.begin_create_or_update": "Microsoft.ServiceNetworking.FrontendsInterface.createOrUpdate", + "azure.mgmt.servicenetworking.operations.FrontendsInterfaceOperations.update": "Microsoft.ServiceNetworking.FrontendsInterface.update", + "azure.mgmt.servicenetworking.aio.operations.FrontendsInterfaceOperations.update": "Microsoft.ServiceNetworking.FrontendsInterface.update", + "azure.mgmt.servicenetworking.operations.FrontendsInterfaceOperations.begin_delete": "Microsoft.ServiceNetworking.FrontendsInterface.delete", + "azure.mgmt.servicenetworking.aio.operations.FrontendsInterfaceOperations.begin_delete": "Microsoft.ServiceNetworking.FrontendsInterface.delete", + "azure.mgmt.servicenetworking.operations.FrontendsInterfaceOperations.list_by_traffic_controller": "Microsoft.ServiceNetworking.FrontendsInterface.listByTrafficController", + "azure.mgmt.servicenetworking.aio.operations.FrontendsInterfaceOperations.list_by_traffic_controller": "Microsoft.ServiceNetworking.FrontendsInterface.listByTrafficController", + "azure.mgmt.servicenetworking.operations.SecurityPoliciesInterfaceOperations.get": "Microsoft.ServiceNetworking.SecurityPoliciesInterface.get", + "azure.mgmt.servicenetworking.aio.operations.SecurityPoliciesInterfaceOperations.get": "Microsoft.ServiceNetworking.SecurityPoliciesInterface.get", + "azure.mgmt.servicenetworking.operations.SecurityPoliciesInterfaceOperations.begin_create_or_update": "Microsoft.ServiceNetworking.SecurityPoliciesInterface.createOrUpdate", + "azure.mgmt.servicenetworking.aio.operations.SecurityPoliciesInterfaceOperations.begin_create_or_update": "Microsoft.ServiceNetworking.SecurityPoliciesInterface.createOrUpdate", + "azure.mgmt.servicenetworking.operations.SecurityPoliciesInterfaceOperations.update": "Microsoft.ServiceNetworking.SecurityPoliciesInterface.update", + "azure.mgmt.servicenetworking.aio.operations.SecurityPoliciesInterfaceOperations.update": "Microsoft.ServiceNetworking.SecurityPoliciesInterface.update", + "azure.mgmt.servicenetworking.operations.SecurityPoliciesInterfaceOperations.begin_delete": "Microsoft.ServiceNetworking.SecurityPoliciesInterface.delete", + "azure.mgmt.servicenetworking.aio.operations.SecurityPoliciesInterfaceOperations.begin_delete": "Microsoft.ServiceNetworking.SecurityPoliciesInterface.delete", + "azure.mgmt.servicenetworking.operations.SecurityPoliciesInterfaceOperations.list_by_traffic_controller": "Microsoft.ServiceNetworking.SecurityPoliciesInterface.listByTrafficController", + "azure.mgmt.servicenetworking.aio.operations.SecurityPoliciesInterfaceOperations.list_by_traffic_controller": "Microsoft.ServiceNetworking.SecurityPoliciesInterface.listByTrafficController", + "azure.mgmt.servicenetworking.operations.TrafficControllerInterfaceOperations.get": "Microsoft.ServiceNetworking.TrafficControllerInterface.get", + "azure.mgmt.servicenetworking.aio.operations.TrafficControllerInterfaceOperations.get": "Microsoft.ServiceNetworking.TrafficControllerInterface.get", + "azure.mgmt.servicenetworking.operations.TrafficControllerInterfaceOperations.begin_create_or_update": "Microsoft.ServiceNetworking.TrafficControllerInterface.createOrUpdate", + "azure.mgmt.servicenetworking.aio.operations.TrafficControllerInterfaceOperations.begin_create_or_update": "Microsoft.ServiceNetworking.TrafficControllerInterface.createOrUpdate", + "azure.mgmt.servicenetworking.operations.TrafficControllerInterfaceOperations.update": "Microsoft.ServiceNetworking.TrafficControllerInterface.update", + "azure.mgmt.servicenetworking.aio.operations.TrafficControllerInterfaceOperations.update": "Microsoft.ServiceNetworking.TrafficControllerInterface.update", + "azure.mgmt.servicenetworking.operations.TrafficControllerInterfaceOperations.begin_delete": "Microsoft.ServiceNetworking.TrafficControllerInterface.delete", + "azure.mgmt.servicenetworking.aio.operations.TrafficControllerInterfaceOperations.begin_delete": "Microsoft.ServiceNetworking.TrafficControllerInterface.delete", + "azure.mgmt.servicenetworking.operations.TrafficControllerInterfaceOperations.list_by_resource_group": "Microsoft.ServiceNetworking.TrafficControllerInterface.listByResourceGroup", + "azure.mgmt.servicenetworking.aio.operations.TrafficControllerInterfaceOperations.list_by_resource_group": "Microsoft.ServiceNetworking.TrafficControllerInterface.listByResourceGroup", + "azure.mgmt.servicenetworking.operations.TrafficControllerInterfaceOperations.list_by_subscription": "Microsoft.ServiceNetworking.TrafficControllerInterface.listBySubscription", + "azure.mgmt.servicenetworking.aio.operations.TrafficControllerInterfaceOperations.list_by_subscription": "Microsoft.ServiceNetworking.TrafficControllerInterface.listBySubscription", + "azure.mgmt.servicenetworking.operations.PrivateEndpointConnectionsInterfaceOperations.get": "Microsoft.ServiceNetworking.PrivateEndpointConnectionsInterface.get", + "azure.mgmt.servicenetworking.aio.operations.PrivateEndpointConnectionsInterfaceOperations.get": "Microsoft.ServiceNetworking.PrivateEndpointConnectionsInterface.get", + "azure.mgmt.servicenetworking.operations.PrivateEndpointConnectionsInterfaceOperations.begin_update": "Microsoft.ServiceNetworking.PrivateEndpointConnectionsInterface.update", + "azure.mgmt.servicenetworking.aio.operations.PrivateEndpointConnectionsInterfaceOperations.begin_update": "Microsoft.ServiceNetworking.PrivateEndpointConnectionsInterface.update", + "azure.mgmt.servicenetworking.operations.PrivateEndpointConnectionsInterfaceOperations.begin_delete": "Microsoft.ServiceNetworking.PrivateEndpointConnectionsInterface.delete", + "azure.mgmt.servicenetworking.aio.operations.PrivateEndpointConnectionsInterfaceOperations.begin_delete": "Microsoft.ServiceNetworking.PrivateEndpointConnectionsInterface.delete", + "azure.mgmt.servicenetworking.operations.PrivateEndpointConnectionsInterfaceOperations.list_by_traffic_controller": "Microsoft.ServiceNetworking.PrivateEndpointConnectionsInterface.listByTrafficController", + "azure.mgmt.servicenetworking.aio.operations.PrivateEndpointConnectionsInterfaceOperations.list_by_traffic_controller": "Microsoft.ServiceNetworking.PrivateEndpointConnectionsInterface.listByTrafficController", + "azure.mgmt.servicenetworking.operations.PrivateLinkResourcesInterfaceOperations.get": "Microsoft.ServiceNetworking.PrivateLinkResourcesInterface.get", + "azure.mgmt.servicenetworking.aio.operations.PrivateLinkResourcesInterfaceOperations.get": "Microsoft.ServiceNetworking.PrivateLinkResourcesInterface.get", + "azure.mgmt.servicenetworking.operations.PrivateLinkResourcesInterfaceOperations.list_by_traffic_controller": "Microsoft.ServiceNetworking.PrivateLinkResourcesInterface.listByTrafficController", + "azure.mgmt.servicenetworking.aio.operations.PrivateLinkResourcesInterfaceOperations.list_by_traffic_controller": "Microsoft.ServiceNetworking.PrivateLinkResourcesInterface.listByTrafficController", + "azure.mgmt.servicenetworking.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.servicenetworking.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list" + }, + "CrossLanguageVersion": "b823de08a498" } \ No newline at end of file diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/__init__.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/__init__.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/__init__.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/__init__.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_client.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_client.py index 03f087eb38cd..3a5e4190693f 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_client.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_client.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,8 +8,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 @@ -18,20 +19,28 @@ from azure.mgmt.core.tools import get_arm_endpoints from ._configuration import ServiceNetworkingMgmtClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import ( AssociationsInterfaceOperations, FrontendsInterfaceOperations, Operations, + PrivateEndpointConnectionsInterfaceOperations, + PrivateLinkResourcesInterfaceOperations, SecurityPoliciesInterfaceOperations, TrafficControllerInterfaceOperations, ) +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 ServiceNetworkingMgmtClient: +class ServiceNetworkingMgmtClient: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Traffic Controller Provider management API. :ivar associations_interface: AssociationsInterfaceOperations operations @@ -46,6 +55,13 @@ class ServiceNetworkingMgmtClient: :ivar traffic_controller_interface: TrafficControllerInterfaceOperations operations :vartype traffic_controller_interface: azure.mgmt.servicenetworking.operations.TrafficControllerInterfaceOperations + :ivar private_endpoint_connections_interface: PrivateEndpointConnectionsInterfaceOperations + operations + :vartype private_endpoint_connections_interface: + azure.mgmt.servicenetworking.operations.PrivateEndpointConnectionsInterfaceOperations + :ivar private_link_resources_interface: PrivateLinkResourcesInterfaceOperations operations + :vartype private_link_resources_interface: + azure.mgmt.servicenetworking.operations.PrivateLinkResourcesInterfaceOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.servicenetworking.operations.Operations :param credential: Credential used to authenticate requests to the service. Required. @@ -54,19 +70,28 @@ class ServiceNetworkingMgmtClient: :type subscription_id: str :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is - "2025-03-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are "2026-03-01" + 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. """ def __init__( - self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + self, + credential: "TokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any ) -> None: _endpoint = "{endpoint}" - _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: base_url = _endpoints["resource_manager"] @@ -75,6 +100,7 @@ def __init__( credential=credential, subscription_id=subscription_id, base_url=cast(str, base_url), + cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs ) @@ -114,6 +140,12 @@ def __init__( self.traffic_controller_interface = TrafficControllerInterfaceOperations( self._client, self._config, self._serialize, self._deserialize ) + self.private_endpoint_connections_interface = PrivateEndpointConnectionsInterfaceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources_interface = PrivateLinkResourcesInterfaceOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_configuration.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_configuration.py index 6e7414540292..be56a0efd4aa 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_configuration.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_configuration.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -14,10 +15,11 @@ from ._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class ServiceNetworkingMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes +class ServiceNetworkingMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Configuration for ServiceNetworkingMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,9 +31,12 @@ class ServiceNetworkingMgmtClientConfiguration: # pylint: disable=too-many-inst :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is - "2025-03-01-preview". Note that overriding this default value may result in unsupported - behavior. + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are "2026-03-01" + 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 """ @@ -40,9 +45,10 @@ def __init__( credential: "TokenCredential", subscription_id: str, base_url: str = "https://management.azure.com", + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-03-01-preview") + api_version: str = kwargs.pop("api_version", "2026-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,6 +58,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.base_url = base_url + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-servicenetworking/{}".format(VERSION)) diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_patch.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_patch.py index 8bcb627aa475..ea765788358a 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_patch.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_patch.py @@ -7,9 +7,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_utils/__init__.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_utils/__init__.py new file mode 100644 index 000000000000..8026245c2abc --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_model_base.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_utils/model_base.py similarity index 57% rename from sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_model_base.py rename to sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_utils/model_base.py index 49d5c7259389..35d5fc024978 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_model_base.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_utils/model_base.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -23,19 +23,26 @@ 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"] TZ_UTC = timezone.utc _T = typing.TypeVar("_T") +_NONE_TYPE = type(None) def _timedelta_as_isostr(td: timedelta) -> str: @@ -102,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": @@ -128,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) @@ -170,6 +208,21 @@ def default(self, o): # pylint: disable=too-many-return-statements r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" ) +_ARRAY_ENCODE_MAPPING = { + "pipeDelimited": "|", + "spaceDelimited": " ", + "commaDelimited": ",", + "newlineDelimited": "\n", +} + + +def _deserialize_array_encoded(delimit: str, attr): + if isinstance(attr, str): + if attr == "": + return [] + return attr.split(delimit) + return attr + def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: """Deserialize ISO-8601 formatted string into Datetime object. @@ -201,7 +254,7 @@ def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: test_utc = date_obj.utctimetuple() if test_utc.tm_year > 9999 or test_utc.tm_year < 1: raise OverflowError("Hit max or min date") - return date_obj + return date_obj # type: ignore[no-any-return] def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: @@ -255,7 +308,7 @@ def _deserialize_time(attr: typing.Union[str, time]) -> time: """ if isinstance(attr, time): return attr - return isodate.parse_time(attr) + return isodate.parse_time(attr) # type: ignore[no-any-return] def _deserialize_bytes(attr): @@ -279,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 @@ -291,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, @@ -308,12 +373,20 @@ 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: return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore @@ -345,16 +418,46 @@ def _get_model(module_name: str, model_name: str): class _MyMutableMapping(MutableMapping[str, typing.Any]): - def __init__(self, data: typing.Dict[str, typing.Any]) -> None: + def __init__(self, data: dict[str, typing.Any]) -> None: self._data = data def __contains__(self, key: typing.Any) -> bool: return key in self._data def __getitem__(self, key: str) -> typing.Any: + # If this key has been deserialized (for mutable types), we need to handle serialization + if hasattr(self, "_attr_to_rest_field"): + cache_attr = f"_deserialized_{key}" + if hasattr(self, cache_attr): + rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) + if rf: + value = self._data.get(key) + if isinstance(value, (dict, list, set)): + # For mutable types, serialize and return + # But also update _data with serialized form and clear flag + # so mutations via this returned value affect _data + serialized = _serialize(value, rf._format) + # If serialized form is same type (no transformation needed), + # return _data directly so mutations work + if isinstance(serialized, type(value)) and serialized == value: + return self._data.get(key) + # Otherwise return serialized copy and clear flag + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + # Store serialized form back + self._data[key] = serialized + return serialized return self._data.__getitem__(key) def __setitem__(self, key: str, value: typing.Any) -> None: + # Clear any cached deserialized value when setting through dictionary access + cache_attr = f"_deserialized_{key}" + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass self._data.__setitem__(key, value) def __delitem__(self, key: str) -> None: @@ -371,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() @@ -395,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: @@ -425,24 +528,24 @@ def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: return self._data.pop(key) return self._data.pop(key, default) - def popitem(self) -> typing.Tuple[str, typing.Any]: + 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) @@ -455,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: @@ -466,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: @@ -482,6 +588,8 @@ def _is_model(obj: typing.Any) -> bool: def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements if isinstance(o, list): + if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): + return _ARRAY_ENCODE_MAPPING[format].join(o) return [_serialize(x, format) for x in o] if isinstance(o, dict): return {k: _serialize(v, format) for k, v in o.items()} @@ -506,16 +614,14 @@ 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 return o -def _get_rest_field( - attr_to_rest_field: typing.Dict[str, "_RestField"], rest_name: str -) -> typing.Optional["_RestField"]: +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: try: return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) except StopIteration: @@ -534,69 +640,253 @@ 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 # could not see _attr_to_rest_field directly because subclass inherits it from parent class - _calculated: typing.Set[str] = set() + _calculated: set[str] = set() 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()} @@ -613,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__) @@ -623,7 +1022,7 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order - attr_to_rest_field: typing.Dict[str, _RestField] = { # map attribute name to rest_field property + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") } annotations = { @@ -638,7 +1037,10 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) if not rf._rest_name_input: rf._rest_name_input = attr - cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) + 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) @@ -667,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 @@ -680,7 +1082,7 @@ def _deserialize(cls, data, exist_discriminators): mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member return mapped_cls._deserialize(data, exist_discriminators) - def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: """Return a dict that can be turned into json using json.dump. :keyword bool exclude_readonly: Whether to remove the readonly properties. @@ -740,7 +1142,7 @@ def _deserialize_with_union(deserializers, obj): def _deserialize_dict( value_deserializer: typing.Optional[typing.Callable], module: typing.Optional[str], - obj: typing.Dict[typing.Any, typing.Any], + obj: dict[typing.Any, typing.Any], ): if obj is None: return obj @@ -750,7 +1152,7 @@ def _deserialize_dict( def _deserialize_multiple_sequence( - entry_deserializers: typing.List[typing.Optional[typing.Callable]], + entry_deserializers: list[typing.Optional[typing.Callable]], module: typing.Optional[str], obj, ): @@ -759,6 +1161,14 @@ def _deserialize_multiple_sequence( return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) +def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: + return ( + isinstance(deserializer, functools.partial) + and isinstance(deserializer.args[0], functools.partial) + and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable + ) + + def _deserialize_sequence( deserializer: typing.Optional[typing.Callable], module: typing.Optional[str], @@ -768,17 +1178,30 @@ def _deserialize_sequence( return obj if isinstance(obj, ET.Element): obj = list(obj) + + # encoded string may be deserialized to sequence + if isinstance(obj, str) and isinstance(deserializer, functools.partial): + # for list[str] + if _is_array_encoded_deserializer(deserializer): + return deserializer(obj) + + # for list[Union[...]] + if isinstance(deserializer.args[0], list): + for sub_deserializer in deserializer.args[0]: + if _is_array_encoded_deserializer(sub_deserializer): + return sub_deserializer(obj) + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) -def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]: +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: return sorted( types, key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), ) -def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-branches +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches annotation: typing.Any, module: typing.Optional[str], rf: typing.Optional["_RestField"] = None, @@ -818,16 +1241,18 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur # is it optional? try: - if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore + 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 != type(None)), module, rf # pyright: ignore + next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore ) return functools.partial(_deserialize_with_optional, if_obj_deserializer) # the type is Optional[Union[...]], we need to remove the None type from the Union annotation_copy = copy.copy(annotation) - annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) except AttributeError: pass @@ -843,7 +1268,10 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur return functools.partial(_deserialize_with_union, deserializers) try: - if annotation._name == "Dict": # pyright: ignore + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": value_deserializer = _get_deserialize_callable_from_annotation( annotation.__args__[1], module, rf # pyright: ignore ) @@ -856,7 +1284,10 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur except (AttributeError, IndexError): pass try: - if annotation._name in ["List", "Set", "Tuple", "Sequence"]: # pyright: ignore + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: if len(annotation.__args__) > 1: # pyright: ignore entry_deserializers = [ _get_deserialize_callable_from_annotation(dt, module, rf) @@ -905,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) @@ -940,14 +1375,14 @@ def _deserialize( def _failsafe_deserialize( deserializer: typing.Any, - value: typing.Any, + response: HttpResponse, module: typing.Optional[str] = None, rf: typing.Optional["_RestField"] = None, format: typing.Optional[str] = None, ) -> typing.Any: try: - return _deserialize(deserializer, value, module, rf, format) - except DeserializationError: + return _deserialize(deserializer, response.json(), module, rf, format) + except Exception: # pylint: disable=broad-except _LOGGER.warning( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -956,17 +1391,18 @@ def _failsafe_deserialize( def _failsafe_deserialize_xml( deserializer: typing.Any, - value: typing.Any, + response: HttpResponse, ) -> typing.Any: try: - return _deserialize_xml(deserializer, value) - except DeserializationError: + return _deserialize_xml(deserializer, response.text()) + except Exception: # pylint: disable=broad-except _LOGGER.warning( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) return None +# pylint: disable=too-many-instance-attributes class _RestField: def __init__( self, @@ -974,11 +1410,12 @@ def __init__( name: typing.Optional[str] = None, type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin is_discriminator: bool = False, - visibility: typing.Optional[typing.List[str]] = None, + visibility: typing.Optional[list[str]] = None, default: typing.Any = _UNSET, format: typing.Optional[str] = None, is_multipart_file_input: bool = False, - xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, ): self._type = type self._rest_name_input = name @@ -986,14 +1423,20 @@ 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: - return getattr(self._type, "args", [None])[0] + result = getattr(self._type, "args", [None])[0] + # type may be wrapped by nested functools.partial so we need to check for that + if isinstance(result, functools.partial): + return getattr(result, "args", [None])[0] + return result @property def _rest_name(self) -> str: @@ -1004,14 +1447,44 @@ def _rest_name(self) -> str: 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 - item = obj.get(self._rest_name) + # Use _data.get() directly to avoid triggering __getitem__ which clears the cache + 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: return item - return _deserialize(self._type, _serialize(item, self._format), rf=self) + + # For mutable types, we want mutations to directly affect _data + # Check if we've already deserialized this value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + # Return the value from _data directly (it's been deserialized in place) + return obj._data.get(self._rest_name) + + # 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 + if isinstance(deserialized, (dict, list, set)): + obj._data[self._rest_name] = deserialized + object.__setattr__(obj, cache_attr, True) # Mark as deserialized + return deserialized + + return deserialized def __set__(self, obj: Model, value) -> None: + # Clear the cached deserialized object when setting a new value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + object.__delattr__(obj, cache_attr) + if value is None: # we want to wipe out entries if users set attr to None try: @@ -1036,11 +1509,12 @@ def rest_field( *, name: typing.Optional[str] = None, type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[typing.List[str]] = None, + visibility: typing.Optional[list[str]] = None, default: typing.Any = _UNSET, format: typing.Optional[str] = None, is_multipart_file_input: bool = False, - xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, ) -> typing.Any: return _RestField( name=name, @@ -1050,6 +1524,7 @@ def rest_field( format=format, is_multipart_file_input=is_multipart_file_input, xml=xml, + deserializer=deserializer, ) @@ -1057,8 +1532,8 @@ def rest_discriminator( *, name: typing.Optional[str] = None, type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[typing.List[str]] = None, - xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, ) -> typing.Any: return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) @@ -1074,21 +1549,77 @@ 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, - parent_meta: typing.Optional[typing.Dict[str, typing.Any]] = None, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, wrapped_element: typing.Optional[ET.Element] = None, -) -> typing.Union[ET.Element, typing.List[ET.Element]]: +) -> typing.Union[ET.Element, list[ET.Element]]: if _is_model(o): model_meta = getattr(o, "_xml", {}) # 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 = [] @@ -1110,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") @@ -1122,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)) @@ -1136,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( @@ -1143,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, }, ) @@ -1152,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, }, ) @@ -1168,10 +1700,11 @@ def _get_element( def _get_wrapped_element( v: typing.Any, exclude_readonly: bool, - meta: typing.Optional[typing.Dict[str, typing.Any]], + 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)) @@ -1179,7 +1712,7 @@ def _get_wrapped_element( _get_element(v, exclude_readonly, meta, wrapped_element) else: wrapped_element.text = _get_primitive_type_value(v) - return wrapped_element + return wrapped_element # type: ignore[no-any-return] def _get_primitive_type_value(v) -> str: @@ -1192,9 +1725,29 @@ def _get_primitive_type_value(v) -> str: return str(v) -def _create_xml_element(tag, prefix=None, ns=None): - if prefix and ns: +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: + _safe_register_namespace(prefix, ns) if ns: return ET.Element("{" + ns + "}" + tag) return ET.Element(tag) @@ -1205,13 +1758,15 @@ def _deserialize_xml( value: str, ) -> typing.Any: element = ET.fromstring(value) # nosec + if _is_model(deserializer): + return deserializer._deserialize(element, []) return _deserialize(deserializer, element) def _convert_element(e: ET.Element): # dict case if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: - dict_result: typing.Dict[str, typing.Any] = {} + dict_result: dict[str, typing.Any] = {} for child in e: if dict_result.get(child.tag) is not None: if isinstance(dict_result[child.tag], list): @@ -1224,7 +1779,7 @@ def _convert_element(e: ET.Element): return dict_result # array case if len(e) > 0: - array_result: typing.List[typing.Any] = [] + array_result: list[typing.Any] = [] for child in e: array_result.append(_convert_element(child)) return array_result diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_serialization.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_utils/serialization.py similarity index 91% rename from sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_serialization.py rename to sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_utils/serialization.py index eb86ea23c965..ae08f9d89f74 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_serialization.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_utils/serialization.py @@ -21,7 +21,6 @@ import sys import codecs from typing import ( - Dict, Any, cast, Optional, @@ -31,7 +30,6 @@ Mapping, Callable, MutableMapping, - List, ) try: @@ -41,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] @@ -229,12 +231,12 @@ class Model: serialization and deserialization. """ - _subtype_map: Dict[str, Dict[str, Any]] = {} - _attribute_map: Dict[str, Dict[str, Any]] = {} - _validation: Dict[str, Dict[str, Any]] = {} + _subtype_map: dict[str, dict[str, Any]] = {} + _attribute_map: dict[str, dict[str, Any]] = {} + _validation: dict[str, dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Optional[Dict[str, Any]] = {} + self.additional_properties: Optional[dict[str, Any]] = {} for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -311,7 +313,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -380,7 +382,7 @@ def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: def from_dict( cls, data: Any, - key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, ) -> Self: """Parse a dict using given key extractor return a model. @@ -414,7 +416,7 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access return result @classmethod @@ -478,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"} @@ -518,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, @@ -528,7 +538,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -579,7 +589,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: - serialized.update(target_obj.additional_properties) + serialized |= target_obj.additional_properties continue try: @@ -789,7 +799,7 @@ def serialize_data(self, data, data_type, **kwargs): # If dependencies is empty, try with current data class # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) @@ -823,13 +833,20 @@ def serialize_basic(cls, data, data_type, **kwargs): :param str data_type: Type of object in the iterable. :rtype: str, int, float, bool :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) @classmethod def serialize_unicode(cls, data): @@ -1100,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. @@ -1184,7 +1256,7 @@ def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argumen while "." in key: # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(List[str], _FLATTEN.split(key)) + dict_keys = cast(list[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1372,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, @@ -1384,9 +1460,13 @@ 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 {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1396,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. @@ -1406,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) @@ -1759,7 +1860,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises TypeError: if string format is not valid. + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1785,7 +1886,11 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) @staticmethod def deserialize_unicode(data): @@ -1920,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/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_validation.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_validation.py index 752b2822f9d3..f5af3a4eb8a2 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_validation.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_validation.py @@ -10,6 +10,22 @@ def api_version_validation(**kwargs): params_added_on = kwargs.pop("params_added_on", {}) method_added_on = kwargs.pop("method_added_on", "") + api_versions_list = kwargs.pop("api_versions_list", []) + + def _index_with_default(value: str, default: int = -1) -> int: + """Get the index of value in lst, or return default if not found. + + :param value: The value to search for in the api_versions_list. + :type value: str + :param default: The default value to return if the value is not found. + :type default: int + :return: The index of the value in the list, or the default value if not found. + :rtype: int + """ + try: + return api_versions_list.index(value) + except ValueError: + return default def decorator(func): @functools.wraps(func) @@ -21,7 +37,7 @@ def wrapper(*args, **kwargs): except AttributeError: return func(*args, **kwargs) - if method_added_on > client_api_version: + if _index_with_default(method_added_on) > _index_with_default(client_api_version): raise ValueError( f"'{func.__name__}' is not available in API version " f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." @@ -31,7 +47,7 @@ def wrapper(*args, **kwargs): parameter: api_version for api_version, parameters in params_added_on.items() for parameter in parameters - if parameter in kwargs and api_version > client_api_version + if parameter in kwargs and _index_with_default(api_version) > _index_with_default(client_api_version) } if unsupported: raise ValueError( diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_version.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_version.py index 5e17bc520983..ccb75164d3bc 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_version.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.1.0b1" +VERSION = "2.1.0" diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/_client.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/_client.py index ed057811f766..cc235cde8efc 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/_client.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/_client.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,8 +8,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 @@ -17,21 +18,29 @@ from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import ServiceNetworkingMgmtClientConfiguration from .operations import ( AssociationsInterfaceOperations, FrontendsInterfaceOperations, Operations, + PrivateEndpointConnectionsInterfaceOperations, + PrivateLinkResourcesInterfaceOperations, SecurityPoliciesInterfaceOperations, TrafficControllerInterfaceOperations, ) +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 ServiceNetworkingMgmtClient: +class ServiceNetworkingMgmtClient: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Traffic Controller Provider management API. :ivar associations_interface: AssociationsInterfaceOperations operations @@ -46,6 +55,13 @@ class ServiceNetworkingMgmtClient: :ivar traffic_controller_interface: TrafficControllerInterfaceOperations operations :vartype traffic_controller_interface: azure.mgmt.servicenetworking.aio.operations.TrafficControllerInterfaceOperations + :ivar private_endpoint_connections_interface: PrivateEndpointConnectionsInterfaceOperations + operations + :vartype private_endpoint_connections_interface: + azure.mgmt.servicenetworking.aio.operations.PrivateEndpointConnectionsInterfaceOperations + :ivar private_link_resources_interface: PrivateLinkResourcesInterfaceOperations operations + :vartype private_link_resources_interface: + azure.mgmt.servicenetworking.aio.operations.PrivateLinkResourcesInterfaceOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.servicenetworking.aio.operations.Operations :param credential: Credential used to authenticate requests to the service. Required. @@ -54,19 +70,28 @@ class ServiceNetworkingMgmtClient: :type subscription_id: str :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is - "2025-03-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are "2026-03-01" + 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. """ def __init__( - self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any ) -> None: _endpoint = "{endpoint}" - _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: base_url = _endpoints["resource_manager"] @@ -75,6 +100,7 @@ def __init__( credential=credential, subscription_id=subscription_id, base_url=cast(str, base_url), + cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs ) @@ -116,6 +142,12 @@ def __init__( self.traffic_controller_interface = TrafficControllerInterfaceOperations( self._client, self._config, self._serialize, self._deserialize ) + self.private_endpoint_connections_interface = PrivateEndpointConnectionsInterfaceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources_interface = PrivateLinkResourcesInterfaceOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) def send_request( diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/_configuration.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/_configuration.py index 8bb56a9b2001..7c5b04fd2e23 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/_configuration.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/_configuration.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -14,10 +15,11 @@ from .._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class ServiceNetworkingMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes +class ServiceNetworkingMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Configuration for ServiceNetworkingMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,9 +31,12 @@ class ServiceNetworkingMgmtClientConfiguration: # pylint: disable=too-many-inst :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is - "2025-03-01-preview". Note that overriding this default value may result in unsupported - behavior. + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are "2026-03-01" + 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 """ @@ -40,9 +45,10 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, base_url: str = "https://management.azure.com", + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-03-01-preview") + api_version: str = kwargs.pop("api_version", "2026-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,6 +58,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.base_url = base_url + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-servicenetworking/{}".format(VERSION)) diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/_patch.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/_patch.py index 8bcb627aa475..ea765788358a 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/_patch.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/_patch.py @@ -7,9 +7,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/operations/__init__.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/operations/__init__.py index 38a4f6af8bbf..4cde903ba4fb 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/operations/__init__.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/operations/__init__.py @@ -16,6 +16,8 @@ from ._operations import FrontendsInterfaceOperations # type: ignore from ._operations import SecurityPoliciesInterfaceOperations # type: ignore from ._operations import TrafficControllerInterfaceOperations # type: ignore +from ._operations import PrivateEndpointConnectionsInterfaceOperations # type: ignore +from ._operations import PrivateLinkResourcesInterfaceOperations # type: ignore from ._operations import Operations # type: ignore from ._patch import __all__ as _patch_all @@ -27,6 +29,8 @@ "FrontendsInterfaceOperations", "SecurityPoliciesInterfaceOperations", "TrafficControllerInterfaceOperations", + "PrivateEndpointConnectionsInterfaceOperations", + "PrivateLinkResourcesInterfaceOperations", "Operations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/operations/_operations.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/operations/_operations.py index 05d631083bcc..2235271b19cd 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/operations/_operations.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/operations/_operations.py @@ -9,7 +9,7 @@ from collections.abc import MutableMapping from io import IOBase import json -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -33,9 +33,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models as _models -from ..._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize -from ..._serialization import Deserializer, Serializer +from ... import models as _models, types as _types +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer from ..._validation import api_version_validation from ...operations._operations import ( build_associations_interface_create_or_update_request, @@ -49,6 +49,12 @@ build_frontends_interface_list_by_traffic_controller_request, build_frontends_interface_update_request, build_operations_list_request, + build_private_endpoint_connections_interface_delete_request, + build_private_endpoint_connections_interface_get_request, + build_private_endpoint_connections_interface_list_by_traffic_controller_request, + build_private_endpoint_connections_interface_update_request, + build_private_link_resources_interface_get_request, + build_private_link_resources_interface_list_by_traffic_controller_request, build_security_policies_interface_create_or_update_request, build_security_policies_interface_delete_request, build_security_policies_interface_get_request, @@ -63,12 +69,12 @@ ) from .._configuration import ServiceNetworkingMgmtClientConfiguration -JSON = MutableMapping[str, Any] T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list -class AssociationsInterfaceOperations: +class AssociationsInterfaceOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -131,6 +137,7 @@ async def get( } _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 @@ -145,11 +152,14 @@ async def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.Association, response.json()) @@ -163,7 +173,7 @@ async def _create_or_update_initial( resource_group_name: str, traffic_controller_name: str, association_name: str, - resource: Union[_models.Association, JSON, IO[bytes]], + resource: Union[_models.Association, _types.Association, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -203,6 +213,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 @@ -216,14 +227,17 @@ async def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 201: 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 @@ -267,7 +281,7 @@ async def begin_create_or_update( resource_group_name: str, traffic_controller_name: str, association_name: str, - resource: JSON, + resource: _types.Association, *, content_type: str = "application/json", **kwargs: Any @@ -282,7 +296,7 @@ async def begin_create_or_update( :param association_name: Name of Association. Required. :type association_name: str :param resource: Resource create parameters. Required. - :type resource: JSON + :type resource: ~azure.mgmt.servicenetworking.types.Association :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -329,7 +343,7 @@ async def begin_create_or_update( resource_group_name: str, traffic_controller_name: str, association_name: str, - resource: Union[_models.Association, JSON, IO[bytes]], + resource: Union[_models.Association, _types.Association, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Association]: """Create a Association. @@ -341,9 +355,10 @@ async def begin_create_or_update( :type traffic_controller_name: str :param association_name: Name of Association. Required. :type association_name: str - :param resource: Resource create parameters. Is one of the following types: Association, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.servicenetworking.models.Association or JSON or IO[bytes] + :param resource: Resource create parameters. Is either a Association type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.servicenetworking.models.Association or + ~azure.mgmt.servicenetworking.types.Association or IO[bytes] :return: An instance of AsyncLROPoller that returns Association. The Association is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicenetworking.models.Association] @@ -438,7 +453,7 @@ async def update( resource_group_name: str, traffic_controller_name: str, association_name: str, - properties: JSON, + properties: _types.AssociationUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -453,7 +468,7 @@ async def update( :param association_name: Name of Association. Required. :type association_name: str :param properties: The resource properties to be updated. Required. - :type properties: JSON + :type properties: ~azure.mgmt.servicenetworking.types.AssociationUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -498,7 +513,7 @@ async def update( resource_group_name: str, traffic_controller_name: str, association_name: str, - properties: Union[_models.AssociationUpdate, JSON, IO[bytes]], + properties: Union[_models.AssociationUpdate, _types.AssociationUpdate, IO[bytes]], **kwargs: Any ) -> _models.Association: """Update a Association. @@ -510,9 +525,10 @@ async def update( :type traffic_controller_name: str :param association_name: Name of Association. Required. :type association_name: str - :param properties: The resource properties to be updated. Is one of the following types: - AssociationUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.servicenetworking.models.AssociationUpdate or JSON or IO[bytes] + :param properties: The resource properties to be updated. Is either a AssociationUpdate type or + a IO[bytes] type. Required. + :type properties: ~azure.mgmt.servicenetworking.models.AssociationUpdate or + ~azure.mgmt.servicenetworking.types.AssociationUpdate or IO[bytes] :return: Association. The Association is compatible with MutableMapping :rtype: ~azure.mgmt.servicenetworking.models.Association :raises ~azure.core.exceptions.HttpResponseError: @@ -554,6 +570,7 @@ async def update( } _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 @@ -568,11 +585,14 @@ async def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.Association, response.json()) @@ -611,6 +631,7 @@ async def _delete_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 @@ -624,7 +645,10 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -632,7 +656,7 @@ async def _delete_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 @@ -704,7 +728,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace def list_by_traffic_controller( self, resource_group_name: str, traffic_controller_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Association"]: + ) -> AsyncItemPaged["_models.Association"]: """List Association resources by TrafficController. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -759,7 +783,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( @@ -772,7 +799,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.Association], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.Association], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -788,7 +818,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -796,7 +829,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class FrontendsInterfaceOperations: +class FrontendsInterfaceOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -859,6 +892,7 @@ async def get( } _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 @@ -873,11 +907,14 @@ async def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.Frontend, response.json()) @@ -891,7 +928,7 @@ async def _create_or_update_initial( resource_group_name: str, traffic_controller_name: str, frontend_name: str, - resource: Union[_models.Frontend, JSON, IO[bytes]], + resource: Union[_models.Frontend, _types.Frontend, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -931,6 +968,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 @@ -944,14 +982,17 @@ async def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 201: 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 @@ -995,7 +1036,7 @@ async def begin_create_or_update( resource_group_name: str, traffic_controller_name: str, frontend_name: str, - resource: JSON, + resource: _types.Frontend, *, content_type: str = "application/json", **kwargs: Any @@ -1010,7 +1051,7 @@ async def begin_create_or_update( :param frontend_name: Frontends. Required. :type frontend_name: str :param resource: Resource create parameters. Required. - :type resource: JSON + :type resource: ~azure.mgmt.servicenetworking.types.Frontend :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1057,7 +1098,7 @@ async def begin_create_or_update( resource_group_name: str, traffic_controller_name: str, frontend_name: str, - resource: Union[_models.Frontend, JSON, IO[bytes]], + resource: Union[_models.Frontend, _types.Frontend, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Frontend]: """Create a Frontend. @@ -1069,9 +1110,10 @@ async def begin_create_or_update( :type traffic_controller_name: str :param frontend_name: Frontends. Required. :type frontend_name: str - :param resource: Resource create parameters. Is one of the following types: Frontend, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.servicenetworking.models.Frontend or JSON or IO[bytes] + :param resource: Resource create parameters. Is either a Frontend type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.servicenetworking.models.Frontend or + ~azure.mgmt.servicenetworking.types.Frontend or IO[bytes] :return: An instance of AsyncLROPoller that returns Frontend. The Frontend is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicenetworking.models.Frontend] @@ -1166,7 +1208,7 @@ async def update( resource_group_name: str, traffic_controller_name: str, frontend_name: str, - properties: JSON, + properties: _types.FrontendUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -1181,7 +1223,7 @@ async def update( :param frontend_name: Frontends. Required. :type frontend_name: str :param properties: The resource properties to be updated. Required. - :type properties: JSON + :type properties: ~azure.mgmt.servicenetworking.types.FrontendUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1226,7 +1268,7 @@ async def update( resource_group_name: str, traffic_controller_name: str, frontend_name: str, - properties: Union[_models.FrontendUpdate, JSON, IO[bytes]], + properties: Union[_models.FrontendUpdate, _types.FrontendUpdate, IO[bytes]], **kwargs: Any ) -> _models.Frontend: """Update a Frontend. @@ -1238,9 +1280,10 @@ async def update( :type traffic_controller_name: str :param frontend_name: Frontends. Required. :type frontend_name: str - :param properties: The resource properties to be updated. Is one of the following types: - FrontendUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.servicenetworking.models.FrontendUpdate or JSON or IO[bytes] + :param properties: The resource properties to be updated. Is either a FrontendUpdate type or a + IO[bytes] type. Required. + :type properties: ~azure.mgmt.servicenetworking.models.FrontendUpdate or + ~azure.mgmt.servicenetworking.types.FrontendUpdate or IO[bytes] :return: Frontend. The Frontend is compatible with MutableMapping :rtype: ~azure.mgmt.servicenetworking.models.Frontend :raises ~azure.core.exceptions.HttpResponseError: @@ -1282,6 +1325,7 @@ async def update( } _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 @@ -1296,11 +1340,14 @@ async def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.Frontend, response.json()) @@ -1339,6 +1386,7 @@ async def _delete_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 @@ -1352,7 +1400,10 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1360,7 +1411,7 @@ async def _delete_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 @@ -1432,7 +1483,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace def list_by_traffic_controller( self, resource_group_name: str, traffic_controller_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Frontend"]: + ) -> AsyncItemPaged["_models.Frontend"]: """List Frontend resources by TrafficController. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1486,7 +1537,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( @@ -1499,7 +1553,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.Frontend], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.Frontend], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1515,7 +1572,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1523,7 +1583,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class SecurityPoliciesInterfaceOperations: +class SecurityPoliciesInterfaceOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -1555,6 +1615,7 @@ def __init__(self, *args, **kwargs) -> None: "accept", ] }, + api_versions_list=["2024-05-01-preview", "2025-01-01", "2025-03-01-preview", "2026-03-01"], ) async def get( self, resource_group_name: str, traffic_controller_name: str, security_policy_name: str, **kwargs: Any @@ -1599,6 +1660,7 @@ async def get( } _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 @@ -1613,11 +1675,14 @@ async def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.SecurityPolicy, response.json()) @@ -1639,13 +1704,14 @@ async def get( "accept", ] }, + api_versions_list=["2024-05-01-preview", "2025-01-01", "2025-03-01-preview", "2026-03-01"], ) async def _create_or_update_initial( self, resource_group_name: str, traffic_controller_name: str, security_policy_name: str, - resource: Union[_models.SecurityPolicy, JSON, IO[bytes]], + resource: Union[_models.SecurityPolicy, _types.SecurityPolicy, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -1685,6 +1751,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 @@ -1698,14 +1765,17 @@ async def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 201: 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 @@ -1749,7 +1819,7 @@ async def begin_create_or_update( resource_group_name: str, traffic_controller_name: str, security_policy_name: str, - resource: JSON, + resource: _types.SecurityPolicy, *, content_type: str = "application/json", **kwargs: Any @@ -1764,7 +1834,7 @@ async def begin_create_or_update( :param security_policy_name: SecurityPolicy. Required. :type security_policy_name: str :param resource: Resource create parameters. Required. - :type resource: JSON + :type resource: ~azure.mgmt.servicenetworking.types.SecurityPolicy :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1819,13 +1889,14 @@ async def begin_create_or_update( "accept", ] }, + api_versions_list=["2024-05-01-preview", "2025-01-01", "2025-03-01-preview", "2026-03-01"], ) async def begin_create_or_update( self, resource_group_name: str, traffic_controller_name: str, security_policy_name: str, - resource: Union[_models.SecurityPolicy, JSON, IO[bytes]], + resource: Union[_models.SecurityPolicy, _types.SecurityPolicy, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.SecurityPolicy]: """Create a SecurityPolicy. @@ -1837,9 +1908,10 @@ async def begin_create_or_update( :type traffic_controller_name: str :param security_policy_name: SecurityPolicy. Required. :type security_policy_name: str - :param resource: Resource create parameters. Is one of the following types: SecurityPolicy, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.servicenetworking.models.SecurityPolicy or JSON or IO[bytes] + :param resource: Resource create parameters. Is either a SecurityPolicy type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.servicenetworking.models.SecurityPolicy or + ~azure.mgmt.servicenetworking.types.SecurityPolicy or IO[bytes] :return: An instance of AsyncLROPoller that returns SecurityPolicy. The SecurityPolicy is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicenetworking.models.SecurityPolicy] @@ -1934,7 +2006,7 @@ async def update( resource_group_name: str, traffic_controller_name: str, security_policy_name: str, - properties: JSON, + properties: _types.SecurityPolicyUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -1949,7 +2021,7 @@ async def update( :param security_policy_name: SecurityPolicy. Required. :type security_policy_name: str :param properties: The resource properties to be updated. Required. - :type properties: JSON + :type properties: ~azure.mgmt.servicenetworking.types.SecurityPolicyUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -2002,13 +2074,14 @@ async def update( "accept", ] }, + api_versions_list=["2024-05-01-preview", "2025-01-01", "2025-03-01-preview", "2026-03-01"], ) async def update( self, resource_group_name: str, traffic_controller_name: str, security_policy_name: str, - properties: Union[_models.SecurityPolicyUpdate, JSON, IO[bytes]], + properties: Union[_models.SecurityPolicyUpdate, _types.SecurityPolicyUpdate, IO[bytes]], **kwargs: Any ) -> _models.SecurityPolicy: """Update a SecurityPolicy. @@ -2020,10 +2093,10 @@ async def update( :type traffic_controller_name: str :param security_policy_name: SecurityPolicy. Required. :type security_policy_name: str - :param properties: The resource properties to be updated. Is one of the following types: - SecurityPolicyUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.servicenetworking.models.SecurityPolicyUpdate or JSON or - IO[bytes] + :param properties: The resource properties to be updated. Is either a SecurityPolicyUpdate type + or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.servicenetworking.models.SecurityPolicyUpdate or + ~azure.mgmt.servicenetworking.types.SecurityPolicyUpdate or IO[bytes] :return: SecurityPolicy. The SecurityPolicy is compatible with MutableMapping :rtype: ~azure.mgmt.servicenetworking.models.SecurityPolicy :raises ~azure.core.exceptions.HttpResponseError: @@ -2065,6 +2138,7 @@ async def update( } _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 @@ -2079,11 +2153,14 @@ async def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.SecurityPolicy, response.json()) @@ -2101,9 +2178,9 @@ async def update( "resource_group_name", "traffic_controller_name", "security_policy_name", - "accept", ] }, + api_versions_list=["2024-05-01-preview", "2025-01-01", "2025-03-01-preview", "2026-03-01"], ) async def _delete_initial( self, resource_group_name: str, traffic_controller_name: str, security_policy_name: str, **kwargs: Any @@ -2135,6 +2212,7 @@ async def _delete_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 @@ -2148,7 +2226,10 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -2156,7 +2237,7 @@ async def _delete_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 @@ -2173,9 +2254,9 @@ async def _delete_initial( "resource_group_name", "traffic_controller_name", "security_policy_name", - "accept", ] }, + api_versions_list=["2024-05-01-preview", "2025-01-01", "2025-03-01-preview", "2026-03-01"], ) async def begin_delete( self, resource_group_name: str, traffic_controller_name: str, security_policy_name: str, **kwargs: Any @@ -2250,10 +2331,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- "accept", ] }, + api_versions_list=["2024-05-01-preview", "2025-01-01", "2025-03-01-preview", "2026-03-01"], ) def list_by_traffic_controller( self, resource_group_name: str, traffic_controller_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SecurityPolicy"]: + ) -> AsyncItemPaged["_models.SecurityPolicy"]: """List SecurityPolicy resources by TrafficController. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2308,7 +2390,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( @@ -2321,7 +2406,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.SecurityPolicy], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.SecurityPolicy], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -2337,7 +2425,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -2345,7 +2436,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class TrafficControllerInterfaceOperations: +class TrafficControllerInterfaceOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -2405,6 +2496,7 @@ async def get( } _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 @@ -2419,11 +2511,14 @@ async def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.TrafficController, response.json()) @@ -2436,7 +2531,7 @@ async def _create_or_update_initial( self, resource_group_name: str, traffic_controller_name: str, - resource: Union[_models.TrafficController, JSON, IO[bytes]], + resource: Union[_models.TrafficController, _types.TrafficController, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -2475,6 +2570,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 @@ -2488,14 +2584,17 @@ async def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 201: 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 @@ -2536,7 +2635,7 @@ async def begin_create_or_update( self, resource_group_name: str, traffic_controller_name: str, - resource: JSON, + resource: _types.TrafficController, *, content_type: str = "application/json", **kwargs: Any @@ -2549,7 +2648,7 @@ async def begin_create_or_update( :param traffic_controller_name: traffic controller name for path. Required. :type traffic_controller_name: str :param resource: Resource create parameters. Required. - :type resource: JSON + :type resource: ~azure.mgmt.servicenetworking.types.TrafficController :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -2594,7 +2693,7 @@ async def begin_create_or_update( self, resource_group_name: str, traffic_controller_name: str, - resource: Union[_models.TrafficController, JSON, IO[bytes]], + resource: Union[_models.TrafficController, _types.TrafficController, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.TrafficController]: """Create a TrafficController. @@ -2604,9 +2703,10 @@ async def begin_create_or_update( :type resource_group_name: str :param traffic_controller_name: traffic controller name for path. Required. :type traffic_controller_name: str - :param resource: Resource create parameters. Is one of the following types: TrafficController, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.servicenetworking.models.TrafficController or JSON or IO[bytes] + :param resource: Resource create parameters. Is either a TrafficController type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.servicenetworking.models.TrafficController or + ~azure.mgmt.servicenetworking.types.TrafficController or IO[bytes] :return: An instance of AsyncLROPoller that returns TrafficController. The TrafficController is compatible with MutableMapping :rtype: @@ -2697,7 +2797,7 @@ async def update( self, resource_group_name: str, traffic_controller_name: str, - properties: JSON, + properties: _types.TrafficControllerUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -2710,7 +2810,7 @@ async def update( :param traffic_controller_name: traffic controller name for path. Required. :type traffic_controller_name: str :param properties: The resource properties to be updated. Required. - :type properties: JSON + :type properties: ~azure.mgmt.servicenetworking.types.TrafficControllerUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -2751,7 +2851,7 @@ async def update( self, resource_group_name: str, traffic_controller_name: str, - properties: Union[_models.TrafficControllerUpdate, JSON, IO[bytes]], + properties: Union[_models.TrafficControllerUpdate, _types.TrafficControllerUpdate, IO[bytes]], **kwargs: Any ) -> _models.TrafficController: """Update a TrafficController. @@ -2761,10 +2861,10 @@ async def update( :type resource_group_name: str :param traffic_controller_name: traffic controller name for path. Required. :type traffic_controller_name: str - :param properties: The resource properties to be updated. Is one of the following types: - TrafficControllerUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.servicenetworking.models.TrafficControllerUpdate or JSON or - IO[bytes] + :param properties: The resource properties to be updated. Is either a TrafficControllerUpdate + type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.servicenetworking.models.TrafficControllerUpdate or + ~azure.mgmt.servicenetworking.types.TrafficControllerUpdate or IO[bytes] :return: TrafficController. The TrafficController is compatible with MutableMapping :rtype: ~azure.mgmt.servicenetworking.models.TrafficController :raises ~azure.core.exceptions.HttpResponseError: @@ -2805,6 +2905,7 @@ async def update( } _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 @@ -2819,11 +2920,14 @@ async def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.TrafficController, response.json()) @@ -2861,6 +2965,7 @@ async def _delete_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 @@ -2874,7 +2979,10 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -2882,7 +2990,7 @@ async def _delete_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 @@ -2951,7 +3059,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.TrafficController"]: + ) -> AsyncItemPaged["_models.TrafficController"]: """List TrafficController resources by resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3003,7 +3111,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( @@ -3016,7 +3127,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.TrafficController], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.TrafficController], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -3032,7 +3146,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -3040,7 +3157,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.TrafficController"]: + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.TrafficController"]: """List TrafficController resources by subscription ID. :return: An iterator like instance of TrafficController @@ -3088,7 +3205,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( @@ -3101,7 +3221,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.TrafficController], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.TrafficController], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -3117,7 +3240,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -3125,14 +3251,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class Operations: +class PrivateEndpointConnectionsInterfaceOperations: # pylint: disable=docstring-missing-param,name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.servicenetworking.aio.ServiceNetworkingMgmtClient`'s - :attr:`operations` attribute. + :attr:`private_endpoint_connections_interface` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -3144,19 +3270,123 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: - """List the operations for the provider. + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": [ + "api_version", + "subscription_id", + "resource_group_name", + "traffic_controller_name", + "private_endpoint_connection_name", + "accept", + ] + }, + api_versions_list=["2026-03-01"], + ) + async def get( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Get a PrivateEndpointConnection. - :return: An iterator like instance of Operation - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicenetworking.models.Operation] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :param private_endpoint_connection_name: Private Endpoint Connection. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicenetworking.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_interface_get_request( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _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 + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": [ + "api_version", + "subscription_id", + "resource_group_name", + "traffic_controller_name", + "private_endpoint_connection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-01"], + ) + async def _update_initial( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3165,62 +3395,854 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - _request = build_operations_list_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _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 - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - return _request + _request = build_private_endpoint_connections_interface_update_request( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - 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) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Create a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :param private_endpoint_connection_name: Private Endpoint Connection. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.servicenetworking.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicenetworking.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: _types.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Create a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :param private_endpoint_connection_name: Private Endpoint Connection. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.servicenetworking.types.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicenetworking.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Create a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :param private_endpoint_connection_name: Private Endpoint Connection. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicenetworking.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": [ + "api_version", + "subscription_id", + "resource_group_name", + "traffic_controller_name", + "private_endpoint_connection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-01"], + ) + async def begin_update( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Create a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :param private_endpoint_connection_name: Private Endpoint Connection. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Is either a PrivateEndpointConnection type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.servicenetworking.models.PrivateEndpointConnection or + ~azure.mgmt.servicenetworking.types.PrivateEndpointConnection or IO[bytes] + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicenetworking.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + private_endpoint_connection_name=private_endpoint_connection_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": [ + "api_version", + "subscription_id", + "resource_group_name", + "traffic_controller_name", + "private_endpoint_connection_name", + ] + }, + api_versions_list=["2026-03-01"], + ) + async def _delete_initial( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_interface_delete_request( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _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 + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + 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() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": [ + "api_version", + "subscription_id", + "resource_group_name", + "traffic_controller_name", + "private_endpoint_connection_name", + ] + }, + api_versions_list=["2026-03-01"], + ) + async def begin_delete( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :param private_endpoint_connection_name: Private Endpoint Connection. Required. + :type private_endpoint_connection_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": ["api_version", "subscription_id", "resource_group_name", "traffic_controller_name", "accept"] + }, + api_versions_list=["2026-03-01"], + ) + def list_by_traffic_controller( + self, resource_group_name: str, traffic_controller_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: + """List PrivateEndpointConnection resources by TrafficController. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicenetworking.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_interface_list_by_traffic_controller_request( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateEndpointConnection], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class PrivateLinkResourcesInterfaceOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicenetworking.aio.ServiceNetworkingMgmtClient`'s + :attr:`private_link_resources_interface` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceNetworkingMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": [ + "api_version", + "subscription_id", + "resource_group_name", + "traffic_controller_name", + "private_link_resource_name", + "accept", + ] + }, + api_versions_list=["2026-03-01"], + ) + async def get( + self, resource_group_name: str, traffic_controller_name: str, private_link_resource_name: str, **kwargs: Any + ) -> _models.PrivateLinkResource: + """Get a PrivateLinkResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :param private_link_resource_name: Private Link Resource. Required. + :type private_link_resource_name: str + :return: PrivateLinkResource. The PrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicenetworking.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) + + _request = build_private_link_resources_interface_get_request( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + private_link_resource_name=private_link_resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _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 + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateLinkResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": ["api_version", "subscription_id", "resource_group_name", "traffic_controller_name", "accept"] + }, + api_versions_list=["2026-03-01"], + ) + def list_by_traffic_controller( + self, resource_group_name: str, traffic_controller_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateLinkResource"]: + """List PrivateLinkResource resources by TrafficController. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicenetworking.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateLinkResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_link_resources_interface_list_by_traffic_controller_request( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateLinkResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class Operations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicenetworking.aio.ServiceNetworkingMgmtClient`'s + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceNetworkingMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicenetworking.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + 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) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/operations/_patch.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/operations/_patch.py index 8bcb627aa475..ea765788358a 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/operations/_patch.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/aio/operations/_patch.py @@ -7,9 +7,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/__init__.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/__init__.py index 2e6d3003c183..5edfc877ace9 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/__init__.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/__init__.py @@ -24,6 +24,7 @@ ErrorDetail, ErrorResponse, Frontend, + FrontendAssociation, FrontendProperties, FrontendUpdate, FrontendUpdateProperties, @@ -32,6 +33,13 @@ IpAccessRulesSecurityPolicy, Operation, OperationDisplay, + PrivateEndpointConnection, + PrivateEndpointConnectionProperties, + PrivateEndpointReference, + PrivateLinkResource, + PrivateLinkResourceProperties, + PrivateLinkServiceConnectionState, + ProxyResource, Resource, ResourceId, SecurityPolicy, @@ -56,7 +64,9 @@ IpAccessRuleAction, Origin, PolicyType, + PrivateLinkServiceConnectionStatus, ProvisioningState, + PublicNetworkAccess, ) from ._patch import __all__ as _patch_all from ._patch import * @@ -73,6 +83,7 @@ "ErrorDetail", "ErrorResponse", "Frontend", + "FrontendAssociation", "FrontendProperties", "FrontendUpdate", "FrontendUpdateProperties", @@ -81,6 +92,13 @@ "IpAccessRulesSecurityPolicy", "Operation", "OperationDisplay", + "PrivateEndpointConnection", + "PrivateEndpointConnectionProperties", + "PrivateEndpointReference", + "PrivateLinkResource", + "PrivateLinkResourceProperties", + "PrivateLinkServiceConnectionState", + "ProxyResource", "Resource", "ResourceId", "SecurityPolicy", @@ -102,7 +120,9 @@ "IpAccessRuleAction", "Origin", "PolicyType", + "PrivateLinkServiceConnectionStatus", "ProvisioningState", + "PublicNetworkAccess", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/_enums.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/_enums.py index 4cfa90ca8331..cb88df644e62 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/_enums.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/_enums.py @@ -23,7 +23,7 @@ class AssociationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Association Type Enum.""" SUBNETS = "subnets" - """Association of Type Subnet""" + """Association of Type Subnet.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -43,9 +43,9 @@ class IpAccessRuleAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Action of Ip Access Rule.""" ALLOW = "allow" - """Allow Source Ip Prefixes""" + """Allow Source Ip Prefixes.""" DENY = "deny" - """Deny Source Ip Prefixes""" + """Deny Source Ip Prefixes.""" class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -65,25 +65,48 @@ class PolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Policy Type of the Security Policy.""" WAF = "waf" - """Policy of Type WAF""" + """Policy of Type WAF.""" IP_ACCESS_RULES = "ipAccessRules" - """Policy of Type IpAccessRules""" + """Policy of Type IpAccessRules.""" + + +class PrivateLinkServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The private endpoint connection status.""" + + PENDING = "Pending" + """Connection is pending approval.""" + APPROVED = "Approved" + """Connection is approved.""" + REJECTED = "Rejected" + """Connection is rejected.""" + DISCONNECTED = "Disconnected" + """Connection is disconnected.""" class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Resource Provisioning State Enum.""" PROVISIONING = "Provisioning" - """Resource in Provisioning State""" + """Resource in Provisioning State.""" UPDATING = "Updating" - """Resource in Updating State""" + """Resource in Updating State.""" DELETING = "Deleting" - """Resource in Deleting State""" + """Resource in Deleting State.""" ACCEPTED = "Accepted" - """Resource in Accepted State""" + """Resource in Accepted State.""" SUCCEEDED = "Succeeded" - """Resource in Succeeded State""" + """Resource in Succeeded State.""" FAILED = "Failed" - """Resource in Failed State""" + """Resource in Failed State.""" CANCELED = "Canceled" - """Resource in Canceled State""" + """Resource in Canceled State.""" + + +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether public network access is allowed for the frontend.""" + + ENABLED = "Enabled" + """Public network access is enabled (public frontend accessible via a public IP address).""" + DISABLED = "Disabled" + """Public network access is disabled (private frontend accessible only through a private + endpoint).""" diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/_models.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/_models.py index 25746de88360..9f00bd8f73da 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/_models.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/_models.py @@ -9,17 +9,16 @@ # pylint: disable=useless-super-delegation import datetime -from typing import Any, Dict, List, Mapping, Optional, TYPE_CHECKING, Union, overload +from typing import Any, Mapping, Optional, TYPE_CHECKING, Union, overload -from .. import _model_base -from .._model_base import rest_field +from .._utils.model_base import Model as _Model, rest_field if TYPE_CHECKING: from .. import models as _models -class Resource(_model_base.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. +class Resource(_Model): + """Resource. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -46,9 +45,8 @@ class Resource(_model_base.Model): """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. +class TrackedResource(Resource): # pylint: disable=docstring-keyword-should-match-keyword-only + """Tracked Resource. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -67,7 +65,7 @@ class TrackedResource(Resource): :vartype location: str """ - tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" location: str = rest_field(visibility=["read", "create"]) """The geo-location where the resource lives. Required.""" @@ -77,7 +75,7 @@ def __init__( self, *, location: str, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, ) -> None: ... @overload @@ -91,7 +89,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Association(TrackedResource): +class Association(TrackedResource): # pylint: disable=docstring-keyword-should-match-keyword-only """Association Subresource of Traffic Controller. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -123,7 +121,7 @@ def __init__( self, *, location: str, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, properties: Optional["_models.AssociationProperties"] = None, ) -> None: ... @@ -138,7 +136,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AssociationProperties(_model_base.Model): +class AssociationProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Association Properties. :ivar association_type: Association Type. Required. "subnets" @@ -185,7 +183,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AssociationSubnet(_model_base.Model): +class AssociationSubnet(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Association Subnet. :ivar id: Association ID. Required. @@ -213,7 +211,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AssociationSubnetUpdate(_model_base.Model): +class AssociationSubnetUpdate(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Association Subnet. :ivar id: Association ID. @@ -241,7 +239,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AssociationUpdate(_model_base.Model): +class AssociationUpdate(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The type used for update operations of the Association. :ivar tags: Resource tags. @@ -250,18 +248,20 @@ class AssociationUpdate(_model_base.Model): :vartype properties: ~azure.mgmt.servicenetworking.models.AssociationUpdateProperties """ - tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" properties: Optional["_models.AssociationUpdateProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """The resource-specific properties for this resource.""" + __flattened_items = ["association_type", "subnet"] + @overload def __init__( self, *, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, properties: Optional["_models.AssociationUpdateProperties"] = None, ) -> None: ... @@ -273,10 +273,28 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - - -class AssociationUpdateProperties(_model_base.Model): + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class AssociationUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The updatable properties of the Association. :ivar association_type: Association Type. "subnets" @@ -313,7 +331,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ErrorAdditionalInfo(_model_base.Model): +class ErrorAdditionalInfo(_Model): """The resource management error additional info. :ivar type: The additional info type. @@ -328,7 +346,7 @@ class ErrorAdditionalInfo(_model_base.Model): """The additional info.""" -class ErrorDetail(_model_base.Model): +class ErrorDetail(_Model): """The error detail. :ivar code: The error code. @@ -349,17 +367,16 @@ class ErrorDetail(_model_base.Model): """The error message.""" target: Optional[str] = rest_field(visibility=["read"]) """The error target.""" - details: Optional[List["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) """The error details.""" - additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = rest_field( + additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( name="additionalInfo", visibility=["read"] ) """The error additional info.""" -class ErrorResponse(_model_base.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. +class ErrorResponse(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Error response. :ivar error: The error object. :vartype error: ~azure.mgmt.servicenetworking.models.ErrorDetail @@ -386,7 +403,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Frontend(TrackedResource): +class Frontend(TrackedResource): # pylint: disable=docstring-keyword-should-match-keyword-only """Frontend Sub Resource of Traffic Controller. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -418,7 +435,7 @@ def __init__( self, *, location: str, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, properties: Optional["_models.FrontendProperties"] = None, ) -> None: ... @@ -433,12 +450,47 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FrontendProperties(_model_base.Model): +class FrontendAssociation(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Reference to an Association resource. + + :ivar id: Resource ID of the Association. Required. + :vartype id: str + """ + + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource ID of the Association. Required.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + ) -> 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 FrontendProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Frontend Properties. :ivar fqdn: The Fully Qualified Domain Name of the DNS record associated to a Traffic Controller frontend. :vartype fqdn: str + :ivar public_network_access: Whether public network access is allowed for the frontend. Enabled + indicates a public frontend; Disabled indicates a private frontend. Known values are: "Enabled" + and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.servicenetworking.models.PublicNetworkAccess + :ivar association: Reference to an Association resource that contains the subnet where the + private frontend should be deployed. + :vartype association: ~azure.mgmt.servicenetworking.models.FrontendAssociation :ivar security_policy_configurations: Frontend Security Policy Configuration. :vartype security_policy_configurations: ~azure.mgmt.servicenetworking.models.SecurityPolicyConfigurations @@ -450,6 +502,16 @@ class FrontendProperties(_model_base.Model): fqdn: Optional[str] = rest_field(visibility=["read"]) """The Fully Qualified Domain Name of the DNS record associated to a Traffic Controller frontend.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether public network access is allowed for the frontend. Enabled indicates a public frontend; + Disabled indicates a private frontend. Known values are: \"Enabled\" and \"Disabled\".""" + association: Optional["_models.FrontendAssociation"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Reference to an Association resource that contains the subnet where the private frontend should + be deployed.""" security_policy_configurations: Optional["_models.SecurityPolicyConfigurations"] = rest_field( name="securityPolicyConfigurations", visibility=["read", "create", "update", "delete", "query"] ) @@ -464,6 +526,8 @@ class FrontendProperties(_model_base.Model): def __init__( self, *, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + association: Optional["_models.FrontendAssociation"] = None, security_policy_configurations: Optional["_models.SecurityPolicyConfigurations"] = None, ) -> None: ... @@ -478,7 +542,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FrontendUpdate(_model_base.Model): +class FrontendUpdate(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The type used for update operations of the Frontend. :ivar tags: Resource tags. @@ -487,7 +551,7 @@ class FrontendUpdate(_model_base.Model): :vartype properties: ~azure.mgmt.servicenetworking.models.FrontendUpdateProperties """ - tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" properties: Optional["_models.FrontendUpdateProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] @@ -498,7 +562,7 @@ class FrontendUpdate(_model_base.Model): def __init__( self, *, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, properties: Optional["_models.FrontendUpdateProperties"] = None, ) -> None: ... @@ -513,14 +577,31 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FrontendUpdateProperties(_model_base.Model): +class FrontendUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The updatable properties of the Frontend. + :ivar public_network_access: Whether public network access is allowed for the frontend. Enabled + indicates a public frontend; Disabled indicates a private frontend. Known values are: "Enabled" + and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.servicenetworking.models.PublicNetworkAccess + :ivar association: Reference to an Association resource that contains the subnet where the + private frontend should be deployed. + :vartype association: ~azure.mgmt.servicenetworking.models.FrontendAssociation :ivar security_policy_configurations: Frontend Security Policy Configuration. :vartype security_policy_configurations: ~azure.mgmt.servicenetworking.models.SecurityPolicyConfigurations """ + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether public network access is allowed for the frontend. Enabled indicates a public frontend; + Disabled indicates a private frontend. Known values are: \"Enabled\" and \"Disabled\".""" + association: Optional["_models.FrontendAssociation"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Reference to an Association resource that contains the subnet where the private frontend should + be deployed.""" security_policy_configurations: Optional["_models.SecurityPolicyConfigurations"] = rest_field( name="securityPolicyConfigurations", visibility=["read", "create", "update", "delete", "query"] ) @@ -530,6 +611,8 @@ class FrontendUpdateProperties(_model_base.Model): def __init__( self, *, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + association: Optional["_models.FrontendAssociation"] = None, security_policy_configurations: Optional["_models.SecurityPolicyConfigurations"] = None, ) -> None: ... @@ -544,7 +627,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IpAccessRule(_model_base.Model): +class IpAccessRule(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Ip Access Policy Rules. :ivar name: Name of the Ip Access Rule. Required. @@ -566,7 +649,7 @@ class IpAccessRule(_model_base.Model): """The priority of the rule. The value can be between 1 and 500. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. Required.""" - source_address_prefixes: List[str] = rest_field( + source_address_prefixes: list[str] = rest_field( name="sourceAddressPrefixes", visibility=["read", "create", "update", "delete", "query"] ) """Source Address Prefixed Applied by the Rule. Asterisk '*' can also be used to match all source @@ -582,7 +665,7 @@ def __init__( *, name: str, priority: int, - source_address_prefixes: List[str], + source_address_prefixes: list[str], action: Union[str, "_models.IpAccessRuleAction"], ) -> None: ... @@ -597,14 +680,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IpAccessRulesPolicy(_model_base.Model): +class IpAccessRulesPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Ip Access Policy. :ivar rules: Ip Access Policy Rules List. :vartype rules: list[~azure.mgmt.servicenetworking.models.IpAccessRule] """ - rules: Optional[List["_models.IpAccessRule"]] = rest_field( + rules: Optional[list["_models.IpAccessRule"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """Ip Access Policy Rules List.""" @@ -613,7 +696,7 @@ class IpAccessRulesPolicy(_model_base.Model): def __init__( self, *, - rules: Optional[List["_models.IpAccessRule"]] = None, + rules: Optional[list["_models.IpAccessRule"]] = None, ) -> None: ... @overload @@ -627,7 +710,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IpAccessRulesSecurityPolicy(_model_base.Model): +class IpAccessRulesSecurityPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """IpAccessRules Security Policy. :ivar id: Resource ID of the Ip Access Rules Security Policy. Required. @@ -655,8 +738,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Operation(_model_base.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. +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: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". @@ -712,8 +795,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class OperationDisplay(_model_base.Model): - """Localized display information for and operation. +class OperationDisplay(_Model): + """Localized display information for an operation. :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". @@ -743,7 +826,235 @@ class OperationDisplay(_model_base.Model): views.""" -class ResourceId(_model_base.Model): +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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.servicenetworking.models.SystemData + """ + + +class PrivateEndpointConnection(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """Private Endpoint Connection resource of Traffic Controller. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.servicenetworking.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.servicenetworking.models.PrivateEndpointConnectionProperties + """ + + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, + ) -> 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 PrivateEndpointConnectionProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties of a Private Endpoint Connection. + + :ivar private_endpoint: The private endpoint resource. + :vartype private_endpoint: ~azure.mgmt.servicenetworking.models.PrivateEndpointReference + :ivar private_link_service_connection_state: The connection state of the private endpoint + connection. Required. + :vartype private_link_service_connection_state: + ~azure.mgmt.servicenetworking.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Provisioning", "Updating", "Deleting", "Accepted", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.servicenetworking.models.ProvisioningState + """ + + private_endpoint: Optional["_models.PrivateEndpointReference"] = rest_field( + name="privateEndpoint", visibility=["read"] + ) + """The private endpoint resource.""" + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState" = rest_field( + name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """The connection state of the private endpoint connection. Required.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the private endpoint connection. Known values are: \"Provisioning\", + \"Updating\", \"Deleting\", \"Accepted\", \"Succeeded\", \"Failed\", and \"Canceled\".""" + + @overload + def __init__( + self, + *, + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", + ) -> 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 PrivateEndpointReference(_Model): + """Reference to a private endpoint resource. + + :ivar id: Resource ID of the private endpoint. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Resource ID of the private endpoint.""" + + +class PrivateLinkResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """A private link 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.servicenetworking.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.servicenetworking.models.PrivateLinkResourceProperties + """ + + properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateLinkResourceProperties"] = None, + ) -> 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 PrivateLinkResourceProperties(_Model): + """Properties of a private link resource. + + :ivar group_id: The private link resource group ID. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource private DNS zone names. + :vartype required_zone_names: list[str] + :ivar provisioning_state: The status of the last operation. Known values are: "Provisioning", + "Updating", "Deleting", "Accepted", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.servicenetworking.models.ProvisioningState + """ + + group_id: Optional[str] = rest_field(name="groupId", visibility=["read"]) + """The private link resource group ID.""" + required_members: Optional[list[str]] = rest_field(name="requiredMembers", visibility=["read"]) + """The private link resource required member names.""" + required_zone_names: Optional[list[str]] = rest_field(name="requiredZoneNames", visibility=["read"]) + """The private link resource private DNS zone names.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The status of the last operation. Known values are: \"Provisioning\", \"Updating\", + \"Deleting\", \"Accepted\", \"Succeeded\", \"Failed\", and \"Canceled\".""" + + +class PrivateLinkServiceConnectionState(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The state of a private link service connection. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". + :vartype status: str or ~azure.mgmt.servicenetworking.models.PrivateLinkServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str + """ + + status: Optional[Union[str, "_models.PrivateLinkServiceConnectionStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + service. Known values are: \"Pending\", \"Approved\", \"Rejected\", and \"Disconnected\".""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The reason for approval/rejection of the connection.""" + actions_required: Optional[str] = rest_field( + name="actionsRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A message indicating if changes on the service provider require any updates on the consumer.""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateLinkServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + ) -> 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 ResourceId(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Resource ID definition used by parent to reference child resources. :ivar id: Resource ID of child resource. Required. @@ -771,7 +1082,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SecurityPolicy(TrackedResource): +class SecurityPolicy(TrackedResource): # pylint: disable=docstring-keyword-should-match-keyword-only """SecurityPolicy Subresource of Traffic Controller. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -803,7 +1114,7 @@ def __init__( self, *, location: str, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, properties: Optional["_models.SecurityPolicyProperties"] = None, ) -> None: ... @@ -818,7 +1129,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SecurityPolicyConfigurations(_model_base.Model): +class SecurityPolicyConfigurations(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """SecurityPolicyConfigurations Subresource of Traffic Controller. :ivar waf_security_policy: Contains reference to a WAF-type security policy. @@ -857,7 +1168,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SecurityPolicyProperties(_model_base.Model): +class SecurityPolicyProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """SecurityPolicy Properties. :ivar policy_type: Type of the Traffic Controller Security Policy. Known values are: "waf" and @@ -914,7 +1225,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SecurityPolicyUpdate(_model_base.Model): +class SecurityPolicyUpdate(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The type used for update operations of the SecurityPolicy. :ivar tags: Resource tags. @@ -923,7 +1234,7 @@ class SecurityPolicyUpdate(_model_base.Model): :vartype properties: ~azure.mgmt.servicenetworking.models.SecurityPolicyUpdateProperties """ - tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" properties: Optional["_models.SecurityPolicyUpdateProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] @@ -934,7 +1245,7 @@ class SecurityPolicyUpdate(_model_base.Model): def __init__( self, *, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, properties: Optional["_models.SecurityPolicyUpdateProperties"] = None, ) -> None: ... @@ -949,7 +1260,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SecurityPolicyUpdateProperties(_model_base.Model): +class SecurityPolicyUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The updatable properties of the SecurityPolicy. :ivar waf_policy: Web Application Firewall Policy of the Traffic Controller Security Policy. @@ -990,7 +1301,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SystemData(_model_base.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. @@ -1057,7 +1368,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TrafficController(TrackedResource): +class TrafficController(TrackedResource): # pylint: disable=docstring-keyword-should-match-keyword-only """Concrete tracked resource types can be created by aliasing this type using a specific property type. @@ -1090,7 +1401,7 @@ def __init__( self, *, location: str, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, properties: Optional["_models.TrafficControllerProperties"] = None, ) -> None: ... @@ -1105,7 +1416,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TrafficControllerProperties(_model_base.Model): +class TrafficControllerProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Traffic Controller Properties. :ivar configuration_endpoints: Configuration Endpoints. @@ -1116,6 +1427,8 @@ class TrafficControllerProperties(_model_base.Model): :vartype associations: list[~azure.mgmt.servicenetworking.models.ResourceId] :ivar security_policies: Security Policies References List. :vartype security_policies: list[~azure.mgmt.servicenetworking.models.ResourceId] + :ivar private_endpoint_connections: Private Endpoint Connections List. + :vartype private_endpoint_connections: list[~azure.mgmt.servicenetworking.models.ResourceId] :ivar security_policy_configurations: Security Policy Configuration. :vartype security_policy_configurations: ~azure.mgmt.servicenetworking.models.SecurityPolicyConfigurations @@ -1124,14 +1437,18 @@ class TrafficControllerProperties(_model_base.Model): :vartype provisioning_state: str or ~azure.mgmt.servicenetworking.models.ProvisioningState """ - configuration_endpoints: Optional[List[str]] = rest_field(name="configurationEndpoints", visibility=["read"]) + configuration_endpoints: Optional[list[str]] = rest_field(name="configurationEndpoints", visibility=["read"]) """Configuration Endpoints.""" - frontends: Optional[List["_models.ResourceId"]] = rest_field(visibility=["read"]) + frontends: Optional[list["_models.ResourceId"]] = rest_field(visibility=["read"]) """Frontends References List.""" - associations: Optional[List["_models.ResourceId"]] = rest_field(visibility=["read"]) + associations: Optional[list["_models.ResourceId"]] = rest_field(visibility=["read"]) """Associations References List.""" - security_policies: Optional[List["_models.ResourceId"]] = rest_field(name="securityPolicies", visibility=["read"]) + security_policies: Optional[list["_models.ResourceId"]] = rest_field(name="securityPolicies", visibility=["read"]) """Security Policies References List.""" + private_endpoint_connections: Optional[list["_models.ResourceId"]] = rest_field( + name="privateEndpointConnections", visibility=["read"] + ) + """Private Endpoint Connections List.""" security_policy_configurations: Optional["_models.SecurityPolicyConfigurations"] = rest_field( name="securityPolicyConfigurations", visibility=["read", "create", "update", "delete", "query"] ) @@ -1160,7 +1477,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TrafficControllerUpdate(_model_base.Model): +class TrafficControllerUpdate(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The type used for update operations of the TrafficController. :ivar tags: Resource tags. @@ -1169,7 +1486,7 @@ class TrafficControllerUpdate(_model_base.Model): :vartype properties: ~azure.mgmt.servicenetworking.models.TrafficControllerUpdateProperties """ - tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" properties: Optional["_models.TrafficControllerUpdateProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] @@ -1180,7 +1497,7 @@ class TrafficControllerUpdate(_model_base.Model): def __init__( self, *, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, properties: Optional["_models.TrafficControllerUpdateProperties"] = None, ) -> None: ... @@ -1195,7 +1512,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TrafficControllerUpdateProperties(_model_base.Model): +class TrafficControllerUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The updatable properties of the TrafficController. :ivar security_policy_configurations: Security Policy Configuration. @@ -1226,7 +1543,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class WafPolicy(_model_base.Model): +class WafPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Web Application Firewall Policy. :ivar id: Resource ID of the WAF. Required. @@ -1254,7 +1571,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class WafSecurityPolicy(_model_base.Model): +class WafSecurityPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Web Application Firewall Security Policy. :ivar id: Resource ID of the Waf Security Policy. Required. diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/_patch.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/_patch.py index 8bcb627aa475..ea765788358a 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/_patch.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/models/_patch.py @@ -7,9 +7,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/operations/__init__.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/operations/__init__.py index 38a4f6af8bbf..4cde903ba4fb 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/operations/__init__.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/operations/__init__.py @@ -16,6 +16,8 @@ from ._operations import FrontendsInterfaceOperations # type: ignore from ._operations import SecurityPoliciesInterfaceOperations # type: ignore from ._operations import TrafficControllerInterfaceOperations # type: ignore +from ._operations import PrivateEndpointConnectionsInterfaceOperations # type: ignore +from ._operations import PrivateLinkResourcesInterfaceOperations # type: ignore from ._operations import Operations # type: ignore from ._patch import __all__ as _patch_all @@ -27,6 +29,8 @@ "FrontendsInterfaceOperations", "SecurityPoliciesInterfaceOperations", "TrafficControllerInterfaceOperations", + "PrivateEndpointConnectionsInterfaceOperations", + "PrivateLinkResourcesInterfaceOperations", "Operations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/operations/_operations.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/operations/_operations.py index 3a7715c8a478..69dc322f5bad 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/operations/_operations.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/operations/_operations.py @@ -9,7 +9,7 @@ from collections.abc import MutableMapping from io import IOBase import json -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -32,15 +32,15 @@ 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 ServiceNetworkingMgmtClientConfiguration -from .._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize -from .._serialization import Deserializer, Serializer +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._utils.serialization import Deserializer, Serializer from .._validation import api_version_validation -JSON = MutableMapping[str, Any] T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -52,7 +52,7 @@ def build_associations_interface_get_request( _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,7 @@ def build_associations_interface_create_or_update_request( # pylint: disable=na _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +114,7 @@ def build_associations_interface_update_request( # pylint: disable=name-too-lon _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,12 +142,9 @@ def build_associations_interface_update_request( # pylint: disable=name-too-lon def build_associations_interface_delete_request( # pylint: disable=name-too-long resource_group_name: str, traffic_controller_name: str, association_name: str, subscription_id: str, **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-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName}" path_format_arguments = { @@ -162,10 +159,7 @@ def build_associations_interface_delete_request( # pylint: disable=name-too-lon # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_associations_interface_list_by_traffic_controller_request( # pylint: disable=name-too-long @@ -174,7 +168,7 @@ def build_associations_interface_list_by_traffic_controller_request( # pylint: _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +196,7 @@ def build_frontends_interface_get_request( _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -232,7 +226,7 @@ def build_frontends_interface_create_or_update_request( # pylint: disable=name- _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -264,7 +258,7 @@ def build_frontends_interface_update_request( _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -292,12 +286,9 @@ def build_frontends_interface_update_request( def build_frontends_interface_delete_request( resource_group_name: str, traffic_controller_name: str, frontend_name: str, subscription_id: str, **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-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName}" path_format_arguments = { @@ -312,10 +303,7 @@ def build_frontends_interface_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_frontends_interface_list_by_traffic_controller_request( # pylint: disable=name-too-long @@ -324,7 +312,7 @@ def build_frontends_interface_list_by_traffic_controller_request( # pylint: dis _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -356,7 +344,7 @@ def build_security_policies_interface_get_request( # pylint: disable=name-too-l _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -390,7 +378,7 @@ def build_security_policies_interface_create_or_update_request( # pylint: disab _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -426,7 +414,7 @@ def build_security_policies_interface_update_request( # pylint: disable=name-to _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -458,12 +446,9 @@ def build_security_policies_interface_delete_request( # pylint: disable=name-to subscription_id: str, **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-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicies/{securityPolicyName}" path_format_arguments = { @@ -478,10 +463,7 @@ def build_security_policies_interface_delete_request( # pylint: disable=name-to # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_security_policies_interface_list_by_traffic_controller_request( # pylint: disable=name-too-long @@ -490,7 +472,7 @@ def build_security_policies_interface_list_by_traffic_controller_request( # pyl _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -518,7 +500,7 @@ def build_traffic_controller_interface_get_request( # pylint: disable=name-too- _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -547,7 +529,7 @@ def build_traffic_controller_interface_create_or_update_request( # pylint: disa _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -578,7 +560,7 @@ def build_traffic_controller_interface_update_request( # pylint: disable=name-t _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -605,12 +587,9 @@ def build_traffic_controller_interface_update_request( # pylint: disable=name-t def build_traffic_controller_interface_delete_request( # pylint: disable=name-too-long resource_group_name: str, traffic_controller_name: str, subscription_id: str, **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-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}" path_format_arguments = { @@ -624,10 +603,7 @@ def build_traffic_controller_interface_delete_request( # pylint: disable=name-t # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_traffic_controller_interface_list_by_resource_group_request( # pylint: disable=name-too-long @@ -636,7 +612,7 @@ def build_traffic_controller_interface_list_by_resource_group_request( # pylint _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -663,7 +639,7 @@ def build_traffic_controller_interface_list_by_subscription_request( # pylint: _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -683,11 +659,202 @@ def build_traffic_controller_interface_list_by_subscription_request( # pylint: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_private_endpoint_connections_interface_get_request( # pylint: disable=name-too-long + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **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", "2026-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "trafficControllerName": _SERIALIZER.url("traffic_controller_name", traffic_controller_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_interface_update_request( # pylint: disable=name-too-long + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _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", "2026-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "trafficControllerName": _SERIALIZER.url("traffic_controller_name", traffic_controller_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_interface_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_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", "2026-03-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "trafficControllerName": _SERIALIZER.url("traffic_controller_name", traffic_controller_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_private_endpoint_connections_interface_list_by_traffic_controller_request( # pylint: disable=name-too-long + resource_group_name: str, traffic_controller_name: str, subscription_id: str, **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", "2026-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/privateEndpointConnections" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "trafficControllerName": _SERIALIZER.url("traffic_controller_name", traffic_controller_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_link_resources_interface_get_request( # pylint: disable=name-too-long + resource_group_name: str, + traffic_controller_name: str, + private_link_resource_name: str, + subscription_id: str, + **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", "2026-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/privateLinkResources/{privateLinkResourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "trafficControllerName": _SERIALIZER.url("traffic_controller_name", traffic_controller_name, "str"), + "privateLinkResourceName": _SERIALIZER.url("private_link_resource_name", private_link_resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_link_resources_interface_list_by_traffic_controller_request( # pylint: disable=name-too-long + resource_group_name: str, traffic_controller_name: str, subscription_id: str, **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", "2026-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/privateLinkResources" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "trafficControllerName": _SERIALIZER.url("traffic_controller_name", traffic_controller_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + 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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -702,7 +869,7 @@ def build_operations_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class AssociationsInterfaceOperations: +class AssociationsInterfaceOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -712,7 +879,7 @@ class AssociationsInterfaceOperations: :attr:`associations_interface` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: ServiceNetworkingMgmtClientConfiguration = ( @@ -765,6 +932,7 @@ def get( } _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 @@ -779,11 +947,14 @@ def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.Association, response.json()) @@ -797,7 +968,7 @@ def _create_or_update_initial( resource_group_name: str, traffic_controller_name: str, association_name: str, - resource: Union[_models.Association, JSON, IO[bytes]], + resource: Union[_models.Association, _types.Association, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -837,6 +1008,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 @@ -850,14 +1022,17 @@ def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 201: 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 @@ -901,7 +1076,7 @@ def begin_create_or_update( resource_group_name: str, traffic_controller_name: str, association_name: str, - resource: JSON, + resource: _types.Association, *, content_type: str = "application/json", **kwargs: Any @@ -916,7 +1091,7 @@ def begin_create_or_update( :param association_name: Name of Association. Required. :type association_name: str :param resource: Resource create parameters. Required. - :type resource: JSON + :type resource: ~azure.mgmt.servicenetworking.types.Association :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -963,7 +1138,7 @@ def begin_create_or_update( resource_group_name: str, traffic_controller_name: str, association_name: str, - resource: Union[_models.Association, JSON, IO[bytes]], + resource: Union[_models.Association, _types.Association, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Association]: """Create a Association. @@ -975,9 +1150,10 @@ def begin_create_or_update( :type traffic_controller_name: str :param association_name: Name of Association. Required. :type association_name: str - :param resource: Resource create parameters. Is one of the following types: Association, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.servicenetworking.models.Association or JSON or IO[bytes] + :param resource: Resource create parameters. Is either a Association type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.servicenetworking.models.Association or + ~azure.mgmt.servicenetworking.types.Association or IO[bytes] :return: An instance of LROPoller that returns Association. The Association is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicenetworking.models.Association] @@ -1072,7 +1248,7 @@ def update( resource_group_name: str, traffic_controller_name: str, association_name: str, - properties: JSON, + properties: _types.AssociationUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -1087,7 +1263,7 @@ def update( :param association_name: Name of Association. Required. :type association_name: str :param properties: The resource properties to be updated. Required. - :type properties: JSON + :type properties: ~azure.mgmt.servicenetworking.types.AssociationUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1132,7 +1308,7 @@ def update( resource_group_name: str, traffic_controller_name: str, association_name: str, - properties: Union[_models.AssociationUpdate, JSON, IO[bytes]], + properties: Union[_models.AssociationUpdate, _types.AssociationUpdate, IO[bytes]], **kwargs: Any ) -> _models.Association: """Update a Association. @@ -1144,9 +1320,10 @@ def update( :type traffic_controller_name: str :param association_name: Name of Association. Required. :type association_name: str - :param properties: The resource properties to be updated. Is one of the following types: - AssociationUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.servicenetworking.models.AssociationUpdate or JSON or IO[bytes] + :param properties: The resource properties to be updated. Is either a AssociationUpdate type or + a IO[bytes] type. Required. + :type properties: ~azure.mgmt.servicenetworking.models.AssociationUpdate or + ~azure.mgmt.servicenetworking.types.AssociationUpdate or IO[bytes] :return: Association. The Association is compatible with MutableMapping :rtype: ~azure.mgmt.servicenetworking.models.Association :raises ~azure.core.exceptions.HttpResponseError: @@ -1188,6 +1365,7 @@ def update( } _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 @@ -1202,11 +1380,14 @@ def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.Association, response.json()) @@ -1245,6 +1426,7 @@ def _delete_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 @@ -1258,7 +1440,10 @@ def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1266,7 +1451,7 @@ def _delete_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 @@ -1338,7 +1523,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace def list_by_traffic_controller( self, resource_group_name: str, traffic_controller_name: str, **kwargs: Any - ) -> Iterable["_models.Association"]: + ) -> ItemPaged["_models.Association"]: """List Association resources by TrafficController. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1392,7 +1577,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( @@ -1405,7 +1593,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Association], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.Association], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1421,7 +1612,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1429,7 +1623,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class FrontendsInterfaceOperations: +class FrontendsInterfaceOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -1439,7 +1633,7 @@ class FrontendsInterfaceOperations: :attr:`frontends_interface` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: ServiceNetworkingMgmtClientConfiguration = ( @@ -1492,6 +1686,7 @@ def get( } _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 @@ -1506,11 +1701,14 @@ def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.Frontend, response.json()) @@ -1524,7 +1722,7 @@ def _create_or_update_initial( resource_group_name: str, traffic_controller_name: str, frontend_name: str, - resource: Union[_models.Frontend, JSON, IO[bytes]], + resource: Union[_models.Frontend, _types.Frontend, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -1564,6 +1762,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 @@ -1577,14 +1776,17 @@ def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 201: 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 @@ -1628,7 +1830,7 @@ def begin_create_or_update( resource_group_name: str, traffic_controller_name: str, frontend_name: str, - resource: JSON, + resource: _types.Frontend, *, content_type: str = "application/json", **kwargs: Any @@ -1643,7 +1845,7 @@ def begin_create_or_update( :param frontend_name: Frontends. Required. :type frontend_name: str :param resource: Resource create parameters. Required. - :type resource: JSON + :type resource: ~azure.mgmt.servicenetworking.types.Frontend :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1690,7 +1892,7 @@ def begin_create_or_update( resource_group_name: str, traffic_controller_name: str, frontend_name: str, - resource: Union[_models.Frontend, JSON, IO[bytes]], + resource: Union[_models.Frontend, _types.Frontend, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Frontend]: """Create a Frontend. @@ -1702,9 +1904,10 @@ def begin_create_or_update( :type traffic_controller_name: str :param frontend_name: Frontends. Required. :type frontend_name: str - :param resource: Resource create parameters. Is one of the following types: Frontend, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.servicenetworking.models.Frontend or JSON or IO[bytes] + :param resource: Resource create parameters. Is either a Frontend type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.servicenetworking.models.Frontend or + ~azure.mgmt.servicenetworking.types.Frontend or IO[bytes] :return: An instance of LROPoller that returns Frontend. The Frontend is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicenetworking.models.Frontend] @@ -1799,7 +2002,7 @@ def update( resource_group_name: str, traffic_controller_name: str, frontend_name: str, - properties: JSON, + properties: _types.FrontendUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -1814,7 +2017,7 @@ def update( :param frontend_name: Frontends. Required. :type frontend_name: str :param properties: The resource properties to be updated. Required. - :type properties: JSON + :type properties: ~azure.mgmt.servicenetworking.types.FrontendUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1859,7 +2062,7 @@ def update( resource_group_name: str, traffic_controller_name: str, frontend_name: str, - properties: Union[_models.FrontendUpdate, JSON, IO[bytes]], + properties: Union[_models.FrontendUpdate, _types.FrontendUpdate, IO[bytes]], **kwargs: Any ) -> _models.Frontend: """Update a Frontend. @@ -1871,9 +2074,10 @@ def update( :type traffic_controller_name: str :param frontend_name: Frontends. Required. :type frontend_name: str - :param properties: The resource properties to be updated. Is one of the following types: - FrontendUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.servicenetworking.models.FrontendUpdate or JSON or IO[bytes] + :param properties: The resource properties to be updated. Is either a FrontendUpdate type or a + IO[bytes] type. Required. + :type properties: ~azure.mgmt.servicenetworking.models.FrontendUpdate or + ~azure.mgmt.servicenetworking.types.FrontendUpdate or IO[bytes] :return: Frontend. The Frontend is compatible with MutableMapping :rtype: ~azure.mgmt.servicenetworking.models.Frontend :raises ~azure.core.exceptions.HttpResponseError: @@ -1915,6 +2119,7 @@ def update( } _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 @@ -1929,11 +2134,14 @@ def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.Frontend, response.json()) @@ -1972,6 +2180,7 @@ def _delete_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 @@ -1985,7 +2194,10 @@ def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1993,7 +2205,7 @@ def _delete_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 @@ -2065,7 +2277,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace def list_by_traffic_controller( self, resource_group_name: str, traffic_controller_name: str, **kwargs: Any - ) -> Iterable["_models.Frontend"]: + ) -> ItemPaged["_models.Frontend"]: """List Frontend resources by TrafficController. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2119,7 +2331,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( @@ -2132,7 +2347,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Frontend], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.Frontend], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -2148,7 +2366,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -2156,7 +2377,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class SecurityPoliciesInterfaceOperations: +class SecurityPoliciesInterfaceOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -2166,7 +2387,7 @@ class SecurityPoliciesInterfaceOperations: :attr:`security_policies_interface` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: ServiceNetworkingMgmtClientConfiguration = ( @@ -2188,6 +2409,7 @@ def __init__(self, *args, **kwargs): "accept", ] }, + api_versions_list=["2024-05-01-preview", "2025-01-01", "2025-03-01-preview", "2026-03-01"], ) def get( self, resource_group_name: str, traffic_controller_name: str, security_policy_name: str, **kwargs: Any @@ -2232,6 +2454,7 @@ def get( } _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 @@ -2246,11 +2469,14 @@ def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.SecurityPolicy, response.json()) @@ -2272,13 +2498,14 @@ def get( "accept", ] }, + api_versions_list=["2024-05-01-preview", "2025-01-01", "2025-03-01-preview", "2026-03-01"], ) def _create_or_update_initial( self, resource_group_name: str, traffic_controller_name: str, security_policy_name: str, - resource: Union[_models.SecurityPolicy, JSON, IO[bytes]], + resource: Union[_models.SecurityPolicy, _types.SecurityPolicy, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -2318,6 +2545,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 @@ -2331,14 +2559,17 @@ def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 201: 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 @@ -2382,7 +2613,7 @@ def begin_create_or_update( resource_group_name: str, traffic_controller_name: str, security_policy_name: str, - resource: JSON, + resource: _types.SecurityPolicy, *, content_type: str = "application/json", **kwargs: Any @@ -2397,7 +2628,7 @@ def begin_create_or_update( :param security_policy_name: SecurityPolicy. Required. :type security_policy_name: str :param resource: Resource create parameters. Required. - :type resource: JSON + :type resource: ~azure.mgmt.servicenetworking.types.SecurityPolicy :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -2452,13 +2683,14 @@ def begin_create_or_update( "accept", ] }, + api_versions_list=["2024-05-01-preview", "2025-01-01", "2025-03-01-preview", "2026-03-01"], ) def begin_create_or_update( self, resource_group_name: str, traffic_controller_name: str, security_policy_name: str, - resource: Union[_models.SecurityPolicy, JSON, IO[bytes]], + resource: Union[_models.SecurityPolicy, _types.SecurityPolicy, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.SecurityPolicy]: """Create a SecurityPolicy. @@ -2470,9 +2702,10 @@ def begin_create_or_update( :type traffic_controller_name: str :param security_policy_name: SecurityPolicy. Required. :type security_policy_name: str - :param resource: Resource create parameters. Is one of the following types: SecurityPolicy, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.servicenetworking.models.SecurityPolicy or JSON or IO[bytes] + :param resource: Resource create parameters. Is either a SecurityPolicy type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.servicenetworking.models.SecurityPolicy or + ~azure.mgmt.servicenetworking.types.SecurityPolicy or IO[bytes] :return: An instance of LROPoller that returns SecurityPolicy. The SecurityPolicy is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicenetworking.models.SecurityPolicy] @@ -2567,7 +2800,7 @@ def update( resource_group_name: str, traffic_controller_name: str, security_policy_name: str, - properties: JSON, + properties: _types.SecurityPolicyUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -2582,7 +2815,7 @@ def update( :param security_policy_name: SecurityPolicy. Required. :type security_policy_name: str :param properties: The resource properties to be updated. Required. - :type properties: JSON + :type properties: ~azure.mgmt.servicenetworking.types.SecurityPolicyUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -2635,13 +2868,14 @@ def update( "accept", ] }, + api_versions_list=["2024-05-01-preview", "2025-01-01", "2025-03-01-preview", "2026-03-01"], ) def update( self, resource_group_name: str, traffic_controller_name: str, security_policy_name: str, - properties: Union[_models.SecurityPolicyUpdate, JSON, IO[bytes]], + properties: Union[_models.SecurityPolicyUpdate, _types.SecurityPolicyUpdate, IO[bytes]], **kwargs: Any ) -> _models.SecurityPolicy: """Update a SecurityPolicy. @@ -2653,10 +2887,10 @@ def update( :type traffic_controller_name: str :param security_policy_name: SecurityPolicy. Required. :type security_policy_name: str - :param properties: The resource properties to be updated. Is one of the following types: - SecurityPolicyUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.servicenetworking.models.SecurityPolicyUpdate or JSON or - IO[bytes] + :param properties: The resource properties to be updated. Is either a SecurityPolicyUpdate type + or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.servicenetworking.models.SecurityPolicyUpdate or + ~azure.mgmt.servicenetworking.types.SecurityPolicyUpdate or IO[bytes] :return: SecurityPolicy. The SecurityPolicy is compatible with MutableMapping :rtype: ~azure.mgmt.servicenetworking.models.SecurityPolicy :raises ~azure.core.exceptions.HttpResponseError: @@ -2698,6 +2932,7 @@ def update( } _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 @@ -2712,11 +2947,14 @@ def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.SecurityPolicy, response.json()) @@ -2734,9 +2972,9 @@ def update( "resource_group_name", "traffic_controller_name", "security_policy_name", - "accept", ] }, + api_versions_list=["2024-05-01-preview", "2025-01-01", "2025-03-01-preview", "2026-03-01"], ) def _delete_initial( self, resource_group_name: str, traffic_controller_name: str, security_policy_name: str, **kwargs: Any @@ -2768,6 +3006,7 @@ def _delete_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 @@ -2781,7 +3020,10 @@ def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -2789,7 +3031,7 @@ def _delete_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 @@ -2806,9 +3048,9 @@ def _delete_initial( "resource_group_name", "traffic_controller_name", "security_policy_name", - "accept", ] }, + api_versions_list=["2024-05-01-preview", "2025-01-01", "2025-03-01-preview", "2026-03-01"], ) def begin_delete( self, resource_group_name: str, traffic_controller_name: str, security_policy_name: str, **kwargs: Any @@ -2883,10 +3125,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- "accept", ] }, + api_versions_list=["2024-05-01-preview", "2025-01-01", "2025-03-01-preview", "2026-03-01"], ) def list_by_traffic_controller( self, resource_group_name: str, traffic_controller_name: str, **kwargs: Any - ) -> Iterable["_models.SecurityPolicy"]: + ) -> ItemPaged["_models.SecurityPolicy"]: """List SecurityPolicy resources by TrafficController. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2940,7 +3183,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( @@ -2953,7 +3199,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SecurityPolicy], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.SecurityPolicy], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -2969,7 +3218,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -2977,7 +3229,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class TrafficControllerInterfaceOperations: +class TrafficControllerInterfaceOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -2987,7 +3239,7 @@ class TrafficControllerInterfaceOperations: :attr:`traffic_controller_interface` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: ServiceNetworkingMgmtClientConfiguration = ( @@ -3035,6 +3287,7 @@ def get(self, resource_group_name: str, traffic_controller_name: str, **kwargs: } _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 @@ -3049,11 +3302,14 @@ def get(self, resource_group_name: str, traffic_controller_name: str, **kwargs: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.TrafficController, response.json()) @@ -3066,7 +3322,7 @@ def _create_or_update_initial( self, resource_group_name: str, traffic_controller_name: str, - resource: Union[_models.TrafficController, JSON, IO[bytes]], + resource: Union[_models.TrafficController, _types.TrafficController, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -3105,6 +3361,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 @@ -3118,14 +3375,17 @@ def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 201: 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 @@ -3165,7 +3425,7 @@ def begin_create_or_update( self, resource_group_name: str, traffic_controller_name: str, - resource: JSON, + resource: _types.TrafficController, *, content_type: str = "application/json", **kwargs: Any @@ -3178,7 +3438,7 @@ def begin_create_or_update( :param traffic_controller_name: traffic controller name for path. Required. :type traffic_controller_name: str :param resource: Resource create parameters. Required. - :type resource: JSON + :type resource: ~azure.mgmt.servicenetworking.types.TrafficController :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -3221,7 +3481,7 @@ def begin_create_or_update( self, resource_group_name: str, traffic_controller_name: str, - resource: Union[_models.TrafficController, JSON, IO[bytes]], + resource: Union[_models.TrafficController, _types.TrafficController, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.TrafficController]: """Create a TrafficController. @@ -3231,9 +3491,10 @@ def begin_create_or_update( :type resource_group_name: str :param traffic_controller_name: traffic controller name for path. Required. :type traffic_controller_name: str - :param resource: Resource create parameters. Is one of the following types: TrafficController, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.servicenetworking.models.TrafficController or JSON or IO[bytes] + :param resource: Resource create parameters. Is either a TrafficController type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.servicenetworking.models.TrafficController or + ~azure.mgmt.servicenetworking.types.TrafficController or IO[bytes] :return: An instance of LROPoller that returns TrafficController. The TrafficController is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicenetworking.models.TrafficController] @@ -3323,7 +3584,7 @@ def update( self, resource_group_name: str, traffic_controller_name: str, - properties: JSON, + properties: _types.TrafficControllerUpdate, *, content_type: str = "application/json", **kwargs: Any @@ -3336,7 +3597,7 @@ def update( :param traffic_controller_name: traffic controller name for path. Required. :type traffic_controller_name: str :param properties: The resource properties to be updated. Required. - :type properties: JSON + :type properties: ~azure.mgmt.servicenetworking.types.TrafficControllerUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -3377,7 +3638,7 @@ def update( self, resource_group_name: str, traffic_controller_name: str, - properties: Union[_models.TrafficControllerUpdate, JSON, IO[bytes]], + properties: Union[_models.TrafficControllerUpdate, _types.TrafficControllerUpdate, IO[bytes]], **kwargs: Any ) -> _models.TrafficController: """Update a TrafficController. @@ -3387,10 +3648,10 @@ def update( :type resource_group_name: str :param traffic_controller_name: traffic controller name for path. Required. :type traffic_controller_name: str - :param properties: The resource properties to be updated. Is one of the following types: - TrafficControllerUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.servicenetworking.models.TrafficControllerUpdate or JSON or - IO[bytes] + :param properties: The resource properties to be updated. Is either a TrafficControllerUpdate + type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.servicenetworking.models.TrafficControllerUpdate or + ~azure.mgmt.servicenetworking.types.TrafficControllerUpdate or IO[bytes] :return: TrafficController. The TrafficController is compatible with MutableMapping :rtype: ~azure.mgmt.servicenetworking.models.TrafficController :raises ~azure.core.exceptions.HttpResponseError: @@ -3431,6 +3692,7 @@ def update( } _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 @@ -3445,11 +3707,14 @@ def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) 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.TrafficController, response.json()) @@ -3485,6 +3750,7 @@ def _delete_initial(self, resource_group_name: str, traffic_controller_name: str } _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 @@ -3498,7 +3764,10 @@ def _delete_initial(self, resource_group_name: str, traffic_controller_name: str except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -3506,7 +3775,7 @@ def _delete_initial(self, resource_group_name: str, traffic_controller_name: str 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 @@ -3571,7 +3840,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.TrafficController"]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.TrafficController"]: """List TrafficController resources by resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3622,7 +3891,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( @@ -3635,7 +3907,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TrafficController], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.TrafficController], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -3651,7 +3926,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -3659,7 +3937,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.TrafficController"]: + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.TrafficController"]: """List TrafficController resources by subscription ID. :return: An iterator like instance of TrafficController @@ -3706,7 +3984,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( @@ -3719,7 +4000,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TrafficController], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.TrafficController], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -3735,7 +4019,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -3743,17 +4030,17 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class Operations: +class PrivateEndpointConnectionsInterfaceOperations: # pylint: disable=docstring-missing-param,name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient`'s - :attr:`operations` attribute. + :attr:`private_endpoint_connections_interface` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: ServiceNetworkingMgmtClientConfiguration = ( @@ -3763,18 +4050,41 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """List the operations for the provider. + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": [ + "api_version", + "subscription_id", + "resource_group_name", + "traffic_controller_name", + "private_endpoint_connection_name", + "accept", + ] + }, + api_versions_list=["2026-03-01"], + ) + def get( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Get a PrivateEndpointConnection. - :return: An iterator like instance of Operation - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicenetworking.models.Operation] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :param private_endpoint_connection_name: Private Endpoint Connection. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicenetworking.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3783,14 +4093,877 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_operations_list_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_interface_get_request( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _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 + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": [ + "api_version", + "subscription_id", + "resource_group_name", + "traffic_controller_name", + "private_endpoint_connection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-01"], + ) + def _update_initial( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_interface_update_request( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _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 + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Create a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :param private_endpoint_connection_name: Private Endpoint Connection. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.servicenetworking.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicenetworking.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: _types.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Create a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :param private_endpoint_connection_name: Private Endpoint Connection. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.servicenetworking.types.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicenetworking.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Create a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :param private_endpoint_connection_name: Private Endpoint Connection. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicenetworking.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": [ + "api_version", + "subscription_id", + "resource_group_name", + "traffic_controller_name", + "private_endpoint_connection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-01"], + ) + def begin_update( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Create a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :param private_endpoint_connection_name: Private Endpoint Connection. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Is either a PrivateEndpointConnection type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.servicenetworking.models.PrivateEndpointConnection or + ~azure.mgmt.servicenetworking.types.PrivateEndpointConnection or IO[bytes] + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicenetworking.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + private_endpoint_connection_name=private_endpoint_connection_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": [ + "api_version", + "subscription_id", + "resource_group_name", + "traffic_controller_name", + "private_endpoint_connection_name", + ] + }, + api_versions_list=["2026-03-01"], + ) + def _delete_initial( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_interface_delete_request( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _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 + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + 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() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": [ + "api_version", + "subscription_id", + "resource_group_name", + "traffic_controller_name", + "private_endpoint_connection_name", + ] + }, + api_versions_list=["2026-03-01"], + ) + def begin_delete( + self, + resource_group_name: str, + traffic_controller_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a PrivateEndpointConnection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :param private_endpoint_connection_name: Private Endpoint Connection. Required. + :type private_endpoint_connection_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": ["api_version", "subscription_id", "resource_group_name", "traffic_controller_name", "accept"] + }, + api_versions_list=["2026-03-01"], + ) + def list_by_traffic_controller( + self, resource_group_name: str, traffic_controller_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateEndpointConnection"]: + """List PrivateEndpointConnection resources by TrafficController. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicenetworking.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_interface_list_by_traffic_controller_request( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateEndpointConnection], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PrivateLinkResourcesInterfaceOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient`'s + :attr:`private_link_resources_interface` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceNetworkingMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": [ + "api_version", + "subscription_id", + "resource_group_name", + "traffic_controller_name", + "private_link_resource_name", + "accept", + ] + }, + api_versions_list=["2026-03-01"], + ) + def get( + self, resource_group_name: str, traffic_controller_name: str, private_link_resource_name: str, **kwargs: Any + ) -> _models.PrivateLinkResource: + """Get a PrivateLinkResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :param private_link_resource_name: Private Link Resource. Required. + :type private_link_resource_name: str + :return: PrivateLinkResource. The PrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicenetworking.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) + + _request = build_private_link_resources_interface_get_request( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + private_link_resource_name=private_link_resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _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 + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateLinkResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-01", + params_added_on={ + "2026-03-01": ["api_version", "subscription_id", "resource_group_name", "traffic_controller_name", "accept"] + }, + api_versions_list=["2026-03-01"], + ) + def list_by_traffic_controller( + self, resource_group_name: str, traffic_controller_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateLinkResource"]: + """List PrivateLinkResource resources by TrafficController. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param traffic_controller_name: traffic controller name for path. Required. + :type traffic_controller_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicenetworking.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateLinkResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_link_resources_interface_list_by_traffic_controller_request( + resource_group_name=resource_group_name, + traffic_controller_name=traffic_controller_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateLinkResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class Operations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicenetworking.ServiceNetworkingMgmtClient`'s + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceNetworkingMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicenetworking.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url( "self._config.base_url", self._config.base_url, "str", skip_quote=True @@ -3809,7 +4982,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( @@ -3822,7 +4998,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) @@ -3838,7 +5017,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/operations/_patch.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/operations/_patch.py index 8bcb627aa475..ea765788358a 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/operations/_patch.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/operations/_patch.py @@ -7,9 +7,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/types.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/types.py new file mode 100644 index 000000000000..5b1eedcf0693 --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/azure/mgmt/servicenetworking/types.py @@ -0,0 +1,700 @@ +# 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 Any, TYPE_CHECKING, Union +from typing_extensions import Required, TypedDict + +if TYPE_CHECKING: + from .models import ( + AssociationType, + CreatedByType, + IpAccessRuleAction, + PolicyType, + PrivateLinkServiceConnectionStatus, + ProvisioningState, + PublicNetworkAccess, + ) + + +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 TrackedResource(Resource): + """Tracked 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 tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: dict[str, str] + """Resource tags.""" + location: Required[str] + """The geo-location where the resource lives. Required.""" + + +class Association(TrackedResource): + """Association Subresource of Traffic Controller. + + :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 tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: "AssociationProperties" + """ + + properties: "AssociationProperties" + """The resource-specific properties for this resource.""" + + +class AssociationProperties(TypedDict, total=False): + """Association Properties. + + :ivar associationType: Association Type. Required. "subnets" + :vartype associationType: Union[str, "AssociationType"] + :ivar subnet: Association Subnet. + :vartype subnet: "AssociationSubnet" + :ivar provisioningState: Provisioning State of Traffic Controller Association Resource. Known + values are: "Provisioning", "Updating", "Deleting", "Accepted", "Succeeded", "Failed", and + "Canceled". + :vartype provisioningState: Union[str, "ProvisioningState"] + """ + + associationType: Required[Union[str, "AssociationType"]] + """Association Type. Required. \"subnets\"""" + subnet: "AssociationSubnet" + """Association Subnet.""" + provisioningState: Union[str, "ProvisioningState"] + """Provisioning State of Traffic Controller Association Resource. Known values are: + \"Provisioning\", \"Updating\", \"Deleting\", \"Accepted\", \"Succeeded\", \"Failed\", and + \"Canceled\".""" + + +class AssociationSubnet(TypedDict, total=False): + """Association Subnet. + + :ivar id: Association ID. Required. + :vartype id: str + """ + + id: Required[str] + """Association ID. Required.""" + + +class AssociationSubnetUpdate(TypedDict, total=False): + """Association Subnet. + + :ivar id: Association ID. + :vartype id: str + """ + + id: str + """Association ID.""" + + +class AssociationUpdate(TypedDict, total=False): + """The type used for update operations of the Association. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The resource-specific properties for this resource. + :vartype properties: "AssociationUpdateProperties" + """ + + tags: dict[str, str] + """Resource tags.""" + properties: "AssociationUpdateProperties" + """The resource-specific properties for this resource.""" + + +class AssociationUpdateProperties(TypedDict, total=False): + """The updatable properties of the Association. + + :ivar associationType: Association Type. "subnets" + :vartype associationType: Union[str, "AssociationType"] + :ivar subnet: Association Subnet. + :vartype subnet: "AssociationSubnetUpdate" + """ + + associationType: Union[str, "AssociationType"] + """Association Type. \"subnets\"""" + subnet: "AssociationSubnetUpdate" + """Association Subnet.""" + + +class Frontend(TrackedResource): + """Frontend Sub Resource of Traffic Controller. + + :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 tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: "FrontendProperties" + """ + + properties: "FrontendProperties" + """The resource-specific properties for this resource.""" + + +class FrontendAssociation(TypedDict, total=False): + """Reference to an Association resource. + + :ivar id: Resource ID of the Association. Required. + :vartype id: str + """ + + id: Required[str] + """Resource ID of the Association. Required.""" + + +class FrontendProperties(TypedDict, total=False): + """Frontend Properties. + + :ivar fqdn: The Fully Qualified Domain Name of the DNS record associated to a Traffic + Controller frontend. + :vartype fqdn: str + :ivar publicNetworkAccess: Whether public network access is allowed for the frontend. Enabled + indicates a public frontend; Disabled indicates a private frontend. Known values are: "Enabled" + and "Disabled". + :vartype publicNetworkAccess: Union[str, "PublicNetworkAccess"] + :ivar association: Reference to an Association resource that contains the subnet where the + private frontend should be deployed. + :vartype association: "FrontendAssociation" + :ivar securityPolicyConfigurations: Frontend Security Policy Configuration. + :vartype securityPolicyConfigurations: "SecurityPolicyConfigurations" + :ivar provisioningState: Provisioning State of Traffic Controller Frontend Resource. Known + values are: "Provisioning", "Updating", "Deleting", "Accepted", "Succeeded", "Failed", and + "Canceled". + :vartype provisioningState: Union[str, "ProvisioningState"] + """ + + fqdn: str + """The Fully Qualified Domain Name of the DNS record associated to a Traffic Controller frontend.""" + publicNetworkAccess: Union[str, "PublicNetworkAccess"] + """Whether public network access is allowed for the frontend. Enabled indicates a public frontend; + Disabled indicates a private frontend. Known values are: \"Enabled\" and \"Disabled\".""" + association: "FrontendAssociation" + """Reference to an Association resource that contains the subnet where the private frontend should + be deployed.""" + securityPolicyConfigurations: "SecurityPolicyConfigurations" + """Frontend Security Policy Configuration.""" + provisioningState: Union[str, "ProvisioningState"] + """Provisioning State of Traffic Controller Frontend Resource. Known values are: \"Provisioning\", + \"Updating\", \"Deleting\", \"Accepted\", \"Succeeded\", \"Failed\", and \"Canceled\".""" + + +class FrontendUpdate(TypedDict, total=False): + """The type used for update operations of the Frontend. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The resource-specific properties for this resource. + :vartype properties: "FrontendUpdateProperties" + """ + + tags: dict[str, str] + """Resource tags.""" + properties: "FrontendUpdateProperties" + """The resource-specific properties for this resource.""" + + +class FrontendUpdateProperties(TypedDict, total=False): + """The updatable properties of the Frontend. + + :ivar publicNetworkAccess: Whether public network access is allowed for the frontend. Enabled + indicates a public frontend; Disabled indicates a private frontend. Known values are: "Enabled" + and "Disabled". + :vartype publicNetworkAccess: Union[str, "PublicNetworkAccess"] + :ivar association: Reference to an Association resource that contains the subnet where the + private frontend should be deployed. + :vartype association: "FrontendAssociation" + :ivar securityPolicyConfigurations: Frontend Security Policy Configuration. + :vartype securityPolicyConfigurations: "SecurityPolicyConfigurations" + """ + + publicNetworkAccess: Union[str, "PublicNetworkAccess"] + """Whether public network access is allowed for the frontend. Enabled indicates a public frontend; + Disabled indicates a private frontend. Known values are: \"Enabled\" and \"Disabled\".""" + association: "FrontendAssociation" + """Reference to an Association resource that contains the subnet where the private frontend should + be deployed.""" + securityPolicyConfigurations: "SecurityPolicyConfigurations" + """Frontend Security Policy Configuration.""" + + +class IpAccessRule(TypedDict, total=False): + """Ip Access Policy Rules. + + :ivar name: Name of the Ip Access Rule. Required. + :vartype name: str + :ivar priority: The priority of the rule. The value can be between 1 and 500. The priority + number must be unique for each rule in the collection. The lower the priority number, the + higher the priority of the rule. Required. + :vartype priority: int + :ivar sourceAddressPrefixes: Source Address Prefixed Applied by the Rule. Asterisk '*' can also + be used to match all source IPs. Required. + :vartype sourceAddressPrefixes: list[str] + :ivar action: Action of the Rule. Required. Known values are: "allow" and "deny". + :vartype action: Union[str, "IpAccessRuleAction"] + """ + + name: Required[str] + """Name of the Ip Access Rule. Required.""" + priority: Required[int] + """The priority of the rule. The value can be between 1 and 500. The priority number must be + unique for each rule in the collection. The lower the priority number, the higher the priority + of the rule. Required.""" + sourceAddressPrefixes: Required[list[str]] + """Source Address Prefixed Applied by the Rule. Asterisk '*' can also be used to match all source + IPs. Required.""" + action: Required[Union[str, "IpAccessRuleAction"]] + """Action of the Rule. Required. Known values are: \"allow\" and \"deny\".""" + + +class IpAccessRulesPolicy(TypedDict, total=False): + """Ip Access Policy. + + :ivar rules: Ip Access Policy Rules List. + :vartype rules: list["IpAccessRule"] + """ + + rules: list["IpAccessRule"] + """Ip Access Policy Rules List.""" + + +class IpAccessRulesSecurityPolicy(TypedDict, total=False): + """IpAccessRules Security Policy. + + :ivar id: Resource ID of the Ip Access Rules Security Policy. Required. + :vartype id: str + """ + + id: Required[str] + """Resource ID of the Ip Access Rules Security Policy. Required.""" + + +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 PrivateEndpointConnection(ProxyResource): + """Private Endpoint Connection resource of Traffic Controller. + + :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: "PrivateEndpointConnectionProperties" + """ + + properties: "PrivateEndpointConnectionProperties" + """The resource-specific properties for this resource.""" + + +class PrivateEndpointConnectionProperties(TypedDict, total=False): + """Properties of a Private Endpoint Connection. + + :ivar privateEndpoint: The private endpoint resource. + :vartype privateEndpoint: "PrivateEndpointReference" + :ivar privateLinkServiceConnectionState: The connection state of the private endpoint + connection. Required. + :vartype privateLinkServiceConnectionState: "PrivateLinkServiceConnectionState" + :ivar provisioningState: Provisioning state of the private endpoint connection. Known values + are: "Provisioning", "Updating", "Deleting", "Accepted", "Succeeded", "Failed", and "Canceled". + :vartype provisioningState: Union[str, "ProvisioningState"] + """ + + privateEndpoint: "PrivateEndpointReference" + """The private endpoint resource.""" + privateLinkServiceConnectionState: Required["PrivateLinkServiceConnectionState"] + """The connection state of the private endpoint connection. Required.""" + provisioningState: Union[str, "ProvisioningState"] + """Provisioning state of the private endpoint connection. Known values are: \"Provisioning\", + \"Updating\", \"Deleting\", \"Accepted\", \"Succeeded\", \"Failed\", and \"Canceled\".""" + + +class PrivateEndpointReference(TypedDict, total=False): + """Reference to a private endpoint resource. + + :ivar id: Resource ID of the private endpoint. + :vartype id: str + """ + + id: str + """Resource ID of the private endpoint.""" + + +class PrivateLinkServiceConnectionState(TypedDict, total=False): + """The state of a private link service connection. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". + :vartype status: Union[str, "PrivateLinkServiceConnectionStatus"] + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actionsRequired: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actionsRequired: str + """ + + status: Union[str, "PrivateLinkServiceConnectionStatus"] + """Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + service. Known values are: \"Pending\", \"Approved\", \"Rejected\", and \"Disconnected\".""" + description: str + """The reason for approval/rejection of the connection.""" + actionsRequired: str + """A message indicating if changes on the service provider require any updates on the consumer.""" + + +class ResourceId(TypedDict, total=False): + """Resource ID definition used by parent to reference child resources. + + :ivar id: Resource ID of child resource. Required. + :vartype id: str + """ + + id: Required[str] + """Resource ID of child resource. Required.""" + + +class SecurityPolicy(TrackedResource): + """SecurityPolicy Subresource of Traffic Controller. + + :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 tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: "SecurityPolicyProperties" + """ + + properties: "SecurityPolicyProperties" + """The resource-specific properties for this resource.""" + + +class SecurityPolicyConfigurations(TypedDict, total=False): + """SecurityPolicyConfigurations Subresource of Traffic Controller. + + :ivar wafSecurityPolicy: Contains reference to a WAF-type security policy. + :vartype wafSecurityPolicy: "WafSecurityPolicy" + :ivar ipAccessRulesSecurityPolicy: Contains reference to a IpAccessRules-type security policy. + :vartype ipAccessRulesSecurityPolicy: "IpAccessRulesSecurityPolicy" + """ + + wafSecurityPolicy: "WafSecurityPolicy" + """Contains reference to a WAF-type security policy.""" + ipAccessRulesSecurityPolicy: "IpAccessRulesSecurityPolicy" + """Contains reference to a IpAccessRules-type security policy.""" + + +class SecurityPolicyProperties(TypedDict, total=False): + """SecurityPolicy Properties. + + :ivar policyType: Type of the Traffic Controller Security Policy. Known values are: "waf" and + "ipAccessRules". + :vartype policyType: Union[str, "PolicyType"] + :ivar wafPolicy: Web Application Firewall Policy of the Traffic Controller Security Policy. + Single Security Policy can have only one policy type set. + :vartype wafPolicy: "WafPolicy" + :ivar ipAccessRulesPolicy: Ip Access Policy of the Traffic Controller Security Policy. Single + Security Policy can have only one policy type set. + :vartype ipAccessRulesPolicy: "IpAccessRulesPolicy" + :ivar provisioningState: Provisioning State of Traffic Controller SecurityPolicy Resource. + Known values are: "Provisioning", "Updating", "Deleting", "Accepted", "Succeeded", "Failed", + and "Canceled". + :vartype provisioningState: Union[str, "ProvisioningState"] + """ + + policyType: Union[str, "PolicyType"] + """Type of the Traffic Controller Security Policy. Known values are: \"waf\" and + \"ipAccessRules\".""" + wafPolicy: "WafPolicy" + """Web Application Firewall Policy of the Traffic Controller Security Policy. Single Security + Policy can have only one policy type set.""" + ipAccessRulesPolicy: "IpAccessRulesPolicy" + """Ip Access Policy of the Traffic Controller Security Policy. Single Security Policy can have + only one policy type set.""" + provisioningState: Union[str, "ProvisioningState"] + """Provisioning State of Traffic Controller SecurityPolicy Resource. Known values are: + \"Provisioning\", \"Updating\", \"Deleting\", \"Accepted\", \"Succeeded\", \"Failed\", and + \"Canceled\".""" + + +class SecurityPolicyUpdate(TypedDict, total=False): + """The type used for update operations of the SecurityPolicy. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The resource-specific properties for this resource. + :vartype properties: "SecurityPolicyUpdateProperties" + """ + + tags: dict[str, str] + """Resource tags.""" + properties: "SecurityPolicyUpdateProperties" + """The resource-specific properties for this resource.""" + + +class SecurityPolicyUpdateProperties(TypedDict, total=False): + """The updatable properties of the SecurityPolicy. + + :ivar wafPolicy: Web Application Firewall Policy of the Traffic Controller Security Policy. + Single Security Policy can have only one policy type set. + :vartype wafPolicy: "WafPolicy" + :ivar ipAccessRulesPolicy: Ip Access Policy of the Traffic Controller Security Policy. Single + Security Policy can have only one policy type set. + :vartype ipAccessRulesPolicy: "IpAccessRulesPolicy" + """ + + wafPolicy: "WafPolicy" + """Web Application Firewall Policy of the Traffic Controller Security Policy. Single Security + Policy can have only one policy type set.""" + ipAccessRulesPolicy: "IpAccessRulesPolicy" + """Ip Access Policy of the Traffic Controller Security Policy. Single Security Policy can have + only one policy type set.""" + + +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 TrafficController(TrackedResource): + """Concrete tracked resource types can be created by aliasing this type using a specific property + type. + + :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 tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: "TrafficControllerProperties" + """ + + properties: "TrafficControllerProperties" + """The resource-specific properties for this resource.""" + + +class TrafficControllerProperties(TypedDict, total=False): + """Traffic Controller Properties. + + :ivar configurationEndpoints: Configuration Endpoints. + :vartype configurationEndpoints: list[str] + :ivar frontends: Frontends References List. + :vartype frontends: list["ResourceId"] + :ivar associations: Associations References List. + :vartype associations: list["ResourceId"] + :ivar securityPolicies: Security Policies References List. + :vartype securityPolicies: list["ResourceId"] + :ivar privateEndpointConnections: Private Endpoint Connections List. + :vartype privateEndpointConnections: list["ResourceId"] + :ivar securityPolicyConfigurations: Security Policy Configuration. + :vartype securityPolicyConfigurations: "SecurityPolicyConfigurations" + :ivar provisioningState: The status of the last operation. Known values are: "Provisioning", + "Updating", "Deleting", "Accepted", "Succeeded", "Failed", and "Canceled". + :vartype provisioningState: Union[str, "ProvisioningState"] + """ + + configurationEndpoints: list[str] + """Configuration Endpoints.""" + frontends: list["ResourceId"] + """Frontends References List.""" + associations: list["ResourceId"] + """Associations References List.""" + securityPolicies: list["ResourceId"] + """Security Policies References List.""" + privateEndpointConnections: list["ResourceId"] + """Private Endpoint Connections List.""" + securityPolicyConfigurations: "SecurityPolicyConfigurations" + """Security Policy Configuration.""" + provisioningState: Union[str, "ProvisioningState"] + """The status of the last operation. Known values are: \"Provisioning\", \"Updating\", + \"Deleting\", \"Accepted\", \"Succeeded\", \"Failed\", and \"Canceled\".""" + + +class TrafficControllerUpdate(TypedDict, total=False): + """The type used for update operations of the TrafficController. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The resource-specific properties for this resource. + :vartype properties: "TrafficControllerUpdateProperties" + """ + + tags: dict[str, str] + """Resource tags.""" + properties: "TrafficControllerUpdateProperties" + """The resource-specific properties for this resource.""" + + +class TrafficControllerUpdateProperties(TypedDict, total=False): + """The updatable properties of the TrafficController. + + :ivar securityPolicyConfigurations: Security Policy Configuration. + :vartype securityPolicyConfigurations: "SecurityPolicyConfigurations" + """ + + securityPolicyConfigurations: "SecurityPolicyConfigurations" + """Security Policy Configuration.""" + + +class WafPolicy(TypedDict, total=False): + """Web Application Firewall Policy. + + :ivar id: Resource ID of the WAF. Required. + :vartype id: str + """ + + id: Required[str] + """Resource ID of the WAF. Required.""" + + +class WafSecurityPolicy(TypedDict, total=False): + """Web Application Firewall Security Policy. + + :ivar id: Resource ID of the Waf Security Policy. Required. + :vartype id: str + """ + + id: Required[str] + """Resource ID of the Waf Security Policy. Required.""" diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_delete.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_delete.py index a3d7fb6dfc1d..288dc666f84b 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_delete.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2025-03-01-preview/AssociationDelete.json +# x-ms-original-file: 2026-03-01/AssociationDelete.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_get.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_get.py index 52fe3a98f419..cc369556344d 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_get.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2025-03-01-preview/AssociationGet.json +# x-ms-original-file: 2026-03-01/AssociationGet.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_patch.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_patch.py index c8fbf1839f04..6e81cce8ccb5 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_patch.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_patch.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: 2025-03-01-preview/AssociationPatch.json +# x-ms-original-file: 2026-03-01/AssociationPatch.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_put.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_put.py index 816a84a78c8e..21a6ff920f48 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_put.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/association_put.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: 2025-03-01-preview/AssociationPut.json +# x-ms-original-file: 2026-03-01/AssociationPut.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/associations_get.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/associations_get.py index 8cd1ad19d319..e918ebb4163f 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/associations_get.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/associations_get.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2025-03-01-preview/AssociationsGet.json +# x-ms-original-file: 2026-03-01/AssociationsGet.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontend_delete.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontend_delete.py index 95f8365119d2..8de972b8233b 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontend_delete.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontend_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2025-03-01-preview/FrontendDelete.json +# x-ms-original-file: 2026-03-01/FrontendDelete.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontend_get.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontend_get.py index eb3580f855b4..cf2d6602b32e 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontend_get.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontend_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2025-03-01-preview/FrontendGet.json +# x-ms-original-file: 2026-03-01/FrontendGet.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontend_patch.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontend_patch.py new file mode 100644 index 000000000000..6c7cc55dc4dd --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontend_patch.py @@ -0,0 +1,54 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.servicenetworking import ServiceNetworkingMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicenetworking +# USAGE + python frontend_patch.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceNetworkingMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.frontends_interface.update( + resource_group_name="rg1", + traffic_controller_name="tc1", + frontend_name="fe1", + properties={ + "properties": { + "association": {"id": "str"}, + "publicNetworkAccess": "str", + "securityPolicyConfigurations": { + "ipAccessRulesSecurityPolicy": {"id": "str"}, + "wafSecurityPolicy": {"id": "str"}, + }, + }, + "tags": {"str": "str"}, + }, + ) + print(response) + + +# x-ms-original-file: 2026-03-01/FrontendPatch.json +if __name__ == "__main__": + main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontend_put.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontend_put.py index 390bdf1a36fc..b21cfde864d2 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontend_put.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontend_put.py @@ -34,11 +34,11 @@ def main(): resource_group_name="rg1", traffic_controller_name="tc1", frontend_name="fe1", - resource={"location": "NorthCentralUS", "properties": {}}, + resource={"location": "NorthCentralUS", "properties": {"publicNetworkAccess": "Enabled"}}, ).result() print(response) -# x-ms-original-file: 2025-03-01-preview/FrontendPut.json +# x-ms-original-file: 2026-03-01/FrontendPut.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontends_get.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontends_get.py index 00e5667aa269..c403b82dab09 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontends_get.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/frontends_get.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2025-03-01-preview/FrontendsGet.json +# x-ms-original-file: 2026-03-01/FrontendsGet.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/ip_access_rules_security_policy_patch.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/ip_access_rules_security_policy_patch.py index c139621a9342..ebdb59816dea 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/ip_access_rules_security_policy_patch.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/ip_access_rules_security_policy_patch.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: 2025-03-01-preview/IpAccessRulesSecurityPolicyPatch.json +# x-ms-original-file: 2026-03-01/IpAccessRulesSecurityPolicyPatch.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/ip_access_rules_security_policy_put.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/ip_access_rules_security_policy_put.py index 95202ac8bdba..034500bf9be7 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/ip_access_rules_security_policy_put.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/ip_access_rules_security_policy_put.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: 2025-03-01-preview/IpAccessRulesSecurityPolicyPut.json +# x-ms-original-file: 2026-03-01/IpAccessRulesSecurityPolicyPut.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/operations_list.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/operations_list.py index ec1ff0af6aad..be2e1296ae7f 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/operations_list.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/operations_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2025-03-01-preview/OperationsList.json +# x-ms-original-file: 2026-03-01/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_endpoint_connection_delete.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_endpoint_connection_delete.py new file mode 100644 index 000000000000..f98e72834c4b --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_endpoint_connection_delete.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.servicenetworking import ServiceNetworkingMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicenetworking +# USAGE + python private_endpoint_connection_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceNetworkingMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.private_endpoint_connections_interface.begin_delete( + resource_group_name="rg1", + traffic_controller_name="tc1", + private_endpoint_connection_name="pec1", + ).result() + + +# x-ms-original-file: 2026-03-01/PrivateEndpointConnectionDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_endpoint_connection_get.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_endpoint_connection_get.py new file mode 100644 index 000000000000..93511d022a3a --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_endpoint_connection_get.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.servicenetworking import ServiceNetworkingMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicenetworking +# USAGE + python private_endpoint_connection_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceNetworkingMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_endpoint_connections_interface.get( + resource_group_name="rg1", + traffic_controller_name="tc1", + private_endpoint_connection_name="pec1", + ) + print(response) + + +# x-ms-original-file: 2026-03-01/PrivateEndpointConnectionGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_endpoint_connection_put.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_endpoint_connection_put.py new file mode 100644 index 000000000000..311153a8becc --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_endpoint_connection_put.py @@ -0,0 +1,48 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.servicenetworking import ServiceNetworkingMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicenetworking +# USAGE + python private_endpoint_connection_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceNetworkingMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_endpoint_connections_interface.begin_update( + resource_group_name="rg1", + traffic_controller_name="tc1", + private_endpoint_connection_name="pec1", + resource={ + "properties": { + "privateLinkServiceConnectionState": {"description": "Approved by admin", "status": "Approved"} + } + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-03-01/PrivateEndpointConnectionPut.json +if __name__ == "__main__": + main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_endpoint_connections_get.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_endpoint_connections_get.py new file mode 100644 index 000000000000..b7ee57c88a60 --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_endpoint_connections_get.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.servicenetworking import ServiceNetworkingMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicenetworking +# USAGE + python private_endpoint_connections_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceNetworkingMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_endpoint_connections_interface.list_by_traffic_controller( + resource_group_name="rg1", + traffic_controller_name="tc1", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-03-01/PrivateEndpointConnectionsGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_frontend_get.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_frontend_get.py new file mode 100644 index 000000000000..abe47a7e5ce9 --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_frontend_get.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.servicenetworking import ServiceNetworkingMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicenetworking +# USAGE + python private_frontend_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceNetworkingMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.frontends_interface.get( + resource_group_name="rg1", + traffic_controller_name="tc1", + frontend_name="pfe1", + ) + print(response) + + +# x-ms-original-file: 2026-03-01/PrivateFrontendGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_frontend_put.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_frontend_put.py new file mode 100644 index 000000000000..556703eadc86 --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_frontend_put.py @@ -0,0 +1,53 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.servicenetworking import ServiceNetworkingMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicenetworking +# USAGE + python private_frontend_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceNetworkingMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.frontends_interface.begin_create_or_update( + resource_group_name="rg1", + traffic_controller_name="tc1", + frontend_name="pfe1", + resource={ + "location": "NorthCentralUS", + "properties": { + "association": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1" + }, + "publicNetworkAccess": "Disabled", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-03-01/PrivateFrontendPut.json +if __name__ == "__main__": + main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_link_resource_get.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_link_resource_get.py new file mode 100644 index 000000000000..aed78ca9d62b --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_link_resource_get.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.servicenetworking import ServiceNetworkingMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicenetworking +# USAGE + python private_link_resource_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceNetworkingMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_link_resources_interface.get( + resource_group_name="rg1", + traffic_controller_name="tc1", + private_link_resource_name="fe1", + ) + print(response) + + +# x-ms-original-file: 2026-03-01/PrivateLinkResourceGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_link_resources_get.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_link_resources_get.py new file mode 100644 index 000000000000..cb6dde4d26cb --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/private_link_resources_get.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.servicenetworking import ServiceNetworkingMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicenetworking +# USAGE + python private_link_resources_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceNetworkingMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_link_resources_interface.list_by_traffic_controller( + resource_group_name="rg1", + traffic_controller_name="tc1", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-03-01/PrivateLinkResourcesGet.json +if __name__ == "__main__": + main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/security_policies_get_list.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/security_policies_get_list.py index a3cda8bc5b7b..9051d4ddaaa4 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/security_policies_get_list.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/security_policies_get_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2025-03-01-preview/SecurityPoliciesGetList.json +# x-ms-original-file: 2026-03-01/SecurityPoliciesGetList.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/security_policy_delete.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/security_policy_delete.py index 745dfb83bbfc..7da3c9813183 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/security_policy_delete.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/security_policy_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2025-03-01-preview/SecurityPolicyDelete.json +# x-ms-original-file: 2026-03-01/SecurityPolicyDelete.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/security_policy_get.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/security_policy_get.py index e3055f6db25d..381cc553644b 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/security_policy_get.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/security_policy_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2025-03-01-preview/SecurityPolicyGet.json +# x-ms-original-file: 2026-03-01/SecurityPolicyGet.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_delete.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_delete.py index 0fbe680fd1b4..fef7877aa54c 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_delete.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2025-03-01-preview/TrafficControllerDelete.json +# x-ms-original-file: 2026-03-01/TrafficControllerDelete.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_get.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_get.py index d2bea4d6f838..93c6a0853b1e 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_get.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2025-03-01-preview/TrafficControllerGet.json +# x-ms-original-file: 2026-03-01/TrafficControllerGet.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_patch.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_patch.py index 93859dcf77f1..0283ef5ac0a6 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_patch.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_patch.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2025-03-01-preview/TrafficControllerPatch.json +# x-ms-original-file: 2026-03-01/TrafficControllerPatch.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_put.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_put.py index 82eb7cba4a46..3213a5ee4077 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_put.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controller_put.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2025-03-01-preview/TrafficControllerPut.json +# x-ms-original-file: 2026-03-01/TrafficControllerPut.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controllers_get.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controllers_get.py index df7bc1b444a1..dd3db7603035 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controllers_get.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controllers_get.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2025-03-01-preview/TrafficControllersGet.json +# x-ms-original-file: 2026-03-01/TrafficControllersGet.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controllers_get_list.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controllers_get_list.py index b4d87d774c65..8a08a8bcc5d7 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controllers_get_list.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/traffic_controllers_get_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2025-03-01-preview/TrafficControllersGetList.json +# x-ms-original-file: 2026-03-01/TrafficControllersGetList.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/waf_security_policy_patch.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/waf_security_policy_patch.py index 6394b64f21ca..3eabccd23557 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/waf_security_policy_patch.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/waf_security_policy_patch.py @@ -38,7 +38,7 @@ def main(): properties={ "properties": { "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Network/applicationGatewayWebApplicationFirewallPolicies/wp-0" } } }, @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: 2025-03-01-preview/WafSecurityPolicyPatch.json +# x-ms-original-file: 2026-03-01/WafSecurityPolicyPatch.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/waf_security_policy_put.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/waf_security_policy_put.py index fc98d16fbbb1..33f9876d1ebc 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/waf_security_policy_put.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_samples/waf_security_policy_put.py @@ -39,7 +39,7 @@ def main(): "location": "NorthCentralUS", "properties": { "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Network/applicationGatewayWebApplicationFirewallPolicies/wp-0" } }, }, @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: 2025-03-01-preview/WafSecurityPolicyPut.json +# x-ms-original-file: 2026-03-01/WafSecurityPolicyPut.json if __name__ == "__main__": main() diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_frontends_interface_operations.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_frontends_interface_operations.py index 6b6caaf29e0b..672da9cadcdc 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_frontends_interface_operations.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_frontends_interface_operations.py @@ -42,8 +42,10 @@ def test_frontends_interface_begin_create_or_update(self, resource_group): "id": "str", "name": "str", "properties": { + "association": {"id": "str"}, "fqdn": "str", "provisioningState": "str", + "publicNetworkAccess": "str", "securityPolicyConfigurations": { "ipAccessRulesSecurityPolicy": {"id": "str"}, "wafSecurityPolicy": {"id": "str"}, @@ -74,10 +76,12 @@ def test_frontends_interface_update(self, resource_group): frontend_name="str", properties={ "properties": { + "association": {"id": "str"}, + "publicNetworkAccess": "str", "securityPolicyConfigurations": { "ipAccessRulesSecurityPolicy": {"id": "str"}, "wafSecurityPolicy": {"id": "str"}, - } + }, }, "tags": {"str": "str"}, }, diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_frontends_interface_operations_async.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_frontends_interface_operations_async.py index e16a25decbb2..6f2024f8879d 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_frontends_interface_operations_async.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_frontends_interface_operations_async.py @@ -44,8 +44,10 @@ async def test_frontends_interface_begin_create_or_update(self, resource_group): "id": "str", "name": "str", "properties": { + "association": {"id": "str"}, "fqdn": "str", "provisioningState": "str", + "publicNetworkAccess": "str", "securityPolicyConfigurations": { "ipAccessRulesSecurityPolicy": {"id": "str"}, "wafSecurityPolicy": {"id": "str"}, @@ -77,10 +79,12 @@ async def test_frontends_interface_update(self, resource_group): frontend_name="str", properties={ "properties": { + "association": {"id": "str"}, + "publicNetworkAccess": "str", "securityPolicyConfigurations": { "ipAccessRulesSecurityPolicy": {"id": "str"}, "wafSecurityPolicy": {"id": "str"}, - } + }, }, "tags": {"str": "str"}, }, diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_private_endpoint_connections_interface_operations.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_private_endpoint_connections_interface_operations.py new file mode 100644 index 000000000000..aa7374e7c339 --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_private_endpoint_connections_interface_operations.py @@ -0,0 +1,88 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.servicenetworking import ServiceNetworkingMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestServiceNetworkingMgmtPrivateEndpointConnectionsInterfaceOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ServiceNetworkingMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_interface_get(self, resource_group): + response = self.client.private_endpoint_connections_interface.get( + resource_group_name=resource_group.name, + traffic_controller_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_interface_begin_update(self, resource_group): + response = self.client.private_endpoint_connections_interface.begin_update( + resource_group_name=resource_group.name, + traffic_controller_name="str", + private_endpoint_connection_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_interface_begin_delete(self, resource_group): + response = self.client.private_endpoint_connections_interface.begin_delete( + resource_group_name=resource_group.name, + traffic_controller_name="str", + private_endpoint_connection_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_interface_list_by_traffic_controller(self, resource_group): + response = self.client.private_endpoint_connections_interface.list_by_traffic_controller( + resource_group_name=resource_group.name, + traffic_controller_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_private_endpoint_connections_interface_operations_async.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_private_endpoint_connections_interface_operations_async.py new file mode 100644 index 000000000000..e6ac58ae178c --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_private_endpoint_connections_interface_operations_async.py @@ -0,0 +1,93 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.servicenetworking.aio import ServiceNetworkingMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestServiceNetworkingMgmtPrivateEndpointConnectionsInterfaceOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ServiceNetworkingMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_interface_get(self, resource_group): + response = await self.client.private_endpoint_connections_interface.get( + resource_group_name=resource_group.name, + traffic_controller_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_interface_begin_update(self, resource_group): + response = await ( + await self.client.private_endpoint_connections_interface.begin_update( + resource_group_name=resource_group.name, + traffic_controller_name="str", + private_endpoint_connection_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_interface_begin_delete(self, resource_group): + response = await ( + await self.client.private_endpoint_connections_interface.begin_delete( + resource_group_name=resource_group.name, + traffic_controller_name="str", + private_endpoint_connection_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_interface_list_by_traffic_controller(self, resource_group): + response = self.client.private_endpoint_connections_interface.list_by_traffic_controller( + resource_group_name=resource_group.name, + traffic_controller_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_private_link_resources_interface_operations.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_private_link_resources_interface_operations.py new file mode 100644 index 000000000000..c13846f54cb0 --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_private_link_resources_interface_operations.py @@ -0,0 +1,42 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.servicenetworking import ServiceNetworkingMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestServiceNetworkingMgmtPrivateLinkResourcesInterfaceOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ServiceNetworkingMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_link_resources_interface_get(self, resource_group): + response = self.client.private_link_resources_interface.get( + resource_group_name=resource_group.name, + traffic_controller_name="str", + private_link_resource_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_link_resources_interface_list_by_traffic_controller(self, resource_group): + response = self.client.private_link_resources_interface.list_by_traffic_controller( + resource_group_name=resource_group.name, + traffic_controller_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_private_link_resources_interface_operations_async.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_private_link_resources_interface_operations_async.py new file mode 100644 index 000000000000..1b11aa616ad8 --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_private_link_resources_interface_operations_async.py @@ -0,0 +1,43 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.servicenetworking.aio import ServiceNetworkingMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestServiceNetworkingMgmtPrivateLinkResourcesInterfaceOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ServiceNetworkingMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_link_resources_interface_get(self, resource_group): + response = await self.client.private_link_resources_interface.get( + resource_group_name=resource_group.name, + traffic_controller_name="str", + private_link_resource_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_link_resources_interface_list_by_traffic_controller(self, resource_group): + response = self.client.private_link_resources_interface.list_by_traffic_controller( + resource_group_name=resource_group.name, + traffic_controller_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_traffic_controller_interface_operations.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_traffic_controller_interface_operations.py index ef27cec4fc1c..7967f18cc41b 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_traffic_controller_interface_operations.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_traffic_controller_interface_operations.py @@ -43,6 +43,7 @@ def test_traffic_controller_interface_begin_create_or_update(self, resource_grou "associations": [{"id": "str"}], "configurationEndpoints": ["str"], "frontends": [{"id": "str"}], + "privateEndpointConnections": [{"id": "str"}], "provisioningState": "str", "securityPolicies": [{"id": "str"}], "securityPolicyConfigurations": { diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_traffic_controller_interface_operations_async.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_traffic_controller_interface_operations_async.py index f70fefdc9b4c..2c58c60af0ea 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_traffic_controller_interface_operations_async.py +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/generated_tests/test_service_networking_mgmt_traffic_controller_interface_operations_async.py @@ -45,6 +45,7 @@ async def test_traffic_controller_interface_begin_create_or_update(self, resourc "associations": [{"id": "str"}], "configurationEndpoints": ["str"], "frontends": [{"id": "str"}], + "privateEndpointConnections": [{"id": "str"}], "provisioningState": "str", "securityPolicies": [{"id": "str"}], "securityPolicyConfigurations": { diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/pyproject.toml b/sdk/servicenetworking/azure-mgmt-servicenetworking/pyproject.toml index 540da07d41af..1d7f24ae9ec2 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/pyproject.toml +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/pyproject.toml @@ -1,6 +1,88 @@ +[build-system] +requires = [ + "setuptools>=77.0.3", + "wheel", +] +build-backend = "setuptools.build_meta" + +[project] +name = "azure-mgmt-servicenetworking" +authors = [ + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, +] +description = "Microsoft Azure Servicenetworking Management Client Library for Python" +license = "MIT" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "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.10" +keywords = [ + "azure", + "azure sdk", +] +dependencies = [ + "isodate>=0.6.1", + "azure-mgmt-core>=1.6.0", + "typing-extensions>=4.6.0", +] +dynamic = [ + "version", + "readme", +] + +[project.urls] +repository = "https://github.com/Azure/azure-sdk-for-python" + +[tool.setuptools.dynamic.version] +attr = "azure.mgmt.servicenetworking._version.VERSION" + +[tool.setuptools.dynamic.readme] +file = [ + "README.md", + "CHANGELOG.md", +] +content-type = "text/markdown" + +[tool.setuptools.packages.find] +exclude = [ + "tests*", + "generated_tests*", + "samples*", + "generated_samples*", + "doc*", + "azure", + "azure.mgmt", +] + +[tool.setuptools.package-data] +pytyped = [ + "py.typed", +] + [tool.azure-sdk-build] breaking = false mypy = false pyright = false type_check_samples = false verifytypes = false + +[packaging] +package_name = "azure-mgmt-servicenetworking" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Servicenetworking Management" +package_doc_id = "" +is_stable = true +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +title = "ServiceNetworkingMgmtClient" +exclude_folders = "" diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/sdk_packaging.toml b/sdk/servicenetworking/azure-mgmt-servicenetworking/sdk_packaging.toml deleted file mode 100644 index cfe0e26c00f1..000000000000 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/sdk_packaging.toml +++ /dev/null @@ -1,11 +0,0 @@ -[packaging] -package_name = "azure-mgmt-servicenetworking" -package_nspkg = "azure-mgmt-nspkg" -package_pprint_name = "Servicenetworking Management" -package_doc_id = "" -is_stable = false -is_arm = true -need_msrestazure = false -need_azuremgmtcore = true -sample_link = "" -title = "ServiceNetworkingMgmtClient" diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/setup.py b/sdk/servicenetworking/azure-mgmt-servicenetworking/setup.py deleted file mode 100644 index bd2d3ccaa724..000000000000 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/setup.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import re -import os.path -from io import open -from setuptools import find_packages, setup - -# Change the PACKAGE_NAME only to change folder and different name -PACKAGE_NAME = "azure-mgmt-servicenetworking" -PACKAGE_PPRINT_NAME = "Servicenetworking Management" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace("-", "/") -# a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace("-", ".") - -# Version extraction inspired from 'requests' -with open( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py"), - "r", -) as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) - -if not version: - raise RuntimeError("Cannot find version information") - -with open("README.md", encoding="utf-8") as f: - readme = f.read() -with open("CHANGELOG.md", encoding="utf-8") as f: - changelog = f.read() - -setup( - name=PACKAGE_NAME, - version=version, - description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), - long_description=readme + "\n\n" + changelog, - long_description_content_type="text/markdown", - license="MIT License", - author="Microsoft Corporation", - author_email="azpysdkhelp@microsoft.com", - url="https://github.com/Azure/azure-sdk-for-python", - keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product - classifiers=[ - "Development Status :: 4 - Beta", - "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", - "License :: OSI Approved :: MIT License", - ], - zip_safe=False, - packages=find_packages( - exclude=[ - "tests", - # Exclude packages that will be covered by PEP420 or nspkg - "azure", - "azure.mgmt", - ] - ), - include_package_data=True, - package_data={ - "pytyped": ["py.typed"], - }, - install_requires=[ - "isodate>=0.6.1", - "typing-extensions>=4.6.0", - "azure-common>=1.1", - "azure-mgmt-core>=1.5.0", - ], - python_requires=">=3.9", -) diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/tsp-location.yaml b/sdk/servicenetworking/azure-mgmt-servicenetworking/tsp-location.yaml index e2b92cbc28ab..d09a122b3fbf 100644 --- a/sdk/servicenetworking/azure-mgmt-servicenetworking/tsp-location.yaml +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/tsp-location.yaml @@ -1,4 +1,4 @@ -directory: specification/servicenetworking/ServiceNetworking.Management -commit: 8ab23bfef36dbedfe554f215d0771a4ef7d56d11 +directory: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/ServiceNetworking +commit: 3fbff828a405632668f197b4c30466a0b8dc2cef repo: Azure/azure-rest-api-specs additionalDirectories: