Skip to main content
Version: 6 - Palatschinke

File

class resources.file.File

Base class: Resource

A file which is stored in Cloudomation.

To store data in a file there are three additional arguments for the save() method available:

import flow_api

def handler(system: flow_api.System, this: flow_api.Execution):
# store a text (utf8 string)
system.file('my-file.txt').save_text_content('text content')
# read as base64
assert system.file('my-file.txt').get_base64_content() == 'dGV4dCBjb250ZW50'
# store bytes data
system.file('my-file.dat').save_bytes_content(b'bytes data äöü')
# read as text (utf8 string)
assert system.file('my-file.dat').get_text_content() == 'bytes data äöü'
# store a base64 encoded string
system.file('my-file.ext').save_base64_content('Q2xvdWRvbWF0aW9u')
# read as bytes
assert system.file('my-file.ext').get_bytes_content() == b'Cloudomation'

# list files
for file_ in system.files():
this.log(file_.get('name', 'size_bytes'))

# clean up
system.file('my-file.txt').delete()
system.file('my-file.dat').delete()
system.file('my-file.ext').delete()

return this.success('all done')

See the corresponding Flow Api class at File

PropertyDescriptionTypeImport/Export
contentThe binary content of the file.BYTEA()both
created_atDateTime(timezone=True)export only
created_byUUID()export only
deleted_atDateTime(timezone=True)export only
deleted_byUUID()export only
descriptionText()both
idUUID()neither
is_archivedBoolean()both
is_openedBoolean()neither
is_pinnedBoolean()neither
is_readonlyBoolean()both
modified_atDateTime(timezone=True)export only
modified_byUUID()export only
nameString(length=128)both
organization_idUUID()export only
project_idUUID()both
record_typeEnum('CONNECTOR', 'FILE', 'FLOW', 'GIT_CONFIG', 'IDENTITY', 'OAUTH', 'ORGANIZATION', 'PLUGIN', 'PROJECT', 'RESOURCE', 'ROLE', 'SCHEDULE', 'SCHEDULER', 'SCHEMA', 'SEARCH', 'SETTING', 'SYNC_CONFIG', 'TAG', 'USER', 'VAULT_CONFIG', 'WEBHOOK', 'WORKSPACE', 'WRAPPER', 'RESOURCE_WRAPPER', 'EXECUTION', 'MESSAGE', 'PROCESS', name='tabletype')neither
resource_typeEnum('CONNECTOR', 'FILE', 'FLOW', 'GIT_CONFIG', 'OAUTH', 'ORGANIZATION', 'PLUGIN', 'PROJECT', 'ROLE', 'SCHEDULE', 'SCHEDULER', 'SCHEMA', 'SEARCH', 'SETTING', 'SYNC_CONFIG', 'TAG', 'USER', 'VAULT_CONFIG', 'WEBHOOK', 'WORKSPACE', 'WRAPPER', 'RESOURCE_WRAPPER', name='resourcetype')neither
size_bytesBigInteger()neither
workspace_idUUID()export only