in source/lambda/configuration/instance_schedule.py [0:0]
def __str__(self):
s = "Schedule \"{}\": ".format(self.name)
attributes = []
if self.description:
attributes.append(" ({})".format(self.description))
if self.override_status is not None:
attributes.append("always {} through override_status".format("running" if self.override_status else "stopped"))
if self.timezone:
attributes.append("timezone is {}".format(str(self.timezone)))
if self.stop_new_instances is not None:
attributes.append("new instanced are {} stopped".format("" if self.stop_new_instances else "not "))
if self.use_maintenance_window is not None:
attributes.append("maintenance windows are {} used to start instances".format("" if self.use_maintenance_window else "not "))
if self.ssm_maintenance_window is not None and self.use_maintenance_window:
attributes.append("SSM maintenance window is {} used to start EC2 instances".format(self.ssm_maintenance_window))
if self.enforced is not None:
attributes.append("schedule state is {} enforced to start or stop instances".format("" if self.enforced else "not "))
if self.hibernate is not None:
attributes.append("stopped ec2 instances are is {} hibernated when stopped".format("" if self.hibernate else "not "))
if self.retain_running is not None:
attributes.append(
"instances are {} stopped if at the and of a period if they were already running at the start of the period".format(
"not" if self.retain_running else ""))
if self.periods and len(self.periods) > 0:
pl = []
for p in self.periods:
ps = "{}".format(str(p["period"].name))
if "instancetype" in p and p["instancetype"] is not None:
ps += ":instancetype {}".format(p["instancetype"])
pl.append(ps)
attributes.append("periods: [" + ", ".join(pl) + ']')
s += "\n".join(attributes)
return s