(g)ULP!
Loading...
Searching...
No Matches
GulpMapping Class Reference
Inheritance diagram for GulpMapping:
Collaboration diagram for GulpMapping:

Public Member Functions

dict to_dict (self)
 
 to_py_dict (cls, str|dict data)
 

Static Public Member Functions

"GulpMapping" from_dict (dict d)
 

Static Public Attributes

dict fields
 
dict model_config
 
Optional options
 

Detailed Description

defines a source->elasticsearch document mapping for a Gulp plugin.

Definition at line 167 of file models.py.

Member Function Documentation

◆ from_dict()

"GulpMapping" from_dict ( dict d)
static

Definition at line 227 of file models.py.

227 def from_dict(d: dict) -> "GulpMapping":
228 m = d.get("fields", {})
229 if len(m) > 0:
230 fields = {k: FieldMappingEntry.from_dict(v) for k, v in m.items()}
231 else:
232 fields = {}
233 opts = d.get("options", None)
234 if opts is not None:
235 options = GulpMappingOptions.from_dict(opts)
236 else:
237 # default values
238 options = GulpMappingOptions()
239
240 return GulpMapping(
241 fields=fields,
242 options=options,
243 )
244

◆ to_dict()

dict to_dict ( self)
NOTE: options is guaranteed to be not None (default values are applied if None)

Definition at line 212 of file models.py.

212 def to_dict(self) -> dict:
213 """
214 NOTE: options is guaranteed to be not None (default values are applied if None)
215 """
216 d = {
217 "fields": {k: v.to_dict() for k, v in self.fields.items()},
218 "options": (
219 GulpMappingOptions.to_dict(self.options)
220 if self.options is not None
221 else GulpMappingOptions().to_dict()
222 ),
223 }
224 return d
225
Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_py_dict()

to_py_dict ( cls,
str | dict data )

Definition at line 247 of file models.py.

247 def to_py_dict(cls, data: str | dict):
248 if data is None:
249 return {}
250
251 if isinstance(data, dict):
252 return data
253
254 return json.loads(data)

Member Data Documentation

◆ fields

dict fields
static
Initial value:
= Field(
{},
description='a dictionary where each key is a source field to be mapped to "map_to" defined in "FieldMappingEntry".',
)

Definition at line 172 of file models.py.

◆ model_config

dict model_config
static
Initial value:
= {
"json_schema_extra": {
"example": {
"fields": {
"source_field1_single": {
"map_to": "my_field"
},
"source_field2_multiple": {
"map_to": ["my_field1", "myfield2"]
},
"source_field3_variable": {
"map_to": [
["category", "process_creation", "process.pe.company"],
["category", "image_load", "file.pe.company"],
]
},
},
"options": {
"agent_type": "my_agent_type",
"event_code": "my_event_code",
"mapping_id": "my_mapping_id",
"ignore_unmapped": False,
"timestamp_yearfirst": True,
"timestamp_dayfirst": False,
"timestamp_tz": "UTC",
"extra": {"my_custom_option": "my_custom_value"},
},
}
}
}

Definition at line 181 of file models.py.

◆ options

Optional options
static
Initial value:
= Field(
None,
description="specific options for this GulpMapping. if None, defaults are applied.",
)

Definition at line 176 of file models.py.


The documentation for this class was generated from the following file: