From 5a07f2edfa41081957e27cee527ed4a6fcc8f25b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:24:44 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#1020) --- .stats.yml | 2 +- api.md | 2 +- .../zero_trust/gateway/configurations.py | 8 +- .../zero_trust/gateway/lists/lists.py | 20 +---- .../types/zero_trust/gateway/__init__.py | 1 - .../gateway/gateway_configuration_settings.py | 18 +---- .../gateway_configuration_settings_param.py | 20 +---- .../zero_trust/gateway/gateway_item_param.py | 8 +- .../zero_trust/gateway/list_list_params.py | 14 ---- .../types/zero_trust/gateway/rule_setting.py | 17 ++-- .../zero_trust/gateway/rule_setting_param.py | 17 ++-- .../zero_trust/gateway/test_configurations.py | 4 - .../zero_trust/gateway/test_lists.py | 77 +------------------ .../zero_trust/gateway/test_rules.py | 4 - 14 files changed, 29 insertions(+), 183 deletions(-) delete mode 100644 src/cloudflare/types/zero_trust/gateway/list_list_params.py diff --git a/.stats.yml b/.stats.yml index db0943d3d73..d1202adc94a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1348 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-36a9d717773ebb507fd0744af578aa64b697030857c602c77458156a911fcab9.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a4ad69b707d0e14c7a716a22c876ab03c40d8aefa59eec101c5c52260cb860f3.yml diff --git a/api.md b/api.md index b610facf969..9fc32242fc8 100644 --- a/api.md +++ b/api.md @@ -6079,7 +6079,7 @@ Methods: - client.zero_trust.gateway.lists.create(\*, account_id, \*\*params) -> Optional - client.zero_trust.gateway.lists.update(list_id, \*, account_id, \*\*params) -> Optional -- client.zero_trust.gateway.lists.list(\*, account_id, \*\*params) -> SyncSinglePage[GatewayList] +- client.zero_trust.gateway.lists.list(\*, account_id) -> SyncSinglePage[GatewayList] - client.zero_trust.gateway.lists.delete(list_id, \*, account_id) -> Optional - client.zero_trust.gateway.lists.edit(list_id, \*, account_id, \*\*params) -> Optional - client.zero_trust.gateway.lists.get(list_id, \*, account_id) -> Optional diff --git a/src/cloudflare/resources/zero_trust/gateway/configurations.py b/src/cloudflare/resources/zero_trust/gateway/configurations.py index 6f30fdb7210..ce316798e47 100644 --- a/src/cloudflare/resources/zero_trust/gateway/configurations.py +++ b/src/cloudflare/resources/zero_trust/gateway/configurations.py @@ -102,8 +102,8 @@ def edit( This endpoint can update a single subcollection of settings such as `antivirus`, `tls_decrypt`, `activity_log`, `block_page`, `browser_isolation`, `fips`, `body_scanning`, or - `certificate`, without updating the entire configuration object. Returns an - error if any collection of settings is not properly configured. + `custom_certificate`, without updating the entire configuration object. Returns + an error if any collection of settings is not properly configured. Args: settings: account settings. @@ -238,8 +238,8 @@ async def edit( This endpoint can update a single subcollection of settings such as `antivirus`, `tls_decrypt`, `activity_log`, `block_page`, `browser_isolation`, `fips`, `body_scanning`, or - `certificate`, without updating the entire configuration object. Returns an - error if any collection of settings is not properly configured. + `custom_certificate`, without updating the entire configuration object. Returns + an error if any collection of settings is not properly configured. Args: settings: account settings. diff --git a/src/cloudflare/resources/zero_trust/gateway/lists/lists.py b/src/cloudflare/resources/zero_trust/gateway/lists/lists.py index 20f88988e72..0810dafa367 100644 --- a/src/cloudflare/resources/zero_trust/gateway/lists/lists.py +++ b/src/cloudflare/resources/zero_trust/gateway/lists/lists.py @@ -34,7 +34,7 @@ AsyncPaginator, make_request_options, ) -from .....types.zero_trust.gateway import list_edit_params, list_list_params, list_create_params, list_update_params +from .....types.zero_trust.gateway import list_edit_params, list_create_params, list_update_params from .....types.zero_trust.gateway.gateway_list import GatewayList from .....types.zero_trust.gateway.gateway_item_param import GatewayItemParam from .....types.zero_trust.gateway.list_create_response import ListCreateResponse @@ -173,7 +173,6 @@ def list( self, *, account_id: str, - type: Literal["SERIAL", "URL", "DOMAIN", "EMAIL", "IP"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -185,8 +184,6 @@ def list( Fetches all Zero Trust lists for an account. Args: - type: The type of list. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -201,11 +198,7 @@ def list( f"/accounts/{account_id}/gateway/lists", page=SyncSinglePage[GatewayList], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"type": type}, list_list_params.ListListParams), + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), model=GatewayList, ) @@ -485,7 +478,6 @@ def list( self, *, account_id: str, - type: Literal["SERIAL", "URL", "DOMAIN", "EMAIL", "IP"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -497,8 +489,6 @@ def list( Fetches all Zero Trust lists for an account. Args: - type: The type of list. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -513,11 +503,7 @@ def list( f"/accounts/{account_id}/gateway/lists", page=AsyncSinglePage[GatewayList], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"type": type}, list_list_params.ListListParams), + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), model=GatewayList, ) diff --git a/src/cloudflare/types/zero_trust/gateway/__init__.py b/src/cloudflare/types/zero_trust/gateway/__init__.py index c462d3ec6af..c3abd0c2212 100644 --- a/src/cloudflare/types/zero_trust/gateway/__init__.py +++ b/src/cloudflare/types/zero_trust/gateway/__init__.py @@ -19,7 +19,6 @@ from .logging_setting import LoggingSetting as LoggingSetting from .gateway_settings import GatewaySettings as GatewaySettings from .list_edit_params import ListEditParams as ListEditParams -from .list_list_params import ListListParams as ListListParams from .location_network import LocationNetwork as LocationNetwork from .gateway_item_param import GatewayItemParam as GatewayItemParam from .list_create_params import ListCreateParams as ListCreateParams diff --git a/src/cloudflare/types/zero_trust/gateway/gateway_configuration_settings.py b/src/cloudflare/types/zero_trust/gateway/gateway_configuration_settings.py index 5504ecf870a..13705c996f6 100644 --- a/src/cloudflare/types/zero_trust/gateway/gateway_configuration_settings.py +++ b/src/cloudflare/types/zero_trust/gateway/gateway_configuration_settings.py @@ -14,12 +14,7 @@ from .browser_isolation_settings import BrowserIsolationSettings from .custom_certificate_settings import CustomCertificateSettings -__all__ = ["GatewayConfigurationSettings", "Certificate"] - - -class Certificate(BaseModel): - id: str - """UUID of certificate to be used for interception.""" +__all__ = ["GatewayConfigurationSettings"] class GatewayConfigurationSettings(BaseModel): @@ -38,17 +33,8 @@ class GatewayConfigurationSettings(BaseModel): browser_isolation: Optional[BrowserIsolationSettings] = None """Browser isolation settings.""" - certificate: Optional[Certificate] = None - """Certificate settings for Gateway TLS interception. - - If not specified, the Cloudflare Root CA will be used. - """ - custom_certificate: Optional[CustomCertificateSettings] = None - """Custom certificate settings for BYO-PKI. - - (deprecated and replaced by `certificate`) - """ + """Custom certificate settings for BYO-PKI.""" extended_email_matching: Optional[ExtendedEmailMatching] = None """Extended e-mail matching settings.""" diff --git a/src/cloudflare/types/zero_trust/gateway/gateway_configuration_settings_param.py b/src/cloudflare/types/zero_trust/gateway/gateway_configuration_settings_param.py index 11cea789954..8b0b1443581 100644 --- a/src/cloudflare/types/zero_trust/gateway/gateway_configuration_settings_param.py +++ b/src/cloudflare/types/zero_trust/gateway/gateway_configuration_settings_param.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing_extensions import TypedDict from .tls_settings_param import TLSSettingsParam from .fips_settings_param import FipsSettingsParam @@ -15,12 +15,7 @@ from .browser_isolation_settings_param import BrowserIsolationSettingsParam from .custom_certificate_settings_param import CustomCertificateSettingsParam -__all__ = ["GatewayConfigurationSettingsParam", "Certificate"] - - -class Certificate(TypedDict, total=False): - id: Required[str] - """UUID of certificate to be used for interception.""" +__all__ = ["GatewayConfigurationSettingsParam"] class GatewayConfigurationSettingsParam(TypedDict, total=False): @@ -39,17 +34,8 @@ class GatewayConfigurationSettingsParam(TypedDict, total=False): browser_isolation: BrowserIsolationSettingsParam """Browser isolation settings.""" - certificate: Certificate - """Certificate settings for Gateway TLS interception. - - If not specified, the Cloudflare Root CA will be used. - """ - custom_certificate: CustomCertificateSettingsParam - """Custom certificate settings for BYO-PKI. - - (deprecated and replaced by `certificate`) - """ + """Custom certificate settings for BYO-PKI.""" extended_email_matching: ExtendedEmailMatchingParam """Extended e-mail matching settings.""" diff --git a/src/cloudflare/types/zero_trust/gateway/gateway_item_param.py b/src/cloudflare/types/zero_trust/gateway/gateway_item_param.py index 819b853caa8..5b5d081859d 100644 --- a/src/cloudflare/types/zero_trust/gateway/gateway_item_param.py +++ b/src/cloudflare/types/zero_trust/gateway/gateway_item_param.py @@ -2,17 +2,11 @@ from __future__ import annotations -from typing import Union -from datetime import datetime -from typing_extensions import Annotated, TypedDict - -from ...._utils import PropertyInfo +from typing_extensions import TypedDict __all__ = ["GatewayItemParam"] class GatewayItemParam(TypedDict, total=False): - created_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - value: str """The value of the item in a list.""" diff --git a/src/cloudflare/types/zero_trust/gateway/list_list_params.py b/src/cloudflare/types/zero_trust/gateway/list_list_params.py deleted file mode 100644 index 30c9d6123e6..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/list_list_params.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["ListListParams"] - - -class ListListParams(TypedDict, total=False): - account_id: Required[str] - - type: Literal["SERIAL", "URL", "DOMAIN", "EMAIL", "IP"] - """The type of list.""" diff --git a/src/cloudflare/types/zero_trust/gateway/rule_setting.py b/src/cloudflare/types/zero_trust/gateway/rule_setting.py index 1e87ca2204e..9af12528729 100644 --- a/src/cloudflare/types/zero_trust/gateway/rule_setting.py +++ b/src/cloudflare/types/zero_trust/gateway/rule_setting.py @@ -28,19 +28,19 @@ class AuditSSH(BaseModel): class BisoAdminControls(BaseModel): dcp: Optional[bool] = None - """Set to false to enable copy-pasting.""" + """Set to true to enable copy-pasting.""" dd: Optional[bool] = None - """Set to false to enable downloading.""" + """Set to true to enable downloading.""" dk: Optional[bool] = None - """Set to false to enable keyboard usage.""" + """Set to true to enable keyboard usage.""" dp: Optional[bool] = None - """Set to false to enable printing.""" + """Set to true to enable printing.""" du: Optional[bool] = None - """Set to false to enable uploading.""" + """Set to true to enable uploading.""" class CheckSession(BaseModel): @@ -153,13 +153,6 @@ class RuleSetting(BaseModel): it to indicate local egress via WARP IPs. """ - ignore_cname_category_matches: Optional[bool] = None - """Set to true, to ignore the category matches at CNAME domains in a response. - - If unchecked, the categories in this rule will be checked against all the CNAME - domain categories in a response. - """ - insecure_disable_dnssec_validation: Optional[bool] = None """INSECURE - disable DNSSEC validation (for Allow actions).""" diff --git a/src/cloudflare/types/zero_trust/gateway/rule_setting_param.py b/src/cloudflare/types/zero_trust/gateway/rule_setting_param.py index 0992e550137..62fe1523f29 100644 --- a/src/cloudflare/types/zero_trust/gateway/rule_setting_param.py +++ b/src/cloudflare/types/zero_trust/gateway/rule_setting_param.py @@ -29,19 +29,19 @@ class AuditSSH(TypedDict, total=False): class BisoAdminControls(TypedDict, total=False): dcp: bool - """Set to false to enable copy-pasting.""" + """Set to true to enable copy-pasting.""" dd: bool - """Set to false to enable downloading.""" + """Set to true to enable downloading.""" dk: bool - """Set to false to enable keyboard usage.""" + """Set to true to enable keyboard usage.""" dp: bool - """Set to false to enable printing.""" + """Set to true to enable printing.""" du: bool - """Set to false to enable uploading.""" + """Set to true to enable uploading.""" class CheckSession(TypedDict, total=False): @@ -154,13 +154,6 @@ class RuleSettingParam(TypedDict, total=False): it to indicate local egress via WARP IPs. """ - ignore_cname_category_matches: bool - """Set to true, to ignore the category matches at CNAME domains in a response. - - If unchecked, the categories in this rule will be checked against all the CNAME - domain categories in a response. - """ - insecure_disable_dnssec_validation: bool """INSECURE - disable DNSSEC validation (for Allow actions).""" diff --git a/tests/api_resources/zero_trust/gateway/test_configurations.py b/tests/api_resources/zero_trust/gateway/test_configurations.py index 795445ac228..62f30e964a0 100644 --- a/tests/api_resources/zero_trust/gateway/test_configurations.py +++ b/tests/api_resources/zero_trust/gateway/test_configurations.py @@ -60,7 +60,6 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "non_identity_enabled": True, "url_browser_isolation_enabled": True, }, - "certificate": {"id": "d1b364c5-1311-466e-a194-f0e943e0799f"}, "custom_certificate": { "enabled": True, "id": "d1b364c5-1311-466e-a194-f0e943e0799f", @@ -143,7 +142,6 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "non_identity_enabled": True, "url_browser_isolation_enabled": True, }, - "certificate": {"id": "d1b364c5-1311-466e-a194-f0e943e0799f"}, "custom_certificate": { "enabled": True, "id": "d1b364c5-1311-466e-a194-f0e943e0799f", @@ -268,7 +266,6 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "non_identity_enabled": True, "url_browser_isolation_enabled": True, }, - "certificate": {"id": "d1b364c5-1311-466e-a194-f0e943e0799f"}, "custom_certificate": { "enabled": True, "id": "d1b364c5-1311-466e-a194-f0e943e0799f", @@ -351,7 +348,6 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "non_identity_enabled": True, "url_browser_isolation_enabled": True, }, - "certificate": {"id": "d1b364c5-1311-466e-a194-f0e943e0799f"}, "custom_certificate": { "enabled": True, "id": "d1b364c5-1311-466e-a194-f0e943e0799f", diff --git a/tests/api_resources/zero_trust/gateway/test_lists.py b/tests/api_resources/zero_trust/gateway/test_lists.py index d7fdc097741..cfd4e978d0f 100644 --- a/tests/api_resources/zero_trust/gateway/test_lists.py +++ b/tests/api_resources/zero_trust/gateway/test_lists.py @@ -9,7 +9,6 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.gateway import ( GatewayList, @@ -39,20 +38,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: name="Admin Serial Numbers", type="SERIAL", description="The serial numbers for administrators", - items=[ - { - "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), - "value": "8GE8721REF", - }, - { - "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), - "value": "8GE8721REF", - }, - { - "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), - "value": "8GE8721REF", - }, - ], + items=[{"value": "8GE8721REF"}, {"value": "8GE8721REF"}, {"value": "8GE8721REF"}], ) assert_matches_type(Optional[ListCreateResponse], list_, path=["response"]) @@ -163,14 +149,6 @@ def test_method_list(self, client: Cloudflare) -> None: ) assert_matches_type(SyncSinglePage[GatewayList], list_, path=["response"]) - @parametrize - def test_method_list_with_all_params(self, client: Cloudflare) -> None: - list_ = client.zero_trust.gateway.lists.list( - account_id="699d98642c564d2e855e9661899b7252", - type="SERIAL", - ) - assert_matches_type(SyncSinglePage[GatewayList], list_, path=["response"]) - @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.zero_trust.gateway.lists.with_raw_response.list( @@ -263,20 +241,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: list_ = client.zero_trust.gateway.lists.edit( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", - append=[ - { - "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), - "value": "8GE8721REF", - }, - { - "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), - "value": "8GE8721REF", - }, - { - "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), - "value": "8GE8721REF", - }, - ], + append=[{"value": "8GE8721REF"}, {"value": "8GE8721REF"}, {"value": "8GE8721REF"}], remove=["8GE8721REF", "8GE8721REF", "8GE8721REF"], ) assert_matches_type(Optional[GatewayList], list_, path=["response"]) @@ -389,20 +354,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare name="Admin Serial Numbers", type="SERIAL", description="The serial numbers for administrators", - items=[ - { - "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), - "value": "8GE8721REF", - }, - { - "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), - "value": "8GE8721REF", - }, - { - "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), - "value": "8GE8721REF", - }, - ], + items=[{"value": "8GE8721REF"}, {"value": "8GE8721REF"}, {"value": "8GE8721REF"}], ) assert_matches_type(Optional[ListCreateResponse], list_, path=["response"]) @@ -513,14 +465,6 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: ) assert_matches_type(AsyncSinglePage[GatewayList], list_, path=["response"]) - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: - list_ = await async_client.zero_trust.gateway.lists.list( - account_id="699d98642c564d2e855e9661899b7252", - type="SERIAL", - ) - assert_matches_type(AsyncSinglePage[GatewayList], list_, path=["response"]) - @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.gateway.lists.with_raw_response.list( @@ -613,20 +557,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) list_ = await async_client.zero_trust.gateway.lists.edit( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", - append=[ - { - "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), - "value": "8GE8721REF", - }, - { - "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), - "value": "8GE8721REF", - }, - { - "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), - "value": "8GE8721REF", - }, - ], + append=[{"value": "8GE8721REF"}, {"value": "8GE8721REF"}, {"value": "8GE8721REF"}], remove=["8GE8721REF", "8GE8721REF", "8GE8721REF"], ) assert_matches_type(Optional[GatewayList], list_, path=["response"]) diff --git a/tests/api_resources/zero_trust/gateway/test_rules.py b/tests/api_resources/zero_trust/gateway/test_rules.py index 924ce1fa37b..b83694ffb9f 100644 --- a/tests/api_resources/zero_trust/gateway/test_rules.py +++ b/tests/api_resources/zero_trust/gateway/test_rules.py @@ -110,7 +110,6 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: "ipv4_fallback": "192.0.2.3", "ipv6": "2001:DB8::/64", }, - "ignore_cname_category_matches": True, "insecure_disable_dnssec_validation": False, "ip_categories": True, "ip_indicator_feeds": True, @@ -271,7 +270,6 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "ipv4_fallback": "192.0.2.3", "ipv6": "2001:DB8::/64", }, - "ignore_cname_category_matches": True, "insecure_disable_dnssec_validation": False, "ip_categories": True, "ip_indicator_feeds": True, @@ -579,7 +577,6 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare "ipv4_fallback": "192.0.2.3", "ipv6": "2001:DB8::/64", }, - "ignore_cname_category_matches": True, "insecure_disable_dnssec_validation": False, "ip_categories": True, "ip_indicator_feeds": True, @@ -740,7 +737,6 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "ipv4_fallback": "192.0.2.3", "ipv6": "2001:DB8::/64", }, - "ignore_cname_category_matches": True, "insecure_disable_dnssec_validation": False, "ip_categories": True, "ip_indicator_feeds": True,