diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..a4005af --- /dev/null +++ b/.flake8 @@ -0,0 +1,6 @@ +[flake8] +max-line-length = 88 +extend-ignore = E203, W503 +per-file-ignores = + cloud_runtimes/__init__.py:F401,F403 + cloud_runtimes/types/__init__.py:F401,F403,F405 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e0c88f..bdbb669 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,3 +44,23 @@ jobs: run: python -m pip install --upgrade pip && python -m pip install -e '.[dev]' - name: Run mypy run: python -m mypy cloud_runtimes + + lint: + name: Format and lint + runs-on: ubuntu-latest + steps: + - name: Check out source + uses: actions/checkout@v7 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.11" + cache: pip + - name: Install development dependencies + run: python -m pip install --upgrade pip && python -m pip install -e '.[dev]' + - name: Check formatting and imports + run: | + python -m black --check cloud_runtimes tests + python -m isort --check-only cloud_runtimes tests + - name: Run flake8 + run: python -m flake8 cloud_runtimes tests diff --git a/README.md b/README.md index c6e3076..3ddeb14 100644 --- a/README.md +++ b/README.md @@ -80,10 +80,14 @@ New code should import `cloud_runtimes`, not the legacy top-level `api` package. ## Develop and verify +Runtime tests cover Python 3.8 and 3.11. Run the complete development toolchain +on Python 3.11; the pinned mypy range retains support for checking the Python +3.8 API target. + ```bash git clone https://github.com/capa-cloud/cloud-runtimes-python.git cd cloud-runtimes-python -python -m venv .venv +python3.11 -m venv .venv source .venv/bin/activate python -m pip install -e '.[dev]' python -m pytest -q @@ -93,7 +97,8 @@ isort --check-only cloud_runtimes tests flake8 cloud_runtimes tests ``` -CI currently verifies tests on Python 3.8 and 3.11 and runs mypy on Python 3.11. +CI verifies tests on Python 3.8 and 3.11, then runs mypy, Black, isort, and +flake8 on Python 3.11. When changing an interface: diff --git a/cloud_runtimes/__init__.py b/cloud_runtimes/__init__.py index 5741a7d..1b80701 100644 --- a/cloud_runtimes/__init__.py +++ b/cloud_runtimes/__init__.py @@ -10,10 +10,9 @@ from .types import * __version__ = "0.0.1" -__author__ = "group.rxcloud" -__email__ = "wshten@gmail.com" +__author__ = "Capa Cloud" __all__ = [ "CloudRuntimesClient", "CloudRuntimesException", -] \ No newline at end of file +] diff --git a/cloud_runtimes/client.py b/cloud_runtimes/client.py index 69a651d..d400644 100644 --- a/cloud_runtimes/client.py +++ b/cloud_runtimes/client.py @@ -6,207 +6,207 @@ from typing import Any, Optional, Type from .core import ( - BindingRuntimes, - ConfigurationRuntimes, - InvocationRuntimes, - PubSubRuntimes, - SecretsRuntimes, - StateRuntimes, + BindingRuntimes, + ConfigurationRuntimes, + InvocationRuntimes, + PubSubRuntimes, + SecretsRuntimes, + StateRuntimes, ) from .enhanced import ( - DatabaseRuntimes, - FileRuntimes, - LockRuntimes, - TelemetryRuntimes, + DatabaseRuntimes, + FileRuntimes, + LockRuntimes, + TelemetryRuntimes, ) from .native import ( - RedisRuntimes, - SqlRuntimes, - S3Runtimes, + RedisRuntimes, + S3Runtimes, + SqlRuntimes, ) from .saas import ( - EmailRuntimes, - SMSRuntimes, - EncryptionRuntimes, + EmailRuntimes, + EncryptionRuntimes, + SMSRuntimes, ) class CloudRuntimesClient: - """Main client for Cloud Runtimes API. - - This class provides interfaces for all runtime capabilities. - """ - - def __init__( - self, - endpoint: Optional[str] = None, - timeout: Optional[float] = None, - **kwargs: Any - ) -> None: - """Initialize the Cloud Runtimes client. - - Args: - endpoint: The Cloud Runtimes endpoint URL - timeout: Request timeout in seconds - **kwargs: Additional configuration options + """Main client for Cloud Runtimes API. + + This class provides interfaces for all runtime capabilities. """ - self.endpoint: str = endpoint or "http://localhost:3500" - self.timeout: float = timeout or 30.0 - self.config = kwargs - - # Initialize core runtime interfaces - self._invocation: Optional[InvocationRuntimes] = None - self._state: Optional[StateRuntimes] = None - self._configuration: Optional[ConfigurationRuntimes] = None - self._pubsub: Optional[PubSubRuntimes] = None - self._secrets: Optional[SecretsRuntimes] = None - self._binding: Optional[BindingRuntimes] = None - - # Initialize enhanced runtime interfaces - self._database: Optional[DatabaseRuntimes] = None - self._file: Optional[FileRuntimes] = None - self._lock: Optional[LockRuntimes] = None - self._telemetry: Optional[TelemetryRuntimes] = None - - # Initialize native runtime interfaces - self._redis: Optional[RedisRuntimes] = None - self._sql: Optional[SqlRuntimes] = None - self._s3: Optional[S3Runtimes] = None - - # Initialize saas runtime interfaces - self._email: Optional[EmailRuntimes] = None - self._sms: Optional[SMSRuntimes] = None - self._encryption: Optional[EncryptionRuntimes] = None - - @property - def invocation(self) -> InvocationRuntimes: - """Get the invocation runtime interface.""" - if self._invocation is None: - raise NotImplementedError("Invocation runtime not implemented") - return self._invocation - - @property - def state(self) -> StateRuntimes: - """Get the state runtime interface.""" - if self._state is None: - raise NotImplementedError("State runtime not implemented") - return self._state - - @property - def configuration(self) -> ConfigurationRuntimes: - """Get the configuration runtime interface.""" - if self._configuration is None: - raise NotImplementedError("Configuration runtime not implemented") - return self._configuration - - @property - def pubsub(self) -> PubSubRuntimes: - """Get the pub/sub runtime interface.""" - if self._pubsub is None: - raise NotImplementedError("PubSub runtime not implemented") - return self._pubsub - - @property - def secrets(self) -> SecretsRuntimes: - """Get the secrets runtime interface.""" - if self._secrets is None: - raise NotImplementedError("Secrets runtime not implemented") - return self._secrets - - @property - def binding(self) -> BindingRuntimes: - """Get the binding runtime interface.""" - if self._binding is None: - raise NotImplementedError("Binding runtime not implemented") - return self._binding - - # Enhanced runtime properties - @property - def database(self) -> DatabaseRuntimes: - """Get the database runtime interface.""" - if self._database is None: - raise NotImplementedError("Database runtime not implemented") - return self._database - - @property - def file(self) -> FileRuntimes: - """Get the file runtime interface.""" - if self._file is None: - raise NotImplementedError("File runtime not implemented") - return self._file - - @property - def lock(self) -> LockRuntimes: - """Get the lock runtime interface.""" - if self._lock is None: - raise NotImplementedError("Lock runtime not implemented") - return self._lock - - @property - def telemetry(self) -> TelemetryRuntimes: - """Get the telemetry runtime interface.""" - if self._telemetry is None: - raise NotImplementedError("Telemetry runtime not implemented") - return self._telemetry - - # Native runtime properties - @property - def redis(self) -> RedisRuntimes: - """Get the Redis runtime interface.""" - if self._redis is None: - raise NotImplementedError("Redis runtime not implemented") - return self._redis - - @property - def sql(self) -> SqlRuntimes: - """Get the SQL runtime interface.""" - if self._sql is None: - raise NotImplementedError("SQL runtime not implemented") - return self._sql - - @property - def s3(self) -> S3Runtimes: - """Get the S3 runtime interface.""" - if self._s3 is None: - raise NotImplementedError("S3 runtime not implemented") - return self._s3 - - # SaaS runtime properties - @property - def email(self) -> EmailRuntimes: - """Get the email runtime interface.""" - if self._email is None: - raise NotImplementedError("Email runtime not implemented") - return self._email - - @property - def sms(self) -> SMSRuntimes: - """Get the SMS runtime interface.""" - if self._sms is None: - raise NotImplementedError("SMS runtime not implemented") - return self._sms - - @property - def encryption(self) -> EncryptionRuntimes: - """Get the encryption runtime interface.""" - if self._encryption is None: - raise NotImplementedError("Encryption runtime not implemented") - return self._encryption - - async def close(self) -> None: - """Close the client and cleanup resources.""" - # Cleanup logic would go here - pass - - async def __aenter__(self) -> "CloudRuntimesClient": - """Async context manager entry.""" - return self - - async def __aexit__( - self, - exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType], - ) -> None: - """Async context manager exit.""" - await self.close() + + def __init__( + self, + endpoint: Optional[str] = None, + timeout: Optional[float] = None, + **kwargs: Any, + ) -> None: + """Initialize the Cloud Runtimes client. + + Args: + endpoint: The Cloud Runtimes endpoint URL + timeout: Request timeout in seconds + **kwargs: Additional configuration options + """ + self.endpoint: str = endpoint or "http://localhost:3500" + self.timeout: float = timeout or 30.0 + self.config = kwargs + + # Initialize core runtime interfaces + self._invocation: Optional[InvocationRuntimes] = None + self._state: Optional[StateRuntimes] = None + self._configuration: Optional[ConfigurationRuntimes] = None + self._pubsub: Optional[PubSubRuntimes] = None + self._secrets: Optional[SecretsRuntimes] = None + self._binding: Optional[BindingRuntimes] = None + + # Initialize enhanced runtime interfaces + self._database: Optional[DatabaseRuntimes] = None + self._file: Optional[FileRuntimes] = None + self._lock: Optional[LockRuntimes] = None + self._telemetry: Optional[TelemetryRuntimes] = None + + # Initialize native runtime interfaces + self._redis: Optional[RedisRuntimes] = None + self._sql: Optional[SqlRuntimes] = None + self._s3: Optional[S3Runtimes] = None + + # Initialize saas runtime interfaces + self._email: Optional[EmailRuntimes] = None + self._sms: Optional[SMSRuntimes] = None + self._encryption: Optional[EncryptionRuntimes] = None + + @property + def invocation(self) -> InvocationRuntimes: + """Get the invocation runtime interface.""" + if self._invocation is None: + raise NotImplementedError("Invocation runtime not implemented") + return self._invocation + + @property + def state(self) -> StateRuntimes: + """Get the state runtime interface.""" + if self._state is None: + raise NotImplementedError("State runtime not implemented") + return self._state + + @property + def configuration(self) -> ConfigurationRuntimes: + """Get the configuration runtime interface.""" + if self._configuration is None: + raise NotImplementedError("Configuration runtime not implemented") + return self._configuration + + @property + def pubsub(self) -> PubSubRuntimes: + """Get the pub/sub runtime interface.""" + if self._pubsub is None: + raise NotImplementedError("PubSub runtime not implemented") + return self._pubsub + + @property + def secrets(self) -> SecretsRuntimes: + """Get the secrets runtime interface.""" + if self._secrets is None: + raise NotImplementedError("Secrets runtime not implemented") + return self._secrets + + @property + def binding(self) -> BindingRuntimes: + """Get the binding runtime interface.""" + if self._binding is None: + raise NotImplementedError("Binding runtime not implemented") + return self._binding + + # Enhanced runtime properties + @property + def database(self) -> DatabaseRuntimes: + """Get the database runtime interface.""" + if self._database is None: + raise NotImplementedError("Database runtime not implemented") + return self._database + + @property + def file(self) -> FileRuntimes: + """Get the file runtime interface.""" + if self._file is None: + raise NotImplementedError("File runtime not implemented") + return self._file + + @property + def lock(self) -> LockRuntimes: + """Get the lock runtime interface.""" + if self._lock is None: + raise NotImplementedError("Lock runtime not implemented") + return self._lock + + @property + def telemetry(self) -> TelemetryRuntimes: + """Get the telemetry runtime interface.""" + if self._telemetry is None: + raise NotImplementedError("Telemetry runtime not implemented") + return self._telemetry + + # Native runtime properties + @property + def redis(self) -> RedisRuntimes: + """Get the Redis runtime interface.""" + if self._redis is None: + raise NotImplementedError("Redis runtime not implemented") + return self._redis + + @property + def sql(self) -> SqlRuntimes: + """Get the SQL runtime interface.""" + if self._sql is None: + raise NotImplementedError("SQL runtime not implemented") + return self._sql + + @property + def s3(self) -> S3Runtimes: + """Get the S3 runtime interface.""" + if self._s3 is None: + raise NotImplementedError("S3 runtime not implemented") + return self._s3 + + # SaaS runtime properties + @property + def email(self) -> EmailRuntimes: + """Get the email runtime interface.""" + if self._email is None: + raise NotImplementedError("Email runtime not implemented") + return self._email + + @property + def sms(self) -> SMSRuntimes: + """Get the SMS runtime interface.""" + if self._sms is None: + raise NotImplementedError("SMS runtime not implemented") + return self._sms + + @property + def encryption(self) -> EncryptionRuntimes: + """Get the encryption runtime interface.""" + if self._encryption is None: + raise NotImplementedError("Encryption runtime not implemented") + return self._encryption + + async def close(self) -> None: + """Close the client and cleanup resources.""" + # Cleanup logic would go here + pass + + async def __aenter__(self) -> "CloudRuntimesClient": + """Async context manager entry.""" + return self + + async def __aexit__( + self, + exc_type: Optional[Type[BaseException]], + exc_val: Optional[BaseException], + exc_tb: Optional[TracebackType], + ) -> None: + """Async context manager exit.""" + await self.close() diff --git a/cloud_runtimes/core/__init__.py b/cloud_runtimes/core/__init__.py index 5cf98f7..010311c 100644 --- a/cloud_runtimes/core/__init__.py +++ b/cloud_runtimes/core/__init__.py @@ -16,4 +16,4 @@ "PubSubRuntimes", "SecretsRuntimes", "BindingRuntimes", -] \ No newline at end of file +] diff --git a/cloud_runtimes/core/binding.py b/cloud_runtimes/core/binding.py index b2c69a0..39c71c7 100644 --- a/cloud_runtimes/core/binding.py +++ b/cloud_runtimes/core/binding.py @@ -3,7 +3,7 @@ """ from abc import ABC, abstractmethod -from typing import Any, Callable, Dict, List, Optional +from typing import Any, Callable, Dict, Optional from ..types.core import ( BindingEvent, @@ -26,16 +26,16 @@ async def invoke_binding( metadata: Optional[Dict[str, str]] = None, ) -> InvokeBindingResponse: """Invoke an external system through a binding. - + Args: binding_name: The name of the binding to invoke operation: The operation to perform on the binding data: Optional data to send with the binding invocation metadata: Optional metadata for the request - + Returns: InvokeBindingResponse containing the response from the external system - + Raises: CloudRuntimesError: If the binding invocation fails """ @@ -47,13 +47,13 @@ async def invoke_binding_with_request( request: InvokeBindingRequest, ) -> InvokeBindingResponse: """Invoke an external system using a structured request object. - + Args: request: InvokeBindingRequest containing all parameters - + Returns: InvokeBindingResponse containing the response from the external system - + Raises: CloudRuntimesError: If the binding invocation fails """ @@ -65,13 +65,13 @@ async def list_input_bindings( metadata: Optional[Dict[str, str]] = None, ) -> ListInputBindingsResponse: """List available input bindings. - + Args: metadata: Optional metadata for the request - + Returns: ListInputBindingsResponse containing available input bindings - + Raises: CloudRuntimesError: If listing input bindings fails """ @@ -83,13 +83,13 @@ async def list_output_bindings( metadata: Optional[Dict[str, str]] = None, ) -> ListOutputBindingsResponse: """List available output bindings. - + Args: metadata: Optional metadata for the request - + Returns: ListOutputBindingsResponse containing available output bindings - + Raises: CloudRuntimesError: If listing output bindings fails """ @@ -103,12 +103,12 @@ async def register_binding_event_handler( metadata: Optional[Dict[str, str]] = None, ) -> None: """Register an event handler for binding events. - + Args: binding_name: The name of the binding to handle events for handler: The event handler function metadata: Optional metadata for the registration - + Raises: CloudRuntimesError: If registering the handler fails """ @@ -121,11 +121,11 @@ async def unregister_binding_event_handler( metadata: Optional[Dict[str, str]] = None, ) -> None: """Unregister the event handler for a binding. - + Args: binding_name: The name of the binding to unregister handler for metadata: Optional metadata for the unregistration - + Raises: CloudRuntimesError: If unregistering the handler fails """ @@ -138,14 +138,14 @@ async def get_binding_metadata( metadata: Optional[Dict[str, str]] = None, ) -> Dict[str, Any]: """Get metadata for a specific binding. - + Args: binding_name: The name of the binding metadata: Optional metadata for the request - + Returns: Dictionary containing binding metadata - + Raises: CloudRuntimesError: If getting binding metadata fails """ @@ -158,14 +158,14 @@ async def check_binding_health( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Check the health status of a binding. - + Args: binding_name: The name of the binding to check metadata: Optional metadata for the request - + Returns: True if the binding is healthy, False otherwise - + Raises: CloudRuntimesError: If the health check fails """ @@ -181,17 +181,17 @@ async def invoke_binding_async( metadata: Optional[Dict[str, str]] = None, ) -> str: """Invoke a binding asynchronously. - + Args: binding_name: The name of the binding to invoke operation: The operation to perform on the binding data: Optional data to send with the binding invocation callback: Optional callback function for the response metadata: Optional metadata for the request - + Returns: Request ID for tracking the async operation - + Raises: CloudRuntimesError: If the async binding invocation fails """ @@ -204,14 +204,14 @@ async def get_binding_operation_result( metadata: Optional[Dict[str, str]] = None, ) -> Optional[InvokeBindingResponse]: """Get the result of an asynchronous binding operation. - + Args: request_id: The request ID returned from invoke_binding_async metadata: Optional metadata for the request - + Returns: InvokeBindingResponse if the operation is complete, None if still pending - + Raises: CloudRuntimesError: If getting the operation result fails """ @@ -224,15 +224,15 @@ async def cancel_binding_operation( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Cancel an asynchronous binding operation. - + Args: request_id: The request ID of the operation to cancel metadata: Optional metadata for the request - + Returns: True if the operation was successfully cancelled, False otherwise - + Raises: CloudRuntimesError: If cancelling the operation fails """ - pass \ No newline at end of file + pass diff --git a/cloud_runtimes/core/configuration.py b/cloud_runtimes/core/configuration.py index 19b4c12..25bfc31 100644 --- a/cloud_runtimes/core/configuration.py +++ b/cloud_runtimes/core/configuration.py @@ -3,7 +3,7 @@ """ from abc import ABC, abstractmethod -from typing import Any, Callable, Dict, List, Optional +from typing import Callable, Dict, List, Optional from ..types.core import ( ConfigurationItem, @@ -25,13 +25,13 @@ async def get_configuration( metadata: Optional[Dict[str, str]] = None, ) -> List[ConfigurationItem]: """Retrieve configuration from specified store. - + Args: store_name: The name of the configuration store app_id: The application ID keys: The configuration keys to retrieve metadata: Additional metadata - + Returns: List of configuration items """ @@ -47,14 +47,14 @@ async def get_configuration_with_group( metadata: Optional[Dict[str, str]] = None, ) -> List[ConfigurationItem]: """Retrieve configuration with group. - + Args: store_name: The name of the configuration store app_id: The application ID keys: The configuration keys to retrieve group: The configuration group metadata: Additional metadata - + Returns: List of configuration items """ @@ -71,7 +71,7 @@ async def get_configuration_with_group_and_label( metadata: Optional[Dict[str, str]] = None, ) -> List[ConfigurationItem]: """Retrieve configuration with group and label. - + Args: store_name: The name of the configuration store app_id: The application ID @@ -79,7 +79,7 @@ async def get_configuration_with_group_and_label( group: The configuration group label: The configuration label metadata: Additional metadata - + Returns: List of configuration items """ @@ -90,10 +90,10 @@ async def get_configuration_with_request( self, request: ConfigurationRequestItem ) -> List[ConfigurationItem]: """Retrieve configuration with full request object. - + Args: request: The configuration request - + Returns: List of configuration items """ @@ -102,7 +102,7 @@ async def get_configuration_with_request( @abstractmethod async def save_configuration(self, request: SaveConfigurationRequest) -> None: """Save configuration. - + Args: request: The save configuration request """ @@ -111,7 +111,7 @@ async def save_configuration(self, request: SaveConfigurationRequest) -> None: @abstractmethod async def delete_configuration(self, request: ConfigurationRequestItem) -> None: """Delete configuration. - + Args: request: The configuration request """ @@ -124,7 +124,7 @@ async def subscribe_configuration( handler: Callable[[SubConfigurationResp], None], ) -> None: """Subscribe to configuration changes. - + Args: request: The configuration request handler: The configuration change handler @@ -132,11 +132,9 @@ async def subscribe_configuration( pass @abstractmethod - async def unsubscribe_configuration( - self, store_name: str, app_id: str - ) -> None: + async def unsubscribe_configuration(self, store_name: str, app_id: str) -> None: """Unsubscribe from configuration changes. - + Args: store_name: The name of the configuration store app_id: The application ID @@ -153,16 +151,17 @@ def get_configuration_sync( ) -> List[ConfigurationItem]: """Synchronous version of get_configuration.""" import asyncio - return asyncio.run( - self.get_configuration(store_name, app_id, keys, metadata) - ) + + return asyncio.run(self.get_configuration(store_name, app_id, keys, metadata)) def save_configuration_sync(self, request: SaveConfigurationRequest) -> None: """Synchronous version of save_configuration.""" import asyncio + return asyncio.run(self.save_configuration(request)) def delete_configuration_sync(self, request: ConfigurationRequestItem) -> None: """Synchronous version of delete_configuration.""" import asyncio - return asyncio.run(self.delete_configuration(request)) \ No newline at end of file + + return asyncio.run(self.delete_configuration(request)) diff --git a/cloud_runtimes/core/invocation.py b/cloud_runtimes/core/invocation.py index 70e16a8..c243e68 100644 --- a/cloud_runtimes/core/invocation.py +++ b/cloud_runtimes/core/invocation.py @@ -9,7 +9,6 @@ HttpExtension, InvokeMethodRequest, InvokeMethodResponse, - MethodInfo, RegisterServerRequest, ) @@ -27,14 +26,14 @@ async def invoke_method( metadata: Optional[Dict[str, str]] = None, ) -> bytes: """Invoke a service method. - + Args: app_id: The Application ID where the service is method_name: The actual Method to be called in the application data: The request data to be sent http_extension: Additional HTTP fields metadata: Metadata to be sent in request - + Returns: Response data as bytes """ @@ -45,10 +44,10 @@ async def invoke_method_with_request( self, request: InvokeMethodRequest ) -> InvokeMethodResponse: """Invoke a service method with full request object. - + Args: request: The invoke method request - + Returns: The invoke method response """ @@ -65,7 +64,7 @@ async def invoke_method_typed( metadata: Optional[Dict[str, str]] = None, ) -> Any: """Invoke a service method with typed request and response. - + Args: app_id: The Application ID where the service is method_name: The actual Method to be called in the application @@ -73,7 +72,7 @@ async def invoke_method_typed( response_type: The expected response type http_extension: Additional HTTP fields metadata: Metadata to be sent in request - + Returns: Response data deserialized to response_type """ @@ -88,13 +87,13 @@ async def register_method( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Register a method handler. - + Args: method_name: The method name to register handler: The method handler function http_extensions: HTTP verbs supported metadata: Additional metadata - + Returns: True if registration successful """ @@ -103,10 +102,10 @@ async def register_method( @abstractmethod async def register_server(self, request: RegisterServerRequest) -> bool: """Register a server with multiple methods. - + Args: request: The register server request - + Returns: True if registration successful """ @@ -123,6 +122,7 @@ def invoke_method_sync( ) -> bytes: """Synchronous version of invoke_method.""" import asyncio + return asyncio.run( self.invoke_method(app_id, method_name, data, http_extension, metadata) ) @@ -132,6 +132,7 @@ def invoke_method_with_request_sync( ) -> InvokeMethodResponse: """Synchronous version of invoke_method_with_request.""" import asyncio + return asyncio.run(self.invoke_method_with_request(request)) def invoke_method_typed_sync( @@ -145,8 +146,9 @@ def invoke_method_typed_sync( ) -> Any: """Synchronous version of invoke_method_typed.""" import asyncio + return asyncio.run( self.invoke_method_typed( app_id, method_name, data, response_type, http_extension, metadata ) - ) \ No newline at end of file + ) diff --git a/cloud_runtimes/core/pubsub.py b/cloud_runtimes/core/pubsub.py index 6a13414..b77e73f 100644 --- a/cloud_runtimes/core/pubsub.py +++ b/cloud_runtimes/core/pubsub.py @@ -24,13 +24,13 @@ async def publish_event( metadata: Optional[Dict[str, str]] = None, ) -> str: """Publish data onto topic in specific pubsub component. - + Args: pubsub_name: The name of the pubsub component topic_name: The name of the topic data: The data to be published metadata: Additional metadata - + Returns: Message ID or empty string """ @@ -45,13 +45,13 @@ async def publish_event_from_custom_content( metadata: Optional[Dict[str, str]] = None, ) -> str: """Serialize an object and publish its contents as data (JSON) onto topic. - + Args: pubsub_name: The name of the pubsub component topic_name: The name of the topic data: The data to be serialized and published metadata: Additional metadata - + Returns: Message ID or empty string """ @@ -60,10 +60,10 @@ async def publish_event_from_custom_content( @abstractmethod async def publish_event_with_request(self, request: PublishEventRequest) -> str: """Publish event with full request object. - + Args: request: The publish event request - + Returns: Message ID or empty string """ @@ -76,7 +76,7 @@ async def subscribe_events( handler: Callable[[TopicEventRequest], None], ) -> None: """Subscribe to events from a topic. - + Args: subscription: The topic subscription handler: The event handler function @@ -84,11 +84,9 @@ async def subscribe_events( pass @abstractmethod - async def unsubscribe_events( - self, pubsub_name: str, topic_name: str - ) -> None: + async def unsubscribe_events(self, pubsub_name: str, topic_name: str) -> None: """Unsubscribe from events. - + Args: pubsub_name: The name of the pubsub component topic_name: The name of the topic @@ -105,9 +103,8 @@ def publish_event_sync( ) -> str: """Synchronous version of publish_event.""" import asyncio - return asyncio.run( - self.publish_event(pubsub_name, topic_name, data, metadata) - ) + + return asyncio.run(self.publish_event(pubsub_name, topic_name, data, metadata)) def publish_event_from_custom_content_sync( self, @@ -118,8 +115,9 @@ def publish_event_from_custom_content_sync( ) -> str: """Synchronous version of publish_event_from_custom_content.""" import asyncio + return asyncio.run( self.publish_event_from_custom_content( pubsub_name, topic_name, data, metadata ) - ) \ No newline at end of file + ) diff --git a/cloud_runtimes/core/secrets.py b/cloud_runtimes/core/secrets.py index c06b065..93ba68b 100644 --- a/cloud_runtimes/core/secrets.py +++ b/cloud_runtimes/core/secrets.py @@ -23,15 +23,15 @@ async def get_secret( metadata: Optional[Dict[str, str]] = None, ) -> SecretResponse: """Get secret from specified store. - + Args: store_name: The name of the secret store key: The key of the secret to retrieve metadata: Optional metadata for the request - + Returns: SecretResponse containing the secret data - + Raises: CloudRuntimesError: If the secret retrieval fails """ @@ -45,15 +45,15 @@ async def get_bulk_secret( metadata: Optional[Dict[str, str]] = None, ) -> Dict[str, SecretResponse]: """Get multiple secrets from specified store. - + Args: store_name: The name of the secret store keys: List of secret keys to retrieve metadata: Optional metadata for the request - + Returns: Dictionary mapping keys to SecretResponse objects - + Raises: CloudRuntimesError: If the bulk secret retrieval fails """ @@ -65,13 +65,13 @@ async def get_secret_with_request( request: GetSecretRequest, ) -> SecretResponse: """Get secret using a structured request object. - + Args: request: GetSecretRequest containing all parameters - + Returns: SecretResponse containing the secret data - + Raises: CloudRuntimesError: If the secret retrieval fails """ @@ -83,13 +83,13 @@ async def get_bulk_secret_with_request( request: GetBulkSecretRequest, ) -> Dict[str, SecretResponse]: """Get multiple secrets using a structured request object. - + Args: request: GetBulkSecretRequest containing all parameters - + Returns: Dictionary mapping keys to SecretResponse objects - + Raises: CloudRuntimesError: If the bulk secret retrieval fails """ @@ -101,13 +101,13 @@ async def list_secret_stores( metadata: Optional[Dict[str, str]] = None, ) -> List[str]: """List available secret stores. - + Args: metadata: Optional metadata for the request - + Returns: List of available secret store names - + Raises: CloudRuntimesError: If listing secret stores fails """ @@ -121,15 +121,15 @@ async def check_secret_exists( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Check if a secret exists in the specified store. - + Args: store_name: The name of the secret store key: The key of the secret to check metadata: Optional metadata for the request - + Returns: True if the secret exists, False otherwise - + Raises: CloudRuntimesError: If the existence check fails """ @@ -143,15 +143,15 @@ async def get_secret_metadata( metadata: Optional[Dict[str, str]] = None, ) -> Dict[str, str]: """Get metadata for a secret without retrieving the actual value. - + Args: store_name: The name of the secret store key: The key of the secret metadata: Optional metadata for the request - + Returns: Dictionary containing secret metadata - + Raises: CloudRuntimesError: If getting metadata fails """ @@ -165,16 +165,16 @@ async def list_secrets( metadata: Optional[Dict[str, str]] = None, ) -> List[str]: """List secret keys in the specified store. - + Args: store_name: The name of the secret store prefix: Optional prefix to filter secret keys metadata: Optional metadata for the request - + Returns: List of secret keys - + Raises: CloudRuntimesError: If listing secrets fails """ - pass \ No newline at end of file + pass diff --git a/cloud_runtimes/core/state.py b/cloud_runtimes/core/state.py index 0cbaad6..e9c2af2 100644 --- a/cloud_runtimes/core/state.py +++ b/cloud_runtimes/core/state.py @@ -13,7 +13,6 @@ GetBulkStateRequest, GetStateRequest, SaveStateRequest, - StateOperation, ) @@ -29,27 +28,25 @@ async def get_state( metadata: Optional[Dict[str, str]] = None, ) -> State[bytes]: """Retrieve a state based on key. - + Args: store_name: The name of the state store key: The key of the state to be retrieved options: Optional settings for retrieve operation metadata: Additional metadata - + Returns: The requested state """ pass @abstractmethod - async def get_state_with_request( - self, request: GetStateRequest - ) -> State[bytes]: + async def get_state_with_request(self, request: GetStateRequest) -> State[bytes]: """Retrieve a state with full request object. - + Args: request: The get state request - + Returns: The requested state """ @@ -65,14 +62,14 @@ async def get_state_typed( metadata: Optional[Dict[str, str]] = None, ) -> State[Any]: """Retrieve a state with typed value. - + Args: store_name: The name of the state store key: The key of the state to be retrieved value_type: The expected value type options: Optional settings for retrieve operation metadata: Additional metadata - + Returns: The requested state with typed value """ @@ -87,13 +84,13 @@ async def get_bulk_state( metadata: Optional[Dict[str, str]] = None, ) -> List[BulkStateItem]: """Retrieve bulk states based on keys. - + Args: store_name: The name of the state store keys: The keys of the states to be retrieved parallelism: Number of parallel operations metadata: Additional metadata - + Returns: List of requested states """ @@ -104,10 +101,10 @@ async def get_bulk_state_with_request( self, request: GetBulkStateRequest ) -> List[BulkStateItem]: """Retrieve bulk states with full request object. - + Args: request: The get bulk state request - + Returns: List of requested states """ @@ -124,7 +121,7 @@ async def save_state( metadata: Optional[Dict[str, str]] = None, ) -> None: """Save/Update a state. - + Args: store_name: The name of the state store key: The key of the state @@ -138,7 +135,7 @@ async def save_state( @abstractmethod async def save_bulk_state(self, request: SaveStateRequest) -> None: """Save/Update a list of states. - + Args: request: Request to save states """ @@ -154,7 +151,7 @@ async def delete_state( metadata: Optional[Dict[str, str]] = None, ) -> None: """Delete a state. - + Args: store_name: The name of the state store key: The key of the state to be removed @@ -167,7 +164,7 @@ async def delete_state( @abstractmethod async def delete_state_with_request(self, request: DeleteStateRequest) -> None: """Delete a state with full request object. - + Args: request: Request to delete a state """ @@ -178,7 +175,7 @@ async def execute_state_transaction( self, request: ExecuteStateTransactionRequest ) -> None: """Execute a transaction. - + Args: request: Request to execute transaction """ @@ -194,6 +191,7 @@ def get_state_sync( ) -> State[bytes]: """Synchronous version of get_state.""" import asyncio + return asyncio.run(self.get_state(store_name, key, options, metadata)) def save_state_sync( @@ -207,6 +205,7 @@ def save_state_sync( ) -> None: """Synchronous version of save_state.""" import asyncio + return asyncio.run( self.save_state(store_name, key, value, etag, options, metadata) ) @@ -221,6 +220,5 @@ def delete_state_sync( ) -> None: """Synchronous version of delete_state.""" import asyncio - return asyncio.run( - self.delete_state(store_name, key, etag, options, metadata) - ) \ No newline at end of file + + return asyncio.run(self.delete_state(store_name, key, etag, options, metadata)) diff --git a/cloud_runtimes/enhanced/__init__.py b/cloud_runtimes/enhanced/__init__.py index 20df714..23329c6 100644 --- a/cloud_runtimes/enhanced/__init__.py +++ b/cloud_runtimes/enhanced/__init__.py @@ -9,7 +9,7 @@ __all__ = [ "DatabaseRuntimes", - "FileRuntimes", + "FileRuntimes", "LockRuntimes", "TelemetryRuntimes", -] \ No newline at end of file +] diff --git a/cloud_runtimes/enhanced/database.py b/cloud_runtimes/enhanced/database.py index 95eda81..5c36a94 100644 --- a/cloud_runtimes/enhanced/database.py +++ b/cloud_runtimes/enhanced/database.py @@ -31,14 +31,14 @@ async def get_connection( metadata: Optional[Dict[str, str]] = None, ) -> GetConnectionResponse: """Get a database connection. - + Args: database_name: The name of the database metadata: Optional metadata for the request - + Returns: GetConnectionResponse containing connection information - + Raises: CloudRuntimesError: If getting connection fails """ @@ -50,13 +50,13 @@ async def get_connection_with_request( request: GetConnectionRequest, ) -> GetConnectionResponse: """Get a connection using a structured request object. - + Args: request: GetConnectionRequest containing all parameters - + Returns: GetConnectionResponse containing connection information - + Raises: CloudRuntimesError: If getting connection fails """ @@ -71,16 +71,16 @@ async def create_table( metadata: Optional[Dict[str, str]] = None, ) -> CreateTableResponse: """Create a database table. - + Args: database_name: The name of the database table_name: The name of the table to create schema: The table schema definition metadata: Optional metadata for the request - + Returns: CreateTableResponse containing creation result - + Raises: CloudRuntimesError: If table creation fails """ @@ -92,13 +92,13 @@ async def create_table_with_request( request: CreateTableRequest, ) -> CreateTableResponse: """Create a table using a structured request object. - + Args: request: CreateTableRequest containing all parameters - + Returns: CreateTableResponse containing creation result - + Raises: CloudRuntimesError: If table creation fails """ @@ -112,15 +112,15 @@ async def delete_table( metadata: Optional[Dict[str, str]] = None, ) -> DeleteTableResponse: """Delete a database table. - + Args: database_name: The name of the database table_name: The name of the table to delete metadata: Optional metadata for the request - + Returns: DeleteTableResponse containing deletion result - + Raises: CloudRuntimesError: If table deletion fails """ @@ -132,13 +132,13 @@ async def delete_table_with_request( request: DeleteTableRequest, ) -> DeleteTableResponse: """Delete a table using a structured request object. - + Args: request: DeleteTableRequest containing all parameters - + Returns: DeleteTableResponse containing deletion result - + Raises: CloudRuntimesError: If table deletion fails """ @@ -153,16 +153,16 @@ async def insert( metadata: Optional[Dict[str, str]] = None, ) -> InsertResponse: """Insert data into a database table. - + Args: database_name: The name of the database table_name: The name of the table data: The data to insert metadata: Optional metadata for the request - + Returns: InsertResponse containing insertion result - + Raises: CloudRuntimesError: If data insertion fails """ @@ -174,13 +174,13 @@ async def insert_with_request( request: InsertRequest, ) -> InsertResponse: """Insert data using a structured request object. - + Args: request: InsertRequest containing all parameters - + Returns: InsertResponse containing insertion result - + Raises: CloudRuntimesError: If data insertion fails """ @@ -195,16 +195,16 @@ async def insert_with_data( metadata: Optional[Dict[str, str]] = None, ) -> InsertResponse: """Insert data with automatic serialization. - + Args: database_name: The name of the database table_name: The name of the table data: The data object to insert (will be serialized) metadata: Optional metadata for the request - + Returns: InsertResponse containing insertion result - + Raises: CloudRuntimesError: If data insertion fails """ @@ -219,16 +219,16 @@ async def query( metadata: Optional[Dict[str, str]] = None, ) -> QueryResponse: """Query data from a database table. - + Args: database_name: The name of the database table_name: The name of the table query_filter: Optional filter conditions metadata: Optional metadata for the request - + Returns: QueryResponse containing query results - + Raises: CloudRuntimesError: If data query fails """ @@ -240,13 +240,13 @@ async def query_with_request( request: QueryRequest, ) -> QueryResponse: """Query data using a structured request object. - + Args: request: QueryRequest containing all parameters - + Returns: QueryResponse containing query results - + Raises: CloudRuntimesError: If data query fails """ @@ -261,16 +261,16 @@ async def query_with_data( metadata: Optional[Dict[str, str]] = None, ) -> QueryResponse: """Query data with automatic filter serialization. - + Args: database_name: The name of the database table_name: The name of the table data: The filter object (will be serialized) metadata: Optional metadata for the request - + Returns: QueryResponse containing query results - + Raises: CloudRuntimesError: If data query fails """ @@ -286,17 +286,17 @@ async def update( metadata: Optional[Dict[str, str]] = None, ) -> UpdateResponse: """Update data in a database table. - + Args: database_name: The name of the database table_name: The name of the table data: The data to update query_filter: Optional filter conditions metadata: Optional metadata for the request - + Returns: UpdateResponse containing update result - + Raises: CloudRuntimesError: If data update fails """ @@ -308,13 +308,13 @@ async def update_with_request( request: UpdateRequest, ) -> UpdateResponse: """Update data using a structured request object. - + Args: request: UpdateRequest containing all parameters - + Returns: UpdateResponse containing update result - + Raises: CloudRuntimesError: If data update fails """ @@ -329,16 +329,16 @@ async def update_with_data( metadata: Optional[Dict[str, str]] = None, ) -> UpdateResponse: """Update data with automatic serialization. - + Args: database_name: The name of the database table_name: The name of the table data: The data object to update (will be serialized) metadata: Optional metadata for the request - + Returns: UpdateResponse containing update result - + Raises: CloudRuntimesError: If data update fails """ @@ -351,14 +351,14 @@ async def begin_transaction( metadata: Optional[Dict[str, str]] = None, ) -> str: """Begin a database transaction. - + Args: database_name: The name of the database metadata: Optional metadata for the request - + Returns: Transaction ID - + Raises: CloudRuntimesError: If beginning transaction fails """ @@ -371,11 +371,11 @@ async def commit_transaction( metadata: Optional[Dict[str, str]] = None, ) -> None: """Commit a database transaction. - + Args: transaction_id: The transaction ID metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If committing transaction fails """ @@ -388,11 +388,11 @@ async def rollback_transaction( metadata: Optional[Dict[str, str]] = None, ) -> None: """Rollback a database transaction. - + Args: transaction_id: The transaction ID metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If rolling back transaction fails """ @@ -407,16 +407,16 @@ async def execute_sql( metadata: Optional[Dict[str, str]] = None, ) -> QueryResponse: """Execute raw SQL query. - + Args: database_name: The name of the database sql: The SQL query to execute parameters: Optional query parameters metadata: Optional metadata for the request - + Returns: QueryResponse containing query results - + Raises: CloudRuntimesError: If SQL execution fails """ @@ -429,14 +429,14 @@ async def list_tables( metadata: Optional[Dict[str, str]] = None, ) -> List[str]: """List all tables in a database. - + Args: database_name: The name of the database metadata: Optional metadata for the request - + Returns: List of table names - + Raises: CloudRuntimesError: If listing tables fails """ @@ -450,16 +450,16 @@ async def get_table_schema( metadata: Optional[Dict[str, str]] = None, ) -> Dict[str, Any]: """Get the schema of a table. - + Args: database_name: The name of the database table_name: The name of the table metadata: Optional metadata for the request - + Returns: Dictionary containing table schema - + Raises: CloudRuntimesError: If getting table schema fails """ - pass \ No newline at end of file + pass diff --git a/cloud_runtimes/enhanced/file.py b/cloud_runtimes/enhanced/file.py index c012fd4..677cb6b 100644 --- a/cloud_runtimes/enhanced/file.py +++ b/cloud_runtimes/enhanced/file.py @@ -3,14 +3,13 @@ """ from abc import ABC, abstractmethod -from typing import Any, AsyncIterator, BinaryIO, Dict, List, Optional +from typing import Any, AsyncIterator, Dict, Optional from ..types.enhanced import ( CopyFileRequest, CreateDirectoryRequest, DeleteDirectoryRequest, DeleteFileRequest, - FileEvent, GetFileRequest, GetFileResponse, ListFileRequest, @@ -34,14 +33,14 @@ async def get_file( metadata: Optional[Dict[str, str]] = None, ) -> GetFileResponse: """Get a file from the file system. - + Args: file_path: The path to the file metadata: Optional metadata for the request - + Returns: GetFileResponse containing file data and metadata - + Raises: CloudRuntimesError: If the file retrieval fails """ @@ -53,13 +52,13 @@ async def get_file_with_request( request: GetFileRequest, ) -> GetFileResponse: """Get a file using a structured request object. - + Args: request: GetFileRequest containing all parameters - + Returns: GetFileResponse containing file data and metadata - + Raises: CloudRuntimesError: If the file retrieval fails """ @@ -73,15 +72,15 @@ async def put_file( metadata: Optional[Dict[str, str]] = None, ) -> str: """Put a file to the file system. - + Args: file_path: The path where to store the file data: The file data as bytes metadata: Optional metadata for the file - + Returns: File ID or path of the stored file - + Raises: CloudRuntimesError: If the file storage fails """ @@ -93,13 +92,13 @@ async def put_file_with_request( request: PutFileRequest, ) -> str: """Put a file using a structured request object. - + Args: request: PutFileRequest containing all parameters - + Returns: File ID or path of the stored file - + Raises: CloudRuntimesError: If the file storage fails """ @@ -113,15 +112,15 @@ async def put_file_stream( metadata: Optional[Dict[str, str]] = None, ) -> str: """Put a file using streaming upload. - + Args: file_path: The path where to store the file stream: Async iterator of file data chunks metadata: Optional metadata for the file - + Returns: File ID or path of the stored file - + Raises: CloudRuntimesError: If the streaming upload fails """ @@ -135,15 +134,15 @@ async def list_files( metadata: Optional[Dict[str, str]] = None, ) -> ListFileResponse: """List files in a directory. - + Args: directory_path: The directory path to list recursive: Whether to list files recursively metadata: Optional metadata for the request - + Returns: ListFileResponse containing file information - + Raises: CloudRuntimesError: If listing files fails """ @@ -155,13 +154,13 @@ async def list_files_with_request( request: ListFileRequest, ) -> ListFileResponse: """List files using a structured request object. - + Args: request: ListFileRequest containing all parameters - + Returns: ListFileResponse containing file information - + Raises: CloudRuntimesError: If listing files fails """ @@ -174,11 +173,11 @@ async def delete_file( metadata: Optional[Dict[str, str]] = None, ) -> None: """Delete a file from the file system. - + Args: file_path: The path to the file to delete metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If the file deletion fails """ @@ -190,10 +189,10 @@ async def delete_file_with_request( request: DeleteFileRequest, ) -> None: """Delete a file using a structured request object. - + Args: request: DeleteFileRequest containing all parameters - + Raises: CloudRuntimesError: If the file deletion fails """ @@ -206,14 +205,14 @@ async def stat_file( metadata: Optional[Dict[str, str]] = None, ) -> StatFileResponse: """Get file metadata and statistics. - + Args: file_path: The path to the file metadata: Optional metadata for the request - + Returns: StatFileResponse containing file metadata - + Raises: CloudRuntimesError: If getting file stats fails """ @@ -225,13 +224,13 @@ async def stat_file_with_request( request: StatFileRequest, ) -> StatFileResponse: """Get file metadata using a structured request object. - + Args: request: StatFileRequest containing all parameters - + Returns: StatFileResponse containing file metadata - + Raises: CloudRuntimesError: If getting file stats fails """ @@ -245,12 +244,12 @@ async def copy_file( metadata: Optional[Dict[str, str]] = None, ) -> None: """Copy a file to a new location. - + Args: source_path: The source file path destination_path: The destination file path metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If the file copy fails """ @@ -262,10 +261,10 @@ async def copy_file_with_request( request: CopyFileRequest, ) -> None: """Copy a file using a structured request object. - + Args: request: CopyFileRequest containing all parameters - + Raises: CloudRuntimesError: If the file copy fails """ @@ -279,12 +278,12 @@ async def move_file( metadata: Optional[Dict[str, str]] = None, ) -> None: """Move a file to a new location. - + Args: source_path: The source file path destination_path: The destination file path metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If the file move fails """ @@ -296,10 +295,10 @@ async def move_file_with_request( request: MoveFileRequest, ) -> None: """Move a file using a structured request object. - + Args: request: MoveFileRequest containing all parameters - + Raises: CloudRuntimesError: If the file move fails """ @@ -313,12 +312,12 @@ async def create_directory( metadata: Optional[Dict[str, str]] = None, ) -> None: """Create a directory. - + Args: directory_path: The directory path to create recursive: Whether to create parent directories metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If directory creation fails """ @@ -330,10 +329,10 @@ async def create_directory_with_request( request: CreateDirectoryRequest, ) -> None: """Create a directory using a structured request object. - + Args: request: CreateDirectoryRequest containing all parameters - + Raises: CloudRuntimesError: If directory creation fails """ @@ -347,12 +346,12 @@ async def delete_directory( metadata: Optional[Dict[str, str]] = None, ) -> None: """Delete a directory. - + Args: directory_path: The directory path to delete recursive: Whether to delete directory contents metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If directory deletion fails """ @@ -364,10 +363,10 @@ async def delete_directory_with_request( request: DeleteDirectoryRequest, ) -> None: """Delete a directory using a structured request object. - + Args: request: DeleteDirectoryRequest containing all parameters - + Raises: CloudRuntimesError: If directory deletion fails """ @@ -381,12 +380,12 @@ async def set_file_permissions( metadata: Optional[Dict[str, str]] = None, ) -> None: """Set file permissions. - + Args: file_path: The path to the file permissions: The permissions string (e.g., "755", "rwxr-xr-x") metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If setting permissions fails """ @@ -398,10 +397,10 @@ async def set_file_permissions_with_request( request: SetFilePermissionsRequest, ) -> None: """Set file permissions using a structured request object. - + Args: request: SetFilePermissionsRequest containing all parameters - + Raises: CloudRuntimesError: If setting permissions fails """ @@ -415,15 +414,15 @@ async def watch_file( metadata: Optional[Dict[str, str]] = None, ) -> str: """Watch a file for changes. - + Args: file_path: The path to the file to watch callback: Callback function for file events metadata: Optional metadata for the request - + Returns: Watch ID for managing the watch - + Raises: CloudRuntimesError: If starting file watch fails """ @@ -436,14 +435,14 @@ async def watch_file_with_request( callback: Any, # Callable[[FileEvent], None] ) -> str: """Watch a file using a structured request object. - + Args: request: WatchFileRequest containing all parameters callback: Callback function for file events - + Returns: Watch ID for managing the watch - + Raises: CloudRuntimesError: If starting file watch fails """ @@ -456,12 +455,12 @@ async def stop_watching( metadata: Optional[Dict[str, str]] = None, ) -> None: """Stop watching a file. - + Args: watch_id: The watch ID returned from watch_file metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If stopping file watch fails """ - pass \ No newline at end of file + pass diff --git a/cloud_runtimes/enhanced/lock.py b/cloud_runtimes/enhanced/lock.py index 49e1b6e..abd81b5 100644 --- a/cloud_runtimes/enhanced/lock.py +++ b/cloud_runtimes/enhanced/lock.py @@ -24,15 +24,15 @@ async def try_lock( metadata: Optional[Dict[str, str]] = None, ) -> TryLockResponse: """Try to acquire a distributed lock. - + Args: lock_name: The name of the lock to acquire timeout_seconds: Optional timeout in seconds metadata: Optional metadata for the request - + Returns: TryLockResponse containing lock acquisition result - + Raises: CloudRuntimesError: If the lock operation fails """ @@ -44,13 +44,13 @@ async def try_lock_with_request( request: TryLockRequest, ) -> TryLockResponse: """Try to acquire a lock using a structured request object. - + Args: request: TryLockRequest containing all parameters - + Returns: TryLockResponse containing lock acquisition result - + Raises: CloudRuntimesError: If the lock operation fails """ @@ -64,15 +64,15 @@ async def unlock( metadata: Optional[Dict[str, str]] = None, ) -> UnlockResponse: """Release a distributed lock. - + Args: lock_name: The name of the lock to release lock_token: The token received when acquiring the lock metadata: Optional metadata for the request - + Returns: UnlockResponse containing unlock result - + Raises: CloudRuntimesError: If the unlock operation fails """ @@ -84,13 +84,13 @@ async def unlock_with_request( request: UnlockRequest, ) -> UnlockResponse: """Release a lock using a structured request object. - + Args: request: UnlockRequest containing all parameters - + Returns: UnlockResponse containing unlock result - + Raises: CloudRuntimesError: If the unlock operation fails """ @@ -105,16 +105,16 @@ async def try_lock_with_timeout( metadata: Optional[Dict[str, str]] = None, ) -> TryLockResponse: """Try to acquire a lock with specific timeout and lease duration. - + Args: lock_name: The name of the lock to acquire timeout_seconds: Timeout for acquiring the lock lease_duration_seconds: How long to hold the lock metadata: Optional metadata for the request - + Returns: TryLockResponse containing lock acquisition result - + Raises: CloudRuntimesError: If the lock operation fails """ @@ -129,16 +129,16 @@ async def renew_lock( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Renew a lock lease. - + Args: lock_name: The name of the lock lock_token: The token of the lock to renew lease_duration_seconds: New lease duration metadata: Optional metadata for the request - + Returns: True if the lock was successfully renewed - + Raises: CloudRuntimesError: If the lock renewal fails """ @@ -151,14 +151,14 @@ async def get_lock_status( metadata: Optional[Dict[str, str]] = None, ) -> Dict[str, str]: """Get the status of a lock. - + Args: lock_name: The name of the lock metadata: Optional metadata for the request - + Returns: Dictionary containing lock status information - + Raises: CloudRuntimesError: If getting lock status fails """ @@ -171,14 +171,14 @@ async def list_locks( metadata: Optional[Dict[str, str]] = None, ) -> List[str]: """List all locks, optionally filtered by prefix. - + Args: prefix: Optional prefix to filter lock names metadata: Optional metadata for the request - + Returns: List of lock names - + Raises: CloudRuntimesError: If listing locks fails """ @@ -191,14 +191,14 @@ async def force_unlock( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Force unlock a lock (admin operation). - + Args: lock_name: The name of the lock to force unlock metadata: Optional metadata for the request - + Returns: True if the lock was successfully force unlocked - + Raises: CloudRuntimesError: If force unlock fails """ @@ -211,15 +211,15 @@ async def is_locked( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Check if a lock is currently held. - + Args: lock_name: The name of the lock to check metadata: Optional metadata for the request - + Returns: True if the lock is currently held - + Raises: CloudRuntimesError: If checking lock status fails """ - pass \ No newline at end of file + pass diff --git a/cloud_runtimes/enhanced/telemetry.py b/cloud_runtimes/enhanced/telemetry.py index d010958..0ee48f2 100644 --- a/cloud_runtimes/enhanced/telemetry.py +++ b/cloud_runtimes/enhanced/telemetry.py @@ -28,14 +28,14 @@ async def with_trace_id( metadata: Optional[Dict[str, str]] = None, ) -> Dict[str, str]: """Add existing trace ID to the outgoing context. - + Args: trace_id: The trace ID to add metadata: Optional metadata for the request - + Returns: Updated context with trace ID - + Raises: CloudRuntimesError: If adding trace ID fails """ @@ -48,11 +48,11 @@ async def with_auth_token( metadata: Optional[Dict[str, str]] = None, ) -> None: """Set auth API token on the instantiated client. - + Args: token: The authentication token metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If setting auth token fails """ @@ -67,16 +67,16 @@ async def build_tracer( metadata: Optional[Dict[str, str]] = None, ) -> Any: """Build a tracer with the given name and optional version/schema. - + Args: tracer_name: The name of the tracer version: Optional version of the tracer schema_url: Optional schema URL metadata: Optional metadata for the request - + Returns: Tracer instance - + Raises: CloudRuntimesError: If building tracer fails """ @@ -88,13 +88,13 @@ async def get_context_propagators( metadata: Optional[Dict[str, str]] = None, ) -> Any: """Get context propagators. - + Args: metadata: Optional metadata for the request - + Returns: Context propagators instance - + Raises: CloudRuntimesError: If getting propagators fails """ @@ -109,16 +109,16 @@ async def build_meter( metadata: Optional[Dict[str, str]] = None, ) -> Any: """Build a meter with the given name and optional version/schema. - + Args: meter_name: The name of the meter version: Optional version of the meter schema_url: Optional schema URL metadata: Optional metadata for the request - + Returns: Meter instance - + Raises: CloudRuntimesError: If building meter fails """ @@ -135,7 +135,7 @@ async def record_metric( metadata: Optional[Dict[str, str]] = None, ) -> None: """Record a metric value. - + Args: name: The metric name value: The metric value @@ -143,7 +143,7 @@ async def record_metric( unit: Optional unit of measurement tags: Optional metric tags metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If recording metric fails """ @@ -155,10 +155,10 @@ async def record_metric_with_request( request: RecordMetricRequest, ) -> None: """Record a metric using a structured request object. - + Args: request: RecordMetricRequest containing all parameters - + Raises: CloudRuntimesError: If recording metric fails """ @@ -173,13 +173,13 @@ async def increment_counter( metadata: Optional[Dict[str, str]] = None, ) -> None: """Increment a counter metric. - + Args: name: The counter name value: The increment value (default 1.0) tags: Optional counter tags metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If incrementing counter fails """ @@ -191,10 +191,10 @@ async def increment_counter_with_request( request: IncrementCounterRequest, ) -> None: """Increment a counter using a structured request object. - + Args: request: IncrementCounterRequest containing all parameters - + Raises: CloudRuntimesError: If incrementing counter fails """ @@ -210,14 +210,14 @@ async def record_histogram( metadata: Optional[Dict[str, str]] = None, ) -> None: """Record a histogram value. - + Args: name: The histogram name value: The histogram value unit: Optional unit of measurement tags: Optional histogram tags metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If recording histogram fails """ @@ -229,10 +229,10 @@ async def record_histogram_with_request( request: RecordHistogramRequest, ) -> None: """Record a histogram using a structured request object. - + Args: request: RecordHistogramRequest containing all parameters - + Raises: CloudRuntimesError: If recording histogram fails """ @@ -248,14 +248,14 @@ async def set_gauge( metadata: Optional[Dict[str, str]] = None, ) -> None: """Set a gauge metric value. - + Args: name: The gauge name value: The gauge value unit: Optional unit of measurement tags: Optional gauge tags metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If setting gauge fails """ @@ -267,10 +267,10 @@ async def set_gauge_with_request( request: SetGaugeRequest, ) -> None: """Set a gauge using a structured request object. - + Args: request: SetGaugeRequest containing all parameters - + Raises: CloudRuntimesError: If setting gauge fails """ @@ -287,7 +287,7 @@ async def get_metrics( metadata: Optional[Dict[str, str]] = None, ) -> GetMetricsResponse: """Get current metric values. - + Args: names: Optional list of metric names to retrieve prefix: Optional prefix to filter metrics @@ -295,10 +295,10 @@ async def get_metrics( start_time: Optional start time for time-based metrics end_time: Optional end time for time-based metrics metadata: Optional metadata for the request - + Returns: GetMetricsResponse containing metric data - + Raises: CloudRuntimesError: If getting metrics fails """ @@ -310,13 +310,13 @@ async def get_metrics_with_request( request: GetMetricsRequest, ) -> GetMetricsResponse: """Get metrics using a structured request object. - + Args: request: GetMetricsRequest containing all parameters - + Returns: GetMetricsResponse containing metric data - + Raises: CloudRuntimesError: If getting metrics fails """ @@ -333,7 +333,7 @@ async def create_span( metadata: Optional[Dict[str, str]] = None, ) -> CreateSpanResponse: """Create a new span. - + Args: operation_name: The name of the operation parent_span_id: Optional parent span ID @@ -341,10 +341,10 @@ async def create_span( start_time: Optional start time tags: Optional span tags metadata: Optional metadata for the request - + Returns: CreateSpanResponse containing span information - + Raises: CloudRuntimesError: If creating span fails """ @@ -356,13 +356,13 @@ async def create_span_with_request( request: CreateSpanRequest, ) -> CreateSpanResponse: """Create a span using a structured request object. - + Args: request: CreateSpanRequest containing all parameters - + Returns: CreateSpanResponse containing span information - + Raises: CloudRuntimesError: If creating span fails """ @@ -374,13 +374,13 @@ async def get_trace_context( metadata: Optional[Dict[str, str]] = None, ) -> TraceContext: """Get the current trace context. - + Args: metadata: Optional metadata for the request - + Returns: TraceContext containing current trace information - + Raises: CloudRuntimesError: If getting trace context fails """ @@ -393,14 +393,14 @@ async def inject_trace_context( metadata: Optional[Dict[str, str]] = None, ) -> Dict[str, str]: """Inject trace context into headers. - + Args: headers: The headers to inject trace context into metadata: Optional metadata for the request - + Returns: Updated headers with trace context - + Raises: CloudRuntimesError: If injecting trace context fails """ @@ -413,15 +413,15 @@ async def extract_trace_context( metadata: Optional[Dict[str, str]] = None, ) -> TraceContext: """Extract trace context from headers. - + Args: headers: The headers to extract trace context from metadata: Optional metadata for the request - + Returns: TraceContext extracted from headers - + Raises: CloudRuntimesError: If extracting trace context fails """ - pass \ No newline at end of file + pass diff --git a/cloud_runtimes/exceptions.py b/cloud_runtimes/exceptions.py index 03d8f95..2a2df2c 100644 --- a/cloud_runtimes/exceptions.py +++ b/cloud_runtimes/exceptions.py @@ -15,7 +15,7 @@ def __init__( details: Optional[Dict[str, Any]] = None, ) -> None: """Initialize CloudRuntimesException. - + Args: code: Error code message: Error message @@ -91,4 +91,4 @@ def __init__(self, message: str, details: Optional[Dict[str, Any]] = None) -> No ERROR_CODE_SYSTEM = "CR_SYSTEM_ERROR" ERROR_CODE_TIMEOUT = "CR_TIMEOUT_ERROR" ERROR_CODE_NOT_FOUND = "CR_NOT_FOUND_ERROR" -ERROR_CODE_CONFLICT = "CR_CONFLICT_ERROR" \ No newline at end of file +ERROR_CODE_CONFLICT = "CR_CONFLICT_ERROR" diff --git a/cloud_runtimes/native/__init__.py b/cloud_runtimes/native/__init__.py index cb61d98..a352905 100644 --- a/cloud_runtimes/native/__init__.py +++ b/cloud_runtimes/native/__init__.py @@ -3,11 +3,11 @@ """ from .redis import RedisRuntimes -from .sql import SqlRuntimes from .s3 import S3Runtimes +from .sql import SqlRuntimes __all__ = [ "RedisRuntimes", - "SqlRuntimes", + "SqlRuntimes", "S3Runtimes", -] \ No newline at end of file +] diff --git a/cloud_runtimes/native/redis.py b/cloud_runtimes/native/redis.py index 32334b8..aa5c47d 100644 --- a/cloud_runtimes/native/redis.py +++ b/cloud_runtimes/native/redis.py @@ -3,8 +3,8 @@ """ from abc import ABC, abstractmethod -from typing import Any, Dict, List, Optional, Union from datetime import timedelta +from typing import Any, Dict, List, Optional, Union from ..types.native import ( RedisExecuteRequest, @@ -23,14 +23,14 @@ async def redis_get( metadata: Optional[Dict[str, str]] = None, ) -> Optional[str]: """Get value by key. - + Args: key: The key to get metadata: Optional metadata for the request - + Returns: The value or None if key doesn't exist - + Raises: CloudRuntimesError: If the operation fails """ @@ -45,16 +45,16 @@ async def redis_set( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Set key-value pair with optional expiration. - + Args: key: The key to set value: The value to set expire: Optional expiration time metadata: Optional metadata for the request - + Returns: True if successful - + Raises: CloudRuntimesError: If the operation fails """ @@ -67,14 +67,14 @@ async def redis_del( metadata: Optional[Dict[str, str]] = None, ) -> int: """Delete one or more keys. - + Args: *keys: The keys to delete metadata: Optional metadata for the request - + Returns: Number of keys deleted - + Raises: CloudRuntimesError: If the operation fails """ @@ -87,14 +87,14 @@ async def redis_exists( metadata: Optional[Dict[str, str]] = None, ) -> int: """Check if keys exist. - + Args: *keys: The keys to check metadata: Optional metadata for the request - + Returns: Number of keys that exist - + Raises: CloudRuntimesError: If the operation fails """ @@ -108,15 +108,15 @@ async def redis_expire( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Set expiration for key. - + Args: key: The key to set expiration for expire: The expiration time metadata: Optional metadata for the request - + Returns: True if expiration was set - + Raises: CloudRuntimesError: If the operation fails """ @@ -129,14 +129,14 @@ async def redis_ttl( metadata: Optional[Dict[str, str]] = None, ) -> Optional[timedelta]: """Get time to live for key. - + Args: key: The key to get TTL for metadata: Optional metadata for the request - + Returns: Time to live or None if key has no expiration - + Raises: CloudRuntimesError: If the operation fails """ @@ -149,14 +149,14 @@ async def redis_incr( metadata: Optional[Dict[str, str]] = None, ) -> int: """Increment value by 1. - + Args: key: The key to increment metadata: Optional metadata for the request - + Returns: The new value after increment - + Raises: CloudRuntimesError: If the operation fails """ @@ -170,15 +170,15 @@ async def redis_incr_by( metadata: Optional[Dict[str, str]] = None, ) -> int: """Increment value by specified amount. - + Args: key: The key to increment value: The amount to increment by metadata: Optional metadata for the request - + Returns: The new value after increment - + Raises: CloudRuntimesError: If the operation fails """ @@ -191,14 +191,14 @@ async def redis_decr( metadata: Optional[Dict[str, str]] = None, ) -> int: """Decrement value by 1. - + Args: key: The key to decrement metadata: Optional metadata for the request - + Returns: The new value after decrement - + Raises: CloudRuntimesError: If the operation fails """ @@ -212,15 +212,15 @@ async def redis_decr_by( metadata: Optional[Dict[str, str]] = None, ) -> int: """Decrement value by specified amount. - + Args: key: The key to decrement value: The amount to decrement by metadata: Optional metadata for the request - + Returns: The new value after decrement - + Raises: CloudRuntimesError: If the operation fails """ @@ -235,15 +235,15 @@ async def redis_hget( metadata: Optional[Dict[str, str]] = None, ) -> Optional[str]: """Get hash field value. - + Args: key: The hash key field: The field name metadata: Optional metadata for the request - + Returns: The field value or None if field doesn't exist - + Raises: CloudRuntimesError: If the operation fails """ @@ -258,16 +258,16 @@ async def redis_hset( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Set hash field value. - + Args: key: The hash key field: The field name value: The field value metadata: Optional metadata for the request - + Returns: True if field was created, False if updated - + Raises: CloudRuntimesError: If the operation fails """ @@ -280,14 +280,14 @@ async def redis_hget_all( metadata: Optional[Dict[str, str]] = None, ) -> Dict[str, str]: """Get all hash fields and values. - + Args: key: The hash key metadata: Optional metadata for the request - + Returns: Dictionary of field-value pairs - + Raises: CloudRuntimesError: If the operation fails """ @@ -301,15 +301,15 @@ async def redis_hdel( metadata: Optional[Dict[str, str]] = None, ) -> int: """Delete hash fields. - + Args: key: The hash key *fields: The field names to delete metadata: Optional metadata for the request - + Returns: Number of fields deleted - + Raises: CloudRuntimesError: If the operation fails """ @@ -324,15 +324,15 @@ async def redis_lpush( metadata: Optional[Dict[str, str]] = None, ) -> int: """Push elements to the head of list. - + Args: key: The list key *values: The values to push metadata: Optional metadata for the request - + Returns: The new length of the list - + Raises: CloudRuntimesError: If the operation fails """ @@ -346,15 +346,15 @@ async def redis_rpush( metadata: Optional[Dict[str, str]] = None, ) -> int: """Push elements to the tail of list. - + Args: key: The list key *values: The values to push metadata: Optional metadata for the request - + Returns: The new length of the list - + Raises: CloudRuntimesError: If the operation fails """ @@ -367,14 +367,14 @@ async def redis_lpop( metadata: Optional[Dict[str, str]] = None, ) -> Optional[str]: """Pop element from the head of list. - + Args: key: The list key metadata: Optional metadata for the request - + Returns: The popped element or None if list is empty - + Raises: CloudRuntimesError: If the operation fails """ @@ -387,14 +387,14 @@ async def redis_rpop( metadata: Optional[Dict[str, str]] = None, ) -> Optional[str]: """Pop element from the tail of list. - + Args: key: The list key metadata: Optional metadata for the request - + Returns: The popped element or None if list is empty - + Raises: CloudRuntimesError: If the operation fails """ @@ -407,14 +407,14 @@ async def redis_llen( metadata: Optional[Dict[str, str]] = None, ) -> int: """Get list length. - + Args: key: The list key metadata: Optional metadata for the request - + Returns: The length of the list - + Raises: CloudRuntimesError: If the operation fails """ @@ -429,15 +429,15 @@ async def redis_sadd( metadata: Optional[Dict[str, str]] = None, ) -> int: """Add members to set. - + Args: key: The set key *members: The members to add metadata: Optional metadata for the request - + Returns: Number of members added - + Raises: CloudRuntimesError: If the operation fails """ @@ -451,15 +451,15 @@ async def redis_srem( metadata: Optional[Dict[str, str]] = None, ) -> int: """Remove members from set. - + Args: key: The set key *members: The members to remove metadata: Optional metadata for the request - + Returns: Number of members removed - + Raises: CloudRuntimesError: If the operation fails """ @@ -472,14 +472,14 @@ async def redis_smembers( metadata: Optional[Dict[str, str]] = None, ) -> List[str]: """Get all members of set. - + Args: key: The set key metadata: Optional metadata for the request - + Returns: List of set members - + Raises: CloudRuntimesError: If the operation fails """ @@ -493,15 +493,15 @@ async def redis_sismember( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Check if member is in set. - + Args: key: The set key member: The member to check metadata: Optional metadata for the request - + Returns: True if member is in set - + Raises: CloudRuntimesError: If the operation fails """ @@ -516,15 +516,15 @@ async def redis_zadd( metadata: Optional[Dict[str, str]] = None, ) -> int: """Add members to sorted set. - + Args: key: The sorted set key *members: The members with scores to add metadata: Optional metadata for the request - + Returns: Number of members added - + Raises: CloudRuntimesError: If the operation fails """ @@ -538,15 +538,15 @@ async def redis_zrem( metadata: Optional[Dict[str, str]] = None, ) -> int: """Remove members from sorted set. - + Args: key: The sorted set key *members: The members to remove metadata: Optional metadata for the request - + Returns: Number of members removed - + Raises: CloudRuntimesError: If the operation fails """ @@ -562,17 +562,17 @@ async def redis_zrange( metadata: Optional[Dict[str, str]] = None, ) -> Union[List[str], List[RedisZMember]]: """Get members from sorted set by range. - + Args: key: The sorted set key start: Start index stop: Stop index with_scores: Whether to include scores metadata: Optional metadata for the request - + Returns: List of members or members with scores - + Raises: CloudRuntimesError: If the operation fails """ @@ -584,14 +584,14 @@ async def redis_execute( request: RedisExecuteRequest, ) -> RedisExecuteResponse: """Execute custom Redis command. - + Args: request: The Redis execute request - + Returns: The Redis execute response - + Raises: CloudRuntimesError: If the operation fails """ - pass \ No newline at end of file + pass diff --git a/cloud_runtimes/native/s3.py b/cloud_runtimes/native/s3.py index d021e22..df3129d 100644 --- a/cloud_runtimes/native/s3.py +++ b/cloud_runtimes/native/s3.py @@ -3,7 +3,7 @@ """ from abc import ABC, abstractmethod -from typing import Any, AsyncIterator, Dict, List, Optional +from typing import AsyncIterator, Dict, Optional from ..types.native import ( S3CopyObjectRequest, @@ -37,16 +37,16 @@ async def s3_get_object( metadata: Optional[Dict[str, str]] = None, ) -> S3GetObjectResponse: """Get object from S3. - + Args: bucket: The S3 bucket name key: The object key version_id: Optional version ID metadata: Optional metadata for the request - + Returns: S3GetObjectResponse containing object data - + Raises: CloudRuntimesError: If getting object fails """ @@ -58,13 +58,13 @@ async def s3_get_object_with_request( request: S3GetObjectRequest, ) -> S3GetObjectResponse: """Get object using a structured request object. - + Args: request: S3GetObjectRequest containing all parameters - + Returns: S3GetObjectResponse containing object data - + Raises: CloudRuntimesError: If getting object fails """ @@ -79,16 +79,16 @@ async def s3_get_object_stream( metadata: Optional[Dict[str, str]] = None, ) -> AsyncIterator[bytes]: """Get object as a stream from S3. - + Args: bucket: The S3 bucket name key: The object key version_id: Optional version ID metadata: Optional metadata for the request - + Yields: Chunks of object data - + Raises: CloudRuntimesError: If getting object stream fails """ @@ -104,17 +104,17 @@ async def s3_put_object( metadata: Optional[Dict[str, str]] = None, ) -> S3PutObjectResponse: """Put object to S3. - + Args: bucket: The S3 bucket name key: The object key data: The object data content_type: Optional content type metadata: Optional metadata for the request - + Returns: S3PutObjectResponse containing put result - + Raises: CloudRuntimesError: If putting object fails """ @@ -126,13 +126,13 @@ async def s3_put_object_with_request( request: S3PutObjectRequest, ) -> S3PutObjectResponse: """Put object using a structured request object. - + Args: request: S3PutObjectRequest containing all parameters - + Returns: S3PutObjectResponse containing put result - + Raises: CloudRuntimesError: If putting object fails """ @@ -148,17 +148,17 @@ async def s3_put_object_stream( metadata: Optional[Dict[str, str]] = None, ) -> S3PutObjectResponse: """Put object using streaming upload to S3. - + Args: bucket: The S3 bucket name key: The object key stream: Async iterator of object data chunks content_type: Optional content type metadata: Optional metadata for the request - + Returns: S3PutObjectResponse containing put result - + Raises: CloudRuntimesError: If streaming upload fails """ @@ -173,13 +173,13 @@ async def s3_delete_object( metadata: Optional[Dict[str, str]] = None, ) -> None: """Delete object from S3. - + Args: bucket: The S3 bucket name key: The object key version_id: Optional version ID metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If deleting object fails """ @@ -191,10 +191,10 @@ async def s3_delete_object_with_request( request: S3DeleteObjectRequest, ) -> None: """Delete object using a structured request object. - + Args: request: S3DeleteObjectRequest containing all parameters - + Raises: CloudRuntimesError: If deleting object fails """ @@ -210,17 +210,17 @@ async def s3_list_objects( metadata: Optional[Dict[str, str]] = None, ) -> S3ListObjectsResponse: """List objects in S3 bucket. - + Args: bucket: The S3 bucket name prefix: Optional prefix to filter objects max_keys: Optional maximum number of keys to return continuation_token: Optional continuation token for pagination metadata: Optional metadata for the request - + Returns: S3ListObjectsResponse containing object list - + Raises: CloudRuntimesError: If listing objects fails """ @@ -232,13 +232,13 @@ async def s3_list_objects_with_request( request: S3ListObjectsRequest, ) -> S3ListObjectsResponse: """List objects using a structured request object. - + Args: request: S3ListObjectsRequest containing all parameters - + Returns: S3ListObjectsResponse containing object list - + Raises: CloudRuntimesError: If listing objects fails """ @@ -253,16 +253,16 @@ async def s3_head_object( metadata: Optional[Dict[str, str]] = None, ) -> S3HeadObjectResponse: """Get object metadata from S3. - + Args: bucket: The S3 bucket name key: The object key version_id: Optional version ID metadata: Optional metadata for the request - + Returns: S3HeadObjectResponse containing object metadata - + Raises: CloudRuntimesError: If getting object metadata fails """ @@ -274,13 +274,13 @@ async def s3_head_object_with_request( request: S3HeadObjectRequest, ) -> S3HeadObjectResponse: """Get object metadata using a structured request object. - + Args: request: S3HeadObjectRequest containing all parameters - + Returns: S3HeadObjectResponse containing object metadata - + Raises: CloudRuntimesError: If getting object metadata fails """ @@ -296,17 +296,17 @@ async def s3_copy_object( metadata: Optional[Dict[str, str]] = None, ) -> S3CopyObjectResponse: """Copy object in S3. - + Args: source_bucket: The source bucket name source_key: The source object key destination_bucket: The destination bucket name destination_key: The destination object key metadata: Optional metadata for the request - + Returns: S3CopyObjectResponse containing copy result - + Raises: CloudRuntimesError: If copying object fails """ @@ -318,13 +318,13 @@ async def s3_copy_object_with_request( request: S3CopyObjectRequest, ) -> S3CopyObjectResponse: """Copy object using a structured request object. - + Args: request: S3CopyObjectRequest containing all parameters - + Returns: S3CopyObjectResponse containing copy result - + Raises: CloudRuntimesError: If copying object fails """ @@ -338,12 +338,12 @@ async def s3_create_bucket( metadata: Optional[Dict[str, str]] = None, ) -> None: """Create S3 bucket. - + Args: bucket: The bucket name to create region: Optional region for the bucket metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If creating bucket fails """ @@ -355,10 +355,10 @@ async def s3_create_bucket_with_request( request: S3CreateBucketRequest, ) -> None: """Create bucket using a structured request object. - + Args: request: S3CreateBucketRequest containing all parameters - + Raises: CloudRuntimesError: If creating bucket fails """ @@ -371,11 +371,11 @@ async def s3_delete_bucket( metadata: Optional[Dict[str, str]] = None, ) -> None: """Delete S3 bucket. - + Args: bucket: The bucket name to delete metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If deleting bucket fails """ @@ -387,10 +387,10 @@ async def s3_delete_bucket_with_request( request: S3DeleteBucketRequest, ) -> None: """Delete bucket using a structured request object. - + Args: request: S3DeleteBucketRequest containing all parameters - + Raises: CloudRuntimesError: If deleting bucket fails """ @@ -402,13 +402,13 @@ async def s3_list_buckets( metadata: Optional[Dict[str, str]] = None, ) -> S3ListBucketsResponse: """List S3 buckets. - + Args: metadata: Optional metadata for the request - + Returns: S3ListBucketsResponse containing bucket list - + Raises: CloudRuntimesError: If listing buckets fails """ @@ -424,17 +424,17 @@ async def s3_get_presigned_url( metadata: Optional[Dict[str, str]] = None, ) -> S3GetPresignedURLResponse: """Get presigned URL for S3 object. - + Args: bucket: The S3 bucket name key: The object key method: HTTP method for the presigned URL expires_in: URL expiration time in seconds metadata: Optional metadata for the request - + Returns: S3GetPresignedURLResponse containing presigned URL - + Raises: CloudRuntimesError: If getting presigned URL fails """ @@ -446,14 +446,14 @@ async def s3_get_presigned_url_with_request( request: S3GetPresignedURLRequest, ) -> S3GetPresignedURLResponse: """Get presigned URL using a structured request object. - + Args: request: S3GetPresignedURLRequest containing all parameters - + Returns: S3GetPresignedURLResponse containing presigned URL - + Raises: CloudRuntimesError: If getting presigned URL fails """ - pass \ No newline at end of file + pass diff --git a/cloud_runtimes/native/sql.py b/cloud_runtimes/native/sql.py index 71f632c..ad9dd2f 100644 --- a/cloud_runtimes/native/sql.py +++ b/cloud_runtimes/native/sql.py @@ -30,15 +30,15 @@ async def sql_execute( metadata: Optional[Dict[str, str]] = None, ) -> SqlExecuteResponse: """Execute SQL statement. - + Args: sql: The SQL statement to execute parameters: Optional parameters for the SQL statement metadata: Optional metadata for the request - + Returns: SqlExecuteResponse containing execution result - + Raises: CloudRuntimesError: If the SQL execution fails """ @@ -50,13 +50,13 @@ async def sql_execute_with_request( request: SqlExecuteRequest, ) -> SqlExecuteResponse: """Execute SQL statement using a structured request object. - + Args: request: SqlExecuteRequest containing all parameters - + Returns: SqlExecuteResponse containing execution result - + Raises: CloudRuntimesError: If the SQL execution fails """ @@ -70,15 +70,15 @@ async def sql_query( metadata: Optional[Dict[str, str]] = None, ) -> SqlQueryResponse: """Execute SQL query. - + Args: sql: The SQL query to execute parameters: Optional parameters for the SQL query metadata: Optional metadata for the request - + Returns: SqlQueryResponse containing query results - + Raises: CloudRuntimesError: If the SQL query fails """ @@ -90,13 +90,13 @@ async def sql_query_with_request( request: SqlQueryRequest, ) -> SqlQueryResponse: """Execute SQL query using a structured request object. - + Args: request: SqlQueryRequest containing all parameters - + Returns: SqlQueryResponse containing query results - + Raises: CloudRuntimesError: If the SQL query fails """ @@ -110,15 +110,15 @@ async def sql_query_row( metadata: Optional[Dict[str, str]] = None, ) -> SqlRowResponse: """Execute SQL query and return single row. - + Args: sql: The SQL query to execute parameters: Optional parameters for the SQL query metadata: Optional metadata for the request - + Returns: SqlRowResponse containing single row result - + Raises: CloudRuntimesError: If the SQL query fails """ @@ -130,13 +130,13 @@ async def sql_query_row_with_request( request: SqlQueryRequest, ) -> SqlRowResponse: """Execute SQL query for single row using a structured request object. - + Args: request: SqlQueryRequest containing all parameters - + Returns: SqlRowResponse containing single row result - + Raises: CloudRuntimesError: If the SQL query fails """ @@ -149,14 +149,14 @@ async def sql_begin_tx( metadata: Optional[Dict[str, str]] = None, ) -> SqlTxResponse: """Begin a transaction. - + Args: isolation_level: Optional transaction isolation level metadata: Optional metadata for the request - + Returns: SqlTxResponse containing transaction information - + Raises: CloudRuntimesError: If beginning transaction fails """ @@ -168,13 +168,13 @@ async def sql_begin_tx_with_request( request: SqlBeginTxRequest, ) -> SqlTxResponse: """Begin a transaction using a structured request object. - + Args: request: SqlBeginTxRequest containing all parameters - + Returns: SqlTxResponse containing transaction information - + Raises: CloudRuntimesError: If beginning transaction fails """ @@ -187,11 +187,11 @@ async def sql_commit_tx( metadata: Optional[Dict[str, str]] = None, ) -> None: """Commit a transaction. - + Args: tx_id: The transaction ID to commit metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If committing transaction fails """ @@ -204,11 +204,11 @@ async def sql_rollback_tx( metadata: Optional[Dict[str, str]] = None, ) -> None: """Roll back a transaction. - + Args: tx_id: The transaction ID to roll back metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If rolling back transaction fails """ @@ -221,14 +221,14 @@ async def sql_prepare( metadata: Optional[Dict[str, str]] = None, ) -> SqlPrepareResponse: """Prepare a SQL statement. - + Args: sql: The SQL statement to prepare metadata: Optional metadata for the request - + Returns: SqlPrepareResponse containing prepared statement information - + Raises: CloudRuntimesError: If preparing statement fails """ @@ -240,13 +240,13 @@ async def sql_prepare_with_request( request: SqlPrepareRequest, ) -> SqlPrepareResponse: """Prepare a SQL statement using a structured request object. - + Args: request: SqlPrepareRequest containing all parameters - + Returns: SqlPrepareResponse containing prepared statement information - + Raises: CloudRuntimesError: If preparing statement fails """ @@ -260,15 +260,15 @@ async def sql_execute_prepared( metadata: Optional[Dict[str, str]] = None, ) -> SqlExecuteResponse: """Execute a prepared statement. - + Args: stmt_id: The prepared statement ID parameters: Optional parameters for the prepared statement metadata: Optional metadata for the request - + Returns: SqlExecuteResponse containing execution result - + Raises: CloudRuntimesError: If executing prepared statement fails """ @@ -280,13 +280,13 @@ async def sql_execute_prepared_with_request( request: SqlExecutePreparedRequest, ) -> SqlExecuteResponse: """Execute a prepared statement using a structured request object. - + Args: request: SqlExecutePreparedRequest containing all parameters - + Returns: SqlExecuteResponse containing execution result - + Raises: CloudRuntimesError: If executing prepared statement fails """ @@ -299,11 +299,11 @@ async def sql_close_prepared( metadata: Optional[Dict[str, str]] = None, ) -> None: """Close a prepared statement. - + Args: stmt_id: The prepared statement ID to close metadata: Optional metadata for the request - + Raises: CloudRuntimesError: If closing prepared statement fails """ @@ -315,13 +315,13 @@ async def sql_get_connection_info( metadata: Optional[Dict[str, str]] = None, ) -> Dict[str, Any]: """Get database connection information. - + Args: metadata: Optional metadata for the request - + Returns: Dictionary containing connection information - + Raises: CloudRuntimesError: If getting connection info fails """ @@ -333,13 +333,13 @@ async def sql_ping( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Ping the database connection. - + Args: metadata: Optional metadata for the request - + Returns: True if connection is alive - + Raises: CloudRuntimesError: If ping fails """ @@ -352,15 +352,15 @@ async def sql_get_schema( metadata: Optional[Dict[str, str]] = None, ) -> Dict[str, Any]: """Get database or table schema information. - + Args: table_name: Optional table name to get schema for metadata: Optional metadata for the request - + Returns: Dictionary containing schema information - + Raises: CloudRuntimesError: If getting schema fails """ - pass \ No newline at end of file + pass diff --git a/cloud_runtimes/saas/__init__.py b/cloud_runtimes/saas/__init__.py index ce11dac..284ba21 100644 --- a/cloud_runtimes/saas/__init__.py +++ b/cloud_runtimes/saas/__init__.py @@ -3,11 +3,11 @@ """ from .email import EmailRuntimes -from .sms import SMSRuntimes from .encryption import EncryptionRuntimes +from .sms import SMSRuntimes __all__ = [ "EmailRuntimes", - "SMSRuntimes", + "SMSRuntimes", "EncryptionRuntimes", -] \ No newline at end of file +] diff --git a/cloud_runtimes/saas/email.py b/cloud_runtimes/saas/email.py index 5a0f75b..c0b4932 100644 --- a/cloud_runtimes/saas/email.py +++ b/cloud_runtimes/saas/email.py @@ -6,10 +6,10 @@ from typing import Dict, List, Optional from ..types.saas import ( + EmailStatusResponse, SendEmailRequest, SendEmailResponse, SendEmailTemplateRequest, - EmailStatusResponse, ) @@ -29,7 +29,7 @@ async def send_email( metadata: Optional[Dict[str, str]] = None, ) -> SendEmailResponse: """Send an email. - + Args: to: List of recipient email addresses subject: Email subject @@ -39,10 +39,10 @@ async def send_email( bcc: Optional BCC recipients html_body: Optional HTML body metadata: Optional metadata for the request - + Returns: SendEmailResponse containing send result - + Raises: CloudRuntimesError: If sending email fails """ @@ -54,13 +54,13 @@ async def send_email_with_request( request: SendEmailRequest, ) -> SendEmailResponse: """Send an email using a structured request object. - + Args: request: SendEmailRequest containing all parameters - + Returns: SendEmailResponse containing send result - + Raises: CloudRuntimesError: If sending email fails """ @@ -78,7 +78,7 @@ async def send_email_with_template( metadata: Optional[Dict[str, str]] = None, ) -> SendEmailResponse: """Send an email using a template. - + Args: to: List of recipient email addresses template_id: Template identifier @@ -87,10 +87,10 @@ async def send_email_with_template( cc: Optional CC recipients bcc: Optional BCC recipients metadata: Optional metadata for the request - + Returns: SendEmailResponse containing send result - + Raises: CloudRuntimesError: If sending email fails """ @@ -102,13 +102,13 @@ async def send_email_with_template_request( request: SendEmailTemplateRequest, ) -> SendEmailResponse: """Send an email with template using a structured request object. - + Args: request: SendEmailTemplateRequest containing all parameters - + Returns: SendEmailResponse containing send result - + Raises: CloudRuntimesError: If sending email fails """ @@ -121,14 +121,14 @@ async def get_email_status( metadata: Optional[Dict[str, str]] = None, ) -> EmailStatusResponse: """Get email sending status. - + Args: message_id: The message ID returned from send_email metadata: Optional metadata for the request - + Returns: EmailStatusResponse containing status information - + Raises: CloudRuntimesError: If getting email status fails """ @@ -141,14 +141,14 @@ async def send_bulk_email( metadata: Optional[Dict[str, str]] = None, ) -> List[SendEmailResponse]: """Send multiple emails in bulk. - + Args: emails: List of email requests to send metadata: Optional metadata for the request - + Returns: List of SendEmailResponse for each email - + Raises: CloudRuntimesError: If sending bulk emails fails """ @@ -161,14 +161,14 @@ async def validate_email_address( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Validate an email address. - + Args: email: The email address to validate metadata: Optional metadata for the request - + Returns: True if email address is valid - + Raises: CloudRuntimesError: If email validation fails """ @@ -180,13 +180,13 @@ async def get_email_templates( metadata: Optional[Dict[str, str]] = None, ) -> List[Dict[str, str]]: """Get available email templates. - + Args: metadata: Optional metadata for the request - + Returns: List of available email templates - + Raises: CloudRuntimesError: If getting templates fails """ @@ -202,17 +202,17 @@ async def create_email_template( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Create an email template. - + Args: template_id: Unique template identifier subject: Template subject (can contain variables) body: Template body (can contain variables) html_body: Optional HTML template body metadata: Optional metadata for the request - + Returns: True if template was created successfully - + Raises: CloudRuntimesError: If creating template fails """ @@ -225,15 +225,15 @@ async def delete_email_template( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Delete an email template. - + Args: template_id: Template identifier to delete metadata: Optional metadata for the request - + Returns: True if template was deleted successfully - + Raises: CloudRuntimesError: If deleting template fails """ - pass \ No newline at end of file + pass diff --git a/cloud_runtimes/saas/encryption.py b/cloud_runtimes/saas/encryption.py index 769888c..f259c9e 100644 --- a/cloud_runtimes/saas/encryption.py +++ b/cloud_runtimes/saas/encryption.py @@ -31,16 +31,16 @@ async def encrypt( metadata: Optional[Dict[str, str]] = None, ) -> EncryptResponse: """Encrypt data. - + Args: data: The data to encrypt algorithm: Encryption algorithm to use key: Optional encryption key (if not provided, a new key will be generated) metadata: Optional metadata for the request - + Returns: EncryptResponse containing encrypted data - + Raises: CloudRuntimesError: If encryption fails """ @@ -52,13 +52,13 @@ async def encrypt_with_request( request: EncryptRequest, ) -> EncryptResponse: """Encrypt data using a structured request object. - + Args: request: EncryptRequest containing all parameters - + Returns: EncryptResponse containing encrypted data - + Raises: CloudRuntimesError: If encryption fails """ @@ -73,16 +73,16 @@ async def decrypt( metadata: Optional[Dict[str, str]] = None, ) -> DecryptResponse: """Decrypt data. - + Args: encrypted_data: The encrypted data to decrypt key: The decryption key algorithm: Decryption algorithm to use metadata: Optional metadata for the request - + Returns: DecryptResponse containing decrypted data - + Raises: CloudRuntimesError: If decryption fails """ @@ -94,13 +94,13 @@ async def decrypt_with_request( request: DecryptRequest, ) -> DecryptResponse: """Decrypt data using a structured request object. - + Args: request: DecryptRequest containing all parameters - + Returns: DecryptResponse containing decrypted data - + Raises: CloudRuntimesError: If decryption fails """ @@ -114,15 +114,15 @@ async def generate_key( metadata: Optional[Dict[str, str]] = None, ) -> GenerateKeyResponse: """Generate encryption key. - + Args: algorithm: Key generation algorithm key_size: Optional key size in bits metadata: Optional metadata for the request - + Returns: GenerateKeyResponse containing generated key - + Raises: CloudRuntimesError: If key generation fails """ @@ -134,13 +134,13 @@ async def generate_key_with_request( request: GenerateKeyRequest, ) -> GenerateKeyResponse: """Generate key using a structured request object. - + Args: request: GenerateKeyRequest containing all parameters - + Returns: GenerateKeyResponse containing generated key - + Raises: CloudRuntimesError: If key generation fails """ @@ -155,16 +155,16 @@ async def hash_data( metadata: Optional[Dict[str, str]] = None, ) -> HashResponse: """Hash data. - + Args: data: The data to hash algorithm: Hashing algorithm to use salt: Optional salt for hashing metadata: Optional metadata for the request - + Returns: HashResponse containing hash result - + Raises: CloudRuntimesError: If hashing fails """ @@ -176,13 +176,13 @@ async def hash_data_with_request( request: HashRequest, ) -> HashResponse: """Hash data using a structured request object. - + Args: request: HashRequest containing all parameters - + Returns: HashResponse containing hash result - + Raises: CloudRuntimesError: If hashing fails """ @@ -198,17 +198,17 @@ async def verify_hash( metadata: Optional[Dict[str, str]] = None, ) -> VerifyHashResponse: """Verify hash. - + Args: data: The original data hash_value: The hash to verify against algorithm: Hashing algorithm used salt: Optional salt used in hashing metadata: Optional metadata for the request - + Returns: VerifyHashResponse containing verification result - + Raises: CloudRuntimesError: If hash verification fails """ @@ -220,13 +220,13 @@ async def verify_hash_with_request( request: VerifyHashRequest, ) -> VerifyHashResponse: """Verify hash using a structured request object. - + Args: request: VerifyHashRequest containing all parameters - + Returns: VerifyHashResponse containing verification result - + Raises: CloudRuntimesError: If hash verification fails """ @@ -239,14 +239,14 @@ async def generate_random_bytes( metadata: Optional[Dict[str, str]] = None, ) -> bytes: """Generate cryptographically secure random bytes. - + Args: length: Number of random bytes to generate metadata: Optional metadata for the request - + Returns: Random bytes - + Raises: CloudRuntimesError: If random generation fails """ @@ -259,14 +259,14 @@ async def generate_uuid( metadata: Optional[Dict[str, str]] = None, ) -> str: """Generate UUID. - + Args: version: UUID version (1, 4, or 5) metadata: Optional metadata for the request - + Returns: Generated UUID string - + Raises: CloudRuntimesError: If UUID generation fails """ @@ -281,16 +281,16 @@ async def sign_data( metadata: Optional[Dict[str, str]] = None, ) -> str: """Sign data with private key. - + Args: data: The data to sign private_key: The private key for signing algorithm: Signing algorithm to use metadata: Optional metadata for the request - + Returns: Base64 encoded signature - + Raises: CloudRuntimesError: If signing fails """ @@ -306,18 +306,18 @@ async def verify_signature( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Verify signature with public key. - + Args: data: The original data signature: Base64 encoded signature to verify public_key: The public key for verification algorithm: Signing algorithm used metadata: Optional metadata for the request - + Returns: True if signature is valid - + Raises: CloudRuntimesError: If signature verification fails """ - pass \ No newline at end of file + pass diff --git a/cloud_runtimes/saas/sms.py b/cloud_runtimes/saas/sms.py index 3de6702..e053229 100644 --- a/cloud_runtimes/saas/sms.py +++ b/cloud_runtimes/saas/sms.py @@ -25,16 +25,16 @@ async def send_sms( metadata: Optional[Dict[str, str]] = None, ) -> SendSMSResponse: """Send an SMS message. - + Args: to: Recipient phone number message: SMS message content from_number: Optional sender phone number metadata: Optional metadata for the request - + Returns: SendSMSResponse containing send result - + Raises: CloudRuntimesError: If sending SMS fails """ @@ -46,13 +46,13 @@ async def send_sms_with_request( request: SendSMSRequest, ) -> SendSMSResponse: """Send an SMS using a structured request object. - + Args: request: SendSMSRequest containing all parameters - + Returns: SendSMSResponse containing send result - + Raises: CloudRuntimesError: If sending SMS fails """ @@ -68,17 +68,17 @@ async def send_sms_with_template( metadata: Optional[Dict[str, str]] = None, ) -> SendSMSResponse: """Send an SMS using a template. - + Args: to: Recipient phone number template_id: Template identifier template_data: Data to populate the template from_number: Optional sender phone number metadata: Optional metadata for the request - + Returns: SendSMSResponse containing send result - + Raises: CloudRuntimesError: If sending SMS fails """ @@ -90,13 +90,13 @@ async def send_sms_with_template_request( request: SendSMSTemplateRequest, ) -> SendSMSResponse: """Send an SMS with template using a structured request object. - + Args: request: SendSMSTemplateRequest containing all parameters - + Returns: SendSMSResponse containing send result - + Raises: CloudRuntimesError: If sending SMS fails """ @@ -109,14 +109,14 @@ async def get_sms_status( metadata: Optional[Dict[str, str]] = None, ) -> SMSStatusResponse: """Get SMS sending status. - + Args: message_id: The message ID returned from send_sms metadata: Optional metadata for the request - + Returns: SMSStatusResponse containing status information - + Raises: CloudRuntimesError: If getting SMS status fails """ @@ -129,14 +129,14 @@ async def send_bulk_sms( metadata: Optional[Dict[str, str]] = None, ) -> List[SendSMSResponse]: """Send multiple SMS messages in bulk. - + Args: messages: List of SMS requests to send metadata: Optional metadata for the request - + Returns: List of SendSMSResponse for each message - + Raises: CloudRuntimesError: If sending bulk SMS fails """ @@ -149,14 +149,14 @@ async def validate_phone_number( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Validate a phone number. - + Args: phone_number: The phone number to validate metadata: Optional metadata for the request - + Returns: True if phone number is valid - + Raises: CloudRuntimesError: If phone validation fails """ @@ -168,13 +168,13 @@ async def get_sms_templates( metadata: Optional[Dict[str, str]] = None, ) -> List[Dict[str, str]]: """Get available SMS templates. - + Args: metadata: Optional metadata for the request - + Returns: List of available SMS templates - + Raises: CloudRuntimesError: If getting templates fails """ @@ -188,15 +188,15 @@ async def create_sms_template( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Create an SMS template. - + Args: template_id: Unique template identifier message: Template message (can contain variables) metadata: Optional metadata for the request - + Returns: True if template was created successfully - + Raises: CloudRuntimesError: If creating template fails """ @@ -209,14 +209,14 @@ async def delete_sms_template( metadata: Optional[Dict[str, str]] = None, ) -> bool: """Delete an SMS template. - + Args: template_id: Template identifier to delete metadata: Optional metadata for the request - + Returns: True if template was deleted successfully - + Raises: CloudRuntimesError: If deleting template fails """ @@ -229,15 +229,15 @@ async def get_delivery_report( metadata: Optional[Dict[str, str]] = None, ) -> Dict[str, str]: """Get SMS delivery report. - + Args: message_id: The message ID to get report for metadata: Optional metadata for the request - + Returns: Dictionary containing delivery report information - + Raises: CloudRuntimesError: If getting delivery report fails """ - pass \ No newline at end of file + pass diff --git a/cloud_runtimes/types/__init__.py b/cloud_runtimes/types/__init__.py index 5a481a4..a641f16 100644 --- a/cloud_runtimes/types/__init__.py +++ b/cloud_runtimes/types/__init__.py @@ -18,11 +18,9 @@ "StateConcurrency", "OperationType", "Metadata", - # HTTP constants "HTTPVerb", "ContentType", - # Core types "InvokeMethodRequest", "InvokeMethodResponse", @@ -35,7 +33,6 @@ "ConfigurationItem", "GetSecretRequest", "InvokeBindingRequest", - # Enhanced types "GetFileRequest", "GetFileResponse", @@ -43,14 +40,12 @@ "TryLockResponse", "DatabaseQueryRequest", "DatabaseQueryResponse", - # Native types "RedisExecuteRequest", "SqlQueryRequest", "S3GetObjectRequest", - # SaaS types "SendEmailRequest", "SendSMSRequest", "EncryptRequest", -] \ No newline at end of file +] diff --git a/cloud_runtimes/types/common.py b/cloud_runtimes/types/common.py index 63a0a31..25ad60b 100644 --- a/cloud_runtimes/types/common.py +++ b/cloud_runtimes/types/common.py @@ -4,7 +4,7 @@ from dataclasses import dataclass from enum import Enum, IntEnum -from typing import Any, Dict, Generic, Optional, TypeVar +from typing import Dict, Generic, Optional, TypeVar from ..exceptions import CloudRuntimesException @@ -14,7 +14,7 @@ @dataclass class Response(Generic[T]): """Generic response wrapper.""" - + data: T metadata: Optional[Dict[str, str]] = None error: Optional[CloudRuntimesException] = None @@ -23,7 +23,7 @@ class Response(Generic[T]): @dataclass class State(Generic[T]): """Represents a key-value state item.""" - + key: str value: T etag: Optional[str] = None @@ -33,21 +33,21 @@ class State(Generic[T]): @dataclass class ETag: """Represents an entity tag for optimistic concurrency control.""" - + value: str @dataclass class StateOptions: """Represents options for state operations.""" - + concurrency: Optional["StateConcurrency"] = None consistency: Optional["StateConsistency"] = None class StateConsistency(IntEnum): """State consistency levels.""" - + UNDEFINED = 0 EVENTUAL = 1 STRONG = 2 @@ -55,7 +55,7 @@ class StateConsistency(IntEnum): class StateConcurrency(IntEnum): """State concurrency control.""" - + UNDEFINED = 0 FIRST_WRITE = 1 LAST_WRITE = 2 @@ -63,7 +63,7 @@ class StateConcurrency(IntEnum): class OperationType(IntEnum): """The type of state operation.""" - + UNDEFINED = 0 UPSERT = 1 DELETE = 2 @@ -75,7 +75,7 @@ class OperationType(IntEnum): class HTTPVerb(str, Enum): """HTTP verbs.""" - + GET = "GET" POST = "POST" PUT = "PUT" @@ -87,7 +87,7 @@ class HTTPVerb(str, Enum): class ContentType(str, Enum): """Content type constants.""" - + JSON = "application/json" TEXT = "text/plain" BINARY = "application/octet-stream" @@ -101,10 +101,10 @@ class ContentType(str, Enum): # Status constants class Status(str, Enum): """Common status values.""" - + PENDING = "pending" ACTIVE = "active" INACTIVE = "inactive" COMPLETED = "completed" FAILED = "failed" - CANCELLED = "cancelled" \ No newline at end of file + CANCELLED = "cancelled" diff --git a/cloud_runtimes/types/core.py b/cloud_runtimes/types/core.py index b5010a5..eec23cd 100644 --- a/cloud_runtimes/types/core.py +++ b/cloud_runtimes/types/core.py @@ -3,8 +3,7 @@ """ from dataclasses import dataclass -from datetime import datetime -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Optional from .common import ETag, Metadata, OperationType, StateOptions @@ -13,7 +12,7 @@ @dataclass class InvokeMethodRequest: """Request to invoke a method.""" - + app_id: str method_name: str data: Optional[bytes] = None @@ -25,7 +24,7 @@ class InvokeMethodRequest: @dataclass class InvokeMethodResponse: """Response from method invocation.""" - + data: Optional[bytes] = None content_type: Optional[str] = None metadata: Optional[Metadata] = None @@ -34,7 +33,7 @@ class InvokeMethodResponse: @dataclass class HttpExtension: """HTTP-specific extensions.""" - + verb: Optional[str] = None querystring: Optional[str] = None headers: Optional[Metadata] = None @@ -43,7 +42,7 @@ class HttpExtension: @dataclass class RegisterServerRequest: """Request to register a server.""" - + server_name: str methods: List["MethodInfo"] metadata: Optional[Metadata] = None @@ -52,7 +51,7 @@ class RegisterServerRequest: @dataclass class MethodInfo: """Information about a registered method.""" - + name: str http_verbs: Optional[List[str]] = None path: Optional[str] = None @@ -63,7 +62,7 @@ class MethodInfo: @dataclass class GetStateRequest: """Request to get state.""" - + store_name: str key: str options: Optional[StateOptions] = None @@ -73,7 +72,7 @@ class GetStateRequest: @dataclass class GetBulkStateRequest: """Request to get multiple states.""" - + store_name: str keys: List[str] parallelism: Optional[int] = None @@ -83,7 +82,7 @@ class GetBulkStateRequest: @dataclass class SaveStateRequest: """Request to save state.""" - + store_name: str states: List["SetStateItem"] @@ -91,7 +90,7 @@ class SaveStateRequest: @dataclass class SetStateItem: """State item to be saved.""" - + key: str value: bytes etag: Optional[ETag] = None @@ -102,7 +101,7 @@ class SetStateItem: @dataclass class DeleteStateRequest: """Request to delete state.""" - + store_name: str key: str etag: Optional[ETag] = None @@ -113,7 +112,7 @@ class DeleteStateRequest: @dataclass class DeleteStateItem: """State item to be deleted.""" - + key: str etag: Optional[ETag] = None metadata: Optional[Metadata] = None @@ -123,7 +122,7 @@ class DeleteStateItem: @dataclass class ExecuteStateTransactionRequest: """Request to execute state transaction.""" - + store_name: str operations: List["StateOperation"] metadata: Optional[Metadata] = None @@ -132,7 +131,7 @@ class ExecuteStateTransactionRequest: @dataclass class StateOperation: """Single operation in a state transaction.""" - + type: OperationType item: SetStateItem @@ -140,7 +139,7 @@ class StateOperation: @dataclass class BulkStateItem: """State item in bulk operations.""" - + key: str value: bytes etag: Optional[str] = None @@ -152,7 +151,7 @@ class BulkStateItem: @dataclass class PublishEventRequest: """Request to publish an event.""" - + pubsub_name: str topic_name: str data: bytes @@ -162,7 +161,7 @@ class PublishEventRequest: @dataclass class TopicEventRequest: """Event received from a topic.""" - + id: str source: str type: str @@ -179,7 +178,7 @@ class TopicEventRequest: @dataclass class TopicSubscription: """Subscription to a topic.""" - + pubsub_name: str topic_name: str metadata: Optional[Metadata] = None @@ -189,7 +188,7 @@ class TopicSubscription: @dataclass class TopicRoute: """Route for topic events.""" - + rules: Optional[List["TopicRule"]] = None match: Optional[str] = None path: str = "" @@ -198,7 +197,7 @@ class TopicRoute: @dataclass class TopicRule: """Rule for topic routing.""" - + match: str path: str @@ -207,7 +206,7 @@ class TopicRule: @dataclass class ConfigurationRequestItem: """Request for configuration.""" - + store_name: str app_id: str keys: List[str] @@ -219,7 +218,7 @@ class ConfigurationRequestItem: @dataclass class ConfigurationItem: """Configuration item.""" - + key: str value: Any version: Optional[str] = None @@ -229,7 +228,7 @@ class ConfigurationItem: @dataclass class SaveConfigurationRequest: """Request to save configuration.""" - + store_name: str app_id: str items: List["ConfigurationSaveItem"] @@ -239,7 +238,7 @@ class SaveConfigurationRequest: @dataclass class ConfigurationSaveItem: """Configuration item to save.""" - + key: str value: Any group: Optional[str] = None @@ -250,7 +249,7 @@ class ConfigurationSaveItem: @dataclass class SubConfigurationResp: """Configuration subscription response.""" - + items: List[ConfigurationItem] id: Optional[str] = None @@ -259,7 +258,7 @@ class SubConfigurationResp: @dataclass class GetSecretRequest: """Request to get a secret.""" - + store_name: str secret_name: str metadata: Optional[Metadata] = None @@ -268,7 +267,7 @@ class GetSecretRequest: @dataclass class GetBulkSecretRequest: """Request to get multiple secrets.""" - + store_name: str metadata: Optional[Metadata] = None @@ -276,14 +275,14 @@ class GetBulkSecretRequest: @dataclass class SecretResponse: """Secret response.""" - + data: Dict[str, str] @dataclass class BulkSecretResponse: """Bulk secret response.""" - + data: Dict[str, Dict[str, str]] @@ -291,7 +290,7 @@ class BulkSecretResponse: @dataclass class InvokeBindingRequest: """Request to invoke a binding.""" - + name: str operation: str data: Optional[bytes] = None @@ -301,7 +300,7 @@ class InvokeBindingRequest: @dataclass class InvokeBindingResponse: """Response from binding invocation.""" - + data: Optional[bytes] = None metadata: Optional[Metadata] = None @@ -309,7 +308,7 @@ class InvokeBindingResponse: @dataclass class BindingEvent: """Binding event.""" - + data: bytes metadata: Optional[Metadata] = None @@ -317,7 +316,7 @@ class BindingEvent: @dataclass class ListInputBindingsResponse: """Response from listing input bindings.""" - + bindings: List[str] metadata: Optional[Metadata] = None @@ -325,6 +324,6 @@ class ListInputBindingsResponse: @dataclass class ListOutputBindingsResponse: """Response from listing output bindings.""" - + bindings: List[str] - metadata: Optional[Metadata] = None \ No newline at end of file + metadata: Optional[Metadata] = None diff --git a/cloud_runtimes/types/enhanced.py b/cloud_runtimes/types/enhanced.py index 8dafb99..13d9be3 100644 --- a/cloud_runtimes/types/enhanced.py +++ b/cloud_runtimes/types/enhanced.py @@ -13,7 +13,7 @@ @dataclass class GetConnectionRequest: """Request to get database connection.""" - + database_name: str metadata: Optional[Metadata] = None @@ -21,7 +21,7 @@ class GetConnectionRequest: @dataclass class GetConnectionResponse: """Response from get connection.""" - + connection_id: str metadata: Optional[Metadata] = None @@ -29,7 +29,7 @@ class GetConnectionResponse: @dataclass class DatabaseQueryRequest: """Request to query database.""" - + database_name: str table_name: Optional[str] = None sql: Optional[str] = None @@ -40,7 +40,7 @@ class DatabaseQueryRequest: @dataclass class DatabaseQueryResponse: """Response from database query.""" - + data: List[Dict[str, Any]] columns: Optional[List[str]] = None metadata: Optional[Metadata] = None @@ -49,7 +49,7 @@ class DatabaseQueryResponse: @dataclass class DatabaseExecuteRequest: """Request to execute database operation.""" - + database_name: str table_name: Optional[str] = None sql: Optional[str] = None @@ -61,7 +61,7 @@ class DatabaseExecuteRequest: @dataclass class DatabaseExecuteResponse: """Response from database execution.""" - + rows_affected: int last_insert_id: Optional[Any] = None metadata: Optional[Metadata] = None @@ -71,7 +71,7 @@ class DatabaseExecuteResponse: @dataclass class GetFileRequest: """Request to get file.""" - + file_name: str metadata: Optional[Metadata] = None @@ -79,7 +79,7 @@ class GetFileRequest: @dataclass class GetFileResponse: """Response from get file.""" - + data: bytes content_type: Optional[str] = None size: int = 0 @@ -90,7 +90,7 @@ class GetFileResponse: @dataclass class PutFileRequest: """Request to put file.""" - + file_name: str data: bytes content_type: Optional[str] = None @@ -100,7 +100,7 @@ class PutFileRequest: @dataclass class ListFileRequest: """Request to list files.""" - + path: Optional[str] = None pattern: Optional[str] = None recursive: bool = False @@ -110,7 +110,7 @@ class ListFileRequest: @dataclass class ListFileResponse: """Response from list files.""" - + files: List["FileInfo"] metadata: Optional[Metadata] = None @@ -118,7 +118,7 @@ class ListFileResponse: @dataclass class FileInfo: """File information.""" - + name: str path: str size: int @@ -131,7 +131,7 @@ class FileInfo: @dataclass class DeleteFileRequest: """Request to delete file.""" - + file_name: str metadata: Optional[Metadata] = None @@ -140,7 +140,7 @@ class DeleteFileRequest: @dataclass class TryLockRequest: """Request to try lock.""" - + lock_name: str timeout: Optional[int] = None # timeout in seconds expire_time: Optional[int] = None # expire time in seconds @@ -150,7 +150,7 @@ class TryLockRequest: @dataclass class TryLockResponse: """Response from try lock.""" - + success: bool lock_id: Optional[str] = None message: Optional[str] = None @@ -161,7 +161,7 @@ class TryLockResponse: @dataclass class UnlockRequest: """Request to unlock.""" - + lock_name: Optional[str] = None lock_id: Optional[str] = None metadata: Optional[Metadata] = None @@ -170,7 +170,7 @@ class UnlockRequest: @dataclass class UnlockResponse: """Response from unlock.""" - + success: bool message: Optional[str] = None metadata: Optional[Metadata] = None @@ -180,7 +180,7 @@ class UnlockResponse: @dataclass class CreateScheduleRequest: """Request to create schedule.""" - + job_name: str schedule: str # cron expression data: Optional[Any] = None @@ -193,7 +193,7 @@ class CreateScheduleRequest: @dataclass class DeleteScheduleRequest: """Request to delete schedule.""" - + job_name: str metadata: Optional[Metadata] = None @@ -201,7 +201,7 @@ class DeleteScheduleRequest: @dataclass class GetScheduleRequest: """Request to get schedule.""" - + job_name: str metadata: Optional[Metadata] = None @@ -209,7 +209,7 @@ class GetScheduleRequest: @dataclass class GetScheduleResponse: """Response from get schedule.""" - + job_name: str schedule: str data: Optional[Any] = None @@ -225,7 +225,7 @@ class GetScheduleResponse: @dataclass class GetNextIDRequest: """Request to get next ID.""" - + key: str metadata: Optional[Metadata] = None @@ -233,7 +233,7 @@ class GetNextIDRequest: @dataclass class GetNextIDResponse: """Response from get next ID.""" - + next_id: int metadata: Optional[Metadata] = None @@ -242,7 +242,7 @@ class GetNextIDResponse: @dataclass class CreateTableRequest: """Request to create table.""" - + database_name: str table_name: str schema: Dict[str, Any] @@ -252,7 +252,7 @@ class CreateTableRequest: @dataclass class CreateTableResponse: """Response from create table.""" - + success: bool message: Optional[str] = None metadata: Optional[Metadata] = None @@ -261,7 +261,7 @@ class CreateTableResponse: @dataclass class DeleteTableRequest: """Request to delete table.""" - + database_name: str table_name: str metadata: Optional[Metadata] = None @@ -270,7 +270,7 @@ class DeleteTableRequest: @dataclass class DeleteTableResponse: """Response from delete table.""" - + success: bool message: Optional[str] = None metadata: Optional[Metadata] = None @@ -279,7 +279,7 @@ class DeleteTableResponse: @dataclass class InsertRequest: """Request to insert data.""" - + database_name: str table_name: str data: Dict[str, Any] @@ -289,7 +289,7 @@ class InsertRequest: @dataclass class InsertResponse: """Response from insert.""" - + success: bool inserted_id: Optional[Any] = None rows_affected: int = 0 @@ -299,7 +299,7 @@ class InsertResponse: @dataclass class QueryRequest: """Request to query data.""" - + database_name: str table_name: str query_filter: Optional[Dict[str, Any]] = None @@ -311,7 +311,7 @@ class QueryRequest: @dataclass class QueryResponse: """Response from query.""" - + data: List[Dict[str, Any]] total_count: Optional[int] = None metadata: Optional[Metadata] = None @@ -320,7 +320,7 @@ class QueryResponse: @dataclass class UpdateRequest: """Request to update data.""" - + database_name: str table_name: str data: Dict[str, Any] @@ -331,7 +331,7 @@ class UpdateRequest: @dataclass class UpdateResponse: """Response from update.""" - + success: bool rows_affected: int = 0 metadata: Optional[Metadata] = None @@ -341,7 +341,7 @@ class UpdateResponse: @dataclass class StatFileRequest: """Request to get file stats.""" - + file_path: str metadata: Optional[Metadata] = None @@ -349,7 +349,7 @@ class StatFileRequest: @dataclass class StatFileResponse: """Response from file stats.""" - + size: int mod_time: datetime is_dir: bool @@ -360,7 +360,7 @@ class StatFileResponse: @dataclass class CopyFileRequest: """Request to copy file.""" - + source_path: str destination_path: str metadata: Optional[Metadata] = None @@ -369,7 +369,7 @@ class CopyFileRequest: @dataclass class MoveFileRequest: """Request to move file.""" - + source_path: str destination_path: str metadata: Optional[Metadata] = None @@ -378,7 +378,7 @@ class MoveFileRequest: @dataclass class CreateDirectoryRequest: """Request to create directory.""" - + directory_path: str recursive: bool = False metadata: Optional[Metadata] = None @@ -387,7 +387,7 @@ class CreateDirectoryRequest: @dataclass class DeleteDirectoryRequest: """Request to delete directory.""" - + directory_path: str recursive: bool = False metadata: Optional[Metadata] = None @@ -396,7 +396,7 @@ class DeleteDirectoryRequest: @dataclass class SetFilePermissionsRequest: """Request to set file permissions.""" - + file_path: str permissions: str metadata: Optional[Metadata] = None @@ -405,7 +405,7 @@ class SetFilePermissionsRequest: @dataclass class WatchFileRequest: """Request to watch file.""" - + file_path: str metadata: Optional[Metadata] = None @@ -413,7 +413,7 @@ class WatchFileRequest: @dataclass class FileEvent: """File system event.""" - + event_type: str # created, modified, deleted, moved file_path: str timestamp: datetime @@ -424,7 +424,7 @@ class FileEvent: @dataclass class RecordMetricRequest: """Request to record metric.""" - + name: str value: float metric_type: str @@ -437,7 +437,7 @@ class RecordMetricRequest: @dataclass class IncrementCounterRequest: """Request to increment counter.""" - + name: str value: float = 1.0 tags: Optional[Dict[str, str]] = None @@ -447,7 +447,7 @@ class IncrementCounterRequest: @dataclass class RecordHistogramRequest: """Request to record histogram.""" - + name: str value: float unit: Optional[str] = None @@ -458,7 +458,7 @@ class RecordHistogramRequest: @dataclass class SetGaugeRequest: """Request to set gauge.""" - + name: str value: float unit: Optional[str] = None @@ -469,7 +469,7 @@ class SetGaugeRequest: @dataclass class GetMetricsRequest: """Request to get metrics.""" - + names: Optional[List[str]] = None prefix: Optional[str] = None tags: Optional[Dict[str, str]] = None @@ -481,7 +481,7 @@ class GetMetricsRequest: @dataclass class GetMetricsResponse: """Response from get metrics.""" - + metrics: List["MetricData"] metadata: Optional[Metadata] = None @@ -489,7 +489,7 @@ class GetMetricsResponse: @dataclass class MetricData: """Metric data.""" - + name: str metric_type: str value: float @@ -502,7 +502,7 @@ class MetricData: @dataclass class CreateSpanRequest: """Request to create span.""" - + operation_name: str parent_span_id: Optional[str] = None trace_id: Optional[str] = None @@ -514,7 +514,7 @@ class CreateSpanRequest: @dataclass class CreateSpanResponse: """Response from create span.""" - + span_id: str trace_id: str context: Optional["TraceContext"] = None @@ -524,11 +524,11 @@ class CreateSpanResponse: @dataclass class TraceContext: """Trace context information.""" - + trace_id: str span_id: str parent_span_id: Optional[str] = None trace_flags: Optional[str] = None trace_state: Optional[str] = None baggage: Optional[Dict[str, str]] = None - metadata: Optional[Metadata] = None \ No newline at end of file + metadata: Optional[Metadata] = None diff --git a/cloud_runtimes/types/native.py b/cloud_runtimes/types/native.py index d3b7270..ad8c77a 100644 --- a/cloud_runtimes/types/native.py +++ b/cloud_runtimes/types/native.py @@ -13,7 +13,7 @@ @dataclass class RedisExecuteRequest: """Request to execute Redis command.""" - + command: str args: Optional[List[Any]] = None metadata: Optional[Metadata] = None @@ -22,7 +22,7 @@ class RedisExecuteRequest: @dataclass class RedisExecuteResponse: """Response from Redis command execution.""" - + result: Any error: Optional[str] = None metadata: Optional[Metadata] = None @@ -32,7 +32,7 @@ class RedisExecuteResponse: @dataclass class SqlExecuteRequest: """Request to execute SQL.""" - + sql: str parameters: Optional[List[Any]] = None tx_id: Optional[str] = None @@ -42,7 +42,7 @@ class SqlExecuteRequest: @dataclass class SqlExecuteResponse: """Response from SQL execution.""" - + rows_affected: int last_insert_id: Optional[Any] = None metadata: Optional[Metadata] = None @@ -51,7 +51,7 @@ class SqlExecuteResponse: @dataclass class SqlQueryRequest: """Request to query SQL.""" - + sql: str parameters: Optional[List[Any]] = None tx_id: Optional[str] = None @@ -61,7 +61,7 @@ class SqlQueryRequest: @dataclass class SqlQueryResponse: """Response from SQL query.""" - + rows: List[Dict[str, Any]] columns: Optional[List[str]] = None metadata: Optional[Metadata] = None @@ -70,7 +70,7 @@ class SqlQueryResponse: @dataclass class SqlRowResponse: """Single row response from SQL query.""" - + row: Dict[str, Any] columns: Optional[List[str]] = None metadata: Optional[Metadata] = None @@ -79,7 +79,7 @@ class SqlRowResponse: @dataclass class SqlBeginTxRequest: """Request to begin transaction.""" - + isolation_level: Optional[str] = None read_only: bool = False metadata: Optional[Metadata] = None @@ -88,7 +88,7 @@ class SqlBeginTxRequest: @dataclass class SqlTxResponse: """Response from transaction operation.""" - + tx_id: str metadata: Optional[Metadata] = None @@ -96,7 +96,7 @@ class SqlTxResponse: @dataclass class SqlPrepareRequest: """Request to prepare SQL statement.""" - + sql: str metadata: Optional[Metadata] = None @@ -104,7 +104,7 @@ class SqlPrepareRequest: @dataclass class SqlPrepareResponse: """Response from SQL prepare.""" - + stmt_id: str metadata: Optional[Metadata] = None @@ -112,7 +112,7 @@ class SqlPrepareResponse: @dataclass class SqlExecutePreparedRequest: """Request to execute prepared statement.""" - + stmt_id: str parameters: Optional[List[Any]] = None tx_id: Optional[str] = None @@ -123,7 +123,7 @@ class SqlExecutePreparedRequest: @dataclass class S3GetObjectRequest: """Request to get S3 object.""" - + bucket: str key: str range: Optional[str] = None @@ -133,7 +133,7 @@ class S3GetObjectRequest: @dataclass class S3GetObjectResponse: """Response from get S3 object.""" - + body: bytes content_type: Optional[str] = None content_length: int = 0 @@ -145,7 +145,7 @@ class S3GetObjectResponse: @dataclass class S3PutObjectRequest: """Request to put S3 object.""" - + bucket: str key: str body: bytes @@ -156,7 +156,7 @@ class S3PutObjectRequest: @dataclass class S3PutObjectResponse: """Response from put S3 object.""" - + etag: Optional[str] = None metadata: Optional[Metadata] = None @@ -164,7 +164,7 @@ class S3PutObjectResponse: @dataclass class S3DeleteObjectRequest: """Request to delete S3 object.""" - + bucket: str key: str metadata: Optional[Metadata] = None @@ -173,7 +173,7 @@ class S3DeleteObjectRequest: @dataclass class S3ListObjectsRequest: """Request to list S3 objects.""" - + bucket: str prefix: Optional[str] = None delimiter: Optional[str] = None @@ -185,7 +185,7 @@ class S3ListObjectsRequest: @dataclass class S3ListObjectsResponse: """Response from list S3 objects.""" - + objects: List["S3Object"] is_truncated: bool = False next_marker: Optional[str] = None @@ -195,7 +195,7 @@ class S3ListObjectsResponse: @dataclass class S3Object: """S3 object.""" - + key: str size: int last_modified: datetime @@ -207,7 +207,7 @@ class S3Object: @dataclass class S3HeadObjectRequest: """Request to get S3 object metadata.""" - + bucket: str key: str metadata: Optional[Metadata] = None @@ -216,7 +216,7 @@ class S3HeadObjectRequest: @dataclass class S3HeadObjectResponse: """Response from head S3 object.""" - + content_type: Optional[str] = None content_length: int = 0 last_modified: Optional[datetime] = None @@ -227,7 +227,7 @@ class S3HeadObjectResponse: @dataclass class S3GetPresignedURLRequest: """Request to get presigned URL.""" - + bucket: str key: str method: str # GET, PUT, DELETE @@ -238,7 +238,7 @@ class S3GetPresignedURLRequest: @dataclass class S3GetPresignedURLResponse: """Response from get presigned URL.""" - + url: str metadata: Optional[Metadata] = None @@ -246,7 +246,7 @@ class S3GetPresignedURLResponse: @dataclass class S3CopyObjectRequest: """Request to copy S3 object.""" - + source_bucket: str source_key: str destination_bucket: str @@ -257,7 +257,7 @@ class S3CopyObjectRequest: @dataclass class S3CopyObjectResponse: """Response from copy S3 object.""" - + etag: Optional[str] = None last_modified: Optional[datetime] = None metadata: Optional[Metadata] = None @@ -266,7 +266,7 @@ class S3CopyObjectResponse: @dataclass class S3CreateBucketRequest: """Request to create S3 bucket.""" - + bucket: str region: Optional[str] = None metadata: Optional[Metadata] = None @@ -275,7 +275,7 @@ class S3CreateBucketRequest: @dataclass class S3DeleteBucketRequest: """Request to delete S3 bucket.""" - + bucket: str metadata: Optional[Metadata] = None @@ -283,7 +283,7 @@ class S3DeleteBucketRequest: @dataclass class S3ListBucketsResponse: """Response from list S3 buckets.""" - + buckets: List["S3Bucket"] metadata: Optional[Metadata] = None @@ -291,7 +291,7 @@ class S3ListBucketsResponse: @dataclass class S3Bucket: """S3 bucket.""" - + name: str creation_date: datetime metadata: Optional[Metadata] = None @@ -301,6 +301,6 @@ class S3Bucket: @dataclass class RedisZMember: """Redis sorted set member with score.""" - + member: str - score: float \ No newline at end of file + score: float diff --git a/cloud_runtimes/types/saas.py b/cloud_runtimes/types/saas.py index 0d93a7e..b73542f 100644 --- a/cloud_runtimes/types/saas.py +++ b/cloud_runtimes/types/saas.py @@ -13,7 +13,7 @@ @dataclass class EmailAttachment: """Email attachment.""" - + name: str content_type: str data: bytes @@ -22,7 +22,7 @@ class EmailAttachment: @dataclass class SendEmailRequest: """Request to send email.""" - + from_: str # 'from' is a Python keyword, so we use 'from_' to: List[str] cc: Optional[List[str]] = None @@ -37,7 +37,7 @@ class SendEmailRequest: @dataclass class SendEmailTemplateRequest: """Request to send email with template.""" - + from_: str to: List[str] cc: Optional[List[str]] = None @@ -50,7 +50,7 @@ class SendEmailTemplateRequest: @dataclass class SendEmailResponse: """Response from send email.""" - + message_id: str status: str metadata: Optional[Metadata] = None @@ -59,7 +59,7 @@ class SendEmailResponse: @dataclass class EmailStatusResponse: """Email status response.""" - + message_id: str status: str delivered_at: Optional[datetime] = None @@ -71,7 +71,7 @@ class EmailStatusResponse: @dataclass class SendSMSRequest: """Request to send SMS.""" - + from_: str to: str message: str @@ -81,7 +81,7 @@ class SendSMSRequest: @dataclass class SendSMSTemplateRequest: """Request to send SMS with template.""" - + from_: str to: str template_id: str @@ -92,7 +92,7 @@ class SendSMSTemplateRequest: @dataclass class SendSMSResponse: """Response from send SMS.""" - + message_id: str status: str metadata: Optional[Metadata] = None @@ -101,7 +101,7 @@ class SendSMSResponse: @dataclass class SMSStatusResponse: """SMS status response.""" - + message_id: str status: str delivered_at: Optional[datetime] = None @@ -113,7 +113,7 @@ class SMSStatusResponse: @dataclass class EncryptRequest: """Request to encrypt data.""" - + data: bytes key_id: Optional[str] = None algorithm: Optional[str] = None @@ -123,7 +123,7 @@ class EncryptRequest: @dataclass class EncryptResponse: """Response from encrypt.""" - + encrypted_data: bytes key_id: Optional[str] = None algorithm: Optional[str] = None @@ -133,7 +133,7 @@ class EncryptResponse: @dataclass class DecryptRequest: """Request to decrypt data.""" - + encrypted_data: bytes key_id: Optional[str] = None algorithm: Optional[str] = None @@ -143,7 +143,7 @@ class DecryptRequest: @dataclass class DecryptResponse: """Response from decrypt.""" - + data: bytes metadata: Optional[Metadata] = None @@ -151,7 +151,7 @@ class DecryptResponse: @dataclass class GenerateKeyRequest: """Request to generate key.""" - + key_type: str # symmetric, asymmetric algorithm: str # AES, RSA, etc. key_size: Optional[int] = None @@ -161,7 +161,7 @@ class GenerateKeyRequest: @dataclass class GenerateKeyResponse: """Response from generate key.""" - + key_id: str public_key: Optional[bytes] = None private_key: Optional[bytes] = None @@ -171,7 +171,7 @@ class GenerateKeyResponse: @dataclass class HashRequest: """Request to hash data.""" - + data: bytes algorithm: str # SHA256, SHA512, MD5, etc. salt: Optional[bytes] = None @@ -181,7 +181,7 @@ class HashRequest: @dataclass class HashResponse: """Response from hash.""" - + hash: bytes salt: Optional[bytes] = None metadata: Optional[Metadata] = None @@ -190,7 +190,7 @@ class HashResponse: @dataclass class VerifyHashRequest: """Request to verify hash.""" - + data: bytes hash: bytes algorithm: str @@ -201,7 +201,7 @@ class VerifyHashRequest: @dataclass class VerifyHashResponse: """Response from verify hash.""" - + valid: bool metadata: Optional[Metadata] = None @@ -210,7 +210,7 @@ class VerifyHashResponse: @dataclass class SendIMMessageRequest: """Request to send instant message.""" - + from_: str to: Optional[str] = None # for direct message group_id: Optional[str] = None # for group message @@ -222,7 +222,7 @@ class SendIMMessageRequest: @dataclass class SendIMMessageResponse: """Response from send instant message.""" - + message_id: str timestamp: datetime metadata: Optional[Metadata] = None @@ -231,7 +231,7 @@ class SendIMMessageResponse: @dataclass class CreateGroupRequest: """Request to create group.""" - + name: str description: Optional[str] = None members: Optional[List[str]] = None @@ -241,7 +241,7 @@ class CreateGroupRequest: @dataclass class CreateGroupResponse: """Response from create group.""" - + group_id: str metadata: Optional[Metadata] = None @@ -250,7 +250,7 @@ class CreateGroupResponse: @dataclass class MakeCallRequest: """Request to make call.""" - + from_: str to: str message: Optional[str] = None @@ -262,7 +262,7 @@ class MakeCallRequest: @dataclass class MakeCallResponse: """Response from make call.""" - + call_id: str status: str metadata: Optional[Metadata] = None @@ -271,7 +271,7 @@ class MakeCallResponse: @dataclass class CallStatusResponse: """Call status response.""" - + call_id: str status: str start_time: Optional[datetime] = None @@ -285,7 +285,7 @@ class CallStatusResponse: @dataclass class ProxyRequest: """Request to proxy HTTP request.""" - + method: str url: str headers: Optional[Metadata] = None @@ -298,9 +298,9 @@ class ProxyRequest: @dataclass class ProxyResponse: """Response from proxy request.""" - + status_code: int headers: Optional[Metadata] = None body: Optional[bytes] = None duration: Optional[float] = None # in seconds - metadata: Optional[Metadata] = None \ No newline at end of file + metadata: Optional[Metadata] = None diff --git a/pyproject.toml b/pyproject.toml index 36becee..af6164b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ description = "Cloud Runtimes API for Python3" readme = "README.md" license = {text = "Apache-2.0"} authors = [ - {name = "group.rxcloud", email = "wshten@gmail.com"}, + {name = "Capa Cloud"}, ] classifiers = [ "Development Status :: 3 - Alpha", @@ -37,7 +37,7 @@ dev = [ "pytest-cov>=4.0.0", "black>=22.0.0", "isort>=5.10.0", - "mypy>=1.0.0", + "mypy>=1.0.0,<1.15", "flake8>=5.0.0", ] test = [ diff --git a/requirements-dev.txt b/requirements-dev.txt index 953687f..774dd6c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,15 +1,15 @@ # Include base requirements -r requirements.txt -# Development and testing dependencies +# Development and testing dependencies (run on Python 3.11) pytest>=7.0.0 pytest-asyncio>=0.21.0 pytest-cov>=4.0.0 black>=22.0.0 isort>=5.10.0 -mypy>=1.0.0 +mypy>=1.0.0,<1.15 flake8>=5.0.0 # Additional development tools pre-commit>=2.20.0 -tox>=4.0.0 \ No newline at end of file +tox>=4.0.0 diff --git a/setup.py b/setup.py index efdf7f1..0291e94 100644 --- a/setup.py +++ b/setup.py @@ -6,8 +6,7 @@ setuptools.setup( name="cloud-runtimes-python", version="0.0.1", - author="group.rxcloud", - author_email="wshten@gmail.com", + author="Capa Cloud", description="Cloud Runtimes API for Python3", long_description=long_description, long_description_content_type="text/markdown", @@ -38,7 +37,7 @@ "pytest-cov>=4.0.0", "black>=22.0.0", "isort>=5.10.0", - "mypy>=1.0.0", + "mypy>=1.0.0,<1.15", "flake8>=5.0.0", ], "test": [ diff --git a/tests/__init__.py b/tests/__init__.py index 739954c..d4839a6 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -# Tests package \ No newline at end of file +# Tests package diff --git a/tests/core/__init__.py b/tests/core/__init__.py index 54e2466..d62ca33 100644 --- a/tests/core/__init__.py +++ b/tests/core/__init__.py @@ -1 +1 @@ -# Core tests package \ No newline at end of file +# Core tests package