Skip to content

Commit b8896ca

Browse files
feat: feat(lex): add Log Explorer to SDK config
* feat(lex): add Log Explorer to SDK config
1 parent 7888a65 commit b8896ca

26 files changed

Lines changed: 2580 additions & 3 deletions

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 2417
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare/cloudflare-08f6951dff1022387f05582fe54cd8eff8e606ad0809b0e3efb5874ebb11cf01.yml
1+
configured_endpoints: 2423
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare/cloudflare-83f11fb5a150a13010ce252dd5eb8911358ac6c2ead9d59813126f2a287b33fa.yml
33
openapi_spec_hash: 6b8ffc5d6d40adc6dc83fbb44811ef18
4-
config_hash: cd80863b2a094f3805409e4a5676b0b8
4+
config_hash: 49ddc3264a325bcb6e3063c4adc8d37e

src/cloudflare/resources/logs/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,22 @@
3232
ReceivedResourceWithStreamingResponse,
3333
AsyncReceivedResourceWithStreamingResponse,
3434
)
35+
from .log_explorer import (
36+
LogExplorerResource,
37+
AsyncLogExplorerResource,
38+
LogExplorerResourceWithRawResponse,
39+
AsyncLogExplorerResourceWithRawResponse,
40+
LogExplorerResourceWithStreamingResponse,
41+
AsyncLogExplorerResourceWithStreamingResponse,
42+
)
3543

