AWSDocAWS SDKGitHub サンプルリポジトリには、さらに多くの SDK サンプルがあります
翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
AWSSDK を使用して Kinesis Data Analytics アプリケーションに出力ストリームを追加する
次のコード例は、Kinesis Data Analytics 3 アプリケーションに出力ストリームを追加する方法を示しています。
- Python
-
- SDK for Python (Boto3)
-
注記
他にもありますGitHub。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 class KinesisAnalyticsApplicationV2: """Encapsulates Kinesis Data Analytics application functions.""" def __init__(self, analytics_client): """ :param analytics_client: A Boto3 Kinesis Data Analytics v2 client. """ self.analytics_client = analytics_client self.name = None self.arn = None self.version_id = None self.create_timestamp = None def add_output(self, in_app_stream_name, output_arn): """ Adds an output stream to the application. Kinesis Data Analytics maps data from the specified in-application stream to the output stream. :param in_app_stream_name: The name of the in-application stream to map to the output stream. :param output_arn: The ARN of the output stream. :return: A list of metadata about the output resources currently assigned to the application. """ try: response = self.analytics_client.add_application_output( ApplicationName=self.name, CurrentApplicationVersionId=self.version_id, Output={ 'Name': in_app_stream_name, 'KinesisStreamsOutput': {'ResourceARN': output_arn}, 'DestinationSchema': {'RecordFormatType': 'JSON'}}) outputs = response['OutputDescriptions'] self.version_id = response['ApplicationVersionId'] logging.info( "Added output %s to %s, which now has %s outputs.", output_arn, self.name, len(outputs)) except ClientError: logger.exception("Couldn't add output %s to %s.", output_arn, self.name) raise else: return outputs
-
API の詳細については、「AWSSDK for Python (Boto3) API リファレンス」のを参照してくださいAddApplicationOutput。
-
入力ストリームをアプリケーションに追加する
アプリケーションの作成