Skip to content
Open
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
1 change: 1 addition & 0 deletions scripts/_proto/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ VOLUME ["/api_new", "/bridge_new"]
COPY ./ ./

RUN mkdir -p ./temporalio/api
RUN uv remove google-adk --optional google-adk
RUN uv add "protobuf<4"
RUN uv sync --all-extras
RUN uv run scripts/gen_protos.py
Expand Down
16 changes: 15 additions & 1 deletion scripts/gen_protos.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
partial(
re.compile(r"from dependencies\.").sub, r"from temporalio.api.dependencies."
),
partial(
re.compile(r"from protoc_gen_openapiv2\.").sub,
r"from temporalio.api.dependencies.protoc_gen_openapiv2.",
),
partial(
re.compile(r"from temporal\.sdk\.core\.").sub, r"from temporalio.bridge.proto."
),
Expand All @@ -50,6 +54,10 @@

pyi_fixes = [
partial(re.compile(r"temporal\.api\.").sub, r"temporalio.api."),
partial(
re.compile(r"protoc_gen_openapiv2\.").sub,
r"temporalio.api.dependencies.protoc_gen_openapiv2.",
),
partial(re.compile(r"temporal\.sdk\.core\.").sub, r"temporalio.bridge.proto."),
]

Expand Down Expand Up @@ -163,6 +171,7 @@ def generate_protos(output_dir: Path):
f"--proto_path={core_proto_dir}",
f"--proto_path={testsrv_proto_dir}",
f"--proto_path={health_proto_dir}",
f"--proto_path={proto_dir}",
f"--proto_path={test_proto_dir}",
f"--proto_path={additional_proto_dir}",
f"--python_out={output_dir}",
Expand All @@ -182,11 +191,16 @@ def generate_protos(output_dir: Path):
grpc_file.unlink()
# Apply fixes before moving code
fix_generated_output(output_dir)
# Move openapiv2 dependency protos
deps_out_dir = api_out_dir / "dependencies"
shutil.rmtree(deps_out_dir / "protoc_gen_openapiv2", ignore_errors=True)
deps_out_dir.mkdir(exist_ok=True)
(output_dir / "protoc_gen_openapiv2").replace(deps_out_dir / "protoc_gen_openapiv2")
(deps_out_dir / "__init__.py").touch()
# Move protos
for p in (output_dir / "temporal" / "api").iterdir():
shutil.rmtree(api_out_dir / p.name, ignore_errors=True)
p.replace(api_out_dir / p.name)
shutil.rmtree(api_out_dir / "dependencies", ignore_errors=True)
for p in (output_dir / "temporal" / "sdk" / "core").iterdir():
shutil.rmtree(sdk_out_dir / p.name, ignore_errors=True)
p.replace(sdk_out_dir / p.name)
Expand Down
10 changes: 9 additions & 1 deletion temporalio/api/cloud/account/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
from .message_pb2 import Account, AccountSpec, AuditLogSinkSpec, Metrics, MetricsSpec
from .message_pb2 import (
Account,
AccountSpec,
AuditLogSink,
AuditLogSinkSpec,
Metrics,
MetricsSpec,
)

__all__ = [
"Account",
"AccountSpec",
"AuditLogSink",
"AuditLogSinkSpec",
"Metrics",
"MetricsSpec",
Expand Down
41 changes: 30 additions & 11 deletions temporalio/api/cloud/account/v1/message_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 101 additions & 1 deletion temporalio/api/cloud/account/v1/message_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ isort:skip_file

import builtins
import sys
import typing

import google.protobuf.descriptor
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import google.protobuf.timestamp_pb2

import temporalio.api.cloud.resource.v1.message_pb2
import temporalio.api.cloud.sink.v1.message_pb2

if sys.version_info >= (3, 8):
if sys.version_info >= (3, 10):
import typing as typing_extensions
else:
import typing_extensions
Expand Down Expand Up @@ -200,3 +203,100 @@ class AuditLogSinkSpec(google.protobuf.message.Message):
) -> typing_extensions.Literal["kinesis_sink", "pub_sub_sink"] | None: ...

