[英]Add Target Group to application listener (AWS CDK PYTHON)
我一直在嘗試運行此代碼失敗,我正在使用 python 和 AWS CDK:
applicationTargetGroup = elbv2.ApplicationTargetGroup(self, 'ApplicationTargetGroup',
target_type=elbv2.TargetType.IP,
target_group_name='stg-test',
protocol=elbv2.ApplicationProtocol.HTTP,
port=8080,
vpc=vpc,
health_check=elbv2.HealthCheck(path='/images/favicon.ico')
)
httpsListener.add_target_groups('TargetGroups',
applicationTargetGroup,
host_header='host.domain.com',
priority=107)
我得到的錯誤如下:
文件“/home/user/workspace/test/cdk/pytest/pytest/pytest_stack.py”,第 33 行, init httpsListener.add_target_groups('TargetGroups', applicationTargetGroup) TypeError: add_target_groups() 需要 2 個位置 arguments 但給出了 3 個
我不明白我做錯了什么,因為文檔說明沒問題:
add_target_groups(id, *, target_groups, conditions=None, host_header=None, path_pattern=None, path_patterns=None, priority=None)
謝謝
add_target_groups的文檔告訴applicationTargetGroup
傳遞了一個關鍵字參數和一個list
:
httpsListener.add_target_groups(
'TargetGroups',
target_groups=[applicationTargetGroup],
host_header='host.domain.com',
priority=107)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.