Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def from_yaml(self, yml):
self.family = yml['family']
if 'task_role_arn' in yml:
self.taskRoleArn = yml['task_role_arn']
if 'network_mode' in yml:
self.networkMode = yml['network_mode']
if 'cpu' in yml:
self.cpu = yml['cpu']
if 'memory' in yml:
self.memory = yml['memory']
if 'volumes' in yml:
self.volumes = yml['volumes']
self.containers = [ContainerDefinition(yml=c_yml) for c_yml in yml['containers']]
if 'launch_type' in yml and yml['launch_type'] == 'FARGATE':
self.executionRoleArn = yml['execution_role']
self.requiresCompatibilities = ['FARGATE']
# 'autoprovision': True|False,
# 'driver': 'string',
# 'driverOpts': {
# 'string': 'string'
# },
# 'labels': {
# 'string': 'string'
# }
# }
# }
self.containers = []
for cd in self.__aws_task_definition['containerDefinitions']:
if sourceVolumes:
cd['sourceVolumes'] = sourceVolumes
self.containers.append(ContainerDefinition(cd))
'entryPoint',
'environment',
'essential',
'image',
'links',
'memory',
'memoryReservation',
'name',
'ulimits',
'cap_add',
'cap_drop',
'tmpfs',
]:
setattr(self, "_" + attr, value)
else:
super(ContainerDefinition, self).__setattr__(attr, value)