global___AuditLogSinkSpec = AuditLogSinkSpec

class AuditLogSink(google.protobuf.message.Message):
"""AuditLogSink is only used by Audit Log"""

DESCRIPTOR: google.protobuf.descriptor.Descriptor

class _Health:
ValueType = typing.NewType("ValueType", builtins.int)
V: typing_extensions.TypeAlias = ValueType

class _HealthEnumTypeWrapper(
google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[
AuditLogSink._Health.ValueType
],
builtins.type,
): # noqa: F821
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
HEALTH_UNSPECIFIED: AuditLogSink._Health.ValueType # 0
HEALTH_OK: AuditLogSink._Health.ValueType # 1
"""The audit log sink is healthy and functioning correctly."""
HEALTH_ERROR_INTERNAL: AuditLogSink._Health.ValueType # 2
"""The audit log sink has an internal error."""
HEALTH_ERROR_USER_CONFIGURATION: AuditLogSink._Health.ValueType # 3
"""The audit log sink has a configuration error."""

class Health(_Health, metaclass=_HealthEnumTypeWrapper):
"""The health status of the audit log sink."""

HEALTH_UNSPECIFIED: AuditLogSink.Health.ValueType # 0
HEALTH_OK: AuditLogSink.Health.ValueType # 1
"""The audit log sink is healthy and functioning correctly."""
HEALTH_ERROR_INTERNAL: AuditLogSink.Health.ValueType # 2
"""The audit log sink has an internal error."""
HEALTH_ERROR_USER_CONFIGURATION: AuditLogSink.Health.ValueType # 3
"""The audit log sink has a configuration error."""

NAME_FIELD_NUMBER: builtins.int
RESOURCE_VERSION_FIELD_NUMBER: builtins.int
STATE_FIELD_NUMBER: builtins.int
SPEC_FIELD_NUMBER: builtins.int
HEALTH_FIELD_NUMBER: builtins.int
ERROR_MESSAGE_FIELD_NUMBER: builtins.int
LAST_SUCCEEDED_TIME_FIELD_NUMBER: builtins.int
name: builtins.str
"""Name of the sink e.g. "audit_log_01" """
resource_version: builtins.str
"""The version of the audit log sink resource."""
state: temporalio.api.cloud.resource.v1.message_pb2.ResourceState.ValueType
"""The current state of the audit log sink."""
@property
def spec(self) -> global___AuditLogSinkSpec:
"""The specification details of the audit log sink."""
health: global___AuditLogSink.Health.ValueType
"""The health status of the audit log sink."""
error_message: builtins.str
"""An error message describing any issues with the audit log sink, if applicable."""
@property
def last_succeeded_time(self) -> google.protobuf.timestamp_pb2.Timestamp:
"""The last succeeded timestamp for the internal workflow responsible for adding data to the sink."""
def __init__(
self,
*,
name: builtins.str = ...,
resource_version: builtins.str = ...,
state: temporalio.api.cloud.resource.v1.message_pb2.ResourceState.ValueType = ...,
spec: global___AuditLogSinkSpec | None = ...,
health: global___AuditLogSink.Health.ValueType = ...,
error_message: builtins.str = ...,
last_succeeded_time: google.protobuf.timestamp_pb2.Timestamp | None = ...,
) -> None: ...
def HasField(
self,
field_name: typing_extensions.Literal[
"last_succeeded_time", b"last_succeeded_time", "spec", b"spec"
],
) -> builtins.bool: ...
def ClearField(
self,
field_name: typing_extensions.Literal[
"error_message",
b"error_message",
"health",
b"health",
"last_succeeded_time",
b"last_succeeded_time",
"name",
b"name",
"resource_version",
b"resource_version",
"spec",
b"spec",
"state",
b"state",
],
) -> None: ...

global___AuditLogSink = AuditLogSink
Empty file.
6 changes: 6 additions & 0 deletions temporalio/api/cloud/auditlog/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .message_pb2 import LogRecord, Principal

__all__ = [
"LogRecord",
"Principal",
]
56 changes: 56 additions & 0 deletions temporalio/api/cloud/auditlog/v1/message_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading