Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@BaseParameter.name.setter
def name(self, name):
if not name:
raise ValueError('UnboundParameter.name cannot be empty.')
self._key = name.split('.')[-1]
prefix = '.'.join(name.split('.')[:-1])
self._prefix = '{}.'.format(prefix) if prefix else ''
self._from_aws()
return self.name > other.name
def __ge__(self, other):
return self.name >= other.name
def __le__(self, other):
return self.name <= other.name
def __eq__(self, other):
return self.name == other.name
def __ne__(self, other):
return self.name != other.name
class UnboundParameter(BaseParameter):
"""
This is a parameter not bound to an ECS service or task.
"""
@BaseParameter.prefix.setter
def prefix(self, value):
self._prefix = value
if self._prefix is None:
self._prefix = ''
self._from_aws()
@BaseParameter.name.setter
def name(self, name):
if not name:
raise ValueError('UnboundParameter.name cannot be empty.')
self._key = name.split('.')[-1]
@BaseParameter.value.setter
def value(self, new_value):
self._value = new_value
:return: string
"""
base = super(UnboundParameter, self).display(key, value)
if not self._aws_parameter:
base += " [NOT IN AWS]"
return base
class ClusterServicePrefixMixin(object):
@property
def prefix(self):
return "{}.{}.".format(self.cluster, self.service)
class Parameter(ClusterServicePrefixMixin, BaseParameter):
"""
This class represents a parameter in the AWS Systems Manager Parameter Store.
"""
def __init__(self, service, cluster, aws={}, yml=None):
self.ssm = get_boto3_session().client('ssm')
self.service = service
self.cluster = cluster
self._defaults()
self.is_external = False
self.__from_yml(yml)
self._from_aws(aws)
def _defaults(self):
super(Parameter, self)._defaults()
self._key = None
@BaseParameter.prefix.setter
def prefix(self, value):
self._prefix = value
if self._prefix is None:
self._prefix = ''
self._from_aws()
@BaseParameter.key.setter
def key(self, value):
"""
Set the prefix-free parameter name.
:param value: string
"""
if not value:
raise ValueError('UnboundParameter.key cannot be empty.')
self._key = value
self._from_aws()