Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#1021)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Jun 18, 2024
1 parent 5a07f2e commit 4f9c809
Show file tree
Hide file tree
Showing 14 changed files with 183 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1348
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a4ad69b707d0e14c7a716a22c876ab03c40d8aefa59eec101c5c52260cb860f3.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-db421d07d58c7abf1af471a342e12789def4e83543dccea6aec34b8667646028.yml
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
8 changes: 4 additions & 4 deletions src/cloudflare/resources/zero_trust/gateway/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
`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.
Expand Down Expand Up @@ -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
`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.
Expand Down
20 changes: 17 additions & 3 deletions src/cloudflare/resources/zero_trust/gateway/lists/lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
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
Expand Down Expand Up @@ -173,6 +173,7 @@ 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,
Expand All @@ -184,6 +185,8 @@ 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
Expand All @@ -198,7 +201,11 @@ 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
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,
)
Expand Down Expand Up @@ -478,6 +485,7 @@ 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,
Expand All @@ -489,6 +497,8 @@ 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
Expand All @@ -503,7 +513,11 @@ 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
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,
)
Expand Down
1 change: 1 addition & 0 deletions src/cloudflare/types/zero_trust/gateway/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
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):
Expand All @@ -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."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -15,7 +15,12 @@
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):
Expand All @@ -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."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
14 changes: 14 additions & 0 deletions src/cloudflare/types/zero_trust/gateway/list_list_params.py
Original file line number Diff line number Diff line change
@@ -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."""
17 changes: 12 additions & 5 deletions src/cloudflare/types/zero_trust/gateway/rule_setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)."""

Expand Down
17 changes: 12 additions & 5 deletions src/cloudflare/types/zero_trust/gateway/rule_setting_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)."""

Expand Down
4 changes: 4 additions & 0 deletions tests/api_resources/zero_trust/gateway/test_configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ 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",
Expand Down Expand Up @@ -142,6 +143,7 @@ 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",
Expand Down Expand Up @@ -266,6 +268,7 @@ 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",
Expand Down Expand Up @@ -348,6 +351,7 @@ 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",
Expand Down
Loading

0 comments on commit 4f9c809

Please sign in to comment.