feat(api): OpenAPI spec update via Stainless API (#1019)

This commit is contained in:
stainless-app[bot] 2024-06-18 14:22:09 +00:00 committed by stainless-bot
parent 038c47e763
commit 9367d593ce
14 changed files with 183 additions and 29 deletions

View file

@ -1,2 +1,2 @@
configured_endpoints: 1348
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-4dcc737ab91fdd1e0edc18214494d806b12d41df4d4641e26e718c8b9dced1dc.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-36a9d717773ebb507fd0744af578aa64b697030857c602c77458156a911fcab9.yml

2
api.md
View file

@ -6079,7 +6079,7 @@ Methods:
- <code title="post /accounts/{account_id}/gateway/lists">client.zero_trust.gateway.lists.<a href="./src/cloudflare/resources/zero_trust/gateway/lists/lists.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/gateway/list_create_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/gateway/list_create_response.py">Optional</a></code>
- <code title="put /accounts/{account_id}/gateway/lists/{list_id}">client.zero_trust.gateway.lists.<a href="./src/cloudflare/resources/zero_trust/gateway/lists/lists.py">update</a>(list_id, \*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/gateway/list_update_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/gateway/gateway_list.py">Optional</a></code>
- <code title="get /accounts/{account_id}/gateway/lists">client.zero_trust.gateway.lists.<a href="./src/cloudflare/resources/zero_trust/gateway/lists/lists.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/gateway_list.py">SyncSinglePage[GatewayList]</a></code>
- <code title="get /accounts/{account_id}/gateway/lists">client.zero_trust.gateway.lists.<a href="./src/cloudflare/resources/zero_trust/gateway/lists/lists.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/gateway/list_list_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/gateway/gateway_list.py">SyncSinglePage[GatewayList]</a></code>
- <code title="delete /accounts/{account_id}/gateway/lists/{list_id}">client.zero_trust.gateway.lists.<a href="./src/cloudflare/resources/zero_trust/gateway/lists/lists.py">delete</a>(list_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/list_delete_response.py">Optional</a></code>
- <code title="patch /accounts/{account_id}/gateway/lists/{list_id}">client.zero_trust.gateway.lists.<a href="./src/cloudflare/resources/zero_trust/gateway/lists/lists.py">edit</a>(list_id, \*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/gateway/list_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/gateway/gateway_list.py">Optional</a></code>
- <code title="get /accounts/{account_id}/gateway/lists/{list_id}">client.zero_trust.gateway.lists.<a href="./src/cloudflare/resources/zero_trust/gateway/lists/lists.py">get</a>(list_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/gateway_list.py">Optional</a></code>

View file

@ -102,8 +102,8 @@ class ConfigurationsResource(SyncAPIResource):
This endpoint can update a
single subcollection of settings such as `antivirus`, `tls_decrypt`,
`activity_log`, `block_page`, `browser_isolation`, `fips`, `body_scanning`, or
`custom_certificate`, without updating the entire configuration object. Returns
an error if any collection of settings is not properly configured.
`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 @@ class AsyncConfigurationsResource(AsyncAPIResource):
This endpoint can update a
single subcollection of settings such as `antivirus`, `tls_decrypt`,
`activity_log`, `block_page`, `browser_isolation`, `fips`, `body_scanning`, or
`custom_certificate`, without updating the entire configuration object. Returns
an error if any collection of settings is not properly configured.
`certificate`, without updating the entire configuration object. Returns an
error if any collection of settings is not properly configured.
Args:
settings: account settings.

View file

@ -34,7 +34,7 @@ from ....._base_client import (
AsyncPaginator,
make_request_options,
)
from .....types.zero_trust.gateway import list_edit_params, list_create_params, list_update_params
from .....types.zero_trust.gateway import list_edit_params, list_list_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,6 +173,7 @@ class ListsResource(SyncAPIResource):
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,
@ -184,6 +185,8 @@ class ListsResource(SyncAPIResource):
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
@ -198,7 +201,11 @@ class ListsResource(SyncAPIResource):
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
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform({"type": type}, list_list_params.ListListParams),
),
model=GatewayList,
)
@ -478,6 +485,7 @@ class AsyncListsResource(AsyncAPIResource):
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,
@ -489,6 +497,8 @@ class AsyncListsResource(AsyncAPIResource):
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
@ -503,7 +513,11 @@ class AsyncListsResource(AsyncAPIResource):
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
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform({"type": type}, list_list_params.ListListParams),
),
model=GatewayList,
)

View file

@ -19,6 +19,7 @@ from .schedule_param import ScheduleParam as ScheduleParam
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

View file

@ -14,7 +14,12 @@ from .extended_email_matching import ExtendedEmailMatching
from .browser_isolation_settings import BrowserIsolationSettings
from .custom_certificate_settings import CustomCertificateSettings
__all__ = ["GatewayConfigurationSettings"]
__all__ = ["GatewayConfigurationSettings", "Certificate"]
class Certificate(BaseModel):
id: str
"""UUID of certificate to be used for interception."""
class GatewayConfigurationSettings(BaseModel):
@ -33,8 +38,17 @@ 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."""
"""Custom certificate settings for BYO-PKI.
(deprecated and replaced by `certificate`)
"""
extended_email_matching: Optional[ExtendedEmailMatching] = None
"""Extended e-mail matching settings."""

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from typing_extensions import TypedDict
from typing_extensions import Required, TypedDict
from .tls_settings_param import TLSSettingsParam
from .fips_settings_param import FipsSettingsParam
@ -15,7 +15,12 @@ from .extended_email_matching_param import ExtendedEmailMatchingParam
from .browser_isolation_settings_param import BrowserIsolationSettingsParam
from .custom_certificate_settings_param import CustomCertificateSettingsParam
__all__ = ["GatewayConfigurationSettingsParam"]
__all__ = ["GatewayConfigurationSettingsParam", "Certificate"]
class Certificate(TypedDict, total=False):
id: Required[str]
"""UUID of certificate to be used for interception."""
class GatewayConfigurationSettingsParam(TypedDict, total=False):
@ -34,8 +39,17 @@ 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."""
"""Custom certificate settings for BYO-PKI.
(deprecated and replaced by `certificate`)
"""
extended_email_matching: ExtendedEmailMatchingParam
"""Extended e-mail matching settings."""

View file

@ -2,11 +2,17 @@
from __future__ import annotations
from typing_extensions import TypedDict
from typing import Union
from datetime import datetime
from typing_extensions import Annotated, TypedDict
from ...._utils import PropertyInfo
__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."""

View file

@ -0,0 +1,14 @@
# 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."""

View file

@ -28,19 +28,19 @@ class AuditSSH(BaseModel):
class BisoAdminControls(BaseModel):
dcp: Optional[bool] = None
"""Set to true to enable copy-pasting."""
"""Set to false to enable copy-pasting."""
dd: Optional[bool] = None
"""Set to true to enable downloading."""
"""Set to false to enable downloading."""
dk: Optional[bool] = None
"""Set to true to enable keyboard usage."""
"""Set to false to enable keyboard usage."""
dp: Optional[bool] = None
"""Set to true to enable printing."""
"""Set to false to enable printing."""
du: Optional[bool] = None
"""Set to true to enable uploading."""
"""Set to false to enable uploading."""
class CheckSession(BaseModel):
@ -153,6 +153,13 @@ 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)."""

View file

@ -29,19 +29,19 @@ class AuditSSH(TypedDict, total=False):
class BisoAdminControls(TypedDict, total=False):
dcp: bool
"""Set to true to enable copy-pasting."""
"""Set to false to enable copy-pasting."""
dd: bool
"""Set to true to enable downloading."""
"""Set to false to enable downloading."""
dk: bool
"""Set to true to enable keyboard usage."""
"""Set to false to enable keyboard usage."""
dp: bool
"""Set to true to enable printing."""
"""Set to false to enable printing."""
du: bool
"""Set to true to enable uploading."""
"""Set to false to enable uploading."""
class CheckSession(TypedDict, total=False):
@ -154,6 +154,13 @@ 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)."""

View file

@ -60,6 +60,7 @@ class TestConfigurations:
"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",
@ -142,6 +143,7 @@ class TestConfigurations:
"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",
@ -266,6 +268,7 @@ class TestAsyncConfigurations:
"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",
@ -348,6 +351,7 @@ class TestAsyncConfigurations:
"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",

View file

@ -9,6 +9,7 @@ import pytest
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,
@ -38,7 +39,20 @@ class TestLists:
name="Admin Serial Numbers",
type="SERIAL",
description="The serial numbers for administrators",
items=[{"value": "8GE8721REF"}, {"value": "8GE8721REF"}, {"value": "8GE8721REF"}],
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",
},
],
)
assert_matches_type(Optional[ListCreateResponse], list_, path=["response"])
@ -149,6 +163,14 @@ class TestLists:
)
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(
@ -241,7 +263,20 @@ class TestLists:
list_ = client.zero_trust.gateway.lists.edit(
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
account_id="699d98642c564d2e855e9661899b7252",
append=[{"value": "8GE8721REF"}, {"value": "8GE8721REF"}, {"value": "8GE8721REF"}],
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",
},
],
remove=["8GE8721REF", "8GE8721REF", "8GE8721REF"],
)
assert_matches_type(Optional[GatewayList], list_, path=["response"])
@ -354,7 +389,20 @@ class TestAsyncLists:
name="Admin Serial Numbers",
type="SERIAL",
description="The serial numbers for administrators",
items=[{"value": "8GE8721REF"}, {"value": "8GE8721REF"}, {"value": "8GE8721REF"}],
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",
},
],
)
assert_matches_type(Optional[ListCreateResponse], list_, path=["response"])
@ -465,6 +513,14 @@ class TestAsyncLists:
)
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(
@ -557,7 +613,20 @@ class TestAsyncLists:
list_ = await async_client.zero_trust.gateway.lists.edit(
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
account_id="699d98642c564d2e855e9661899b7252",
append=[{"value": "8GE8721REF"}, {"value": "8GE8721REF"}, {"value": "8GE8721REF"}],
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",
},
],
remove=["8GE8721REF", "8GE8721REF", "8GE8721REF"],
)
assert_matches_type(Optional[GatewayList], list_, path=["response"])

View file

@ -110,6 +110,7 @@ class TestRules:
"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,
@ -270,6 +271,7 @@ class TestRules:
"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,
@ -577,6 +579,7 @@ class TestAsyncRules:
"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,
@ -737,6 +740,7 @@ class TestAsyncRules:
"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,