Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def show(ctx, name):
"""
Print out all parameters that match NAME. If NAME ends with a '*', do a wildcard search on all parameters that
begin with the prefix.
"""
parms = UnboundParameterFactory.new(name)
parms.sort()
if not parms:
print('No parameters found that match "{}"'.format(name))
else:
for parm in parms:
print(parm)
def parameters_update(ctx, name, new_kms_key, value, force_multiple, dry_run):
"""
Update the parameter that matches NAME with either a new KMS Key ID, a new value, or both.
If NAME ends with a '*', and you use the --new-kms-key parameter, update the KMS Key ID on on all parameters that
begin with the prefix.
If NAME ends with a '*', and you use the --value parameter, don't update the value for all parameters that begin
with the prefix unless you also specify --force-multiple.
"""
parms = UnboundParameterFactory.new(name)
if not parms:
print('No parameters found that match "{}"'.format(name))
else:
parms.sort()
print("\nBEFORE:")
print("-----------------------------------------------------------------------")
for parm in parms:
print(parm)
print("\nAFTER:")
print("-----------------------------------------------------------------------")
for parm in parms:
if new_kms_key:
parm.kms_key_id = new_kms_key
if len(parms) == 1 or force_multiple:
if value:
parm.value = value
def parameters_copy(ctx, from_name, to_name, new_kms_key, overwrite, dry_run):
"""
If FROM_NAME does not end with a "*", copy a parameter named FROM_NAME to another named TO_NAME.
If FROM_NAME does end with a '*', do a wildcard search on all parameters that begin with the FROM_NAME, and copy
those parameters to new ones with the FROM_NAME as prefix replaced with TO_NAME as prefix.
"""
parms = UnboundParameterFactory.new(from_name)
if not parms:
print('No parameters found that match "{}"'.format(from_name))
else:
parms.sort()
print("\FROM:")
print("-----------------------------------------------------------------------")
for parm in parms:
print(parm)
m = WILDCARD_RE.search(from_name)
if m:
if not to_name.endswith('.'):
to_name += "."
for parm in parms:
parm.prefix = to_name
if new_kms_key:
parm.kms_key_id = new_kms_key