CreateApplication搭配使用 AWS SDK - AWS SDK代码示例

AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

CreateApplication搭配使用 AWS SDK

以下代码示例演示如何使用 CreateApplication

Python
SDK适用于 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 create(self, app_name, role_arn, env="SQL-1_0"): """ Creates a Kinesis Data Analytics application. :param app_name: The name of the application. :param role_arn: The ARN of a role that can be assumed by Kinesis Data Analytics and grants needed permissions. :param env: The runtime environment of the application, such as SQL. Code uploaded to the application runs in this environment. :return: Metadata about the newly created application. """ try: response = self.analytics_client.create_application( ApplicationName=app_name, RuntimeEnvironment=env, ServiceExecutionRole=role_arn, ) details = response["ApplicationDetail"] self._update_details(details) logger.info("Application %s created.", app_name) except ClientError: logger.exception("Couldn't create application %s.", app_name) raise else: return details
  • 有关API详细信息,请参阅CreateApplication中的 AWS SDKPython (Boto3) API 参考。