class Agent_Catalog_Schema(Base_Schema): """Represents an agent in the catalog.""" doc = Agent_Catalog_Document id = Str(required=True, example='filebeat', description='Id of the agent in the catalog.') actions = Nested(Agent_Catalog_Action_Schema, many=True, unknown='INCLUDE', description='Action properties.', validate=Unique_List.apply('id'), error_messages=Unique_List.error_messages) parameters = Nested(Agent_Catalog_Parameter_Schema, many=True, unknown='INCLUDE', description='Parameter properties.', validate=Unique_List.apply('id'), error_messages=Unique_List.error_messages) resources = Nested(Agent_Catalog_Resource_Schema, many=True, unknown='INCLUDE', description='Resource properties.', validate=Unique_List.apply('id'), error_messages=Unique_List.error_messages) description = Str( example='Collect system metrics from execution environments.', description='Short description of the agent.') deployment_source = List_or_One( Str, example='https://www.example.com/k8s-artefact.yaml', description='Link to the deployment sources')
class Agent_Catalog_Resource_Config_Schema(Schema): """Agent resource configuration.""" path = List_or_One(Str, required=True, example='/usr/share/filebeat/filebeat.yml', description='File path.')
class Pipeline_Schema(Base_Schema): """Represents the stored pipelines.""" doc = Pipeline_Document id = Str(required=True, example='BXrHRn5RPU55Qh9JwMZn', description='Id of the pipeline.') name = Str(description='Used by the UI to create a new pipeline.', example='test-pipeline') agent_instance_ids = List_or_One( Str(validate=In.apply(Agent_Instance_Document.get_ids), error_messages=In.error_messages), description='Ids of the agent instances included in this pipeline.') algorithm_instance_ids = List_or_One( Str(validate=In.apply(Algorithm_Instance_Document.get_ids), error_messages=In.error_messages), description='Ids of the algorithm instances included in this pipeline.' )
class Algorithm_Catalog_Parameter_Schema(Schema): """Algorithm parameter.""" id = Str(required=True, example='frequency', description='Parameter id.') type = Str(required=True, enum=PARAMETER_TYPES, example=PARAMETER_TYPES[0], description='Parameter type.', validate=validate.OneOf(PARAMETER_TYPES)) list = Bool(default=False, example=True, description='Indicate if the parameter can have multiple values.') values = List_or_One(Str, example='mysql', description='Possible values if the parameter type is choice.') encoding_scheme = Str(default='base64', example='base64', description='Encoding scheme used to store the binary data') description = Str(example='Enable the algorithm.', description='Short description of the parameter.') example = Raw(example='10s', description='Example of parameter value.')
class Agent_Catalog_Action_Config_Schema(Schema): """Agent action configuration.""" cmd = Str(required=True, example='service filebeat start', description='Action command.') args = List_or_One(Str, example='-v', description='Action command argument') daemon = Bool(default=False, example=True, description='Execute the command as daemon.')
class eBPF_Program_Catalog_Config_Schema(Schema): """eBPF program configuration.""" code = List_or_One(Str, required=True, description='Code of the eBPF program.') metrics = Nested(eBPF_Program_Catalog_Config_Metric_Schema, many=True, unknown='INCLUDE', description='eBPF program metrics.', validate=Unique_List.apply('name'), error_messages=Unique_List.error_messages)
class Agent_Catalog_Parameter_Config_Schema(Schema): """Agent parameter configuration.""" schema = Str(required=True, enum=PARAMETER_SCHEMAS, example=PARAMETER_SCHEMAS[0], description='Schema of the parameter file', validate=validate.OneOf(PARAMETER_SCHEMAS)) source = Str(required=True, example='/usr/share/filebeat/filebeat.yml', description='Path of the source parameter file') path = List_or_One(Str, required=True, example='enabled', description='Path of the parameter value in the file')
class eBPF_Program_Catalog_Parameter_Schema(Schema): """eBPF program configuration.""" id = Str(required=True, example='interface', description='Parameter id.') type = Str(required=True, description='Parameter type.', enum=PARAMETER_TYPES, example='integer', validate=validate.OneOf(PARAMETER_TYPES)) list = Bool( default=False, example=True, description='Indicate if the parameter can have multiple values.') values = List_or_One( Str, example='yes', description='Possible values if the parameter type is choice.') description = Str(example='Network Interface to attach.', description='Short description of the parameter.') example = Raw(example='eno0', description='Example of parameter value.')
class Query_Request_Schema(Base_Schema): """Query request to filter the items.""" select = List_or_One(Str, example='id', description='Fields to return.', validate=Unique_List.apply(), error_messages=Unique_List.error_messages) where = Nested( Query_Request_Clause_Schema, description='Filter the items based on different conditions.') order = Nested(Query_Request_Order_Schema, many=True, description='Order the filtered items.') limit = Nested(Query_Request_Limit_Schema, description='Limit the number of items to return.') force = Boolean( default=False, example=True, description= """Force the execution of the request even there are some errors (example: delete a inconstent entries).""")
class Agent_Catalog_Parameter_Schema(Schema): """Agent parameter.""" id = Str(required=True, example='log-period', description='Parameter id.') type = Str(required=True, enum=PARAMETER_TYPES, example=PARAMETER_TYPES[0], description='Parameter type.', validate=validate.OneOf(PARAMETER_TYPES)) config = Nested(Agent_Catalog_Parameter_Config_Schema, unknown='INCLUDE', required=True, description='Parameter configuration.') list = Bool( default=False, example=True, description='Indicate if the parameter can have multiple values.') values = List_or_One( Str, example='mysql', description='Possible values if the parameter type is choice.') description = Str(example='Enable the agent.', description='Short description of the parameter.') example = Raw(example='10s', description='Example of parameter value.')
class Code_Request_Schema(Base_Schema): """Request for code endpoint.""" id = Str(required=True, example='firewall', description='Code id.') code = List_or_One(Str, required=True, description='Code source')