├── docs ├── .nojekyll ├── objects.inv ├── _static │ ├── file.png │ ├── plus.png │ ├── minus.png │ ├── fonts │ │ ├── RobotoSlab │ │ │ ├── NOTICE │ │ │ ├── roboto-slab-v7-bold.eot │ │ │ ├── roboto-slab-v7-bold.ttf │ │ │ ├── roboto-slab-v7-bold.woff │ │ │ ├── roboto-slab-v7-bold.woff2 │ │ │ ├── roboto-slab-v7-regular.eot │ │ │ ├── roboto-slab-v7-regular.ttf │ │ │ ├── roboto-slab-v7-regular.woff │ │ │ ├── roboto-slab-v7-regular.woff2 │ │ │ └── LICENSE │ │ ├── Lato │ │ │ ├── lato-bold.eot │ │ │ ├── lato-bold.ttf │ │ │ ├── lato-bold.woff │ │ │ ├── lato-bold.woff2 │ │ │ ├── lato-italic.eot │ │ │ ├── lato-italic.ttf │ │ │ ├── lato-italic.woff │ │ │ ├── lato-italic.woff2 │ │ │ ├── lato-regular.eot │ │ │ ├── lato-regular.ttf │ │ │ ├── lato-regular.woff │ │ │ ├── lato-bolditalic.eot │ │ │ ├── lato-bolditalic.ttf │ │ │ ├── lato-regular.woff2 │ │ │ ├── lato-bolditalic.woff │ │ │ ├── lato-bolditalic.woff2 │ │ │ └── LICENSE │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ ├── fontawesome-webfont.woff2 │ │ └── LICENSE │ ├── documentation_options.js │ ├── css │ │ └── badge_only.css │ ├── js │ │ └── theme.js │ ├── pygments.css │ ├── doctools.js │ └── language_data.js ├── _sources │ ├── _apidoc │ │ ├── modules.rst.txt │ │ ├── example.example.rst.txt │ │ ├── example.benchmarker.rst.txt │ │ ├── stream_manager.data.rst.txt │ │ ├── stream_manager.util.rst.txt │ │ ├── stream_manager.exceptions.rst.txt │ │ ├── stream_manager.utilinternal.rst.txt │ │ ├── stream_manager.streammanagerclient.rst.txt │ │ ├── example.rst.txt │ │ └── stream_manager.rst.txt │ └── index.rst.txt ├── .buildinfo ├── search.html ├── index.html ├── _modules │ ├── index.html │ ├── stream_manager │ │ ├── util.html │ │ └── exceptions.html │ └── example │ │ └── example.html ├── _apidoc │ ├── example.html │ ├── example.example.html │ ├── stream_manager.html │ ├── modules.html │ ├── example.benchmarker.html │ ├── stream_manager.util.html │ └── stream_manager.utilinternal.html └── py-modindex.html ├── requirements.txt ├── setup.cfg ├── MANIFEST.in ├── NOTICE ├── CHANGELOG.rst ├── stream_manager ├── __init__.py ├── util.py ├── exceptions.py └── utilinternal.py ├── setup.py ├── README.md ├── samples ├── stream_manager_ioT_siteWise.py ├── stream_manager_kinesis.py └── stream_manager_s3.py └── LICENSE /docs/.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | cbor2~=5.4.2 2 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal = 1 3 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.txt *.py 2 | recursive-include *.txt *.py -------------------------------------------------------------------------------- /docs/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/objects.inv -------------------------------------------------------------------------------- /docs/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/file.png -------------------------------------------------------------------------------- /docs/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/plus.png -------------------------------------------------------------------------------- /docs/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/minus.png -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/NOTICE: -------------------------------------------------------------------------------- 1 | RobotoSlab[wght].ttf: Copyright 2018 The Roboto Slab Project Authors (https://github.com/googlefonts/robotoslab) -------------------------------------------------------------------------------- /docs/_sources/_apidoc/modules.rst.txt: -------------------------------------------------------------------------------- 1 | API Reference 2 | ============= 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | 7 | example 8 | stream_manager 9 | -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-bold.eot -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-bold.ttf -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-bold.woff -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-bold.woff2 -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-italic.eot -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-italic.ttf -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-italic.woff -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-italic.woff2 -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-regular.eot -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-regular.ttf -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-regular.woff -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bolditalic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-bolditalic.eot -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bolditalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-bolditalic.ttf -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-regular.woff2 -------------------------------------------------------------------------------- /docs/_static/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/_static/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /docs/_static/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bolditalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-bolditalic.woff -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bolditalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/Lato/lato-bolditalic.woff2 -------------------------------------------------------------------------------- /docs/_static/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf -------------------------------------------------------------------------------- /docs/_sources/index.rst.txt: -------------------------------------------------------------------------------- 1 | .. include:: 2 | ../resources/README.rst 3 | 4 | API Documentation 5 | ================= 6 | * :doc:`stream_manager <_apidoc/stream_manager>` 7 | * :ref:`genindex` 8 | -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf -------------------------------------------------------------------------------- /docs/_sources/_apidoc/example.example.rst.txt: -------------------------------------------------------------------------------- 1 | example.example module 2 | ====================== 3 | 4 | .. automodule:: example.example 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 -------------------------------------------------------------------------------- /docs/_sources/_apidoc/example.benchmarker.rst.txt: -------------------------------------------------------------------------------- 1 | example.benchmarker module 2 | ========================== 3 | 4 | .. automodule:: example.benchmarker 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/_sources/_apidoc/stream_manager.data.rst.txt: -------------------------------------------------------------------------------- 1 | stream\_manager.data package 2 | ============================ 3 | 4 | .. automodule:: stream_manager.data 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/_sources/_apidoc/stream_manager.util.rst.txt: -------------------------------------------------------------------------------- 1 | stream\_manager.util module 2 | =========================== 3 | 4 | .. automodule:: stream_manager.util 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/_sources/_apidoc/stream_manager.exceptions.rst.txt: -------------------------------------------------------------------------------- 1 | stream\_manager.exceptions module 2 | ================================= 3 | 4 | .. automodule:: stream_manager.exceptions 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | AWS Greengrass Stream Manager SDK for Python 2 | Copyright 2019-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | 4 | This product includes software developed at 5 | Amazon Web Services, Inc. (http://aws.amazon.com/). 6 | 7 | -------------------------------------------------------------------------------- /docs/_sources/_apidoc/stream_manager.utilinternal.rst.txt: -------------------------------------------------------------------------------- 1 | stream\_manager.utilinternal module 2 | =================================== 3 | 4 | .. automodule:: stream_manager.utilinternal 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: 0f8fa7192fab67dc409482e6501c4d21 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /docs/_sources/_apidoc/stream_manager.streammanagerclient.rst.txt: -------------------------------------------------------------------------------- 1 | stream\_manager.streammanagerclient module 2 | ========================================== 3 | 4 | .. automodule:: stream_manager.streammanagerclient 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/_sources/_apidoc/example.rst.txt: -------------------------------------------------------------------------------- 1 | example package 2 | =============== 3 | 4 | .. automodule:: example 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | 9 | Submodules 10 | ---------- 11 | 12 | .. toctree:: 13 | :maxdepth: 4 14 | 15 | example.benchmarker 16 | example.example 17 | -------------------------------------------------------------------------------- /docs/_static/documentation_options.js: -------------------------------------------------------------------------------- 1 | var DOCUMENTATION_OPTIONS = { 2 | URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), 3 | VERSION: '1.1.1', 4 | LANGUAGE: 'None', 5 | COLLAPSE_INDEX: false, 6 | BUILDER: 'html', 7 | FILE_SUFFIX: '.html', 8 | LINK_SUFFIX: '.html', 9 | HAS_SOURCE: true, 10 | SOURCELINK_SUFFIX: '.txt', 11 | NAVIGATION_WITH_KEYS: false 12 | }; -------------------------------------------------------------------------------- /CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ========= 2 | CHANGELOG 3 | ========= 4 | 5 | 1.1.1 6 | ===== 7 | - Stream manager client is now a context manager, enabling it to be used with the Python `with` statement. 8 | - Bump cbor2 dependency version to support Python 3.10. 9 | - Update usage of asyncio to support Python 3.10. 10 | 11 | 1.1.0 12 | ===== 13 | Stream manager supports automatic data export to AWS S3 and AWS IoT SiteWise, provides new API method to update existing streams, and pause or resume exporting. 14 | -------------------------------------------------------------------------------- /docs/_sources/_apidoc/stream_manager.rst.txt: -------------------------------------------------------------------------------- 1 | stream\_manager package 2 | ======================= 3 | 4 | .. automodule:: stream_manager 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | 9 | Subpackages 10 | ----------- 11 | 12 | .. toctree:: 13 | :maxdepth: 4 14 | 15 | stream_manager.data 16 | 17 | Submodules 18 | ---------- 19 | 20 | .. toctree:: 21 | :maxdepth: 4 22 | 23 | stream_manager.exceptions 24 | stream_manager.streammanagerclient 25 | stream_manager.util 26 | stream_manager.utilinternal 27 | -------------------------------------------------------------------------------- /stream_manager/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | SPDX-License-Identifier: Apache-2.0 4 | """ 5 | 6 | # Export public facing objects 7 | # flake8: noqa 8 | 9 | from .streammanagerclient import StreamManagerClient, SDK_VERSION 10 | from .exceptions import * 11 | from .util import Util 12 | from .data import ( 13 | ReadMessagesOptions, 14 | MessageStreamDefinition, 15 | ExportDefinition, 16 | StrategyOnFull, 17 | Persistence, 18 | HTTPConfig, 19 | IoTAnalyticsConfig, 20 | KinesisConfig, 21 | ExportFormat, 22 | # Status related 23 | # Config 24 | StatusConfig, 25 | # Data 26 | StatusContext, 27 | StatusLevel, 28 | EventType, 29 | Status, 30 | StatusMessage, 31 | # S3 Tasks related: 32 | # Config 33 | S3ExportTaskExecutorConfig, 34 | # Data 35 | S3ExportTaskDefinition, 36 | # Iot SiteWise related: 37 | # Config 38 | IoTSiteWiseConfig, 39 | # Data 40 | Variant, 41 | Quality, 42 | TimeInNanos, 43 | AssetPropertyValue, 44 | PutAssetPropertyValueEntry, 45 | ) 46 | -------------------------------------------------------------------------------- /stream_manager/util.py: -------------------------------------------------------------------------------- 1 | """ 2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | SPDX-License-Identifier: Apache-2.0 4 | """ 5 | 6 | import json 7 | 8 | from .exceptions import ValidationException 9 | from .utilinternal import UtilInternal 10 | 11 | 12 | """ 13 | Util functions exposed to the customers 14 | """ 15 | 16 | 17 | class Util: 18 | """ 19 | Validate And Serialize an instance of class to Json bytes. 20 | :param data: an instance object 21 | :return: a byte array. 22 | :raises: :ValidationException 23 | """ 24 | 25 | @staticmethod 26 | def validate_and_serialize_to_json_bytes(data): 27 | validation = UtilInternal.is_invalid(data) 28 | if validation: 29 | raise ValidationException(validation) 30 | return UtilInternal.serialize_to_json_with_empty_array_as_null(data) 31 | 32 | """ 33 | Deserialize the json byte array to an object 34 | :param :bytes byte array of data 35 | :param :type instance class type 36 | :return: an object. 37 | """ 38 | 39 | @staticmethod 40 | def deserialize_json_bytes_to_obj(bytes, type): 41 | return type.from_dict(json.loads(bytes)) 42 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | distutils/setuptools install script. 5 | """ 6 | import os 7 | import re 8 | 9 | from setuptools import setup, find_packages 10 | 11 | 12 | ROOT = os.path.dirname(__file__) 13 | VERSION_RE = re.compile(r'''SDK_VERSION = ['"]([0-9.]+)['"]''') 14 | 15 | 16 | requires = [ 17 | "cbor2~=5.4.2" 18 | ] 19 | 20 | 21 | def get_version(): 22 | init = open(os.path.join(ROOT,'stream_manager','streammanagerclient.py')).read() 23 | version = VERSION_RE.search(init).group(1) 24 | if os.getenv("PYPI_TEST", False) == "True": 25 | import time 26 | return version + "." + str(int(time.time())) 27 | return version 28 | 29 | 30 | setup( 31 | name='stream_manager', 32 | version=get_version(), 33 | description='The AWS IoT Greengrass Stream Manager SDK for Python', 34 | long_description=open('README.md').read(), 35 | long_description_content_type='text/markdown', 36 | author='Amazon Web Services', 37 | url='', 38 | scripts=[], 39 | packages=find_packages(), 40 | package_data={ 41 | 'stream_manager': [ 42 | ] 43 | }, 44 | include_package_data=True, 45 | install_requires=requires, 46 | license="Apache License 2.0", 47 | classifiers=[ 48 | 'Development Status :: 5 - Production/Stable', 49 | 'Intended Audience :: Developers', 50 | 'Natural Language :: English', 51 | 'License :: OSI Approved :: Apache Software License', 52 | 'Programming Language :: Python', 53 | 'Programming Language :: Python :: 3.7', 54 | 'Programming Language :: Python :: 3.8', 55 | 'Programming Language :: Python :: 3.9', 56 | 'Programming Language :: Python :: 3.10', 57 | ], 58 | ) 59 | -------------------------------------------------------------------------------- /stream_manager/exceptions.py: -------------------------------------------------------------------------------- 1 | """ 2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | SPDX-License-Identifier: Apache-2.0 4 | """ 5 | 6 | 7 | class StreamManagerException(Exception): 8 | def __init__(self, message="", status=None, request_id=None): 9 | super().__init__(message) 10 | self.status = status 11 | self.request_id = request_id 12 | self.message = message 13 | 14 | 15 | class ClientException(StreamManagerException): 16 | pass 17 | 18 | 19 | class ValidationException(ClientException): 20 | pass 21 | 22 | 23 | class ConnectFailedException(ClientException): 24 | pass 25 | 26 | 27 | class InvalidRequestException(StreamManagerException): 28 | pass 29 | 30 | 31 | class RequestPayloadTooLargeException(StreamManagerException): 32 | pass 33 | 34 | 35 | class ResourceNotFoundException(StreamManagerException): 36 | pass 37 | 38 | 39 | class ResponsePayloadTooLargeException(StreamManagerException): 40 | pass 41 | 42 | 43 | class ServerTimeoutException(StreamManagerException): 44 | pass 45 | 46 | 47 | class UnauthorizedException(StreamManagerException): 48 | pass 49 | 50 | 51 | class UnknownFailureException(StreamManagerException): 52 | pass 53 | 54 | 55 | class NotEnoughMessagesException(StreamManagerException): 56 | pass 57 | 58 | 59 | class MessageStoreReadErrorException(StreamManagerException): 60 | pass 61 | 62 | 63 | class ServerOutOfMemoryException(StreamManagerException): 64 | pass 65 | 66 | 67 | class UpdateFailedException(StreamManagerException): 68 | pass 69 | 70 | 71 | class UnknownOperationException(StreamManagerException): 72 | pass 73 | 74 | 75 | class UpdateNotAllowedException(InvalidRequestException): 76 | pass 77 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## AWS Greengrass Stream Manager SDK for Python 2 | 3 | The **AWS Greengrass Stream Manager SDK for Python** enables Python developers to manage data streams using [Stream 4 | Manager](https://docs.aws.amazon.com/greengrass/v2/developerguide/manage-data-streams.html) on AWS IoT Greengrass core. 5 | 6 | ## Overview 7 | 8 | This document provides instructions for preparing your Python code to manage Streams in Stream Manager using the Python 9 | SDK. 10 | 11 | ## Using Stream Manager Client to work with Streams 12 | 13 | Follow the guide [here](https://docs.aws.amazon.com/greengrass/v2/developerguide/work-with-streams.html) to work 14 | with Streams using the Stream Manager Client from the Stream Manager SDK. 15 | 16 | View Python SDK documentation [here](https://aws-greengrass.github.io/aws-greengrass-stream-manager-sdk-python/). 17 | 18 | ## Compatibility 19 | 20 | Stream Manager SDK provided by this repo is compatible with Stream Manager running on Greengrass Core 1.11 and above. 21 | 22 | ## Requirements 23 | 24 | This SDK has additional requirements. Specifically, Stream Manager SDK requires Python version 3.6 or above. It also 25 | has package requirements listed in the requirements.txt file. Please install these requirements. 26 | 27 | To install the requirements you can use pip such as :code:`pip install --user -r requirements.txt`. This will install 28 | the requirements to your Python path on the device. However if you are deploying the code to a device, you can bundle 29 | the requirements with your code. With the pip command above, the dependencies will be installed to the user 30 | site-packages directory. To find its location, use :code:`python -m site --user-site`. You can then simply copy the 31 | entire user site package directory contents into the final artifact before deploying which will ensure that the Stream 32 | Manager dependencies are present. 33 | 34 | ## Installation 35 | 36 | One way to install both stream-manager and its dependencies (i.e. cbor) is to run the following command: 37 | ```console 38 | pip3 install stream_manager 39 | ``` 40 | 41 | ## Getting Help 42 | 43 | * [Ask on AWS re:Post](https://repost.aws/) 44 | 45 | ## License 46 | 47 | Apache 2.0 48 | -------------------------------------------------------------------------------- /docs/_static/css/badge_only.css: -------------------------------------------------------------------------------- 1 | .fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-weight:normal;font-style:normal;src:url("../fonts/fontawesome-webfont.eot");src:url("../fonts/fontawesome-webfont.eot?#iefix") format("embedded-opentype"),url("../fonts/fontawesome-webfont.woff") format("woff"),url("../fonts/fontawesome-webfont.ttf") format("truetype"),url("../fonts/fontawesome-webfont.svg#FontAwesome") format("svg")}.fa:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa{display:inline-block;text-decoration:inherit}li .fa{display:inline-block}li .fa-large:before,li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-0.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before,ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before{content:""}.icon-book:before{content:""}.fa-caret-down:before{content:""}.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.icon-caret-up:before{content:""}.fa-caret-left:before{content:""}.icon-caret-left:before{content:""}.fa-caret-right:before{content:""}.icon-caret-right:before{content:""}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#2980B9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up{height:auto;max-height:100%}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}} 2 | -------------------------------------------------------------------------------- /samples/stream_manager_ioT_siteWise.py: -------------------------------------------------------------------------------- 1 | """ 2 | Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | SPDX-License-Identifier: Apache-2.0 4 | """ 5 | 6 | 7 | import asyncio 8 | import calendar 9 | import logging 10 | import random 11 | import time 12 | import uuid 13 | 14 | from stream_manager import ( 15 | AssetPropertyValue, 16 | ExportDefinition, 17 | IoTSiteWiseConfig, 18 | MessageStreamDefinition, 19 | PutAssetPropertyValueEntry, 20 | Quality, 21 | ResourceNotFoundException, 22 | StrategyOnFull, 23 | StreamManagerClient, 24 | TimeInNanos, 25 | Variant, 26 | ) 27 | from stream_manager.util import Util 28 | 29 | # This example will create a Greengrass StreamManager stream called "SomeStream". 30 | # It will then start writing data into that stream and StreamManager will 31 | # automatically export the written data to the customer-created property alias. 32 | # This example will run forever, until the program is killed. 33 | 34 | # The size of the StreamManager stream on disk will not exceed the default (which is 256 MB). 35 | # Any data appended after the stream reaches the size limit, will continue to be appended, and 36 | # StreamManager will delete the oldest data until the total stream size is back under 256MB. 37 | 38 | 39 | property_alias = "SomePropertyAlias" 40 | 41 | 42 | # This will create a random asset property value entry and return it to the caller. 43 | def get_random_site_wise_entry(): 44 | 45 | # SiteWise requires unique timestamps in all messages and also needs timstamps not earlier 46 | # than 10 minutes in the past. Add some randomness to time and offset. 47 | 48 | # Note: Inorder to create a new asset property data, you should use the classes defined in the 49 | # greengrasssdk.stream_manager module. 50 | 51 | time_in_nanos = TimeInNanos( 52 | time_in_seconds=calendar.timegm(time.gmtime()) - random.randint(0, 60), offset_in_nanos=random.randint(0, 10000) 53 | ) 54 | variant = Variant(double_value=random.random()) 55 | asset = [AssetPropertyValue(value=variant, quality=Quality.GOOD, timestamp=time_in_nanos)] 56 | return PutAssetPropertyValueEntry(entry_id=str(uuid.uuid4()), property_alias=property_alias, property_values=asset) 57 | 58 | 59 | def main(logger): 60 | try: 61 | stream_name = "SomeStream" 62 | client = StreamManagerClient() 63 | 64 | # Try deleting the stream (if it exists) so that we have a fresh start 65 | try: 66 | client.delete_message_stream(stream_name=stream_name) 67 | except ResourceNotFoundException: 68 | pass 69 | 70 | exports = ExportDefinition( 71 | iot_sitewise=[IoTSiteWiseConfig(identifier="IoTSiteWiseExport" + stream_name, batch_size=5)] 72 | ) 73 | client.create_message_stream( 74 | MessageStreamDefinition( 75 | name=stream_name, strategy_on_full=StrategyOnFull.OverwriteOldestData, export_definition=exports 76 | ) 77 | ) 78 | 79 | logger.info("Now going to start writing random IoTSiteWiseEntry to the stream") 80 | # Now start putting in random site wise entries. 81 | while True: 82 | logger.debug("Appending new random IoTSiteWiseEntry to stream") 83 | client.append_message(stream_name, Util.validate_and_serialize_to_json_bytes(get_random_site_wise_entry())) 84 | time.sleep(1) 85 | except asyncio.TimeoutError: 86 | print("Timed out") 87 | except Exception as e: 88 | print(e) 89 | print(type(e)) 90 | finally: 91 | if client: 92 | client.close() 93 | 94 | 95 | logging.basicConfig(level=logging.INFO) 96 | # Start up this sample code 97 | main(logger=logging.getLogger()) 98 | -------------------------------------------------------------------------------- /samples/stream_manager_kinesis.py: -------------------------------------------------------------------------------- 1 | """ 2 | Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | SPDX-License-Identifier: Apache-2.0 4 | """ 5 | 6 | 7 | import asyncio 8 | import logging 9 | import random 10 | import time 11 | 12 | from stream_manager import ( 13 | ExportDefinition, 14 | KinesisConfig, 15 | MessageStreamDefinition, 16 | ReadMessagesOptions, 17 | ResourceNotFoundException, 18 | StrategyOnFull, 19 | StreamManagerClient, 20 | ) 21 | 22 | # This example will create a Greengrass StreamManager stream called "SomeStream". 23 | # It will then start writing data into that stream and StreamManager will 24 | # automatically export the written data to a Kinesis Data Stream called "MyKinesisStream". 25 | # This example will run forever, until the program is killed. 26 | 27 | # The size of the StreamManager stream on disk will not exceed the default (which is 256 MB). 28 | # Any data appended after the stream reaches the size limit, will continue to be appended, and 29 | # StreamManager will delete the oldest data until the total stream size is back under 256MB. 30 | # The Kinesis Data Stream in the cloud has no such bound, so all the data from this script 31 | # will be uploaded to Kinesis and you will be charged for that usage. 32 | 33 | 34 | def main(logger): 35 | try: 36 | stream_name = "SomeStream" 37 | kinesis_stream_name = "MyKinesisStream" 38 | 39 | # Create a client for the StreamManager 40 | client = StreamManagerClient() 41 | 42 | # Try deleting the stream (if it exists) so that we have a fresh start 43 | try: 44 | client.delete_message_stream(stream_name=stream_name) 45 | except ResourceNotFoundException: 46 | pass 47 | 48 | exports = ExportDefinition( 49 | kinesis=[KinesisConfig(identifier="KinesisExport" + stream_name, kinesis_stream_name=kinesis_stream_name)] 50 | ) 51 | client.create_message_stream( 52 | MessageStreamDefinition( 53 | name=stream_name, strategy_on_full=StrategyOnFull.OverwriteOldestData, export_definition=exports 54 | ) 55 | ) 56 | 57 | # Append 2 messages and print their sequence numbers 58 | logger.info( 59 | "Successfully appended message to stream with sequence number %d", 60 | client.append_message(stream_name, "ABCDEFGHIJKLMNO".encode("utf-8")), 61 | ) 62 | logger.info( 63 | "Successfully appended message to stream with sequence number %d", 64 | client.append_message(stream_name, "PQRSTUVWXYZ".encode("utf-8")), 65 | ) 66 | 67 | # Try reading the 2 messages we just appended and print them out 68 | logger.info( 69 | "Successfully read 2 messages: %s", 70 | client.read_messages(stream_name, ReadMessagesOptions(min_message_count=2, read_timeout_millis=1000)), 71 | ) 72 | 73 | logger.info("Now going to start writing random integers between 0 and 1000 to the stream") 74 | # Now start putting in random data between 0 and 1000 to emulate device sensor input 75 | while True: 76 | logger.debug("Appending new random integer to stream") 77 | client.append_message(stream_name, random.randint(0, 1000).to_bytes(length=4, signed=True, byteorder="big")) 78 | time.sleep(1) 79 | 80 | except asyncio.TimeoutError: 81 | logger.exception("Timed out while executing") 82 | except Exception: 83 | logger.exception("Exception while running") 84 | finally: 85 | # Always close the client to avoid resource leaks 86 | if client: 87 | client.close() 88 | 89 | 90 | logging.basicConfig(level=logging.INFO) 91 | # Start up this sample code 92 | main(logger=logging.getLogger()) 93 | -------------------------------------------------------------------------------- /docs/_static/js/theme.js: -------------------------------------------------------------------------------- 1 | /* sphinx_rtd_theme version 0.4.0 | MIT license */ 2 | /* Built 20180606 11:06 */ 3 | require=function n(e,i,t){function o(s,a){if(!i[s]){if(!e[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(r)return r(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=i[s]={exports:{}};e[s][0].call(u.exports,function(n){var i=e[s][1][n];return o(i||n)},u,u.exports,n,e,i,t)}return i[s].exports}for(var r="function"==typeof require&&require,s=0;s"),n("table.docutils.footnote").wrap("
"),n("table.docutils.citation").wrap("
"),n(".wy-menu-vertical ul").not(".simple").siblings("a").each(function(){var i=n(this);expand=n(''),expand.on("click",function(n){return e.toggleCurrent(i),n.stopPropagation(),!1}),i.prepend(expand)})},reset:function(){var n=encodeURI(window.location.hash)||"#";try{var e=$(".wy-menu-vertical"),i=e.find('[href="'+n+'"]');if(0===i.length){var t=$('.document [id="'+n.substring(1)+'"]').closest("div.section");0===(i=e.find('[href="#'+t.attr("id")+'"]')).length&&(i=e.find('[href="#"]'))}i.length>0&&($(".wy-menu-vertical .current").removeClass("current"),i.addClass("current"),i.closest("li.toctree-l1").addClass("current"),i.closest("li.toctree-l1").parent().addClass("current"),i.closest("li.toctree-l1").addClass("current"),i.closest("li.toctree-l2").addClass("current"),i.closest("li.toctree-l3").addClass("current"),i.closest("li.toctree-l4").addClass("current"))}catch(o){console.log("Error expanding nav for anchor",o)}},onScroll:function(){this.winScroll=!1;var n=this.win.scrollTop(),e=n+this.winHeight,i=this.navBar.scrollTop()+(n-this.winPosition);n<0||e>this.docHeight||(this.navBar.scrollTop(i),this.winPosition=n)},onResize:function(){this.winResize=!1,this.winHeight=this.win.height(),this.docHeight=$(document).height()},hashChange:function(){this.linkScroll=!0,this.win.one("hashchange",function(){this.linkScroll=!1})},toggleCurrent:function(n){var e=n.closest("li");e.siblings("li.current").removeClass("current"),e.siblings().find("li.current").removeClass("current"),e.find("> ul li.current").removeClass("current"),e.toggleClass("current")}},"undefined"!=typeof window&&(window.SphinxRtdTheme={Navigation:e.exports.ThemeNav,StickyNav:e.exports.ThemeNav}),function(){for(var n=0,e=["ms","moz","webkit","o"],i=0;i 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Search — Greengrass Stream Manager Python SDK 1.1.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 | 90 | 91 |
92 | 93 | 94 | 100 | 101 | 102 |
103 | 104 |
105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 |
123 | 124 |
    125 | 126 |
  • Docs »
  • 127 | 128 |
  • Search
  • 129 | 130 | 131 |
  • 132 | 133 | 134 | 135 |
  • 136 | 137 |
138 | 139 | 140 |
141 |
142 |
143 |
144 | 145 | 153 | 154 | 155 |
156 | 157 |
158 | 159 |
160 | 161 |
162 |
163 | 164 | 165 |
166 | 167 |
168 |

169 | © Copyright 2022, Amazon.com. 170 | 171 |

172 |
173 | Built with Sphinx using a theme provided by Read the Docs. 174 | 175 |
176 | 177 |
178 |
179 | 180 |
181 | 182 |
183 | 184 | 185 | 186 | 187 | 188 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 213 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | API Documentation — Greengrass Stream Manager Python SDK 1.1.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 | 93 | 94 |
95 | 96 | 97 | 103 | 104 | 105 |
106 | 107 |
108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 |
126 | 127 |
    128 | 129 |
  • Docs »
  • 130 | 131 |
  • API Documentation
  • 132 | 133 | 134 |
  • 135 | 136 | 137 | View page source 138 | 139 | 140 |
  • 141 | 142 |
143 | 144 | 145 |
146 |
147 |
148 |
149 | 150 |
151 |

API Documentation

152 | 156 |
157 | 158 | 159 |
160 | 161 |
162 |
163 | 164 | 165 |
166 | 167 |
168 |

169 | © Copyright 2022, Amazon.com. 170 | 171 |

172 |
173 | Built with Sphinx using a theme provided by Read the Docs. 174 | 175 |
176 | 177 |
178 |
179 | 180 |
181 | 182 |
183 | 184 | 185 | 186 | 187 | 188 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 212 | 213 | 214 | -------------------------------------------------------------------------------- /docs/_modules/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Overview: module code — Greengrass Stream Manager Python SDK 1.1.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 | 90 | 91 |
92 | 93 | 94 | 100 | 101 | 102 |
103 | 104 |
105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 |
123 | 124 |
    125 | 126 |
  • Docs »
  • 127 | 128 |
  • Overview: module code
  • 129 | 130 | 131 |
  • 132 | 133 |
  • 134 | 135 |
136 | 137 | 138 |
139 |
140 |
141 |
142 | 143 |

All modules for which code is available

144 | 152 | 153 |
154 | 155 |
156 |
157 | 158 | 159 |
160 | 161 |
162 |

163 | © Copyright 2022, Amazon.com. 164 | 165 |

166 |
167 | Built with Sphinx using a theme provided by Read the Docs. 168 | 169 |
170 | 171 |
172 |
173 | 174 |
175 | 176 |
177 | 178 | 179 | 180 | 181 | 182 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 206 | 207 | 208 | -------------------------------------------------------------------------------- /docs/_apidoc/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | example package — Greengrass Stream Manager Python SDK 1.1.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 | 96 | 97 |
98 | 99 | 100 | 106 | 107 | 108 |
109 | 110 |
111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 |
129 | 130 |
    131 | 132 |
  • Docs »
  • 133 | 134 |
  • example package
  • 135 | 136 | 137 |
  • 138 | 139 | 140 | View page source 141 | 142 | 143 |
  • 144 | 145 |
146 | 147 | 148 |
149 |
150 |
151 |
152 | 153 |
154 |

example package

155 |

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 156 | SPDX-License-Identifier: Apache-2.0

157 |
158 |

Submodules

159 |
160 | 164 |
165 |
166 |
167 | 168 | 169 |
170 | 171 |
172 |
173 | 174 | 175 |
176 | 177 |
178 |

179 | © Copyright 2022, Amazon.com. 180 | 181 |

182 |
183 | Built with Sphinx using a theme provided by Read the Docs. 184 | 185 |
186 | 187 |
188 |
189 | 190 |
191 | 192 |
193 | 194 | 195 | 196 | 197 | 198 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 222 | 223 | 224 | -------------------------------------------------------------------------------- /docs/_apidoc/example.example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | example.example module — Greengrass Stream Manager Python SDK 1.1.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 | 93 | 94 |
95 | 96 | 97 | 103 | 104 | 105 |
106 | 107 |
108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 |
126 | 127 |
    128 | 129 |
  • Docs »
  • 130 | 131 |
  • example.example module
  • 132 | 133 | 134 |
  • 135 | 136 | 137 | View page source 138 | 139 | 140 |
  • 141 | 142 |
143 | 144 | 145 |
146 |
147 |
148 |
149 | 150 |
151 |

example.example module

152 |

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 153 | SPDX-License-Identifier: Apache-2.0

154 |
155 |
156 | example.example.main()[source]
157 |
158 | 159 |
160 | 161 | 162 |
163 | 164 |
165 |
166 | 167 | 168 |
169 | 170 |
171 |

172 | © Copyright 2022, Amazon.com. 173 | 174 |

175 |
176 | Built with Sphinx using a theme provided by Read the Docs. 177 | 178 |
179 | 180 |
181 |
182 | 183 |
184 | 185 |
186 | 187 | 188 | 189 | 190 | 191 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 215 | 216 | 217 | -------------------------------------------------------------------------------- /samples/stream_manager_s3.py: -------------------------------------------------------------------------------- 1 | """ 2 | Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | SPDX-License-Identifier: Apache-2.0 4 | """ 5 | 6 | 7 | import asyncio 8 | import logging 9 | import time 10 | 11 | from stream_manager import ( 12 | ExportDefinition, 13 | MessageStreamDefinition, 14 | ReadMessagesOptions, 15 | ResourceNotFoundException, 16 | S3ExportTaskDefinition, 17 | S3ExportTaskExecutorConfig, 18 | Status, 19 | StatusConfig, 20 | StatusLevel, 21 | StatusMessage, 22 | StrategyOnFull, 23 | StreamManagerClient, 24 | StreamManagerException, 25 | ) 26 | from stream_manager.util import Util 27 | 28 | # This example creates a local stream named "SomeStream", and a status stream named "SomeStatusStream. 29 | # It adds 1 S3 Export task into the "SomeStream" stream and then stream manager automatically exports 30 | # the data to a customer-created S3 bucket named "SomeBucket". 31 | # This example runs until the customer-created file at URL "SomeURL" has been uploaded to the S3 bucket. 32 | 33 | 34 | def main(logger): 35 | try: 36 | stream_name = "SomeStream" 37 | status_stream_name = "SomeStatusStreamName" 38 | bucket_name = "SomeBucket" 39 | key_name = "SomeKey" 40 | file_url = "file:/path/to/some/file.someExtension" 41 | client = StreamManagerClient() 42 | 43 | # Try deleting the status stream (if it exists) so that we have a fresh start 44 | try: 45 | client.delete_message_stream(stream_name=status_stream_name) 46 | except ResourceNotFoundException: 47 | pass 48 | 49 | # Try deleting the stream (if it exists) so that we have a fresh start 50 | try: 51 | client.delete_message_stream(stream_name=stream_name) 52 | except ResourceNotFoundException: 53 | pass 54 | 55 | exports = ExportDefinition( 56 | s3_task_executor=[ 57 | S3ExportTaskExecutorConfig( 58 | identifier="S3TaskExecutor" + stream_name, # Required 59 | # Optional. Add an export status stream to add statuses for all S3 upload tasks. 60 | status_config=StatusConfig( 61 | status_level=StatusLevel.INFO, # Default is INFO level statuses. 62 | # Status Stream should be created before specifying in S3 Export Config. 63 | status_stream_name=status_stream_name, 64 | ), 65 | ) 66 | ] 67 | ) 68 | 69 | # Create the Status Stream. 70 | client.create_message_stream( 71 | MessageStreamDefinition(name=status_stream_name, strategy_on_full=StrategyOnFull.OverwriteOldestData) 72 | ) 73 | 74 | # Create the message stream with the S3 Export definition. 75 | client.create_message_stream( 76 | MessageStreamDefinition( 77 | name=stream_name, strategy_on_full=StrategyOnFull.OverwriteOldestData, export_definition=exports 78 | ) 79 | ) 80 | 81 | # Append a S3 Task definition and print the sequence number 82 | s3_export_task_definition = S3ExportTaskDefinition(input_url=file_url, bucket=bucket_name, key=key_name) 83 | logger.info( 84 | "Successfully appended S3 Task Definition to stream with sequence number %d", 85 | client.append_message(stream_name, Util.validate_and_serialize_to_json_bytes(s3_export_task_definition)), 86 | ) 87 | 88 | # Read the statuses from the export status stream 89 | stop_checking = False 90 | next_seq = 0 91 | while not stop_checking: 92 | try: 93 | messages_list = client.read_messages( 94 | status_stream_name, 95 | ReadMessagesOptions( 96 | desired_start_sequence_number=next_seq, min_message_count=1, read_timeout_millis=1000 97 | ), 98 | ) 99 | for message in messages_list: 100 | # Deserialize the status message first. 101 | status_message = Util.deserialize_json_bytes_to_obj(message.payload, StatusMessage) 102 | 103 | # Check the status of the status message. If the status is "Success", 104 | # the file was successfully uploaded to S3. 105 | # If the status was either "Failure" or "Cancelled", the server was unable to upload the file to S3. 106 | # We will print the message for why the upload to S3 failed from the status message. 107 | # If the status was "InProgress", the status indicates that the server has started uploading 108 | # the S3 task. 109 | if status_message.status == Status.Success: 110 | logger.info("Successfully uploaded file at path " + file_url + " to S3.") 111 | stop_checking = True 112 | elif status_message.status == Status.InProgress: 113 | logger.info("File upload is in Progress.") 114 | next_seq = message.sequence_number + 1 115 | elif status_message.status == Status.Failure or status_message.status == Status.Canceled: 116 | logger.info( 117 | "Unable to upload file at path " + file_url + " to S3. Message: " + status_message.message 118 | ) 119 | stop_checking = True 120 | if not stop_checking: 121 | time.sleep(5) 122 | except StreamManagerException: 123 | logger.exception("Exception while running") 124 | time.sleep(5) 125 | except asyncio.TimeoutError: 126 | logger.exception("Timed out while executing") 127 | except Exception: 128 | logger.exception("Exception while running") 129 | finally: 130 | if client: 131 | client.close() 132 | 133 | 134 | logging.basicConfig(level=logging.INFO) 135 | # Start up this sample code 136 | main(logger=logging.getLogger()) 137 | -------------------------------------------------------------------------------- /docs/_apidoc/stream_manager.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | stream_manager package — Greengrass Stream Manager Python SDK 1.1.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 | 97 | 98 |
99 | 100 | 101 | 107 | 108 | 109 |
110 | 111 |
112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 |
130 | 131 |
    132 | 133 |
  • Docs »
  • 134 | 135 |
  • stream_manager package
  • 136 | 137 | 138 |
  • 139 | 140 | 141 | View page source 142 | 143 | 144 |
  • 145 | 146 |
147 | 148 | 149 |
150 |
151 |
152 |
153 | 154 |
155 |

stream_manager package

156 |

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 157 | SPDX-License-Identifier: Apache-2.0

158 |
159 |

Subpackages

160 |
161 | 164 |
165 |
166 | 177 |
178 | 179 | 180 |
181 | 182 |
183 |
184 | 185 | 186 |
187 | 188 |
189 |

190 | © Copyright 2022, Amazon.com. 191 | 192 |

193 |
194 | Built with Sphinx using a theme provided by Read the Docs. 195 | 196 |
197 | 198 |
199 |
200 | 201 |
202 | 203 |
204 | 205 | 206 | 207 | 208 | 209 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 233 | 234 | 235 | -------------------------------------------------------------------------------- /docs/_apidoc/modules.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | API Reference — Greengrass Stream Manager Python SDK 1.1.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 | 93 | 94 |
95 | 96 | 97 | 103 | 104 | 105 |
106 | 107 |
108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 |
126 | 127 |
    128 | 129 |
  • Docs »
  • 130 | 131 |
  • API Reference
  • 132 | 133 | 134 |
  • 135 | 136 | 137 | View page source 138 | 139 | 140 |
  • 141 | 142 |
143 | 144 | 145 |
146 |
147 |
148 |
149 | 150 |
151 |

API Reference

152 | 178 |
179 | 180 | 181 |
182 | 183 |
184 |
185 | 186 | 187 |
188 | 189 |
190 |

191 | © Copyright 2022, Amazon.com. 192 | 193 |

194 |
195 | Built with Sphinx using a theme provided by Read the Docs. 196 | 197 |
198 | 199 |
200 |
201 | 202 |
203 | 204 |
205 | 206 | 207 | 208 | 209 | 210 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 234 | 235 | 236 | -------------------------------------------------------------------------------- /docs/_apidoc/example.benchmarker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | example.benchmarker module — Greengrass Stream Manager Python SDK 1.1.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 | 93 | 94 |
95 | 96 | 97 | 103 | 104 | 105 |
106 | 107 |
108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 |
126 | 127 |
    128 | 129 |
  • Docs »
  • 130 | 131 |
  • example.benchmarker module
  • 132 | 133 | 134 |
  • 135 | 136 | 137 | View page source 138 | 139 | 140 |
  • 141 | 142 |
143 | 144 | 145 |
146 |
147 |
148 |
149 | 150 |
151 |

example.benchmarker module

152 |

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 153 | SPDX-License-Identifier: Apache-2.0

154 |
155 |
156 | example.benchmarker.print_progress_bar(iteration, total, prefix='', suffix='', decimals=1, length=100, fill='█')[source]
157 |
158 | 159 |
160 |
161 | example.benchmarker.main()[source]
162 |
163 | 164 |
165 | 166 | 167 |
168 | 169 |
170 |
171 | 172 | 173 |
174 | 175 |
176 |

177 | © Copyright 2022, Amazon.com. 178 | 179 |

180 |
181 | Built with Sphinx using a theme provided by Read the Docs. 182 | 183 |
184 | 185 |
186 |
187 | 188 |
189 | 190 |
191 | 192 | 193 | 194 | 195 | 196 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 220 | 221 | 222 | -------------------------------------------------------------------------------- /docs/_apidoc/stream_manager.util.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | stream_manager.util module — Greengrass Stream Manager Python SDK 1.1.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 | 93 | 94 |
95 | 96 | 97 | 103 | 104 | 105 |
106 | 107 |
108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 |
126 | 127 |
    128 | 129 |
  • Docs »
  • 130 | 131 |
  • stream_manager.util module
  • 132 | 133 | 134 |
  • 135 | 136 | 137 | View page source 138 | 139 | 140 |
  • 141 | 142 |
143 | 144 | 145 |
146 |
147 |
148 |
149 | 150 |
151 |

stream_manager.util module

152 |

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 153 | SPDX-License-Identifier: Apache-2.0

154 |
155 |
156 | class stream_manager.util.Util[source]
157 |

Bases: object

158 |

Validate And Serialize an instance of class to Json bytes. 159 | :param data: an instance object 160 | :return: a byte array. 161 | :raises: :ValidationException

162 |
163 |
164 | static validate_and_serialize_to_json_bytes(data)[source]
165 |
166 | 167 |
168 |
169 | static deserialize_json_bytes_to_obj(bytes, type)[source]
170 |
171 | 172 |
173 | 174 |
175 | 176 | 177 |
178 | 179 |
180 |
181 | 182 | 183 |
184 | 185 |
186 |

187 | © Copyright 2022, Amazon.com. 188 | 189 |

190 |
191 | Built with Sphinx using a theme provided by Read the Docs. 192 | 193 |
194 | 195 |
196 |
197 | 198 |
199 | 200 |
201 | 202 | 203 | 204 | 205 | 206 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 230 | 231 | 232 | -------------------------------------------------------------------------------- /docs/py-modindex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Python Module Index — Greengrass Stream Manager Python SDK 1.1.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
44 | 45 | 46 | 93 | 94 |
95 | 96 | 97 | 103 | 104 | 105 |
106 | 107 |
108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 |
126 | 127 |
    128 | 129 |
  • Docs »
  • 130 | 131 |
  • Python Module Index
  • 132 | 133 | 134 |
  • 135 | 136 |
  • 137 | 138 |
139 | 140 | 141 |
142 |
143 |
144 |
145 | 146 | 147 |

Python Module Index

148 | 149 |
150 | e | 151 | s 152 |
153 | 154 | 155 | 156 | 158 | 159 | 161 | 164 | 165 | 166 | 169 | 170 | 171 | 174 | 175 | 177 | 178 | 180 | 183 | 184 | 185 | 188 | 189 | 190 | 193 | 194 | 195 | 198 | 199 | 200 | 203 | 204 | 205 | 208 |
 
157 | e
162 | example 163 |
    167 | example.benchmarker 168 |
    172 | example.example 173 |
 
176 | s
181 | stream_manager 182 |
    186 | stream_manager.data 187 |
    191 | stream_manager.exceptions 192 |
    196 | stream_manager.streammanagerclient 197 |
    201 | stream_manager.util 202 |
    206 | stream_manager.utilinternal 207 |
209 | 210 | 211 |
212 | 213 |
214 |
215 | 216 | 217 |
218 | 219 |
220 |

221 | © Copyright 2022, Amazon.com. 222 | 223 |

224 |
225 | Built with Sphinx using a theme provided by Read the Docs. 226 | 227 |
228 | 229 |
230 |
231 | 232 |
233 | 234 |
235 | 236 | 237 | 238 | 239 | 240 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 264 | 265 | 266 | -------------------------------------------------------------------------------- /docs/_modules/stream_manager/util.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | stream_manager.util — Greengrass Stream Manager Python SDK 1.1.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 | 90 | 91 |
92 | 93 | 94 | 100 | 101 | 102 |
103 | 104 |
105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 |
123 | 124 |
    125 | 126 |
  • Docs »
  • 127 | 128 |
  • Module code »
  • 129 | 130 |
  • stream_manager.util
  • 131 | 132 | 133 |
  • 134 | 135 |
  • 136 | 137 |
138 | 139 | 140 |
141 |
142 |
143 |
144 | 145 |

Source code for stream_manager.util

146 | """
147 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
148 | SPDX-License-Identifier: Apache-2.0
149 | """
150 | 
151 | import json
152 | 
153 | from .exceptions import ValidationException
154 | from .utilinternal import UtilInternal
155 | 
156 | 
157 | """
158 | Util functions exposed to the customers
159 | """
160 | 
161 | 
162 | 
[docs]class Util: 163 | """ 164 | Validate And Serialize an instance of class to Json bytes. 165 | :param data: an instance object 166 | :return: a byte array. 167 | :raises: :ValidationException 168 | """ 169 | 170 |
[docs] @staticmethod 171 | def validate_and_serialize_to_json_bytes(data): 172 | validation = UtilInternal.is_invalid(data) 173 | if validation: 174 | raise ValidationException(validation) 175 | return UtilInternal.serialize_to_json_with_empty_array_as_null(data)
176 | 177 | """ 178 | Deserialize the json byte array to an object 179 | :param :bytes byte array of data 180 | :param :type instance class type 181 | :return: an object. 182 | """ 183 | 184 |
[docs] @staticmethod 185 | def deserialize_json_bytes_to_obj(bytes, type): 186 | return type.from_dict(json.loads(bytes))
187 |
188 | 189 |
190 | 191 |
192 |
193 | 194 | 195 |
196 | 197 |
198 |

199 | © Copyright 2022, Amazon.com. 200 | 201 |

202 |
203 | Built with Sphinx using a theme provided by Read the Docs. 204 | 205 |
206 | 207 |
208 |
209 | 210 |
211 | 212 |
213 | 214 | 215 | 216 | 217 | 218 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 242 | 243 | 244 | -------------------------------------------------------------------------------- /stream_manager/utilinternal.py: -------------------------------------------------------------------------------- 1 | """ 2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | SPDX-License-Identifier: Apache-2.0 4 | """ 5 | 6 | import asyncio 7 | import json 8 | import re 9 | import uuid 10 | from typing import Sequence 11 | 12 | from .data import ResponseStatusCode 13 | from .exceptions import ( 14 | InvalidRequestException, 15 | MessageStoreReadErrorException, 16 | NotEnoughMessagesException, 17 | RequestPayloadTooLargeException, 18 | ResourceNotFoundException, 19 | ResponsePayloadTooLargeException, 20 | ServerOutOfMemoryException, 21 | ServerTimeoutException, 22 | StreamManagerException, 23 | UnauthorizedException, 24 | UnknownFailureException, 25 | UnknownOperationException, 26 | UpdateFailedException, 27 | UpdateNotAllowedException, 28 | ) 29 | 30 | 31 | class UtilInternal: 32 | __ENDIAN = "big" 33 | _MAX_PACKET_SIZE = 1 << 30 34 | 35 | @staticmethod 36 | def sync(coro, loop: asyncio.AbstractEventLoop): 37 | if asyncio.iscoroutine(coro): 38 | # Run async function in the loop and return the value or raise the exception 39 | return asyncio.run_coroutine_threadsafe(coro, loop=loop).result() 40 | 41 | return coro 42 | 43 | """ 44 | Delete keys with the value ``None`` in a dictionary, recursively. 45 | This alters the input so you may wish to ``copy`` the dict first. 46 | """ 47 | 48 | @staticmethod 49 | def del_empty_arrays(d): 50 | 51 | for key, value in list(d.items()): 52 | if isinstance(value, list) and len(value) == 0: 53 | del d[key] 54 | elif isinstance(value, dict): 55 | UtilInternal.del_empty_arrays(value) 56 | return d 57 | 58 | @staticmethod 59 | def serialize_to_json_with_empty_array_as_null(data): 60 | s = json.dumps(UtilInternal.del_empty_arrays(data.as_dict())) 61 | 62 | return s.encode() 63 | 64 | @staticmethod 65 | def int_to_bytes(i, length=4): 66 | return int.to_bytes(i, length=length, byteorder=UtilInternal.__ENDIAN, signed=True) 67 | 68 | @staticmethod 69 | def int_from_bytes(b): 70 | return int.from_bytes(b, byteorder=UtilInternal.__ENDIAN, signed=True) 71 | 72 | @staticmethod 73 | def encode_frame(frame) -> Sequence[bytes]: 74 | if len(frame.payload) + 1 > UtilInternal._MAX_PACKET_SIZE: 75 | raise RequestPayloadTooLargeException() 76 | return [ 77 | bytes( 78 | [ 79 | *UtilInternal.int_to_bytes(len(frame.payload) + 1), 80 | *UtilInternal.int_to_bytes(frame.operation.value, length=1), 81 | ] 82 | ), 83 | frame.payload, 84 | ] 85 | 86 | @staticmethod 87 | def get_request_id(): 88 | return str(uuid.uuid4()) 89 | 90 | @staticmethod 91 | def is_invalid(o): 92 | if not hasattr(o, "_validations_map"): 93 | return False 94 | if not hasattr(o, "_types_map"): 95 | return False 96 | for prop_name, validations in o._validations_map.items(): 97 | if not hasattr(o, prop_name): 98 | return "Object is malformed, missing property: {}".format(prop_name) 99 | # Validate all properties on lists 100 | if type(getattr(o, prop_name)) == list: 101 | for i, v in enumerate(getattr(o, prop_name)): 102 | result = UtilInternal.is_invalid(v) 103 | if result: 104 | return "Property {}[{}] is invalid because {}".format(prop_name, i, result) 105 | 106 | # Recurse down to check validity of objects within objects 107 | result = UtilInternal.is_invalid(getattr(o, prop_name)) 108 | if result: 109 | return "Property {} is invalid because {}".format(prop_name, result) 110 | 111 | # Validate the property 112 | if "required" in validations and validations["required"] and getattr(o, prop_name) is None: 113 | return "Property {} is required, but was None".format(prop_name) 114 | if ( 115 | "minLength" in validations 116 | and getattr(o, prop_name) is not None 117 | and len(getattr(o, prop_name)) < validations["minLength"] 118 | ): 119 | return "Property {} must have a minimum length of {}, but found length of {}".format( 120 | prop_name, validations["minLength"], len(getattr(o, prop_name)) 121 | ) 122 | if ( 123 | "maxLength" in validations 124 | and getattr(o, prop_name) is not None 125 | and len(getattr(o, prop_name)) > validations["maxLength"] 126 | ): 127 | return "Property {} must have a maximum length of {}, but found length of {}".format( 128 | prop_name, validations["maxLength"], len(getattr(o, prop_name)) 129 | ) 130 | if ( 131 | "minItems" in validations 132 | and getattr(o, prop_name) is not None 133 | and len(getattr(o, prop_name)) < validations["minItems"] 134 | ): 135 | return "Property {} must have at least {} items, but found {}".format( 136 | prop_name, validations["minItems"], len(getattr(o, prop_name)) 137 | ) 138 | if ( 139 | "maxItems" in validations 140 | and getattr(o, prop_name) is not None 141 | and len(getattr(o, prop_name)) > validations["maxItems"] 142 | ): 143 | return "Property {} must have at most {} items, but found {}".format( 144 | prop_name, validations["maxItems"], len(getattr(o, prop_name)) 145 | ) 146 | if ( 147 | "maximum" in validations 148 | and getattr(o, prop_name) is not None 149 | and getattr(o, prop_name) > validations["maximum"] 150 | ): 151 | return "Property {} must be at most {}".format(prop_name, validations["maximum"]) 152 | if ( 153 | "minimum" in validations 154 | and getattr(o, prop_name) is not None 155 | and getattr(o, prop_name) < validations["minimum"] 156 | ): 157 | return "Property {} must be at least {}".format(prop_name, validations["minimum"]) 158 | if ( 159 | "pattern" in validations 160 | and getattr(o, prop_name) is not None 161 | and re.fullmatch(validations["pattern"], getattr(o, prop_name)) is None 162 | ): 163 | return "Property {} must match regex {}".format(prop_name, validations["pattern"]) 164 | 165 | for prop_name, types in o._types_map.items(): 166 | # Validate all properties with their respective types 167 | if "type" in types and getattr(o, prop_name) is not None: 168 | result = isinstance(getattr(o, prop_name), types["type"]) 169 | if not result: 170 | return "Property {} is invalid because it must be of type {}".format( 171 | prop_name, types["type"].__name__ 172 | ) 173 | if types["type"] == list and "subtype" in types: 174 | for i, v in enumerate(getattr(o, prop_name)): 175 | result = isinstance(v, types["subtype"]) 176 | if not result: 177 | return "Property {}[{}] is invalid because it must be of type {}".format( 178 | prop_name, i, types["subtype"].__name__ 179 | ) 180 | 181 | return False 182 | 183 | @staticmethod 184 | def raise_on_error_response(response): 185 | if response.status == ResponseStatusCode.Success: 186 | return 187 | elif response.status == ResponseStatusCode.InvalidRequest: 188 | raise InvalidRequestException(response.error_message, response.status, response.request_id) 189 | elif response.status == ResponseStatusCode.RequestPayloadTooLarge: 190 | raise RequestPayloadTooLargeException(response.error_message, response.status, response.request_id) 191 | elif response.status == ResponseStatusCode.ResourceNotFound: 192 | raise ResourceNotFoundException(response.error_message, response.status, response.request_id) 193 | elif response.status == ResponseStatusCode.ResponsePayloadTooLarge: 194 | raise ResponsePayloadTooLargeException(response.error_message, response.status, response.request_id) 195 | elif response.status == ResponseStatusCode.ServerTimeout: 196 | raise ServerTimeoutException(response.error_message, response.status, response.request_id) 197 | elif response.status == ResponseStatusCode.Unauthorized: 198 | raise UnauthorizedException(response.error_message, response.status, response.request_id) 199 | elif response.status == ResponseStatusCode.UnknownFailure: 200 | raise UnknownFailureException(response.error_message, response.status, response.request_id) 201 | elif response.status == ResponseStatusCode.NotEnoughMessages: 202 | raise NotEnoughMessagesException(response.error_message, response.status, response.request_id) 203 | elif response.status == ResponseStatusCode.MessageStoreReadError: 204 | raise MessageStoreReadErrorException(response.error_message, response.status, response.request_id) 205 | elif response.status == ResponseStatusCode.OutOfMemoryError: 206 | raise ServerOutOfMemoryException(response.error_message, response.status, response.request_id) 207 | elif response.status == ResponseStatusCode.UpdateFailed: 208 | raise UpdateFailedException(response.error_message, response.status, response.request_id) 209 | elif response.status == ResponseStatusCode.UpdateNotAllowed: 210 | raise UpdateNotAllowedException(response.error_message, response.status, response.request_id) 211 | elif response.status == ResponseStatusCode.UnknownOperation: 212 | raise UnknownOperationException(response.error_message, response.status, response.request_id) 213 | else: 214 | raise StreamManagerException( 215 | "Client is not able to understand this server response status code", "Unrecognized", response.request_id 216 | ) 217 | -------------------------------------------------------------------------------- /docs/_modules/example/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | example.example — Greengrass Stream Manager Python SDK 1.1.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 | 90 | 91 |
92 | 93 | 94 | 100 | 101 | 102 |
103 | 104 |
105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 |
123 | 124 |
    125 | 126 |
  • Docs »
  • 127 | 128 |
  • Module code »
  • 129 | 130 |
  • example.example
  • 131 | 132 | 133 |
  • 134 | 135 |
  • 136 | 137 |
138 | 139 | 140 |
141 |
142 |
143 |
144 | 145 |

Source code for example.example

146 | """
147 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
148 | SPDX-License-Identifier: Apache-2.0
149 | """
150 | 
151 | import asyncio
152 | import logging
153 | 
154 | from stream_manager import MessageStreamDefinition, ReadMessagesOptions, StrategyOnFull, StreamManagerClient
155 | 
156 | 
157 | 
[docs]def main(): 158 | try: 159 | client = StreamManagerClient() 160 | client.delete_message_stream("jjj") 161 | print( 162 | client.create_message_stream( 163 | MessageStreamDefinition( 164 | name="jjj", max_size=1024 * 1024, strategy_on_full=StrategyOnFull.OverwriteOldestData 165 | ) 166 | ) 167 | ) 168 | print(client.append_message("jjj", "ABCDEFGHIJKLMNO".encode("utf-8"))) 169 | print(client.append_message("jjj", "asdgdgdgs".encode("utf-8"))) 170 | print(client.append_message("jjj", "sdgaoidsgdg9373bgjd".encode("utf-8"))) 171 | print(client.read_messages("jjj", ReadMessagesOptions(min_message_count=3, read_timeout_millis=1000))) 172 | 173 | except asyncio.TimeoutError: 174 | print("Timed out") 175 | except Exception as e: 176 | print(e) 177 | print(type(e)) 178 | finally: 179 | if client: 180 | client.close()
181 | 182 | 183 | if __name__ == "__main__": 184 | logging.basicConfig(level=logging.NOTSET) 185 | main() 186 |
187 | 188 |
189 | 190 |
191 |
192 | 193 | 194 |
195 | 196 |
197 |

198 | © Copyright 2022, Amazon.com. 199 | 200 |

201 |
202 | Built with Sphinx using a theme provided by Read the Docs. 203 | 204 |
205 | 206 |
207 |
208 | 209 |
210 | 211 |
212 | 213 | 214 | 215 | 216 | 217 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 241 | 242 | 243 | -------------------------------------------------------------------------------- /docs/_static/doctools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * doctools.js 3 | * ~~~~~~~~~~~ 4 | * 5 | * Sphinx JavaScript utilities for all documentation. 6 | * 7 | * :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | /** 13 | * select a different prefix for underscore 14 | */ 15 | $u = _.noConflict(); 16 | 17 | /** 18 | * make the code below compatible with browsers without 19 | * an installed firebug like debugger 20 | if (!window.console || !console.firebug) { 21 | var names = ["log", "debug", "info", "warn", "error", "assert", "dir", 22 | "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", 23 | "profile", "profileEnd"]; 24 | window.console = {}; 25 | for (var i = 0; i < names.length; ++i) 26 | window.console[names[i]] = function() {}; 27 | } 28 | */ 29 | 30 | /** 31 | * small helper function to urldecode strings 32 | * 33 | * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL 34 | */ 35 | jQuery.urldecode = function(x) { 36 | if (!x) { 37 | return x 38 | } 39 | return decodeURIComponent(x.replace(/\+/g, ' ')); 40 | }; 41 | 42 | /** 43 | * small helper function to urlencode strings 44 | */ 45 | jQuery.urlencode = encodeURIComponent; 46 | 47 | /** 48 | * This function returns the parsed url parameters of the 49 | * current request. Multiple values per key are supported, 50 | * it will always return arrays of strings for the value parts. 51 | */ 52 | jQuery.getQueryParameters = function(s) { 53 | if (typeof s === 'undefined') 54 | s = document.location.search; 55 | var parts = s.substr(s.indexOf('?') + 1).split('&'); 56 | var result = {}; 57 | for (var i = 0; i < parts.length; i++) { 58 | var tmp = parts[i].split('=', 2); 59 | var key = jQuery.urldecode(tmp[0]); 60 | var value = jQuery.urldecode(tmp[1]); 61 | if (key in result) 62 | result[key].push(value); 63 | else 64 | result[key] = [value]; 65 | } 66 | return result; 67 | }; 68 | 69 | /** 70 | * highlight a given string on a jquery object by wrapping it in 71 | * span elements with the given class name. 72 | */ 73 | jQuery.fn.highlightText = function(text, className) { 74 | function highlight(node, addItems) { 75 | if (node.nodeType === 3) { 76 | var val = node.nodeValue; 77 | var pos = val.toLowerCase().indexOf(text); 78 | if (pos >= 0 && 79 | !jQuery(node.parentNode).hasClass(className) && 80 | !jQuery(node.parentNode).hasClass("nohighlight")) { 81 | var span; 82 | var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg"); 83 | if (isInSVG) { 84 | span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); 85 | } else { 86 | span = document.createElement("span"); 87 | span.className = className; 88 | } 89 | span.appendChild(document.createTextNode(val.substr(pos, text.length))); 90 | node.parentNode.insertBefore(span, node.parentNode.insertBefore( 91 | document.createTextNode(val.substr(pos + text.length)), 92 | node.nextSibling)); 93 | node.nodeValue = val.substr(0, pos); 94 | if (isInSVG) { 95 | var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); 96 | var bbox = node.parentElement.getBBox(); 97 | rect.x.baseVal.value = bbox.x; 98 | rect.y.baseVal.value = bbox.y; 99 | rect.width.baseVal.value = bbox.width; 100 | rect.height.baseVal.value = bbox.height; 101 | rect.setAttribute('class', className); 102 | addItems.push({ 103 | "parent": node.parentNode, 104 | "target": rect}); 105 | } 106 | } 107 | } 108 | else if (!jQuery(node).is("button, select, textarea")) { 109 | jQuery.each(node.childNodes, function() { 110 | highlight(this, addItems); 111 | }); 112 | } 113 | } 114 | var addItems = []; 115 | var result = this.each(function() { 116 | highlight(this, addItems); 117 | }); 118 | for (var i = 0; i < addItems.length; ++i) { 119 | jQuery(addItems[i].parent).before(addItems[i].target); 120 | } 121 | return result; 122 | }; 123 | 124 | /* 125 | * backward compatibility for jQuery.browser 126 | * This will be supported until firefox bug is fixed. 127 | */ 128 | if (!jQuery.browser) { 129 | jQuery.uaMatch = function(ua) { 130 | ua = ua.toLowerCase(); 131 | 132 | var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || 133 | /(webkit)[ \/]([\w.]+)/.exec(ua) || 134 | /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || 135 | /(msie) ([\w.]+)/.exec(ua) || 136 | ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || 137 | []; 138 | 139 | return { 140 | browser: match[ 1 ] || "", 141 | version: match[ 2 ] || "0" 142 | }; 143 | }; 144 | jQuery.browser = {}; 145 | jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; 146 | } 147 | 148 | /** 149 | * Small JavaScript module for the documentation. 150 | */ 151 | var Documentation = { 152 | 153 | init : function() { 154 | this.fixFirefoxAnchorBug(); 155 | this.highlightSearchWords(); 156 | this.initIndexTable(); 157 | if (DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) { 158 | this.initOnKeyListeners(); 159 | } 160 | }, 161 | 162 | /** 163 | * i18n support 164 | */ 165 | TRANSLATIONS : {}, 166 | PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; }, 167 | LOCALE : 'unknown', 168 | 169 | // gettext and ngettext don't access this so that the functions 170 | // can safely bound to a different name (_ = Documentation.gettext) 171 | gettext : function(string) { 172 | var translated = Documentation.TRANSLATIONS[string]; 173 | if (typeof translated === 'undefined') 174 | return string; 175 | return (typeof translated === 'string') ? translated : translated[0]; 176 | }, 177 | 178 | ngettext : function(singular, plural, n) { 179 | var translated = Documentation.TRANSLATIONS[singular]; 180 | if (typeof translated === 'undefined') 181 | return (n == 1) ? singular : plural; 182 | return translated[Documentation.PLURALEXPR(n)]; 183 | }, 184 | 185 | addTranslations : function(catalog) { 186 | for (var key in catalog.messages) 187 | this.TRANSLATIONS[key] = catalog.messages[key]; 188 | this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); 189 | this.LOCALE = catalog.locale; 190 | }, 191 | 192 | /** 193 | * add context elements like header anchor links 194 | */ 195 | addContextElements : function() { 196 | $('div[id] > :header:first').each(function() { 197 | $('\u00B6'). 198 | attr('href', '#' + this.id). 199 | attr('title', _('Permalink to this headline')). 200 | appendTo(this); 201 | }); 202 | $('dt[id]').each(function() { 203 | $('\u00B6'). 204 | attr('href', '#' + this.id). 205 | attr('title', _('Permalink to this definition')). 206 | appendTo(this); 207 | }); 208 | }, 209 | 210 | /** 211 | * workaround a firefox stupidity 212 | * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 213 | */ 214 | fixFirefoxAnchorBug : function() { 215 | if (document.location.hash && $.browser.mozilla) 216 | window.setTimeout(function() { 217 | document.location.href += ''; 218 | }, 10); 219 | }, 220 | 221 | /** 222 | * highlight the search words provided in the url in the text 223 | */ 224 | highlightSearchWords : function() { 225 | var params = $.getQueryParameters(); 226 | var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; 227 | if (terms.length) { 228 | var body = $('div.body'); 229 | if (!body.length) { 230 | body = $('body'); 231 | } 232 | window.setTimeout(function() { 233 | $.each(terms, function() { 234 | body.highlightText(this.toLowerCase(), 'highlighted'); 235 | }); 236 | }, 10); 237 | $('') 239 | .appendTo($('#searchbox')); 240 | } 241 | }, 242 | 243 | /** 244 | * init the domain index toggle buttons 245 | */ 246 | initIndexTable : function() { 247 | var togglers = $('img.toggler').click(function() { 248 | var src = $(this).attr('src'); 249 | var idnum = $(this).attr('id').substr(7); 250 | $('tr.cg-' + idnum).toggle(); 251 | if (src.substr(-9) === 'minus.png') 252 | $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); 253 | else 254 | $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); 255 | }).css('display', ''); 256 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { 257 | togglers.click(); 258 | } 259 | }, 260 | 261 | /** 262 | * helper function to hide the search marks again 263 | */ 264 | hideSearchWords : function() { 265 | $('#searchbox .highlight-link').fadeOut(300); 266 | $('span.highlighted').removeClass('highlighted'); 267 | }, 268 | 269 | /** 270 | * make the url absolute 271 | */ 272 | makeURL : function(relativeURL) { 273 | return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; 274 | }, 275 | 276 | /** 277 | * get the current relative url 278 | */ 279 | getCurrentURL : function() { 280 | var path = document.location.pathname; 281 | var parts = path.split(/\//); 282 | $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { 283 | if (this === '..') 284 | parts.pop(); 285 | }); 286 | var url = parts.join('/'); 287 | return path.substring(url.lastIndexOf('/') + 1, path.length - 1); 288 | }, 289 | 290 | initOnKeyListeners: function() { 291 | $(document).keydown(function(event) { 292 | var activeElementType = document.activeElement.tagName; 293 | // don't navigate when in search box, textarea, dropdown or button 294 | if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT' 295 | && activeElementType !== 'BUTTON' && !event.altKey && !event.ctrlKey && !event.metaKey 296 | && !event.shiftKey) { 297 | switch (event.keyCode) { 298 | case 37: // left 299 | var prevHref = $('link[rel="prev"]').prop('href'); 300 | if (prevHref) { 301 | window.location.href = prevHref; 302 | return false; 303 | } 304 | case 39: // right 305 | var nextHref = $('link[rel="next"]').prop('href'); 306 | if (nextHref) { 307 | window.location.href = nextHref; 308 | return false; 309 | } 310 | } 311 | } 312 | }); 313 | } 314 | }; 315 | 316 | // quick alias for translations 317 | _ = Documentation.gettext; 318 | 319 | $(document).ready(function() { 320 | Documentation.init(); 321 | }); 322 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2012-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | RobotoSlab[wght].ttf: Copyright 2018 The Roboto Slab Project Authors (https://github.com/googlefonts/robotoslab) 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /docs/_static/language_data.js: -------------------------------------------------------------------------------- 1 | /* 2 | * language_data.js 3 | * ~~~~~~~~~~~~~~~~ 4 | * 5 | * This script contains the language-specific data used by searchtools.js, 6 | * namely the list of stopwords, stemmer, scorer and splitter. 7 | * 8 | * :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. 9 | * :license: BSD, see LICENSE for details. 10 | * 11 | */ 12 | 13 | var stopwords = ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"]; 14 | 15 | 16 | /* Non-minified version is copied as a separate JS file, is available */ 17 | 18 | /** 19 | * Porter Stemmer 20 | */ 21 | var Stemmer = function() { 22 | 23 | var step2list = { 24 | ational: 'ate', 25 | tional: 'tion', 26 | enci: 'ence', 27 | anci: 'ance', 28 | izer: 'ize', 29 | bli: 'ble', 30 | alli: 'al', 31 | entli: 'ent', 32 | eli: 'e', 33 | ousli: 'ous', 34 | ization: 'ize', 35 | ation: 'ate', 36 | ator: 'ate', 37 | alism: 'al', 38 | iveness: 'ive', 39 | fulness: 'ful', 40 | ousness: 'ous', 41 | aliti: 'al', 42 | iviti: 'ive', 43 | biliti: 'ble', 44 | logi: 'log' 45 | }; 46 | 47 | var step3list = { 48 | icate: 'ic', 49 | ative: '', 50 | alize: 'al', 51 | iciti: 'ic', 52 | ical: 'ic', 53 | ful: '', 54 | ness: '' 55 | }; 56 | 57 | var c = "[^aeiou]"; // consonant 58 | var v = "[aeiouy]"; // vowel 59 | var C = c + "[^aeiouy]*"; // consonant sequence 60 | var V = v + "[aeiou]*"; // vowel sequence 61 | 62 | var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 63 | var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 64 | var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 65 | var s_v = "^(" + C + ")?" + v; // vowel in stem 66 | 67 | this.stemWord = function (w) { 68 | var stem; 69 | var suffix; 70 | var firstch; 71 | var origword = w; 72 | 73 | if (w.length < 3) 74 | return w; 75 | 76 | var re; 77 | var re2; 78 | var re3; 79 | var re4; 80 | 81 | firstch = w.substr(0,1); 82 | if (firstch == "y") 83 | w = firstch.toUpperCase() + w.substr(1); 84 | 85 | // Step 1a 86 | re = /^(.+?)(ss|i)es$/; 87 | re2 = /^(.+?)([^s])s$/; 88 | 89 | if (re.test(w)) 90 | w = w.replace(re,"$1$2"); 91 | else if (re2.test(w)) 92 | w = w.replace(re2,"$1$2"); 93 | 94 | // Step 1b 95 | re = /^(.+?)eed$/; 96 | re2 = /^(.+?)(ed|ing)$/; 97 | if (re.test(w)) { 98 | var fp = re.exec(w); 99 | re = new RegExp(mgr0); 100 | if (re.test(fp[1])) { 101 | re = /.$/; 102 | w = w.replace(re,""); 103 | } 104 | } 105 | else if (re2.test(w)) { 106 | var fp = re2.exec(w); 107 | stem = fp[1]; 108 | re2 = new RegExp(s_v); 109 | if (re2.test(stem)) { 110 | w = stem; 111 | re2 = /(at|bl|iz)$/; 112 | re3 = new RegExp("([^aeiouylsz])\\1$"); 113 | re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 114 | if (re2.test(w)) 115 | w = w + "e"; 116 | else if (re3.test(w)) { 117 | re = /.$/; 118 | w = w.replace(re,""); 119 | } 120 | else if (re4.test(w)) 121 | w = w + "e"; 122 | } 123 | } 124 | 125 | // Step 1c 126 | re = /^(.+?)y$/; 127 | if (re.test(w)) { 128 | var fp = re.exec(w); 129 | stem = fp[1]; 130 | re = new RegExp(s_v); 131 | if (re.test(stem)) 132 | w = stem + "i"; 133 | } 134 | 135 | // Step 2 136 | re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; 137 | if (re.test(w)) { 138 | var fp = re.exec(w); 139 | stem = fp[1]; 140 | suffix = fp[2]; 141 | re = new RegExp(mgr0); 142 | if (re.test(stem)) 143 | w = stem + step2list[suffix]; 144 | } 145 | 146 | // Step 3 147 | re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; 148 | if (re.test(w)) { 149 | var fp = re.exec(w); 150 | stem = fp[1]; 151 | suffix = fp[2]; 152 | re = new RegExp(mgr0); 153 | if (re.test(stem)) 154 | w = stem + step3list[suffix]; 155 | } 156 | 157 | // Step 4 158 | re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; 159 | re2 = /^(.+?)(s|t)(ion)$/; 160 | if (re.test(w)) { 161 | var fp = re.exec(w); 162 | stem = fp[1]; 163 | re = new RegExp(mgr1); 164 | if (re.test(stem)) 165 | w = stem; 166 | } 167 | else if (re2.test(w)) { 168 | var fp = re2.exec(w); 169 | stem = fp[1] + fp[2]; 170 | re2 = new RegExp(mgr1); 171 | if (re2.test(stem)) 172 | w = stem; 173 | } 174 | 175 | // Step 5 176 | re = /^(.+?)e$/; 177 | if (re.test(w)) { 178 | var fp = re.exec(w); 179 | stem = fp[1]; 180 | re = new RegExp(mgr1); 181 | re2 = new RegExp(meq1); 182 | re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 183 | if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) 184 | w = stem; 185 | } 186 | re = /ll$/; 187 | re2 = new RegExp(mgr1); 188 | if (re.test(w) && re2.test(w)) { 189 | re = /.$/; 190 | w = w.replace(re,""); 191 | } 192 | 193 | // and turn initial Y back to y 194 | if (firstch == "y") 195 | w = firstch.toLowerCase() + w.substr(1); 196 | return w; 197 | } 198 | } 199 | 200 | 201 | 202 | 203 | var splitChars = (function() { 204 | var result = {}; 205 | var singles = [96, 180, 187, 191, 215, 247, 749, 885, 903, 907, 909, 930, 1014, 1648, 206 | 1748, 1809, 2416, 2473, 2481, 2526, 2601, 2609, 2612, 2615, 2653, 2702, 207 | 2706, 2729, 2737, 2740, 2857, 2865, 2868, 2910, 2928, 2948, 2961, 2971, 208 | 2973, 3085, 3089, 3113, 3124, 3213, 3217, 3241, 3252, 3295, 3341, 3345, 209 | 3369, 3506, 3516, 3633, 3715, 3721, 3736, 3744, 3748, 3750, 3756, 3761, 210 | 3781, 3912, 4239, 4347, 4681, 4695, 4697, 4745, 4785, 4799, 4801, 4823, 211 | 4881, 5760, 5901, 5997, 6313, 7405, 8024, 8026, 8028, 8030, 8117, 8125, 212 | 8133, 8181, 8468, 8485, 8487, 8489, 8494, 8527, 11311, 11359, 11687, 11695, 213 | 11703, 11711, 11719, 11727, 11735, 12448, 12539, 43010, 43014, 43019, 43587, 214 | 43696, 43713, 64286, 64297, 64311, 64317, 64319, 64322, 64325, 65141]; 215 | var i, j, start, end; 216 | for (i = 0; i < singles.length; i++) { 217 | result[singles[i]] = true; 218 | } 219 | var ranges = [[0, 47], [58, 64], [91, 94], [123, 169], [171, 177], [182, 184], [706, 709], 220 | [722, 735], [741, 747], [751, 879], [888, 889], [894, 901], [1154, 1161], 221 | [1318, 1328], [1367, 1368], [1370, 1376], [1416, 1487], [1515, 1519], [1523, 1568], 222 | [1611, 1631], [1642, 1645], [1750, 1764], [1767, 1773], [1789, 1790], [1792, 1807], 223 | [1840, 1868], [1958, 1968], [1970, 1983], [2027, 2035], [2038, 2041], [2043, 2047], 224 | [2070, 2073], [2075, 2083], [2085, 2087], [2089, 2307], [2362, 2364], [2366, 2383], 225 | [2385, 2391], [2402, 2405], [2419, 2424], [2432, 2436], [2445, 2446], [2449, 2450], 226 | [2483, 2485], [2490, 2492], [2494, 2509], [2511, 2523], [2530, 2533], [2546, 2547], 227 | [2554, 2564], [2571, 2574], [2577, 2578], [2618, 2648], [2655, 2661], [2672, 2673], 228 | [2677, 2692], [2746, 2748], [2750, 2767], [2769, 2783], [2786, 2789], [2800, 2820], 229 | [2829, 2830], [2833, 2834], [2874, 2876], [2878, 2907], [2914, 2917], [2930, 2946], 230 | [2955, 2957], [2966, 2968], [2976, 2978], [2981, 2983], [2987, 2989], [3002, 3023], 231 | [3025, 3045], [3059, 3076], [3130, 3132], [3134, 3159], [3162, 3167], [3170, 3173], 232 | [3184, 3191], [3199, 3204], [3258, 3260], [3262, 3293], [3298, 3301], [3312, 3332], 233 | [3386, 3388], [3390, 3423], [3426, 3429], [3446, 3449], [3456, 3460], [3479, 3481], 234 | [3518, 3519], [3527, 3584], [3636, 3647], [3655, 3663], [3674, 3712], [3717, 3718], 235 | [3723, 3724], [3726, 3731], [3752, 3753], [3764, 3772], [3774, 3775], [3783, 3791], 236 | [3802, 3803], [3806, 3839], [3841, 3871], [3892, 3903], [3949, 3975], [3980, 4095], 237 | [4139, 4158], [4170, 4175], [4182, 4185], [4190, 4192], [4194, 4196], [4199, 4205], 238 | [4209, 4212], [4226, 4237], [4250, 4255], [4294, 4303], [4349, 4351], [4686, 4687], 239 | [4702, 4703], [4750, 4751], [4790, 4791], [4806, 4807], [4886, 4887], [4955, 4968], 240 | [4989, 4991], [5008, 5023], [5109, 5120], [5741, 5742], [5787, 5791], [5867, 5869], 241 | [5873, 5887], [5906, 5919], [5938, 5951], [5970, 5983], [6001, 6015], [6068, 6102], 242 | [6104, 6107], [6109, 6111], [6122, 6127], [6138, 6159], [6170, 6175], [6264, 6271], 243 | [6315, 6319], [6390, 6399], [6429, 6469], [6510, 6511], [6517, 6527], [6572, 6592], 244 | [6600, 6607], [6619, 6655], [6679, 6687], [6741, 6783], [6794, 6799], [6810, 6822], 245 | [6824, 6916], [6964, 6980], [6988, 6991], [7002, 7042], [7073, 7085], [7098, 7167], 246 | [7204, 7231], [7242, 7244], [7294, 7400], [7410, 7423], [7616, 7679], [7958, 7959], 247 | [7966, 7967], [8006, 8007], [8014, 8015], [8062, 8063], [8127, 8129], [8141, 8143], 248 | [8148, 8149], [8156, 8159], [8173, 8177], [8189, 8303], [8306, 8307], [8314, 8318], 249 | [8330, 8335], [8341, 8449], [8451, 8454], [8456, 8457], [8470, 8472], [8478, 8483], 250 | [8506, 8507], [8512, 8516], [8522, 8525], [8586, 9311], [9372, 9449], [9472, 10101], 251 | [10132, 11263], [11493, 11498], [11503, 11516], [11518, 11519], [11558, 11567], 252 | [11622, 11630], [11632, 11647], [11671, 11679], [11743, 11822], [11824, 12292], 253 | [12296, 12320], [12330, 12336], [12342, 12343], [12349, 12352], [12439, 12444], 254 | [12544, 12548], [12590, 12592], [12687, 12689], [12694, 12703], [12728, 12783], 255 | [12800, 12831], [12842, 12880], [12896, 12927], [12938, 12976], [12992, 13311], 256 | [19894, 19967], [40908, 40959], [42125, 42191], [42238, 42239], [42509, 42511], 257 | [42540, 42559], [42592, 42593], [42607, 42622], [42648, 42655], [42736, 42774], 258 | [42784, 42785], [42889, 42890], [42893, 43002], [43043, 43055], [43062, 43071], 259 | [43124, 43137], [43188, 43215], [43226, 43249], [43256, 43258], [43260, 43263], 260 | [43302, 43311], [43335, 43359], [43389, 43395], [43443, 43470], [43482, 43519], 261 | [43561, 43583], [43596, 43599], [43610, 43615], [43639, 43641], [43643, 43647], 262 | [43698, 43700], [43703, 43704], [43710, 43711], [43715, 43738], [43742, 43967], 263 | [44003, 44015], [44026, 44031], [55204, 55215], [55239, 55242], [55292, 55295], 264 | [57344, 63743], [64046, 64047], [64110, 64111], [64218, 64255], [64263, 64274], 265 | [64280, 64284], [64434, 64466], [64830, 64847], [64912, 64913], [64968, 65007], 266 | [65020, 65135], [65277, 65295], [65306, 65312], [65339, 65344], [65371, 65381], 267 | [65471, 65473], [65480, 65481], [65488, 65489], [65496, 65497]]; 268 | for (i = 0; i < ranges.length; i++) { 269 | start = ranges[i][0]; 270 | end = ranges[i][1]; 271 | for (j = start; j <= end; j++) { 272 | result[j] = true; 273 | } 274 | } 275 | return result; 276 | })(); 277 | 278 | function splitQuery(query) { 279 | var result = []; 280 | var start = -1; 281 | for (var i = 0; i < query.length; i++) { 282 | if (splitChars[query.charCodeAt(i)]) { 283 | if (start !== -1) { 284 | result.push(query.slice(start, i)); 285 | start = -1; 286 | } 287 | } else if (start === -1) { 288 | start = i; 289 | } 290 | } 291 | if (start !== -1) { 292 | result.push(query.slice(start)); 293 | } 294 | return result; 295 | } 296 | 297 | 298 | -------------------------------------------------------------------------------- /docs/_apidoc/stream_manager.utilinternal.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | stream_manager.utilinternal module — Greengrass Stream Manager Python SDK 1.1.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 | 93 | 94 |
95 | 96 | 97 | 103 | 104 | 105 |
106 | 107 |
108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 |
126 | 127 |
    128 | 129 |
  • Docs »
  • 130 | 131 |
  • stream_manager.utilinternal module
  • 132 | 133 | 134 |
  • 135 | 136 | 137 | View page source 138 | 139 | 140 |
  • 141 | 142 |
143 | 144 | 145 |
146 |
147 |
148 |
149 | 150 |
151 |

stream_manager.utilinternal module

152 |

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 153 | SPDX-License-Identifier: Apache-2.0

154 |
155 |
156 | class stream_manager.utilinternal.UtilInternal[source]
157 |

Bases: object

158 |
159 |
160 | static sync(coro, loop: asyncio.events.AbstractEventLoop)[source]
161 |
162 | 163 |
164 |
165 | static del_empty_arrays(d)[source]
166 |
167 | 168 |
169 |
170 | static serialize_to_json_with_empty_array_as_null(data)[source]
171 |
172 | 173 |
174 |
175 | static int_to_bytes(i, length=4)[source]
176 |
177 | 178 |
179 |
180 | static int_from_bytes(b)[source]
181 |
182 | 183 |
184 |
185 | static encode_frame(frame)Sequence[bytes][source]
186 |
187 | 188 |
189 |
190 | static get_request_id()[source]
191 |
192 | 193 |
194 |
195 | static is_invalid(o)[source]
196 |
197 | 198 |
199 |
200 | static raise_on_error_response(response)[source]
201 |
202 | 203 |
204 | 205 |
206 | 207 | 208 |
209 | 210 |
211 |
212 | 213 | 214 |
215 | 216 |
217 |

218 | © Copyright 2022, Amazon.com. 219 | 220 |

221 |
222 | Built with Sphinx using a theme provided by Read the Docs. 223 | 224 |
225 | 226 |
227 |
228 | 229 |
230 | 231 |
232 | 233 | 234 | 235 | 236 | 237 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 261 | 262 | 263 | -------------------------------------------------------------------------------- /docs/_modules/stream_manager/exceptions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | stream_manager.exceptions — Greengrass Stream Manager Python SDK 1.1.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 | 90 | 91 |
92 | 93 | 94 | 100 | 101 | 102 |
103 | 104 |
105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 |
123 | 124 |
    125 | 126 |
  • Docs »
  • 127 | 128 |
  • Module code »
  • 129 | 130 |
  • stream_manager.exceptions
  • 131 | 132 | 133 |
  • 134 | 135 |
  • 136 | 137 |
138 | 139 | 140 |
141 |
142 |
143 |
144 | 145 |

Source code for stream_manager.exceptions

146 | """
147 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
148 | SPDX-License-Identifier: Apache-2.0
149 | """
150 | 
151 | 
152 | 
[docs]class StreamManagerException(Exception): 153 | def __init__(self, message="", status=None, request_id=None): 154 | super().__init__(message) 155 | self.status = status 156 | self.request_id = request_id 157 | self.message = message
158 | 159 | 160 |
[docs]class ClientException(StreamManagerException): 161 | pass
162 | 163 | 164 |
[docs]class ValidationException(ClientException): 165 | pass
166 | 167 | 168 |
[docs]class ConnectFailedException(ClientException): 169 | pass
170 | 171 | 172 |
[docs]class InvalidRequestException(StreamManagerException): 173 | pass
174 | 175 | 176 |
[docs]class RequestPayloadTooLargeException(StreamManagerException): 177 | pass
178 | 179 | 180 |
[docs]class ResourceNotFoundException(StreamManagerException): 181 | pass
182 | 183 | 184 |
[docs]class ResponsePayloadTooLargeException(StreamManagerException): 185 | pass
186 | 187 | 188 |
[docs]class ServerTimeoutException(StreamManagerException): 189 | pass
190 | 191 | 192 |
[docs]class UnauthorizedException(StreamManagerException): 193 | pass
194 | 195 | 196 |
[docs]class UnknownFailureException(StreamManagerException): 197 | pass
198 | 199 | 200 |
[docs]class NotEnoughMessagesException(StreamManagerException): 201 | pass
202 | 203 | 204 |
[docs]class MessageStoreReadErrorException(StreamManagerException): 205 | pass
206 | 207 | 208 |
[docs]class ServerOutOfMemoryException(StreamManagerException): 209 | pass
210 | 211 | 212 |
[docs]class UpdateFailedException(StreamManagerException): 213 | pass
214 | 215 | 216 |
[docs]class UnknownOperationException(StreamManagerException): 217 | pass
218 | 219 | 220 |
[docs]class UpdateNotAllowedException(InvalidRequestException): 221 | pass
222 |
223 | 224 |
225 | 226 |
227 |
228 | 229 | 230 |
231 | 232 |
233 |

234 | © Copyright 2022, Amazon.com. 235 | 236 |

237 |
238 | Built with Sphinx using a theme provided by Read the Docs. 239 | 240 |
241 | 242 |
243 |
244 | 245 |
246 | 247 |
248 | 249 | 250 | 251 | 252 | 253 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 277 | 278 | 279 | --------------------------------------------------------------------------------