heat API : add get_param_value to API utils
Add get_param_value helper to common aws API utils Change-Id: I69ab3ed1e34f8691457f3d986b4af06b1d381039 Signed-off-by: Steven Hardy <shardy@redhat.com>
This commit is contained in:
parent
43e558ff5e
commit
119d4a06f3
@ -19,6 +19,7 @@ Helper utilities related to the AWS API implementations
|
||||
|
||||
import re
|
||||
import itertools
|
||||
from heat.api.aws import exception
|
||||
|
||||
|
||||
def format_response(action, response):
|
||||
@ -89,6 +90,19 @@ def extract_param_list(params, prefix=''):
|
||||
return [dict(kv for di, kv in m) for mi, m in members]
|
||||
|
||||
|
||||
def get_param_value(params, key):
|
||||
"""
|
||||
Helper function, looks up an expected parameter in a parsed
|
||||
params dict and returns the result. If params does not contain
|
||||
the requested key we raise an exception of the appropriate type
|
||||
"""
|
||||
try:
|
||||
return params[key]
|
||||
except KeyError:
|
||||
logger.error("Request does not contain %s parameter!" % key)
|
||||
raise exception.HeatMissingParameterError(key)
|
||||
|
||||
|
||||
def reformat_dict_keys(keymap={}, inputdict={}):
|
||||
'''
|
||||
Utility function for mapping one dict format to another
|
||||
|
Loading…
Reference in New Issue
Block a user