Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1259
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-9e7278b59ca6d3312a49ec919b139cdc626476b556f93923d70aeaf39c5c7bcf.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-66dffe82f1ae82ccb13bf0b382257be6906f416a22d1ca4ea74464cfff324775.yml
6 changes: 4 additions & 2 deletions src/cloudflare/resources/logpush/datasets/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def get(
key-value pairs, where keys are field names, and values are descriptions.

Args:
dataset_id: Name of the dataset.
dataset_id: Name of the dataset. A list of supported datasets can be found on the
[Developer Docs](https://developers.cloudflare.com/logs/reference/log-fields/).

account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.

Expand Down Expand Up @@ -120,7 +121,8 @@ async def get(
key-value pairs, where keys are field names, and values are descriptions.

Args:
dataset_id: Name of the dataset.
dataset_id: Name of the dataset. A list of supported datasets can be found on the
[Developer Docs](https://developers.cloudflare.com/logs/reference/log-fields/).

account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.

Expand Down
6 changes: 4 additions & 2 deletions src/cloudflare/resources/logpush/datasets/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def get(
Lists Logpush jobs for an account or zone for a dataset.

Args:
dataset_id: Name of the dataset.
dataset_id: Name of the dataset. A list of supported datasets can be found on the
[Developer Docs](https://developers.cloudflare.com/logs/reference/log-fields/).

account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.

Expand Down Expand Up @@ -117,7 +118,8 @@ async def get(
Lists Logpush jobs for an account or zone for a dataset.

Args:
dataset_id: Name of the dataset.
dataset_id: Name of the dataset. A list of supported datasets can be found on the
[Developer Docs](https://developers.cloudflare.com/logs/reference/log-fields/).

account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.

Expand Down
150 changes: 136 additions & 14 deletions src/cloudflare/resources/logpush/jobs.py

Large diffs are not rendered by default.

48 changes: 44 additions & 4 deletions src/cloudflare/types/logpush/job_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,29 @@ class JobCreateParams(TypedDict, total=False):
"""The Zone ID to use for this endpoint. Mutually exclusive with the Account ID."""

dataset: Optional[str]
"""Name of the dataset."""
"""Name of the dataset.

A list of supported datasets can be found on the
[Developer Docs](https://developers.cloudflare.com/logs/reference/log-fields/).
"""

enabled: bool
"""Flag that indicates if the job is enabled."""

frequency: Optional[Literal["high", "low"]]
"""The frequency at which Cloudflare sends batches of logs to your destination.
"""This field is deprecated.

Please use `max_upload_*` parameters instead. The frequency at which Cloudflare
sends batches of logs to your destination. Setting frequency to high sends your
logs in larger quantities of smaller files. Setting frequency to low sends logs
in smaller quantities of larger files.
"""

Setting frequency to high sends your logs in larger quantities of smaller files.
Setting frequency to low sends logs in smaller quantities of larger files.
kind: Optional[Literal["edge"]]
"""
The kind parameter (optional) is used to differentiate between Logpush and Edge
Log Delivery jobs. Currently, Edge Log Delivery is only supported for the
`http_requests` dataset.
"""

logpull_options: Optional[str]
Expand All @@ -46,6 +59,33 @@ class JobCreateParams(TypedDict, total=False):
keep on making this call for you, setting start and end times appropriately.
"""

max_upload_bytes: Optional[int]
"""The maximum uncompressed file size of a batch of logs.

This setting value must be between `5 MB` and `1 GB`, or `0` to disable it. Note
that you cannot set a minimum file size; this means that log files may be much
smaller than this batch size. This parameter is not available for jobs with
`edge` as its kind.
"""

max_upload_interval_seconds: Optional[int]
"""The maximum interval in seconds for log batches.

This setting must be between 30 and 300 seconds (5 minutes), or `0` to disable
it. Note that you cannot specify a minimum interval for log batches; this means
that log files may be sent in shorter intervals than this. This parameter is
only used for jobs with `edge` as its kind.
"""

max_upload_records: Optional[int]
"""The maximum number of log lines per batch.

This setting must be between 1000 and 1,000,000 lines, or `0` to disable it.
Note that you cannot specify a minimum number of log lines per batch; this means
that log files may contain many fewer lines than this. This parameter is not
available for jobs with `edge` as its kind.
"""

name: Optional[str]
"""Optional human readable job name.

Expand Down
42 changes: 39 additions & 3 deletions src/cloudflare/types/logpush/job_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,19 @@ class JobUpdateParams(TypedDict, total=False):
"""Flag that indicates if the job is enabled."""

frequency: Optional[Literal["high", "low"]]
"""The frequency at which Cloudflare sends batches of logs to your destination.
"""This field is deprecated.

Please use `max_upload_*` parameters instead. The frequency at which Cloudflare
sends batches of logs to your destination. Setting frequency to high sends your
logs in larger quantities of smaller files. Setting frequency to low sends logs
in smaller quantities of larger files.
"""

Setting frequency to high sends your logs in larger quantities of smaller files.
Setting frequency to low sends logs in smaller quantities of larger files.
kind: Optional[Literal["edge"]]
"""
The kind parameter (optional) is used to differentiate between Logpush and Edge
Log Delivery jobs. Currently, Edge Log Delivery is only supported for the
`http_requests` dataset.
"""

logpull_options: Optional[str]
Expand All @@ -43,6 +52,33 @@ class JobUpdateParams(TypedDict, total=False):
keep on making this call for you, setting start and end times appropriately.
"""

max_upload_bytes: Optional[int]
"""The maximum uncompressed file size of a batch of logs.

This setting value must be between `5 MB` and `1 GB`, or `0` to disable it. Note
that you cannot set a minimum file size; this means that log files may be much
smaller than this batch size. This parameter is not available for jobs with
`edge` as its kind.
"""

max_upload_interval_seconds: Optional[int]
"""The maximum interval in seconds for log batches.

This setting must be between 30 and 300 seconds (5 minutes), or `0` to disable
it. Note that you cannot specify a minimum interval for log batches; this means
that log files may be sent in shorter intervals than this. This parameter is
only used for jobs with `edge` as its kind.
"""

max_upload_records: Optional[int]
"""The maximum number of log lines per batch.

This setting must be between 1000 and 1,000,000 lines, or `0` to disable it.
Note that you cannot specify a minimum number of log lines per batch; this means
that log files may contain many fewer lines than this. This parameter is not
available for jobs with `edge` as its kind.
"""

output_options: Optional[OutputOptionsParam]
"""The structured replacement for `logpull_options`.

Expand Down
48 changes: 44 additions & 4 deletions src/cloudflare/types/logpush/logpush_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ class LogpushJob(BaseModel):
"""Unique id of the job."""

dataset: Optional[str] = None
"""Name of the dataset."""
"""Name of the dataset.

A list of supported datasets can be found on the
[Developer Docs](https://developers.cloudflare.com/logs/reference/log-fields/).
"""

destination_conf: Optional[str] = None
"""Uniquely identifies a resource (such as an s3 bucket) where data will be pushed.
Expand All @@ -36,10 +40,19 @@ class LogpushJob(BaseModel):
"""

frequency: Optional[Literal["high", "low"]] = None
"""The frequency at which Cloudflare sends batches of logs to your destination.
"""This field is deprecated.

Please use `max_upload_*` parameters instead. The frequency at which Cloudflare
sends batches of logs to your destination. Setting frequency to high sends your
logs in larger quantities of smaller files. Setting frequency to low sends logs
in smaller quantities of larger files.
"""

Setting frequency to high sends your logs in larger quantities of smaller files.
Setting frequency to low sends logs in smaller quantities of larger files.
kind: Optional[Literal["edge"]] = None
"""
The kind parameter (optional) is used to differentiate between Logpush and Edge
Log Delivery jobs. Currently, Edge Log Delivery is only supported for the
`http_requests` dataset.
"""

last_complete: Optional[datetime] = None
Expand Down Expand Up @@ -68,6 +81,33 @@ class LogpushJob(BaseModel):
keep on making this call for you, setting start and end times appropriately.
"""

max_upload_bytes: Optional[int] = None
"""The maximum uncompressed file size of a batch of logs.

This setting value must be between `5 MB` and `1 GB`, or `0` to disable it. Note
that you cannot set a minimum file size; this means that log files may be much
smaller than this batch size. This parameter is not available for jobs with
`edge` as its kind.
"""

max_upload_interval_seconds: Optional[int] = None
"""The maximum interval in seconds for log batches.

This setting must be between 30 and 300 seconds (5 minutes), or `0` to disable
it. Note that you cannot specify a minimum interval for log batches; this means
that log files may be sent in shorter intervals than this. This parameter is
only used for jobs with `edge` as its kind.
"""

max_upload_records: Optional[int] = None
"""The maximum number of log lines per batch.

This setting must be between 1000 and 1,000,000 lines, or `0` to disable it.
Note that you cannot specify a minimum number of log lines per batch; this means
that log files may contain many fewer lines than this. This parameter is not
available for jobs with `edge` as its kind.
"""

name: Optional[str] = None
"""Optional human readable job name.

Expand Down
16 changes: 16 additions & 0 deletions tests/api_resources/logpush/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
dataset="http_requests",
enabled=False,
frequency="high",
kind="edge",
logpull_options="fields=RayID,ClientIP,EdgeStartTimestamp&timestamps=rfc3339",
max_upload_bytes=5000000,
max_upload_interval_seconds=30,
max_upload_records=1000,
name="example.com",
output_options={
"cve_2021_4428": True,
Expand Down Expand Up @@ -117,7 +121,11 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None:
destination_conf="s3://mybucket/logs?region=us-west-2",
enabled=False,
frequency="high",
kind="edge",
logpull_options="fields=RayID,ClientIP,EdgeStartTimestamp&timestamps=rfc3339",
max_upload_bytes=5000000,
max_upload_interval_seconds=30,
max_upload_records=1000,
output_options={
"cve_2021_4428": True,
"batch_prefix": "string",
Expand Down Expand Up @@ -378,7 +386,11 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare
dataset="http_requests",
enabled=False,
frequency="high",
kind="edge",
logpull_options="fields=RayID,ClientIP,EdgeStartTimestamp&timestamps=rfc3339",
max_upload_bytes=5000000,
max_upload_interval_seconds=30,
max_upload_records=1000,
name="example.com",
output_options={
"cve_2021_4428": True,
Expand Down Expand Up @@ -459,7 +471,11 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare
destination_conf="s3://mybucket/logs?region=us-west-2",
enabled=False,
frequency="high",
kind="edge",
logpull_options="fields=RayID,ClientIP,EdgeStartTimestamp&timestamps=rfc3339",
max_upload_bytes=5000000,
max_upload_interval_seconds=30,
max_upload_records=1000,
output_options={
"cve_2021_4428": True,
"batch_prefix": "string",
Expand Down