diff --git a/sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/_patch.py b/sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/_patch.py index 59473e6e901b..438d337b9f88 100644 --- a/sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/_patch.py +++ b/sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/_patch.py @@ -66,8 +66,8 @@ class ConfidentialLedgerClient(GeneratedClient): file does not exist yet, the Confidential Ledger's TLS certificate will be fetched and saved to this file. :paramtype ledger_certificate_path: Union[bytes, str, os.PathLike] - :keyword api_version: Api Version. Default value is "2022-05-13". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: API version for Confidential Ledger operations. Default value is "2024-12-09-preview". + This aligns with the latest preview specification. Overriding may lead to unsupported behavior. :paramtype api_version: str """ @@ -79,6 +79,10 @@ def __init__( ledger_certificate_path: Union[bytes, str, os.PathLike], **kwargs: Any, ) -> None: + # Align default to latest preview used by generated configuration + api_version = kwargs.pop("api_version", "2024-12-09-preview") + kwargs["api_version"] = api_version + # Remove some kwargs first so that there aren't unexpected kwargs passed to # get_ledger_identity. diff --git a/sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/aio/_patch.py b/sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/aio/_patch.py index 0f494322eb1d..2606b3cc67ac 100644 --- a/sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/aio/_patch.py +++ b/sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/aio/_patch.py @@ -52,8 +52,8 @@ class ConfidentialLedgerClient(GeneratedClient): file does not exist yet, the Confidential Ledger's TLS certificate will be fetched and saved to this file. :paramtype ledger_certificate_path: Union[bytes, str, os.PathLike] - :keyword api_version: Api Version. Default value is "2022-05-13". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: API version for Confidential Ledger operations. Default value is "2024-12-09-preview". + This aligns with the latest preview specification. Overriding may lead to unsupported behavior. :paramtype api_version: str """ @@ -65,6 +65,10 @@ def __init__( ledger_certificate_path: Union[bytes, str, os.PathLike], **kwargs: Any, ) -> None: + # Align default to latest preview used by generated configuration + api_version = kwargs.pop("api_version", "2024-12-09-preview") + kwargs["api_version"] = api_version + # Remove some kwargs first so that there aren't unexpected kwargs passed to # get_ledger_identity. diff --git a/sdk/confidentialledger/azure-confidentialledger/tests/test_api_version.py b/sdk/confidentialledger/azure-confidentialledger/tests/test_api_version.py new file mode 100644 index 000000000000..93610ce40614 --- /dev/null +++ b/sdk/confidentialledger/azure-confidentialledger/tests/test_api_version.py @@ -0,0 +1,96 @@ +# pylint: disable=line-too-long,useless-suppression +"""Tests for API version defaults in Confidential Ledger clients.""" +import os +import re + + +class TestDefaultApiVersion: + """Test that the default API version is correctly set in source code.""" + + def test_data_plane_patch_has_correct_default(self): + """Verify data-plane _patch.py has 2024-12-09-preview as default.""" + patch_file = os.path.join( + os.path.dirname(os.path.dirname(__file__)), + "azure", "confidentialledger", "_patch.py" + ) + + with open(patch_file, 'r', encoding='utf-8') as f: + content = f.read() + + # Check docstring mentions the correct version + assert '"2024-12-09-preview"' in content, \ + "Docstring should mention 2024-12-09-preview" + + # Check code sets the correct default + assert 'api_version = kwargs.pop("api_version", "2024-12-09-preview")' in content, \ + "Code should default to 2024-12-09-preview" + + def test_data_plane_async_patch_has_correct_default(self): + """Verify async data-plane aio/_patch.py has 2024-12-09-preview as default.""" + patch_file = os.path.join( + os.path.dirname(os.path.dirname(__file__)), + "azure", "confidentialledger", "aio", "_patch.py" + ) + + with open(patch_file, 'r', encoding='utf-8') as f: + content = f.read() + + # Check docstring mentions the correct version + assert '"2024-12-09-preview"' in content, \ + "Docstring should mention 2024-12-09-preview" + + # Check code sets the correct default + assert 'api_version = kwargs.pop("api_version", "2024-12-09-preview")' in content, \ + "Code should default to 2024-12-09-preview" + + def test_mgmt_client_docstring_mentions_version(self): + """Verify management client docstring mentions current default version.""" + mgmt_file = os.path.join( + os.path.dirname(os.path.dirname(os.path.dirname(__file__))), + "azure-mgmt-confidentialledger", "azure", "mgmt", "confidentialledger", + "_confidential_ledger.py" + ) + + with open(mgmt_file, 'r', encoding='utf-8') as f: + content = f.read() + + # Check docstring mentions the correct version + assert "2024-09-19-preview" in content, \ + "Docstring should mention 2024-09-19-preview as default" + + # Check it mentions the newer version + assert "2025-06-10-preview" in content, \ + "Docstring should mention 2025-06-10-preview as available" + + def test_mgmt_client_async_docstring_mentions_version(self): + """Verify async management client docstring mentions current default version.""" + mgmt_file = os.path.join( + os.path.dirname(os.path.dirname(os.path.dirname(__file__))), + "azure-mgmt-confidentialledger", "azure", "mgmt", "confidentialledger", + "aio", "_confidential_ledger.py" + ) + + with open(mgmt_file, 'r', encoding='utf-8') as f: + content = f.read() + + # Check docstring mentions the correct version + assert "2024-09-19-preview" in content, \ + "Docstring should mention 2024-09-19-preview as default" + + # Check it mentions the newer version + assert "2025-06-10-preview" in content, \ + "Docstring should mention 2025-06-10-preview as available" + + def test_generated_config_uses_latest_preview(self): + """Verify generated configuration file uses the latest preview version.""" + config_file = os.path.join( + os.path.dirname(os.path.dirname(__file__)), + "azure", "confidentialledger", "_configuration.py" + ) + + with open(config_file, 'r', encoding='utf-8') as f: + content = f.read() + + # Check that generated config uses 2024-12-09-preview + assert '"2024-12-09-preview"' in content, \ + "Generated configuration should use 2024-12-09-preview" diff --git a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_confidential_ledger.py b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_confidential_ledger.py index ad426127888e..d3062ed34db0 100644 --- a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_confidential_ledger.py +++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_confidential_ledger.py @@ -27,7 +27,10 @@ class ConfidentialLedger(ConfidentialLedgerOperationsMixin): - """Microsoft Azure Confidential Compute Ledger Control Plane REST API version 2020-12-01-preview. + """Microsoft Azure Confidential Compute Ledger Control Plane. + + Default REST API version: 2024-09-19-preview. + A newer preview (2025-06-10-preview) is available in published TypeSpec; specify api_version to opt-in. :ivar operations: Operations operations :vartype operations: azure.mgmt.confidentialledger.operations.Operations diff --git a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/aio/_confidential_ledger.py b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/aio/_confidential_ledger.py index 09cfeffbb285..05cb7e5b5d68 100644 --- a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/aio/_confidential_ledger.py +++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/aio/_confidential_ledger.py @@ -27,7 +27,10 @@ class ConfidentialLedger(ConfidentialLedgerOperationsMixin): - """Microsoft Azure Confidential Compute Ledger Control Plane REST API version 2020-12-01-preview. + """Microsoft Azure Confidential Compute Ledger Control Plane. + + Default REST API version: 2024-09-19-preview. + Newer preview (2025-06-10-preview) available; set api_version explicitly to use it. :ivar operations: Operations operations :vartype operations: azure.mgmt.confidentialledger.aio.operations.Operations