in source/api/app.py [0:0]
def create_manager_stack(filesystem_id, uid, gid, path, subnet_ids, security_groups):
"""
Creates a file manager managed resources stack
:param filesystem_id: The id of the filesystem to create resources for
:param uid: UID that will be used in the EFS access point
:param gid: GID that will be used in the EFS access point
:param path: Path that will be used in the EFS access point
:param subnet_ids: Subnet IDs that the lambda function will use
:param security_groups: Security groups that the lambda function will use
:returns: Create status
:raises ChaliceViewError
"""
stack_name = '{prefix}-ManagedResources-{filesystem}'.format(prefix=STACK_PREFIX, \
filesystem=filesystem_id)
template_body = read_template_file()
try:
response = CFN.create_stack(
StackName=stack_name,
TemplateBody=template_body,
Parameters=[
{
'ParameterKey': 'FileSystemId',
'ParameterValue': filesystem_id,
},
{
'ParameterKey': 'PosixUserUid',
'ParameterValue': uid,
},
{
'ParameterKey': 'PosixUserGid',
'ParameterValue': gid,
},
{
'ParameterKey': 'RootDirectoryPath',
'ParameterValue': path,
},
{
'ParameterKey': 'VpcConfigSgIds',
'ParameterValue': ','.join(security_groups),
},
{
'ParameterKey': 'VpcConfigSubnetIds',
'ParameterValue': ','.join(subnet_ids),
},
],
TimeoutInMinutes=15,
Capabilities=[
'CAPABILITY_NAMED_IAM',
],
OnFailure='DELETE',
)
except botocore.exceptions.ClientError as error:
app.log.error(error)
raise ChaliceViewError(error)
else:
return response