Skip to content

Commit

Permalink
feat(api): api update (#2132)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Nov 8, 2024
1 parent e077e34 commit f0898d4
Show file tree
Hide file tree
Showing 14 changed files with 131 additions and 21 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: 1397
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cedc346a76dfdf50768c01a48e573dfaeddfe35be8910188d42fe3c5afaaa5bb.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1504fe697d2d7335627a605468544df46a79e9a8b355f91527556e6d25cf0f7a.yml
4 changes: 2 additions & 2 deletions src/cloudflare/resources/workers/scripts/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def edit(
logpush: Whether Logpush is turned on for the Worker.
observability: Observability settings for the Worker
observability: Observability settings for the Worker.
tail_consumers: List of Workers that will consume logs from the attached Worker.
Expand Down Expand Up @@ -205,7 +205,7 @@ async def edit(
logpush: Whether Logpush is turned on for the Worker.
observability: Observability settings for the Worker
observability: Observability settings for the Worker.
tail_consumers: List of Workers that will consume logs from the attached Worker.
Expand Down
6 changes: 6 additions & 0 deletions src/cloudflare/types/workers/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ class Script(BaseModel):
etag: Optional[str] = None
"""Hashed script content, can be used in a If-None-Match header when updating."""

has_assets: Optional[bool] = None
"""Whether a Worker contains assets."""

has_modules: Optional[bool] = None
"""Whether a Worker contains modules."""

logpush: Optional[bool] = None
"""Whether Logpush is turned on for the Worker."""

Expand Down
4 changes: 2 additions & 2 deletions src/cloudflare/types/workers/script_setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class Observability(BaseModel):
enabled: bool
"""Whether observability is enabled for the Worker"""
"""Whether observability is enabled for the Worker."""

head_sampling_rate: Optional[float] = None
"""The sampling rate for incoming requests.
Expand All @@ -24,7 +24,7 @@ class ScriptSetting(BaseModel):
"""Whether Logpush is turned on for the Worker."""

observability: Optional[Observability] = None
"""Observability settings for the Worker"""
"""Observability settings for the Worker."""

tail_consumers: Optional[List[ConsumerScript]] = None
"""List of Workers that will consume logs from the attached Worker."""
38 changes: 34 additions & 4 deletions src/cloudflare/types/workers/script_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"ScriptUpdateParams",
"Variant0",
"Variant0Metadata",
"Variant0MetadataAssets",
"Variant0MetadataAssetsConfig",
"Variant0MetadataBinding",
"Variant0MetadataMigrations",
"Variant0MetadataObservability",
Expand Down Expand Up @@ -48,6 +50,25 @@ class Variant0(TypedDict, total=False):
"""JSON encoded metadata about the uploaded parts and Worker configuration."""


class Variant0MetadataAssetsConfig(TypedDict, total=False):
html_handling: Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]
"""Determines the redirects and rewrites of requests for HTML content."""

not_found_handling: Literal["none", "404-page", "single-page-application"]
"""
Determines the response when a request does not match a static asset, and there
is no Worker script.
"""


class Variant0MetadataAssets(TypedDict, total=False):
config: Variant0MetadataAssetsConfig
"""Configuration for assets within a Worker."""

jwt: str
"""Token provided upon successful upload of all files from a registered manifest."""


class Variant0MetadataBindingTyped(TypedDict, total=False):
name: str
"""Name of the binding variable."""
Expand All @@ -67,7 +88,7 @@ class Variant0MetadataBindingTyped(TypedDict, total=False):

class Variant0MetadataObservability(TypedDict, total=False):
enabled: Required[bool]
"""Whether observability is enabled for the Worker"""
"""Whether observability is enabled for the Worker."""

head_sampling_rate: Optional[float]
"""The sampling rate for incoming requests.
Expand All @@ -77,6 +98,9 @@ class Variant0MetadataObservability(TypedDict, total=False):


class Variant0Metadata(TypedDict, total=False):
assets: Variant0MetadataAssets
"""Configuration for assets within a Worker"""

bindings: Iterable[Variant0MetadataBinding]
"""List of bindings available to the worker."""

Expand All @@ -101,6 +125,12 @@ class Variant0Metadata(TypedDict, total=False):
included in a `compatibility_date`.
"""

keep_assets: bool
"""
Retain assets which exist for a previously uploaded Worker version; used in lieu
of providing a completion token.
"""

keep_bindings: List[str]
"""List of binding types to keep from previous_upload."""

Expand All @@ -117,12 +147,12 @@ class Variant0Metadata(TypedDict, total=False):
"""Migrations to apply for Durable Objects associated with this Worker."""

observability: Variant0MetadataObservability
"""Observability settings for the Worker"""
"""Observability settings for the Worker."""

placement: PlacementConfigurationParam

tags: List[str]
"""List of strings to use as tags for this Worker"""
"""List of strings to use as tags for this Worker."""

tail_consumers: Iterable[ConsumerScriptParam]
"""List of Workers that will consume logs from the attached Worker."""
Expand All @@ -131,7 +161,7 @@ class Variant0Metadata(TypedDict, total=False):
"""Usage model to apply to invocations."""

version_tags: Dict[str, str]
"""Key-value pairs to use as tags for this version of this Worker"""
"""Key-value pairs to use as tags for this version of this Worker."""


class Variant1(TypedDict, total=False):
Expand Down
6 changes: 6 additions & 0 deletions src/cloudflare/types/workers/script_update_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ class ScriptUpdateResponse(BaseModel):
etag: Optional[str] = None
"""Hashed script content, can be used in a If-None-Match header when updating."""

has_assets: Optional[bool] = None
"""Whether a Worker contains assets."""

has_modules: Optional[bool] = None
"""Whether a Worker contains modules."""

logpush: Optional[bool] = None
"""Whether Logpush is turned on for the Worker."""

Expand Down
4 changes: 2 additions & 2 deletions src/cloudflare/types/workers/scripts/setting_edit_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ class SettingEditParams(TypedDict, total=False):
"""Whether Logpush is turned on for the Worker."""

observability: Observability
"""Observability settings for the Worker"""
"""Observability settings for the Worker."""

tail_consumers: Iterable[ConsumerScriptParam]
"""List of Workers that will consume logs from the attached Worker."""


class Observability(TypedDict, total=False):
enabled: Required[bool]
"""Whether observability is enabled for the Worker"""
"""Whether observability is enabled for the Worker."""

head_sampling_rate: Optional[float]
"""The sampling rate for incoming requests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"ScriptUpdateParams",
"Variant0",
"Variant0Metadata",
"Variant0MetadataAssets",
"Variant0MetadataAssetsConfig",
"Variant0MetadataBinding",
"Variant0MetadataMigrations",
"Variant0MetadataObservability",
Expand Down Expand Up @@ -43,6 +45,25 @@ class Variant0(TypedDict, total=False):
"""JSON encoded metadata about the uploaded parts and Worker configuration."""


class Variant0MetadataAssetsConfig(TypedDict, total=False):
html_handling: Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]
"""Determines the redirects and rewrites of requests for HTML content."""

not_found_handling: Literal["none", "404-page", "single-page-application"]
"""
Determines the response when a request does not match a static asset, and there
is no Worker script.
"""


class Variant0MetadataAssets(TypedDict, total=False):
config: Variant0MetadataAssetsConfig
"""Configuration for assets within a Worker."""

jwt: str
"""Token provided upon successful upload of all files from a registered manifest."""


class Variant0MetadataBindingTyped(TypedDict, total=False):
name: str
"""Name of the binding variable."""
Expand All @@ -62,7 +83,7 @@ class Variant0MetadataBindingTyped(TypedDict, total=False):

class Variant0MetadataObservability(TypedDict, total=False):
enabled: Required[bool]
"""Whether observability is enabled for the Worker"""
"""Whether observability is enabled for the Worker."""

head_sampling_rate: Optional[float]
"""The sampling rate for incoming requests.
Expand All @@ -72,6 +93,9 @@ class Variant0MetadataObservability(TypedDict, total=False):


class Variant0Metadata(TypedDict, total=False):
assets: Variant0MetadataAssets
"""Configuration for assets within a Worker"""

bindings: Iterable[Variant0MetadataBinding]
"""List of bindings available to the worker."""

Expand All @@ -96,6 +120,12 @@ class Variant0Metadata(TypedDict, total=False):
included in a `compatibility_date`.
"""

keep_assets: bool
"""
Retain assets which exist for a previously uploaded Worker version; used in lieu
of providing a completion token.
"""

keep_bindings: List[str]
"""List of binding types to keep from previous_upload."""

Expand All @@ -112,12 +142,12 @@ class Variant0Metadata(TypedDict, total=False):
"""Migrations to apply for Durable Objects associated with this Worker."""

observability: Variant0MetadataObservability
"""Observability settings for the Worker"""
"""Observability settings for the Worker."""

placement: PlacementConfigurationParam

tags: List[str]
"""List of strings to use as tags for this Worker"""
"""List of strings to use as tags for this Worker."""

tail_consumers: Iterable[ConsumerScriptParam]
"""List of Workers that will consume logs from the attached Worker."""
Expand All @@ -126,7 +156,7 @@ class Variant0Metadata(TypedDict, total=False):
"""Usage model to apply to invocations."""

version_tags: Dict[str, str]
"""Key-value pairs to use as tags for this version of this Worker"""
"""Key-value pairs to use as tags for this version of this Worker."""


class Variant1(TypedDict, total=False):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ class ScriptUpdateResponse(BaseModel):
etag: Optional[str] = None
"""Hashed script content, can be used in a If-None-Match header when updating."""

has_assets: Optional[bool] = None
"""Whether a Worker contains assets."""

has_modules: Optional[bool] = None
"""Whether a Worker contains modules."""

logpush: Optional[bool] = None
"""Whether Logpush is turned on for the Worker."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SettingsLimits(TypedDict, total=False):

class SettingsObservability(TypedDict, total=False):
enabled: Required[bool]
"""Whether observability is enabled for the Worker"""
"""Whether observability is enabled for the Worker."""

head_sampling_rate: Optional[float]
"""The sampling rate for incoming requests.
Expand Down Expand Up @@ -63,7 +63,7 @@ class Settings(TypedDict, total=False):
"""Migrations to apply for Durable Objects associated with this Worker."""

observability: SettingsObservability
"""Observability settings for the Worker"""
"""Observability settings for the Worker."""

placement: PlacementConfigurationParam

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Limits(BaseModel):

class Observability(BaseModel):
enabled: bool
"""Whether observability is enabled for the Worker"""
"""Whether observability is enabled for the Worker."""

head_sampling_rate: Optional[float] = None
"""The sampling rate for incoming requests.
Expand Down Expand Up @@ -52,7 +52,7 @@ class SettingEditResponse(BaseModel):
"""Migrations to apply for Durable Objects associated with this Worker."""

observability: Optional[Observability] = None
"""Observability settings for the Worker"""
"""Observability settings for the Worker."""

placement: Optional[PlacementConfiguration] = None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Limits(BaseModel):

class Observability(BaseModel):
enabled: bool
"""Whether observability is enabled for the Worker"""
"""Whether observability is enabled for the Worker."""

head_sampling_rate: Optional[float] = None
"""The sampling rate for incoming requests.
Expand Down Expand Up @@ -52,7 +52,7 @@ class SettingGetResponse(BaseModel):
"""Migrations to apply for Durable Objects associated with this Worker."""

observability: Optional[Observability] = None
"""Observability settings for the Worker"""
"""Observability settings for the Worker."""

placement: Optional[PlacementConfiguration] = None

Expand Down
16 changes: 16 additions & 0 deletions tests/api_resources/workers/test_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N
rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
any_part_name=[b"raw file contents", b"raw file contents", b"raw file contents"],
metadata={
"assets": {
"config": {
"html_handling": "auto-trailing-slash",
"not_found_handling": "none",
},
"jwt": "jwt",
},
"bindings": [
{
"name": "MY_ENV_VAR",
Expand All @@ -53,6 +60,7 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N
"body_part": "worker.js",
"compatibility_date": "2023-07-25",
"compatibility_flags": ["string", "string", "string"],
"keep_assets": False,
"keep_bindings": ["string", "string", "string"],
"logpush": False,
"main_module": "worker.js",
Expand Down Expand Up @@ -412,6 +420,13 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn
rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
any_part_name=[b"raw file contents", b"raw file contents", b"raw file contents"],
metadata={
"assets": {
"config": {
"html_handling": "auto-trailing-slash",
"not_found_handling": "none",
},
"jwt": "jwt",
},
"bindings": [
{
"name": "MY_ENV_VAR",
Expand All @@ -421,6 +436,7 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn
"body_part": "worker.js",
"compatibility_date": "2023-07-25",
"compatibility_flags": ["string", "string", "string"],
"keep_assets": False,
"keep_bindings": ["string", "string", "string"],
"logpush": False,
"main_module": "worker.js",
Expand Down
Loading

0 comments on commit f0898d4

Please sign in to comment.