【问题标题】:AWS SDK | List of waiters for Elastic BeanstalkAWS 开发工具包 | Elastic Beanstalk 的服务员列表
【发布时间】:2016-10-04 23:55:55
【问题描述】:

我对这个 method get_waiter(waiter_name) 很感兴趣。服务员的例子在这个page。我到处寻找,但找不到这个特定服务的完整服务员列表(也适用于 Python 和 PHP)。

基本上,我想要做的是在继续下一个任务之前获取应用或环境的状态并验证它是否良好。

如果来自 AWS 响应的状态与我期望的状态匹配,我目前的方法是使用 while 循环和 break。我认为这不是处理这个问题的最好方法。如果我错了,请纠正我。

这是我用 Python 编写的代码中的 sn-p:

# Check the application status
while True:
    try:
        response = eb.describe_application_versions(
            ApplicationName=app_name,
            VersionLabels=[
                new_app_version
            ]
        )
        status = 'PROCESSED'
        app_status = response['ApplicationVersions'][0]['Status']

        if status == app_status:
            print('Application Status:\t', app_status)
            break
    except:
        raise

# Deploy the app to Elastic Beanstalk
try:
    response = eb.update_environment(
        ApplicationName=app_name,
        EnvironmentId=env_id,
        VersionLabel=new_app_version
    )
except:
    raise

# Check environment health
while True:
    try:
        response = eb.describe_environment_health(
            EnvironmentId=env_id,
            AttributeNames=[
                'Status'
            ]
        )
        status = 'Ready'
        env_status = response['Status']

        if status == env_status:
            print('Environment Status:\t', env_status)
            break
    except:
        raise

【问题讨论】:

    标签: python amazon-web-services sdk boto


    【解决方案1】:

    该服务还没有服务员。如果有,您会在文档中看到它们。例如,将elasticbeanstalk boto3 docscloudfront docs 进行比较。 cloudfront 文档有一个waiters section

    【讨论】:

      猜你喜欢
      • 2018-01-24
      • 2013-09-29
      • 2021-08-22
      • 2023-03-09
      • 2019-12-21
      • 2017-02-15
      • 2021-12-27
      • 1970-01-01
      • 2015-10-22
      相关资源
      最近更新 更多