brewtils.resolvers package¶
Submodules¶
brewtils.resolvers.gridfs module¶
-
class
brewtils.resolvers.gridfs.
GridfsResolver
(client)[source]¶ Bases:
object
Bytes-Resolver for GridFS
Resolvers are meant to be written for specific storage types. In this case, we are just simply using the API to stream bytes into a file.
This class is meant to be used transparently to Plugin developers. Resolvers respond to two methods:
- upload(value)
- download(bytes_parameter, writer)
-
client
¶ A brewtils.EasyClient
-
download
(bytes_parameter, writer)[source]¶ Download the given bytes parameter.
Parameters: - bytes_parameter – A specific request’s parameter value.
- writer – File-like object that has a write method.
-
upload
(value)[source]¶ Upload the given value to the server if necessary.
The value can be one of the following:
- A dictionary with a storage_type and filename.
- A string pointing to a valid filename.
- An open file descriptor.
If you use a dictionary, and include an “id” the resolver will assume you have already uploaded the file, and skip doing it for you.
Parameters: value – Value to upload. Returns: A valid dictionary to use as a bytes parameter.
brewtils.resolvers.parameter module¶
-
class
brewtils.resolvers.parameter.
DownloadResolver
(request, params_to_resolve, resolvers, base_directory)[source]¶
-
class
brewtils.resolvers.parameter.
ParameterResolver
(request, params_to_resolve, resolvers)[source]¶ Bases:
object
Base class for parameter resolution.
This class is used under-the-hood for various plugin functions. Its purpose is to remove all the various cleanup and house keeping steps involved in resolving parameters. An example of an unresolved parameter is a dictionary which represents a bytes object. In this case, the user wants the open file descriptor, not the random dictionary that they don’t know how to process. The parameter resolver helps handle these scenarios by providing the following API:
with ParameterResolver(request, ["my_file"], resolvers) as resolved_params: file_bytes = resolved_params["my_file"].read()
This is intended for internal use for the plugin class.
Module contents¶
-
class
brewtils.resolvers.
DownloadResolver
(request, params_to_resolve, resolvers, base_directory)[source]¶
-
class
brewtils.resolvers.
GridfsResolver
(client)[source]¶ Bases:
object
Bytes-Resolver for GridFS
Resolvers are meant to be written for specific storage types. In this case, we are just simply using the API to stream bytes into a file.
This class is meant to be used transparently to Plugin developers. Resolvers respond to two methods:
- upload(value)
- download(bytes_parameter, writer)
-
client
¶ A brewtils.EasyClient
-
download
(bytes_parameter, writer)[source]¶ Download the given bytes parameter.
Parameters: - bytes_parameter – A specific request’s parameter value.
- writer – File-like object that has a write method.
-
upload
(value)[source]¶ Upload the given value to the server if necessary.
The value can be one of the following:
- A dictionary with a storage_type and filename.
- A string pointing to a valid filename.
- An open file descriptor.
If you use a dictionary, and include an “id” the resolver will assume you have already uploaded the file, and skip doing it for you.
Parameters: value – Value to upload. Returns: A valid dictionary to use as a bytes parameter.