# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import httpx from .kvs.kvs import ( KvsResource, AsyncKvsResource, KvsResourceWithRawResponse, AsyncKvsResourceWithRawResponse, KvsResourceWithStreamingResponse, AsyncKvsResourceWithStreamingResponse, ) from ..._types import Body, Query, Headers, NotGiven, not_given from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) from .sqldbs.sqldbs import ( SqldbsResource, AsyncSqldbsResource, SqldbsResourceWithRawResponse, AsyncSqldbsResourceWithRawResponse, SqldbsResourceWithStreamingResponse, AsyncSqldbsResourceWithStreamingResponse, ) from ..._base_client import make_request_options from .buckets.buckets import ( BucketsResource, AsyncBucketsResource, BucketsResourceWithRawResponse, AsyncBucketsResourceWithRawResponse, BucketsResourceWithStreamingResponse, AsyncBucketsResourceWithStreamingResponse, ) from .cloudfs.cloudfs import ( CloudfsResource, AsyncCloudfsResource, CloudfsResourceWithRawResponse, AsyncCloudfsResourceWithRawResponse, CloudfsResourceWithStreamingResponse, AsyncCloudfsResourceWithStreamingResponse, ) from .migration_sources import ( MigrationSourcesResource, AsyncMigrationSourcesResource, MigrationSourcesResourceWithRawResponse, AsyncMigrationSourcesResourceWithRawResponse, MigrationSourcesResourceWithStreamingResponse, AsyncMigrationSourcesResourceWithStreamingResponse, ) from .migrations.migrations import ( MigrationsResource, AsyncMigrationsResource, MigrationsResourceWithRawResponse, AsyncMigrationsResourceWithRawResponse, MigrationsResourceWithStreamingResponse, AsyncMigrationsResourceWithStreamingResponse, ) from ...types.storage_list_migration_source_coverage_response import StorageListMigrationSourceCoverageResponse __all__ = ["StorageResource", "AsyncStorageResource"] class StorageResource(SyncAPIResource): """Migrate data from an external provider into Telnyx Cloud Storage""" @cached_property def buckets(self) -> BucketsResource: """Presigned object URL operations""" return BucketsResource(self._client) @cached_property def migration_sources(self) -> MigrationSourcesResource: """Migrate data from an external provider into Telnyx Cloud Storage""" return MigrationSourcesResource(self._client) @cached_property def migrations(self) -> MigrationsResource: """Migrate data from an external provider into Telnyx Cloud Storage""" return MigrationsResource(self._client) @cached_property def kvs(self) -> KvsResource: """Manage KV storage namespaces""" return KvsResource(self._client) @cached_property def cloudfs(self) -> CloudfsResource: """ Manage CloudFS filesystems — JuiceFS-compatible filesystems backed by Telnyx Cloud Storage """ return CloudfsResource(self._client) @cached_property def sqldbs(self) -> SqldbsResource: """Manage SQL databases and run SQL against them""" return SqldbsResource(self._client) @cached_property def with_raw_response(self) -> StorageResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/team-telnyx/telnyx-python#accessing-raw-response-data-eg-headers """ return StorageResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> StorageResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/team-telnyx/telnyx-python#with_streaming_response """ return StorageResourceWithStreamingResponse(self) def list_migration_source_coverage( self, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StorageListMigrationSourceCoverageResponse: """List the external storage providers and regions supported as migration sources.""" return self._get( "/storage/migration_source_coverage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=StorageListMigrationSourceCoverageResponse, ) class AsyncStorageResource(AsyncAPIResource): """Migrate data from an external provider into Telnyx Cloud Storage""" @cached_property def buckets(self) -> AsyncBucketsResource: """Presigned object URL operations""" return AsyncBucketsResource(self._client) @cached_property def migration_sources(self) -> AsyncMigrationSourcesResource: """Migrate data from an external provider into Telnyx Cloud Storage""" return AsyncMigrationSourcesResource(self._client) @cached_property def migrations(self) -> AsyncMigrationsResource: """Migrate data from an external provider into Telnyx Cloud Storage""" return AsyncMigrationsResource(self._client) @cached_property def kvs(self) -> AsyncKvsResource: """Manage KV storage namespaces""" return AsyncKvsResource(self._client) @cached_property def cloudfs(self) -> AsyncCloudfsResource: """ Manage CloudFS filesystems — JuiceFS-compatible filesystems backed by Telnyx Cloud Storage """ return AsyncCloudfsResource(self._client) @cached_property def sqldbs(self) -> AsyncSqldbsResource: """Manage SQL databases and run SQL against them""" return AsyncSqldbsResource(self._client) @cached_property def with_raw_response(self) -> AsyncStorageResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/team-telnyx/telnyx-python#accessing-raw-response-data-eg-headers """ return AsyncStorageResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncStorageResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/team-telnyx/telnyx-python#with_streaming_response """ return AsyncStorageResourceWithStreamingResponse(self) async def list_migration_source_coverage( self, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StorageListMigrationSourceCoverageResponse: """List the external storage providers and regions supported as migration sources.""" return await self._get( "/storage/migration_source_coverage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=StorageListMigrationSourceCoverageResponse, ) class StorageResourceWithRawResponse: def __init__(self, storage: StorageResource) -> None: self._storage = storage self.list_migration_source_coverage = to_raw_response_wrapper( storage.list_migration_source_coverage, ) @cached_property def buckets(self) -> BucketsResourceWithRawResponse: """Presigned object URL operations""" return BucketsResourceWithRawResponse(self._storage.buckets) @cached_property def migration_sources(self) -> MigrationSourcesResourceWithRawResponse: """Migrate data from an external provider into Telnyx Cloud Storage""" return MigrationSourcesResourceWithRawResponse(self._storage.migration_sources) @cached_property def migrations(self) -> MigrationsResourceWithRawResponse: """Migrate data from an external provider into Telnyx Cloud Storage""" return MigrationsResourceWithRawResponse(self._storage.migrations) @cached_property def kvs(self) -> KvsResourceWithRawResponse: """Manage KV storage namespaces""" return KvsResourceWithRawResponse(self._storage.kvs) @cached_property def cloudfs(self) -> CloudfsResourceWithRawResponse: """ Manage CloudFS filesystems — JuiceFS-compatible filesystems backed by Telnyx Cloud Storage """ return CloudfsResourceWithRawResponse(self._storage.cloudfs) @cached_property def sqldbs(self) -> SqldbsResourceWithRawResponse: """Manage SQL databases and run SQL against them""" return SqldbsResourceWithRawResponse(self._storage.sqldbs) class AsyncStorageResourceWithRawResponse: def __init__(self, storage: AsyncStorageResource) -> None: self._storage = storage self.list_migration_source_coverage = async_to_raw_response_wrapper( storage.list_migration_source_coverage, ) @cached_property def buckets(self) -> AsyncBucketsResourceWithRawResponse: """Presigned object URL operations""" return AsyncBucketsResourceWithRawResponse(self._storage.buckets) @cached_property def migration_sources(self) -> AsyncMigrationSourcesResourceWithRawResponse: """Migrate data from an external provider into Telnyx Cloud Storage""" return AsyncMigrationSourcesResourceWithRawResponse(self._storage.migration_sources) @cached_property def migrations(self) -> AsyncMigrationsResourceWithRawResponse: """Migrate data from an external provider into Telnyx Cloud Storage""" return AsyncMigrationsResourceWithRawResponse(self._storage.migrations) @cached_property def kvs(self) -> AsyncKvsResourceWithRawResponse: """Manage KV storage namespaces""" return AsyncKvsResourceWithRawResponse(self._storage.kvs) @cached_property def cloudfs(self) -> AsyncCloudfsResourceWithRawResponse: """ Manage CloudFS filesystems — JuiceFS-compatible filesystems backed by Telnyx Cloud Storage """ return AsyncCloudfsResourceWithRawResponse(self._storage.cloudfs) @cached_property def sqldbs(self) -> AsyncSqldbsResourceWithRawResponse: """Manage SQL databases and run SQL against them""" return AsyncSqldbsResourceWithRawResponse(self._storage.sqldbs) class StorageResourceWithStreamingResponse: def __init__(self, storage: StorageResource) -> None: self._storage = storage self.list_migration_source_coverage = to_streamed_response_wrapper( storage.list_migration_source_coverage, ) @cached_property def buckets(self) -> BucketsResourceWithStreamingResponse: """Presigned object URL operations""" return BucketsResourceWithStreamingResponse(self._storage.buckets) @cached_property def migration_sources(self) -> MigrationSourcesResourceWithStreamingResponse: """Migrate data from an external provider into Telnyx Cloud Storage""" return MigrationSourcesResourceWithStreamingResponse(self._storage.migration_sources) @cached_property def migrations(self) -> MigrationsResourceWithStreamingResponse: """Migrate data from an external provider into Telnyx Cloud Storage""" return MigrationsResourceWithStreamingResponse(self._storage.migrations) @cached_property def kvs(self) -> KvsResourceWithStreamingResponse: """Manage KV storage namespaces""" return KvsResourceWithStreamingResponse(self._storage.kvs) @cached_property def cloudfs(self) -> CloudfsResourceWithStreamingResponse: """ Manage CloudFS filesystems — JuiceFS-compatible filesystems backed by Telnyx Cloud Storage """ return CloudfsResourceWithStreamingResponse(self._storage.cloudfs) @cached_property def sqldbs(self) -> SqldbsResourceWithStreamingResponse: """Manage SQL databases and run SQL against them""" return SqldbsResourceWithStreamingResponse(self._storage.sqldbs) class AsyncStorageResourceWithStreamingResponse: def __init__(self, storage: AsyncStorageResource) -> None: self._storage = storage self.list_migration_source_coverage = async_to_streamed_response_wrapper( storage.list_migration_source_coverage, ) @cached_property def buckets(self) -> AsyncBucketsResourceWithStreamingResponse: """Presigned object URL operations""" return AsyncBucketsResourceWithStreamingResponse(self._storage.buckets) @cached_property def migration_sources(self) -> AsyncMigrationSourcesResourceWithStreamingResponse: """Migrate data from an external provider into Telnyx Cloud Storage""" return AsyncMigrationSourcesResourceWithStreamingResponse(self._storage.migration_sources) @cached_property def migrations(self) -> AsyncMigrationsResourceWithStreamingResponse: """Migrate data from an external provider into Telnyx Cloud Storage""" return AsyncMigrationsResourceWithStreamingResponse(self._storage.migrations) @cached_property def kvs(self) -> AsyncKvsResourceWithStreamingResponse: """Manage KV storage namespaces""" return AsyncKvsResourceWithStreamingResponse(self._storage.kvs) @cached_property def cloudfs(self) -> AsyncCloudfsResourceWithStreamingResponse: """ Manage CloudFS filesystems — JuiceFS-compatible filesystems backed by Telnyx Cloud Storage """ return AsyncCloudfsResourceWithStreamingResponse(self._storage.cloudfs) @cached_property def sqldbs(self) -> AsyncSqldbsResourceWithStreamingResponse: """Manage SQL databases and run SQL against them""" return AsyncSqldbsResourceWithStreamingResponse(self._storage.sqldbs)