Skip to main content
Version: 7 - Gugelhupf

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', 'content_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
bundle_idReference to the bundle this record is associated with. Allowed for CONNECTOR, FILE, FLOW, PLUGIN, ROLE, SCHEDULER, SCHEMA, SETTING, TAG, WRAPPER. Not allowed for BUNDLE, BUNDLE_REPOSITORY, EXECUTION, GIT_CONFIG, MESSAGE, OAUTH, ORGANIZATION, PROCESS, PROJECT, SCHEDULE, SYNC_CONFIG, USER, VAULT_CONFIG, WEBHOOK, WORKSPACE. Mutually exclusive with project_idUUID()both
contentThe binary content of the file.BYTEA()both
content_size_bytesThe size of the content in bytes .BigInteger()export only
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_bundle_readonlyBoolean()neither
is_project_readonlyBoolean()neither
is_readonlyA flag to control if the record can be modified. Allowed for BUNDLE, BUNDLE_REPOSITORY, CONNECTOR, FILE, FLOW, GIT_CONFIG, OAUTH, PLUGIN, PROJECT, ROLE, SCHEDULE, SCHEDULER, SCHEMA, SETTING, SYNC_CONFIG, TAG, VAULT_CONFIG, WEBHOOK, WRAPPER. Not allowed for EXECUTION, MESSAGE, ORGANIZATION, PROCESS, USER, WORKSPACEBoolean()both
modified_atDateTime(timezone=True)export only
modified_byUUID()export only
nameString(length=128)both
organization_idUUID()export only
project_idReference to the project this record is associated with. Allowed for CONNECTOR, EXECUTION, FILE, FLOW, GIT_CONFIG, MESSAGE, OAUTH, PLUGIN, SCHEDULE, SCHEDULER, SCHEMA, SETTING, SYNC_CONFIG, TAG, VAULT_CONFIG, WEBHOOK, WRAPPER. Not allowed for BUNDLE, BUNDLE_REPOSITORY, ORGANIZATION, PROCESS, PROJECT, ROLE, USER, WORKSPACE. Mutually exclusive with bundle_id.UUID()both
record_typeEnum('BUNDLE', 'BUNDLE_REPOSITORY', 'CONNECTOR', 'EXECUTION', 'FILE', 'FLOW', 'GIT_CONFIG', 'MESSAGE', 'OAUTH', 'ORGANIZATION', 'PLUGIN', 'PROCESS', 'PROJECT', 'ROLE', 'SCHEDULE', 'SCHEDULER', 'SCHEMA', 'SETTING', 'SYNC_CONFIG', 'TAG', 'USER', 'VAULT_CONFIG', 'WEBHOOK', 'WORKSPACE', 'WRAPPER', name='recordtype')neither
resource_typeEnum('BUNDLE', 'BUNDLE_REPOSITORY', 'CONNECTOR', 'FILE', 'FLOW', 'GIT_CONFIG', 'OAUTH', 'ORGANIZATION', 'PLUGIN', 'PROJECT', 'ROLE', 'SCHEDULE', 'SCHEDULER', 'SCHEMA', 'SETTING', 'SYNC_CONFIG', 'TAG', 'USER', 'VAULT_CONFIG', 'WEBHOOK', 'WORKSPACE', 'WRAPPER', name='resourcetype')neither
schema_versionString(length=128)neither
workspace_idUUID()export only