diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml new file mode 100644 index 0000000..eef14a5 --- /dev/null +++ b/.github/workflows/python.yml @@ -0,0 +1,136 @@ +name: Waylay Storage CI + +on: + push: + branches: [ "main", "staging", "release/**" ] + tags: + - '**' + pull_request: + branches: [ "main", "staging", "release/**" ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Git with token to access other private repositories + run: git config --global url."https://${{ secrets.OTOMATOR_PAT }}@github".insteadOf https://github + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: '**/*requirements*.txt' + - name: install dependencies + run: make ci-install-types + - name: code qa + run: make ci-code-qa + - name: unit tests + run: make ci-test + + test-minimal: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + steps: + - uses: actions/checkout@v4 + - name: Set up Git with token to access other private repositories + run: git config --global url."https://${{ secrets.OTOMATOR_PAT }}@github".insteadOf https://github + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: '**/*requirements*.txt' + - name: install dependencies + run: make ci-install-api + - name: unit tests + run: make ci-test + + publish-api: + needs: + - test + - test-minimal + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + + defaults: + run: + working-directory: ./waylay-sdk-storage + + name: Publish api package to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/waylay-sdk-storage + + permissions: + actions: read + contents: read + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install pypa/build + run: pip install build + - name: check version + id: check-tag + uses: samuelcolvin/check-python-version@v4.1 + with: + version_file_path: waylay-sdk-storage/src/waylay/services/storage/service/__init__.py + - name: Build + run: python3 -m build + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: waylay-sdk-storage/dist + + publish-types: + needs: + - test + - test-minimal + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + + defaults: + run: + working-directory: ./waylay-sdk-storage-types + + name: Publish types package to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/waylay-sdk-storage-types + + + permissions: + actions: read + contents: read + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install pypa/build + run: pip install build + - name: check version + id: check-tag + uses: samuelcolvin/check-python-version@v4.1 + with: + version_file_path: waylay-sdk-storage-types/src/waylay/services/storage/models/__init__.py + - name: Build + run: python3 -m build + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: waylay-sdk-storage-types/dist \ No newline at end of file diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..1ab4126 --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,97 @@ +.github/workflows/python.yml +.openapi-generator-ignore +LICENSE.txt +Makefile +README.md +docs/AUTH.md +docs/AboutApi.md +docs/AuthenticationConfig.md +docs/BUCKETCREATIONSTATUS.md +docs/BUCKETPOLICYSTATUS.md +docs/Bucket.md +docs/BucketApi.md +docs/BucketConfiguration.md +docs/BucketListing.md +docs/BucketObject.md +docs/BucketObjectListing.md +docs/CHANNELTYPE.md +docs/Channel.md +docs/EventFilter.md +docs/Expiry.md +docs/HALEntity.md +docs/HALLink.md +docs/HTTPMETHOD.md +docs/HTTPValidationError.md +docs/Links.md +docs/LocationInner.md +docs/NotificationQueueStatus.md +docs/NotificationQueueStatusReport.md +docs/ObjectApi.md +docs/Operation.md +docs/PayloadConfig.md +docs/QUEUESETUPSTATUS.md +docs/ResponseList.md +docs/SIGN.md +docs/STORETYPE.md +docs/Store.md +docs/SubscriptionApi.md +docs/SubscriptionConfig.md +docs/Subscriptions.md +docs/SubscriptionsListing.md +docs/SystemChannelConfig.md +docs/SystemChannelConfigType.md +docs/TenantStatusReport.md +docs/VENTTYPE.md +docs/ValidationError.md +docs/WebScriptChannelConfig.md +docs/WebScriptChannelConfigType.md +pyproject.toml +requirements.txt +test/__init__.py +test/api/__init__.py +test/api/about_api_test.py +test/api/bucket_api_test.py +test/api/object_api_test.py +test/api/subscription_api_test.py +test/conftest.py +test/openapi.py +test/types/__init__.py +test/types/auth_stub.py +test/types/authentication_config_stub.py +test/types/bucket_configuration_stub.py +test/types/bucket_listing_stub.py +test/types/bucket_object_listing_stub.py +test/types/bucket_object_stub.py +test/types/bucket_stub.py +test/types/bucketcreationstatus_stub.py +test/types/bucketpolicystatus_stub.py +test/types/channel_stub.py +test/types/channeltype_stub.py +test/types/event_filter_stub.py +test/types/expiry_stub.py +test/types/hal_entity_stub.py +test/types/hal_link_stub.py +test/types/http_validation_error_stub.py +test/types/httpmethod_stub.py +test/types/links_stub.py +test/types/location_inner_stub.py +test/types/notification_queue_status_report_stub.py +test/types/notification_queue_status_stub.py +test/types/payload_config_stub.py +test/types/queuesetupstatus_stub.py +test/types/response_list_stub.py +test/types/sign_stub.py +test/types/store_stub.py +test/types/storetype_stub.py +test/types/subscription_config_stub.py +test/types/subscriptions_listing_stub.py +test/types/subscriptions_stub.py +test/types/system_channel_config_stub.py +test/types/system_channel_config_type_stub.py +test/types/tenant_status_report_stub.py +test/types/validation_error_stub.py +test/types/venttype_stub.py +test/types/web_script_channel_config_stub.py +test/types/web_script_channel_config_type_stub.py +waylay-sdk-storage-types/README.md +waylay-sdk-storage/README.md diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..4b49d9b --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.2.0 \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..2796771 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,13 @@ +ISC License (ISC) +Copyright 2024, Waylay + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, +OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7b0d2e7 --- /dev/null +++ b/Makefile @@ -0,0 +1,158 @@ +printMsg=printf "\033[36m\033[1m%-15s\033[0m\033[36m %-30s\033[0m\n" + +.PHONY: help test +## use triple hashes ### to indicate main build targets +help: + @awk 'BEGIN {FS = ":[^#]*? ### "} /^[a-zA-Z0-9_\-\.]+:[^#]* ### / {printf "\033[1m\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) + @awk 'BEGIN {FS = ":[^#]*? ## "} /^[a-zA-Z0-9_\-\.]+:[^#]* ## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) +.DEFAULT_GOAL := help + +SERVICE_NAME=storage + +API_FOLDER=waylay-sdk-${SERVICE_NAME} +API_SRC=${API_FOLDER}/src +TYPES_FOLDER=waylay-sdk-${SERVICE_NAME}-types +TYPES_SRC=${TYPES_FOLDER}/src +TEST_FOLDER=test +TEST_RUN_FOLDER=${TEST_FOLDER}/_run + +CMD_FORMAT=ruff format --no-respect-gitignore --preview +CMD_FIX=ruff check --fix --unsafe-fixes --no-respect-gitignore --preview +CMD_CHECK=ruff check --no-respect-gitignore --preview + +# disables test QA unless set to empty string +TEST_QA_PREFIX?=echo DISABLED + +VENV_DIR=.venv +VENV_TYPES_DIR=.venv/types +VENV_TYPES_ACTIVATE_CMD=${VENV_TYPES_DIR}/bin/activate +VENV_TYPES_ACTIVATE=. ${VENV_TYPES_ACTIVATE_CMD} + +${VENV_TYPES_ACTIVATE_CMD}: + python3 -m venv ${VENV_TYPES_DIR} + ${VENV_TYPES_ACTIVATE} && make exec-dev-install-types + +VENV_NOTYPES_DIR=.venv/notypes +VENV_NOTYPES_ACTIVATE_CMD=${VENV_NOTYPES_DIR}/bin/activate +VENV_NOTYPES_ACTIVATE=. ${VENV_NOTYPES_ACTIVATE_CMD} + +${VENV_NOTYPES_ACTIVATE_CMD}: + python3 -m venv ${VENV_NOTYPES_DIR} + ${VENV_NOTYPES_ACTIVATE} && make exec-dev-install-api + + +install-types: ${VENV_TYPES_ACTIVATE_CMD} + +install-notypes: ${VENV_NOTYPES_ACTIVATE_CMD} + +install: install-types + +clean: + rm -fr ${VENV_DIR} + rm -fr .*_cache + rm -fr */.*_cache + rm -fr */src/*.egg-info + rm -fr **/__pycache__ + rm -rf ${TEST_RUN_FOLDER} + +lint: install ### Run linting checks + @${VENV_TYPES_ACTIVATE} && make exec-lint + +typecheck: install ### Run type checks + @${VENV_TYPES_ACTIVATE} && make exec-typecheck + +code-qa: install ### perform code quality checks + @${VENV_TYPES_ACTIVATE} && make exec-code-qa + +test: test-notypes test-types ### Run unit tests with and without types installed + +test-types: install-types ### Run unit tests with types installed + @${VENV_TYPES_ACTIVATE} && make exec-test + @${printMsg} 'tests with types package installed' 'OK' + +test-notypes: install-notypes ### Run unit tests with types installed + @${VENV_NOTYPES_ACTIVATE} && make exec-test + @${printMsg} 'tests without types package installed' 'OK' + +format: install ### Format code + @${VENV_TYPES_ACTIVATE} && make exec-format + +exec-lint: ### Run linting checks + cd ${API_FOLDER} && ${CMD_CHECK} + @${printMsg} 'lint ${API_FOLDER}' 'OK' + cd ${TYPES_FOLDER} && ${CMD_CHECK} + @${printMsg} 'lint ${TYPES_FOLDER}' 'OK' + ${CMD_CHECK} + @${printMsg} 'lint test' 'OK' + +exec-typecheck: ### Run type checks + cd ${API_SRC}/ && mypy --namespace-packages -p waylay + @${printMsg} 'typecheck api' 'OK' + cd ${TYPES_SRC}/ && mypy --namespace-packages -p waylay + @${printMsg} 'typecheck types' 'OK' + ${TEST_QA_PREFIX} mypy ${TEST_FOLDER} + @${printMsg} 'typecheck test' '${TEST_QA_PREFIX} OK' + +${TEST_RUN_FOLDER}: # workaround for JSF schema resolution + mkdir -p ${TEST_RUN_FOLDER} + cp -r openapi ${TEST_RUN_FOLDER}/openapi + # let JSF loader resolve './xx.yaml' to 'openapi/xx.yaml.json' + # and make contentEncoding=base64 work + cd ${TEST_RUN_FOLDER}/openapi && for f in `ls *.yaml`; \ + do \ + cat $$f | yq 'tojson' | sed -e 's/"base64"/"base-64"/' > $$f.json; \ + cd .. && ln -s openapi/$$f.json $$f; cd openapi; \ + done + +exec-test: ${TEST_RUN_FOLDER} ### Run unit tests + cd ${TEST_RUN_FOLDER} && pytest .. + +exec-format: ### Format code + ${CMD_FIX} ${API_FOLDER} + ${CMD_FORMAT} ${API_FOLDER} + @${printMsg} 'format api' 'OK' + ${CMD_FIX} ${TYPES_FOLDER} + ${CMD_FORMAT} ${TYPES_FOLDER} + @${printMsg} 'format types' 'OK' + ${CMD_FIX} ${TEST_FOLDER} + ${CMD_FORMAT} ${TEST_FOLDER} + @${printMsg} 'format test' 'OK' + +exec-code-qa: exec-lint exec-typecheck ### perform code quality checks + +ci-code-qa: exec-code-qa ### perform ci code quality checks + +exec-dev-install-types: exec-dev-install-api ### Install the development environment including types + pip install -e ${TYPES_FOLDER}[dev] + +exec-dev-install-api: _install_requirements ### Install the minimal development environment + pip install -e ${API_FOLDER}[dev] + +ci-install-types: ci-install-api ### Install the environment including types with frozen requirements + pip install './${TYPES_FOLDER}[dev]' + +ci-install-api: _install_requirements ### Install the minimal environment with frozen requirements + pip install './${API_FOLDER}[dev]' + +ci-test: exec-test ### perform ci unit tests + +_install_requirements: + pip install --upgrade pip + pip install -r requirements.txt + +_GENERATED_FOLDER?=. +_GENERATED_FILES=.openapi-generator/FILES + +_clean_gen: ### Removes all code-generated files + @test -s ${_GENERATED_FOLDER}/${_GENERATED_FILES} || ( \ + ${printMsg} 'clean-generated ${_GENERATED_FOLDER}' 'FAILED (no ${_GENERATED_FILES}).' \ + && exit -1 \ + ) + cd ${_GENERATED_FOLDER} && xargs rm -f < ${_GENERATED_FILES} && find . -empty -type d -delete + @${printMsg} 'clean-generated ${_GENERATED_FOLDER}' 'OK' + +clean-generated: ### Removes all code-generated files + @make clean + @_GENERATED_FOLDER=${TYPES_FOLDER} make _clean_gen + @_GENERATED_FOLDER=${API_FOLDER} make _clean_gen + @_GENERATED_FOLDER='.' make _clean_gen diff --git a/README.md b/README.md new file mode 100644 index 0000000..a227e8a --- /dev/null +++ b/README.md @@ -0,0 +1,115 @@ +# Waylay Storage Service + +Manage storage buckets and subscriptions. + + +This Python package is automatically generated based on the +Waylay Storage OpenAPI specification (API version: 0.4.1) +For more information, please visit [the openapi specification](https://docs.waylay.io/openapi/public/redocly/storage.html). + +It consists of two sub-packages that are both plugins for the waylay-sdk-core package. +- The `waylay-sdk-storage` sub-package contains the Storage api methods. +- The `waylay-sdk-storage-types` sub-package is an extension that contains the typed model classes for all path params, query params, body params and responses for each of the api methods in `waylay-sdk-storage`. + +## Requirements. +This package requires Python 3.9+. + +## Installation +Typically this package is installed when installing the [waylay-sdk-core](https://pypi.org/project/waylay-sdk/) package to enable the service's functionality. +When the service api methods are required, waylay-sdk-storage is included in: +- ```pip install waylay-sdk-core[storage]``` to install `waylay-sdk-core` along with only this service, or +- ```pip install waylay-sdk-core[services]``` to install `waylay-sdk-core` along with all services. +When the typed models are required, both waylay-sdk-storage and waylay-sdk-storage-types are included in: +- ```pip install waylay-sdk-core[storage,storage-types]``` to install `waylay-sdk-core` along with only this service including the typed models, or +- ```pip install waylay-sdk-core[services,services-types]``` to install `waylay-sdk-core` along with all services along with the typed models. + +## Usage + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +try: + # Version + # calls `GET /storage/v1/` + api_response = await waylay_client.storage.about.version( + ) + print("The response of storage.about.version:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.about.version: %s\n" % e) +``` + + +For more information, please visit the [Waylay API documentation](https://docs.waylay.io/#/api/?id=software-development-kits). + +## Documentation for API Endpoints + +All URIs are relative to *https://api.waylay.io* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AboutApi* | [**status**](docs/AboutApi.md#status) | **GET** /storage/v1/status | Status +*AboutApi* | [**version**](docs/AboutApi.md#version) | **GET** /storage/v1/ | Version +*BucketApi* | [**get**](docs/BucketApi.md#get) | **GET** /storage/v1/bucket/{bucket_name} | Get Bucket +*BucketApi* | [**list**](docs/BucketApi.md#list) | **GET** /storage/v1/bucket | List Buckets +*ObjectApi* | [**copy_or_move**](docs/ObjectApi.md#copy_or_move) | **PUT** /storage/v1/bucket/{bucket_name}/{target_path} | Copy Or Move Object +*ObjectApi* | [**create_folder**](docs/ObjectApi.md#create_folder) | **PUT** /storage/v1/bucket/{bucket_name}/{object_path}/ | Create Folder +*ObjectApi* | [**list**](docs/ObjectApi.md#list) | **GET** /storage/v1/bucket/{bucket_name}/{object_path} | List Objects +*ObjectApi* | [**remove**](docs/ObjectApi.md#remove) | **DELETE** /storage/v1/bucket/{bucket_name}/{object_path} | Remove Object Or Folder +*SubscriptionApi* | [**create**](docs/SubscriptionApi.md#create) | **POST** /storage/v1/subscription/{bucket_name} | Create Bucket Subscription +*SubscriptionApi* | [**delete_by**](docs/SubscriptionApi.md#delete_by) | **DELETE** /storage/v1/subscription/{bucket_name} | Delete All Bucket Subscriptions +*SubscriptionApi* | [**get**](docs/SubscriptionApi.md#get) | **GET** /storage/v1/subscription/{bucket_name}/{subscription_id} | Get Bucket Subscription +*SubscriptionApi* | [**list**](docs/SubscriptionApi.md#list) | **GET** /storage/v1/subscription | Query All Subscriptions +*SubscriptionApi* | [**query**](docs/SubscriptionApi.md#query) | **GET** /storage/v1/subscription/{bucket_name} | Query Bucket Subscriptions +*SubscriptionApi* | [**remove**](docs/SubscriptionApi.md#remove) | **DELETE** /storage/v1/subscription/{bucket_name}/{subscription_id} | Delete Bucket Subscription +*SubscriptionApi* | [**replace**](docs/SubscriptionApi.md#replace) | **PUT** /storage/v1/subscription/{bucket_name}/{subscription_id} | Replace Bucket Subscription + + +## Documentation For Models + + - [AUTH](docs/AUTH.md) + - [AuthenticationConfig](docs/AuthenticationConfig.md) + - [BUCKETCREATIONSTATUS](docs/BUCKETCREATIONSTATUS.md) + - [BUCKETPOLICYSTATUS](docs/BUCKETPOLICYSTATUS.md) + - [Bucket](docs/Bucket.md) + - [BucketConfiguration](docs/BucketConfiguration.md) + - [BucketListing](docs/BucketListing.md) + - [BucketObject](docs/BucketObject.md) + - [BucketObjectListing](docs/BucketObjectListing.md) + - [CHANNELTYPE](docs/CHANNELTYPE.md) + - [Channel](docs/Channel.md) + - [EventFilter](docs/EventFilter.md) + - [Expiry](docs/Expiry.md) + - [HALEntity](docs/HALEntity.md) + - [HALLink](docs/HALLink.md) + - [HTTPMETHOD](docs/HTTPMETHOD.md) + - [HTTPValidationError](docs/HTTPValidationError.md) + - [Links](docs/Links.md) + - [LocationInner](docs/LocationInner.md) + - [NotificationQueueStatus](docs/NotificationQueueStatus.md) + - [NotificationQueueStatusReport](docs/NotificationQueueStatusReport.md) + - [PayloadConfig](docs/PayloadConfig.md) + - [QUEUESETUPSTATUS](docs/QUEUESETUPSTATUS.md) + - [ResponseList](docs/ResponseList.md) + - [SIGN](docs/SIGN.md) + - [STORETYPE](docs/STORETYPE.md) + - [Store](docs/Store.md) + - [SubscriptionConfig](docs/SubscriptionConfig.md) + - [Subscriptions](docs/Subscriptions.md) + - [SubscriptionsListing](docs/SubscriptionsListing.md) + - [SystemChannelConfig](docs/SystemChannelConfig.md) + - [SystemChannelConfigType](docs/SystemChannelConfigType.md) + - [TenantStatusReport](docs/TenantStatusReport.md) + - [VENTTYPE](docs/VENTTYPE.md) + - [ValidationError](docs/ValidationError.md) + - [WebScriptChannelConfig](docs/WebScriptChannelConfig.md) + - [WebScriptChannelConfigType](docs/WebScriptChannelConfigType.md) + diff --git a/docs/AUTH.md b/docs/AUTH.md new file mode 100644 index 0000000..e46964f --- /dev/null +++ b/docs/AUTH.md @@ -0,0 +1,12 @@ +# AUTH + +Supported authentication methods for notifications. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/AboutApi.md b/docs/AboutApi.md new file mode 100644 index 0000000..24d64f2 --- /dev/null +++ b/docs/AboutApi.md @@ -0,0 +1,150 @@ +# waylay.services.storage.AboutApi + +All URIs are relative to *https://api.waylay.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**status**](AboutApi.md#status) | **GET** /storage/v1/status | Status +[**version**](AboutApi.md#version) | **GET** /storage/v1/ | Version + +# **status** +> status( +> query: StatusQuery, +> headers +> ) -> TenantStatusReport + +Status + +Validate consistency of buckets and notification queues for this tenant. + +### Example + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +from waylay.services.storage.models.tenant_status_report import TenantStatusReport +try: + # Status + # calls `GET /storage/v1/status` + api_response = await waylay_client.storage.about.status( + # query parameters: + query = { + 'include_buckets': True + 'include_queues': True + 'include_disk_usage': False + }, + ) + print("The response of storage.about.status:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.about.status: %s\n" % e) +``` + +### Endpoint +``` +GET /storage/v1/status +``` +### Parameters + +Name | Type | API binding | Description | Notes +-------- | ----- | ------------- | ------------- | ------------- +**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | +**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] +**query['include_buckets']** (dict)
**query.include_buckets** (Query) | **bool** | query parameter `"include_buckets"` | | [optional] [default True] +**query['include_queues']** (dict)
**query.include_queues** (Query) | **bool** | query parameter `"include_queues"` | | [optional] [default True] +**query['include_disk_usage']** (dict)
**query.include_disk_usage** (Query) | **bool** | query parameter `"include_disk_usage"` | | [optional] [default False] +**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | + +### Return type + +Selected path param | Raw response param | Return Type | Description | Links +------------------- | ------------------ | ------------ | ----------- | ----- +Literal[""] _(default)_ | False _(default)_ | **`TenantStatusReport`** | | [TenantStatusReport](TenantStatusReport.md) +str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | +/ | True | `Response` | The raw http response object. + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **version** +> version( +> headers +> ) -> str + +Version + +Get the application version. + +### Example + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +try: + # Version + # calls `GET /storage/v1/` + api_response = await waylay_client.storage.about.version( + ) + print("The response of storage.about.version:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.about.version: %s\n" % e) +``` + +### Endpoint +``` +GET /storage/v1/ +``` +### Parameters + +This endpoint does not need any parameter. +**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | + +### Return type + +Selected path param | Raw response param | Return Type | Description | Links +------------------- | ------------------ | ------------ | ----------- | ----- +Literal[""] _(default)_ | False _(default)_ | **`str`** | | +str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | +/ | True | `Response` | The raw http response object. + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/AuthenticationConfig.md b/docs/AuthenticationConfig.md new file mode 100644 index 0000000..f8e317f --- /dev/null +++ b/docs/AuthenticationConfig.md @@ -0,0 +1,32 @@ +# AuthenticationConfig + +Configuration for the authentication method used when forwarding an event to a channel. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**method** | [**AUTH**](AUTH.md) | | [optional] +**key** | **str** | | [optional] +**secret** | **str** | | [optional] + +## Example + +```python +from waylay.services.storage.models.authentication_config import AuthenticationConfig + +# TODO update the JSON string below +json = "{}" +# create an instance of AuthenticationConfig from a JSON string +authentication_config_instance = AuthenticationConfig.from_json(json) +# print the JSON string representation of the object +print AuthenticationConfig.to_json() + +# convert the object into a dict +authentication_config_dict = authentication_config_instance.to_dict() +# create an instance of AuthenticationConfig from a dict +authentication_config_form_dict = authentication_config.from_dict(authentication_config_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BUCKETCREATIONSTATUS.md b/docs/BUCKETCREATIONSTATUS.md new file mode 100644 index 0000000..563dd79 --- /dev/null +++ b/docs/BUCKETCREATIONSTATUS.md @@ -0,0 +1,12 @@ +# BUCKETCREATIONSTATUS + +Possbile bucket creation status codes. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BUCKETPOLICYSTATUS.md b/docs/BUCKETPOLICYSTATUS.md new file mode 100644 index 0000000..612ee81 --- /dev/null +++ b/docs/BUCKETPOLICYSTATUS.md @@ -0,0 +1,12 @@ +# BUCKETPOLICYSTATUS + +Possible bucket policy status codes. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Bucket.md b/docs/Bucket.md new file mode 100644 index 0000000..d67db46 --- /dev/null +++ b/docs/Bucket.md @@ -0,0 +1,35 @@ +# Bucket + +Representation of a storage bucket. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**Dict[str, Links]**](Links.md) | | [optional] +**alias** | **str** | | [optional] +**name** | **str** | | +**store** | [**Store**](Store.md) | | [optional] +**creation_date** | **datetime** | | [optional] +**size** | **int** | | [optional] + +## Example + +```python +from waylay.services.storage.models.bucket import Bucket + +# TODO update the JSON string below +json = "{}" +# create an instance of Bucket from a JSON string +bucket_instance = Bucket.from_json(json) +# print the JSON string representation of the object +print Bucket.to_json() + +# convert the object into a dict +bucket_dict = bucket_instance.to_dict() +# create an instance of Bucket from a dict +bucket_form_dict = bucket.from_dict(bucket_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BucketApi.md b/docs/BucketApi.md new file mode 100644 index 0000000..6d0478f --- /dev/null +++ b/docs/BucketApi.md @@ -0,0 +1,156 @@ +# waylay.services.storage.BucketApi + +All URIs are relative to *https://api.waylay.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get**](BucketApi.md#get) | **GET** /storage/v1/bucket/{bucket_name} | Get Bucket +[**list**](BucketApi.md#list) | **GET** /storage/v1/bucket | List Buckets + +# **get** +> get( +> bucket_name: str, +> query: GetQuery, +> headers +> ) -> Bucket + +Get Bucket + +Get a descriptive representation of a bucket. + +### Example + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +from waylay.services.storage.models.bucket import Bucket +try: + # Get Bucket + # calls `GET /storage/v1/bucket/{bucket_name}` + api_response = await waylay_client.storage.bucket.get( + 'bucket_name_example', # bucket_name | path param "bucket_name" + # query parameters: + query = { + }, + ) + print("The response of storage.bucket.get:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.bucket.get: %s\n" % e) +``` + +### Endpoint +``` +GET /storage/v1/bucket/{bucket_name} +``` +### Parameters + +Name | Type | API binding | Description | Notes +-------- | ----- | ------------- | ------------- | ------------- +**bucket_name** | **str** | path parameter `"bucket_name"` | | +**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | +**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] +**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | + +### Return type + +Selected path param | Raw response param | Return Type | Description | Links +------------------- | ------------------ | ------------ | ----------- | ----- +Literal[""] _(default)_ | False _(default)_ | **`Bucket`** | | [Bucket](Bucket.md) +str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | +/ | True | `Response` | The raw http response object. + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **list** +> list( +> query: ListQuery, +> headers +> ) -> BucketListing + +List Buckets + +List authorized buckets. + +### Example + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +from waylay.services.storage.models.bucket_listing import BucketListing +try: + # List Buckets + # calls `GET /storage/v1/bucket` + api_response = await waylay_client.storage.bucket.list( + # query parameters: + query = { + }, + ) + print("The response of storage.bucket.list:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.bucket.list: %s\n" % e) +``` + +### Endpoint +``` +GET /storage/v1/bucket +``` +### Parameters + +Name | Type | API binding | Description | Notes +-------- | ----- | ------------- | ------------- | ------------- +**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | +**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] +**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | + +### Return type + +Selected path param | Raw response param | Return Type | Description | Links +------------------- | ------------------ | ------------ | ----------- | ----- +Literal[""] _(default)_ | False _(default)_ | **`BucketListing`** | | [BucketListing](BucketListing.md) +str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | +/ | True | `Response` | The raw http response object. + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/BucketConfiguration.md b/docs/BucketConfiguration.md new file mode 100644 index 0000000..62a0f2f --- /dev/null +++ b/docs/BucketConfiguration.md @@ -0,0 +1,39 @@ +# BucketConfiguration + +Representation of a bucket configuration. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**Dict[str, Links]**](Links.md) | | [optional] +**alias** | **str** | | [optional] +**name** | **str** | | +**store** | [**Store**](Store.md) | | [optional] +**creation_date** | **datetime** | | [optional] +**size** | **int** | | [optional] +**status** | [**BUCKETCREATIONSTATUS**](BUCKETCREATIONSTATUS.md) | | [optional] +**public_policy_json** | **object** | | [optional] +**public_policy_type** | **str** | | [optional] +**error** | **str** | | [optional] + +## Example + +```python +from waylay.services.storage.models.bucket_configuration import BucketConfiguration + +# TODO update the JSON string below +json = "{}" +# create an instance of BucketConfiguration from a JSON string +bucket_configuration_instance = BucketConfiguration.from_json(json) +# print the JSON string representation of the object +print BucketConfiguration.to_json() + +# convert the object into a dict +bucket_configuration_dict = bucket_configuration_instance.to_dict() +# create an instance of BucketConfiguration from a dict +bucket_configuration_form_dict = bucket_configuration.from_dict(bucket_configuration_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BucketListing.md b/docs/BucketListing.md new file mode 100644 index 0000000..bf62795 --- /dev/null +++ b/docs/BucketListing.md @@ -0,0 +1,31 @@ +# BucketListing + +List of Bucket representations. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**Dict[str, Links]**](Links.md) | | [optional] +**buckets** | [**List[Bucket]**](Bucket.md) | | + +## Example + +```python +from waylay.services.storage.models.bucket_listing import BucketListing + +# TODO update the JSON string below +json = "{}" +# create an instance of BucketListing from a JSON string +bucket_listing_instance = BucketListing.from_json(json) +# print the JSON string representation of the object +print BucketListing.to_json() + +# convert the object into a dict +bucket_listing_dict = bucket_listing_instance.to_dict() +# create an instance of BucketListing from a dict +bucket_listing_form_dict = bucket_listing.from_dict(bucket_listing_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BucketObject.md b/docs/BucketObject.md new file mode 100644 index 0000000..4dc673b --- /dev/null +++ b/docs/BucketObject.md @@ -0,0 +1,40 @@ +# BucketObject + +Representation of a storage object. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**Dict[str, Links]**](Links.md) | | [optional] +**bucket** | [**Bucket**](Bucket.md) | | +**name** | **str** | | +**last_modified** | **datetime** | | [optional] +**etag** | **str** | | [optional] +**size** | **int** | | [optional] +**content_type** | **str** | | [optional] +**is_dir** | **bool** | | [optional] [default to False] +**storage_class** | **str** | | [optional] +**owner_id** | **str** | | [optional] +**owner_name** | **str** | | [optional] + +## Example + +```python +from waylay.services.storage.models.bucket_object import BucketObject + +# TODO update the JSON string below +json = "{}" +# create an instance of BucketObject from a JSON string +bucket_object_instance = BucketObject.from_json(json) +# print the JSON string representation of the object +print BucketObject.to_json() + +# convert the object into a dict +bucket_object_dict = bucket_object_instance.to_dict() +# create an instance of BucketObject from a dict +bucket_object_form_dict = bucket_object.from_dict(bucket_object_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BucketObjectListing.md b/docs/BucketObjectListing.md new file mode 100644 index 0000000..51d906a --- /dev/null +++ b/docs/BucketObjectListing.md @@ -0,0 +1,31 @@ +# BucketObjectListing + +List of storage object representations. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**Dict[str, Links]**](Links.md) | | [optional] +**objects** | [**List[BucketObject]**](BucketObject.md) | | + +## Example + +```python +from waylay.services.storage.models.bucket_object_listing import BucketObjectListing + +# TODO update the JSON string below +json = "{}" +# create an instance of BucketObjectListing from a JSON string +bucket_object_listing_instance = BucketObjectListing.from_json(json) +# print the JSON string representation of the object +print BucketObjectListing.to_json() + +# convert the object into a dict +bucket_object_listing_dict = bucket_object_listing_instance.to_dict() +# create an instance of BucketObjectListing from a dict +bucket_object_listing_form_dict = bucket_object_listing.from_dict(bucket_object_listing_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CHANNELTYPE.md b/docs/CHANNELTYPE.md new file mode 100644 index 0000000..cd0d3dc --- /dev/null +++ b/docs/CHANNELTYPE.md @@ -0,0 +1,12 @@ +# CHANNELTYPE + +Supported notification channel types. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Channel.md b/docs/Channel.md new file mode 100644 index 0000000..96f4b9f --- /dev/null +++ b/docs/Channel.md @@ -0,0 +1,36 @@ +# Channel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**SystemChannelConfigType**](SystemChannelConfigType.md) | | [optional] +**description** | **str** | | [optional] +**payload** | [**PayloadConfig**](PayloadConfig.md) | | [optional] +**authentication** | [**AuthenticationConfig**](AuthenticationConfig.md) | | [optional] +**expiry** | [**Expiry**](Expiry.md) | | [optional] +**name** | **str** | | +**version** | **str** | | [optional] +**method** | [**HTTPMETHOD**](HTTPMETHOD.md) | | [optional] + +## Example + +```python +from waylay.services.storage.models.channel import Channel + +# TODO update the JSON string below +json = "{}" +# create an instance of Channel from a JSON string +channel_instance = Channel.from_json(json) +# print the JSON string representation of the object +print Channel.to_json() + +# convert the object into a dict +channel_dict = channel_instance.to_dict() +# create an instance of Channel from a dict +channel_form_dict = channel.from_dict(channel_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/EventFilter.md b/docs/EventFilter.md new file mode 100644 index 0000000..4e8f96b --- /dev/null +++ b/docs/EventFilter.md @@ -0,0 +1,34 @@ +# EventFilter + +Filter on change events in a storage backend. The `prefix` and `suffix` properties are conditions on the object path (not including the bucket name). When not specified, all paths in the bucket will selected. The `events` property can contain `put` and/or `delete` values, corresponding to create/update and deletion events. When not specified, only the create/update events are filtered. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**prefix** | **str** | | [optional] +**suffix** | **str** | | [optional] +**events** | [**List[VENTTYPE]**](VENTTYPE.md) | | [optional] [default to ["put"]] +**description** | **str** | | [optional] +**queue** | **str** | | [optional] + +## Example + +```python +from waylay.services.storage.models.event_filter import EventFilter + +# TODO update the JSON string below +json = "{}" +# create an instance of EventFilter from a JSON string +event_filter_instance = EventFilter.from_json(json) +# print the JSON string representation of the object +print EventFilter.to_json() + +# convert the object into a dict +event_filter_dict = event_filter_instance.to_dict() +# create an instance of EventFilter from a dict +event_filter_form_dict = event_filter.from_dict(event_filter_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Expiry.md b/docs/Expiry.md new file mode 100644 index 0000000..7add143 --- /dev/null +++ b/docs/Expiry.md @@ -0,0 +1,32 @@ +# Expiry + +Input model for expiry parameters. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seconds** | **int** | | [optional] +**hours** | **int** | | [optional] +**days** | **int** | | [optional] + +## Example + +```python +from waylay.services.storage.models.expiry import Expiry + +# TODO update the JSON string below +json = "{}" +# create an instance of Expiry from a JSON string +expiry_instance = Expiry.from_json(json) +# print the JSON string representation of the object +print Expiry.to_json() + +# convert the object into a dict +expiry_dict = expiry_instance.to_dict() +# create an instance of Expiry from a dict +expiry_form_dict = expiry.from_dict(expiry_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/HALEntity.md b/docs/HALEntity.md new file mode 100644 index 0000000..f4255c0 --- /dev/null +++ b/docs/HALEntity.md @@ -0,0 +1,30 @@ +# HALEntity + +Output model representing a collection of HAL links. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**Dict[str, Links]**](Links.md) | | [optional] + +## Example + +```python +from waylay.services.storage.models.hal_entity import HALEntity + +# TODO update the JSON string below +json = "{}" +# create an instance of HALEntity from a JSON string +hal_entity_instance = HALEntity.from_json(json) +# print the JSON string representation of the object +print HALEntity.to_json() + +# convert the object into a dict +hal_entity_dict = hal_entity_instance.to_dict() +# create an instance of HALEntity from a dict +hal_entity_form_dict = hal_entity.from_dict(hal_entity_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/HALLink.md b/docs/HALLink.md new file mode 100644 index 0000000..c10be67 --- /dev/null +++ b/docs/HALLink.md @@ -0,0 +1,32 @@ +# HALLink + +Represents a HAL link. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **str** | | +**method** | **str** | | [optional] +**form_data** | **object** | | [optional] + +## Example + +```python +from waylay.services.storage.models.hal_link import HALLink + +# TODO update the JSON string below +json = "{}" +# create an instance of HALLink from a JSON string +hal_link_instance = HALLink.from_json(json) +# print the JSON string representation of the object +print HALLink.to_json() + +# convert the object into a dict +hal_link_dict = hal_link_instance.to_dict() +# create an instance of HALLink from a dict +hal_link_form_dict = hal_link.from_dict(hal_link_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/HTTPMETHOD.md b/docs/HTTPMETHOD.md new file mode 100644 index 0000000..b09687a --- /dev/null +++ b/docs/HTTPMETHOD.md @@ -0,0 +1,12 @@ +# HTTPMETHOD + +Supported notification methods. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/HTTPValidationError.md b/docs/HTTPValidationError.md new file mode 100644 index 0000000..f118084 --- /dev/null +++ b/docs/HTTPValidationError.md @@ -0,0 +1,29 @@ +# HTTPValidationError + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**detail** | [**List[ValidationError]**](ValidationError.md) | | [optional] + +## Example + +```python +from waylay.services.storage.models.http_validation_error import HTTPValidationError + +# TODO update the JSON string below +json = "{}" +# create an instance of HTTPValidationError from a JSON string +http_validation_error_instance = HTTPValidationError.from_json(json) +# print the JSON string representation of the object +print HTTPValidationError.to_json() + +# convert the object into a dict +http_validation_error_dict = http_validation_error_instance.to_dict() +# create an instance of HTTPValidationError from a dict +http_validation_error_form_dict = http_validation_error.from_dict(http_validation_error_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Links.md b/docs/Links.md new file mode 100644 index 0000000..4c670e1 --- /dev/null +++ b/docs/Links.md @@ -0,0 +1,31 @@ +# Links + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **str** | | +**method** | **str** | | [optional] +**form_data** | **object** | | [optional] + +## Example + +```python +from waylay.services.storage.models.links import Links + +# TODO update the JSON string below +json = "{}" +# create an instance of Links from a JSON string +links_instance = Links.from_json(json) +# print the JSON string representation of the object +print Links.to_json() + +# convert the object into a dict +links_dict = links_instance.to_dict() +# create an instance of Links from a dict +links_form_dict = links.from_dict(links_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/LocationInner.md b/docs/LocationInner.md new file mode 100644 index 0000000..01ca113 --- /dev/null +++ b/docs/LocationInner.md @@ -0,0 +1,28 @@ +# LocationInner + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from waylay.services.storage.models.location_inner import LocationInner + +# TODO update the JSON string below +json = "{}" +# create an instance of LocationInner from a JSON string +location_inner_instance = LocationInner.from_json(json) +# print the JSON string representation of the object +print LocationInner.to_json() + +# convert the object into a dict +location_inner_dict = location_inner_instance.to_dict() +# create an instance of LocationInner from a dict +location_inner_form_dict = location_inner.from_dict(location_inner_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NotificationQueueStatus.md b/docs/NotificationQueueStatus.md new file mode 100644 index 0000000..1187613 --- /dev/null +++ b/docs/NotificationQueueStatus.md @@ -0,0 +1,35 @@ +# NotificationQueueStatus + +Response model for the notification queue configuration. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | [**QUEUESETUPSTATUS**](QUEUESETUPSTATUS.md) | | +**name** | **str** | | +**method** | **str** | | +**configured_parameters** | **object** | | [optional] +**actual_parameters** | **object** | | [optional] +**error** | **str** | | [optional] + +## Example + +```python +from waylay.services.storage.models.notification_queue_status import NotificationQueueStatus + +# TODO update the JSON string below +json = "{}" +# create an instance of NotificationQueueStatus from a JSON string +notification_queue_status_instance = NotificationQueueStatus.from_json(json) +# print the JSON string representation of the object +print NotificationQueueStatus.to_json() + +# convert the object into a dict +notification_queue_status_dict = notification_queue_status_instance.to_dict() +# create an instance of NotificationQueueStatus from a dict +notification_queue_status_form_dict = notification_queue_status.from_dict(notification_queue_status_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NotificationQueueStatusReport.md b/docs/NotificationQueueStatusReport.md new file mode 100644 index 0000000..2a0143b --- /dev/null +++ b/docs/NotificationQueueStatusReport.md @@ -0,0 +1,32 @@ +# NotificationQueueStatusReport + +Response model for a notification queue status report. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**store** | **str** | | +**notification_queues** | [**List[NotificationQueueStatus]**](NotificationQueueStatus.md) | | +**messages** | **List[object]** | | [optional] + +## Example + +```python +from waylay.services.storage.models.notification_queue_status_report import NotificationQueueStatusReport + +# TODO update the JSON string below +json = "{}" +# create an instance of NotificationQueueStatusReport from a JSON string +notification_queue_status_report_instance = NotificationQueueStatusReport.from_json(json) +# print the JSON string representation of the object +print NotificationQueueStatusReport.to_json() + +# convert the object into a dict +notification_queue_status_report_dict = notification_queue_status_report_instance.to_dict() +# create an instance of NotificationQueueStatusReport from a dict +notification_queue_status_report_form_dict = notification_queue_status_report.from_dict(notification_queue_status_report_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ObjectApi.md b/docs/ObjectApi.md new file mode 100644 index 0000000..b8d2e99 --- /dev/null +++ b/docs/ObjectApi.md @@ -0,0 +1,354 @@ +# waylay.services.storage.ObjectApi + +All URIs are relative to *https://api.waylay.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**copy_or_move**](ObjectApi.md#copy_or_move) | **PUT** /storage/v1/bucket/{bucket_name}/{target_path} | Copy Or Move Object +[**create_folder**](ObjectApi.md#create_folder) | **PUT** /storage/v1/bucket/{bucket_name}/{object_path}/ | Create Folder +[**list**](ObjectApi.md#list) | **GET** /storage/v1/bucket/{bucket_name}/{object_path} | List Objects +[**remove**](ObjectApi.md#remove) | **DELETE** /storage/v1/bucket/{bucket_name}/{object_path} | Remove Object Or Folder + +# **copy_or_move** +> copy_or_move( +> bucket_name: str, +> target_path: str, +> query: CopyOrMoveQuery, +> headers +> ) -> HALEntity + +Copy Or Move Object + +Copy or move object to new location. + +### Example + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +from waylay.services.storage.models.hal_entity import HALEntity +try: + # Copy Or Move Object + # calls `PUT /storage/v1/bucket/{bucket_name}/{target_path}` + api_response = await waylay_client.storage.object.copy_or_move( + 'bucket_name_example', # bucket_name | path param "bucket_name" + 'target_path_example', # target_path | path param "target_path" + # query parameters: + query = { + 'move': False + }, + ) + print("The response of storage.object.copy_or_move:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.object.copy_or_move: %s\n" % e) +``` + +### Endpoint +``` +PUT /storage/v1/bucket/{bucket_name}/{target_path} +``` +### Parameters + +Name | Type | API binding | Description | Notes +-------- | ----- | ------------- | ------------- | ------------- +**bucket_name** | **str** | path parameter `"bucket_name"` | | +**target_path** | **str** | path parameter `"target_path"` | | +**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | +**query['source']** (dict)
**query.source** (Query) | **str** | query parameter `"source"` | | +**query['move']** (dict)
**query.move** (Query) | **bool** | query parameter `"move"` | | [optional] [default False] +**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] +**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | + +### Return type + +Selected path param | Raw response param | Return Type | Description | Links +------------------- | ------------------ | ------------ | ----------- | ----- +Literal[""] _(default)_ | False _(default)_ | **`HALEntity`** | | [HALEntity](HALEntity.md) +str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | +/ | True | `Response` | The raw http response object. + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **create_folder** +> create_folder( +> bucket_name: str, +> object_path: str, +> query: CreateFolderQuery, +> headers +> ) -> BucketObject + +Create Folder + +Create a (virtual) folder. * (`all=true`) force creation of a hidden folder, having a path element that starts with a `.`. + +### Example + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +from waylay.services.storage.models.bucket_object import BucketObject +try: + # Create Folder + # calls `PUT /storage/v1/bucket/{bucket_name}/{object_path}/` + api_response = await waylay_client.storage.object.create_folder( + 'bucket_name_example', # bucket_name | path param "bucket_name" + 'object_path_example', # object_path | path param "object_path" + # query parameters: + query = { + 'all': False + }, + ) + print("The response of storage.object.create_folder:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.object.create_folder: %s\n" % e) +``` + +### Endpoint +``` +PUT /storage/v1/bucket/{bucket_name}/{object_path}/ +``` +### Parameters + +Name | Type | API binding | Description | Notes +-------- | ----- | ------------- | ------------- | ------------- +**bucket_name** | **str** | path parameter `"bucket_name"` | | +**object_path** | **str** | path parameter `"object_path"` | | +**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | +**query['all']** (dict)
**query.all** (Query) | **bool** | query parameter `"all"` | | [optional] [default False] +**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] +**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | + +### Return type + +Selected path param | Raw response param | Return Type | Description | Links +------------------- | ------------------ | ------------ | ----------- | ----- +Literal[""] _(default)_ | False _(default)_ | **`BucketObject`** | | [BucketObject](BucketObject.md) +str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | +/ | True | `Response` | The raw http response object. + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **list** +> list( +> bucket_name: str, +> object_path: str, +> query: ListQuery, +> headers +> ) -> ResponseList + +List Objects + +List, inspect or sign objects. * list the objects of a bucket with {object_path} prefix * (`recursive=true`) list content recursively * (`all=true`) include hidden objects * (`stat=true`) get the meta of the object at {object_path} * (`sign=[GET,PUT,POST]`) fetch presigned urls to operate on {object_path} * (`all=true`) allow link creation for hidden objects + +### Example + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +from waylay.services.storage.models.response_list import ResponseList +try: + # List Objects + # calls `GET /storage/v1/bucket/{bucket_name}/{object_path}` + api_response = await waylay_client.storage.object.list( + 'bucket_name_example', # bucket_name | path param "bucket_name" + 'object_path_example', # object_path | path param "object_path" + # query parameters: + query = { + 'stat': False + 'recursive': True + 'all': True + 'fetch_content_type': True + 'get_as_attachment': True + 'content_length_min': 0 + }, + ) + print("The response of storage.object.list:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.object.list: %s\n" % e) +``` + +### Endpoint +``` +GET /storage/v1/bucket/{bucket_name}/{object_path} +``` +### Parameters + +Name | Type | API binding | Description | Notes +-------- | ----- | ------------- | ------------- | ------------- +**bucket_name** | **str** | path parameter `"bucket_name"` | | +**object_path** | **str** | path parameter `"object_path"` | | +**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | +**query['stat']** (dict)
**query.stat** (Query) | **bool** | query parameter `"stat"` | | [optional] [default False] +**query['recursive']** (dict)
**query.recursive** (Query) | **bool** | query parameter `"recursive"` | | [optional] +**query['all']** (dict)
**query.all** (Query) | **bool** | query parameter `"all"` | | [optional] +**query['start_after']** (dict)
**query.start_after** (Query) | **str** | query parameter `"start_after"` | | [optional] +**query['fetch_content_type']** (dict)
**query.fetch_content_type** (Query) | **bool** | query parameter `"fetch_content_type"` | | [optional] [default True] +**query['get_as_attachment']** (dict)
**query.get_as_attachment** (Query) | **bool** | query parameter `"get_as_attachment"` | | [optional] [default True] +**query['max_keys']** (dict)
**query.max_keys** (Query) | **int** | query parameter `"max_keys"` | | [optional] +**query['sign']** (dict)
**query.sign** (Query) | **str** | query parameter `"sign"` | | [optional] +**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] +**query['expiry_days']** (dict)
**query.expiry_days** (Query) | **int** | query parameter `"expiry_days"` | | [optional] +**query['expiry_hours']** (dict)
**query.expiry_hours** (Query) | **int** | query parameter `"expiry_hours"` | | [optional] +**query['expiry_seconds']** (dict)
**query.expiry_seconds** (Query) | **int** | query parameter `"expiry_seconds"` | | [optional] +**query['content_length_min']** (dict)
**query.content_length_min** (Query) | **int** | query parameter `"content_length_min"` | | [optional] [default 0] +**query['content_length_max']** (dict)
**query.content_length_max** (Query) | **int** | query parameter `"content_length_max"` | | [optional] +**query['content_type']** (dict)
**query.content_type** (Query) | **str** | query parameter `"content_type"` | | [optional] +**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | + +### Return type + +Selected path param | Raw response param | Return Type | Description | Links +------------------- | ------------------ | ------------ | ----------- | ----- +Literal[""] _(default)_ | False _(default)_ | **`ResponseList`** | | [ResponseList](ResponseList.md) +str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | +/ | True | `Response` | The raw http response object. + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **remove** +> remove( +> bucket_name: str, +> object_path: str, +> query: RemoveQuery, +> headers +> ) -> HALEntity + +Remove Object Or Folder + +Remove the object or folder at {object_path}. An {object_path} ending in a `/` requests folder deletion of an empty folder unless: * (`recursive=true`) forces recursive deletion of a (non-empty) folder. * (`all=true`) forces recursive deletion, including hidden objects. + +### Example + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +from waylay.services.storage.models.hal_entity import HALEntity +try: + # Remove Object Or Folder + # calls `DELETE /storage/v1/bucket/{bucket_name}/{object_path}` + api_response = await waylay_client.storage.object.remove( + 'bucket_name_example', # bucket_name | path param "bucket_name" + 'object_path_example', # object_path | path param "object_path" + # query parameters: + query = { + 'recursive': True + 'all': True + }, + ) + print("The response of storage.object.remove:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.object.remove: %s\n" % e) +``` + +### Endpoint +``` +DELETE /storage/v1/bucket/{bucket_name}/{object_path} +``` +### Parameters + +Name | Type | API binding | Description | Notes +-------- | ----- | ------------- | ------------- | ------------- +**bucket_name** | **str** | path parameter `"bucket_name"` | | +**object_path** | **str** | path parameter `"object_path"` | | +**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | +**query['recursive']** (dict)
**query.recursive** (Query) | **bool** | query parameter `"recursive"` | | [optional] +**query['all']** (dict)
**query.all** (Query) | **bool** | query parameter `"all"` | | [optional] +**query['start_after']** (dict)
**query.start_after** (Query) | **str** | query parameter `"start_after"` | | [optional] +**query['max_keys']** (dict)
**query.max_keys** (Query) | **int** | query parameter `"max_keys"` | | [optional] +**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] +**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | + +### Return type + +Selected path param | Raw response param | Return Type | Description | Links +------------------- | ------------------ | ------------ | ----------- | ----- +Literal[""] _(default)_ | False _(default)_ | **`HALEntity`** | | [HALEntity](HALEntity.md) +str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | +/ | True | `Response` | The raw http response object. + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Operation.md b/docs/Operation.md new file mode 100644 index 0000000..1139f3b --- /dev/null +++ b/docs/Operation.md @@ -0,0 +1,334 @@ + + +# REST _operation methods_ + +The SDK service module `waylay.services.storage.service` is a generated +plugin for the Waylay Python SDK. + +For each of the operations described in the +[OpenAPI specification](https://docs.waylay.io/openapi/sdk/redocly/storage.html) +of the service, a python _operation_ method is generated. + +These _operation methods_ have a standard sequence of (_positional_ and _named_) arguments, + as illustrated by this example REST operation +`POST /demo/v5/gadgets/{id}/trinkets/combatulate` with _operationId_ `combatulateTrinket` + +## Example request + +```python +response = await waylay_client.demo.gadgets.combatulate_trinket( + # required path parameters (positional), for the `id` path parameter + '23456', + # required or optional query parameters (named) + query={ + 'compression_level': 15 + }, + # request body named arguments (named) + # in this case using generated model for an `application/json` request + json=CombatulationRecipe(mode='traditional', decoration='minimal'), + # optional http headers (named) + headers: { + 'accept' : 'text/csv' + }, + # optional named arguments that specify how the response should be rendered (named) + raw_response=False, + select_path=None, + response_type=None, + # optional named arguments passed to the http client (named) + timeout=10.0, +) +``` + +# Supported request arguments + +Each _operation method_ of this SDK uses the following arguments: + +## Argument overview +* [`*path_args: str`](#req_arg_path) required positional path parameters +* [`query: QueryRequest`](#req_arg_query) url query parameters +* [request body](#req_arg_body) arguments + * [`json: Any`](#req_arg_json) a model instance or python data structure for a json request (`application/json`) + * [`content: ContentRequest`](#req_arg_content) raw bytes of any content type + * [`files: FilesRequest`](#req_arg_files) a multi-part request (`multipart/form-data`) + * [`data: DataRequest`](#req_arg_data) an url-encoded form (`application/x-www-form-urlencoded`), or additional non-file parts of a multi-part request. +* [`headers: HeadersRequest`](#req_arg_headers) http request headers +* [response rendering](#req_arg_render) arguments that specify how the response is presented + * [`raw_response: bool`](#req_arg_raw): if `True` returns a http `Response` object + * [`select_path: str`](#req_arg_select): used on a `json` `dict` response to select the relevant part of the response. + * [`response_type: Type | None`](#req_arg_response_type): parse the response as an instance of specified type. +* [http client](#req_arg_client) arguments that influence the handling of the http call. + +## Typing of arguments +The generated methods of this SDK will include additional type information, including +* the actual names of the the path arguments +* model types for the `json` request argument +* keys and values for documented `query`, `header` and `data` + +The most relevant request body arguments (of `json`, `files`, `data`, `content`) +are explicitly documented, leaving the others as optional `**kwargs` named parameters. + +But even if not explicitly documented in the typed signature, you can use the other request body arguments, +assuming the server supports it. + +## Using `content` to send a request body. +The `content` argument is always available as named argument. +Even if e.g. the typing of `combatulate_trinket` method suggests to use a `json` argument, +you can alternatively specify a binary `content` request to stream an already json-encoded request from file. + +```python +binary_req_body = b'{"mode":"traditional","decoration":"minimal"}' +response = await waylay_client.demo.gadgets.combatulate_trinket( + '23456', + content=binary_req_body, + headers={'content-type' : 'application/json'} +) +``` + +## Path parameter arguments +In case the REST operation supports path parameters that configure the request URL, +they are presented as required (positional) initial parameters of type `str`. + +In the example above, the first `'23456'` corresponds to the `id` path parameter, +and leads to a call with url +``` +POST /demo/v5/gadgets/23456/trinkets/combatulate +``` + +## Query parameter arguments +```python +query: QueryRequest +``` +with types +```python +QueryRequest = QueryMap | QueryEntries | QueryString | Model +PrimitiveData = str | int | float | bool | None +# a mapping of query keys to values or list of values +QueryMap = Mapping[str, Union[PrimitiveData, Sequence[PrimitiveData]]] +# a list of query tuples, with repeated keys +QueryEntries = List[Tuple[str, PrimitiveData]] | Tuple[Tuple[str, PrimitiveData], ...] +# a query string, to be used as is on the request +QueryString = str | bytes +``` + +The named `query` argument holds all url query parameters. +Any query arguments described in the OpenAPI document will typed, but undocumented +query parameters will be forwarded. E.g. using +``` +query={ 'compression_level': 15, 'debug': True } +``` +Will lead to a request with url query parameters +``` +POST /demo/v5/gadgets/23456/trinkets/combatulate?compression_level=15&debug=true +``` + +Any model instance specified as an argument will be converted to its `dict` representation first, +which has to be compatible with a `QueryMap` + +## Request body arguments +The following cases are supported for request body arguments +* [`json: Any`](#req_arg_json) a model instance or python data structure for a json request (`application/json`) +* [`content: ContentRequest`](#req_arg_content) raw bytes of any content type +* [`files: FilesRequest`](#req_arg_files) a multi-part request (`multipart/form-data`) +* [`data: DataRequest`](#req_arg_data) an url-encoded form (`application/x-www-form-urlencoded`), or additional non-file parts of a multi-part request. + +### JSON request argument `json` +The `json` argument allows the user to specify a `application/json` request body, using a +generated instance of a generated _Model_ class, or as a python data structure. + +```python +json: Any +``` + +Most REST operations use a JSON (`application/json`) request body, and the SDK service module +will provide typed _model_ classes for them. + +These requests can be passed as a `json` named parameter, either as _model instances_ or as plain +python `dict`, `array` or primitive types that are JSON-serializable. + +#### Example +The following examples assume that the server supports `application/json` requests. + +```python +response = await waylay_client.demo.gadgets.combatulate_trinket( + '43466', + json=CombatulationRecipe(mode='traditional', decoration='minimal') +) +``` +```python +response = await waylay_client.demo.gadgets.combatulate_trinket( + '43466', + json={'mode':'traditional', 'decoration':'minimal'} +) +``` +Will both send a json request with payload `{"mode":"traditional","decoration":"minimal"}` to the server, + +assuming that `CombatulationRecipe` is a model class that does not include additional default attributes. + +### Binary request argument `content` +The `content` argument allows the user to specify a raw binary request of any content type. + +```python +content: ContentRequest +``` +with types +```python +ContentRequest = bytes | str | Iterable[bytes] | AsyncIterable[bytes] | IO[bytes] +``` + +For operations with non-JSON request bodies, the request body must be specified in its binary form +using the `content` argument. + +Unless a default `content-type` is defined in the OpenAPI specification, or at the server, you need +to specify a `content-type` header. + +Supported values for the `content` argument are: +* a `bytes` instance such as `b'abc'` +* `str` instances will be converted to `bytes` using the `utf-8` encoding. +* an `Iterable` that produces `bytes` +* an `AsyncIterable` that produces bytes +* a `IO[bytes]` object that is converted to a `Iterable[bytes]` (if it not yet is). + +When the SDK can infer a total length of the bytes stream (e.g. when attached to a file), +the request will be uploaded as one stream with a `content-length` header indicating the length. + +Otherwise, the content is sent in chuncks (using `"Transfer-Encoding": "chunked"`), +looping over the iterable or buffered reads from the stream. + +#### examples +Using a bytes string: +```python +response = await waylay_client.demo.gadgets.combatulate_trinket( + '23456', + content=b'{"mode":"traditional","decoration":"minimal"}', + headers={'content-type' : 'application/json'} +) +``` +Using an iterator with `bytes` chunks: +```python +def generate_chunks(): + yield b'{"mode":' + yield b'"traditional",' + yield b'"decoration":"minimal"' + yield b'}' +response = await waylay_client.demo.gadgets.combatulate_trinket( + '23456', + content=generate_chunks(), + headers={'content-type' : 'application/json'} +) +``` + +From file, assuming the server supports xml requests: +```python +with open('~/combatulation_requests/example_23456.xml') as xml_file: + response = await waylay_client.demo.gadgets.combatulate_trinket( + '23456', + content=xml_file, + headers={'content-type' : 'text/xml'} + ) +``` + +### Multipart file request argument `files` (and `data`) +The `files` argument triggers the composition of a `multipart/form-data` request. +```python +files: FilesRequest +data: DataRequest +``` +with types +```python +FilesRequest = Mapping[str, FileTypes] | Sequence[Tuple[str, FileTypes]] +DataRequest = Optional[Mapping[str, bytes | PrimitiveData]] + +FileTypes = FileContent | FileNameContent | FileNameContentType | FileNameContentTypeHeaders + +# the raw content as bytes (stream) +FileContent = Union[IO[bytes], bytes, str] +# a file name and content +FileNameContent = [Optional[str], FileContent] +# a file name, content and mediatype string +FileNameContentType = [Optional[str], FileContent, Optional[str]] +# a file name, content, mediatype and additional headers +FileNameContentTypeHeaders = [Optional[str], FileContent, Optional[str], Mapping[str, str]] + +PrimitiveData = str | int | float | bool | None +``` + +When the REST operation supports a multipart file request (content type `multipart/form-data`), +use the `files` named argument to construct such request. +Each entry in the `files` argument ends up as one part of a multipart request, using the specified +part name. + +You can provide the raw bytes (stream) only, +or optionally specify the `filename`, `content-type` or additional `headers` for each part. + +When a `data` argument is specified, these will be added as additional non-file parts, + +#### Example +The following examples assume that the server supports `multipart/form-data` requests. +```python +response = await waylay_client.demo.gadgets.combatulate_trinket( + '43466', + files={'background': open('~/images/deepblue.png)}, + data={'mode':'traditional', 'decoration':'minimal'} +) +``` + +Will send the data as `multipart/form-data`, with three sections `background`, `mode` and `decoration`. + +```python +response = await waylay_client.demo.gadgets.combatulate_trinket( + '43466', + files={ + 'background': ['deepblue.png', open('~/images/deepblue.png),'image/png'] + }, + data={'mode':'traditional', 'decoration':'minimal'} +) +``` +sends the same data, but a filename and content type is added to the `background` part. + + + + +### Url-encoded form data `data` +The `data` argument triggers the composition of an `application/x-www-form-urlencoded` html form request. + +```python +data: Optional[Mapping[str, bytes | PrimitiveData]] +``` + +For operations that use url-encoded form data (content type `application/x-www-form-urlencoded`), +use the `data` named argument (without a `files` argument). + +The http client will in that case use that content-type and encode the using that style. + +These type of operations are normally meant to support [simple html forms](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST#example). + +#### Example +The following example assumes that the server supports `application/x-www-form-urlencoded` requests. + +```python +response = await waylay_client.demo.gadgets.combatulate_trinket( + '43466', + data={'mode':'traditional', 'decoration':'minimal'} +) +``` +Will send the data with content-type `application/x-www-form-urlencoded`, as if an html form submitted +this request with form inputs `mode` and `decoration`. + +## Request `headers` argument + +TODO + +## Response rendering arguments + +### Render a raw http response: `raw_response` +TODO + +### Select a part of the response: `select_path` +TODO + +### Parse the 2XX response as an instance of type: `response_type` +TODO + +## Http client arguments + +TODO diff --git a/docs/PayloadConfig.md b/docs/PayloadConfig.md new file mode 100644 index 0000000..aba374d --- /dev/null +++ b/docs/PayloadConfig.md @@ -0,0 +1,31 @@ +# PayloadConfig + +Configuration object that specifies the expected notification payload. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**signed_links** | [**List[SIGN]**](SIGN.md) | | [optional] +**reference** | **object** | | [optional] + +## Example + +```python +from waylay.services.storage.models.payload_config import PayloadConfig + +# TODO update the JSON string below +json = "{}" +# create an instance of PayloadConfig from a JSON string +payload_config_instance = PayloadConfig.from_json(json) +# print the JSON string representation of the object +print PayloadConfig.to_json() + +# convert the object into a dict +payload_config_dict = payload_config_instance.to_dict() +# create an instance of PayloadConfig from a dict +payload_config_form_dict = payload_config.from_dict(payload_config_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/QUEUESETUPSTATUS.md b/docs/QUEUESETUPSTATUS.md new file mode 100644 index 0000000..b08959e --- /dev/null +++ b/docs/QUEUESETUPSTATUS.md @@ -0,0 +1,12 @@ +# QUEUESETUPSTATUS + +Possbile queue setup status codes. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ResponseList.md b/docs/ResponseList.md new file mode 100644 index 0000000..9659888 --- /dev/null +++ b/docs/ResponseList.md @@ -0,0 +1,40 @@ +# ResponseList + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**Dict[str, Links]**](Links.md) | | [optional] +**objects** | [**List[BucketObject]**](BucketObject.md) | | +**bucket** | [**Bucket**](Bucket.md) | | +**name** | **str** | | +**last_modified** | **datetime** | | [optional] +**etag** | **str** | | [optional] +**size** | **int** | | [optional] +**content_type** | **str** | | [optional] +**is_dir** | **bool** | | [optional] [default to False] +**storage_class** | **str** | | [optional] +**owner_id** | **str** | | [optional] +**owner_name** | **str** | | [optional] + +## Example + +```python +from waylay.services.storage.models.response_list import ResponseList + +# TODO update the JSON string below +json = "{}" +# create an instance of ResponseList from a JSON string +response_list_instance = ResponseList.from_json(json) +# print the JSON string representation of the object +print ResponseList.to_json() + +# convert the object into a dict +response_list_dict = response_list_instance.to_dict() +# create an instance of ResponseList from a dict +response_list_form_dict = response_list.from_dict(response_list_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SIGN.md b/docs/SIGN.md new file mode 100644 index 0000000..468b953 --- /dev/null +++ b/docs/SIGN.md @@ -0,0 +1,12 @@ +# SIGN + +Supported `sign` url parameter values. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/STORETYPE.md b/docs/STORETYPE.md new file mode 100644 index 0000000..4ade7ba --- /dev/null +++ b/docs/STORETYPE.md @@ -0,0 +1,12 @@ +# STORETYPE + +Supported backend store types. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Store.md b/docs/Store.md new file mode 100644 index 0000000..7b4bd27 --- /dev/null +++ b/docs/Store.md @@ -0,0 +1,33 @@ +# Store + +Representation of a backend store. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**Dict[str, Links]**](Links.md) | | [optional] +**type** | [**STORETYPE**](STORETYPE.md) | | +**name** | **str** | | +**url** | **str** | | + +## Example + +```python +from waylay.services.storage.models.store import Store + +# TODO update the JSON string below +json = "{}" +# create an instance of Store from a JSON string +store_instance = Store.from_json(json) +# print the JSON string representation of the object +print Store.to_json() + +# convert the object into a dict +store_dict = store_instance.to_dict() +# create an instance of Store from a dict +store_form_dict = store.from_dict(store_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SubscriptionApi.md b/docs/SubscriptionApi.md new file mode 100644 index 0000000..e016b7e --- /dev/null +++ b/docs/SubscriptionApi.md @@ -0,0 +1,583 @@ +# waylay.services.storage.SubscriptionApi + +All URIs are relative to *https://api.waylay.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create**](SubscriptionApi.md#create) | **POST** /storage/v1/subscription/{bucket_name} | Create Bucket Subscription +[**delete_by**](SubscriptionApi.md#delete_by) | **DELETE** /storage/v1/subscription/{bucket_name} | Delete All Bucket Subscriptions +[**get**](SubscriptionApi.md#get) | **GET** /storage/v1/subscription/{bucket_name}/{subscription_id} | Get Bucket Subscription +[**list**](SubscriptionApi.md#list) | **GET** /storage/v1/subscription | Query All Subscriptions +[**query**](SubscriptionApi.md#query) | **GET** /storage/v1/subscription/{bucket_name} | Query Bucket Subscriptions +[**remove**](SubscriptionApi.md#remove) | **DELETE** /storage/v1/subscription/{bucket_name}/{subscription_id} | Delete Bucket Subscription +[**replace**](SubscriptionApi.md#replace) | **PUT** /storage/v1/subscription/{bucket_name}/{subscription_id} | Replace Bucket Subscription + +# **create** +> create( +> bucket_name: str, +> query: CreateQuery, +> headers +> ) -> SubscriptionConfig + +Create Bucket Subscription + +Create a new notification subscription on a bucket with a given or generated id. + +### Example + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +from waylay.services.storage.models.subscription_config import SubscriptionConfig +try: + # Create Bucket Subscription + # calls `POST /storage/v1/subscription/{bucket_name}` + api_response = await waylay_client.storage.subscription.create( + 'bucket_name_example', # bucket_name | path param "bucket_name" + # query parameters: + query = { + }, + # json data: use a generated model or a json-serializable python data structure (dict, list) + json = waylay.services.storage.SubscriptionConfig() # SubscriptionConfig | + ) + print("The response of storage.subscription.create:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.subscription.create: %s\n" % e) +``` + +### Endpoint +``` +POST /storage/v1/subscription/{bucket_name} +``` +### Parameters + +Name | Type | API binding | Description | Notes +-------- | ----- | ------------- | ------------- | ------------- +**bucket_name** | **str** | path parameter `"bucket_name"` | | +**json** | [**SubscriptionConfig**](SubscriptionConfig.md) | json request body | | +**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | +**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] +**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | + +### Return type + +Selected path param | Raw response param | Return Type | Description | Links +------------------- | ------------------ | ------------ | ----------- | ----- +Literal[""] _(default)_ | False _(default)_ | **`SubscriptionConfig`** | | [SubscriptionConfig](SubscriptionConfig.md) +str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | +/ | True | `Response` | The raw http response object. + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_by** +> delete_by( +> bucket_name: str, +> query: DeleteByQuery, +> headers +> ) -> HALEntity + +Delete All Bucket Subscriptions + +Remove all notification subscription on a bucket that match a given event and/or channel filter. + +### Example + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +from waylay.services.storage.models.channeltype import CHANNELTYPE +from waylay.services.storage.models.hal_entity import HALEntity +from waylay.services.storage.models.venttype import VENTTYPE +try: + # Delete All Bucket Subscriptions + # calls `DELETE /storage/v1/subscription/{bucket_name}` + api_response = await waylay_client.storage.subscription.delete_by( + 'bucket_name_example', # bucket_name | path param "bucket_name" + # query parameters: + query = { + 'event_type': 'delete' + 'channel_type': 'webhook' + }, + ) + print("The response of storage.subscription.delete_by:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.subscription.delete_by: %s\n" % e) +``` + +### Endpoint +``` +DELETE /storage/v1/subscription/{bucket_name} +``` +### Parameters + +Name | Type | API binding | Description | Notes +-------- | ----- | ------------- | ------------- | ------------- +**bucket_name** | **str** | path parameter `"bucket_name"` | | +**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | +**query['start_after']** (dict)
**query.start_after** (Query) | **str** | query parameter `"start_after"` | | [optional] +**query['prefix']** (dict)
**query.prefix** (Query) | **str** | query parameter `"prefix"` | | [optional] +**query['suffix']** (dict)
**query.suffix** (Query) | **str** | query parameter `"suffix"` | | [optional] +**query['event_type']** (dict)
**query.event_type** (Query) | [**VENTTYPE**](.md) | query parameter `"event_type"` | | [optional] +**query['channel_type']** (dict)
**query.channel_type** (Query) | [**CHANNELTYPE**](.md) | query parameter `"channel_type"` | | [optional] +**query['channel_id']** (dict)
**query.channel_id** (Query) | **str** | query parameter `"channel_id"` | | [optional] +**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] +**query['max_keys']** (dict)
**query.max_keys** (Query) | **int** | query parameter `"max_keys"` | | [optional] +**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | + +### Return type + +Selected path param | Raw response param | Return Type | Description | Links +------------------- | ------------------ | ------------ | ----------- | ----- +Literal[""] _(default)_ | False _(default)_ | **`HALEntity`** | | [HALEntity](HALEntity.md) +str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | +/ | True | `Response` | The raw http response object. + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get** +> get( +> bucket_name: str, +> subscription_id: str, +> query: GetQuery, +> headers +> ) -> SubscriptionConfig + +Get Bucket Subscription + +Fetch a notification subscription. + +### Example + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +from waylay.services.storage.models.subscription_config import SubscriptionConfig +try: + # Get Bucket Subscription + # calls `GET /storage/v1/subscription/{bucket_name}/{subscription_id}` + api_response = await waylay_client.storage.subscription.get( + 'bucket_name_example', # bucket_name | path param "bucket_name" + 'subscription_id_example', # subscription_id | path param "subscription_id" + # query parameters: + query = { + }, + ) + print("The response of storage.subscription.get:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.subscription.get: %s\n" % e) +``` + +### Endpoint +``` +GET /storage/v1/subscription/{bucket_name}/{subscription_id} +``` +### Parameters + +Name | Type | API binding | Description | Notes +-------- | ----- | ------------- | ------------- | ------------- +**bucket_name** | **str** | path parameter `"bucket_name"` | | +**subscription_id** | **str** | path parameter `"subscription_id"` | | +**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | +**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] +**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | + +### Return type + +Selected path param | Raw response param | Return Type | Description | Links +------------------- | ------------------ | ------------ | ----------- | ----- +Literal[""] _(default)_ | False _(default)_ | **`SubscriptionConfig`** | | [SubscriptionConfig](SubscriptionConfig.md) +str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | +/ | True | `Response` | The raw http response object. + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **list** +> list( +> query: ListQuery, +> headers +> ) -> SubscriptionsListing + +Query All Subscriptions + +List notification subscriptions per bucket that have notification enabled. + +### Example + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +from waylay.services.storage.models.channeltype import CHANNELTYPE +from waylay.services.storage.models.subscriptions_listing import SubscriptionsListing +from waylay.services.storage.models.venttype import VENTTYPE +try: + # Query All Subscriptions + # calls `GET /storage/v1/subscription` + api_response = await waylay_client.storage.subscription.list( + # query parameters: + query = { + 'event_type': 'delete' + 'channel_type': 'webhook' + }, + ) + print("The response of storage.subscription.list:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.subscription.list: %s\n" % e) +``` + +### Endpoint +``` +GET /storage/v1/subscription +``` +### Parameters + +Name | Type | API binding | Description | Notes +-------- | ----- | ------------- | ------------- | ------------- +**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | +**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] +**query['prefix']** (dict)
**query.prefix** (Query) | **str** | query parameter `"prefix"` | | [optional] +**query['suffix']** (dict)
**query.suffix** (Query) | **str** | query parameter `"suffix"` | | [optional] +**query['event_type']** (dict)
**query.event_type** (Query) | [**VENTTYPE**](.md) | query parameter `"event_type"` | | [optional] +**query['channel_type']** (dict)
**query.channel_type** (Query) | [**CHANNELTYPE**](.md) | query parameter `"channel_type"` | | [optional] +**query['channel_id']** (dict)
**query.channel_id** (Query) | **str** | query parameter `"channel_id"` | | [optional] +**query['max_keys']** (dict)
**query.max_keys** (Query) | **int** | query parameter `"max_keys"` | | [optional] +**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | + +### Return type + +Selected path param | Raw response param | Return Type | Description | Links +------------------- | ------------------ | ------------ | ----------- | ----- +Literal[""] _(default)_ | False _(default)_ | **`SubscriptionsListing`** | | [SubscriptionsListing](SubscriptionsListing.md) +str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | +/ | True | `Response` | The raw http response object. + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **query** +> query( +> bucket_name: str, +> query: QueryQuery, +> headers +> ) -> Subscriptions + +Query Bucket Subscriptions + +List notification subscriptions for given bucket. + +### Example + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +from waylay.services.storage.models.channeltype import CHANNELTYPE +from waylay.services.storage.models.subscriptions import Subscriptions +from waylay.services.storage.models.venttype import VENTTYPE +try: + # Query Bucket Subscriptions + # calls `GET /storage/v1/subscription/{bucket_name}` + api_response = await waylay_client.storage.subscription.query( + 'bucket_name_example', # bucket_name | path param "bucket_name" + # query parameters: + query = { + 'event_type': 'delete' + 'channel_type': 'webhook' + }, + ) + print("The response of storage.subscription.query:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.subscription.query: %s\n" % e) +``` + +### Endpoint +``` +GET /storage/v1/subscription/{bucket_name} +``` +### Parameters + +Name | Type | API binding | Description | Notes +-------- | ----- | ------------- | ------------- | ------------- +**bucket_name** | **str** | path parameter `"bucket_name"` | | +**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | +**query['start_after']** (dict)
**query.start_after** (Query) | **str** | query parameter `"start_after"` | | [optional] +**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] +**query['prefix']** (dict)
**query.prefix** (Query) | **str** | query parameter `"prefix"` | | [optional] +**query['suffix']** (dict)
**query.suffix** (Query) | **str** | query parameter `"suffix"` | | [optional] +**query['event_type']** (dict)
**query.event_type** (Query) | [**VENTTYPE**](.md) | query parameter `"event_type"` | | [optional] +**query['channel_type']** (dict)
**query.channel_type** (Query) | [**CHANNELTYPE**](.md) | query parameter `"channel_type"` | | [optional] +**query['channel_id']** (dict)
**query.channel_id** (Query) | **str** | query parameter `"channel_id"` | | [optional] +**query['max_keys']** (dict)
**query.max_keys** (Query) | **int** | query parameter `"max_keys"` | | [optional] +**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | + +### Return type + +Selected path param | Raw response param | Return Type | Description | Links +------------------- | ------------------ | ------------ | ----------- | ----- +Literal[""] _(default)_ | False _(default)_ | **`Subscriptions`** | | [Subscriptions](Subscriptions.md) +str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | +/ | True | `Response` | The raw http response object. + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **remove** +> remove( +> bucket_name: str, +> subscription_id: str, +> query: RemoveQuery, +> headers +> ) -> HALEntity + +Delete Bucket Subscription + +Remove a notification subscription. + +### Example + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +from waylay.services.storage.models.hal_entity import HALEntity +try: + # Delete Bucket Subscription + # calls `DELETE /storage/v1/subscription/{bucket_name}/{subscription_id}` + api_response = await waylay_client.storage.subscription.remove( + 'bucket_name_example', # bucket_name | path param "bucket_name" + 'subscription_id_example', # subscription_id | path param "subscription_id" + # query parameters: + query = { + }, + ) + print("The response of storage.subscription.remove:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.subscription.remove: %s\n" % e) +``` + +### Endpoint +``` +DELETE /storage/v1/subscription/{bucket_name}/{subscription_id} +``` +### Parameters + +Name | Type | API binding | Description | Notes +-------- | ----- | ------------- | ------------- | ------------- +**bucket_name** | **str** | path parameter `"bucket_name"` | | +**subscription_id** | **str** | path parameter `"subscription_id"` | | +**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | +**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] +**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | + +### Return type + +Selected path param | Raw response param | Return Type | Description | Links +------------------- | ------------------ | ------------ | ----------- | ----- +Literal[""] _(default)_ | False _(default)_ | **`HALEntity`** | | [HALEntity](HALEntity.md) +str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | +/ | True | `Response` | The raw http response object. + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **replace** +> replace( +> bucket_name: str, +> subscription_id: str, +> query: ReplaceQuery, +> headers +> ) -> SubscriptionConfig + +Replace Bucket Subscription + +Create or replace a notification subscription on a bucket with a given id. + +### Example + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +from waylay.services.storage.models.subscription_config import SubscriptionConfig +try: + # Replace Bucket Subscription + # calls `PUT /storage/v1/subscription/{bucket_name}/{subscription_id}` + api_response = await waylay_client.storage.subscription.replace( + 'bucket_name_example', # bucket_name | path param "bucket_name" + 'subscription_id_example', # subscription_id | path param "subscription_id" + # query parameters: + query = { + }, + # json data: use a generated model or a json-serializable python data structure (dict, list) + json = waylay.services.storage.SubscriptionConfig() # SubscriptionConfig | + ) + print("The response of storage.subscription.replace:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.subscription.replace: %s\n" % e) +``` + +### Endpoint +``` +PUT /storage/v1/subscription/{bucket_name}/{subscription_id} +``` +### Parameters + +Name | Type | API binding | Description | Notes +-------- | ----- | ------------- | ------------- | ------------- +**bucket_name** | **str** | path parameter `"bucket_name"` | | +**subscription_id** | **str** | path parameter `"subscription_id"` | | +**json** | [**SubscriptionConfig**](SubscriptionConfig.md) | json request body | | +**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | +**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] +**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | + +### Return type + +Selected path param | Raw response param | Return Type | Description | Links +------------------- | ------------------ | ------------ | ----------- | ----- +Literal[""] _(default)_ | False _(default)_ | **`SubscriptionConfig`** | | [SubscriptionConfig](SubscriptionConfig.md) +str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | +/ | True | `Response` | The raw http response object. + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/SubscriptionConfig.md b/docs/SubscriptionConfig.md new file mode 100644 index 0000000..2059d2c --- /dev/null +++ b/docs/SubscriptionConfig.md @@ -0,0 +1,35 @@ +# SubscriptionConfig + +Specification of a notification subscription that forwards to a given channel. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**Dict[str, Links]**](Links.md) | | [optional] +**id** | **str** | | [optional] +**title** | **str** | | [optional] +**description** | **str** | | [optional] +**channel** | [**Channel**](Channel.md) | | +**filters** | [**List[EventFilter]**](EventFilter.md) | | + +## Example + +```python +from waylay.services.storage.models.subscription_config import SubscriptionConfig + +# TODO update the JSON string below +json = "{}" +# create an instance of SubscriptionConfig from a JSON string +subscription_config_instance = SubscriptionConfig.from_json(json) +# print the JSON string representation of the object +print SubscriptionConfig.to_json() + +# convert the object into a dict +subscription_config_dict = subscription_config_instance.to_dict() +# create an instance of SubscriptionConfig from a dict +subscription_config_form_dict = subscription_config.from_dict(subscription_config_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Subscriptions.md b/docs/Subscriptions.md new file mode 100644 index 0000000..0f3df0c --- /dev/null +++ b/docs/Subscriptions.md @@ -0,0 +1,33 @@ +# Subscriptions + +Listing object for subscriptions. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**Dict[str, Links]**](Links.md) | | [optional] +**bucket** | [**Bucket**](Bucket.md) | | +**subscriptions** | [**List[SubscriptionConfig]**](SubscriptionConfig.md) | | +**warnings** | **List[object]** | | [optional] + +## Example + +```python +from waylay.services.storage.models.subscriptions import Subscriptions + +# TODO update the JSON string below +json = "{}" +# create an instance of Subscriptions from a JSON string +subscriptions_instance = Subscriptions.from_json(json) +# print the JSON string representation of the object +print Subscriptions.to_json() + +# convert the object into a dict +subscriptions_dict = subscriptions_instance.to_dict() +# create an instance of Subscriptions from a dict +subscriptions_form_dict = subscriptions.from_dict(subscriptions_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SubscriptionsListing.md b/docs/SubscriptionsListing.md new file mode 100644 index 0000000..4282303 --- /dev/null +++ b/docs/SubscriptionsListing.md @@ -0,0 +1,31 @@ +# SubscriptionsListing + +List of buckets that support subscriptions. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**Dict[str, Links]**](Links.md) | | [optional] +**buckets** | [**List[Bucket]**](Bucket.md) | | + +## Example + +```python +from waylay.services.storage.models.subscriptions_listing import SubscriptionsListing + +# TODO update the JSON string below +json = "{}" +# create an instance of SubscriptionsListing from a JSON string +subscriptions_listing_instance = SubscriptionsListing.from_json(json) +# print the JSON string representation of the object +print SubscriptionsListing.to_json() + +# convert the object into a dict +subscriptions_listing_dict = subscriptions_listing_instance.to_dict() +# create an instance of SubscriptionsListing from a dict +subscriptions_listing_form_dict = subscriptions_listing.from_dict(subscriptions_listing_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SystemChannelConfig.md b/docs/SystemChannelConfig.md new file mode 100644 index 0000000..4f4a312 --- /dev/null +++ b/docs/SystemChannelConfig.md @@ -0,0 +1,34 @@ +# SystemChannelConfig + +Channel configuration for functionality that is fixed by the platform. This cannot be selected by the end user. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**SystemChannelConfigType**](SystemChannelConfigType.md) | | [optional] +**description** | **str** | | [optional] +**payload** | [**PayloadConfig**](PayloadConfig.md) | | [optional] +**authentication** | [**AuthenticationConfig**](AuthenticationConfig.md) | | [optional] +**expiry** | [**Expiry**](Expiry.md) | | [optional] + +## Example + +```python +from waylay.services.storage.models.system_channel_config import SystemChannelConfig + +# TODO update the JSON string below +json = "{}" +# create an instance of SystemChannelConfig from a JSON string +system_channel_config_instance = SystemChannelConfig.from_json(json) +# print the JSON string representation of the object +print SystemChannelConfig.to_json() + +# convert the object into a dict +system_channel_config_dict = system_channel_config_instance.to_dict() +# create an instance of SystemChannelConfig from a dict +system_channel_config_form_dict = system_channel_config.from_dict(system_channel_config_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SystemChannelConfigType.md b/docs/SystemChannelConfigType.md new file mode 100644 index 0000000..4b70c3d --- /dev/null +++ b/docs/SystemChannelConfigType.md @@ -0,0 +1,11 @@ +# SystemChannelConfigType + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TenantStatusReport.md b/docs/TenantStatusReport.md new file mode 100644 index 0000000..ff3adb1 --- /dev/null +++ b/docs/TenantStatusReport.md @@ -0,0 +1,36 @@ +# TenantStatusReport + +Response model for a tenant status report. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tenant** | **str** | | +**buckets** | [**List[BucketConfiguration]**](BucketConfiguration.md) | | [optional] +**queues** | [**List[NotificationQueueStatusReport]**](NotificationQueueStatusReport.md) | | [optional] +**total_size** | **int** | | [optional] +**bucket_status** | [**BUCKETCREATIONSTATUS**](BUCKETCREATIONSTATUS.md) | | [optional] +**policy_status** | [**BUCKETPOLICYSTATUS**](BUCKETPOLICYSTATUS.md) | | [optional] +**queue_status** | [**QUEUESETUPSTATUS**](QUEUESETUPSTATUS.md) | | [optional] + +## Example + +```python +from waylay.services.storage.models.tenant_status_report import TenantStatusReport + +# TODO update the JSON string below +json = "{}" +# create an instance of TenantStatusReport from a JSON string +tenant_status_report_instance = TenantStatusReport.from_json(json) +# print the JSON string representation of the object +print TenantStatusReport.to_json() + +# convert the object into a dict +tenant_status_report_dict = tenant_status_report_instance.to_dict() +# create an instance of TenantStatusReport from a dict +tenant_status_report_form_dict = tenant_status_report.from_dict(tenant_status_report_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/VENTTYPE.md b/docs/VENTTYPE.md new file mode 100644 index 0000000..c1cce0e --- /dev/null +++ b/docs/VENTTYPE.md @@ -0,0 +1,12 @@ +# VENTTYPE + +Supported notification change event types. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ValidationError.md b/docs/ValidationError.md new file mode 100644 index 0000000..3048ebe --- /dev/null +++ b/docs/ValidationError.md @@ -0,0 +1,31 @@ +# ValidationError + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loc** | [**List[LocationInner]**](LocationInner.md) | | +**msg** | **str** | | +**type** | **str** | | + +## Example + +```python +from waylay.services.storage.models.validation_error import ValidationError + +# TODO update the JSON string below +json = "{}" +# create an instance of ValidationError from a JSON string +validation_error_instance = ValidationError.from_json(json) +# print the JSON string representation of the object +print ValidationError.to_json() + +# convert the object into a dict +validation_error_dict = validation_error_instance.to_dict() +# create an instance of ValidationError from a dict +validation_error_form_dict = validation_error.from_dict(validation_error_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WebScriptChannelConfig.md b/docs/WebScriptChannelConfig.md new file mode 100644 index 0000000..21f003f --- /dev/null +++ b/docs/WebScriptChannelConfig.md @@ -0,0 +1,37 @@ +# WebScriptChannelConfig + +Channel configuration for invoking a waylay webscript. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**WebScriptChannelConfigType**](WebScriptChannelConfigType.md) | | [optional] +**description** | **str** | | [optional] +**payload** | [**PayloadConfig**](PayloadConfig.md) | | [optional] +**authentication** | [**AuthenticationConfig**](AuthenticationConfig.md) | | [optional] +**expiry** | [**Expiry**](Expiry.md) | | [optional] +**name** | **str** | | +**version** | **str** | | [optional] +**method** | [**HTTPMETHOD**](HTTPMETHOD.md) | | [optional] + +## Example + +```python +from waylay.services.storage.models.web_script_channel_config import WebScriptChannelConfig + +# TODO update the JSON string below +json = "{}" +# create an instance of WebScriptChannelConfig from a JSON string +web_script_channel_config_instance = WebScriptChannelConfig.from_json(json) +# print the JSON string representation of the object +print WebScriptChannelConfig.to_json() + +# convert the object into a dict +web_script_channel_config_dict = web_script_channel_config_instance.to_dict() +# create an instance of WebScriptChannelConfig from a dict +web_script_channel_config_form_dict = web_script_channel_config.from_dict(web_script_channel_config_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WebScriptChannelConfigType.md b/docs/WebScriptChannelConfigType.md new file mode 100644 index 0000000..9582ac2 --- /dev/null +++ b/docs/WebScriptChannelConfigType.md @@ -0,0 +1,11 @@ +# WebScriptChannelConfigType + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/openapi/storage.openapi.yaml b/openapi/storage.openapi.yaml new file mode 100644 index 0000000..9914d53 --- /dev/null +++ b/openapi/storage.openapi.yaml @@ -0,0 +1,1473 @@ +openapi: 3.1.0 +info: + title: Waylay Storage + description: ' + + Manage storage buckets and subscriptions. + + ' + version: v0.4.1 +paths: + /storage/v1/bucket: + get: + tags: + - Bucket + summary: List Buckets + description: List authorized buckets. + operationId: list_bucket + parameters: + - required: false + schema: + type: string + title: Store + name: store + in: query + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BucketListing' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: &id001 + - waylayApiKeySecret: [] + /storage/v1/bucket/{bucket_name}: + get: + tags: + - Bucket + summary: Get Bucket + description: Get a descriptive representation of a bucket. + operationId: get_bucket + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + - required: false + schema: + type: string + title: Store + name: store + in: query + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Bucket' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: *id001 + /storage/v1/bucket/{bucket_name}/{object_path}: + get: + tags: + - Object + summary: List Objects + description: "List, inspect or sign objects.\n\n* list the objects of a bucket\ + \ with {object_path} prefix\n * (`recursive=true`) list content recursively\n\ + \ * (`all=true`) include hidden objects\n* (`stat=true`) get the meta of\ + \ the object at {object_path}\n* (`sign=[GET,PUT,POST]`) fetch presigned urls\ + \ to operate on {object_path}\n * (`all=true`) allow link creation for\ + \ hidden objects" + operationId: list_object + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + - required: true + schema: + type: string + title: Object Path + name: object_path + in: path + - required: false + schema: + type: boolean + title: Stat + default: false + name: stat + in: query + - required: false + schema: + type: boolean + title: Recursive + name: recursive + in: query + - required: false + schema: + type: boolean + title: All + name: all + in: query + - required: false + schema: + type: string + title: Start After + name: start_after + in: query + - required: false + schema: + type: boolean + title: Fetch Content Type + default: true + name: fetch_content_type + in: query + - required: false + schema: + type: boolean + title: Get As Attachment + default: true + name: get_as_attachment + in: query + - required: false + schema: + type: integer + title: Max Keys + name: max_keys + in: query + - required: false + schema: + type: string + title: Sign + name: sign + in: query + - required: false + schema: + type: string + title: Store + name: store + in: query + - required: false + schema: + type: integer + title: Expiry Days + name: expiry_days + in: query + - required: false + schema: + type: integer + title: Expiry Hours + name: expiry_hours + in: query + - required: false + schema: + type: integer + title: Expiry Seconds + name: expiry_seconds + in: query + - required: false + schema: + type: integer + title: Content Length Min + default: 0 + name: content_length_min + in: query + - required: false + schema: + type: integer + title: Content Length Max + name: content_length_max + in: query + - required: false + schema: + type: string + title: Content Type + name: content_type + in: query + responses: + '200': + description: Successful Response + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/BucketObjectListing' + - $ref: '#/components/schemas/BucketObject' + - $ref: '#/components/schemas/HALEntity' + title: Response List + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: *id001 + delete: + tags: + - Object + summary: Remove Object Or Folder + description: 'Remove the object or folder at {object_path}. + + + An {object_path} ending in a `/` requests folder deletion of an empty + + folder unless: + + * (`recursive=true`) forces recursive deletion of a (non-empty) folder. + + * (`all=true`) forces recursive deletion, including hidden objects.' + operationId: remove_object + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + - required: true + schema: + type: string + title: Object Path + name: object_path + in: path + - required: false + schema: + type: boolean + title: Recursive + name: recursive + in: query + - required: false + schema: + type: boolean + title: All + name: all + in: query + - required: false + schema: + type: string + title: Start After + name: start_after + in: query + - required: false + schema: + type: integer + title: Max Keys + name: max_keys + in: query + - required: false + schema: + type: string + title: Store + name: store + in: query + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/HALEntity' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: *id001 + /storage/v1/bucket/{bucket_name}/{object_path}/: + put: + tags: + - Object + summary: Create Folder + description: "Create a (virtual) folder.\n\n* (`all=true`) force creation of\ + \ a hidden folder,\n having a path element that starts with a `.`." + operationId: createFolder_object + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + - required: true + schema: + type: string + title: Object Path + name: object_path + in: path + - required: false + schema: + type: boolean + title: All + default: false + name: all + in: query + - required: false + schema: + type: string + title: Store + name: store + in: query + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BucketObject' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: *id001 + /storage/v1/bucket/{bucket_name}/{target_path}: + put: + tags: + - Object + summary: Copy Or Move Object + description: Copy or move object to new location. + operationId: copyOrMove_object + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + - required: true + schema: + type: string + title: Target Path + name: target_path + in: path + - required: true + schema: + type: string + title: Source + name: source + in: query + - required: false + schema: + type: boolean + title: Move + default: false + name: move + in: query + - required: false + schema: + type: string + title: Store + name: store + in: query + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/HALEntity' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: *id001 + /storage/v1/subscription: + get: + tags: + - Subscription + summary: Query All Subscriptions + description: List notification subscriptions per bucket that have notification + enabled. + operationId: list_subscription + parameters: + - required: false + schema: + type: string + title: Store + name: store + in: query + - required: false + schema: + type: string + title: Prefix + name: prefix + in: query + - required: false + schema: + type: string + title: Suffix + name: suffix + in: query + - required: false + schema: + $ref: '#/components/schemas/EVENT_TYPE' + name: event_type + in: query + - required: false + schema: + $ref: '#/components/schemas/CHANNEL_TYPE' + name: channel_type + in: query + - required: false + schema: + type: string + title: Channel Id + name: channel_id + in: query + - required: false + schema: + type: integer + title: Max Keys + name: max_keys + in: query + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionsListing' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: *id001 + /storage/v1/subscription/{bucket_name}: + get: + tags: + - Subscription + summary: Query Bucket Subscriptions + description: List notification subscriptions for given bucket. + operationId: query_subscription + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + - required: false + schema: + type: string + title: Start After + name: start_after + in: query + - required: false + schema: + type: string + title: Store + name: store + in: query + - required: false + schema: + type: string + title: Prefix + name: prefix + in: query + - required: false + schema: + type: string + title: Suffix + name: suffix + in: query + - required: false + schema: + $ref: '#/components/schemas/EVENT_TYPE' + name: event_type + in: query + - required: false + schema: + $ref: '#/components/schemas/CHANNEL_TYPE' + name: channel_type + in: query + - required: false + schema: + type: string + title: Channel Id + name: channel_id + in: query + - required: false + schema: + type: integer + title: Max Keys + name: max_keys + in: query + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Subscriptions' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: *id001 + post: + tags: + - Subscription + summary: Create Bucket Subscription + description: Create a new notification subscription on a bucket with a given + or generated id. + operationId: create_subscription + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + - required: false + schema: + type: string + title: Store + name: store + in: query + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionConfig' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionConfig' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: *id001 + delete: + tags: + - Subscription + summary: Delete All Bucket Subscriptions + description: 'Remove all notification subscription on a bucket + + that match a given event and/or channel filter.' + operationId: deleteBy_subscription + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + - required: false + schema: + type: string + title: Start After + name: start_after + in: query + - required: false + schema: + type: string + title: Prefix + name: prefix + in: query + - required: false + schema: + type: string + title: Suffix + name: suffix + in: query + - required: false + schema: + $ref: '#/components/schemas/EVENT_TYPE' + name: event_type + in: query + - required: false + schema: + $ref: '#/components/schemas/CHANNEL_TYPE' + name: channel_type + in: query + - required: false + schema: + type: string + title: Channel Id + name: channel_id + in: query + - required: false + schema: + type: string + title: Store + name: store + in: query + - required: false + schema: + type: integer + title: Max Keys + name: max_keys + in: query + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/HALEntity' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: *id001 + /storage/v1/subscription/{bucket_name}/{subscription_id}: + get: + tags: + - Subscription + summary: Get Bucket Subscription + description: Fetch a notification subscription. + operationId: get_subscription + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + - required: true + schema: + type: string + title: Subscription Id + name: subscription_id + in: path + - required: false + schema: + type: string + title: Store + name: store + in: query + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionConfig' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: *id001 + put: + tags: + - Subscription + summary: Replace Bucket Subscription + description: Create or replace a notification subscription on a bucket with + a given id. + operationId: replace_subscription + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + - required: true + schema: + type: string + title: Subscription Id + name: subscription_id + in: path + - required: false + schema: + type: string + title: Store + name: store + in: query + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionConfig' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionConfig' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: *id001 + delete: + tags: + - Subscription + summary: Delete Bucket Subscription + description: Remove a notification subscription. + operationId: remove_subscription + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + - required: true + schema: + type: string + title: Subscription Id + name: subscription_id + in: path + - required: false + schema: + type: string + title: Store + name: store + in: query + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/HALEntity' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: *id001 + /storage/v1/: + get: + tags: + - About + summary: Version + description: Get the application version. + operationId: version_about + responses: + '200': + description: Successful Response + content: + application/json: + schema: + type: string + title: Response Version + security: *id001 + /storage/v1/status: + get: + tags: + - About + summary: Status + description: Validate consistency of buckets and notification queues for this + tenant. + operationId: status_about + parameters: + - required: false + schema: + type: string + title: Store + name: store + in: query + - required: false + schema: + type: boolean + title: Include Buckets + default: true + name: include_buckets + in: query + - required: false + schema: + type: boolean + title: Include Queues + default: true + name: include_queues + in: query + - required: false + schema: + type: boolean + title: Include Disk Usage + default: false + name: include_disk_usage + in: query + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/TenantStatusReport' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: *id001 +components: + schemas: + AUTH: + type: string + enum: + - DEFAULT + - NONE + - API_KEY + - TOKEN + - WAYLAY_APP + - WAYLAY_TOKEN + - WEBSCRIPT + title: AUTH + description: Supported authentication methods for notifications. + AuthenticationConfig: + properties: + method: + allOf: + - $ref: '#/components/schemas/AUTH' + default: DEFAULT + key: + type: string + title: Key + secret: + type: string + title: Secret + type: object + title: AuthenticationConfig + description: Configuration for the authentication method used when forwarding + an event to a channel. + BUCKET_CREATION_STATUS: + type: string + enum: + - unknown + - missing + - invalid + - up_to_date + title: BUCKET_CREATION_STATUS + description: Possbile bucket creation status codes. + BUCKET_POLICY_STATUS: + type: string + enum: + - unknown + - missing + - out_dated + - up_to_date + title: BUCKET_POLICY_STATUS + description: Possible bucket policy status codes. + Bucket: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + alias: + type: string + title: Alias + name: + type: string + title: Name + store: + $ref: '#/components/schemas/Store' + creation_date: + type: string + format: date-time + title: Creation Date + size: + type: integer + title: Size + type: object + required: + - name + title: Bucket + description: Representation of a storage bucket. + BucketConfiguration: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + alias: + type: string + title: Alias + name: + type: string + title: Name + store: + $ref: '#/components/schemas/Store' + creation_date: + type: string + format: date-time + title: Creation Date + size: + type: integer + title: Size + status: + allOf: + - $ref: '#/components/schemas/BUCKET_CREATION_STATUS' + default: unknown + public_policy_json: + type: object + title: Public Policy Json + public_policy_type: + type: string + title: Public Policy Type + error: + type: string + title: Error + type: object + required: + - name + title: BucketConfiguration + description: Representation of a bucket configuration. + BucketListing: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + buckets: + items: + $ref: '#/components/schemas/Bucket' + type: array + title: Buckets + type: object + required: + - buckets + title: BucketListing + description: List of Bucket representations. + BucketObject: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + bucket: + $ref: '#/components/schemas/Bucket' + name: + type: string + title: Name + last_modified: + type: string + format: date-time + title: Last Modified + etag: + type: string + title: Etag + size: + type: integer + title: Size + content_type: + type: string + title: Content Type + is_dir: + type: boolean + title: Is Dir + default: false + storage_class: + type: string + title: Storage Class + owner_id: + type: string + title: Owner Id + owner_name: + type: string + title: Owner Name + type: object + required: + - bucket + - name + title: BucketObject + description: Representation of a storage object. + BucketObjectListing: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + objects: + items: + $ref: '#/components/schemas/BucketObject' + type: array + title: Objects + type: object + required: + - objects + title: BucketObjectListing + description: List of storage object representations. + CHANNEL_TYPE: + type: string + enum: + - webhook + - webscript + - system + title: CHANNEL_TYPE + description: Supported notification channel types. + EVENT_TYPE: + type: string + enum: + - delete + - put + - get + title: EVENT_TYPE + description: Supported notification change event types. + EventFilter: + properties: + prefix: + type: string + title: Prefix + suffix: + type: string + title: Suffix + events: + items: + $ref: '#/components/schemas/EVENT_TYPE' + type: array + uniqueItems: true + default: + - put + description: + type: string + title: Description + queue: + type: string + title: Queue + type: object + title: EventFilter + description: 'Filter on change events in a storage backend. + + + The `prefix` and `suffix` properties are conditions on the object path + + (not including the bucket name). When not specified, all paths in the bucket + will selected. + + + The `events` property can contain `put` and/or `delete` values, corresponding + + to create/update and deletion events. + + When not specified, only the create/update events are filtered.' + Expiry: + properties: + seconds: + type: integer + title: Seconds + hours: + type: integer + title: Hours + days: + type: integer + title: Days + type: object + title: Expiry + description: Input model for expiry parameters. + HALEntity: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + type: object + title: HALEntity + description: Output model representing a collection of HAL links. + HALLink: + properties: + href: + type: string + title: Href + method: + type: string + title: Method + form_data: + type: object + title: Form Data + type: object + required: + - href + title: HALLink + description: Represents a HAL link. + HTTPValidationError: + properties: + detail: + items: + $ref: '#/components/schemas/ValidationError' + type: array + title: Detail + type: object + title: HTTPValidationError + HTTP_METHOD: + type: string + enum: + - GET + - PUT + - POST + title: HTTP_METHOD + description: Supported notification methods. + NotificationQueueStatus: + properties: + status: + $ref: '#/components/schemas/QUEUE_SETUP_STATUS' + name: + type: string + title: Name + method: + type: string + title: Method + configured_parameters: + type: object + title: Configured Parameters + actual_parameters: + type: object + title: Actual Parameters + error: + type: string + title: Error + type: object + required: + - status + - name + - method + title: NotificationQueueStatus + description: Response model for the notification queue configuration. + NotificationQueueStatusReport: + properties: + store: + type: string + title: Store + notification_queues: + items: + $ref: '#/components/schemas/NotificationQueueStatus' + type: array + title: Notification Queues + messages: + items: + type: object + type: array + title: Messages + type: object + required: + - store + - notification_queues + title: NotificationQueueStatusReport + description: Response model for a notification queue status report. + PayloadConfig: + properties: + signed_links: + items: + $ref: '#/components/schemas/SIGN' + type: array + reference: + title: Reference + type: object + title: PayloadConfig + description: Configuration object that specifies the expected notification payload. + QUEUE_SETUP_STATUS: + type: string + enum: + - unknown + - missing + - invalid + - not_specified + - up_to_date + title: QUEUE_SETUP_STATUS + description: Possbile queue setup status codes. + SIGN: + type: string + enum: + - GET + - PUT + - POST + title: SIGN + description: Supported `sign` url parameter values. + STORE_TYPE: + type: string + enum: + - gs + - s3 + - azure + title: STORE_TYPE + description: Supported backend store types. + Store: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + type: + $ref: '#/components/schemas/STORE_TYPE' + name: + type: string + title: Name + url: + type: string + title: Url + type: object + required: + - type + - name + - url + title: Store + description: Representation of a backend store. + SubscriptionConfig: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + id: + type: string + title: Id + title: + type: string + title: Title + description: + type: string + title: Description + channel: + anyOf: + - $ref: '#/components/schemas/WebScriptChannelConfig' + - $ref: '#/components/schemas/SystemChannelConfig' + title: Channel + filters: + items: + $ref: '#/components/schemas/EventFilter' + type: array + title: Filters + type: object + required: + - channel + - filters + title: SubscriptionConfig + description: Specification of a notification subscription that forwards to a + given channel. + Subscriptions: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + bucket: + $ref: '#/components/schemas/Bucket' + subscriptions: + items: + $ref: '#/components/schemas/SubscriptionConfig' + type: array + title: Subscriptions + warnings: + items: + type: object + type: array + title: Warnings + type: object + required: + - bucket + - subscriptions + title: Subscriptions + description: Listing object for subscriptions. + SubscriptionsListing: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + buckets: + items: + $ref: '#/components/schemas/Bucket' + type: array + title: Buckets + type: object + required: + - buckets + title: SubscriptionsListing + description: List of buckets that support subscriptions. + SystemChannelConfig: + properties: + type: + type: string + enum: + - system + title: Type + default: system + description: + type: string + title: Description + payload: + $ref: '#/components/schemas/PayloadConfig' + authentication: + $ref: '#/components/schemas/AuthenticationConfig' + expiry: + $ref: '#/components/schemas/Expiry' + type: object + title: SystemChannelConfig + description: 'Channel configuration for functionality that is fixed by the platform. + + + This cannot be selected by the end user.' + TenantStatusReport: + properties: + tenant: + type: string + title: Tenant + buckets: + items: + $ref: '#/components/schemas/BucketConfiguration' + type: array + title: Buckets + queues: + items: + $ref: '#/components/schemas/NotificationQueueStatusReport' + type: array + title: Queues + total_size: + type: integer + title: Total Size + bucket_status: + $ref: '#/components/schemas/BUCKET_CREATION_STATUS' + policy_status: + $ref: '#/components/schemas/BUCKET_POLICY_STATUS' + queue_status: + $ref: '#/components/schemas/QUEUE_SETUP_STATUS' + type: object + required: + - tenant + title: TenantStatusReport + description: Response model for a tenant status report. + ValidationError: + properties: + loc: + items: + anyOf: + - type: string + - type: integer + type: array + title: Location + msg: + type: string + title: Message + type: + type: string + title: Error Type + type: object + required: + - loc + - msg + - type + title: ValidationError + WebScriptChannelConfig: + properties: + type: + type: string + enum: + - webscript + title: Type + default: webscript + description: + type: string + title: Description + payload: + $ref: '#/components/schemas/PayloadConfig' + authentication: + $ref: '#/components/schemas/AuthenticationConfig' + expiry: + $ref: '#/components/schemas/Expiry' + name: + type: string + title: Name + version: + type: string + title: Version + method: + allOf: + - $ref: '#/components/schemas/HTTP_METHOD' + default: POST + type: object + required: + - name + title: WebScriptChannelConfig + description: Channel configuration for invoking a waylay webscript. + securitySchemes: + waylayApiKeySecret: + type: http + description: Waylay apiKey/apiSecret basic authentication. All endpoints support + also Waylay JWT Bearer authentication. + scheme: basic +tags: +- name: Bucket + description: User operations on the buckets of the mapped object stores. +- name: Object + description: User operations on bucket objects. +- name: Subscription + description: User operations on change notification subscriptions. +- name: About + description: Service version and status. +servers: +- url: https://api.waylay.io + description: Waylay enterprise gateway diff --git a/openapi/storage.transformed.openapi.yaml b/openapi/storage.transformed.openapi.yaml new file mode 100644 index 0000000..0c2db2b --- /dev/null +++ b/openapi/storage.transformed.openapi.yaml @@ -0,0 +1,1616 @@ +openapi: 3.0.3 +info: + title: Waylay Storage + description: | + + Manage storage buckets and subscriptions. + version: 0.4.1 +paths: + /storage/v1/bucket: + get: + tags: + - Bucket + summary: List Buckets + description: List authorized buckets. + operationId: list_bucket + parameters: + - required: false + schema: + type: string + title: Store + name: store + in: query + x-showExample: false + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BucketListing' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - waylayApiKeySecret: [] + x-py-method: list + x-consumes-multipart: false + x-consumes-urlencoded: false + x-consumes-json: false + x-consumes-other: false + /storage/v1/bucket/{bucket_name}: + get: + tags: + - Bucket + summary: Get Bucket + description: Get a descriptive representation of a bucket. + operationId: get_bucket + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + x-showExample: false + - required: false + schema: + type: string + title: Store + name: store + in: query + x-showExample: false + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Bucket' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - waylayApiKeySecret: [] + x-py-method: get + x-consumes-multipart: false + x-consumes-urlencoded: false + x-consumes-json: false + x-consumes-other: false + /storage/v1/bucket/{bucket_name}/{object_path}: + get: + tags: + - Object + summary: List Objects + description: >- + List, inspect or sign objects. + + + * list the objects of a bucket with {object_path} prefix + * (`recursive=true`) list content recursively + * (`all=true`) include hidden objects + * (`stat=true`) get the meta of the object at {object_path} + + * (`sign=[GET,PUT,POST]`) fetch presigned urls to operate on + {object_path} + * (`all=true`) allow link creation for hidden objects + operationId: list_object + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + x-showExample: false + - required: true + schema: + type: string + title: Object Path + name: object_path + in: path + x-showExample: false + - required: false + schema: + type: boolean + title: Stat + default: false + name: stat + in: query + x-showExample: true + - required: false + schema: + type: boolean + title: Recursive + name: recursive + in: query + x-showExample: true + - required: false + schema: + type: boolean + title: All + name: all + in: query + x-showExample: true + - required: false + schema: + type: string + title: Start After + name: start_after + in: query + x-showExample: false + - required: false + schema: + type: boolean + title: Fetch Content Type + default: true + name: fetch_content_type + in: query + x-showExample: true + - required: false + schema: + type: boolean + title: Get As Attachment + default: true + name: get_as_attachment + in: query + x-showExample: true + - required: false + schema: + type: integer + title: Max Keys + name: max_keys + in: query + x-showExample: false + - required: false + schema: + type: string + title: Sign + name: sign + in: query + x-showExample: false + - required: false + schema: + type: string + title: Store + name: store + in: query + x-showExample: false + - required: false + schema: + type: integer + title: Expiry Days + name: expiry_days + in: query + x-showExample: false + - required: false + schema: + type: integer + title: Expiry Hours + name: expiry_hours + in: query + x-showExample: false + - required: false + schema: + type: integer + title: Expiry Seconds + name: expiry_seconds + in: query + x-showExample: false + - required: false + schema: + type: integer + title: Content Length Min + default: 0 + name: content_length_min + in: query + x-showExample: true + - required: false + schema: + type: integer + title: Content Length Max + name: content_length_max + in: query + x-showExample: false + - required: false + schema: + type: string + title: Content Type + name: content_type + in: query + x-showExample: false + responses: + '200': + description: Successful Response + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/BucketObjectListing' + - $ref: '#/components/schemas/BucketObject' + - $ref: '#/components/schemas/HALEntity' + title: Response List + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - waylayApiKeySecret: [] + x-py-method: list + x-consumes-multipart: false + x-consumes-urlencoded: false + x-consumes-json: false + x-consumes-other: false + delete: + tags: + - Object + summary: Remove Object Or Folder + description: |- + Remove the object or folder at {object_path}. + + An {object_path} ending in a `/` requests folder deletion of an empty + folder unless: + * (`recursive=true`) forces recursive deletion of a (non-empty) folder. + * (`all=true`) forces recursive deletion, including hidden objects. + operationId: remove_object + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + x-showExample: false + - required: true + schema: + type: string + title: Object Path + name: object_path + in: path + x-showExample: false + - required: false + schema: + type: boolean + title: Recursive + name: recursive + in: query + x-showExample: true + - required: false + schema: + type: boolean + title: All + name: all + in: query + x-showExample: true + - required: false + schema: + type: string + title: Start After + name: start_after + in: query + x-showExample: false + - required: false + schema: + type: integer + title: Max Keys + name: max_keys + in: query + x-showExample: false + - required: false + schema: + type: string + title: Store + name: store + in: query + x-showExample: false + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/HALEntity' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - waylayApiKeySecret: [] + x-py-method: remove + x-consumes-multipart: false + x-consumes-urlencoded: false + x-consumes-json: false + x-consumes-other: false + /storage/v1/bucket/{bucket_name}/{object_path}/: + put: + tags: + - Object + summary: Create Folder + description: |- + Create a (virtual) folder. + + * (`all=true`) force creation of a hidden folder, + having a path element that starts with a `.`. + operationId: createFolder_object + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + x-showExample: false + - required: true + schema: + type: string + title: Object Path + name: object_path + in: path + x-showExample: false + - required: false + schema: + type: boolean + title: All + default: false + name: all + in: query + x-showExample: true + - required: false + schema: + type: string + title: Store + name: store + in: query + x-showExample: false + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BucketObject' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - waylayApiKeySecret: [] + x-py-method: create_folder + x-consumes-multipart: false + x-consumes-urlencoded: false + x-consumes-json: false + x-consumes-other: false + /storage/v1/bucket/{bucket_name}/{target_path}: + put: + tags: + - Object + summary: Copy Or Move Object + description: Copy or move object to new location. + operationId: copyOrMove_object + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + x-showExample: false + - required: true + schema: + type: string + title: Target Path + name: target_path + in: path + x-showExample: false + - required: true + schema: + type: string + title: Source + name: source + in: query + x-showExample: false + - required: false + schema: + type: boolean + title: Move + default: false + name: move + in: query + x-showExample: true + - required: false + schema: + type: string + title: Store + name: store + in: query + x-showExample: false + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/HALEntity' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - waylayApiKeySecret: [] + x-py-method: copy_or_move + x-consumes-multipart: false + x-consumes-urlencoded: false + x-consumes-json: false + x-consumes-other: false + /storage/v1/subscription: + get: + tags: + - Subscription + summary: Query All Subscriptions + description: >- + List notification subscriptions per bucket that have notification + enabled. + operationId: list_subscription + parameters: + - required: false + schema: + type: string + title: Store + name: store + in: query + x-showExample: false + - required: false + schema: + type: string + title: Prefix + name: prefix + in: query + x-showExample: false + - required: false + schema: + type: string + title: Suffix + name: suffix + in: query + x-showExample: false + - required: false + schema: + $ref: '#/components/schemas/VENT_TYPE' + name: event_type + in: query + x-showExample: true + - required: false + schema: + $ref: '#/components/schemas/CHANNEL_TYPE' + name: channel_type + in: query + x-showExample: true + - required: false + schema: + type: string + title: Channel Id + name: channel_id + in: query + x-showExample: false + - required: false + schema: + type: integer + title: Max Keys + name: max_keys + in: query + x-showExample: false + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionsListing' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - waylayApiKeySecret: [] + x-py-method: list + x-consumes-multipart: false + x-consumes-urlencoded: false + x-consumes-json: false + x-consumes-other: false + /storage/v1/subscription/{bucket_name}: + get: + tags: + - Subscription + summary: Query Bucket Subscriptions + description: List notification subscriptions for given bucket. + operationId: query_subscription + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + x-showExample: false + - required: false + schema: + type: string + title: Start After + name: start_after + in: query + x-showExample: false + - required: false + schema: + type: string + title: Store + name: store + in: query + x-showExample: false + - required: false + schema: + type: string + title: Prefix + name: prefix + in: query + x-showExample: false + - required: false + schema: + type: string + title: Suffix + name: suffix + in: query + x-showExample: false + - required: false + schema: + $ref: '#/components/schemas/VENT_TYPE' + name: event_type + in: query + x-showExample: true + - required: false + schema: + $ref: '#/components/schemas/CHANNEL_TYPE' + name: channel_type + in: query + x-showExample: true + - required: false + schema: + type: string + title: Channel Id + name: channel_id + in: query + x-showExample: false + - required: false + schema: + type: integer + title: Max Keys + name: max_keys + in: query + x-showExample: false + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Subscriptions' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - waylayApiKeySecret: [] + x-py-method: query + x-consumes-multipart: false + x-consumes-urlencoded: false + x-consumes-json: false + x-consumes-other: false + post: + tags: + - Subscription + summary: Create Bucket Subscription + description: >- + Create a new notification subscription on a bucket with a given or + generated id. + operationId: create_subscription + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + x-showExample: false + - required: false + schema: + type: string + title: Store + name: store + in: query + x-showExample: false + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionConfig' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionConfig' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - waylayApiKeySecret: [] + x-py-method: create + x-consumes-multipart: false + x-consumes-urlencoded: false + x-consumes-json: true + x-consumes-other: false + delete: + tags: + - Subscription + summary: Delete All Bucket Subscriptions + description: |- + Remove all notification subscription on a bucket + that match a given event and/or channel filter. + operationId: deleteBy_subscription + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + x-showExample: false + - required: false + schema: + type: string + title: Start After + name: start_after + in: query + x-showExample: false + - required: false + schema: + type: string + title: Prefix + name: prefix + in: query + x-showExample: false + - required: false + schema: + type: string + title: Suffix + name: suffix + in: query + x-showExample: false + - required: false + schema: + $ref: '#/components/schemas/VENT_TYPE' + name: event_type + in: query + x-showExample: true + - required: false + schema: + $ref: '#/components/schemas/CHANNEL_TYPE' + name: channel_type + in: query + x-showExample: true + - required: false + schema: + type: string + title: Channel Id + name: channel_id + in: query + x-showExample: false + - required: false + schema: + type: string + title: Store + name: store + in: query + x-showExample: false + - required: false + schema: + type: integer + title: Max Keys + name: max_keys + in: query + x-showExample: false + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/HALEntity' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - waylayApiKeySecret: [] + x-py-method: delete_by + x-consumes-multipart: false + x-consumes-urlencoded: false + x-consumes-json: false + x-consumes-other: false + /storage/v1/subscription/{bucket_name}/{subscription_id}: + get: + tags: + - Subscription + summary: Get Bucket Subscription + description: Fetch a notification subscription. + operationId: get_subscription + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + x-showExample: false + - required: true + schema: + type: string + title: Subscription Id + name: subscription_id + in: path + x-showExample: false + - required: false + schema: + type: string + title: Store + name: store + in: query + x-showExample: false + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionConfig' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - waylayApiKeySecret: [] + x-py-method: get + x-consumes-multipart: false + x-consumes-urlencoded: false + x-consumes-json: false + x-consumes-other: false + put: + tags: + - Subscription + summary: Replace Bucket Subscription + description: >- + Create or replace a notification subscription on a bucket with a given + id. + operationId: replace_subscription + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + x-showExample: false + - required: true + schema: + type: string + title: Subscription Id + name: subscription_id + in: path + x-showExample: false + - required: false + schema: + type: string + title: Store + name: store + in: query + x-showExample: false + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionConfig' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionConfig' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - waylayApiKeySecret: [] + x-py-method: replace + x-consumes-multipart: false + x-consumes-urlencoded: false + x-consumes-json: true + x-consumes-other: false + delete: + tags: + - Subscription + summary: Delete Bucket Subscription + description: Remove a notification subscription. + operationId: remove_subscription + parameters: + - required: true + schema: + type: string + title: Bucket Name + name: bucket_name + in: path + x-showExample: false + - required: true + schema: + type: string + title: Subscription Id + name: subscription_id + in: path + x-showExample: false + - required: false + schema: + type: string + title: Store + name: store + in: query + x-showExample: false + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/HALEntity' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - waylayApiKeySecret: [] + x-py-method: remove + x-consumes-multipart: false + x-consumes-urlencoded: false + x-consumes-json: false + x-consumes-other: false + /storage/v1/: + get: + tags: + - About + summary: Version + description: Get the application version. + operationId: version_about + responses: + '200': + description: Successful Response + content: + application/json: + schema: + type: string + title: Response Version + security: + - waylayApiKeySecret: [] + x-py-method: version + x-consumes-multipart: false + x-consumes-urlencoded: false + x-consumes-json: false + x-consumes-other: false + /storage/v1/status: + get: + tags: + - About + summary: Status + description: Validate consistency of buckets and notification queues for this tenant. + operationId: status_about + parameters: + - required: false + schema: + type: string + title: Store + name: store + in: query + x-showExample: false + - required: false + schema: + type: boolean + title: Include Buckets + default: true + name: include_buckets + in: query + x-showExample: true + - required: false + schema: + type: boolean + title: Include Queues + default: true + name: include_queues + in: query + x-showExample: true + - required: false + schema: + type: boolean + title: Include Disk Usage + default: false + name: include_disk_usage + in: query + x-showExample: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/TenantStatusReport' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - waylayApiKeySecret: [] + x-py-method: status + x-consumes-multipart: false + x-consumes-urlencoded: false + x-consumes-json: false + x-consumes-other: false +components: + schemas: + AUTH: + type: string + enum: + - DEFAULT + - NONE + - API_KEY + - TOKEN + - WAYLAY_APP + - WAYLAY_TOKEN + - WEBSCRIPT + description: Supported authentication methods for notifications. + AuthenticationConfig: + properties: + method: + allOf: + - $ref: '#/components/schemas/AUTH' + default: DEFAULT + key: + type: string + title: Key + secret: + type: string + title: Secret + type: object + description: >- + Configuration for the authentication method used when forwarding an + event to a channel. + BUCKET_CREATION_STATUS: + type: string + enum: + - unknown + - missing + - invalid + - up_to_date + description: Possbile bucket creation status codes. + BUCKET_POLICY_STATUS: + type: string + enum: + - unknown + - missing + - out_dated + - up_to_date + description: Possible bucket policy status codes. + Bucket: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + alias: + type: string + title: Alias + name: + type: string + title: Name + store: + $ref: '#/components/schemas/Store' + creation_date: + type: string + format: date-time + title: Creation Date + size: + type: integer + title: Size + type: object + required: + - name + description: Representation of a storage bucket. + BucketConfiguration: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + alias: + type: string + title: Alias + name: + type: string + title: Name + store: + $ref: '#/components/schemas/Store' + creation_date: + type: string + format: date-time + title: Creation Date + size: + type: integer + title: Size + status: + allOf: + - $ref: '#/components/schemas/BUCKET_CREATION_STATUS' + default: unknown + public_policy_json: + type: object + title: Public Policy Json + public_policy_type: + type: string + title: Public Policy Type + error: + type: string + title: Error + type: object + required: + - name + description: Representation of a bucket configuration. + BucketListing: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + buckets: + items: + $ref: '#/components/schemas/Bucket' + type: array + title: Buckets + type: object + required: + - buckets + description: List of Bucket representations. + BucketObject: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + bucket: + $ref: '#/components/schemas/Bucket' + name: + type: string + title: Name + last_modified: + type: string + format: date-time + title: Last Modified + etag: + type: string + title: Etag + size: + type: integer + title: Size + content_type: + type: string + title: Content Type + is_dir: + type: boolean + title: Is Dir + default: false + storage_class: + type: string + title: Storage Class + owner_id: + type: string + title: Owner Id + owner_name: + type: string + title: Owner Name + type: object + required: + - bucket + - name + description: Representation of a storage object. + BucketObjectListing: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + objects: + items: + $ref: '#/components/schemas/BucketObject' + type: array + title: Objects + type: object + required: + - objects + description: List of storage object representations. + CHANNEL_TYPE: + type: string + enum: + - webhook + - webscript + - system + description: Supported notification channel types. + VENT_TYPE: + type: string + enum: + - delete + - put + - get + description: Supported notification change event types. + EventFilter: + properties: + prefix: + type: string + title: Prefix + suffix: + type: string + title: Suffix + events: + items: + $ref: '#/components/schemas/VENT_TYPE' + type: array + uniqueItems: true + default: + - put + description: + type: string + title: Description + queue: + type: string + title: Queue + type: object + description: >- + Filter on change events in a storage backend. + + + The `prefix` and `suffix` properties are conditions on the object path + + (not including the bucket name). When not specified, all paths in the + bucket will selected. + + + The `events` property can contain `put` and/or `delete` values, + corresponding + + to create/update and deletion events. + + When not specified, only the create/update events are filtered. + Expiry: + properties: + seconds: + type: integer + title: Seconds + hours: + type: integer + title: Hours + days: + type: integer + title: Days + type: object + description: Input model for expiry parameters. + HALEntity: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + type: object + description: Output model representing a collection of HAL links. + HALLink: + properties: + href: + type: string + title: Href + method: + type: string + title: Method + form_data: + type: object + title: Form Data + type: object + required: + - href + description: Represents a HAL link. + HTTPValidationError: + properties: + detail: + items: + $ref: '#/components/schemas/ValidationError' + type: array + title: Detail + type: object + HTTP_METHOD: + type: string + enum: + - GET + - PUT + - POST + description: Supported notification methods. + NotificationQueueStatus: + properties: + status: + $ref: '#/components/schemas/QUEUE_SETUP_STATUS' + name: + type: string + title: Name + method: + type: string + title: Method + configured_parameters: + type: object + title: Configured Parameters + actual_parameters: + type: object + title: Actual Parameters + error: + type: string + title: Error + type: object + required: + - status + - name + - method + description: Response model for the notification queue configuration. + NotificationQueueStatusReport: + properties: + store: + type: string + title: Store + notification_queues: + items: + $ref: '#/components/schemas/NotificationQueueStatus' + type: array + title: Notification Queues + messages: + items: + type: object + type: array + title: Messages + type: object + required: + - store + - notification_queues + description: Response model for a notification queue status report. + PayloadConfig: + properties: + signed_links: + items: + $ref: '#/components/schemas/SIGN' + type: array + reference: + title: Reference + type: object + description: Configuration object that specifies the expected notification payload. + QUEUE_SETUP_STATUS: + type: string + enum: + - unknown + - missing + - invalid + - not_specified + - up_to_date + description: Possbile queue setup status codes. + SIGN: + type: string + enum: + - GET + - PUT + - POST + description: Supported `sign` url parameter values. + STORE_TYPE: + type: string + enum: + - gs + - s3 + - azure + description: Supported backend store types. + Store: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + type: + $ref: '#/components/schemas/STORE_TYPE' + name: + type: string + title: Name + url: + type: string + title: Url + type: object + required: + - type + - name + - url + description: Representation of a backend store. + SubscriptionConfig: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + id: + type: string + title: Id + title: + type: string + title: Title + description: + type: string + title: Description + channel: + anyOf: + - $ref: '#/components/schemas/WebScriptChannelConfig' + - $ref: '#/components/schemas/SystemChannelConfig' + title: Channel + filters: + items: + $ref: '#/components/schemas/EventFilter' + type: array + title: Filters + type: object + required: + - channel + - filters + description: >- + Specification of a notification subscription that forwards to a given + channel. + Subscriptions: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + bucket: + $ref: '#/components/schemas/Bucket' + subscriptions: + items: + $ref: '#/components/schemas/SubscriptionConfig' + type: array + title: Subscriptions + warnings: + items: + type: object + type: array + title: Warnings + type: object + required: + - bucket + - subscriptions + description: Listing object for subscriptions. + SubscriptionsListing: + properties: + _links: + additionalProperties: + anyOf: + - $ref: '#/components/schemas/HALLink' + - items: + $ref: '#/components/schemas/HALLink' + type: array + type: object + title: ' Links' + buckets: + items: + $ref: '#/components/schemas/Bucket' + type: array + title: Buckets + type: object + required: + - buckets + description: List of buckets that support subscriptions. + SystemChannelConfig: + properties: + type: + type: string + enum: + - system + default: system + description: + type: string + title: Description + payload: + $ref: '#/components/schemas/PayloadConfig' + authentication: + $ref: '#/components/schemas/AuthenticationConfig' + expiry: + $ref: '#/components/schemas/Expiry' + type: object + description: |- + Channel configuration for functionality that is fixed by the platform. + + This cannot be selected by the end user. + TenantStatusReport: + properties: + tenant: + type: string + title: Tenant + buckets: + items: + $ref: '#/components/schemas/BucketConfiguration' + type: array + title: Buckets + queues: + items: + $ref: '#/components/schemas/NotificationQueueStatusReport' + type: array + title: Queues + total_size: + type: integer + title: Total Size + bucket_status: + $ref: '#/components/schemas/BUCKET_CREATION_STATUS' + policy_status: + $ref: '#/components/schemas/BUCKET_POLICY_STATUS' + queue_status: + $ref: '#/components/schemas/QUEUE_SETUP_STATUS' + type: object + required: + - tenant + description: Response model for a tenant status report. + ValidationError: + properties: + loc: + items: + anyOf: + - type: string + - type: integer + type: array + title: Location + msg: + type: string + title: Message + type: + type: string + title: Error Type + type: object + required: + - loc + - msg + - type + WebScriptChannelConfig: + properties: + type: + type: string + enum: + - webscript + default: webscript + description: + type: string + title: Description + payload: + $ref: '#/components/schemas/PayloadConfig' + authentication: + $ref: '#/components/schemas/AuthenticationConfig' + expiry: + $ref: '#/components/schemas/Expiry' + name: + type: string + title: Name + version: + type: string + title: Version + method: + allOf: + - $ref: '#/components/schemas/HTTP_METHOD' + default: POST + type: object + required: + - name + description: Channel configuration for invoking a waylay webscript. + securitySchemes: + waylayApiKeySecret: + type: http + description: >- + Waylay apiKey/apiSecret basic authentication. All endpoints support also + Waylay JWT Bearer authentication. + scheme: basic +tags: + - name: Bucket + description: User operations on the buckets of the mapped object stores. + - name: Object + description: User operations on bucket objects. + - name: Subscription + description: User operations on change notification subscriptions. + - name: About + description: Service version and status. +servers: + - url: https://api.waylay.io + description: Waylay enterprise gateway diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..efdced7 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[tool.ruff] +include = ["pyproject.toml", "test/**/*.py"] + +[tool.ruff.lint] +ignore-init-module-imports = true +# allow duplicate imports +ignore=["F811"] +# https://docs.astral.sh/ruff/rules +select= [ + "UP007", "FA102", # convert Union to | (pep-604) + "I001", "F401", # sort and remove unused imports + "PIE790", # remove unnecessary pass statements + "E303", # too many blank lines +] + +[tool.ruff.lint.per-file-ignores] +# do not touch imports here +"__init__.py" = ["F401"] +"conftest.py" = ["F401"] + +[tool.pytest.ini_options] +asyncio_mode = "auto" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..252e690 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +pydantic ~= 2.6 +typing-extensions ~= 4.9 +waylay-sdk-core@git+https://github.com/waylayio/waylay-sdk-py@cc464ef9ee120bc54ff6381add0c92a2d06e2944 diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..81cb999 --- /dev/null +++ b/test/__init__.py @@ -0,0 +1 @@ +"""Waylay Storage.""" diff --git a/test/api/__init__.py b/test/api/__init__.py new file mode 100644 index 0000000..4424ea4 --- /dev/null +++ b/test/api/__init__.py @@ -0,0 +1 @@ +"""Waylay Storage tests.""" diff --git a/test/api/about_api_test.py b/test/api/about_api_test.py new file mode 100644 index 0000000..ad73a8a --- /dev/null +++ b/test/api/about_api_test.py @@ -0,0 +1,141 @@ +# coding: utf-8 +"""Waylay Storage api tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json +import re +from importlib.util import find_spec +from typing import Union + +import pytest +from pytest_httpx import HTTPXMock +from typeguard import check_type +from waylay.sdk import ApiClient, WaylayClient +from waylay.sdk.api._models import Model +from waylay.services.storage.api import AboutApi +from waylay.services.storage.service import StorageService + +from ..types.tenant_status_report_stub import TenantStatusReportStub + +MODELS_AVAILABLE = ( + True if find_spec("waylay.services.storage.models") is not None else False +) + +if MODELS_AVAILABLE: + from waylay.services.storage.models import TenantStatusReport + from waylay.services.storage.queries.about_api import StatusQuery + + +# some mappings that are needed for some interpolations +null, true, false = None, True, False + + +@pytest.fixture +def about_api(waylay_api_client: ApiClient) -> AboutApi: + return AboutApi(waylay_api_client) + + +def test_registered(waylay_client: WaylayClient): + """Test that AboutApi api is registered in the sdk client.""" + assert isinstance(waylay_client.storage.about, AboutApi) + + +def _status_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str): + mock_response = TenantStatusReportStub.create_json() + httpx_mock_kwargs = { + "method": "GET", + "url": re.compile(f"^{gateway_url}/storage/v1/status(\\?.*)?"), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_status(service: StorageService, gateway_url: str, httpx_mock: HTTPXMock): + """Test case for status + Status + """ + # set path params + kwargs = { + # optionally use StatusQuery to validate and reuse parameters + "query": StatusQuery( + store="store_example", + include_buckets=True, + include_queues=True, + include_disk_usage=False, + ), + } + _status_set_mock_response(httpx_mock, gateway_url) + resp = await service.about.status(**kwargs) + check_type(resp, Union[TenantStatusReport,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_status_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for status with models not installed + Status + """ + # set path params + kwargs = { + "query": { + "store": "store_example", + "include_buckets": True, + "include_queues": True, + "include_disk_usage": False, + }, + } + _status_set_mock_response(httpx_mock, gateway_url) + resp = await service.about.status(**kwargs) + check_type(resp, Model) + + +def _version_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str): + mock_response = "''" + httpx_mock_kwargs = { + "method": "GET", + "url": re.compile(f"^{gateway_url}/storage/v1/(\\?.*)?"), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_version( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for version + Version + """ + # set path params + kwargs = {} + _version_set_mock_response(httpx_mock, gateway_url) + resp = await service.about.version(**kwargs) + check_type(resp, Union[str,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_version_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for version with models not installed + Version + """ + # set path params + kwargs = {} + _version_set_mock_response(httpx_mock, gateway_url) + resp = await service.about.version(**kwargs) + check_type(resp, Model) diff --git a/test/api/bucket_api_test.py b/test/api/bucket_api_test.py new file mode 100644 index 0000000..d36cf42 --- /dev/null +++ b/test/api/bucket_api_test.py @@ -0,0 +1,151 @@ +# coding: utf-8 +"""Waylay Storage api tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json +import re +from importlib.util import find_spec +from typing import Union +from urllib.parse import quote + +import pytest +from pytest_httpx import HTTPXMock +from typeguard import check_type +from waylay.sdk import ApiClient, WaylayClient +from waylay.sdk.api._models import Model +from waylay.services.storage.api import BucketApi +from waylay.services.storage.service import StorageService + +from ..types.bucket_listing_stub import BucketListingStub +from ..types.bucket_stub import BucketStub + +MODELS_AVAILABLE = ( + True if find_spec("waylay.services.storage.models") is not None else False +) + +if MODELS_AVAILABLE: + from waylay.services.storage.models import ( + Bucket, + BucketListing, + ) + from waylay.services.storage.queries.bucket_api import GetQuery, ListQuery + + +# some mappings that are needed for some interpolations +null, true, false = None, True, False + + +@pytest.fixture +def bucket_api(waylay_api_client: ApiClient) -> BucketApi: + return BucketApi(waylay_api_client) + + +def test_registered(waylay_client: WaylayClient): + """Test that BucketApi api is registered in the sdk client.""" + assert isinstance(waylay_client.storage.bucket, BucketApi) + + +def _get_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str, bucket_name: str): + mock_response = BucketStub.create_json() + httpx_mock_kwargs = { + "method": "GET", + "url": re.compile(f"^{gateway_url}/storage/v1/bucket/{bucket_name}(\\?.*)?"), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_get(service: StorageService, gateway_url: str, httpx_mock: HTTPXMock): + """Test case for get + Get Bucket + """ + # set path params + bucket_name = "bucket_name_example" + + kwargs = { + # optionally use GetQuery to validate and reuse parameters + "query": GetQuery( + store="store_example", + ), + } + _get_set_mock_response(httpx_mock, gateway_url, quote(str(bucket_name))) + resp = await service.bucket.get(bucket_name, **kwargs) + check_type(resp, Union[Bucket,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_get_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for get with models not installed + Get Bucket + """ + # set path params + bucket_name = "bucket_name_example" + + kwargs = { + "query": { + "store": "store_example", + }, + } + _get_set_mock_response(httpx_mock, gateway_url, quote(str(bucket_name))) + resp = await service.bucket.get(bucket_name, **kwargs) + check_type(resp, Model) + + +def _list_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str): + mock_response = BucketListingStub.create_json() + httpx_mock_kwargs = { + "method": "GET", + "url": re.compile(f"^{gateway_url}/storage/v1/bucket(\\?.*)?"), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_list(service: StorageService, gateway_url: str, httpx_mock: HTTPXMock): + """Test case for list + List Buckets + """ + # set path params + kwargs = { + # optionally use ListQuery to validate and reuse parameters + "query": ListQuery( + store="store_example", + ), + } + _list_set_mock_response(httpx_mock, gateway_url) + resp = await service.bucket.list(**kwargs) + check_type(resp, Union[BucketListing,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_list_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for list with models not installed + List Buckets + """ + # set path params + kwargs = { + "query": { + "store": "store_example", + }, + } + _list_set_mock_response(httpx_mock, gateway_url) + resp = await service.bucket.list(**kwargs) + check_type(resp, Model) diff --git a/test/api/object_api_test.py b/test/api/object_api_test.py new file mode 100644 index 0000000..45ff94a --- /dev/null +++ b/test/api/object_api_test.py @@ -0,0 +1,360 @@ +# coding: utf-8 +"""Waylay Storage api tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json +import re +from importlib.util import find_spec +from typing import Union +from urllib.parse import quote + +import pytest +from pytest_httpx import HTTPXMock +from typeguard import check_type +from waylay.sdk import ApiClient, WaylayClient +from waylay.sdk.api._models import Model +from waylay.services.storage.api import ObjectApi +from waylay.services.storage.service import StorageService + +from ..types.bucket_object_stub import BucketObjectStub +from ..types.hal_entity_stub import HALEntityStub +from ..types.response_list_stub import ResponseListStub + +MODELS_AVAILABLE = ( + True if find_spec("waylay.services.storage.models") is not None else False +) + +if MODELS_AVAILABLE: + from waylay.services.storage.models import ( + BucketObject, + HALEntity, + ResponseList, + ) + from waylay.services.storage.queries.object_api import ( + CopyOrMoveQuery, + CreateFolderQuery, + ListQuery, + RemoveQuery, + ) + + +# some mappings that are needed for some interpolations +null, true, false = None, True, False + + +@pytest.fixture +def object_api(waylay_api_client: ApiClient) -> ObjectApi: + return ObjectApi(waylay_api_client) + + +def test_registered(waylay_client: WaylayClient): + """Test that ObjectApi api is registered in the sdk client.""" + assert isinstance(waylay_client.storage.object, ObjectApi) + + +def _copy_or_move_set_mock_response( + httpx_mock: HTTPXMock, gateway_url: str, bucket_name: str, target_path: str +): + mock_response = HALEntityStub.create_json() + httpx_mock_kwargs = { + "method": "PUT", + "url": re.compile( + f"^{gateway_url}/storage/v1/bucket/{bucket_name}/{target_path}(\\?.*)?" + ), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_copy_or_move( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for copy_or_move + Copy Or Move Object + """ + # set path params + bucket_name = "bucket_name_example" + + target_path = "target_path_example" + + kwargs = { + # optionally use CopyOrMoveQuery to validate and reuse parameters + "query": CopyOrMoveQuery( + source="source_example", + move=False, + store="store_example", + ), + } + _copy_or_move_set_mock_response( + httpx_mock, gateway_url, quote(str(bucket_name)), quote(str(target_path)) + ) + resp = await service.object.copy_or_move(bucket_name, target_path, **kwargs) + check_type(resp, Union[HALEntity,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_copy_or_move_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for copy_or_move with models not installed + Copy Or Move Object + """ + # set path params + bucket_name = "bucket_name_example" + + target_path = "target_path_example" + + kwargs = { + "query": { + "source": "source_example", + "move": False, + "store": "store_example", + }, + } + _copy_or_move_set_mock_response( + httpx_mock, gateway_url, quote(str(bucket_name)), quote(str(target_path)) + ) + resp = await service.object.copy_or_move(bucket_name, target_path, **kwargs) + check_type(resp, Model) + + +def _create_folder_set_mock_response( + httpx_mock: HTTPXMock, gateway_url: str, bucket_name: str, object_path: str +): + mock_response = BucketObjectStub.create_json() + httpx_mock_kwargs = { + "method": "PUT", + "url": re.compile( + f"^{gateway_url}/storage/v1/bucket/{bucket_name}/{object_path}/(\\?.*)?" + ), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_create_folder( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for create_folder + Create Folder + """ + # set path params + bucket_name = "bucket_name_example" + + object_path = "object_path_example" + + kwargs = { + # optionally use CreateFolderQuery to validate and reuse parameters + "query": CreateFolderQuery( + all=False, + store="store_example", + ), + } + _create_folder_set_mock_response( + httpx_mock, gateway_url, quote(str(bucket_name)), quote(str(object_path)) + ) + resp = await service.object.create_folder(bucket_name, object_path, **kwargs) + check_type(resp, Union[BucketObject,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_create_folder_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for create_folder with models not installed + Create Folder + """ + # set path params + bucket_name = "bucket_name_example" + + object_path = "object_path_example" + + kwargs = { + "query": { + "all": False, + "store": "store_example", + }, + } + _create_folder_set_mock_response( + httpx_mock, gateway_url, quote(str(bucket_name)), quote(str(object_path)) + ) + resp = await service.object.create_folder(bucket_name, object_path, **kwargs) + check_type(resp, Model) + + +def _list_set_mock_response( + httpx_mock: HTTPXMock, gateway_url: str, bucket_name: str, object_path: str +): + mock_response = ResponseListStub.create_json() + httpx_mock_kwargs = { + "method": "GET", + "url": re.compile( + f"^{gateway_url}/storage/v1/bucket/{bucket_name}/{object_path}(\\?.*)?" + ), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_list(service: StorageService, gateway_url: str, httpx_mock: HTTPXMock): + """Test case for list + List Objects + """ + # set path params + bucket_name = "bucket_name_example" + + object_path = "object_path_example" + + kwargs = { + # optionally use ListQuery to validate and reuse parameters + "query": ListQuery( + stat=False, + recursive=True, + all=True, + start_after="start_after_example", + fetch_content_type=True, + get_as_attachment=True, + max_keys=56, + sign="sign_example", + store="store_example", + expiry_days=56, + expiry_hours=56, + expiry_seconds=56, + content_length_min=0, + content_length_max=56, + content_type="content_type_example", + ), + } + _list_set_mock_response( + httpx_mock, gateway_url, quote(str(bucket_name)), quote(str(object_path)) + ) + resp = await service.object.list(bucket_name, object_path, **kwargs) + check_type(resp, Union[ResponseList,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_list_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for list with models not installed + List Objects + """ + # set path params + bucket_name = "bucket_name_example" + + object_path = "object_path_example" + + kwargs = { + "query": { + "stat": False, + "recursive": True, + "all": True, + "start_after": "start_after_example", + "fetch_content_type": True, + "get_as_attachment": True, + "max_keys": 56, + "sign": "sign_example", + "store": "store_example", + "expiry_days": 56, + "expiry_hours": 56, + "expiry_seconds": 56, + "content_length_min": 0, + "content_length_max": 56, + "content_type": "content_type_example", + }, + } + _list_set_mock_response( + httpx_mock, gateway_url, quote(str(bucket_name)), quote(str(object_path)) + ) + resp = await service.object.list(bucket_name, object_path, **kwargs) + check_type(resp, Model) + + +def _remove_set_mock_response( + httpx_mock: HTTPXMock, gateway_url: str, bucket_name: str, object_path: str +): + mock_response = HALEntityStub.create_json() + httpx_mock_kwargs = { + "method": "DELETE", + "url": re.compile( + f"^{gateway_url}/storage/v1/bucket/{bucket_name}/{object_path}(\\?.*)?" + ), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_remove(service: StorageService, gateway_url: str, httpx_mock: HTTPXMock): + """Test case for remove + Remove Object Or Folder + """ + # set path params + bucket_name = "bucket_name_example" + + object_path = "object_path_example" + + kwargs = { + # optionally use RemoveQuery to validate and reuse parameters + "query": RemoveQuery( + recursive=True, + all=True, + start_after="start_after_example", + max_keys=56, + store="store_example", + ), + } + _remove_set_mock_response( + httpx_mock, gateway_url, quote(str(bucket_name)), quote(str(object_path)) + ) + resp = await service.object.remove(bucket_name, object_path, **kwargs) + check_type(resp, Union[HALEntity,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_remove_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for remove with models not installed + Remove Object Or Folder + """ + # set path params + bucket_name = "bucket_name_example" + + object_path = "object_path_example" + + kwargs = { + "query": { + "recursive": True, + "all": True, + "start_after": "start_after_example", + "max_keys": 56, + "store": "store_example", + }, + } + _remove_set_mock_response( + httpx_mock, gateway_url, quote(str(bucket_name)), quote(str(object_path)) + ) + resp = await service.object.remove(bucket_name, object_path, **kwargs) + check_type(resp, Model) diff --git a/test/api/subscription_api_test.py b/test/api/subscription_api_test.py new file mode 100644 index 0000000..434c904 --- /dev/null +++ b/test/api/subscription_api_test.py @@ -0,0 +1,517 @@ +# coding: utf-8 +"""Waylay Storage api tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json +import re +from importlib.util import find_spec +from typing import Union +from urllib.parse import quote + +import pytest +from pytest_httpx import HTTPXMock +from typeguard import check_type +from waylay.sdk import ApiClient, WaylayClient +from waylay.sdk.api._models import Model +from waylay.services.storage.api import SubscriptionApi +from waylay.services.storage.service import StorageService + +from ..types.hal_entity_stub import HALEntityStub +from ..types.subscription_config_stub import SubscriptionConfigStub +from ..types.subscriptions_listing_stub import SubscriptionsListingStub +from ..types.subscriptions_stub import SubscriptionsStub + +MODELS_AVAILABLE = ( + True if find_spec("waylay.services.storage.models") is not None else False +) + +if MODELS_AVAILABLE: + from waylay.services.storage.models import ( + HALEntity, + SubscriptionConfig, + Subscriptions, + SubscriptionsListing, + ) + from waylay.services.storage.queries.subscription_api import ( + CreateQuery, + DeleteByQuery, + GetQuery, + ListQuery, + QueryQuery, + RemoveQuery, + ReplaceQuery, + ) + + +# some mappings that are needed for some interpolations +null, true, false = None, True, False + + +@pytest.fixture +def subscription_api(waylay_api_client: ApiClient) -> SubscriptionApi: + return SubscriptionApi(waylay_api_client) + + +def test_registered(waylay_client: WaylayClient): + """Test that SubscriptionApi api is registered in the sdk client.""" + assert isinstance(waylay_client.storage.subscription, SubscriptionApi) + + +def _create_set_mock_response( + httpx_mock: HTTPXMock, gateway_url: str, bucket_name: str +): + mock_response = SubscriptionConfigStub.create_json() + httpx_mock_kwargs = { + "method": "POST", + "url": re.compile( + f"^{gateway_url}/storage/v1/subscription/{bucket_name}(\\?.*)?" + ), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_create(service: StorageService, gateway_url: str, httpx_mock: HTTPXMock): + """Test case for create + Create Bucket Subscription + """ + # set path params + bucket_name = "bucket_name_example" + + kwargs = { + # optionally use CreateQuery to validate and reuse parameters + "query": CreateQuery( + store="store_example", + ), + "json": SubscriptionConfigStub.create_instance(), + } + _create_set_mock_response(httpx_mock, gateway_url, quote(str(bucket_name))) + resp = await service.subscription.create(bucket_name, **kwargs) + check_type(resp, Union[SubscriptionConfig,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_create_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for create with models not installed + Create Bucket Subscription + """ + # set path params + bucket_name = "bucket_name_example" + + kwargs = { + "query": { + "store": "store_example", + }, + "json": SubscriptionConfigStub.create_json(), + } + _create_set_mock_response(httpx_mock, gateway_url, quote(str(bucket_name))) + resp = await service.subscription.create(bucket_name, **kwargs) + check_type(resp, Model) + + +def _delete_by_set_mock_response( + httpx_mock: HTTPXMock, gateway_url: str, bucket_name: str +): + mock_response = HALEntityStub.create_json() + httpx_mock_kwargs = { + "method": "DELETE", + "url": re.compile( + f"^{gateway_url}/storage/v1/subscription/{bucket_name}(\\?.*)?" + ), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_delete_by( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for delete_by + Delete All Bucket Subscriptions + """ + # set path params + bucket_name = "bucket_name_example" + + kwargs = { + # optionally use DeleteByQuery to validate and reuse parameters + "query": DeleteByQuery( + start_after="start_after_example", + prefix="prefix_example", + suffix="suffix_example", + event_type="delete", + channel_type="webhook", + channel_id="channel_id_example", + store="store_example", + max_keys=56, + ), + } + _delete_by_set_mock_response(httpx_mock, gateway_url, quote(str(bucket_name))) + resp = await service.subscription.delete_by(bucket_name, **kwargs) + check_type(resp, Union[HALEntity,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_delete_by_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for delete_by with models not installed + Delete All Bucket Subscriptions + """ + # set path params + bucket_name = "bucket_name_example" + + kwargs = { + "query": { + "start_after": "start_after_example", + "prefix": "prefix_example", + "suffix": "suffix_example", + "event_type": "delete", + "channel_type": "webhook", + "channel_id": "channel_id_example", + "store": "store_example", + "max_keys": 56, + }, + } + _delete_by_set_mock_response(httpx_mock, gateway_url, quote(str(bucket_name))) + resp = await service.subscription.delete_by(bucket_name, **kwargs) + check_type(resp, Model) + + +def _get_set_mock_response( + httpx_mock: HTTPXMock, gateway_url: str, bucket_name: str, subscription_id: str +): + mock_response = SubscriptionConfigStub.create_json() + httpx_mock_kwargs = { + "method": "GET", + "url": re.compile( + f"^{gateway_url}/storage/v1/subscription/{bucket_name}/{subscription_id}(\\?.*)?" + ), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_get(service: StorageService, gateway_url: str, httpx_mock: HTTPXMock): + """Test case for get + Get Bucket Subscription + """ + # set path params + bucket_name = "bucket_name_example" + + subscription_id = "subscription_id_example" + + kwargs = { + # optionally use GetQuery to validate and reuse parameters + "query": GetQuery( + store="store_example", + ), + } + _get_set_mock_response( + httpx_mock, gateway_url, quote(str(bucket_name)), quote(str(subscription_id)) + ) + resp = await service.subscription.get(bucket_name, subscription_id, **kwargs) + check_type(resp, Union[SubscriptionConfig,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_get_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for get with models not installed + Get Bucket Subscription + """ + # set path params + bucket_name = "bucket_name_example" + + subscription_id = "subscription_id_example" + + kwargs = { + "query": { + "store": "store_example", + }, + } + _get_set_mock_response( + httpx_mock, gateway_url, quote(str(bucket_name)), quote(str(subscription_id)) + ) + resp = await service.subscription.get(bucket_name, subscription_id, **kwargs) + check_type(resp, Model) + + +def _list_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str): + mock_response = SubscriptionsListingStub.create_json() + httpx_mock_kwargs = { + "method": "GET", + "url": re.compile(f"^{gateway_url}/storage/v1/subscription(\\?.*)?"), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_list(service: StorageService, gateway_url: str, httpx_mock: HTTPXMock): + """Test case for list + Query All Subscriptions + """ + # set path params + kwargs = { + # optionally use ListQuery to validate and reuse parameters + "query": ListQuery( + store="store_example", + prefix="prefix_example", + suffix="suffix_example", + event_type="delete", + channel_type="webhook", + channel_id="channel_id_example", + max_keys=56, + ), + } + _list_set_mock_response(httpx_mock, gateway_url) + resp = await service.subscription.list(**kwargs) + check_type(resp, Union[SubscriptionsListing,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_list_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for list with models not installed + Query All Subscriptions + """ + # set path params + kwargs = { + "query": { + "store": "store_example", + "prefix": "prefix_example", + "suffix": "suffix_example", + "event_type": "delete", + "channel_type": "webhook", + "channel_id": "channel_id_example", + "max_keys": 56, + }, + } + _list_set_mock_response(httpx_mock, gateway_url) + resp = await service.subscription.list(**kwargs) + check_type(resp, Model) + + +def _query_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str, bucket_name: str): + mock_response = SubscriptionsStub.create_json() + httpx_mock_kwargs = { + "method": "GET", + "url": re.compile( + f"^{gateway_url}/storage/v1/subscription/{bucket_name}(\\?.*)?" + ), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_query(service: StorageService, gateway_url: str, httpx_mock: HTTPXMock): + """Test case for query + Query Bucket Subscriptions + """ + # set path params + bucket_name = "bucket_name_example" + + kwargs = { + # optionally use QueryQuery to validate and reuse parameters + "query": QueryQuery( + start_after="start_after_example", + store="store_example", + prefix="prefix_example", + suffix="suffix_example", + event_type="delete", + channel_type="webhook", + channel_id="channel_id_example", + max_keys=56, + ), + } + _query_set_mock_response(httpx_mock, gateway_url, quote(str(bucket_name))) + resp = await service.subscription.query(bucket_name, **kwargs) + check_type(resp, Union[Subscriptions,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_query_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for query with models not installed + Query Bucket Subscriptions + """ + # set path params + bucket_name = "bucket_name_example" + + kwargs = { + "query": { + "start_after": "start_after_example", + "store": "store_example", + "prefix": "prefix_example", + "suffix": "suffix_example", + "event_type": "delete", + "channel_type": "webhook", + "channel_id": "channel_id_example", + "max_keys": 56, + }, + } + _query_set_mock_response(httpx_mock, gateway_url, quote(str(bucket_name))) + resp = await service.subscription.query(bucket_name, **kwargs) + check_type(resp, Model) + + +def _remove_set_mock_response( + httpx_mock: HTTPXMock, gateway_url: str, bucket_name: str, subscription_id: str +): + mock_response = HALEntityStub.create_json() + httpx_mock_kwargs = { + "method": "DELETE", + "url": re.compile( + f"^{gateway_url}/storage/v1/subscription/{bucket_name}/{subscription_id}(\\?.*)?" + ), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_remove(service: StorageService, gateway_url: str, httpx_mock: HTTPXMock): + """Test case for remove + Delete Bucket Subscription + """ + # set path params + bucket_name = "bucket_name_example" + + subscription_id = "subscription_id_example" + + kwargs = { + # optionally use RemoveQuery to validate and reuse parameters + "query": RemoveQuery( + store="store_example", + ), + } + _remove_set_mock_response( + httpx_mock, gateway_url, quote(str(bucket_name)), quote(str(subscription_id)) + ) + resp = await service.subscription.remove(bucket_name, subscription_id, **kwargs) + check_type(resp, Union[HALEntity,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_remove_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for remove with models not installed + Delete Bucket Subscription + """ + # set path params + bucket_name = "bucket_name_example" + + subscription_id = "subscription_id_example" + + kwargs = { + "query": { + "store": "store_example", + }, + } + _remove_set_mock_response( + httpx_mock, gateway_url, quote(str(bucket_name)), quote(str(subscription_id)) + ) + resp = await service.subscription.remove(bucket_name, subscription_id, **kwargs) + check_type(resp, Model) + + +def _replace_set_mock_response( + httpx_mock: HTTPXMock, gateway_url: str, bucket_name: str, subscription_id: str +): + mock_response = SubscriptionConfigStub.create_json() + httpx_mock_kwargs = { + "method": "PUT", + "url": re.compile( + f"^{gateway_url}/storage/v1/subscription/{bucket_name}/{subscription_id}(\\?.*)?" + ), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_replace( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for replace + Replace Bucket Subscription + """ + # set path params + bucket_name = "bucket_name_example" + + subscription_id = "subscription_id_example" + + kwargs = { + # optionally use ReplaceQuery to validate and reuse parameters + "query": ReplaceQuery( + store="store_example", + ), + "json": SubscriptionConfigStub.create_instance(), + } + _replace_set_mock_response( + httpx_mock, gateway_url, quote(str(bucket_name)), quote(str(subscription_id)) + ) + resp = await service.subscription.replace(bucket_name, subscription_id, **kwargs) + check_type(resp, Union[SubscriptionConfig,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_replace_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for replace with models not installed + Replace Bucket Subscription + """ + # set path params + bucket_name = "bucket_name_example" + + subscription_id = "subscription_id_example" + + kwargs = { + "query": { + "store": "store_example", + }, + "json": SubscriptionConfigStub.create_json(), + } + _replace_set_mock_response( + httpx_mock, gateway_url, quote(str(bucket_name)), quote(str(subscription_id)) + ) + resp = await service.subscription.replace(bucket_name, subscription_id, **kwargs) + check_type(resp, Model) diff --git a/test/conftest.py b/test/conftest.py new file mode 100644 index 0000000..4f5f39a --- /dev/null +++ b/test/conftest.py @@ -0,0 +1,68 @@ +"""Automatic pytest fixtures.""" + +import httpx +import pytest +import starlette.requests as req +import starlette.responses as res +from waylay.sdk import ApiClient, WaylayClient, WaylayConfig +from waylay.sdk.auth import NoCredentials +from waylay.services.storage.service import StorageService + +GATEWAY_URL = "http://example.io" + + +@pytest.fixture(name="gateway_url") +def fixture_gateway_url() -> str: + return GATEWAY_URL + + +@pytest.fixture(name="waylay_config") +def fixture_config(gateway_url) -> WaylayConfig: + return WaylayConfig(credentials=NoCredentials(gateway_url=gateway_url)) + + +@pytest.fixture(name="waylay_api_client") +def fixture_api_client(waylay_config: WaylayConfig) -> ApiClient: + return ApiClient(waylay_config, {"auth": None}) + + +@pytest.fixture(name="service") +def fixture_service(waylay_api_client: ApiClient) -> StorageService: + return StorageService(waylay_api_client) + + +@pytest.fixture(name="waylay_client") +def fixture_waylay_client(waylay_config: WaylayConfig) -> WaylayClient: + return WaylayClient(waylay_config, {"auth": None}) + + +@pytest.fixture(name="test_app", scope="module") +def fixture_my_app(): + async def echo_app(scope, receive, send): + request = req.Request(scope, receive) + content_type = request.headers.get("content-type", "application/octet-stream") + if content_type.startswith("application/json"): + response = res.JSONResponse(await request.json()) + elif content_type.startswith("multipart/form-data") or content_type.startswith( + "application/x-www-form-urlencoded" + ): + form = await request.form() + response = res.JSONResponse({ + key: (value if isinstance(value, str) else {"size": value.size}) + for key, value in form.items() + }) + else: + bytes = await request.body() + response = res.JSONResponse({"bytes": str(bytes, encoding="utf-8")}) + await response(scope, receive, send) + + return echo_app + + +@pytest.fixture(name="echo_service") +async def fixture_echo_client(service, test_app): + async with service({ + "transport": httpx.ASGITransport(test_app), + "auth": None, + }) as srv: + yield srv diff --git a/test/openapi.py b/test/openapi.py new file mode 100644 index 0000000..f7cac23 --- /dev/null +++ b/test/openapi.py @@ -0,0 +1,959 @@ +import json + +import yaml + + +def with_example_provider(dct): + has_example = False + if "example" in dct: + example, has_example = dct["example"], True + elif "examples" in dct: + examples = dct["examples"] + if isinstance(examples, list) and list: + example, has_example = examples[0], True + elif "default" in dct: + example, has_example = dct["default"], True + + if has_example: + provider = ( + example + if example is None or isinstance(example, (dict, list, int, float, bool)) + else f"'{example}'" + ) + dct.update({"$provider": f"lambda: {provider}"}) + return dct + + +with open("openapi/storage.transformed.openapi.yaml", "r") as file: + OPENAPI_SPEC = yaml.safe_load(file) + +MODEL_DEFINITIONS = OPENAPI_SPEC["components"]["schemas"] + +_auth_model_schema = json.loads( + r"""{ + "type" : "string", + "description" : "Supported authentication methods for notifications.", + "enum" : [ "DEFAULT", "NONE", "API_KEY", "TOKEN", "WAYLAY_APP", "WAYLAY_TOKEN", "WEBSCRIPT" ] +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"AUTH": _auth_model_schema}) + +_authentication_config_model_schema = json.loads( + r"""{ + "type" : "object", + "properties" : { + "method" : { + "allOf" : [ { + "$ref" : "#/components/schemas/AUTH" + } ], + "default" : "DEFAULT" + }, + "key" : { + "title" : "Key", + "type" : "string" + }, + "secret" : { + "title" : "Secret", + "type" : "string" + } + }, + "description" : "Configuration for the authentication method used when forwarding an event to a channel." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"AuthenticationConfig": _authentication_config_model_schema}) + +_bucket_creation_status_model_schema = json.loads( + r"""{ + "type" : "string", + "description" : "Possbile bucket creation status codes.", + "enum" : [ "unknown", "missing", "invalid", "up_to_date" ] +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({ + "BUCKET_CREATION_STATUS": _bucket_creation_status_model_schema +}) + +_bucket_policy_status_model_schema = json.loads( + r"""{ + "type" : "string", + "description" : "Possible bucket policy status codes.", + "enum" : [ "unknown", "missing", "out_dated", "up_to_date" ] +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"BUCKET_POLICY_STATUS": _bucket_policy_status_model_schema}) + +_bucket_model_schema = json.loads( + r"""{ + "required" : [ "name" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "alias" : { + "title" : "Alias", + "type" : "string" + }, + "name" : { + "title" : "Name", + "type" : "string" + }, + "store" : { + "$ref" : "#/components/schemas/Store" + }, + "creation_date" : { + "title" : "Creation Date", + "type" : "string", + "format" : "date-time" + }, + "size" : { + "title" : "Size", + "type" : "integer" + } + }, + "description" : "Representation of a storage bucket." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"Bucket": _bucket_model_schema}) + +_bucket_configuration_model_schema = json.loads( + r"""{ + "required" : [ "name" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "alias" : { + "title" : "Alias", + "type" : "string" + }, + "name" : { + "title" : "Name", + "type" : "string" + }, + "store" : { + "$ref" : "#/components/schemas/Store" + }, + "creation_date" : { + "title" : "Creation Date", + "type" : "string", + "format" : "date-time" + }, + "size" : { + "title" : "Size", + "type" : "integer" + }, + "status" : { + "allOf" : [ { + "$ref" : "#/components/schemas/BUCKET_CREATION_STATUS" + } ], + "default" : "unknown" + }, + "public_policy_json" : { + "title" : "Public Policy Json", + "type" : "object" + }, + "public_policy_type" : { + "title" : "Public Policy Type", + "type" : "string" + }, + "error" : { + "title" : "Error", + "type" : "string" + } + }, + "description" : "Representation of a bucket configuration." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"BucketConfiguration": _bucket_configuration_model_schema}) + +_bucket_listing_model_schema = json.loads( + r"""{ + "required" : [ "buckets" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "buckets" : { + "title" : "Buckets", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Bucket" + } + } + }, + "description" : "List of Bucket representations." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"BucketListing": _bucket_listing_model_schema}) + +_bucket_object_model_schema = json.loads( + r"""{ + "required" : [ "bucket", "name" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "bucket" : { + "$ref" : "#/components/schemas/Bucket" + }, + "name" : { + "title" : "Name", + "type" : "string" + }, + "last_modified" : { + "title" : "Last Modified", + "type" : "string", + "format" : "date-time" + }, + "etag" : { + "title" : "Etag", + "type" : "string" + }, + "size" : { + "title" : "Size", + "type" : "integer" + }, + "content_type" : { + "title" : "Content Type", + "type" : "string" + }, + "is_dir" : { + "title" : "Is Dir", + "type" : "boolean", + "default" : false + }, + "storage_class" : { + "title" : "Storage Class", + "type" : "string" + }, + "owner_id" : { + "title" : "Owner Id", + "type" : "string" + }, + "owner_name" : { + "title" : "Owner Name", + "type" : "string" + } + }, + "description" : "Representation of a storage object." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"BucketObject": _bucket_object_model_schema}) + +_bucket_object_listing_model_schema = json.loads( + r"""{ + "required" : [ "objects" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "objects" : { + "title" : "Objects", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/BucketObject" + } + } + }, + "description" : "List of storage object representations." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"BucketObjectListing": _bucket_object_listing_model_schema}) + +_channel_type_model_schema = json.loads( + r"""{ + "type" : "string", + "description" : "Supported notification channel types.", + "enum" : [ "webhook", "webscript", "system" ] +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"CHANNEL_TYPE": _channel_type_model_schema}) + +_channel_model_schema = json.loads( + r"""{ + "title" : "Channel", + "anyOf" : [ { + "$ref" : "#/components/schemas/WebScriptChannelConfig" + }, { + "$ref" : "#/components/schemas/SystemChannelConfig" + } ] +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"Channel": _channel_model_schema}) + +_event_filter_model_schema = json.loads( + r"""{ + "type" : "object", + "properties" : { + "prefix" : { + "title" : "Prefix", + "type" : "string" + }, + "suffix" : { + "title" : "Suffix", + "type" : "string" + }, + "events" : { + "uniqueItems" : true, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/VENT_TYPE" + }, + "default" : [ "put" ] + }, + "description" : { + "title" : "Description", + "type" : "string" + }, + "queue" : { + "title" : "Queue", + "type" : "string" + } + }, + "description" : "Filter on change events in a storage backend.\n\nThe `prefix` and `suffix` properties are conditions on the object path\n(not including the bucket name). When not specified, all paths in the bucket will selected.\n\nThe `events` property can contain `put` and/or `delete` values, corresponding\nto create/update and deletion events.\nWhen not specified, only the create/update events are filtered." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"EventFilter": _event_filter_model_schema}) + +_expiry_model_schema = json.loads( + r"""{ + "type" : "object", + "properties" : { + "seconds" : { + "title" : "Seconds", + "type" : "integer" + }, + "hours" : { + "title" : "Hours", + "type" : "integer" + }, + "days" : { + "title" : "Days", + "type" : "integer" + } + }, + "description" : "Input model for expiry parameters." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"Expiry": _expiry_model_schema}) + +_hal_entity_model_schema = json.loads( + r"""{ + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + } + }, + "description" : "Output model representing a collection of HAL links." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"HALEntity": _hal_entity_model_schema}) + +_hal_link_model_schema = json.loads( + r"""{ + "required" : [ "href" ], + "type" : "object", + "properties" : { + "href" : { + "title" : "Href", + "type" : "string" + }, + "method" : { + "title" : "Method", + "type" : "string" + }, + "form_data" : { + "title" : "Form Data", + "type" : "object" + } + }, + "description" : "Represents a HAL link." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"HALLink": _hal_link_model_schema}) + +_http_method_model_schema = json.loads( + r"""{ + "type" : "string", + "description" : "Supported notification methods.", + "enum" : [ "GET", "PUT", "POST" ] +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"HTTP_METHOD": _http_method_model_schema}) + +_http_validation_error_model_schema = json.loads( + r"""{ + "type" : "object", + "properties" : { + "detail" : { + "title" : "Detail", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ValidationError" + } + } + } +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"HTTPValidationError": _http_validation_error_model_schema}) + +_links_model_schema = json.loads( + r"""{ + "title" : "_Links", + "anyOf" : [ { + "$ref" : "#/components/schemas/HALLink" + }, { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/HALLink" + } + } ] +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"_Links": _links_model_schema}) + +_location_inner_model_schema = json.loads( + r"""{ + "title" : "Location_inner", + "anyOf" : [ { + "type" : "string" + }, { + "type" : "integer" + } ] +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"Location_inner": _location_inner_model_schema}) + +_notification_queue_status_model_schema = json.loads( + r"""{ + "required" : [ "method", "name", "status" ], + "type" : "object", + "properties" : { + "status" : { + "$ref" : "#/components/schemas/QUEUE_SETUP_STATUS" + }, + "name" : { + "title" : "Name", + "type" : "string" + }, + "method" : { + "title" : "Method", + "type" : "string" + }, + "configured_parameters" : { + "title" : "Configured Parameters", + "type" : "object" + }, + "actual_parameters" : { + "title" : "Actual Parameters", + "type" : "object" + }, + "error" : { + "title" : "Error", + "type" : "string" + } + }, + "description" : "Response model for the notification queue configuration." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({ + "NotificationQueueStatus": _notification_queue_status_model_schema +}) + +_notification_queue_status_report_model_schema = json.loads( + r"""{ + "required" : [ "notification_queues", "store" ], + "type" : "object", + "properties" : { + "store" : { + "title" : "Store", + "type" : "string" + }, + "notification_queues" : { + "title" : "Notification Queues", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/NotificationQueueStatus" + } + }, + "messages" : { + "title" : "Messages", + "type" : "array", + "items" : { + "type" : "object" + } + } + }, + "description" : "Response model for a notification queue status report." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({ + "NotificationQueueStatusReport": _notification_queue_status_report_model_schema +}) + +_payload_config_model_schema = json.loads( + r"""{ + "type" : "object", + "properties" : { + "signed_links" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/SIGN" + } + }, + "reference" : { + "title" : "Reference" + } + }, + "description" : "Configuration object that specifies the expected notification payload." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"PayloadConfig": _payload_config_model_schema}) + +_queue_setup_status_model_schema = json.loads( + r"""{ + "title" : "QUEUE_SETUP_STATUS", + "type" : "string", + "description" : "Possbile queue setup status codes.", + "enum" : [ "unknown", "missing", "invalid", "not_specified", "up_to_date" ] +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"QUEUE_SETUP_STATUS": _queue_setup_status_model_schema}) + +_response_list_model_schema = json.loads( + r"""{ + "title" : "Response List", + "anyOf" : [ { + "$ref" : "#/components/schemas/BucketObjectListing" + }, { + "$ref" : "#/components/schemas/BucketObject" + }, { + "$ref" : "#/components/schemas/HALEntity" + } ] +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"Response_List": _response_list_model_schema}) + +_sign_model_schema = json.loads( + r"""{ + "title" : "SIGN", + "type" : "string", + "description" : "Supported `sign` url parameter values.", + "enum" : [ "GET", "PUT", "POST" ] +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"SIGN": _sign_model_schema}) + +_store_type_model_schema = json.loads( + r"""{ + "title" : "STORE_TYPE", + "type" : "string", + "description" : "Supported backend store types.", + "enum" : [ "gs", "s3", "azure" ] +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"STORE_TYPE": _store_type_model_schema}) + +_store_model_schema = json.loads( + r"""{ + "title" : "Store", + "required" : [ "name", "type", "url" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "type" : { + "$ref" : "#/components/schemas/STORE_TYPE" + }, + "name" : { + "title" : "Name", + "type" : "string" + }, + "url" : { + "title" : "Url", + "type" : "string" + } + }, + "description" : "Representation of a backend store." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"Store": _store_model_schema}) + +_subscription_config_model_schema = json.loads( + r"""{ + "required" : [ "channel", "filters" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "id" : { + "title" : "Id", + "type" : "string" + }, + "title" : { + "title" : "Title", + "type" : "string" + }, + "description" : { + "title" : "Description", + "type" : "string" + }, + "channel" : { + "$ref" : "#/components/schemas/Channel" + }, + "filters" : { + "title" : "Filters", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/EventFilter" + } + } + }, + "description" : "Specification of a notification subscription that forwards to a given channel." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"SubscriptionConfig": _subscription_config_model_schema}) + +_subscriptions_model_schema = json.loads( + r"""{ + "required" : [ "bucket", "subscriptions" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "bucket" : { + "$ref" : "#/components/schemas/Bucket" + }, + "subscriptions" : { + "title" : "Subscriptions", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/SubscriptionConfig" + } + }, + "warnings" : { + "title" : "Warnings", + "type" : "array", + "items" : { + "type" : "object" + } + } + }, + "description" : "Listing object for subscriptions." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"Subscriptions": _subscriptions_model_schema}) + +_subscriptions_listing_model_schema = json.loads( + r"""{ + "required" : [ "buckets" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "buckets" : { + "title" : "Buckets", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Bucket" + } + } + }, + "description" : "List of buckets that support subscriptions." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"SubscriptionsListing": _subscriptions_listing_model_schema}) + +_system_channel_config_model_schema = json.loads( + r"""{ + "type" : "object", + "properties" : { + "type" : { + "$ref" : "#/components/schemas/SystemChannelConfig_type" + }, + "description" : { + "title" : "Description", + "type" : "string" + }, + "payload" : { + "$ref" : "#/components/schemas/PayloadConfig" + }, + "authentication" : { + "$ref" : "#/components/schemas/AuthenticationConfig" + }, + "expiry" : { + "$ref" : "#/components/schemas/Expiry" + } + }, + "description" : "Channel configuration for functionality that is fixed by the platform.\n\nThis cannot be selected by the end user." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"SystemChannelConfig": _system_channel_config_model_schema}) + +_system_channel_config_type_model_schema = json.loads( + r"""{ + "title" : "SystemChannelConfig_type", + "type" : "string", + "default" : "system", + "enum" : [ "system" ] +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({ + "SystemChannelConfig_type": _system_channel_config_type_model_schema +}) + +_tenant_status_report_model_schema = json.loads( + r"""{ + "required" : [ "tenant" ], + "type" : "object", + "properties" : { + "tenant" : { + "title" : "Tenant", + "type" : "string" + }, + "buckets" : { + "title" : "Buckets", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/BucketConfiguration" + } + }, + "queues" : { + "title" : "Queues", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/NotificationQueueStatusReport" + } + }, + "total_size" : { + "title" : "Total Size", + "type" : "integer" + }, + "bucket_status" : { + "$ref" : "#/components/schemas/BUCKET_CREATION_STATUS" + }, + "policy_status" : { + "$ref" : "#/components/schemas/BUCKET_POLICY_STATUS" + }, + "queue_status" : { + "$ref" : "#/components/schemas/QUEUE_SETUP_STATUS" + } + }, + "description" : "Response model for a tenant status report." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"TenantStatusReport": _tenant_status_report_model_schema}) + +_vent_type_model_schema = json.loads( + r"""{ + "type" : "string", + "description" : "Supported notification change event types.", + "enum" : [ "delete", "put", "get" ] +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"VENT_TYPE": _vent_type_model_schema}) + +_validation_error_model_schema = json.loads( + r"""{ + "title" : "ValidationError", + "required" : [ "loc", "msg", "type" ], + "type" : "object", + "properties" : { + "loc" : { + "title" : "Location", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Location_inner" + } + }, + "msg" : { + "title" : "Message", + "type" : "string" + }, + "type" : { + "title" : "Error Type", + "type" : "string" + } + } +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"ValidationError": _validation_error_model_schema}) + +_web_script_channel_config_model_schema = json.loads( + r"""{ + "required" : [ "name" ], + "type" : "object", + "properties" : { + "type" : { + "$ref" : "#/components/schemas/WebScriptChannelConfig_type" + }, + "description" : { + "title" : "Description", + "type" : "string" + }, + "payload" : { + "$ref" : "#/components/schemas/PayloadConfig" + }, + "authentication" : { + "$ref" : "#/components/schemas/AuthenticationConfig" + }, + "expiry" : { + "$ref" : "#/components/schemas/Expiry" + }, + "name" : { + "title" : "Name", + "type" : "string" + }, + "version" : { + "title" : "Version", + "type" : "string" + }, + "method" : { + "allOf" : [ { + "$ref" : "#/components/schemas/HTTP_METHOD" + } ], + "default" : "POST" + } + }, + "description" : "Channel configuration for invoking a waylay webscript." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({ + "WebScriptChannelConfig": _web_script_channel_config_model_schema +}) + +_web_script_channel_config_type_model_schema = json.loads( + r"""{ + "title" : "WebScriptChannelConfig_type", + "type" : "string", + "default" : "webscript", + "enum" : [ "webscript" ] +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({ + "WebScriptChannelConfig_type": _web_script_channel_config_type_model_schema +}) diff --git a/test/types/__init__.py b/test/types/__init__.py new file mode 100644 index 0000000..57aeef8 --- /dev/null +++ b/test/types/__init__.py @@ -0,0 +1 @@ +"""Waylay Storage REST model tests.""" diff --git a/test/types/auth_stub.py b/test/types/auth_stub.py new file mode 100644 index 0000000..b35f7b6 --- /dev/null +++ b/test/types/auth_stub.py @@ -0,0 +1,53 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.auth import AUTH + + AUTHAdapter = TypeAdapter(AUTH) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +auth_model_schema = json.loads( + r"""{ + "type" : "string", + "description" : "Supported authentication methods for notifications.", + "enum" : [ "DEFAULT", "NONE", "API_KEY", "TOKEN", "WAYLAY_APP", "WAYLAY_TOKEN", "WEBSCRIPT" ] +} +""", + object_hook=with_example_provider, +) +auth_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +auth_faker = JSF(auth_model_schema, allow_none_optionals=1) + + +class AUTHStub: + """AUTH unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return auth_faker.generate() + + @classmethod + def create_instance(cls) -> "AUTH": + """Create AUTH stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return AUTHAdapter.validate_python(cls.create_json()) diff --git a/test/types/authentication_config_stub.py b/test/types/authentication_config_stub.py new file mode 100644 index 0000000..088fb9b --- /dev/null +++ b/test/types/authentication_config_stub.py @@ -0,0 +1,72 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.authentication_config import ( + AuthenticationConfig, + ) + + AuthenticationConfigAdapter = TypeAdapter(AuthenticationConfig) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +authentication_config_model_schema = json.loads( + r"""{ + "type" : "object", + "properties" : { + "method" : { + "allOf" : [ { + "$ref" : "#/components/schemas/AUTH" + } ], + "default" : "DEFAULT" + }, + "key" : { + "title" : "Key", + "type" : "string" + }, + "secret" : { + "title" : "Secret", + "type" : "string" + } + }, + "description" : "Configuration for the authentication method used when forwarding an event to a channel." +} +""", + object_hook=with_example_provider, +) +authentication_config_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +authentication_config_faker = JSF( + authentication_config_model_schema, allow_none_optionals=1 +) + + +class AuthenticationConfigStub: + """AuthenticationConfig unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return authentication_config_faker.generate() + + @classmethod + def create_instance(cls) -> "AuthenticationConfig": + """Create AuthenticationConfig stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return AuthenticationConfigAdapter.validate_python(cls.create_json()) diff --git a/test/types/bucket_configuration_stub.py b/test/types/bucket_configuration_stub.py new file mode 100644 index 0000000..ab874af --- /dev/null +++ b/test/types/bucket_configuration_stub.py @@ -0,0 +1,102 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.bucket_configuration import BucketConfiguration + + BucketConfigurationAdapter = TypeAdapter(BucketConfiguration) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +bucket_configuration_model_schema = json.loads( + r"""{ + "required" : [ "name" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "alias" : { + "title" : "Alias", + "type" : "string" + }, + "name" : { + "title" : "Name", + "type" : "string" + }, + "store" : { + "$ref" : "#/components/schemas/Store" + }, + "creation_date" : { + "title" : "Creation Date", + "type" : "string", + "format" : "date-time" + }, + "size" : { + "title" : "Size", + "type" : "integer" + }, + "status" : { + "allOf" : [ { + "$ref" : "#/components/schemas/BUCKET_CREATION_STATUS" + } ], + "default" : "unknown" + }, + "public_policy_json" : { + "title" : "Public Policy Json", + "type" : "object" + }, + "public_policy_type" : { + "title" : "Public Policy Type", + "type" : "string" + }, + "error" : { + "title" : "Error", + "type" : "string" + } + }, + "description" : "Representation of a bucket configuration." +} +""", + object_hook=with_example_provider, +) +bucket_configuration_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +bucket_configuration_faker = JSF( + bucket_configuration_model_schema, allow_none_optionals=1 +) + + +class BucketConfigurationStub: + """BucketConfiguration unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return bucket_configuration_faker.generate() + + @classmethod + def create_instance(cls) -> "BucketConfiguration": + """Create BucketConfiguration stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return BucketConfigurationAdapter.validate_python(cls.create_json()) diff --git a/test/types/bucket_listing_stub.py b/test/types/bucket_listing_stub.py new file mode 100644 index 0000000..d64c35a --- /dev/null +++ b/test/types/bucket_listing_stub.py @@ -0,0 +1,69 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.bucket_listing import BucketListing + + BucketListingAdapter = TypeAdapter(BucketListing) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +bucket_listing_model_schema = json.loads( + r"""{ + "required" : [ "buckets" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "buckets" : { + "title" : "Buckets", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Bucket" + } + } + }, + "description" : "List of Bucket representations." +} +""", + object_hook=with_example_provider, +) +bucket_listing_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +bucket_listing_faker = JSF(bucket_listing_model_schema, allow_none_optionals=1) + + +class BucketListingStub: + """BucketListing unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return bucket_listing_faker.generate() + + @classmethod + def create_instance(cls) -> "BucketListing": + """Create BucketListing stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return BucketListingAdapter.validate_python(cls.create_json()) diff --git a/test/types/bucket_object_listing_stub.py b/test/types/bucket_object_listing_stub.py new file mode 100644 index 0000000..3563f3f --- /dev/null +++ b/test/types/bucket_object_listing_stub.py @@ -0,0 +1,71 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.bucket_object_listing import BucketObjectListing + + BucketObjectListingAdapter = TypeAdapter(BucketObjectListing) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +bucket_object_listing_model_schema = json.loads( + r"""{ + "required" : [ "objects" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "objects" : { + "title" : "Objects", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/BucketObject" + } + } + }, + "description" : "List of storage object representations." +} +""", + object_hook=with_example_provider, +) +bucket_object_listing_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +bucket_object_listing_faker = JSF( + bucket_object_listing_model_schema, allow_none_optionals=1 +) + + +class BucketObjectListingStub: + """BucketObjectListing unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return bucket_object_listing_faker.generate() + + @classmethod + def create_instance(cls) -> "BucketObjectListing": + """Create BucketObjectListing stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return BucketObjectListingAdapter.validate_python(cls.create_json()) diff --git a/test/types/bucket_object_stub.py b/test/types/bucket_object_stub.py new file mode 100644 index 0000000..7f32f01 --- /dev/null +++ b/test/types/bucket_object_stub.py @@ -0,0 +1,103 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.bucket_object import BucketObject + + BucketObjectAdapter = TypeAdapter(BucketObject) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +bucket_object_model_schema = json.loads( + r"""{ + "required" : [ "bucket", "name" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "bucket" : { + "$ref" : "#/components/schemas/Bucket" + }, + "name" : { + "title" : "Name", + "type" : "string" + }, + "last_modified" : { + "title" : "Last Modified", + "type" : "string", + "format" : "date-time" + }, + "etag" : { + "title" : "Etag", + "type" : "string" + }, + "size" : { + "title" : "Size", + "type" : "integer" + }, + "content_type" : { + "title" : "Content Type", + "type" : "string" + }, + "is_dir" : { + "title" : "Is Dir", + "type" : "boolean", + "default" : false + }, + "storage_class" : { + "title" : "Storage Class", + "type" : "string" + }, + "owner_id" : { + "title" : "Owner Id", + "type" : "string" + }, + "owner_name" : { + "title" : "Owner Name", + "type" : "string" + } + }, + "description" : "Representation of a storage object." +} +""", + object_hook=with_example_provider, +) +bucket_object_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +bucket_object_faker = JSF(bucket_object_model_schema, allow_none_optionals=1) + + +class BucketObjectStub: + """BucketObject unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return bucket_object_faker.generate() + + @classmethod + def create_instance(cls) -> "BucketObject": + """Create BucketObject stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return BucketObjectAdapter.validate_python(cls.create_json()) diff --git a/test/types/bucket_stub.py b/test/types/bucket_stub.py new file mode 100644 index 0000000..d284f5a --- /dev/null +++ b/test/types/bucket_stub.py @@ -0,0 +1,82 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.bucket import Bucket + + BucketAdapter = TypeAdapter(Bucket) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +bucket_model_schema = json.loads( + r"""{ + "required" : [ "name" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "alias" : { + "title" : "Alias", + "type" : "string" + }, + "name" : { + "title" : "Name", + "type" : "string" + }, + "store" : { + "$ref" : "#/components/schemas/Store" + }, + "creation_date" : { + "title" : "Creation Date", + "type" : "string", + "format" : "date-time" + }, + "size" : { + "title" : "Size", + "type" : "integer" + } + }, + "description" : "Representation of a storage bucket." +} +""", + object_hook=with_example_provider, +) +bucket_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +bucket_faker = JSF(bucket_model_schema, allow_none_optionals=1) + + +class BucketStub: + """Bucket unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return bucket_faker.generate() + + @classmethod + def create_instance(cls) -> "Bucket": + """Create Bucket stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return BucketAdapter.validate_python(cls.create_json()) diff --git a/test/types/bucketcreationstatus_stub.py b/test/types/bucketcreationstatus_stub.py new file mode 100644 index 0000000..d0e74d2 --- /dev/null +++ b/test/types/bucketcreationstatus_stub.py @@ -0,0 +1,55 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.bucketcreationstatus import BUCKETCREATIONSTATUS + + BUCKETCREATIONSTATUSAdapter = TypeAdapter(BUCKETCREATIONSTATUS) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +bucket_creation_status_model_schema = json.loads( + r"""{ + "type" : "string", + "description" : "Possbile bucket creation status codes.", + "enum" : [ "unknown", "missing", "invalid", "up_to_date" ] +} +""", + object_hook=with_example_provider, +) +bucket_creation_status_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +bucket_creation_status_faker = JSF( + bucket_creation_status_model_schema, allow_none_optionals=1 +) + + +class BUCKETCREATIONSTATUSStub: + """BUCKETCREATIONSTATUS unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return bucket_creation_status_faker.generate() + + @classmethod + def create_instance(cls) -> "BUCKETCREATIONSTATUS": + """Create BUCKETCREATIONSTATUS stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return BUCKETCREATIONSTATUSAdapter.validate_python(cls.create_json()) diff --git a/test/types/bucketpolicystatus_stub.py b/test/types/bucketpolicystatus_stub.py new file mode 100644 index 0000000..ddf78d5 --- /dev/null +++ b/test/types/bucketpolicystatus_stub.py @@ -0,0 +1,55 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.bucketpolicystatus import BUCKETPOLICYSTATUS + + BUCKETPOLICYSTATUSAdapter = TypeAdapter(BUCKETPOLICYSTATUS) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +bucket_policy_status_model_schema = json.loads( + r"""{ + "type" : "string", + "description" : "Possible bucket policy status codes.", + "enum" : [ "unknown", "missing", "out_dated", "up_to_date" ] +} +""", + object_hook=with_example_provider, +) +bucket_policy_status_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +bucket_policy_status_faker = JSF( + bucket_policy_status_model_schema, allow_none_optionals=1 +) + + +class BUCKETPOLICYSTATUSStub: + """BUCKETPOLICYSTATUS unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return bucket_policy_status_faker.generate() + + @classmethod + def create_instance(cls) -> "BUCKETPOLICYSTATUS": + """Create BUCKETPOLICYSTATUS stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return BUCKETPOLICYSTATUSAdapter.validate_python(cls.create_json()) diff --git a/test/types/channel_stub.py b/test/types/channel_stub.py new file mode 100644 index 0000000..e832079 --- /dev/null +++ b/test/types/channel_stub.py @@ -0,0 +1,56 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.channel import Channel + + ChannelAdapter = TypeAdapter(Channel) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +channel_model_schema = json.loads( + r"""{ + "title" : "Channel", + "anyOf" : [ { + "$ref" : "#/components/schemas/WebScriptChannelConfig" + }, { + "$ref" : "#/components/schemas/SystemChannelConfig" + } ] +} +""", + object_hook=with_example_provider, +) +channel_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +channel_faker = JSF(channel_model_schema, allow_none_optionals=1) + + +class ChannelStub: + """Channel unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return channel_faker.generate() + + @classmethod + def create_instance(cls) -> "Channel": + """Create Channel stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return ChannelAdapter.validate_python(cls.create_json()) diff --git a/test/types/channeltype_stub.py b/test/types/channeltype_stub.py new file mode 100644 index 0000000..b4a063d --- /dev/null +++ b/test/types/channeltype_stub.py @@ -0,0 +1,53 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.channeltype import CHANNELTYPE + + CHANNELTYPEAdapter = TypeAdapter(CHANNELTYPE) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +channel_type_model_schema = json.loads( + r"""{ + "type" : "string", + "description" : "Supported notification channel types.", + "enum" : [ "webhook", "webscript", "system" ] +} +""", + object_hook=with_example_provider, +) +channel_type_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +channel_type_faker = JSF(channel_type_model_schema, allow_none_optionals=1) + + +class CHANNELTYPEStub: + """CHANNELTYPE unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return channel_type_faker.generate() + + @classmethod + def create_instance(cls) -> "CHANNELTYPE": + """Create CHANNELTYPE stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return CHANNELTYPEAdapter.validate_python(cls.create_json()) diff --git a/test/types/event_filter_stub.py b/test/types/event_filter_stub.py new file mode 100644 index 0000000..0c65910 --- /dev/null +++ b/test/types/event_filter_stub.py @@ -0,0 +1,78 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.event_filter import EventFilter + + EventFilterAdapter = TypeAdapter(EventFilter) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +event_filter_model_schema = json.loads( + r"""{ + "type" : "object", + "properties" : { + "prefix" : { + "title" : "Prefix", + "type" : "string" + }, + "suffix" : { + "title" : "Suffix", + "type" : "string" + }, + "events" : { + "uniqueItems" : true, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/VENT_TYPE" + }, + "default" : [ "put" ] + }, + "description" : { + "title" : "Description", + "type" : "string" + }, + "queue" : { + "title" : "Queue", + "type" : "string" + } + }, + "description" : "Filter on change events in a storage backend.\n\nThe `prefix` and `suffix` properties are conditions on the object path\n(not including the bucket name). When not specified, all paths in the bucket will selected.\n\nThe `events` property can contain `put` and/or `delete` values, corresponding\nto create/update and deletion events.\nWhen not specified, only the create/update events are filtered." +} +""", + object_hook=with_example_provider, +) +event_filter_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +event_filter_faker = JSF(event_filter_model_schema, allow_none_optionals=1) + + +class EventFilterStub: + """EventFilter unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return event_filter_faker.generate() + + @classmethod + def create_instance(cls) -> "EventFilter": + """Create EventFilter stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return EventFilterAdapter.validate_python(cls.create_json()) diff --git a/test/types/expiry_stub.py b/test/types/expiry_stub.py new file mode 100644 index 0000000..085b727 --- /dev/null +++ b/test/types/expiry_stub.py @@ -0,0 +1,66 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.expiry import Expiry + + ExpiryAdapter = TypeAdapter(Expiry) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +expiry_model_schema = json.loads( + r"""{ + "type" : "object", + "properties" : { + "seconds" : { + "title" : "Seconds", + "type" : "integer" + }, + "hours" : { + "title" : "Hours", + "type" : "integer" + }, + "days" : { + "title" : "Days", + "type" : "integer" + } + }, + "description" : "Input model for expiry parameters." +} +""", + object_hook=with_example_provider, +) +expiry_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +expiry_faker = JSF(expiry_model_schema, allow_none_optionals=1) + + +class ExpiryStub: + """Expiry unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return expiry_faker.generate() + + @classmethod + def create_instance(cls) -> "Expiry": + """Create Expiry stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return ExpiryAdapter.validate_python(cls.create_json()) diff --git a/test/types/hal_entity_stub.py b/test/types/hal_entity_stub.py new file mode 100644 index 0000000..ed0d2a7 --- /dev/null +++ b/test/types/hal_entity_stub.py @@ -0,0 +1,61 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.hal_entity import HALEntity + + HALEntityAdapter = TypeAdapter(HALEntity) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +hal_entity_model_schema = json.loads( + r"""{ + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + } + }, + "description" : "Output model representing a collection of HAL links." +} +""", + object_hook=with_example_provider, +) +hal_entity_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +hal_entity_faker = JSF(hal_entity_model_schema, allow_none_optionals=1) + + +class HALEntityStub: + """HALEntity unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return hal_entity_faker.generate() + + @classmethod + def create_instance(cls) -> "HALEntity": + """Create HALEntity stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return HALEntityAdapter.validate_python(cls.create_json()) diff --git a/test/types/hal_link_stub.py b/test/types/hal_link_stub.py new file mode 100644 index 0000000..2e03e7f --- /dev/null +++ b/test/types/hal_link_stub.py @@ -0,0 +1,67 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.hal_link import HALLink + + HALLinkAdapter = TypeAdapter(HALLink) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +hal_link_model_schema = json.loads( + r"""{ + "required" : [ "href" ], + "type" : "object", + "properties" : { + "href" : { + "title" : "Href", + "type" : "string" + }, + "method" : { + "title" : "Method", + "type" : "string" + }, + "form_data" : { + "title" : "Form Data", + "type" : "object" + } + }, + "description" : "Represents a HAL link." +} +""", + object_hook=with_example_provider, +) +hal_link_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +hal_link_faker = JSF(hal_link_model_schema, allow_none_optionals=1) + + +class HALLinkStub: + """HALLink unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return hal_link_faker.generate() + + @classmethod + def create_instance(cls) -> "HALLink": + """Create HALLink stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return HALLinkAdapter.validate_python(cls.create_json()) diff --git a/test/types/http_validation_error_stub.py b/test/types/http_validation_error_stub.py new file mode 100644 index 0000000..473a488 --- /dev/null +++ b/test/types/http_validation_error_stub.py @@ -0,0 +1,62 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.http_validation_error import HTTPValidationError + + HTTPValidationErrorAdapter = TypeAdapter(HTTPValidationError) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +http_validation_error_model_schema = json.loads( + r"""{ + "type" : "object", + "properties" : { + "detail" : { + "title" : "Detail", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ValidationError" + } + } + } +} +""", + object_hook=with_example_provider, +) +http_validation_error_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +http_validation_error_faker = JSF( + http_validation_error_model_schema, allow_none_optionals=1 +) + + +class HTTPValidationErrorStub: + """HTTPValidationError unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return http_validation_error_faker.generate() + + @classmethod + def create_instance(cls) -> "HTTPValidationError": + """Create HTTPValidationError stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return HTTPValidationErrorAdapter.validate_python(cls.create_json()) diff --git a/test/types/httpmethod_stub.py b/test/types/httpmethod_stub.py new file mode 100644 index 0000000..b710e35 --- /dev/null +++ b/test/types/httpmethod_stub.py @@ -0,0 +1,53 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.httpmethod import HTTPMETHOD + + HTTPMETHODAdapter = TypeAdapter(HTTPMETHOD) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +http_method_model_schema = json.loads( + r"""{ + "type" : "string", + "description" : "Supported notification methods.", + "enum" : [ "GET", "PUT", "POST" ] +} +""", + object_hook=with_example_provider, +) +http_method_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +http_method_faker = JSF(http_method_model_schema, allow_none_optionals=1) + + +class HTTPMETHODStub: + """HTTPMETHOD unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return http_method_faker.generate() + + @classmethod + def create_instance(cls) -> "HTTPMETHOD": + """Create HTTPMETHOD stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return HTTPMETHODAdapter.validate_python(cls.create_json()) diff --git a/test/types/links_stub.py b/test/types/links_stub.py new file mode 100644 index 0000000..9762dd0 --- /dev/null +++ b/test/types/links_stub.py @@ -0,0 +1,59 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.links import Links + + LinksAdapter = TypeAdapter(Links) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +links_model_schema = json.loads( + r"""{ + "title" : "_Links", + "anyOf" : [ { + "$ref" : "#/components/schemas/HALLink" + }, { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/HALLink" + } + } ] +} +""", + object_hook=with_example_provider, +) +links_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +links_faker = JSF(links_model_schema, allow_none_optionals=1) + + +class LinksStub: + """Links unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return links_faker.generate() + + @classmethod + def create_instance(cls) -> "Links": + """Create Links stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return LinksAdapter.validate_python(cls.create_json()) diff --git a/test/types/location_inner_stub.py b/test/types/location_inner_stub.py new file mode 100644 index 0000000..c44a418 --- /dev/null +++ b/test/types/location_inner_stub.py @@ -0,0 +1,56 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.location_inner import LocationInner + + LocationInnerAdapter = TypeAdapter(LocationInner) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +location_inner_model_schema = json.loads( + r"""{ + "title" : "Location_inner", + "anyOf" : [ { + "type" : "string" + }, { + "type" : "integer" + } ] +} +""", + object_hook=with_example_provider, +) +location_inner_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +location_inner_faker = JSF(location_inner_model_schema, allow_none_optionals=1) + + +class LocationInnerStub: + """LocationInner unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return location_inner_faker.generate() + + @classmethod + def create_instance(cls) -> "LocationInner": + """Create LocationInner stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return LocationInnerAdapter.validate_python(cls.create_json()) diff --git a/test/types/notification_queue_status_report_stub.py b/test/types/notification_queue_status_report_stub.py new file mode 100644 index 0000000..c8c8fb6 --- /dev/null +++ b/test/types/notification_queue_status_report_stub.py @@ -0,0 +1,77 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.notification_queue_status_report import ( + NotificationQueueStatusReport, + ) + + NotificationQueueStatusReportAdapter = TypeAdapter(NotificationQueueStatusReport) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +notification_queue_status_report_model_schema = json.loads( + r"""{ + "required" : [ "notification_queues", "store" ], + "type" : "object", + "properties" : { + "store" : { + "title" : "Store", + "type" : "string" + }, + "notification_queues" : { + "title" : "Notification Queues", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/NotificationQueueStatus" + } + }, + "messages" : { + "title" : "Messages", + "type" : "array", + "items" : { + "type" : "object" + } + } + }, + "description" : "Response model for a notification queue status report." +} +""", + object_hook=with_example_provider, +) +notification_queue_status_report_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +notification_queue_status_report_faker = JSF( + notification_queue_status_report_model_schema, allow_none_optionals=1 +) + + +class NotificationQueueStatusReportStub: + """NotificationQueueStatusReport unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return notification_queue_status_report_faker.generate() + + @classmethod + def create_instance(cls) -> "NotificationQueueStatusReport": + """Create NotificationQueueStatusReport stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return NotificationQueueStatusReportAdapter.validate_python(cls.create_json()) diff --git a/test/types/notification_queue_status_stub.py b/test/types/notification_queue_status_stub.py new file mode 100644 index 0000000..205b64f --- /dev/null +++ b/test/types/notification_queue_status_stub.py @@ -0,0 +1,82 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.notification_queue_status import ( + NotificationQueueStatus, + ) + + NotificationQueueStatusAdapter = TypeAdapter(NotificationQueueStatus) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +notification_queue_status_model_schema = json.loads( + r"""{ + "required" : [ "method", "name", "status" ], + "type" : "object", + "properties" : { + "status" : { + "$ref" : "#/components/schemas/QUEUE_SETUP_STATUS" + }, + "name" : { + "title" : "Name", + "type" : "string" + }, + "method" : { + "title" : "Method", + "type" : "string" + }, + "configured_parameters" : { + "title" : "Configured Parameters", + "type" : "object" + }, + "actual_parameters" : { + "title" : "Actual Parameters", + "type" : "object" + }, + "error" : { + "title" : "Error", + "type" : "string" + } + }, + "description" : "Response model for the notification queue configuration." +} +""", + object_hook=with_example_provider, +) +notification_queue_status_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +notification_queue_status_faker = JSF( + notification_queue_status_model_schema, allow_none_optionals=1 +) + + +class NotificationQueueStatusStub: + """NotificationQueueStatus unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return notification_queue_status_faker.generate() + + @classmethod + def create_instance(cls) -> "NotificationQueueStatus": + """Create NotificationQueueStatus stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return NotificationQueueStatusAdapter.validate_python(cls.create_json()) diff --git a/test/types/payload_config_stub.py b/test/types/payload_config_stub.py new file mode 100644 index 0000000..3f8188d --- /dev/null +++ b/test/types/payload_config_stub.py @@ -0,0 +1,63 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.payload_config import PayloadConfig + + PayloadConfigAdapter = TypeAdapter(PayloadConfig) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +payload_config_model_schema = json.loads( + r"""{ + "type" : "object", + "properties" : { + "signed_links" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/SIGN" + } + }, + "reference" : { + "title" : "Reference" + } + }, + "description" : "Configuration object that specifies the expected notification payload." +} +""", + object_hook=with_example_provider, +) +payload_config_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +payload_config_faker = JSF(payload_config_model_schema, allow_none_optionals=1) + + +class PayloadConfigStub: + """PayloadConfig unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return payload_config_faker.generate() + + @classmethod + def create_instance(cls) -> "PayloadConfig": + """Create PayloadConfig stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return PayloadConfigAdapter.validate_python(cls.create_json()) diff --git a/test/types/queuesetupstatus_stub.py b/test/types/queuesetupstatus_stub.py new file mode 100644 index 0000000..e8c58d6 --- /dev/null +++ b/test/types/queuesetupstatus_stub.py @@ -0,0 +1,54 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.queuesetupstatus import QUEUESETUPSTATUS + + QUEUESETUPSTATUSAdapter = TypeAdapter(QUEUESETUPSTATUS) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +queue_setup_status_model_schema = json.loads( + r"""{ + "title" : "QUEUE_SETUP_STATUS", + "type" : "string", + "description" : "Possbile queue setup status codes.", + "enum" : [ "unknown", "missing", "invalid", "not_specified", "up_to_date" ] +} +""", + object_hook=with_example_provider, +) +queue_setup_status_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +queue_setup_status_faker = JSF(queue_setup_status_model_schema, allow_none_optionals=1) + + +class QUEUESETUPSTATUSStub: + """QUEUESETUPSTATUS unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return queue_setup_status_faker.generate() + + @classmethod + def create_instance(cls) -> "QUEUESETUPSTATUS": + """Create QUEUESETUPSTATUS stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return QUEUESETUPSTATUSAdapter.validate_python(cls.create_json()) diff --git a/test/types/response_list_stub.py b/test/types/response_list_stub.py new file mode 100644 index 0000000..bd4b08a --- /dev/null +++ b/test/types/response_list_stub.py @@ -0,0 +1,58 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.response_list import ResponseList + + ResponseListAdapter = TypeAdapter(ResponseList) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +response_list_model_schema = json.loads( + r"""{ + "title" : "Response List", + "anyOf" : [ { + "$ref" : "#/components/schemas/BucketObjectListing" + }, { + "$ref" : "#/components/schemas/BucketObject" + }, { + "$ref" : "#/components/schemas/HALEntity" + } ] +} +""", + object_hook=with_example_provider, +) +response_list_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +response_list_faker = JSF(response_list_model_schema, allow_none_optionals=1) + + +class ResponseListStub: + """ResponseList unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return response_list_faker.generate() + + @classmethod + def create_instance(cls) -> "ResponseList": + """Create ResponseList stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return ResponseListAdapter.validate_python(cls.create_json()) diff --git a/test/types/sign_stub.py b/test/types/sign_stub.py new file mode 100644 index 0000000..8ddb353 --- /dev/null +++ b/test/types/sign_stub.py @@ -0,0 +1,54 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.sign import SIGN + + SIGNAdapter = TypeAdapter(SIGN) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +sign_model_schema = json.loads( + r"""{ + "title" : "SIGN", + "type" : "string", + "description" : "Supported `sign` url parameter values.", + "enum" : [ "GET", "PUT", "POST" ] +} +""", + object_hook=with_example_provider, +) +sign_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +sign_faker = JSF(sign_model_schema, allow_none_optionals=1) + + +class SIGNStub: + """SIGN unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return sign_faker.generate() + + @classmethod + def create_instance(cls) -> "SIGN": + """Create SIGN stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return SIGNAdapter.validate_python(cls.create_json()) diff --git a/test/types/store_stub.py b/test/types/store_stub.py new file mode 100644 index 0000000..c8f15c1 --- /dev/null +++ b/test/types/store_stub.py @@ -0,0 +1,74 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.store import Store + + StoreAdapter = TypeAdapter(Store) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +store_model_schema = json.loads( + r"""{ + "title" : "Store", + "required" : [ "name", "type", "url" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "type" : { + "$ref" : "#/components/schemas/STORE_TYPE" + }, + "name" : { + "title" : "Name", + "type" : "string" + }, + "url" : { + "title" : "Url", + "type" : "string" + } + }, + "description" : "Representation of a backend store." +} +""", + object_hook=with_example_provider, +) +store_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +store_faker = JSF(store_model_schema, allow_none_optionals=1) + + +class StoreStub: + """Store unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return store_faker.generate() + + @classmethod + def create_instance(cls) -> "Store": + """Create Store stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return StoreAdapter.validate_python(cls.create_json()) diff --git a/test/types/storetype_stub.py b/test/types/storetype_stub.py new file mode 100644 index 0000000..8beb34c --- /dev/null +++ b/test/types/storetype_stub.py @@ -0,0 +1,54 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.storetype import STORETYPE + + STORETYPEAdapter = TypeAdapter(STORETYPE) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +store_type_model_schema = json.loads( + r"""{ + "title" : "STORE_TYPE", + "type" : "string", + "description" : "Supported backend store types.", + "enum" : [ "gs", "s3", "azure" ] +} +""", + object_hook=with_example_provider, +) +store_type_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +store_type_faker = JSF(store_type_model_schema, allow_none_optionals=1) + + +class STORETYPEStub: + """STORETYPE unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return store_type_faker.generate() + + @classmethod + def create_instance(cls) -> "STORETYPE": + """Create STORETYPE stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return STORETYPEAdapter.validate_python(cls.create_json()) diff --git a/test/types/subscription_config_stub.py b/test/types/subscription_config_stub.py new file mode 100644 index 0000000..62f58a8 --- /dev/null +++ b/test/types/subscription_config_stub.py @@ -0,0 +1,86 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.subscription_config import SubscriptionConfig + + SubscriptionConfigAdapter = TypeAdapter(SubscriptionConfig) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +subscription_config_model_schema = json.loads( + r"""{ + "required" : [ "channel", "filters" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "id" : { + "title" : "Id", + "type" : "string" + }, + "title" : { + "title" : "Title", + "type" : "string" + }, + "description" : { + "title" : "Description", + "type" : "string" + }, + "channel" : { + "$ref" : "#/components/schemas/Channel" + }, + "filters" : { + "title" : "Filters", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/EventFilter" + } + } + }, + "description" : "Specification of a notification subscription that forwards to a given channel." +} +""", + object_hook=with_example_provider, +) +subscription_config_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +subscription_config_faker = JSF( + subscription_config_model_schema, allow_none_optionals=1 +) + + +class SubscriptionConfigStub: + """SubscriptionConfig unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return subscription_config_faker.generate() + + @classmethod + def create_instance(cls) -> "SubscriptionConfig": + """Create SubscriptionConfig stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return SubscriptionConfigAdapter.validate_python(cls.create_json()) diff --git a/test/types/subscriptions_listing_stub.py b/test/types/subscriptions_listing_stub.py new file mode 100644 index 0000000..0dc89bb --- /dev/null +++ b/test/types/subscriptions_listing_stub.py @@ -0,0 +1,73 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.subscriptions_listing import ( + SubscriptionsListing, + ) + + SubscriptionsListingAdapter = TypeAdapter(SubscriptionsListing) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +subscriptions_listing_model_schema = json.loads( + r"""{ + "required" : [ "buckets" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "buckets" : { + "title" : "Buckets", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Bucket" + } + } + }, + "description" : "List of buckets that support subscriptions." +} +""", + object_hook=with_example_provider, +) +subscriptions_listing_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +subscriptions_listing_faker = JSF( + subscriptions_listing_model_schema, allow_none_optionals=1 +) + + +class SubscriptionsListingStub: + """SubscriptionsListing unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return subscriptions_listing_faker.generate() + + @classmethod + def create_instance(cls) -> "SubscriptionsListing": + """Create SubscriptionsListing stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return SubscriptionsListingAdapter.validate_python(cls.create_json()) diff --git a/test/types/subscriptions_stub.py b/test/types/subscriptions_stub.py new file mode 100644 index 0000000..6af15c9 --- /dev/null +++ b/test/types/subscriptions_stub.py @@ -0,0 +1,79 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.subscriptions import Subscriptions + + SubscriptionsAdapter = TypeAdapter(Subscriptions) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +subscriptions_model_schema = json.loads( + r"""{ + "required" : [ "bucket", "subscriptions" ], + "type" : "object", + "properties" : { + "_links" : { + "title" : " Links", + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/_Links" + } + }, + "bucket" : { + "$ref" : "#/components/schemas/Bucket" + }, + "subscriptions" : { + "title" : "Subscriptions", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/SubscriptionConfig" + } + }, + "warnings" : { + "title" : "Warnings", + "type" : "array", + "items" : { + "type" : "object" + } + } + }, + "description" : "Listing object for subscriptions." +} +""", + object_hook=with_example_provider, +) +subscriptions_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +subscriptions_faker = JSF(subscriptions_model_schema, allow_none_optionals=1) + + +class SubscriptionsStub: + """Subscriptions unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return subscriptions_faker.generate() + + @classmethod + def create_instance(cls) -> "Subscriptions": + """Create Subscriptions stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return SubscriptionsAdapter.validate_python(cls.create_json()) diff --git a/test/types/system_channel_config_stub.py b/test/types/system_channel_config_stub.py new file mode 100644 index 0000000..4024ca8 --- /dev/null +++ b/test/types/system_channel_config_stub.py @@ -0,0 +1,72 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.system_channel_config import SystemChannelConfig + + SystemChannelConfigAdapter = TypeAdapter(SystemChannelConfig) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +system_channel_config_model_schema = json.loads( + r"""{ + "type" : "object", + "properties" : { + "type" : { + "$ref" : "#/components/schemas/SystemChannelConfig_type" + }, + "description" : { + "title" : "Description", + "type" : "string" + }, + "payload" : { + "$ref" : "#/components/schemas/PayloadConfig" + }, + "authentication" : { + "$ref" : "#/components/schemas/AuthenticationConfig" + }, + "expiry" : { + "$ref" : "#/components/schemas/Expiry" + } + }, + "description" : "Channel configuration for functionality that is fixed by the platform.\n\nThis cannot be selected by the end user." +} +""", + object_hook=with_example_provider, +) +system_channel_config_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +system_channel_config_faker = JSF( + system_channel_config_model_schema, allow_none_optionals=1 +) + + +class SystemChannelConfigStub: + """SystemChannelConfig unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return system_channel_config_faker.generate() + + @classmethod + def create_instance(cls) -> "SystemChannelConfig": + """Create SystemChannelConfig stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return SystemChannelConfigAdapter.validate_python(cls.create_json()) diff --git a/test/types/system_channel_config_type_stub.py b/test/types/system_channel_config_type_stub.py new file mode 100644 index 0000000..6daf217 --- /dev/null +++ b/test/types/system_channel_config_type_stub.py @@ -0,0 +1,58 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.system_channel_config_type import ( + SystemChannelConfigType, + ) + + SystemChannelConfigTypeAdapter = TypeAdapter(SystemChannelConfigType) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +system_channel_config_type_model_schema = json.loads( + r"""{ + "title" : "SystemChannelConfig_type", + "type" : "string", + "default" : "system", + "enum" : [ "system" ] +} +""", + object_hook=with_example_provider, +) +system_channel_config_type_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +system_channel_config_type_faker = JSF( + system_channel_config_type_model_schema, allow_none_optionals=1 +) + + +class SystemChannelConfigTypeStub: + """SystemChannelConfigType unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return system_channel_config_type_faker.generate() + + @classmethod + def create_instance(cls) -> "SystemChannelConfigType": + """Create SystemChannelConfigType stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return SystemChannelConfigTypeAdapter.validate_python(cls.create_json()) diff --git a/test/types/tenant_status_report_stub.py b/test/types/tenant_status_report_stub.py new file mode 100644 index 0000000..3ebea4a --- /dev/null +++ b/test/types/tenant_status_report_stub.py @@ -0,0 +1,88 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.tenant_status_report import TenantStatusReport + + TenantStatusReportAdapter = TypeAdapter(TenantStatusReport) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +tenant_status_report_model_schema = json.loads( + r"""{ + "required" : [ "tenant" ], + "type" : "object", + "properties" : { + "tenant" : { + "title" : "Tenant", + "type" : "string" + }, + "buckets" : { + "title" : "Buckets", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/BucketConfiguration" + } + }, + "queues" : { + "title" : "Queues", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/NotificationQueueStatusReport" + } + }, + "total_size" : { + "title" : "Total Size", + "type" : "integer" + }, + "bucket_status" : { + "$ref" : "#/components/schemas/BUCKET_CREATION_STATUS" + }, + "policy_status" : { + "$ref" : "#/components/schemas/BUCKET_POLICY_STATUS" + }, + "queue_status" : { + "$ref" : "#/components/schemas/QUEUE_SETUP_STATUS" + } + }, + "description" : "Response model for a tenant status report." +} +""", + object_hook=with_example_provider, +) +tenant_status_report_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +tenant_status_report_faker = JSF( + tenant_status_report_model_schema, allow_none_optionals=1 +) + + +class TenantStatusReportStub: + """TenantStatusReport unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return tenant_status_report_faker.generate() + + @classmethod + def create_instance(cls) -> "TenantStatusReport": + """Create TenantStatusReport stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return TenantStatusReportAdapter.validate_python(cls.create_json()) diff --git a/test/types/validation_error_stub.py b/test/types/validation_error_stub.py new file mode 100644 index 0000000..673a671 --- /dev/null +++ b/test/types/validation_error_stub.py @@ -0,0 +1,70 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.validation_error import ValidationError + + ValidationErrorAdapter = TypeAdapter(ValidationError) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +validation_error_model_schema = json.loads( + r"""{ + "title" : "ValidationError", + "required" : [ "loc", "msg", "type" ], + "type" : "object", + "properties" : { + "loc" : { + "title" : "Location", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Location_inner" + } + }, + "msg" : { + "title" : "Message", + "type" : "string" + }, + "type" : { + "title" : "Error Type", + "type" : "string" + } + } +} +""", + object_hook=with_example_provider, +) +validation_error_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +validation_error_faker = JSF(validation_error_model_schema, allow_none_optionals=1) + + +class ValidationErrorStub: + """ValidationError unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return validation_error_faker.generate() + + @classmethod + def create_instance(cls) -> "ValidationError": + """Create ValidationError stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return ValidationErrorAdapter.validate_python(cls.create_json()) diff --git a/test/types/venttype_stub.py b/test/types/venttype_stub.py new file mode 100644 index 0000000..2ff36ac --- /dev/null +++ b/test/types/venttype_stub.py @@ -0,0 +1,53 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.venttype import VENTTYPE + + VENTTYPEAdapter = TypeAdapter(VENTTYPE) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +vent_type_model_schema = json.loads( + r"""{ + "type" : "string", + "description" : "Supported notification change event types.", + "enum" : [ "delete", "put", "get" ] +} +""", + object_hook=with_example_provider, +) +vent_type_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +vent_type_faker = JSF(vent_type_model_schema, allow_none_optionals=1) + + +class VENTTYPEStub: + """VENTTYPE unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return vent_type_faker.generate() + + @classmethod + def create_instance(cls) -> "VENTTYPE": + """Create VENTTYPE stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return VENTTYPEAdapter.validate_python(cls.create_json()) diff --git a/test/types/web_script_channel_config_stub.py b/test/types/web_script_channel_config_stub.py new file mode 100644 index 0000000..d299368 --- /dev/null +++ b/test/types/web_script_channel_config_stub.py @@ -0,0 +1,89 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.web_script_channel_config import ( + WebScriptChannelConfig, + ) + + WebScriptChannelConfigAdapter = TypeAdapter(WebScriptChannelConfig) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +web_script_channel_config_model_schema = json.loads( + r"""{ + "required" : [ "name" ], + "type" : "object", + "properties" : { + "type" : { + "$ref" : "#/components/schemas/WebScriptChannelConfig_type" + }, + "description" : { + "title" : "Description", + "type" : "string" + }, + "payload" : { + "$ref" : "#/components/schemas/PayloadConfig" + }, + "authentication" : { + "$ref" : "#/components/schemas/AuthenticationConfig" + }, + "expiry" : { + "$ref" : "#/components/schemas/Expiry" + }, + "name" : { + "title" : "Name", + "type" : "string" + }, + "version" : { + "title" : "Version", + "type" : "string" + }, + "method" : { + "allOf" : [ { + "$ref" : "#/components/schemas/HTTP_METHOD" + } ], + "default" : "POST" + } + }, + "description" : "Channel configuration for invoking a waylay webscript." +} +""", + object_hook=with_example_provider, +) +web_script_channel_config_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +web_script_channel_config_faker = JSF( + web_script_channel_config_model_schema, allow_none_optionals=1 +) + + +class WebScriptChannelConfigStub: + """WebScriptChannelConfig unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return web_script_channel_config_faker.generate() + + @classmethod + def create_instance(cls) -> "WebScriptChannelConfig": + """Create WebScriptChannelConfig stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return WebScriptChannelConfigAdapter.validate_python(cls.create_json()) diff --git a/test/types/web_script_channel_config_type_stub.py b/test/types/web_script_channel_config_type_stub.py new file mode 100644 index 0000000..eb7e40e --- /dev/null +++ b/test/types/web_script_channel_config_type_stub.py @@ -0,0 +1,58 @@ +# coding: utf-8 +"""Waylay Storage model tests. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.storage.models.web_script_channel_config_type import ( + WebScriptChannelConfigType, + ) + + WebScriptChannelConfigTypeAdapter = TypeAdapter(WebScriptChannelConfigType) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +web_script_channel_config_type_model_schema = json.loads( + r"""{ + "title" : "WebScriptChannelConfig_type", + "type" : "string", + "default" : "webscript", + "enum" : [ "webscript" ] +} +""", + object_hook=with_example_provider, +) +web_script_channel_config_type_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +web_script_channel_config_type_faker = JSF( + web_script_channel_config_type_model_schema, allow_none_optionals=1 +) + + +class WebScriptChannelConfigTypeStub: + """WebScriptChannelConfigType unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return web_script_channel_config_type_faker.generate() + + @classmethod + def create_instance(cls) -> "WebScriptChannelConfigType": + """Create WebScriptChannelConfigType stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return WebScriptChannelConfigTypeAdapter.validate_python(cls.create_json()) diff --git a/waylay-sdk-storage-types/.openapi-generator/FILES b/waylay-sdk-storage-types/.openapi-generator/FILES new file mode 100644 index 0000000..a1f5aaf --- /dev/null +++ b/waylay-sdk-storage-types/.openapi-generator/FILES @@ -0,0 +1,48 @@ +LICENSE.txt +pyproject.toml +src/waylay/services/storage/models/__init__.py +src/waylay/services/storage/models/auth.py +src/waylay/services/storage/models/authentication_config.py +src/waylay/services/storage/models/bucket.py +src/waylay/services/storage/models/bucket_configuration.py +src/waylay/services/storage/models/bucket_listing.py +src/waylay/services/storage/models/bucket_object.py +src/waylay/services/storage/models/bucket_object_listing.py +src/waylay/services/storage/models/bucketcreationstatus.py +src/waylay/services/storage/models/bucketpolicystatus.py +src/waylay/services/storage/models/channel.py +src/waylay/services/storage/models/channeltype.py +src/waylay/services/storage/models/event_filter.py +src/waylay/services/storage/models/expiry.py +src/waylay/services/storage/models/hal_entity.py +src/waylay/services/storage/models/hal_link.py +src/waylay/services/storage/models/http_validation_error.py +src/waylay/services/storage/models/httpmethod.py +src/waylay/services/storage/models/links.py +src/waylay/services/storage/models/location_inner.py +src/waylay/services/storage/models/notification_queue_status.py +src/waylay/services/storage/models/notification_queue_status_report.py +src/waylay/services/storage/models/object.py +src/waylay/services/storage/models/payload_config.py +src/waylay/services/storage/models/py.typed +src/waylay/services/storage/models/queuesetupstatus.py +src/waylay/services/storage/models/response_list.py +src/waylay/services/storage/models/sign.py +src/waylay/services/storage/models/store.py +src/waylay/services/storage/models/storetype.py +src/waylay/services/storage/models/subscription_config.py +src/waylay/services/storage/models/subscriptions.py +src/waylay/services/storage/models/subscriptions_listing.py +src/waylay/services/storage/models/system_channel_config.py +src/waylay/services/storage/models/system_channel_config_type.py +src/waylay/services/storage/models/tenant_status_report.py +src/waylay/services/storage/models/validation_error.py +src/waylay/services/storage/models/venttype.py +src/waylay/services/storage/models/web_script_channel_config.py +src/waylay/services/storage/models/web_script_channel_config_type.py +src/waylay/services/storage/queries/__init__.py +src/waylay/services/storage/queries/about_api.py +src/waylay/services/storage/queries/bucket_api.py +src/waylay/services/storage/queries/object_api.py +src/waylay/services/storage/queries/py.typed +src/waylay/services/storage/queries/subscription_api.py diff --git a/waylay-sdk-storage-types/.openapi-generator/VERSION b/waylay-sdk-storage-types/.openapi-generator/VERSION new file mode 100644 index 0000000..4b49d9b --- /dev/null +++ b/waylay-sdk-storage-types/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.2.0 \ No newline at end of file diff --git a/waylay-sdk-storage-types/LICENSE.txt b/waylay-sdk-storage-types/LICENSE.txt new file mode 100644 index 0000000..2796771 --- /dev/null +++ b/waylay-sdk-storage-types/LICENSE.txt @@ -0,0 +1,13 @@ +ISC License (ISC) +Copyright 2024, Waylay + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, +OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/waylay-sdk-storage-types/README.md b/waylay-sdk-storage-types/README.md new file mode 100644 index 0000000..b7df080 --- /dev/null +++ b/waylay-sdk-storage-types/README.md @@ -0,0 +1,49 @@ +# Waylay Storage Service + +Manage storage buckets and subscriptions. + + +This Python package is automatically generated based on the +Waylay Storage OpenAPI specification (API version: 0.4.1) +For more information, please visit [the openapi specification](https://docs.waylay.io/openapi/public/redocly/storage.html). + +It is considered an extension of the waylay-sdk-storage package, and it consists of the typed model classes for all path params, query params, body params and responses for each of the api methods in `waylay-sdk-storage`. + +## Requirements. +This package requires Python 3.9+. + +## Installation +Typically this package is installed when installing the [waylay-sdk-core](https://pypi.org/project/waylay-sdk/) package to enable the service's functionality. +When the service api methods are required, waylay-sdk-storage is included in: +- ```pip install waylay-sdk-core[storage]``` to install `waylay-sdk-core` along with only this service, or +- ```pip install waylay-sdk-core[services]``` to install `waylay-sdk-core` along with all services. +When the typed models are required, both waylay-sdk-storage and waylay-sdk-storage-types are included in: +- ```pip install waylay-sdk-core[storage,storage-types]``` to install `waylay-sdk-core` along with only this service including the typed models, or +- ```pip install waylay-sdk-core[services,services-types]``` to install `waylay-sdk-core` along with all services along with the typed models. + +## Usage + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +try: + # Version + # calls `GET /storage/v1/` + api_response = await waylay_client.storage.about.version( + ) + print("The response of storage.about.version:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.about.version: %s\n" % e) +``` + + +For more information, please visit the [Waylay API documentation](https://docs.waylay.io/#/api/?id=software-development-kits). diff --git a/waylay-sdk-storage-types/pyproject.toml b/waylay-sdk-storage-types/pyproject.toml new file mode 100644 index 0000000..f6cd59b --- /dev/null +++ b/waylay-sdk-storage-types/pyproject.toml @@ -0,0 +1,74 @@ +[build-system] +requires = ["setuptools >= 61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "waylay-sdk-storage-types" +version = "0.4.1" +description = "Waylay Storage Types " +authors = [ + { name = "Waylay", email = "info@waylay.io"} +] +keywords = ["Waylay Storage" , "Types"] +requires-python = ">= 3.9" +dependencies = [ + "waylay-sdk-core ~= 0.2.0", + "waylay-sdk-storage == 0.4.1", + "pydantic ~= 2.6", + "typing-extensions ~= 4.10", + "eval-type-backport ~= 0.1.3; python_version < '3.10'", +] +readme = "README.md" +license={file = "LICENSE.txt"} + +[project.urls] +Homepage = "https://www.waylay.io/" +Documentation = "https://docs.waylay.io/#/api/?id=software-development-kits" +Repository = "https://github.com/waylayio/waylay-sdk-storage-py.git" +"Openapi Specification" = "https://docs.waylay.io/openapi/public/redocly/storage.html" + +[project.optional-dependencies] +dev = [ + "mypy", + "ruff", + "types-python-jose", + "types-appdirs", + "types-python-dateutil", + "pytest", + "pytest-mock", + "pytest-httpx", + "pytest-asyncio", + "starlette", + "python-multipart", + "typeguard", + "pyyaml", + "jsf >= 0.11.1", +] + + +[tool.setuptools.packages.find] +where = ["src/"] +namespaces = true + +[tool.ruff] +include = ["pyproject.toml", "src/**/*.py"] + +[tool.ruff.lint] +ignore-init-module-imports = true +# allow duplicate imports +ignore=["F811"] +# https://docs.astral.sh/ruff/rules +select= [ + "UP007", "FA102", # convert Union to | (pep-604) + "I001", "F401", # sort and remove unused imports + "PIE790", # remove unnecessary pass statements + "E303", # too many blank lines +] + +[tool.ruff.lint.per-file-ignores] +# do not touch imports here +"__init__.py" = ["F401"] +"conftest.py" = ["F401"] + +[tool.pytest.ini_options] +asyncio_mode = "auto" \ No newline at end of file diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/__init__.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/__init__.py new file mode 100644 index 0000000..a80a342 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/__init__.py @@ -0,0 +1,95 @@ +# coding: utf-8 +"""Waylay Storage: REST Models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +version: 0.4.1 + + Manage storage buckets and subscriptions. + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +__version__ = "0.4.1" + +# import models into model package +from .auth import AUTH +from .authentication_config import AuthenticationConfig +from .bucket import Bucket +from .bucket_configuration import BucketConfiguration +from .bucket_listing import BucketListing +from .bucket_object import BucketObject +from .bucket_object_listing import BucketObjectListing +from .bucketcreationstatus import BUCKETCREATIONSTATUS +from .bucketpolicystatus import BUCKETPOLICYSTATUS +from .channel import Channel +from .channeltype import CHANNELTYPE +from .event_filter import EventFilter +from .expiry import Expiry +from .hal_entity import HALEntity +from .hal_link import HALLink +from .http_validation_error import HTTPValidationError +from .httpmethod import HTTPMETHOD +from .links import Links +from .location_inner import LocationInner +from .notification_queue_status import NotificationQueueStatus +from .notification_queue_status_report import NotificationQueueStatusReport +from .payload_config import PayloadConfig +from .queuesetupstatus import QUEUESETUPSTATUS +from .response_list import ResponseList +from .sign import SIGN +from .store import Store +from .storetype import STORETYPE +from .subscription_config import SubscriptionConfig +from .subscriptions import Subscriptions +from .subscriptions_listing import SubscriptionsListing +from .system_channel_config import SystemChannelConfig +from .system_channel_config_type import SystemChannelConfigType +from .tenant_status_report import TenantStatusReport +from .validation_error import ValidationError +from .venttype import VENTTYPE +from .web_script_channel_config import WebScriptChannelConfig +from .web_script_channel_config_type import WebScriptChannelConfigType + +__all__ = [ + "__version__", + "AUTH", + "AuthenticationConfig", + "BUCKETCREATIONSTATUS", + "BUCKETPOLICYSTATUS", + "Bucket", + "BucketConfiguration", + "BucketListing", + "BucketObject", + "BucketObjectListing", + "CHANNELTYPE", + "Channel", + "EventFilter", + "Expiry", + "HALEntity", + "HALLink", + "HTTPMETHOD", + "HTTPValidationError", + "Links", + "LocationInner", + "NotificationQueueStatus", + "NotificationQueueStatusReport", + "PayloadConfig", + "QUEUESETUPSTATUS", + "ResponseList", + "SIGN", + "STORETYPE", + "Store", + "SubscriptionConfig", + "Subscriptions", + "SubscriptionsListing", + "SystemChannelConfig", + "SystemChannelConfigType", + "TenantStatusReport", + "VENTTYPE", + "ValidationError", + "WebScriptChannelConfig", + "WebScriptChannelConfigType", +] diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/auth.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/auth.py new file mode 100644 index 0000000..b47e6f9 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/auth.py @@ -0,0 +1,29 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from enum import Enum + + +class AUTH(str, Enum): + """Supported authentication methods for notifications..""" + + DEFAULT = "DEFAULT" + NONE = "NONE" + API_KEY = "API_KEY" + TOKEN = "TOKEN" + WAYLAY_APP = "WAYLAY_APP" + WAYLAY_TOKEN = "WAYLAY_TOKEN" + WEBSCRIPT = "WEBSCRIPT" + + def __str__(self) -> str: + return str(self.value) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/authentication_config.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/authentication_config.py new file mode 100644 index 0000000..52386f0 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/authentication_config.py @@ -0,0 +1,35 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from pydantic import ( + ConfigDict, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.auth import AUTH + + +class AuthenticationConfig(WaylayBaseModel): + """Configuration for the authentication method used when forwarding an event to a channel..""" + + method: AUTH | None = None + key: StrictStr | None = None + secret: StrictStr | None = None + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket.py new file mode 100644 index 0000000..36a3e9c --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket.py @@ -0,0 +1,44 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from datetime import datetime +from typing import Dict + +from pydantic import ( + ConfigDict, + Field, + StrictInt, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.links import Links +from ..models.store import Store + + +class Bucket(WaylayBaseModel): + """Representation of a storage bucket..""" + + links: Dict[str, Links] | None = Field(default=None, alias="_links") + alias: StrictStr | None = None + name: StrictStr + store: Store | None = None + creation_date: datetime | None = None + size: StrictInt | None = None + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_configuration.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_configuration.py new file mode 100644 index 0000000..c246146 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_configuration.py @@ -0,0 +1,49 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from datetime import datetime +from typing import Any, Dict + +from pydantic import ( + ConfigDict, + Field, + StrictInt, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.bucketcreationstatus import BUCKETCREATIONSTATUS +from ..models.links import Links +from ..models.store import Store + + +class BucketConfiguration(WaylayBaseModel): + """Representation of a bucket configuration..""" + + links: Dict[str, Links] | None = Field(default=None, alias="_links") + alias: StrictStr | None = None + name: StrictStr + store: Store | None = None + creation_date: datetime | None = None + size: StrictInt | None = None + status: BUCKETCREATIONSTATUS | None = None + public_policy_json: Dict[str, Any] | None = None + public_policy_type: StrictStr | None = None + error: StrictStr | None = None + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_listing.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_listing.py new file mode 100644 index 0000000..c10c953 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_listing.py @@ -0,0 +1,37 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import Dict, List + +from pydantic import ( + ConfigDict, + Field, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.bucket import Bucket +from ..models.links import Links + + +class BucketListing(WaylayBaseModel): + """List of Bucket representations..""" + + links: Dict[str, Links] | None = Field(default=None, alias="_links") + buckets: List[Bucket] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_object.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_object.py new file mode 100644 index 0000000..3ba277b --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_object.py @@ -0,0 +1,50 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from datetime import datetime +from typing import Dict + +from pydantic import ( + ConfigDict, + Field, + StrictBool, + StrictInt, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.bucket import Bucket +from ..models.links import Links + + +class BucketObject(WaylayBaseModel): + """Representation of a storage object..""" + + links: Dict[str, Links] | None = Field(default=None, alias="_links") + bucket: Bucket + name: StrictStr + last_modified: datetime | None = None + etag: StrictStr | None = None + size: StrictInt | None = None + content_type: StrictStr | None = None + is_dir: StrictBool | None = False + storage_class: StrictStr | None = None + owner_id: StrictStr | None = None + owner_name: StrictStr | None = None + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_object_listing.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_object_listing.py new file mode 100644 index 0000000..8347111 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_object_listing.py @@ -0,0 +1,37 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import Dict, List + +from pydantic import ( + ConfigDict, + Field, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.bucket_object import BucketObject +from ..models.links import Links + + +class BucketObjectListing(WaylayBaseModel): + """List of storage object representations..""" + + links: Dict[str, Links] | None = Field(default=None, alias="_links") + objects: List[BucketObject] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucketcreationstatus.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucketcreationstatus.py new file mode 100644 index 0000000..81f61b8 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucketcreationstatus.py @@ -0,0 +1,26 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from enum import Enum + + +class BUCKETCREATIONSTATUS(str, Enum): + """Possbile bucket creation status codes..""" + + UNKNOWN = "unknown" + MISSING = "missing" + INVALID = "invalid" + UP_TO_DATE = "up_to_date" + + def __str__(self) -> str: + return str(self.value) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucketpolicystatus.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucketpolicystatus.py new file mode 100644 index 0000000..118260e --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucketpolicystatus.py @@ -0,0 +1,26 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from enum import Enum + + +class BUCKETPOLICYSTATUS(str, Enum): + """Possible bucket policy status codes..""" + + UNKNOWN = "unknown" + MISSING = "missing" + OUT_DATED = "out_dated" + UP_TO_DATE = "up_to_date" + + def __str__(self) -> str: + return str(self.value) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/channel.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/channel.py new file mode 100644 index 0000000..b67a9e6 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/channel.py @@ -0,0 +1,28 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import ( + Union, +) + +from typing_extensions import ( + Annotated, # >=3.9 +) + +from ..models.system_channel_config import SystemChannelConfig +from ..models.web_script_channel_config import WebScriptChannelConfig + +Channel = Union[ + Annotated[WebScriptChannelConfig, ""], Annotated[SystemChannelConfig, ""] +] +"""Channel.""" diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/channeltype.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/channeltype.py new file mode 100644 index 0000000..5db9bdc --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/channeltype.py @@ -0,0 +1,25 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from enum import Enum + + +class CHANNELTYPE(str, Enum): + """Supported notification channel types..""" + + WEBHOOK = "webhook" + WEBSCRIPT = "webscript" + SYSTEM = "system" + + def __str__(self) -> str: + return str(self.value) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/event_filter.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/event_filter.py new file mode 100644 index 0000000..e644d7c --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/event_filter.py @@ -0,0 +1,39 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import List + +from pydantic import ( + ConfigDict, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.venttype import VENTTYPE + + +class EventFilter(WaylayBaseModel): + """Filter on change events in a storage backend. The `prefix` and `suffix` properties are conditions on the object path (not including the bucket name). When not specified, all paths in the bucket will selected. The `events` property can contain `put` and/or `delete` values, corresponding to create/update and deletion events. When not specified, only the create/update events are filtered..""" + + prefix: StrictStr | None = None + suffix: StrictStr | None = None + events: List[VENTTYPE] | None = None + description: StrictStr | None = None + queue: StrictStr | None = None + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/expiry.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/expiry.py new file mode 100644 index 0000000..2cd0b8f --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/expiry.py @@ -0,0 +1,33 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from pydantic import ( + ConfigDict, + StrictInt, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + + +class Expiry(WaylayBaseModel): + """Input model for expiry parameters..""" + + seconds: StrictInt | None = None + hours: StrictInt | None = None + days: StrictInt | None = None + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/hal_entity.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/hal_entity.py new file mode 100644 index 0000000..e6bc22a --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/hal_entity.py @@ -0,0 +1,35 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import Dict + +from pydantic import ( + ConfigDict, + Field, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.links import Links + + +class HALEntity(WaylayBaseModel): + """Output model representing a collection of HAL links..""" + + links: Dict[str, Links] | None = Field(default=None, alias="_links") + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/hal_link.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/hal_link.py new file mode 100644 index 0000000..49520e7 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/hal_link.py @@ -0,0 +1,35 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import Any, Dict + +from pydantic import ( + ConfigDict, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + + +class HALLink(WaylayBaseModel): + """Represents a HAL link..""" + + href: StrictStr + method: StrictStr | None = None + form_data: Dict[str, Any] | None = None + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/http_validation_error.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/http_validation_error.py new file mode 100644 index 0000000..626469d --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/http_validation_error.py @@ -0,0 +1,34 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import List + +from pydantic import ( + ConfigDict, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.validation_error import ValidationError + + +class HTTPValidationError(WaylayBaseModel): + """HTTPValidationError.""" + + detail: List[ValidationError] | None = None + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/httpmethod.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/httpmethod.py new file mode 100644 index 0000000..afb1e1f --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/httpmethod.py @@ -0,0 +1,25 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from enum import Enum + + +class HTTPMETHOD(str, Enum): + """Supported notification methods..""" + + GET = "GET" + PUT = "PUT" + POST = "POST" + + def __str__(self) -> str: + return str(self.value) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/links.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/links.py new file mode 100644 index 0000000..eb7ea56 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/links.py @@ -0,0 +1,26 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import ( + List, + Union, +) + +from typing_extensions import ( + Annotated, # >=3.9 +) + +from ..models.hal_link import HALLink + +Links = Union[Annotated[HALLink, ""], Annotated[List[HALLink], ""]] +"""Links.""" diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/location_inner.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/location_inner.py new file mode 100644 index 0000000..1ac9922 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/location_inner.py @@ -0,0 +1,23 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import ( + Union, +) + +from typing_extensions import ( + Annotated, # >=3.9 +) + +LocationInner = Union[Annotated[str, ""], Annotated[int, ""]] +"""LocationInner.""" diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/notification_queue_status.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/notification_queue_status.py new file mode 100644 index 0000000..41b0568 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/notification_queue_status.py @@ -0,0 +1,40 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import Any, Dict + +from pydantic import ( + ConfigDict, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.queuesetupstatus import QUEUESETUPSTATUS + + +class NotificationQueueStatus(WaylayBaseModel): + """Response model for the notification queue configuration..""" + + status: QUEUESETUPSTATUS + name: StrictStr + method: StrictStr + configured_parameters: Dict[str, Any] | None = None + actual_parameters: Dict[str, Any] | None = None + error: StrictStr | None = None + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/notification_queue_status_report.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/notification_queue_status_report.py new file mode 100644 index 0000000..1e0cc4b --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/notification_queue_status_report.py @@ -0,0 +1,37 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import Any, Dict, List + +from pydantic import ( + ConfigDict, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.notification_queue_status import NotificationQueueStatus + + +class NotificationQueueStatusReport(WaylayBaseModel): + """Response model for a notification queue status report..""" + + store: StrictStr + notification_queues: List[NotificationQueueStatus] + messages: List[Dict[str, Any]] | None = None + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/object.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/object.py new file mode 100644 index 0000000..6cbd270 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/object.py @@ -0,0 +1,4 @@ +# workaround definition to resolve the import +# from ..models.object import object +# generated by `vendorExtensions.x-py-model-imports` +object = object diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/payload_config.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/payload_config.py new file mode 100644 index 0000000..623650d --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/payload_config.py @@ -0,0 +1,35 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import Any, List + +from pydantic import ( + ConfigDict, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.sign import SIGN + + +class PayloadConfig(WaylayBaseModel): + """Configuration object that specifies the expected notification payload..""" + + signed_links: List[SIGN] | None = None + reference: Any | None = None + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/py.typed b/waylay-sdk-storage-types/src/waylay/services/storage/models/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/queuesetupstatus.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/queuesetupstatus.py new file mode 100644 index 0000000..e227997 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/queuesetupstatus.py @@ -0,0 +1,27 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from enum import Enum + + +class QUEUESETUPSTATUS(str, Enum): + """Possbile queue setup status codes..""" + + UNKNOWN = "unknown" + MISSING = "missing" + INVALID = "invalid" + NOT_SPECIFIED = "not_specified" + UP_TO_DATE = "up_to_date" + + def __str__(self) -> str: + return str(self.value) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/response_list.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/response_list.py new file mode 100644 index 0000000..3de5eb9 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/response_list.py @@ -0,0 +1,31 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import ( + Union, +) + +from typing_extensions import ( + Annotated, # >=3.9 +) + +from ..models.bucket_object import BucketObject +from ..models.bucket_object_listing import BucketObjectListing +from ..models.hal_entity import HALEntity + +ResponseList = Union[ + Annotated[BucketObjectListing, ""], + Annotated[BucketObject, ""], + Annotated[HALEntity, ""], +] +"""ResponseList.""" diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/sign.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/sign.py new file mode 100644 index 0000000..8bfae8f --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/sign.py @@ -0,0 +1,25 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from enum import Enum + + +class SIGN(str, Enum): + """Supported `sign` url parameter values..""" + + GET = "GET" + PUT = "PUT" + POST = "POST" + + def __str__(self) -> str: + return str(self.value) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/store.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/store.py new file mode 100644 index 0000000..843d931 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/store.py @@ -0,0 +1,40 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import Dict + +from pydantic import ( + ConfigDict, + Field, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.links import Links +from ..models.storetype import STORETYPE + + +class Store(WaylayBaseModel): + """Representation of a backend store..""" + + links: Dict[str, Links] | None = Field(default=None, alias="_links") + type: STORETYPE + name: StrictStr + url: StrictStr + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/storetype.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/storetype.py new file mode 100644 index 0000000..1d6bbe2 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/storetype.py @@ -0,0 +1,25 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from enum import Enum + + +class STORETYPE(str, Enum): + """Supported backend store types..""" + + GS = "gs" + S3 = "s3" + AZURE = "azure" + + def __str__(self) -> str: + return str(self.value) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/subscription_config.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/subscription_config.py new file mode 100644 index 0000000..1c7af59 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/subscription_config.py @@ -0,0 +1,43 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import Dict, List + +from pydantic import ( + ConfigDict, + Field, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.channel import Channel +from ..models.event_filter import EventFilter +from ..models.links import Links + + +class SubscriptionConfig(WaylayBaseModel): + """Specification of a notification subscription that forwards to a given channel..""" + + links: Dict[str, Links] | None = Field(default=None, alias="_links") + id: StrictStr | None = None + title: StrictStr | None = None + description: StrictStr | None = None + channel: Channel + filters: List[EventFilter] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/subscriptions.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/subscriptions.py new file mode 100644 index 0000000..b13312f --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/subscriptions.py @@ -0,0 +1,40 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import Any, Dict, List + +from pydantic import ( + ConfigDict, + Field, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.bucket import Bucket +from ..models.links import Links +from ..models.subscription_config import SubscriptionConfig + + +class Subscriptions(WaylayBaseModel): + """Listing object for subscriptions..""" + + links: Dict[str, Links] | None = Field(default=None, alias="_links") + bucket: Bucket + subscriptions: List[SubscriptionConfig] + warnings: List[Dict[str, Any]] | None = None + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/subscriptions_listing.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/subscriptions_listing.py new file mode 100644 index 0000000..5c4e26e --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/subscriptions_listing.py @@ -0,0 +1,37 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import Dict, List + +from pydantic import ( + ConfigDict, + Field, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.bucket import Bucket +from ..models.links import Links + + +class SubscriptionsListing(WaylayBaseModel): + """List of buckets that support subscriptions..""" + + links: Dict[str, Links] | None = Field(default=None, alias="_links") + buckets: List[Bucket] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/system_channel_config.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/system_channel_config.py new file mode 100644 index 0000000..6356916 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/system_channel_config.py @@ -0,0 +1,40 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from pydantic import ( + ConfigDict, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.authentication_config import AuthenticationConfig +from ..models.expiry import Expiry +from ..models.payload_config import PayloadConfig +from ..models.system_channel_config_type import SystemChannelConfigType + + +class SystemChannelConfig(WaylayBaseModel): + """Channel configuration for functionality that is fixed by the platform. This cannot be selected by the end user..""" + + type: SystemChannelConfigType | None = None + description: StrictStr | None = None + payload: PayloadConfig | None = None + authentication: AuthenticationConfig | None = None + expiry: Expiry | None = None + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/system_channel_config_type.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/system_channel_config_type.py new file mode 100644 index 0000000..51430f3 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/system_channel_config_type.py @@ -0,0 +1,23 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from enum import Enum + + +class SystemChannelConfigType(str, Enum): + """SystemChannelConfigType.""" + + SYSTEM = "system" + + def __str__(self) -> str: + return str(self.value) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/tenant_status_report.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/tenant_status_report.py new file mode 100644 index 0000000..0740dfb --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/tenant_status_report.py @@ -0,0 +1,46 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import List + +from pydantic import ( + ConfigDict, + StrictInt, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.bucket_configuration import BucketConfiguration +from ..models.bucketcreationstatus import BUCKETCREATIONSTATUS +from ..models.bucketpolicystatus import BUCKETPOLICYSTATUS +from ..models.notification_queue_status_report import NotificationQueueStatusReport +from ..models.queuesetupstatus import QUEUESETUPSTATUS + + +class TenantStatusReport(WaylayBaseModel): + """Response model for a tenant status report..""" + + tenant: StrictStr + buckets: List[BucketConfiguration] | None = None + queues: List[NotificationQueueStatusReport] | None = None + total_size: StrictInt | None = None + bucket_status: BUCKETCREATIONSTATUS | None = None + policy_status: BUCKETPOLICYSTATUS | None = None + queue_status: QUEUESETUPSTATUS | None = None + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/validation_error.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/validation_error.py new file mode 100644 index 0000000..1c27c20 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/validation_error.py @@ -0,0 +1,37 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from typing import List + +from pydantic import ( + ConfigDict, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.location_inner import LocationInner + + +class ValidationError(WaylayBaseModel): + """ValidationError.""" + + loc: List[LocationInner] + msg: StrictStr + type: StrictStr + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/venttype.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/venttype.py new file mode 100644 index 0000000..f3ea98b --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/venttype.py @@ -0,0 +1,25 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from enum import Enum + + +class VENTTYPE(str, Enum): + """Supported notification change event types..""" + + DELETE = "delete" + PUT = "put" + GET = "get" + + def __str__(self) -> str: + return str(self.value) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/web_script_channel_config.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/web_script_channel_config.py new file mode 100644 index 0000000..ff57748 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/web_script_channel_config.py @@ -0,0 +1,44 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from pydantic import ( + ConfigDict, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.authentication_config import AuthenticationConfig +from ..models.expiry import Expiry +from ..models.httpmethod import HTTPMETHOD +from ..models.payload_config import PayloadConfig +from ..models.web_script_channel_config_type import WebScriptChannelConfigType + + +class WebScriptChannelConfig(WaylayBaseModel): + """Channel configuration for invoking a waylay webscript..""" + + type: WebScriptChannelConfigType | None = None + description: StrictStr | None = None + payload: PayloadConfig | None = None + authentication: AuthenticationConfig | None = None + expiry: Expiry | None = None + name: StrictStr + version: StrictStr | None = None + method: HTTPMETHOD | None = None + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/web_script_channel_config_type.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/web_script_channel_config_type.py new file mode 100644 index 0000000..1d34150 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/web_script_channel_config_type.py @@ -0,0 +1,23 @@ +# coding: utf-8 +"""Waylay Storage models. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from enum import Enum + + +class WebScriptChannelConfigType(str, Enum): + """WebScriptChannelConfigType.""" + + WEBSCRIPT = "webscript" + + def __str__(self) -> str: + return str(self.value) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/queries/__init__.py b/waylay-sdk-storage-types/src/waylay/services/storage/queries/__init__.py new file mode 100644 index 0000000..42a20ff --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/queries/__init__.py @@ -0,0 +1,13 @@ +# coding: utf-8 +"""Waylay Storage: Query Parameters. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +version: 0.4.1 + + Manage storage buckets and subscriptions. + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/queries/about_api.py b/waylay-sdk-storage-types/src/waylay/services/storage/queries/about_api.py new file mode 100644 index 0000000..8571499 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/queries/about_api.py @@ -0,0 +1,63 @@ +# coding: utf-8 +"""Waylay Storage query parameters. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +from __future__ import annotations # for Python 3.7–3.9 + +from pydantic import ( + ConfigDict, + StrictBool, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + + +def _status_query_alias_for(field_name: str) -> str: + if field_name == "store": + return "store" + if field_name == "include_buckets": + return "include_buckets" + if field_name == "include_queues": + return "include_queues" + if field_name == "include_disk_usage": + return "include_disk_usage" + return field_name + + +class StatusQuery(WaylayBaseModel): + """Model for `status` query parameters.""" + + store: StrictStr | None = None + include_buckets: StrictBool | None = None + include_queues: StrictBool | None = None + include_disk_usage: StrictBool | None = None + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + extra="allow", + alias_generator=_status_query_alias_for, + populate_by_name=True, + ) + + +def _version_query_alias_for(field_name: str) -> str: + return field_name + + +class VersionQuery(WaylayBaseModel): + """Model for `version` query parameters.""" + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + extra="allow", + alias_generator=_version_query_alias_for, + populate_by_name=True, + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/queries/bucket_api.py b/waylay-sdk-storage-types/src/waylay/services/storage/queries/bucket_api.py new file mode 100644 index 0000000..7aaee45 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/queries/bucket_api.py @@ -0,0 +1,57 @@ +# coding: utf-8 +"""Waylay Storage query parameters. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +from __future__ import annotations # for Python 3.7–3.9 + +from pydantic import ( + ConfigDict, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + + +def _get_query_alias_for(field_name: str) -> str: + if field_name == "store": + return "store" + return field_name + + +class GetQuery(WaylayBaseModel): + """Model for `get` query parameters.""" + + store: StrictStr | None = None + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + extra="allow", + alias_generator=_get_query_alias_for, + populate_by_name=True, + ) + + +def _list_query_alias_for(field_name: str) -> str: + if field_name == "store": + return "store" + return field_name + + +class ListQuery(WaylayBaseModel): + """Model for `list` query parameters.""" + + store: StrictStr | None = None + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + extra="allow", + alias_generator=_list_query_alias_for, + populate_by_name=True, + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/queries/object_api.py b/waylay-sdk-storage-types/src/waylay/services/storage/queries/object_api.py new file mode 100644 index 0000000..de83c42 --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/queries/object_api.py @@ -0,0 +1,162 @@ +# coding: utf-8 +"""Waylay Storage query parameters. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +from __future__ import annotations # for Python 3.7–3.9 + +from pydantic import ( + ConfigDict, + StrictBool, + StrictInt, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + + +def _copy_or_move_query_alias_for(field_name: str) -> str: + if field_name == "source": + return "source" + if field_name == "move": + return "move" + if field_name == "store": + return "store" + return field_name + + +class CopyOrMoveQuery(WaylayBaseModel): + """Model for `copy_or_move` query parameters.""" + + source: StrictStr + move: StrictBool | None = None + store: StrictStr | None = None + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + extra="allow", + alias_generator=_copy_or_move_query_alias_for, + populate_by_name=True, + ) + + +def _create_folder_query_alias_for(field_name: str) -> str: + if field_name == "all": + return "all" + if field_name == "store": + return "store" + return field_name + + +class CreateFolderQuery(WaylayBaseModel): + """Model for `create_folder` query parameters.""" + + all: StrictBool | None = None + store: StrictStr | None = None + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + extra="allow", + alias_generator=_create_folder_query_alias_for, + populate_by_name=True, + ) + + +def _list_query_alias_for(field_name: str) -> str: + if field_name == "stat": + return "stat" + if field_name == "recursive": + return "recursive" + if field_name == "all": + return "all" + if field_name == "start_after": + return "start_after" + if field_name == "fetch_content_type": + return "fetch_content_type" + if field_name == "get_as_attachment": + return "get_as_attachment" + if field_name == "max_keys": + return "max_keys" + if field_name == "sign": + return "sign" + if field_name == "store": + return "store" + if field_name == "expiry_days": + return "expiry_days" + if field_name == "expiry_hours": + return "expiry_hours" + if field_name == "expiry_seconds": + return "expiry_seconds" + if field_name == "content_length_min": + return "content_length_min" + if field_name == "content_length_max": + return "content_length_max" + if field_name == "content_type": + return "content_type" + return field_name + + +class ListQuery(WaylayBaseModel): + """Model for `list` query parameters.""" + + stat: StrictBool | None = None + recursive: StrictBool | None = None + all: StrictBool | None = None + start_after: StrictStr | None = None + fetch_content_type: StrictBool | None = None + get_as_attachment: StrictBool | None = None + max_keys: StrictInt | None = None + sign: StrictStr | None = None + store: StrictStr | None = None + expiry_days: StrictInt | None = None + expiry_hours: StrictInt | None = None + expiry_seconds: StrictInt | None = None + content_length_min: StrictInt | None = None + content_length_max: StrictInt | None = None + content_type: StrictStr | None = None + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + extra="allow", + alias_generator=_list_query_alias_for, + populate_by_name=True, + ) + + +def _remove_query_alias_for(field_name: str) -> str: + if field_name == "recursive": + return "recursive" + if field_name == "all": + return "all" + if field_name == "start_after": + return "start_after" + if field_name == "max_keys": + return "max_keys" + if field_name == "store": + return "store" + return field_name + + +class RemoveQuery(WaylayBaseModel): + """Model for `remove` query parameters.""" + + recursive: StrictBool | None = None + all: StrictBool | None = None + start_after: StrictStr | None = None + max_keys: StrictInt | None = None + store: StrictStr | None = None + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + extra="allow", + alias_generator=_remove_query_alias_for, + populate_by_name=True, + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/queries/py.typed b/waylay-sdk-storage-types/src/waylay/services/storage/queries/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/queries/subscription_api.py b/waylay-sdk-storage-types/src/waylay/services/storage/queries/subscription_api.py new file mode 100644 index 0000000..51406be --- /dev/null +++ b/waylay-sdk-storage-types/src/waylay/services/storage/queries/subscription_api.py @@ -0,0 +1,221 @@ +# coding: utf-8 +"""Waylay Storage query parameters. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +from __future__ import annotations # for Python 3.7–3.9 + +from pydantic import ( + ConfigDict, + StrictInt, + StrictStr, +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + +from ..models.channeltype import CHANNELTYPE +from ..models.venttype import VENTTYPE + + +def _create_query_alias_for(field_name: str) -> str: + if field_name == "store": + return "store" + return field_name + + +class CreateQuery(WaylayBaseModel): + """Model for `create` query parameters.""" + + store: StrictStr | None = None + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + extra="allow", + alias_generator=_create_query_alias_for, + populate_by_name=True, + ) + + +def _delete_by_query_alias_for(field_name: str) -> str: + if field_name == "start_after": + return "start_after" + if field_name == "prefix": + return "prefix" + if field_name == "suffix": + return "suffix" + if field_name == "event_type": + return "event_type" + if field_name == "channel_type": + return "channel_type" + if field_name == "channel_id": + return "channel_id" + if field_name == "store": + return "store" + if field_name == "max_keys": + return "max_keys" + return field_name + + +class DeleteByQuery(WaylayBaseModel): + """Model for `delete_by` query parameters.""" + + start_after: StrictStr | None = None + prefix: StrictStr | None = None + suffix: StrictStr | None = None + event_type: VENTTYPE | None = None + channel_type: CHANNELTYPE | None = None + channel_id: StrictStr | None = None + store: StrictStr | None = None + max_keys: StrictInt | None = None + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + extra="allow", + alias_generator=_delete_by_query_alias_for, + populate_by_name=True, + ) + + +def _get_query_alias_for(field_name: str) -> str: + if field_name == "store": + return "store" + return field_name + + +class GetQuery(WaylayBaseModel): + """Model for `get` query parameters.""" + + store: StrictStr | None = None + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + extra="allow", + alias_generator=_get_query_alias_for, + populate_by_name=True, + ) + + +def _list_query_alias_for(field_name: str) -> str: + if field_name == "store": + return "store" + if field_name == "prefix": + return "prefix" + if field_name == "suffix": + return "suffix" + if field_name == "event_type": + return "event_type" + if field_name == "channel_type": + return "channel_type" + if field_name == "channel_id": + return "channel_id" + if field_name == "max_keys": + return "max_keys" + return field_name + + +class ListQuery(WaylayBaseModel): + """Model for `list` query parameters.""" + + store: StrictStr | None = None + prefix: StrictStr | None = None + suffix: StrictStr | None = None + event_type: VENTTYPE | None = None + channel_type: CHANNELTYPE | None = None + channel_id: StrictStr | None = None + max_keys: StrictInt | None = None + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + extra="allow", + alias_generator=_list_query_alias_for, + populate_by_name=True, + ) + + +def _query_query_alias_for(field_name: str) -> str: + if field_name == "start_after": + return "start_after" + if field_name == "store": + return "store" + if field_name == "prefix": + return "prefix" + if field_name == "suffix": + return "suffix" + if field_name == "event_type": + return "event_type" + if field_name == "channel_type": + return "channel_type" + if field_name == "channel_id": + return "channel_id" + if field_name == "max_keys": + return "max_keys" + return field_name + + +class QueryQuery(WaylayBaseModel): + """Model for `query` query parameters.""" + + start_after: StrictStr | None = None + store: StrictStr | None = None + prefix: StrictStr | None = None + suffix: StrictStr | None = None + event_type: VENTTYPE | None = None + channel_type: CHANNELTYPE | None = None + channel_id: StrictStr | None = None + max_keys: StrictInt | None = None + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + extra="allow", + alias_generator=_query_query_alias_for, + populate_by_name=True, + ) + + +def _remove_query_alias_for(field_name: str) -> str: + if field_name == "store": + return "store" + return field_name + + +class RemoveQuery(WaylayBaseModel): + """Model for `remove` query parameters.""" + + store: StrictStr | None = None + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + extra="allow", + alias_generator=_remove_query_alias_for, + populate_by_name=True, + ) + + +def _replace_query_alias_for(field_name: str) -> str: + if field_name == "store": + return "store" + return field_name + + +class ReplaceQuery(WaylayBaseModel): + """Model for `replace` query parameters.""" + + store: StrictStr | None = None + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + extra="allow", + alias_generator=_replace_query_alias_for, + populate_by_name=True, + ) diff --git a/waylay-sdk-storage/.openapi-generator/FILES b/waylay-sdk-storage/.openapi-generator/FILES new file mode 100644 index 0000000..d3a12aa --- /dev/null +++ b/waylay-sdk-storage/.openapi-generator/FILES @@ -0,0 +1,11 @@ +LICENSE.txt +pyproject.toml +src/waylay/services/storage/api/__init__.py +src/waylay/services/storage/api/about_api.py +src/waylay/services/storage/api/bucket_api.py +src/waylay/services/storage/api/object_api.py +src/waylay/services/storage/api/py.typed +src/waylay/services/storage/api/subscription_api.py +src/waylay/services/storage/service/__init__.py +src/waylay/services/storage/service/py.typed +src/waylay/services/storage/service/service.py diff --git a/waylay-sdk-storage/.openapi-generator/VERSION b/waylay-sdk-storage/.openapi-generator/VERSION new file mode 100644 index 0000000..4b49d9b --- /dev/null +++ b/waylay-sdk-storage/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.2.0 \ No newline at end of file diff --git a/waylay-sdk-storage/LICENSE.txt b/waylay-sdk-storage/LICENSE.txt new file mode 100644 index 0000000..2796771 --- /dev/null +++ b/waylay-sdk-storage/LICENSE.txt @@ -0,0 +1,13 @@ +ISC License (ISC) +Copyright 2024, Waylay + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, +OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/waylay-sdk-storage/README.md b/waylay-sdk-storage/README.md new file mode 100644 index 0000000..991b956 --- /dev/null +++ b/waylay-sdk-storage/README.md @@ -0,0 +1,50 @@ +# Waylay Storage Service + +Manage storage buckets and subscriptions. + + +This Python package is automatically generated based on the +Waylay Storage OpenAPI specification (API version: 0.4.1) +For more information, please visit [the openapi specification](https://docs.waylay.io/openapi/public/redocly/storage.html). + +It consists of a plugin for the waylay-sdk-core package, and contains the Storage api methods. +Note that the typed model classes for all path params, query params, body params and responses for each of the api methods are contained in a separate package called waylay-sdk-storage-types. + +## Requirements. +This package requires Python 3.9+. + +## Installation +Typically this package is installed when installing the [waylay-sdk-core](https://pypi.org/project/waylay-sdk/) package to enable the service's functionality. +When the service api methods are required, waylay-sdk-storage is included in: +- ```pip install waylay-sdk-core[storage]``` to install `waylay-sdk-core` along with only this service, or +- ```pip install waylay-sdk-core[services]``` to install `waylay-sdk-core` along with all services. +When the typed models are required, both waylay-sdk-storage and waylay-sdk-storage-types are included in: +- ```pip install waylay-sdk-core[storage,storage-types]``` to install `waylay-sdk-core` along with only this service including the typed models, or +- ```pip install waylay-sdk-core[services,services-types]``` to install `waylay-sdk-core` along with all services along with the typed models. + +## Usage + +```python +from pprint import pprint + +# Import the waylay-client from the waylay-sdk-core package +from waylay.sdk.client import WaylayClient +from waylay.sdk.api.api_exceptions import ApiError + +# Intialize a waylay client instance +waylay_client = WaylayClient.from_profile() + +# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +try: + # Version + # calls `GET /storage/v1/` + api_response = await waylay_client.storage.about.version( + ) + print("The response of storage.about.version:\n") + pprint(api_response) +except ApiError as e: + print("Exception when calling storage.about.version: %s\n" % e) +``` + + +For more information, please visit the [Waylay API documentation](https://docs.waylay.io/#/api/?id=software-development-kits). \ No newline at end of file diff --git a/waylay-sdk-storage/pyproject.toml b/waylay-sdk-storage/pyproject.toml new file mode 100644 index 0000000..cb2133e --- /dev/null +++ b/waylay-sdk-storage/pyproject.toml @@ -0,0 +1,77 @@ +[build-system] +requires = ["setuptools >= 61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "waylay-sdk-storage" +version = "0.4.1" +description = "Waylay Storage" +authors = [ + { name = "Waylay", email = "info@waylay.io"} +] +keywords = ["Waylay Storage"] +requires-python = ">= 3.9" +dependencies = [ + "waylay-sdk-core ~= 0.2.0", + "pydantic ~= 2.6", + "typing-extensions ~= 4.10", + "eval-type-backport ~= 0.1.3; python_version < '3.10'", +] +readme = "README.md" +license={file = "LICENSE.txt"} + +[project.urls] +Homepage = "https://www.waylay.io/" +Documentation = "https://docs.waylay.io/#/api/?id=software-development-kits" +Repository = "https://github.com/waylayio/waylay-sdk-storage-py.git" +"Openapi Specification" = "https://docs.waylay.io/openapi/public/redocly/storage.html" + +[project.optional-dependencies] +dev = [ + "mypy", + "ruff", + "types-python-jose", + "types-appdirs", + "types-python-dateutil", + "pytest", + "pytest-mock", + "pytest-httpx", + "pytest-asyncio", + "starlette", + "python-multipart", + "typeguard", + "pyyaml", + "jsf >= 0.11.1", +] + +types = ["waylay-sdk-storage-types"] + +[project.entry-points.dynamic] +"waylay_sdk_plugins"= "waylay.services.storage.service:PLUGINS" + +[tool.setuptools.packages.find] +where = ["src/"] +namespaces = true + +[tool.ruff] +include = ["pyproject.toml", "src/**/*.py"] + +[tool.ruff.lint] +ignore-init-module-imports = true +# allow duplicate imports +ignore=["F811"] +# https://docs.astral.sh/ruff/rules +select= [ + "UP007", "FA102", # convert Union to | (pep-604) + "I001", "F401", # sort and remove unused imports + "PIE790", # remove unnecessary pass statements + "E303", # too many blank lines +] + +[tool.ruff.lint.per-file-ignores] +# do not touch imports here +"__init__.py" = ["F401"] +"conftest.py" = ["F401"] + +[tool.pytest.ini_options] +asyncio_mode = "auto" \ No newline at end of file diff --git a/waylay-sdk-storage/src/waylay/services/storage/api/__init__.py b/waylay-sdk-storage/src/waylay/services/storage/api/__init__.py new file mode 100644 index 0000000..194b56b --- /dev/null +++ b/waylay-sdk-storage/src/waylay/services/storage/api/__init__.py @@ -0,0 +1,14 @@ +"""Waylay Storage: apis.""" + +# import apis into api package +from .about_api import AboutApi +from .bucket_api import BucketApi +from .object_api import ObjectApi +from .subscription_api import SubscriptionApi + +__all__ = [ + "AboutApi", + "BucketApi", + "ObjectApi", + "SubscriptionApi", +] diff --git a/waylay-sdk-storage/src/waylay/services/storage/api/about_api.py b/waylay-sdk-storage/src/waylay/services/storage/api/about_api.py new file mode 100644 index 0000000..64a12dd --- /dev/null +++ b/waylay-sdk-storage/src/waylay/services/storage/api/about_api.py @@ -0,0 +1,346 @@ +# coding: utf-8 +"""Waylay Storage api. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +from __future__ import annotations # for Python 3.7–3.9 + +from typing import ( + TYPE_CHECKING, + Any, + Dict, + Literal, + TypeVar, + overload, +) + +from pydantic import ( + StrictBool, + TypeAdapter, +) +from waylay.sdk.api import ( + HeaderTypes, + QueryParamTypes, + Response, +) +from waylay.sdk.api._models import Model +from waylay.sdk.plugin import WithApiClient + +if TYPE_CHECKING: + from waylay.services.storage.models import HTTPValidationError, TenantStatusReport + from waylay.services.storage.queries.about_api import StatusQuery, VersionQuery + + +try: + from waylay.services.storage.models import HTTPValidationError, TenantStatusReport + from waylay.services.storage.queries.about_api import StatusQuery, VersionQuery + + MODELS_AVAILABLE = True +except ImportError: + MODELS_AVAILABLE = False + + if not TYPE_CHECKING: + StatusQuery = dict + TenantStatusReport = Model + + HTTPValidationError = Model + + VersionQuery = dict + + +T = TypeVar("T") + + +class AboutApi(WithApiClient): + """AboutApi service methods. + + NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + @overload + async def status( + self, + *, + query: StatusQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> TenantStatusReport: ... + + @overload + async def status( + self, + *, + query: StatusQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + @overload + async def status( + self, + *, + query: StatusQuery | QueryParamTypes | None = None, + raw_response: Literal[True], + select_path: Literal["_not_used_"] = "_not_used_", + response_type: Literal[None] = None, # not used + headers: HeaderTypes | None = None, + **kwargs, + ) -> Response: ... + + @overload + async def status( + self, + *, + query: StatusQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Model: ... + + @overload + async def status( + self, + *, + query: StatusQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + async def status( + self, + *, + query: StatusQuery | QueryParamTypes | None = None, + raw_response: StrictBool = False, + select_path: str = "", + response_type: T | None = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> TenantStatusReport | T | Response | Model: + """Status. + + Validate consistency of buckets and notification queues for this tenant. + :param query: URL Query parameters. + :type query: StatusQuery | QueryParamTypes, optional + :param query['store'] (dict)
query.store (Query) : + :type query['store']: str + :param query['include_buckets'] (dict)
query.include_buckets (Query) : + :type query['include_buckets']: bool + :param query['include_queues'] (dict)
query.include_queues (Query) : + :type query['include_queues']: bool + :param query['include_disk_usage'] (dict)
query.include_disk_usage (Query) : + :type query['include_disk_usage']: bool + :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. + :param select_path: Denotes the json path applied to the response object before returning it. + Set it to the empty string `""` to receive the full response object. + :param response_type: If specified, the response is parsed into an instance of the specified type. + :param headers: Header parameters for this request + :type headers: dict, optional + :param `**kwargs`: Additional parameters passed on to the http client. + See below. + :Keyword Arguments: + * timeout: a single numeric timeout in seconds, + or a tuple of _connect_, _read_, _write_ and _pool_ timeouts. + * stream: if true, the response will be in streaming mode + * cookies + * extensions + * auth + * follow_redirects: bool + + :return: Returns the result object if the http request succeeded with status code '2XX'. + :raises APIError: If the http request has a status code different from `2XX`. This + object wraps both the http Response and any parsed data. + """ + + should_validate = ( + MODELS_AVAILABLE and self.api_client.config.client_side_validation + ) + + # path parameters + path_params: Dict[str, str] = {} + + ## named body parameters + body_args: Dict[str, Any] = {} + + # query parameters + if query is not None and should_validate: + query = TypeAdapter(StatusQuery).validate_python(query) + + response_types_map: Dict[str, Any] = ( + {"2XX": response_type} + if response_type is not None + else { + "200": TenantStatusReport if not select_path else Model, + } + ) + non_200_response_types_map: Dict[str, Any] = { + "422": HTTPValidationError, + } + response_types_map.update(non_200_response_types_map) + + ## peform request + return await self.api_client.request( + method="GET", + resource_path="/storage/v1/status", + path_params=path_params, + params=query, + **body_args, + headers=headers, + **kwargs, + response_type=response_types_map, + select_path=select_path, + raw_response=raw_response, + ) + + @overload + async def version( + self, + *, + query: VersionQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> str: ... + + @overload + async def version( + self, + *, + query: VersionQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + @overload + async def version( + self, + *, + query: VersionQuery | QueryParamTypes | None = None, + raw_response: Literal[True], + select_path: Literal["_not_used_"] = "_not_used_", + response_type: Literal[None] = None, # not used + headers: HeaderTypes | None = None, + **kwargs, + ) -> Response: ... + + @overload + async def version( + self, + *, + query: VersionQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Model: ... + + @overload + async def version( + self, + *, + query: VersionQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + async def version( + self, + *, + query: VersionQuery | QueryParamTypes | None = None, + raw_response: StrictBool = False, + select_path: str = "", + response_type: T | None = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> str | T | Response | Model: + """Version. + + Get the application version. + :param query: URL Query parameters. + :type query: VersionQuery | QueryParamTypes, optional + :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. + :param select_path: Denotes the json path applied to the response object before returning it. + Set it to the empty string `""` to receive the full response object. + :param response_type: If specified, the response is parsed into an instance of the specified type. + :param headers: Header parameters for this request + :type headers: dict, optional + :param `**kwargs`: Additional parameters passed on to the http client. + See below. + :Keyword Arguments: + * timeout: a single numeric timeout in seconds, + or a tuple of _connect_, _read_, _write_ and _pool_ timeouts. + * stream: if true, the response will be in streaming mode + * cookies + * extensions + * auth + * follow_redirects: bool + + :return: Returns the result object if the http request succeeded with status code '2XX'. + :raises APIError: If the http request has a status code different from `2XX`. This + object wraps both the http Response and any parsed data. + """ + + should_validate = ( + MODELS_AVAILABLE and self.api_client.config.client_side_validation + ) + + # path parameters + path_params: Dict[str, str] = {} + + ## named body parameters + body_args: Dict[str, Any] = {} + + # query parameters + if query is not None and should_validate: + query = TypeAdapter(VersionQuery).validate_python(query) + + response_types_map: Dict[str, Any] = ( + {"2XX": response_type} + if response_type is not None + else { + "200": str if not select_path else Model, + } + ) + non_200_response_types_map: Dict[str, Any] = {} + response_types_map.update(non_200_response_types_map) + + ## peform request + return await self.api_client.request( + method="GET", + resource_path="/storage/v1/", + path_params=path_params, + params=query, + **body_args, + headers=headers, + **kwargs, + response_type=response_types_map, + select_path=select_path, + raw_response=raw_response, + ) diff --git a/waylay-sdk-storage/src/waylay/services/storage/api/bucket_api.py b/waylay-sdk-storage/src/waylay/services/storage/api/bucket_api.py new file mode 100644 index 0000000..3cbdf5b --- /dev/null +++ b/waylay-sdk-storage/src/waylay/services/storage/api/bucket_api.py @@ -0,0 +1,366 @@ +# coding: utf-8 +"""Waylay Storage api. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +from __future__ import annotations # for Python 3.7–3.9 + +from typing import ( + TYPE_CHECKING, + Any, + Dict, + Literal, + TypeVar, + overload, +) + +from pydantic import ( + StrictBool, + StrictStr, + TypeAdapter, +) +from waylay.sdk.api import ( + HeaderTypes, + QueryParamTypes, + Response, +) +from waylay.sdk.api._models import Model +from waylay.sdk.plugin import WithApiClient + +if TYPE_CHECKING: + from waylay.services.storage.models import ( + Bucket, + BucketListing, + HTTPValidationError, + ) + from waylay.services.storage.queries.bucket_api import GetQuery, ListQuery + + +try: + from waylay.services.storage.models import ( + Bucket, + BucketListing, + HTTPValidationError, + ) + from waylay.services.storage.queries.bucket_api import GetQuery, ListQuery + + MODELS_AVAILABLE = True +except ImportError: + MODELS_AVAILABLE = False + + if not TYPE_CHECKING: + GetQuery = dict + Bucket = Model + + HTTPValidationError = Model + + ListQuery = dict + BucketListing = Model + + HTTPValidationError = Model + + +T = TypeVar("T") + + +class BucketApi(WithApiClient): + """BucketApi service methods. + + NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + @overload + async def get( + self, + bucket_name: StrictStr, + *, + query: GetQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Bucket: ... + + @overload + async def get( + self, + bucket_name: StrictStr, + *, + query: GetQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + @overload + async def get( + self, + bucket_name: StrictStr, + *, + query: GetQuery | QueryParamTypes | None = None, + raw_response: Literal[True], + select_path: Literal["_not_used_"] = "_not_used_", + response_type: Literal[None] = None, # not used + headers: HeaderTypes | None = None, + **kwargs, + ) -> Response: ... + + @overload + async def get( + self, + bucket_name: StrictStr, + *, + query: GetQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Model: ... + + @overload + async def get( + self, + bucket_name: StrictStr, + *, + query: GetQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + async def get( + self, + bucket_name: StrictStr, + *, + query: GetQuery | QueryParamTypes | None = None, + raw_response: StrictBool = False, + select_path: str = "", + response_type: T | None = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Bucket | T | Response | Model: + """Get Bucket. + + Get a descriptive representation of a bucket. + :param bucket_name: (required) + :type bucket_name: str + :param query: URL Query parameters. + :type query: GetQuery | QueryParamTypes, optional + :param query['store'] (dict)
query.store (Query) : + :type query['store']: str + :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. + :param select_path: Denotes the json path applied to the response object before returning it. + Set it to the empty string `""` to receive the full response object. + :param response_type: If specified, the response is parsed into an instance of the specified type. + :param headers: Header parameters for this request + :type headers: dict, optional + :param `**kwargs`: Additional parameters passed on to the http client. + See below. + :Keyword Arguments: + * timeout: a single numeric timeout in seconds, + or a tuple of _connect_, _read_, _write_ and _pool_ timeouts. + * stream: if true, the response will be in streaming mode + * cookies + * extensions + * auth + * follow_redirects: bool + + :return: Returns the result object if the http request succeeded with status code '2XX'. + :raises APIError: If the http request has a status code different from `2XX`. This + object wraps both the http Response and any parsed data. + """ + + should_validate = ( + MODELS_AVAILABLE and self.api_client.config.client_side_validation + ) + + # path parameters + path_params: Dict[str, str] = { + "bucket_name": str(bucket_name), + } + + ## named body parameters + body_args: Dict[str, Any] = {} + + # query parameters + if query is not None and should_validate: + query = TypeAdapter(GetQuery).validate_python(query) + + response_types_map: Dict[str, Any] = ( + {"2XX": response_type} + if response_type is not None + else { + "200": Bucket if not select_path else Model, + } + ) + non_200_response_types_map: Dict[str, Any] = { + "422": HTTPValidationError, + } + response_types_map.update(non_200_response_types_map) + + ## peform request + return await self.api_client.request( + method="GET", + resource_path="/storage/v1/bucket/{bucket_name}", + path_params=path_params, + params=query, + **body_args, + headers=headers, + **kwargs, + response_type=response_types_map, + select_path=select_path, + raw_response=raw_response, + ) + + @overload + async def list( + self, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> BucketListing: ... + + @overload + async def list( + self, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + @overload + async def list( + self, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: Literal[True], + select_path: Literal["_not_used_"] = "_not_used_", + response_type: Literal[None] = None, # not used + headers: HeaderTypes | None = None, + **kwargs, + ) -> Response: ... + + @overload + async def list( + self, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Model: ... + + @overload + async def list( + self, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + async def list( + self, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: StrictBool = False, + select_path: str = "", + response_type: T | None = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> BucketListing | T | Response | Model: + """List Buckets. + + List authorized buckets. + :param query: URL Query parameters. + :type query: ListQuery | QueryParamTypes, optional + :param query['store'] (dict)
query.store (Query) : + :type query['store']: str + :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. + :param select_path: Denotes the json path applied to the response object before returning it. + Set it to the empty string `""` to receive the full response object. + :param response_type: If specified, the response is parsed into an instance of the specified type. + :param headers: Header parameters for this request + :type headers: dict, optional + :param `**kwargs`: Additional parameters passed on to the http client. + See below. + :Keyword Arguments: + * timeout: a single numeric timeout in seconds, + or a tuple of _connect_, _read_, _write_ and _pool_ timeouts. + * stream: if true, the response will be in streaming mode + * cookies + * extensions + * auth + * follow_redirects: bool + + :return: Returns the result object if the http request succeeded with status code '2XX'. + :raises APIError: If the http request has a status code different from `2XX`. This + object wraps both the http Response and any parsed data. + """ + + should_validate = ( + MODELS_AVAILABLE and self.api_client.config.client_side_validation + ) + + # path parameters + path_params: Dict[str, str] = {} + + ## named body parameters + body_args: Dict[str, Any] = {} + + # query parameters + if query is not None and should_validate: + query = TypeAdapter(ListQuery).validate_python(query) + + response_types_map: Dict[str, Any] = ( + {"2XX": response_type} + if response_type is not None + else { + "200": BucketListing if not select_path else Model, + } + ) + non_200_response_types_map: Dict[str, Any] = { + "422": HTTPValidationError, + } + response_types_map.update(non_200_response_types_map) + + ## peform request + return await self.api_client.request( + method="GET", + resource_path="/storage/v1/bucket", + path_params=path_params, + params=query, + **body_args, + headers=headers, + **kwargs, + response_type=response_types_map, + select_path=select_path, + raw_response=raw_response, + ) diff --git a/waylay-sdk-storage/src/waylay/services/storage/api/object_api.py b/waylay-sdk-storage/src/waylay/services/storage/api/object_api.py new file mode 100644 index 0000000..985c527 --- /dev/null +++ b/waylay-sdk-storage/src/waylay/services/storage/api/object_api.py @@ -0,0 +1,774 @@ +# coding: utf-8 +"""Waylay Storage api. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +from __future__ import annotations # for Python 3.7–3.9 + +from typing import ( + TYPE_CHECKING, + Any, + Dict, + Literal, + TypeVar, + overload, +) + +from pydantic import ( + StrictBool, + StrictStr, + TypeAdapter, +) +from waylay.sdk.api import ( + HeaderTypes, + QueryParamTypes, + Response, +) +from waylay.sdk.api._models import Model +from waylay.sdk.plugin import WithApiClient + +if TYPE_CHECKING: + from waylay.services.storage.models import ( + BucketObject, + HALEntity, + HTTPValidationError, + ResponseList, + ) + from waylay.services.storage.queries.object_api import ( + CopyOrMoveQuery, + CreateFolderQuery, + ListQuery, + RemoveQuery, + ) + + +try: + from waylay.services.storage.models import ( + BucketObject, + HALEntity, + HTTPValidationError, + ResponseList, + ) + from waylay.services.storage.queries.object_api import ( + CopyOrMoveQuery, + CreateFolderQuery, + ListQuery, + RemoveQuery, + ) + + MODELS_AVAILABLE = True +except ImportError: + MODELS_AVAILABLE = False + + if not TYPE_CHECKING: + CopyOrMoveQuery = dict + HALEntity = Model + + HTTPValidationError = Model + + CreateFolderQuery = dict + BucketObject = Model + + HTTPValidationError = Model + + ListQuery = dict + ResponseList = Model + + HTTPValidationError = Model + + RemoveQuery = dict + HALEntity = Model + + HTTPValidationError = Model + + +T = TypeVar("T") + + +class ObjectApi(WithApiClient): + """ObjectApi service methods. + + NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + @overload + async def copy_or_move( + self, + bucket_name: StrictStr, + target_path: StrictStr, + *, + query: CopyOrMoveQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> HALEntity: ... + + @overload + async def copy_or_move( + self, + bucket_name: StrictStr, + target_path: StrictStr, + *, + query: CopyOrMoveQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + @overload + async def copy_or_move( + self, + bucket_name: StrictStr, + target_path: StrictStr, + *, + query: CopyOrMoveQuery | QueryParamTypes | None = None, + raw_response: Literal[True], + select_path: Literal["_not_used_"] = "_not_used_", + response_type: Literal[None] = None, # not used + headers: HeaderTypes | None = None, + **kwargs, + ) -> Response: ... + + @overload + async def copy_or_move( + self, + bucket_name: StrictStr, + target_path: StrictStr, + *, + query: CopyOrMoveQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Model: ... + + @overload + async def copy_or_move( + self, + bucket_name: StrictStr, + target_path: StrictStr, + *, + query: CopyOrMoveQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + async def copy_or_move( + self, + bucket_name: StrictStr, + target_path: StrictStr, + *, + query: CopyOrMoveQuery | QueryParamTypes | None = None, + raw_response: StrictBool = False, + select_path: str = "", + response_type: T | None = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> HALEntity | T | Response | Model: + """Copy Or Move Object. + + Copy or move object to new location. + :param bucket_name: (required) + :type bucket_name: str + :param target_path: (required) + :type target_path: str + :param query: URL Query parameters. + :type query: CopyOrMoveQuery | QueryParamTypes, optional + :param query['source'] (dict)
query.source (Query) : (required) + :type query['source']: str + :param query['move'] (dict)
query.move (Query) : + :type query['move']: bool + :param query['store'] (dict)
query.store (Query) : + :type query['store']: str + :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. + :param select_path: Denotes the json path applied to the response object before returning it. + Set it to the empty string `""` to receive the full response object. + :param response_type: If specified, the response is parsed into an instance of the specified type. + :param headers: Header parameters for this request + :type headers: dict, optional + :param `**kwargs`: Additional parameters passed on to the http client. + See below. + :Keyword Arguments: + * timeout: a single numeric timeout in seconds, + or a tuple of _connect_, _read_, _write_ and _pool_ timeouts. + * stream: if true, the response will be in streaming mode + * cookies + * extensions + * auth + * follow_redirects: bool + + :return: Returns the result object if the http request succeeded with status code '2XX'. + :raises APIError: If the http request has a status code different from `2XX`. This + object wraps both the http Response and any parsed data. + """ + + should_validate = ( + MODELS_AVAILABLE and self.api_client.config.client_side_validation + ) + + # path parameters + path_params: Dict[str, str] = { + "bucket_name": str(bucket_name), + "target_path": str(target_path), + } + + ## named body parameters + body_args: Dict[str, Any] = {} + + # query parameters + if query is not None and should_validate: + query = TypeAdapter(CopyOrMoveQuery).validate_python(query) + + response_types_map: Dict[str, Any] = ( + {"2XX": response_type} + if response_type is not None + else { + "200": HALEntity if not select_path else Model, + } + ) + non_200_response_types_map: Dict[str, Any] = { + "422": HTTPValidationError, + } + response_types_map.update(non_200_response_types_map) + + ## peform request + return await self.api_client.request( + method="PUT", + resource_path="/storage/v1/bucket/{bucket_name}/{target_path}", + path_params=path_params, + params=query, + **body_args, + headers=headers, + **kwargs, + response_type=response_types_map, + select_path=select_path, + raw_response=raw_response, + ) + + @overload + async def create_folder( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: CreateFolderQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> BucketObject: ... + + @overload + async def create_folder( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: CreateFolderQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + @overload + async def create_folder( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: CreateFolderQuery | QueryParamTypes | None = None, + raw_response: Literal[True], + select_path: Literal["_not_used_"] = "_not_used_", + response_type: Literal[None] = None, # not used + headers: HeaderTypes | None = None, + **kwargs, + ) -> Response: ... + + @overload + async def create_folder( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: CreateFolderQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Model: ... + + @overload + async def create_folder( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: CreateFolderQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + async def create_folder( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: CreateFolderQuery | QueryParamTypes | None = None, + raw_response: StrictBool = False, + select_path: str = "", + response_type: T | None = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> BucketObject | T | Response | Model: + """Create Folder. + + Create a (virtual) folder. * (`all=true`) force creation of a hidden folder, having a path element that starts with a `.`. + :param bucket_name: (required) + :type bucket_name: str + :param object_path: (required) + :type object_path: str + :param query: URL Query parameters. + :type query: CreateFolderQuery | QueryParamTypes, optional + :param query['all'] (dict)
query.all (Query) : + :type query['all']: bool + :param query['store'] (dict)
query.store (Query) : + :type query['store']: str + :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. + :param select_path: Denotes the json path applied to the response object before returning it. + Set it to the empty string `""` to receive the full response object. + :param response_type: If specified, the response is parsed into an instance of the specified type. + :param headers: Header parameters for this request + :type headers: dict, optional + :param `**kwargs`: Additional parameters passed on to the http client. + See below. + :Keyword Arguments: + * timeout: a single numeric timeout in seconds, + or a tuple of _connect_, _read_, _write_ and _pool_ timeouts. + * stream: if true, the response will be in streaming mode + * cookies + * extensions + * auth + * follow_redirects: bool + + :return: Returns the result object if the http request succeeded with status code '2XX'. + :raises APIError: If the http request has a status code different from `2XX`. This + object wraps both the http Response and any parsed data. + """ + + should_validate = ( + MODELS_AVAILABLE and self.api_client.config.client_side_validation + ) + + # path parameters + path_params: Dict[str, str] = { + "bucket_name": str(bucket_name), + "object_path": str(object_path), + } + + ## named body parameters + body_args: Dict[str, Any] = {} + + # query parameters + if query is not None and should_validate: + query = TypeAdapter(CreateFolderQuery).validate_python(query) + + response_types_map: Dict[str, Any] = ( + {"2XX": response_type} + if response_type is not None + else { + "200": BucketObject if not select_path else Model, + } + ) + non_200_response_types_map: Dict[str, Any] = { + "422": HTTPValidationError, + } + response_types_map.update(non_200_response_types_map) + + ## peform request + return await self.api_client.request( + method="PUT", + resource_path="/storage/v1/bucket/{bucket_name}/{object_path}/", + path_params=path_params, + params=query, + **body_args, + headers=headers, + **kwargs, + response_type=response_types_map, + select_path=select_path, + raw_response=raw_response, + ) + + @overload + async def list( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> ResponseList: ... + + @overload + async def list( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + @overload + async def list( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: Literal[True], + select_path: Literal["_not_used_"] = "_not_used_", + response_type: Literal[None] = None, # not used + headers: HeaderTypes | None = None, + **kwargs, + ) -> Response: ... + + @overload + async def list( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Model: ... + + @overload + async def list( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + async def list( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: StrictBool = False, + select_path: str = "", + response_type: T | None = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> ResponseList | T | Response | Model: + """List Objects. + + List, inspect or sign objects. * list the objects of a bucket with {object_path} prefix * (`recursive=true`) list content recursively * (`all=true`) include hidden objects * (`stat=true`) get the meta of the object at {object_path} * (`sign=[GET,PUT,POST]`) fetch presigned urls to operate on {object_path} * (`all=true`) allow link creation for hidden objects + :param bucket_name: (required) + :type bucket_name: str + :param object_path: (required) + :type object_path: str + :param query: URL Query parameters. + :type query: ListQuery | QueryParamTypes, optional + :param query['stat'] (dict)
query.stat (Query) : + :type query['stat']: bool + :param query['recursive'] (dict)
query.recursive (Query) : + :type query['recursive']: bool + :param query['all'] (dict)
query.all (Query) : + :type query['all']: bool + :param query['start_after'] (dict)
query.start_after (Query) : + :type query['start_after']: str + :param query['fetch_content_type'] (dict)
query.fetch_content_type (Query) : + :type query['fetch_content_type']: bool + :param query['get_as_attachment'] (dict)
query.get_as_attachment (Query) : + :type query['get_as_attachment']: bool + :param query['max_keys'] (dict)
query.max_keys (Query) : + :type query['max_keys']: int + :param query['sign'] (dict)
query.sign (Query) : + :type query['sign']: str + :param query['store'] (dict)
query.store (Query) : + :type query['store']: str + :param query['expiry_days'] (dict)
query.expiry_days (Query) : + :type query['expiry_days']: int + :param query['expiry_hours'] (dict)
query.expiry_hours (Query) : + :type query['expiry_hours']: int + :param query['expiry_seconds'] (dict)
query.expiry_seconds (Query) : + :type query['expiry_seconds']: int + :param query['content_length_min'] (dict)
query.content_length_min (Query) : + :type query['content_length_min']: int + :param query['content_length_max'] (dict)
query.content_length_max (Query) : + :type query['content_length_max']: int + :param query['content_type'] (dict)
query.content_type (Query) : + :type query['content_type']: str + :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. + :param select_path: Denotes the json path applied to the response object before returning it. + Set it to the empty string `""` to receive the full response object. + :param response_type: If specified, the response is parsed into an instance of the specified type. + :param headers: Header parameters for this request + :type headers: dict, optional + :param `**kwargs`: Additional parameters passed on to the http client. + See below. + :Keyword Arguments: + * timeout: a single numeric timeout in seconds, + or a tuple of _connect_, _read_, _write_ and _pool_ timeouts. + * stream: if true, the response will be in streaming mode + * cookies + * extensions + * auth + * follow_redirects: bool + + :return: Returns the result object if the http request succeeded with status code '2XX'. + :raises APIError: If the http request has a status code different from `2XX`. This + object wraps both the http Response and any parsed data. + """ + + should_validate = ( + MODELS_AVAILABLE and self.api_client.config.client_side_validation + ) + + # path parameters + path_params: Dict[str, str] = { + "bucket_name": str(bucket_name), + "object_path": str(object_path), + } + + ## named body parameters + body_args: Dict[str, Any] = {} + + # query parameters + if query is not None and should_validate: + query = TypeAdapter(ListQuery).validate_python(query) + + response_types_map: Dict[str, Any] = ( + {"2XX": response_type} + if response_type is not None + else { + "200": ResponseList if not select_path else Model, + } + ) + non_200_response_types_map: Dict[str, Any] = { + "422": HTTPValidationError, + } + response_types_map.update(non_200_response_types_map) + + ## peform request + return await self.api_client.request( + method="GET", + resource_path="/storage/v1/bucket/{bucket_name}/{object_path}", + path_params=path_params, + params=query, + **body_args, + headers=headers, + **kwargs, + response_type=response_types_map, + select_path=select_path, + raw_response=raw_response, + ) + + @overload + async def remove( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: RemoveQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> HALEntity: ... + + @overload + async def remove( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: RemoveQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + @overload + async def remove( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: RemoveQuery | QueryParamTypes | None = None, + raw_response: Literal[True], + select_path: Literal["_not_used_"] = "_not_used_", + response_type: Literal[None] = None, # not used + headers: HeaderTypes | None = None, + **kwargs, + ) -> Response: ... + + @overload + async def remove( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: RemoveQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Model: ... + + @overload + async def remove( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: RemoveQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + async def remove( + self, + bucket_name: StrictStr, + object_path: StrictStr, + *, + query: RemoveQuery | QueryParamTypes | None = None, + raw_response: StrictBool = False, + select_path: str = "", + response_type: T | None = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> HALEntity | T | Response | Model: + """Remove Object Or Folder. + + Remove the object or folder at {object_path}. An {object_path} ending in a `/` requests folder deletion of an empty folder unless: * (`recursive=true`) forces recursive deletion of a (non-empty) folder. * (`all=true`) forces recursive deletion, including hidden objects. + :param bucket_name: (required) + :type bucket_name: str + :param object_path: (required) + :type object_path: str + :param query: URL Query parameters. + :type query: RemoveQuery | QueryParamTypes, optional + :param query['recursive'] (dict)
query.recursive (Query) : + :type query['recursive']: bool + :param query['all'] (dict)
query.all (Query) : + :type query['all']: bool + :param query['start_after'] (dict)
query.start_after (Query) : + :type query['start_after']: str + :param query['max_keys'] (dict)
query.max_keys (Query) : + :type query['max_keys']: int + :param query['store'] (dict)
query.store (Query) : + :type query['store']: str + :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. + :param select_path: Denotes the json path applied to the response object before returning it. + Set it to the empty string `""` to receive the full response object. + :param response_type: If specified, the response is parsed into an instance of the specified type. + :param headers: Header parameters for this request + :type headers: dict, optional + :param `**kwargs`: Additional parameters passed on to the http client. + See below. + :Keyword Arguments: + * timeout: a single numeric timeout in seconds, + or a tuple of _connect_, _read_, _write_ and _pool_ timeouts. + * stream: if true, the response will be in streaming mode + * cookies + * extensions + * auth + * follow_redirects: bool + + :return: Returns the result object if the http request succeeded with status code '2XX'. + :raises APIError: If the http request has a status code different from `2XX`. This + object wraps both the http Response and any parsed data. + """ + + should_validate = ( + MODELS_AVAILABLE and self.api_client.config.client_side_validation + ) + + # path parameters + path_params: Dict[str, str] = { + "bucket_name": str(bucket_name), + "object_path": str(object_path), + } + + ## named body parameters + body_args: Dict[str, Any] = {} + + # query parameters + if query is not None and should_validate: + query = TypeAdapter(RemoveQuery).validate_python(query) + + response_types_map: Dict[str, Any] = ( + {"2XX": response_type} + if response_type is not None + else { + "200": HALEntity if not select_path else Model, + } + ) + non_200_response_types_map: Dict[str, Any] = { + "422": HTTPValidationError, + } + response_types_map.update(non_200_response_types_map) + + ## peform request + return await self.api_client.request( + method="DELETE", + resource_path="/storage/v1/bucket/{bucket_name}/{object_path}", + path_params=path_params, + params=query, + **body_args, + headers=headers, + **kwargs, + response_type=response_types_map, + select_path=select_path, + raw_response=raw_response, + ) diff --git a/waylay-sdk-storage/src/waylay/services/storage/api/py.typed b/waylay-sdk-storage/src/waylay/services/storage/api/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/waylay-sdk-storage/src/waylay/services/storage/api/subscription_api.py b/waylay-sdk-storage/src/waylay/services/storage/api/subscription_api.py new file mode 100644 index 0000000..f35e539 --- /dev/null +++ b/waylay-sdk-storage/src/waylay/services/storage/api/subscription_api.py @@ -0,0 +1,1251 @@ +# coding: utf-8 +"""Waylay Storage api. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +from __future__ import annotations # for Python 3.7–3.9 + +from typing import ( + TYPE_CHECKING, + Any, + Dict, + Literal, + TypeVar, + overload, +) + +from pydantic import ( + StrictBool, + StrictStr, + TypeAdapter, +) +from waylay.sdk.api import ( + HeaderTypes, + QueryParamTypes, + Response, +) +from waylay.sdk.api._models import Model +from waylay.sdk.plugin import WithApiClient + +if TYPE_CHECKING: + from waylay.services.storage.models import ( + HALEntity, + HTTPValidationError, + SubscriptionConfig, + Subscriptions, + SubscriptionsListing, + ) + from waylay.services.storage.queries.subscription_api import ( + CreateQuery, + DeleteByQuery, + GetQuery, + ListQuery, + QueryQuery, + RemoveQuery, + ReplaceQuery, + ) + + +try: + from waylay.services.storage.models import ( + HALEntity, + HTTPValidationError, + SubscriptionConfig, + Subscriptions, + SubscriptionsListing, + ) + from waylay.services.storage.queries.subscription_api import ( + CreateQuery, + DeleteByQuery, + GetQuery, + ListQuery, + QueryQuery, + RemoveQuery, + ReplaceQuery, + ) + + MODELS_AVAILABLE = True +except ImportError: + MODELS_AVAILABLE = False + + if not TYPE_CHECKING: + SubscriptionConfig = Model + + CreateQuery = dict + SubscriptionConfig = Model + + HTTPValidationError = Model + + DeleteByQuery = dict + HALEntity = Model + + HTTPValidationError = Model + + GetQuery = dict + SubscriptionConfig = Model + + HTTPValidationError = Model + + ListQuery = dict + SubscriptionsListing = Model + + HTTPValidationError = Model + + QueryQuery = dict + Subscriptions = Model + + HTTPValidationError = Model + + RemoveQuery = dict + HALEntity = Model + + HTTPValidationError = Model + + SubscriptionConfig = Model + + ReplaceQuery = dict + SubscriptionConfig = Model + + HTTPValidationError = Model + + +T = TypeVar("T") + + +class SubscriptionApi(WithApiClient): + """SubscriptionApi service methods. + + NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + @overload + async def create( + self, + bucket_name: StrictStr, + *, + json: SubscriptionConfig, + query: CreateQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> SubscriptionConfig: ... + + @overload + async def create( + self, + bucket_name: StrictStr, + *, + json: SubscriptionConfig, + query: CreateQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + @overload + async def create( + self, + bucket_name: StrictStr, + *, + json: SubscriptionConfig, + query: CreateQuery | QueryParamTypes | None = None, + raw_response: Literal[True], + select_path: Literal["_not_used_"] = "_not_used_", + response_type: Literal[None] = None, # not used + headers: HeaderTypes | None = None, + **kwargs, + ) -> Response: ... + + @overload + async def create( + self, + bucket_name: StrictStr, + *, + json: SubscriptionConfig, + query: CreateQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Model: ... + + @overload + async def create( + self, + bucket_name: StrictStr, + *, + json: SubscriptionConfig, + query: CreateQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + async def create( + self, + bucket_name: StrictStr, + *, + json: SubscriptionConfig, + query: CreateQuery | QueryParamTypes | None = None, + raw_response: StrictBool = False, + select_path: str = "", + response_type: T | None = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> SubscriptionConfig | T | Response | Model: + """Create Bucket Subscription. + + Create a new notification subscription on a bucket with a given or generated id. + :param bucket_name: (required) + :type bucket_name: str + :param json: The json request body. + :type json: SubscriptionConfig, optional + :param query: URL Query parameters. + :type query: CreateQuery | QueryParamTypes, optional + :param query['store'] (dict)
query.store (Query) : + :type query['store']: str + :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. + :param select_path: Denotes the json path applied to the response object before returning it. + Set it to the empty string `""` to receive the full response object. + :param response_type: If specified, the response is parsed into an instance of the specified type. + :param headers: Header parameters for this request + :type headers: dict, optional + :param `**kwargs`: Additional parameters passed on to the http client. + See below. + :Keyword Arguments: + * timeout: a single numeric timeout in seconds, + or a tuple of _connect_, _read_, _write_ and _pool_ timeouts. + * stream: if true, the response will be in streaming mode + * cookies + * extensions + * auth + * follow_redirects: bool + + :return: Returns the result object if the http request succeeded with status code '2XX'. + :raises APIError: If the http request has a status code different from `2XX`. This + object wraps both the http Response and any parsed data. + """ + + should_validate = ( + MODELS_AVAILABLE and self.api_client.config.client_side_validation + ) + + # path parameters + path_params: Dict[str, str] = { + "bucket_name": str(bucket_name), + } + + ## named body parameters + body_args: Dict[str, Any] = {} + if json is not None and should_validate: + body_adapter = TypeAdapter(SubscriptionConfig) + json = body_adapter.validate_python(json) # type: ignore # https://github.com/pydantic/pydantic/discussions/7094 + body_args["json"] = json + + # query parameters + if query is not None and should_validate: + query = TypeAdapter(CreateQuery).validate_python(query) + + response_types_map: Dict[str, Any] = ( + {"2XX": response_type} + if response_type is not None + else { + "200": SubscriptionConfig if not select_path else Model, + } + ) + non_200_response_types_map: Dict[str, Any] = { + "422": HTTPValidationError, + } + response_types_map.update(non_200_response_types_map) + + ## peform request + return await self.api_client.request( + method="POST", + resource_path="/storage/v1/subscription/{bucket_name}", + path_params=path_params, + params=query, + **body_args, + headers=headers, + **kwargs, + response_type=response_types_map, + select_path=select_path, + raw_response=raw_response, + ) + + @overload + async def delete_by( + self, + bucket_name: StrictStr, + *, + query: DeleteByQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> HALEntity: ... + + @overload + async def delete_by( + self, + bucket_name: StrictStr, + *, + query: DeleteByQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + @overload + async def delete_by( + self, + bucket_name: StrictStr, + *, + query: DeleteByQuery | QueryParamTypes | None = None, + raw_response: Literal[True], + select_path: Literal["_not_used_"] = "_not_used_", + response_type: Literal[None] = None, # not used + headers: HeaderTypes | None = None, + **kwargs, + ) -> Response: ... + + @overload + async def delete_by( + self, + bucket_name: StrictStr, + *, + query: DeleteByQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Model: ... + + @overload + async def delete_by( + self, + bucket_name: StrictStr, + *, + query: DeleteByQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + async def delete_by( + self, + bucket_name: StrictStr, + *, + query: DeleteByQuery | QueryParamTypes | None = None, + raw_response: StrictBool = False, + select_path: str = "", + response_type: T | None = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> HALEntity | T | Response | Model: + """Delete All Bucket Subscriptions. + + Remove all notification subscription on a bucket that match a given event and/or channel filter. + :param bucket_name: (required) + :type bucket_name: str + :param query: URL Query parameters. + :type query: DeleteByQuery | QueryParamTypes, optional + :param query['start_after'] (dict)
query.start_after (Query) : + :type query['start_after']: str + :param query['prefix'] (dict)
query.prefix (Query) : + :type query['prefix']: str + :param query['suffix'] (dict)
query.suffix (Query) : + :type query['suffix']: str + :param query['event_type'] (dict)
query.event_type (Query) : + :type query['event_type']: VENTTYPE + :param query['channel_type'] (dict)
query.channel_type (Query) : + :type query['channel_type']: CHANNELTYPE + :param query['channel_id'] (dict)
query.channel_id (Query) : + :type query['channel_id']: str + :param query['store'] (dict)
query.store (Query) : + :type query['store']: str + :param query['max_keys'] (dict)
query.max_keys (Query) : + :type query['max_keys']: int + :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. + :param select_path: Denotes the json path applied to the response object before returning it. + Set it to the empty string `""` to receive the full response object. + :param response_type: If specified, the response is parsed into an instance of the specified type. + :param headers: Header parameters for this request + :type headers: dict, optional + :param `**kwargs`: Additional parameters passed on to the http client. + See below. + :Keyword Arguments: + * timeout: a single numeric timeout in seconds, + or a tuple of _connect_, _read_, _write_ and _pool_ timeouts. + * stream: if true, the response will be in streaming mode + * cookies + * extensions + * auth + * follow_redirects: bool + + :return: Returns the result object if the http request succeeded with status code '2XX'. + :raises APIError: If the http request has a status code different from `2XX`. This + object wraps both the http Response and any parsed data. + """ + + should_validate = ( + MODELS_AVAILABLE and self.api_client.config.client_side_validation + ) + + # path parameters + path_params: Dict[str, str] = { + "bucket_name": str(bucket_name), + } + + ## named body parameters + body_args: Dict[str, Any] = {} + + # query parameters + if query is not None and should_validate: + query = TypeAdapter(DeleteByQuery).validate_python(query) + + response_types_map: Dict[str, Any] = ( + {"2XX": response_type} + if response_type is not None + else { + "200": HALEntity if not select_path else Model, + } + ) + non_200_response_types_map: Dict[str, Any] = { + "422": HTTPValidationError, + } + response_types_map.update(non_200_response_types_map) + + ## peform request + return await self.api_client.request( + method="DELETE", + resource_path="/storage/v1/subscription/{bucket_name}", + path_params=path_params, + params=query, + **body_args, + headers=headers, + **kwargs, + response_type=response_types_map, + select_path=select_path, + raw_response=raw_response, + ) + + @overload + async def get( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + query: GetQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> SubscriptionConfig: ... + + @overload + async def get( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + query: GetQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + @overload + async def get( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + query: GetQuery | QueryParamTypes | None = None, + raw_response: Literal[True], + select_path: Literal["_not_used_"] = "_not_used_", + response_type: Literal[None] = None, # not used + headers: HeaderTypes | None = None, + **kwargs, + ) -> Response: ... + + @overload + async def get( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + query: GetQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Model: ... + + @overload + async def get( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + query: GetQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + async def get( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + query: GetQuery | QueryParamTypes | None = None, + raw_response: StrictBool = False, + select_path: str = "", + response_type: T | None = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> SubscriptionConfig | T | Response | Model: + """Get Bucket Subscription. + + Fetch a notification subscription. + :param bucket_name: (required) + :type bucket_name: str + :param subscription_id: (required) + :type subscription_id: str + :param query: URL Query parameters. + :type query: GetQuery | QueryParamTypes, optional + :param query['store'] (dict)
query.store (Query) : + :type query['store']: str + :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. + :param select_path: Denotes the json path applied to the response object before returning it. + Set it to the empty string `""` to receive the full response object. + :param response_type: If specified, the response is parsed into an instance of the specified type. + :param headers: Header parameters for this request + :type headers: dict, optional + :param `**kwargs`: Additional parameters passed on to the http client. + See below. + :Keyword Arguments: + * timeout: a single numeric timeout in seconds, + or a tuple of _connect_, _read_, _write_ and _pool_ timeouts. + * stream: if true, the response will be in streaming mode + * cookies + * extensions + * auth + * follow_redirects: bool + + :return: Returns the result object if the http request succeeded with status code '2XX'. + :raises APIError: If the http request has a status code different from `2XX`. This + object wraps both the http Response and any parsed data. + """ + + should_validate = ( + MODELS_AVAILABLE and self.api_client.config.client_side_validation + ) + + # path parameters + path_params: Dict[str, str] = { + "bucket_name": str(bucket_name), + "subscription_id": str(subscription_id), + } + + ## named body parameters + body_args: Dict[str, Any] = {} + + # query parameters + if query is not None and should_validate: + query = TypeAdapter(GetQuery).validate_python(query) + + response_types_map: Dict[str, Any] = ( + {"2XX": response_type} + if response_type is not None + else { + "200": SubscriptionConfig if not select_path else Model, + } + ) + non_200_response_types_map: Dict[str, Any] = { + "422": HTTPValidationError, + } + response_types_map.update(non_200_response_types_map) + + ## peform request + return await self.api_client.request( + method="GET", + resource_path="/storage/v1/subscription/{bucket_name}/{subscription_id}", + path_params=path_params, + params=query, + **body_args, + headers=headers, + **kwargs, + response_type=response_types_map, + select_path=select_path, + raw_response=raw_response, + ) + + @overload + async def list( + self, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> SubscriptionsListing: ... + + @overload + async def list( + self, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + @overload + async def list( + self, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: Literal[True], + select_path: Literal["_not_used_"] = "_not_used_", + response_type: Literal[None] = None, # not used + headers: HeaderTypes | None = None, + **kwargs, + ) -> Response: ... + + @overload + async def list( + self, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Model: ... + + @overload + async def list( + self, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + async def list( + self, + *, + query: ListQuery | QueryParamTypes | None = None, + raw_response: StrictBool = False, + select_path: str = "", + response_type: T | None = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> SubscriptionsListing | T | Response | Model: + """Query All Subscriptions. + + List notification subscriptions per bucket that have notification enabled. + :param query: URL Query parameters. + :type query: ListQuery | QueryParamTypes, optional + :param query['store'] (dict)
query.store (Query) : + :type query['store']: str + :param query['prefix'] (dict)
query.prefix (Query) : + :type query['prefix']: str + :param query['suffix'] (dict)
query.suffix (Query) : + :type query['suffix']: str + :param query['event_type'] (dict)
query.event_type (Query) : + :type query['event_type']: VENTTYPE + :param query['channel_type'] (dict)
query.channel_type (Query) : + :type query['channel_type']: CHANNELTYPE + :param query['channel_id'] (dict)
query.channel_id (Query) : + :type query['channel_id']: str + :param query['max_keys'] (dict)
query.max_keys (Query) : + :type query['max_keys']: int + :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. + :param select_path: Denotes the json path applied to the response object before returning it. + Set it to the empty string `""` to receive the full response object. + :param response_type: If specified, the response is parsed into an instance of the specified type. + :param headers: Header parameters for this request + :type headers: dict, optional + :param `**kwargs`: Additional parameters passed on to the http client. + See below. + :Keyword Arguments: + * timeout: a single numeric timeout in seconds, + or a tuple of _connect_, _read_, _write_ and _pool_ timeouts. + * stream: if true, the response will be in streaming mode + * cookies + * extensions + * auth + * follow_redirects: bool + + :return: Returns the result object if the http request succeeded with status code '2XX'. + :raises APIError: If the http request has a status code different from `2XX`. This + object wraps both the http Response and any parsed data. + """ + + should_validate = ( + MODELS_AVAILABLE and self.api_client.config.client_side_validation + ) + + # path parameters + path_params: Dict[str, str] = {} + + ## named body parameters + body_args: Dict[str, Any] = {} + + # query parameters + if query is not None and should_validate: + query = TypeAdapter(ListQuery).validate_python(query) + + response_types_map: Dict[str, Any] = ( + {"2XX": response_type} + if response_type is not None + else { + "200": SubscriptionsListing if not select_path else Model, + } + ) + non_200_response_types_map: Dict[str, Any] = { + "422": HTTPValidationError, + } + response_types_map.update(non_200_response_types_map) + + ## peform request + return await self.api_client.request( + method="GET", + resource_path="/storage/v1/subscription", + path_params=path_params, + params=query, + **body_args, + headers=headers, + **kwargs, + response_type=response_types_map, + select_path=select_path, + raw_response=raw_response, + ) + + @overload + async def query( + self, + bucket_name: StrictStr, + *, + query: QueryQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Subscriptions: ... + + @overload + async def query( + self, + bucket_name: StrictStr, + *, + query: QueryQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + @overload + async def query( + self, + bucket_name: StrictStr, + *, + query: QueryQuery | QueryParamTypes | None = None, + raw_response: Literal[True], + select_path: Literal["_not_used_"] = "_not_used_", + response_type: Literal[None] = None, # not used + headers: HeaderTypes | None = None, + **kwargs, + ) -> Response: ... + + @overload + async def query( + self, + bucket_name: StrictStr, + *, + query: QueryQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Model: ... + + @overload + async def query( + self, + bucket_name: StrictStr, + *, + query: QueryQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + async def query( + self, + bucket_name: StrictStr, + *, + query: QueryQuery | QueryParamTypes | None = None, + raw_response: StrictBool = False, + select_path: str = "", + response_type: T | None = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Subscriptions | T | Response | Model: + """Query Bucket Subscriptions. + + List notification subscriptions for given bucket. + :param bucket_name: (required) + :type bucket_name: str + :param query: URL Query parameters. + :type query: QueryQuery | QueryParamTypes, optional + :param query['start_after'] (dict)
query.start_after (Query) : + :type query['start_after']: str + :param query['store'] (dict)
query.store (Query) : + :type query['store']: str + :param query['prefix'] (dict)
query.prefix (Query) : + :type query['prefix']: str + :param query['suffix'] (dict)
query.suffix (Query) : + :type query['suffix']: str + :param query['event_type'] (dict)
query.event_type (Query) : + :type query['event_type']: VENTTYPE + :param query['channel_type'] (dict)
query.channel_type (Query) : + :type query['channel_type']: CHANNELTYPE + :param query['channel_id'] (dict)
query.channel_id (Query) : + :type query['channel_id']: str + :param query['max_keys'] (dict)
query.max_keys (Query) : + :type query['max_keys']: int + :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. + :param select_path: Denotes the json path applied to the response object before returning it. + Set it to the empty string `""` to receive the full response object. + :param response_type: If specified, the response is parsed into an instance of the specified type. + :param headers: Header parameters for this request + :type headers: dict, optional + :param `**kwargs`: Additional parameters passed on to the http client. + See below. + :Keyword Arguments: + * timeout: a single numeric timeout in seconds, + or a tuple of _connect_, _read_, _write_ and _pool_ timeouts. + * stream: if true, the response will be in streaming mode + * cookies + * extensions + * auth + * follow_redirects: bool + + :return: Returns the result object if the http request succeeded with status code '2XX'. + :raises APIError: If the http request has a status code different from `2XX`. This + object wraps both the http Response and any parsed data. + """ + + should_validate = ( + MODELS_AVAILABLE and self.api_client.config.client_side_validation + ) + + # path parameters + path_params: Dict[str, str] = { + "bucket_name": str(bucket_name), + } + + ## named body parameters + body_args: Dict[str, Any] = {} + + # query parameters + if query is not None and should_validate: + query = TypeAdapter(QueryQuery).validate_python(query) + + response_types_map: Dict[str, Any] = ( + {"2XX": response_type} + if response_type is not None + else { + "200": Subscriptions if not select_path else Model, + } + ) + non_200_response_types_map: Dict[str, Any] = { + "422": HTTPValidationError, + } + response_types_map.update(non_200_response_types_map) + + ## peform request + return await self.api_client.request( + method="GET", + resource_path="/storage/v1/subscription/{bucket_name}", + path_params=path_params, + params=query, + **body_args, + headers=headers, + **kwargs, + response_type=response_types_map, + select_path=select_path, + raw_response=raw_response, + ) + + @overload + async def remove( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + query: RemoveQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> HALEntity: ... + + @overload + async def remove( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + query: RemoveQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + @overload + async def remove( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + query: RemoveQuery | QueryParamTypes | None = None, + raw_response: Literal[True], + select_path: Literal["_not_used_"] = "_not_used_", + response_type: Literal[None] = None, # not used + headers: HeaderTypes | None = None, + **kwargs, + ) -> Response: ... + + @overload + async def remove( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + query: RemoveQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Model: ... + + @overload + async def remove( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + query: RemoveQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + async def remove( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + query: RemoveQuery | QueryParamTypes | None = None, + raw_response: StrictBool = False, + select_path: str = "", + response_type: T | None = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> HALEntity | T | Response | Model: + """Delete Bucket Subscription. + + Remove a notification subscription. + :param bucket_name: (required) + :type bucket_name: str + :param subscription_id: (required) + :type subscription_id: str + :param query: URL Query parameters. + :type query: RemoveQuery | QueryParamTypes, optional + :param query['store'] (dict)
query.store (Query) : + :type query['store']: str + :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. + :param select_path: Denotes the json path applied to the response object before returning it. + Set it to the empty string `""` to receive the full response object. + :param response_type: If specified, the response is parsed into an instance of the specified type. + :param headers: Header parameters for this request + :type headers: dict, optional + :param `**kwargs`: Additional parameters passed on to the http client. + See below. + :Keyword Arguments: + * timeout: a single numeric timeout in seconds, + or a tuple of _connect_, _read_, _write_ and _pool_ timeouts. + * stream: if true, the response will be in streaming mode + * cookies + * extensions + * auth + * follow_redirects: bool + + :return: Returns the result object if the http request succeeded with status code '2XX'. + :raises APIError: If the http request has a status code different from `2XX`. This + object wraps both the http Response and any parsed data. + """ + + should_validate = ( + MODELS_AVAILABLE and self.api_client.config.client_side_validation + ) + + # path parameters + path_params: Dict[str, str] = { + "bucket_name": str(bucket_name), + "subscription_id": str(subscription_id), + } + + ## named body parameters + body_args: Dict[str, Any] = {} + + # query parameters + if query is not None and should_validate: + query = TypeAdapter(RemoveQuery).validate_python(query) + + response_types_map: Dict[str, Any] = ( + {"2XX": response_type} + if response_type is not None + else { + "200": HALEntity if not select_path else Model, + } + ) + non_200_response_types_map: Dict[str, Any] = { + "422": HTTPValidationError, + } + response_types_map.update(non_200_response_types_map) + + ## peform request + return await self.api_client.request( + method="DELETE", + resource_path="/storage/v1/subscription/{bucket_name}/{subscription_id}", + path_params=path_params, + params=query, + **body_args, + headers=headers, + **kwargs, + response_type=response_types_map, + select_path=select_path, + raw_response=raw_response, + ) + + @overload + async def replace( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + json: SubscriptionConfig, + query: ReplaceQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> SubscriptionConfig: ... + + @overload + async def replace( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + json: SubscriptionConfig, + query: ReplaceQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: Literal[""] = "", + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + @overload + async def replace( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + json: SubscriptionConfig, + query: ReplaceQuery | QueryParamTypes | None = None, + raw_response: Literal[True], + select_path: Literal["_not_used_"] = "_not_used_", + response_type: Literal[None] = None, # not used + headers: HeaderTypes | None = None, + **kwargs, + ) -> Response: ... + + @overload + async def replace( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + json: SubscriptionConfig, + query: ReplaceQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: Literal[None] = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> Model: ... + + @overload + async def replace( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + json: SubscriptionConfig, + query: ReplaceQuery | QueryParamTypes | None = None, + raw_response: Literal[False] = False, + select_path: str, + response_type: T, + headers: HeaderTypes | None = None, + **kwargs, + ) -> T: ... + + async def replace( + self, + bucket_name: StrictStr, + subscription_id: StrictStr, + *, + json: SubscriptionConfig, + query: ReplaceQuery | QueryParamTypes | None = None, + raw_response: StrictBool = False, + select_path: str = "", + response_type: T | None = None, + headers: HeaderTypes | None = None, + **kwargs, + ) -> SubscriptionConfig | T | Response | Model: + """Replace Bucket Subscription. + + Create or replace a notification subscription on a bucket with a given id. + :param bucket_name: (required) + :type bucket_name: str + :param subscription_id: (required) + :type subscription_id: str + :param json: The json request body. + :type json: SubscriptionConfig, optional + :param query: URL Query parameters. + :type query: ReplaceQuery | QueryParamTypes, optional + :param query['store'] (dict)
query.store (Query) : + :type query['store']: str + :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. + :param select_path: Denotes the json path applied to the response object before returning it. + Set it to the empty string `""` to receive the full response object. + :param response_type: If specified, the response is parsed into an instance of the specified type. + :param headers: Header parameters for this request + :type headers: dict, optional + :param `**kwargs`: Additional parameters passed on to the http client. + See below. + :Keyword Arguments: + * timeout: a single numeric timeout in seconds, + or a tuple of _connect_, _read_, _write_ and _pool_ timeouts. + * stream: if true, the response will be in streaming mode + * cookies + * extensions + * auth + * follow_redirects: bool + + :return: Returns the result object if the http request succeeded with status code '2XX'. + :raises APIError: If the http request has a status code different from `2XX`. This + object wraps both the http Response and any parsed data. + """ + + should_validate = ( + MODELS_AVAILABLE and self.api_client.config.client_side_validation + ) + + # path parameters + path_params: Dict[str, str] = { + "bucket_name": str(bucket_name), + "subscription_id": str(subscription_id), + } + + ## named body parameters + body_args: Dict[str, Any] = {} + if json is not None and should_validate: + body_adapter = TypeAdapter(SubscriptionConfig) + json = body_adapter.validate_python(json) # type: ignore # https://github.com/pydantic/pydantic/discussions/7094 + body_args["json"] = json + + # query parameters + if query is not None and should_validate: + query = TypeAdapter(ReplaceQuery).validate_python(query) + + response_types_map: Dict[str, Any] = ( + {"2XX": response_type} + if response_type is not None + else { + "200": SubscriptionConfig if not select_path else Model, + } + ) + non_200_response_types_map: Dict[str, Any] = { + "422": HTTPValidationError, + } + response_types_map.update(non_200_response_types_map) + + ## peform request + return await self.api_client.request( + method="PUT", + resource_path="/storage/v1/subscription/{bucket_name}/{subscription_id}", + path_params=path_params, + params=query, + **body_args, + headers=headers, + **kwargs, + response_type=response_types_map, + select_path=select_path, + raw_response=raw_response, + ) diff --git a/waylay-sdk-storage/src/waylay/services/storage/service/__init__.py b/waylay-sdk-storage/src/waylay/services/storage/service/__init__.py new file mode 100644 index 0000000..007eef1 --- /dev/null +++ b/waylay-sdk-storage/src/waylay/services/storage/service/__init__.py @@ -0,0 +1,24 @@ +# coding: utf-8 +"""Waylay Storage: Service. + +This code was generated from the OpenAPI documentation of 'Waylay Storage' + +version: 0.4.1 + + Manage storage buckets and subscriptions. + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +__version__ = "0.4.1" + +from .service import StorageService + +PLUGINS = [StorageService] + +__all__ = [ + "__version__", + "StorageService", +] diff --git a/waylay-sdk-storage/src/waylay/services/storage/service/py.typed b/waylay-sdk-storage/src/waylay/services/storage/service/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/waylay-sdk-storage/src/waylay/services/storage/service/service.py b/waylay-sdk-storage/src/waylay/services/storage/service/service.py new file mode 100644 index 0000000..3ad406d --- /dev/null +++ b/waylay-sdk-storage/src/waylay/services/storage/service/service.py @@ -0,0 +1,29 @@ +"""Storage Service.""" + +from waylay.sdk import ApiClient, WaylayService + +from ..api.about_api import AboutApi +from ..api.bucket_api import BucketApi +from ..api.object_api import ObjectApi +from ..api.subscription_api import SubscriptionApi + + +class StorageService(WaylayService): + """Storage Service Class.""" + + name = "storage" + title = "Storage Service" + + about: AboutApi + bucket: BucketApi + object: ObjectApi + subscription: SubscriptionApi + + def __init__(self, api_client: ApiClient): + """Create the storage service.""" + + super().__init__(api_client) + self.about = AboutApi(api_client) + self.bucket = BucketApi(api_client) + self.object = ObjectApi(api_client) + self.subscription = SubscriptionApi(api_client)