Skip to content
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 .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.72.0"
".": "0.73.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 124
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-4c243ff089133bd49322d98a6943647589972f71ecadc993fe9e5029972b3995.yml
openapi_spec_hash: a2cb637a19a070d07a1a4343c75444ee
config_hash: fb167e754ebb3a14649463725891c9d0
configured_endpoints: 125
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-55409ab573762d8bc010fb34c885651ca858a97d4353b4776b7aafeaaa313257.yml
openapi_spec_hash: 0cf678d80f2a2b73fb9ec82d05c8cc0a
config_hash: 06186eb40e0058a2a87ac251fc07415d
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.73.0 (2026-07-01)

Full Changelog: [v0.72.0...v0.73.0](https://github.com/kernel/kernel-python-sdk/compare/v0.72.0...v0.73.0)

### Features

* Add hidden audit-logs export endpoint ([619c672](https://github.com/kernel/kernel-python-sdk/commit/619c6720f986b835393793896bb5ad4b64f8673f))

## 0.72.0 (2026-06-26)

Full Changelog: [v0.71.0...v0.72.0](https://github.com/kernel/kernel-python-sdk/compare/v0.71.0...v0.72.0)
Expand Down
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ from kernel.types import AuditLogEntry
Methods:

- <code title="get /audit-logs">client.audit_logs.<a href="./src/kernel/resources/audit_logs.py">list</a>(\*\*<a href="src/kernel/types/audit_log_list_params.py">params</a>) -> <a href="./src/kernel/types/audit_log_entry.py">SyncPageTokenPagination[AuditLogEntry]</a></code>
- <code title="get /audit-logs/export/chunk">client.audit_logs.<a href="./src/kernel/resources/audit_logs.py">export_chunk</a>(\*\*<a href="src/kernel/types/audit_log_export_chunk_params.py">params</a>) -> BinaryAPIResponse</code>

# APIKeys

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "kernel"
version = "0.72.0"
version = "0.73.0"
description = "The official Python library for the kernel API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "kernel"
__version__ = "0.72.0" # x-release-please-version
__version__ = "0.73.0" # x-release-please-version
199 changes: 197 additions & 2 deletions src/kernel/resources/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,28 @@

from typing import Union
from datetime import datetime
from typing_extensions import Literal

import httpx

from ..types import audit_log_list_params
from ..types import audit_log_list_params, audit_log_export_chunk_params
from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from .._utils import maybe_transform
from .._utils import maybe_transform, async_maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import (
BinaryAPIResponse,
AsyncBinaryAPIResponse,
StreamedBinaryAPIResponse,
AsyncStreamedBinaryAPIResponse,
to_raw_response_wrapper,
to_streamed_response_wrapper,
async_to_raw_response_wrapper,
to_custom_raw_response_wrapper,
async_to_streamed_response_wrapper,
to_custom_streamed_response_wrapper,
async_to_custom_raw_response_wrapper,
async_to_custom_streamed_response_wrapper,
)
from ..pagination import SyncPageTokenPagination, AsyncPageTokenPagination
from .._base_client import AsyncPaginator, make_request_options
Expand Down Expand Up @@ -128,6 +137,91 @@ def list(
model=AuditLogEntry,
)

def export_chunk(
self,
*,
end: Union[str, datetime],
start: Union[str, datetime],
auth_strategy: str | Omit = omit,
cursor: str | Omit = omit,
exclude_method: str | Omit = omit,
format: Literal["jsonl", "jsonl.gz"] | Omit = omit,
limit: int | Omit = omit,
method: str | Omit = omit,
search: str | Omit = omit,
search_user_id: SequenceNotStr[str] | Omit = omit,
service: str | Omit = omit,
# 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> BinaryAPIResponse:
"""
Download an organization's audit log records for a time range as a file, for
archival, compliance, or offline analysis. For interactive browsing, use GET
/audit-logs.

Args:
end: Upper bound (exclusive) for the audit record timestamp.

start: Lower bound (inclusive) for the audit record timestamp.

auth_strategy: Filter by authentication strategy.

cursor: Opaque cursor from X-Next-Cursor for the next chunk of older records.

exclude_method: Filter out results by HTTP method.

format: Encoding for the returned chunk.

limit: Maximum number of records to return in this chunk.

method: Filter by HTTP method.

search: Free-text search over path, user ID, email, client IP, and status.

search_user_id: Additional user IDs to OR into free-text search.

service: Filter by service name.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
return self._get(
"/audit-logs/export/chunk",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
{
"end": end,
"start": start,
"auth_strategy": auth_strategy,
"cursor": cursor,
"exclude_method": exclude_method,
"format": format,
"limit": limit,
"method": method,
"search": search,
"search_user_id": search_user_id,
"service": service,
},
audit_log_export_chunk_params.AuditLogExportChunkParams,
),
),
cast_to=BinaryAPIResponse,
)


class AsyncAuditLogsResource(AsyncAPIResource):
"""Read audit log records for the authenticated organization."""
Expand Down Expand Up @@ -232,6 +326,91 @@ def list(
model=AuditLogEntry,
)

async def export_chunk(
self,
*,
end: Union[str, datetime],
start: Union[str, datetime],
auth_strategy: str | Omit = omit,
cursor: str | Omit = omit,
exclude_method: str | Omit = omit,
format: Literal["jsonl", "jsonl.gz"] | Omit = omit,
limit: int | Omit = omit,
method: str | Omit = omit,
search: str | Omit = omit,
search_user_id: SequenceNotStr[str] | Omit = omit,
service: str | Omit = omit,
# 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncBinaryAPIResponse:
"""
Download an organization's audit log records for a time range as a file, for
archival, compliance, or offline analysis. For interactive browsing, use GET
/audit-logs.

Args:
end: Upper bound (exclusive) for the audit record timestamp.

start: Lower bound (inclusive) for the audit record timestamp.

auth_strategy: Filter by authentication strategy.

cursor: Opaque cursor from X-Next-Cursor for the next chunk of older records.

exclude_method: Filter out results by HTTP method.

format: Encoding for the returned chunk.

limit: Maximum number of records to return in this chunk.

method: Filter by HTTP method.

search: Free-text search over path, user ID, email, client IP, and status.

search_user_id: Additional user IDs to OR into free-text search.

service: Filter by service name.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
return await self._get(
"/audit-logs/export/chunk",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform(
{
"end": end,
"start": start,
"auth_strategy": auth_strategy,
"cursor": cursor,
"exclude_method": exclude_method,
"format": format,
"limit": limit,
"method": method,
"search": search,
"search_user_id": search_user_id,
"service": service,
},
audit_log_export_chunk_params.AuditLogExportChunkParams,
),
),
cast_to=AsyncBinaryAPIResponse,
)


class AuditLogsResourceWithRawResponse:
def __init__(self, audit_logs: AuditLogsResource) -> None:
Expand All @@ -240,6 +419,10 @@ def __init__(self, audit_logs: AuditLogsResource) -> None:
self.list = to_raw_response_wrapper(
audit_logs.list,
)
self.export_chunk = to_custom_raw_response_wrapper(
audit_logs.export_chunk,
BinaryAPIResponse,
)


class AsyncAuditLogsResourceWithRawResponse:
Expand All @@ -249,6 +432,10 @@ def __init__(self, audit_logs: AsyncAuditLogsResource) -> None:
self.list = async_to_raw_response_wrapper(
audit_logs.list,
)
self.export_chunk = async_to_custom_raw_response_wrapper(
audit_logs.export_chunk,
AsyncBinaryAPIResponse,
)


class AuditLogsResourceWithStreamingResponse:
Expand All @@ -258,6 +445,10 @@ def __init__(self, audit_logs: AuditLogsResource) -> None:
self.list = to_streamed_response_wrapper(
audit_logs.list,
)
self.export_chunk = to_custom_streamed_response_wrapper(
audit_logs.export_chunk,
StreamedBinaryAPIResponse,
)


class AsyncAuditLogsResourceWithStreamingResponse:
Expand All @@ -267,3 +458,7 @@ def __init__(self, audit_logs: AsyncAuditLogsResource) -> None:
self.list = async_to_streamed_response_wrapper(
audit_logs.list,
)
self.export_chunk = async_to_custom_streamed_response_wrapper(
audit_logs.export_chunk,
AsyncStreamedBinaryAPIResponse,
)
1 change: 1 addition & 0 deletions src/kernel/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
from .browser_pool_release_params import BrowserPoolReleaseParams as BrowserPoolReleaseParams
from .deployment_retrieve_response import DeploymentRetrieveResponse as DeploymentRetrieveResponse
from .invocation_retrieve_response import InvocationRetrieveResponse as InvocationRetrieveResponse
from .audit_log_export_chunk_params import AuditLogExportChunkParams as AuditLogExportChunkParams
from .browser_pool_acquire_response import BrowserPoolAcquireResponse as BrowserPoolAcquireResponse
from .credential_totp_code_response import CredentialTotpCodeResponse as CredentialTotpCodeResponse
from .browser_load_extensions_params import BrowserLoadExtensionsParams as BrowserLoadExtensionsParams
Expand Down
47 changes: 47 additions & 0 deletions src/kernel/types/audit_log_export_chunk_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Union
from datetime import datetime
from typing_extensions import Literal, Required, Annotated, TypedDict

from .._types import SequenceNotStr
from .._utils import PropertyInfo

__all__ = ["AuditLogExportChunkParams"]


class AuditLogExportChunkParams(TypedDict, total=False):
end: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]]
"""Upper bound (exclusive) for the audit record timestamp."""

start: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]]
"""Lower bound (inclusive) for the audit record timestamp."""

auth_strategy: str
"""Filter by authentication strategy."""

cursor: str
"""Opaque cursor from X-Next-Cursor for the next chunk of older records."""

exclude_method: str
"""Filter out results by HTTP method."""

format: Literal["jsonl", "jsonl.gz"]
"""Encoding for the returned chunk."""

limit: int
"""Maximum number of records to return in this chunk."""

method: str
"""Filter by HTTP method."""

search: str
"""Free-text search over path, user ID, email, client IP, and status."""

search_user_id: SequenceNotStr[str]
"""Additional user IDs to OR into free-text search."""

service: str
"""Filter by service name."""
Loading
Loading