task_configuration.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:aws-ops-automator 作者: awslabs 项目源码 文件源码
def validate_regions(self, regions, action_name, ):
        action_properties = actions.get_action_properties(action_name)
        service_name = action_properties[actions.ACTION_SERVICE]

        if self.service_is_regional(service_name) and action_properties.get(actions.ACTION_MULTI_REGION, True):
            if regions is None or len(regions) == 0:
                return [boto3.Session().region_name]
            else:
                available_regions = self.service_regions(service_name)
                if len(regions) == 1 and list(regions)[0] == "*":
                    return available_regions

                for region in regions:
                    if region not in available_regions:
                        raise ValueError(MSG_BAD_REGION.format(region, service_name, ",".join(available_regions)))
                return list(regions)
        else:
            if regions is not None and len(regions) != 0:
                msg = WARN_NOT_REGIONAL_SERVICE.format(",".join(regions), service_name, action_name)
                self._warn(msg)
        return []
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号