diff --git a/api.md b/api.md index d6ee0dc3377c..a3e4ab3ea2c0 100644 --- a/api.md +++ b/api.md @@ -1535,13 +1535,17 @@ Methods: Types: ```python -from cloudflare.types.certificate_authorities import TLSHostnameAssociation +from cloudflare.types.certificate_authorities import ( + TLSHostnameAssociation, + HostnameAssociationUpdateResponse, + HostnameAssociationGetResponse, +) ``` Methods: -- client.certificate_authorities.hostname_associations.update(\*, zone_id, \*\*params) -> TLSHostnameAssociation -- client.certificate_authorities.hostname_associations.get(\*, zone_id, \*\*params) -> TLSHostnameAssociation +- client.certificate_authorities.hostname_associations.update(\*, zone_id, \*\*params) -> HostnameAssociationUpdateResponse +- client.certificate_authorities.hostname_associations.get(\*, zone_id, \*\*params) -> HostnameAssociationGetResponse # ClientCertificates diff --git a/src/cloudflare/resources/certificate_authorities/hostname_associations.py b/src/cloudflare/resources/certificate_authorities/hostname_associations.py index 87331116d125..3a57d819bf02 100644 --- a/src/cloudflare/resources/certificate_authorities/hostname_associations.py +++ b/src/cloudflare/resources/certificate_authorities/hostname_associations.py @@ -24,7 +24,8 @@ make_request_options, ) from ...types.certificate_authorities import ( - TLSHostnameAssociation, + HostnameAssociationGetResponse, + HostnameAssociationUpdateResponse, hostname_association_get_params, hostname_association_update_params, ) @@ -53,7 +54,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TLSHostnameAssociation: + ) -> HostnameAssociationUpdateResponse: """ Replace Hostname Associations @@ -90,7 +91,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]), + cast_to=cast(Type[HostnameAssociationUpdateResponse], ResultWrapper[HostnameAssociationUpdateResponse]), ) def get( @@ -104,7 +105,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TLSHostnameAssociation: + ) -> HostnameAssociationGetResponse: """ List Hostname Associations @@ -138,7 +139,7 @@ def get( ), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]), + cast_to=cast(Type[HostnameAssociationGetResponse], ResultWrapper[HostnameAssociationGetResponse]), ) @@ -163,7 +164,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TLSHostnameAssociation: + ) -> HostnameAssociationUpdateResponse: """ Replace Hostname Associations @@ -200,7 +201,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]), + cast_to=cast(Type[HostnameAssociationUpdateResponse], ResultWrapper[HostnameAssociationUpdateResponse]), ) async def get( @@ -214,7 +215,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TLSHostnameAssociation: + ) -> HostnameAssociationGetResponse: """ List Hostname Associations @@ -248,7 +249,7 @@ async def get( ), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[TLSHostnameAssociation], ResultWrapper[TLSHostnameAssociation]), + cast_to=cast(Type[HostnameAssociationGetResponse], ResultWrapper[HostnameAssociationGetResponse]), ) diff --git a/src/cloudflare/types/certificate_authorities/__init__.py b/src/cloudflare/types/certificate_authorities/__init__.py index 9f248f2ad9b6..8136d1b91d44 100644 --- a/src/cloudflare/types/certificate_authorities/__init__.py +++ b/src/cloudflare/types/certificate_authorities/__init__.py @@ -2,6 +2,7 @@ from __future__ import annotations -from .tls_hostname_association import TLSHostnameAssociation as TLSHostnameAssociation from .hostname_association_get_params import HostnameAssociationGetParams as HostnameAssociationGetParams +from .hostname_association_get_response import HostnameAssociationGetResponse as HostnameAssociationGetResponse from .hostname_association_update_params import HostnameAssociationUpdateParams as HostnameAssociationUpdateParams +from .hostname_association_update_response import HostnameAssociationUpdateResponse as HostnameAssociationUpdateResponse diff --git a/src/cloudflare/types/certificate_authorities/hostname_association_get_response.py b/src/cloudflare/types/certificate_authorities/hostname_association_get_response.py new file mode 100644 index 000000000000..6eeccbfc43c0 --- /dev/null +++ b/src/cloudflare/types/certificate_authorities/hostname_association_get_response.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["HostnameAssociationGetResponse"] + + +class HostnameAssociationGetResponse(BaseModel): + hostnames: Optional[List[str]] = None diff --git a/src/cloudflare/types/certificate_authorities/hostname_association_update_response.py b/src/cloudflare/types/certificate_authorities/hostname_association_update_response.py new file mode 100644 index 000000000000..8d4318ab148d --- /dev/null +++ b/src/cloudflare/types/certificate_authorities/hostname_association_update_response.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["HostnameAssociationUpdateResponse"] + + +class HostnameAssociationUpdateResponse(BaseModel): + hostnames: Optional[List[str]] = None diff --git a/src/cloudflare/types/certificate_authorities/tls_hostname_association.py b/src/cloudflare/types/certificate_authorities/tls_hostname_association.py deleted file mode 100644 index ab1a832cb65f..000000000000 --- a/src/cloudflare/types/certificate_authorities/tls_hostname_association.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["TLSHostnameAssociation"] - - -class TLSHostnameAssociation(BaseModel): - hostnames: Optional[List[str]] = None - - mtls_certificate_id: Optional[str] = None - """ - The UUID for a certificate that was uploaded to the mTLS Certificate Management - endpoint. If no mtls_certificate_id is given, the hostnames will be associated - to your active Cloudflare Managed CA. - """ diff --git a/tests/api_resources/certificate_authorities/test_hostname_associations.py b/tests/api_resources/certificate_authorities/test_hostname_associations.py index 58ba5b381061..bd14519e2c57 100644 --- a/tests/api_resources/certificate_authorities/test_hostname_associations.py +++ b/tests/api_resources/certificate_authorities/test_hostname_associations.py @@ -10,7 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.types.certificate_authorities import ( - TLSHostnameAssociation, + HostnameAssociationGetResponse, + HostnameAssociationUpdateResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +26,7 @@ def test_method_update(self, client: Cloudflare) -> None: hostname_association = client.certificate_authorities.hostname_associations.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +36,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: hostnames=["api.example.com", "api.example.com", "api.example.com"], mtls_certificate_id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +48,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname_association = response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -59,7 +60,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname_association = response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) assert cast(Any, response.is_closed) is True @@ -77,7 +78,7 @@ def test_method_get(self, client: Cloudflare) -> None: hostname_association = client.certificate_authorities.hostname_associations.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -86,7 +87,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", mtls_certificate_id="b2134436-2555-4acf-be5b-26c48136575e", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -98,7 +99,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname_association = response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -110,7 +111,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname_association = response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) assert cast(Any, response.is_closed) is True @@ -132,7 +133,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: hostname_association = await async_client.certificate_authorities.hostname_associations.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +143,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare hostnames=["api.example.com", "api.example.com", "api.example.com"], mtls_certificate_id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -154,7 +155,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname_association = await response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -166,7 +167,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname_association = await response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationUpdateResponse, hostname_association, path=["response"]) assert cast(Any, response.is_closed) is True @@ -184,7 +185,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: hostname_association = await async_client.certificate_authorities.hostname_associations.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +194,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - zone_id="023e105f4ecef8ad9ca31a8372d0c353", mtls_certificate_id="b2134436-2555-4acf-be5b-26c48136575e", ) - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -205,7 +206,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname_association = await response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) @pytest.mark.skip() @parametrize @@ -217,7 +218,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname_association = await response.parse() - assert_matches_type(TLSHostnameAssociation, hostname_association, path=["response"]) + assert_matches_type(HostnameAssociationGetResponse, hostname_association, path=["response"]) assert cast(Any, response.is_closed) is True