3644
__all__ = [
45+
"LogExplorerResource",
46+
"AsyncLogExplorerResource",
47+
"LogExplorerResourceWithRawResponse",
48+
"AsyncLogExplorerResourceWithRawResponse",
49+
"LogExplorerResourceWithStreamingResponse",
50+
"AsyncLogExplorerResourceWithStreamingResponse",
3751
"ControlResource",
3852
"AsyncControlResource",
3953
"ControlResourceWithRawResponse",

src/cloudflare/resources/logs/api.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
# Logs
22

3+
## LogExplorer
4+
5+
### Query
6+
7+
Types:
8+
9+
```python
10+
from cloudflare.types.logs.log_explorer import QuerySqlResponse
11+
```
12+
13+
Methods:
14+
15+
- <code title="post /{accounts_or_zones}/{account_or_zone_id}/logs/explorer/query/sql">client.logs.log_explorer.query.<a href="./src/cloudflare/resources/logs/log_explorer/query.py">sql</a>(body, \*, account_id, zone_id, \*\*<a href="src/cloudflare/types/logs/log_explorer/query_sql_params.py">params</a>) -> <a href="./src/cloudflare/types/logs/log_explorer/query_sql_response.py">SyncSinglePage[QuerySqlResponse]</a></code>
16+
17+
### Datasets
18+
19+
Types:
20+
21+
```python
22+
from cloudflare.types.logs.log_explorer import CreateRequest, Dataset, DatasetSummary, UpdateRequest
23+
```
24+
25+
Methods:
26+
27+
- <code title="post /{accounts_or_zones}/{account_or_zone_id}/logs/explorer/datasets">client.logs.log_explorer.datasets.<a href="./src/cloudflare/resources/logs/log_explorer/datasets/datasets.py">create</a>(\*, account_id, zone_id, \*\*<a href="src/cloudflare/types/logs/log_explorer/dataset_create_params.py">params</a>) -> <a href="./src/cloudflare/types/logs/log_explorer/dataset.py">Optional[Dataset]</a></code>
28+
- <code title="put /{accounts_or_zones}/{account_or_zone_id}/logs/explorer/datasets/{dataset_id}">client.logs.log_explorer.datasets.<a href="./src/cloudflare/resources/logs/log_explorer/datasets/datasets.py">update</a>(dataset_id, \*, account_id, zone_id, \*\*<a href="src/cloudflare/types/logs/log_explorer/dataset_update_params.py">params</a>) -> <a href="./src/cloudflare/types/logs/log_explorer/dataset.py">Optional[Dataset]</a></code>
29+
- <code title="get /{accounts_or_zones}/{account_or_zone_id}/logs/explorer/datasets">client.logs.log_explorer.datasets.<a href="./src/cloudflare/resources/logs/log_explorer/datasets/datasets.py">list</a>(\*, account_id, zone_id, \*\*<a href="src/cloudflare/types/logs/log_explorer/dataset_list_params.py">params</a>) -> <a href="./src/cloudflare/types/logs/log_explorer/dataset_summary.py">SyncSinglePage[DatasetSummary]</a></code>
30+
- <code title="get /{accounts_or_zones}/{account_or_zone_id}/logs/explorer/datasets/{dataset_id}">client.logs.log_explorer.datasets.<a href="./src/cloudflare/resources/logs/log_explorer/datasets/datasets.py">get</a>(dataset_id, \*, account_id, zone_id) -> <a href="./src/cloudflare/types/logs/log_explorer/dataset.py">Optional[Dataset]</a></code>
31+
32+
#### Available
33+
34+
Types:
35+
36+
```python
37+
from cloudflare.types.logs.log_explorer.datasets import AvailableDataset, AvailableList
38+
```
39+
40+
Methods:
41+
42+
- <code title="get /{accounts_or_zones}/{account_or_zone_id}/logs/explorer/datasets/available">client.logs.log_explorer.datasets.available.<a href="./src/cloudflare/resources/logs/log_explorer/datasets/available.py">list</a>(\*, account_id, zone_id) -> <a href="./src/cloudflare/types/logs/log_explorer/datasets/available_dataset.py">SyncSinglePage[AvailableDataset]</a></code>
43+
344
## Control
445

546
### Retention
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .query import (
4+
QueryResource,
5+
AsyncQueryResource,
6+
QueryResourceWithRawResponse,
7+
AsyncQueryResourceWithRawResponse,
8+
QueryResourceWithStreamingResponse,
9+
AsyncQueryResourceWithStreamingResponse,
10+
)
11+
from .datasets import (
12+
DatasetsResource,
13+
AsyncDatasetsResource,
14+
DatasetsResourceWithRawResponse,
15+
AsyncDatasetsResourceWithRawResponse,
16+
DatasetsResourceWithStreamingResponse,
17+
AsyncDatasetsResourceWithStreamingResponse,
18+
)
19+
from .log_explorer import (
20+
LogExplorerResource,
21+
AsyncLogExplorerResource,
22+
LogExplorerResourceWithRawResponse,
23+
AsyncLogExplorerResourceWithRawResponse,
24+
LogExplorerResourceWithStreamingResponse,
25+
AsyncLogExplorerResourceWithStreamingResponse,
26+
)
27+
28+
__all__ = [
29+
"QueryResource",
30+
"AsyncQueryResource",
31+
"QueryResourceWithRawResponse",
32+
"AsyncQueryResourceWithRawResponse",
33+
"QueryResourceWithStreamingResponse",
34+
"AsyncQueryResourceWithStreamingResponse",
35+
"DatasetsResource",
36+
"AsyncDatasetsResource",
37+
"DatasetsResourceWithRawResponse",
38+
"AsyncDatasetsResourceWithRawResponse",
39+
"DatasetsResourceWithStreamingResponse",
40+
"AsyncDatasetsResourceWithStreamingResponse",
41+
"LogExplorerResource",
42+
"AsyncLogExplorerResource",
43+
"LogExplorerResourceWithRawResponse",
44+
"AsyncLogExplorerResourceWithRawResponse",
45+
"LogExplorerResourceWithStreamingResponse",
46+
"AsyncLogExplorerResourceWithStreamingResponse",
47+
]
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .datasets import (
4+
DatasetsResource,
5+
AsyncDatasetsResource,
6+
DatasetsResourceWithRawResponse,
7+
AsyncDatasetsResourceWithRawResponse,
8+
DatasetsResourceWithStreamingResponse,
9+
AsyncDatasetsResourceWithStreamingResponse,
10+
)
11+
from .available import (
12+
AvailableResource,
13+
AsyncAvailableResource,
14+
AvailableResourceWithRawResponse,
15+
AsyncAvailableResourceWithRawResponse,
16+
AvailableResourceWithStreamingResponse,
17+
AsyncAvailableResourceWithStreamingResponse,
18+
)
19+
20+
__all__ = [
21+
"AvailableResource",
22+
"AsyncAvailableResource",
23+
"AvailableResourceWithRawResponse",
24+
"AsyncAvailableResourceWithRawResponse",
25+
"AvailableResourceWithStreamingResponse",
26+
"AsyncAvailableResourceWithStreamingResponse",
27+
"DatasetsResource",
28+
"AsyncDatasetsResource",
29+
"DatasetsResourceWithRawResponse",
30+
"AsyncDatasetsResourceWithRawResponse",
31+
"DatasetsResourceWithStreamingResponse",
32+
"AsyncDatasetsResourceWithStreamingResponse",
33+
]
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
import httpx
6+
7+
from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
8+
from ....._utils import path_template
9+
from ....._compat import cached_property
10+
from ....._resource import SyncAPIResource, AsyncAPIResource
11+
from ....._response import (
12+
to_raw_response_wrapper,
13+
to_streamed_response_wrapper,
14+
async_to_raw_response_wrapper,
15+
async_to_streamed_response_wrapper,
16+
)
17+
from .....pagination import SyncSinglePage, AsyncSinglePage
18+
from ....._base_client import AsyncPaginator, make_request_options
19+
from .....types.logs.log_explorer.datasets.available_dataset import AvailableDataset
20+
21+
__all__ = ["AvailableResource", "AsyncAvailableResource"]
22+
23+
24+
class AvailableResource(SyncAPIResource):
25+
@cached_property
26+
def with_raw_response(self) -> AvailableResourceWithRawResponse:
27+
"""
28+
This property can be used as a prefix for any HTTP method call to return
29+
the raw response object instead of the parsed content.
30+
31+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
32+
"""
33+
return AvailableResourceWithRawResponse(self)
34+
35+
@cached_property
36+
def with_streaming_response(self) -> AvailableResourceWithStreamingResponse:
37+
"""
38+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
39+
40+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
41+
"""
42+
return AvailableResourceWithStreamingResponse(self)
43+
44+
def list(
45+
self,
46+
*,
47+
account_id: str | Omit = omit,
48+
zone_id: str | Omit = omit,
49+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
50+
# The extra values given here take precedence over values defined on the client or passed to this method.
51+
extra_headers: Headers | None = None,
52+
extra_query: Query | None = None,
53+
extra_body: Body | None = None,
54+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
55+
) -> SyncSinglePage[AvailableDataset]:
56+
"""Returns all dataset types that this account or zone can create.
57+
58+
Each entry
59+
includes the dataset schema and timestamp field.
60+
61+
The schema shows all possible fields for a dataset. However, not all fields may
62+
be available for your account or zone. When creating or updating a dataset, only
63+
fields available to your account or zone can be enabled. If you request a field
64+
that is not available, you will receive an error.
65+
66+
Args:
67+
account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
68+
69+
zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
70+
71+
extra_headers: Send extra headers
72+
73+
extra_query: Add additional query parameters to the request
74+
75+
extra_body: Add additional JSON properties to the request
76+
77+
timeout: Override the client-level default timeout for this request, in seconds
78+
"""
79+
if account_id and zone_id:
80+
raise ValueError("You cannot provide both account_id and zone_id")
81+
82+
if account_id:
83+
account_or_zone = "accounts"
84+
account_or_zone_id = account_id
85+
else:
86+
if not zone_id:
87+
raise ValueError("You must provide either account_id or zone_id")
88+
89+
account_or_zone = "zones"
90+
account_or_zone_id = zone_id
91+
return self._get_api_list(
92+
path_template(
93+
"/{account_or_zone}/{account_or_zone_id}/logs/explorer/datasets/available",
94+
account_or_zone=account_or_zone,
95+
account_or_zone_id=account_or_zone_id,
96+
),
97+
page=SyncSinglePage[AvailableDataset],
98+
options=make_request_options(
99+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
100+
),
101+
model=AvailableDataset,
102+
)
103+
104+
105+
class AsyncAvailableResource(AsyncAPIResource):
106+
@cached_property
107+
def with_raw_response(self) -> AsyncAvailableResourceWithRawResponse:
108+
"""
109+
This property can be used as a prefix for any HTTP method call to return
110+
the raw response object instead of the parsed content.
111+
112+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
113+
"""
114+
return AsyncAvailableResourceWithRawResponse(self)
115+
116+
@cached_property
117+
def with_streaming_response(self) -> AsyncAvailableResourceWithStreamingResponse:
118+
"""
119+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
120+
121+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
122+
"""
123+
return AsyncAvailableResourceWithStreamingResponse(self)
124+
125+
def list(
126+
self,
127+
*,
128+
account_id: str | Omit = omit,
129+
zone_id: str | Omit = omit,
130+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
131+
# The extra values given here take precedence over values defined on the client or passed to this method.
132+
extra_headers: Headers | None = None,
133+
extra_query: Query | None = None,
134+
extra_body: Body | None = None,
135+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
136+
) -> AsyncPaginator[AvailableDataset, AsyncSinglePage[AvailableDataset]]:
137+
"""Returns all dataset types that this account or zone can create.
138+
139+
Each entry
140+
includes the dataset schema and timestamp field.
141+
142+
The schema shows all possible fields for a dataset. However, not all fields may
143+
be available for your account or zone. When creating or updating a dataset, only
144+
fields available to your account or zone can be enabled. If you request a field
145+
that is not available, you will receive an error.
146+
147+
Args:
148+
account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
149+
150+
zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
151+
152+
extra_headers: Send extra headers
153+
154+
extra_query: Add additional query parameters to the request
155+
156+
extra_body: Add additional JSON properties to the request
157+
158+
timeout: Override the client-level default timeout for this request, in seconds
159+
"""
160+
if account_id and zone_id:
161+
raise ValueError("You cannot provide both account_id and zone_id")
162+
163+
if account_id:
164+
account_or_zone = "accounts"
165+
account_or_zone_id = account_id
166+
else:
167+
if not zone_id:
168+
raise ValueError("You must provide either account_id or zone_id")
169+
170+
account_or_zone = "zones"
171+
account_or_zone_id = zone_id
172+
return self._get_api_list(
173+
path_template(
174+
"/{account_or_zone}/{account_or_zone_id}/logs/explorer/datasets/available",
175+
account_or_zone=account_or_zone,
176+
account_or_zone_id=account_or_zone_id,
177+
),
178+
page=AsyncSinglePage[AvailableDataset],
179+
options=make_request_options(
180+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
181+
),
182+
model=AvailableDataset,
183+
)
184+
185+
186+
class AvailableResourceWithRawResponse:
187+
def __init__(self, available: AvailableResource) -> None:
188+
self._available = available
189+
190+
self.list = to_raw_response_wrapper(
191+
available.list,
192+
)
193+
194+
195+
class AsyncAvailableResourceWithRawResponse:
196+
def __init__(self, available: AsyncAvailableResource) -> None:
197+
self._available = available
198+
199+
self.list = async_to_raw_response_wrapper(
200+
available.list,
201+
)
202+
203+
204+
class AvailableResourceWithStreamingResponse:
205+
def __init__(self, available: AvailableResource) -> None:
206+
self._available = available
207+
208+
self.list = to_streamed_response_wrapper(
209+
available.list,
210+
)
211+
212+
213+
class AsyncAvailableResourceWithStreamingResponse:
214+
def __init__(self, available: AsyncAvailableResource) -> None:
215+
self._available = available
216+
217+
self.list = async_to_streamed_response_wrapper(
218+
available.list,
219+
)

0 commit comments

Comments
 (0)