Skip to content

Commit f317af7

Browse files
committed
feat(audit_logs): add audit_logs resource
1 parent a98fa44 commit f317af7

189 files changed

Lines changed: 60061 additions & 40 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .audit_logs import (
4+
AuditLogsResource,
5+
AsyncAuditLogsResource,
6+
AuditLogsResourceWithRawResponse,
7+
AsyncAuditLogsResourceWithRawResponse,
8+
AuditLogsResourceWithStreamingResponse,
9+
AsyncAuditLogsResourceWithStreamingResponse,
10+
)
11+
12+
__all__ = [
13+
"AuditLogsResource",
14+
"AsyncAuditLogsResource",
15+
"AuditLogsResourceWithRawResponse",
16+
"AsyncAuditLogsResourceWithRawResponse",
17+
"AuditLogsResourceWithStreamingResponse",
18+
"AsyncAuditLogsResourceWithStreamingResponse",
19+
]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# AuditLogs
2+
3+
Methods:
4+
5+
- <code title="get /accounts/{account_id}/audit_logs">client.audit_logs.<a href="./src/cloudflare/resources/audit_logs/audit_logs.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/audit_logs/audit_log_list_params.py">params</a>) -> <a href="./src/cloudflare/types/shared/audit_log.py">SyncV4PagePaginationArray[AuditLog]</a></code>
Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Union
6+
from datetime import date, datetime
7+
from typing_extensions import Literal
8+
9+
import httpx
10+
11+
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
12+
from ..._utils import path_template, maybe_transform
13+
from ..._compat import cached_property
14+
from ..._resource import SyncAPIResource, AsyncAPIResource
15+
from ..._response import (
16+
to_raw_response_wrapper,
17+
to_streamed_response_wrapper,
18+
async_to_raw_response_wrapper,
19+
async_to_streamed_response_wrapper,
20+
)
21+
from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
22+
from ..._base_client import AsyncPaginator, make_request_options
23+
from ...types.audit_logs import audit_log_list_params
24+
from ...types.shared.audit_log import AuditLog
25+
26+
__all__ = ["AuditLogsResource", "AsyncAuditLogsResource"]
27+
28+
29+
class AuditLogsResource(SyncAPIResource):
30+
@cached_property
31+
def with_raw_response(self) -> AuditLogsResourceWithRawResponse:
32+
"""
33+
This property can be used as a prefix for any HTTP method call to return
34+
the raw response object instead of the parsed content.
35+
36+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
37+
"""
38+
return AuditLogsResourceWithRawResponse(self)
39+
40+
@cached_property
41+
def with_streaming_response(self) -> AuditLogsResourceWithStreamingResponse:
42+
"""
43+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
44+
45+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
46+
"""
47+
return AuditLogsResourceWithStreamingResponse(self)
48+
49+
def list(
50+
self,
51+
*,
52+
account_id: str | None = None,
53+
id: str | Omit = omit,
54+
action: audit_log_list_params.Action | Omit = omit,
55+
actor: audit_log_list_params.Actor | Omit = omit,
56+
before: Union[Union[str, date], Union[str, datetime]] | Omit = omit,
57+
direction: Literal["desc", "asc"] | Omit = omit,
58+
export: bool | Omit = omit,
59+
hide_user_logs: bool | Omit = omit,
60+
page: float | Omit = omit,
61+
per_page: float | Omit = omit,
62+
since: Union[Union[str, date], Union[str, datetime]] | Omit = omit,
63+
zone: audit_log_list_params.Zone | Omit = omit,
64+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
65+
# The extra values given here take precedence over values defined on the client or passed to this method.
66+
extra_headers: Headers | None = None,
67+
extra_query: Query | None = None,
68+
extra_body: Body | None = None,
69+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
70+
) -> SyncV4PagePaginationArray[AuditLog]:
71+
"""Gets a list of audit logs for an account.
72+
73+
Can be filtered by who made the
74+
change, on which zone, and the timeframe of the change.
75+
76+
Args:
77+
account_id: Identifier
78+
79+
id: Finds a specific log by its ID.
80+
81+
before: Limits the returned results to logs older than the specified date. A `full-date`
82+
that conforms to RFC3339.
83+
84+
direction: Changes the direction of the chronological sorting.
85+
86+
export: Indicates that this request is an export of logs in CSV format.
87+
88+
hide_user_logs: Indicates whether or not to hide user level audit logs.
89+
90+
page: Defines which page of results to return.
91+
92+
per_page: Sets the number of results to return per page.
93+
94+
since: Limits the returned results to logs newer than the specified date. A `full-date`
95+
that conforms to RFC3339.
96+
97+
extra_headers: Send extra headers
98+
99+
extra_query: Add additional query parameters to the request
100+
101+
extra_body: Add additional JSON properties to the request
102+
103+
timeout: Override the client-level default timeout for this request, in seconds
104+
"""
105+
if account_id is None:
106+
account_id = self._client._get_account_id_path_param()
107+
if not account_id:
108+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
109+
return self._get_api_list(
110+
path_template("/accounts/{account_id}/audit_logs", account_id=account_id),
111+
page=SyncV4PagePaginationArray[AuditLog],
112+
options=make_request_options(
113+
extra_headers=extra_headers,
114+
extra_query=extra_query,
115+
extra_body=extra_body,
116+
timeout=timeout,
117+
query=maybe_transform(
118+
{
119+
"id": id,
120+
"action": action,
121+
"actor": actor,
122+
"before": before,
123+
"direction": direction,
124+
"export": export,
125+
"hide_user_logs": hide_user_logs,
126+
"page": page,
127+
"per_page": per_page,
128+
"since": since,
129+
"zone": zone,
130+
},
131+
audit_log_list_params.AuditLogListParams,
132+
),
133+
),
134+
model=AuditLog,
135+
)
136+
137+
138+
class AsyncAuditLogsResource(AsyncAPIResource):
139+
@cached_property
140+
def with_raw_response(self) -> AsyncAuditLogsResourceWithRawResponse:
141+
"""
142+
This property can be used as a prefix for any HTTP method call to return
143+
the raw response object instead of the parsed content.
144+
145+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
146+
"""
147+
return AsyncAuditLogsResourceWithRawResponse(self)
148+
149+
@cached_property
150+
def with_streaming_response(self) -> AsyncAuditLogsResourceWithStreamingResponse:
151+
"""
152+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
153+
154+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
155+
"""
156+
return AsyncAuditLogsResourceWithStreamingResponse(self)
157+
158+
def list(
159+
self,
160+
*,
161+
account_id: str | None = None,
162+
id: str | Omit = omit,
163+
action: audit_log_list_params.Action | Omit = omit,
164+
actor: audit_log_list_params.Actor | Omit = omit,
165+
before: Union[Union[str, date], Union[str, datetime]] | Omit = omit,
166+
direction: Literal["desc", "asc"] | Omit = omit,
167+
export: bool | Omit = omit,
168+
hide_user_logs: bool | Omit = omit,
169+
page: float | Omit = omit,
170+
per_page: float | Omit = omit,
171+
since: Union[Union[str, date], Union[str, datetime]] | Omit = omit,
172+
zone: audit_log_list_params.Zone | Omit = omit,
173+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
174+
# The extra values given here take precedence over values defined on the client or passed to this method.
175+
extra_headers: Headers | None = None,
176+
extra_query: Query | None = None,
177+
extra_body: Body | None = None,
178+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
179+
) -> AsyncPaginator[AuditLog, AsyncV4PagePaginationArray[AuditLog]]:
180+
"""Gets a list of audit logs for an account.
181+
182+
Can be filtered by who made the
183+
change, on which zone, and the timeframe of the change.
184+
185+
Args:
186+
account_id: Identifier
187+
188+
id: Finds a specific log by its ID.
189+
190+
before: Limits the returned results to logs older than the specified date. A `full-date`
191+
that conforms to RFC3339.
192+
193+
direction: Changes the direction of the chronological sorting.
194+
195+
export: Indicates that this request is an export of logs in CSV format.
196+
197+
hide_user_logs: Indicates whether or not to hide user level audit logs.
198+
199+
page: Defines which page of results to return.
200+
201+
per_page: Sets the number of results to return per page.
202+
203+
since: Limits the returned results to logs newer than the specified date. A `full-date`
204+
that conforms to RFC3339.
205+
206+
extra_headers: Send extra headers
207+
208+
extra_query: Add additional query parameters to the request
209+
210+
extra_body: Add additional JSON properties to the request
211+
212+
timeout: Override the client-level default timeout for this request, in seconds
213+
"""
214+
if account_id is None:
215+
account_id = self._client._get_account_id_path_param()
216+
if not account_id:
217+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
218+
return self._get_api_list(
219+
path_template("/accounts/{account_id}/audit_logs", account_id=account_id),
220+
page=AsyncV4PagePaginationArray[AuditLog],
221+
options=make_request_options(
222+
extra_headers=extra_headers,
223+
extra_query=extra_query,
224+
extra_body=extra_body,
225+
timeout=timeout,
226+
query=maybe_transform(
227+
{
228+
"id": id,
229+
"action": action,
230+
"actor": actor,
231+
"before": before,
232+
"direction": direction,
233+
"export": export,
234+
"hide_user_logs": hide_user_logs,
235+
"page": page,
236+
"per_page": per_page,
237+
"since": since,
238+
"zone": zone,
239+
},
240+
audit_log_list_params.AuditLogListParams,
241+
),
242+
),
243+
model=AuditLog,
244+
)
245+
246+
247+
class AuditLogsResourceWithRawResponse:
248+
def __init__(self, audit_logs: AuditLogsResource) -> None:
249+
self._audit_logs = audit_logs
250+
251+
self.list = to_raw_response_wrapper(
252+
audit_logs.list,
253+
)
254+
255+
256+
class AsyncAuditLogsResourceWithRawResponse:
257+
def __init__(self, audit_logs: AsyncAuditLogsResource) -> None:
258+
self._audit_logs = audit_logs
259+
260+
self.list = async_to_raw_response_wrapper(
261+
audit_logs.list,
262+
)
263+
264+
265+
class AuditLogsResourceWithStreamingResponse:
266+
def __init__(self, audit_logs: AuditLogsResource) -> None:
267+
self._audit_logs = audit_logs
268+
269+
self.list = to_streamed_response_wrapper(
270+
audit_logs.list,
271+
)
272+
273+
274+
class AsyncAuditLogsResourceWithStreamingResponse:
275+
def __init__(self, audit_logs: AsyncAuditLogsResource) -> None:
276+
self._audit_logs = audit_logs
277+
278+
self.list = async_to_streamed_response_wrapper(
279+
audit_logs.list,
280+
)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .bot_management import (
4+
BotManagementResource,
5+
AsyncBotManagementResource,
6+
BotManagementResourceWithRawResponse,
7+
AsyncBotManagementResourceWithRawResponse,
8+
BotManagementResourceWithStreamingResponse,
9+
AsyncBotManagementResourceWithStreamingResponse,
10+
)
11+
12+
__all__ = [
13+
"BotManagementResource",
14+
"AsyncBotManagementResource",
15+
"BotManagementResourceWithRawResponse",
16+
"AsyncBotManagementResourceWithRawResponse",
17+
"BotManagementResourceWithStreamingResponse",
18+
"AsyncBotManagementResourceWithStreamingResponse",
19+
]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# BotManagement
2+
3+
Types:
4+
5+
```python
6+
from cloudflare.types.bot_management import (
7+
BotFightModeConfiguration,
8+
SubscriptionConfiguration,
9+
SuperBotFightModeDefinitelyConfiguration,
10+
SuperBotFightModeLikelyConfiguration,
11+
BotManagementUpdateResponse,
12+
BotManagementGetResponse,
13+
)
14+
```
15+
16+
Methods:
17+
18+
- <code title="put /zones/{zone_id}/bot_management">client.bot_management.<a href="./src/cloudflare/resources/bot_management/bot_management.py">update</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/bot_management/bot_management_update_params.py">params</a>) -> <a href="./src/cloudflare/types/bot_management/bot_management_update_response.py">Optional[BotManagementUpdateResponse]</a></code>
19+
- <code title="get /zones/{zone_id}/bot_management">client.bot_management.<a href="./src/cloudflare/resources/bot_management/bot_management.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/bot_management/bot_management_get_response.py">Optional[BotManagementGetResponse]</a></code>

0 commit comments

Comments
 (0)