in server/custom_resources/update_usage_plan.py [0:0]
def do_action(event, _):
""" Usage plans are created as part of bootstrap template.
This method associates the usage plans for various tiers with tenant Apis
Args:
event ([type]): [description]
_ ([type]): [description]
"""
logger.info("adding api gateway stage to usage plan")
api_id = event['ResourceProperties']['ApiGatewayId']
settings_table_name = event['ResourceProperties']['SettingsTableName']
is_pooled_deploy = event['ResourceProperties']['IsPooledDeploy']
stage = event['ResourceProperties']['Stage']
usage_plan_id_basic = event['ResourceProperties']['UsagePlanBasicTier']
usage_plan_id_standard = event['ResourceProperties']['UsagePlanStandardTier']
usage_plan_id_premium = event['ResourceProperties']['UsagePlanPremiumTier']
usage_plan_id_platinum = event['ResourceProperties']['UsagePlanPlatinumTier']
table_system_settings = dynamodb.Table(settings_table_name)
if(is_pooled_deploy == "true"):
response_apigateway = apigateway.update_usage_plan (
usagePlanId=usage_plan_id_basic,
patchOperations=[
{
'op':'add',
'path':'/apiStages',
'value': api_id + ":" + stage
}
]
)
response_apigateway = apigateway.update_usage_plan (
usagePlanId=usage_plan_id_standard,
patchOperations=[
{
'op':'add',
'path':'/apiStages',
'value': api_id + ":" + stage
}
]
)
response_apigateway = apigateway.update_usage_plan (
usagePlanId=usage_plan_id_premium,
patchOperations=[
{
'op':'add',
'path':'/apiStages',
'value': api_id + ":" + stage
}
]
)
else:
response_apigateway = apigateway.update_usage_plan (
usagePlanId=usage_plan_id_platinum,
patchOperations=[
{
'op':'add',
'path':'/apiStages',
'value': api_id + ":" + stage
}
]
)