dasl-client 1.0.6__py3-none-any.whl → 1.0.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of dasl-client might be problematic. Click here for more details.

dasl_client/types/dbui.py CHANGED
@@ -24,12 +24,16 @@ class Dbui(BaseModel):
24
24
  Table column details.
25
25
 
26
26
  Attributes:
27
- name (Optional[str]): The column name.
28
- type_name (Optional[str]): The name of the column type.
29
- type_detail (Optional[str]): Additional information about the
30
- column's type.
31
- position (Optional[int]): The column's index in the table.
32
- nullable (Optional[bool]): Indicates if this column is nullable.
27
+ name (Optional[str]):
28
+ The column name.
29
+ type_name (Optional[str]):
30
+ The name of the column type.
31
+ type_detail (Optional[str]):
32
+ Additional information about the column's type.
33
+ position (Optional[int]):
34
+ The column's index in the table.
35
+ nullable (Optional[bool]):
36
+ Indicates if this column is nullable.
33
37
  """
34
38
 
35
39
  name: Optional[str] = None
@@ -125,12 +129,14 @@ class TransformRequest(BaseModel):
125
129
  silver).
126
130
 
127
131
  Attributes:
128
- input (TransformRequest.Input): The input block containing the
129
- columns metadata and data.
132
+ input (TransformRequest.Input):
133
+ The input block containing the columns metadata and data.
130
134
  autoloader_input (DataSource.Autoloader):
131
- use_preset (str): Indicates which preset to use for the transforms.
132
- transforms (List[TransformRequest.Transform]): A list of transform
133
- configurations.
135
+ The autoloader input configuration.
136
+ use_preset (str):
137
+ Indicates which preset to use for the transforms.
138
+ transforms (List[TransformRequest.Transform]):
139
+ A list of transform configurations.
134
140
  """
135
141
 
136
142
  class Input(BaseModel):
@@ -138,10 +144,10 @@ class TransformRequest(BaseModel):
138
144
  Input data for the transform request.
139
145
 
140
146
  Attributes:
141
- columns (List[Dbui.TableColumnDetails]): A list of metadata about
142
- the columns.
143
- data (List[Dict[str, str]]): The data represented as a list of
144
- dictionaries.
147
+ columns (List[Dbui.TableColumnDetails]):
148
+ A list of metadata about the columns.
149
+ data (List[Dict[str, str]]):
150
+ The data represented as a list of dictionaries.
145
151
  """
146
152
 
147
153
  columns: List[Dbui.TableColumnDetails]
@@ -171,19 +177,24 @@ class TransformRequest(BaseModel):
171
177
  A transform configuration to apply to the data.
172
178
 
173
179
  Attributes:
174
- transform_type (str): The type of transform (one of
175
- SilverPreTransform, SilverTransform, Gold).
176
- use_pre_transform_preset (str): Indicates which pre-transform
177
- preset to use if requested.
178
- use_preset_table (str): Indicates which table to use within the
179
- preset's transform type for Silver and Gold.
180
+ transform_type (str):
181
+ The type of transform (one of SilverPreTransform,
182
+ SilverTransform, Gold).
183
+ use_pre_transform_preset (str):
184
+ Indicates which pre-transform preset to use if requested.
185
+ use_preset_table (str):
186
+ Indicates which table to use within the preset's transform
187
+ type for Silver and Gold.
180
188
  filter (str):
189
+ Filter expression.
181
190
  post_filter (str):
191
+ Filter expression applied after the transform.
182
192
  preset_overrides (TransformRequest.Transform.PresetOverrides):
183
193
  Overrides for the preset configuration.
184
- add_fields (List[FieldSpec]): Additional field specifications
185
- to add.
186
- utils (FieldUtils): Utility configurations for handling fields.
194
+ add_fields (List[FieldSpec]):
195
+ Additional field specifications to add.
196
+ utils (FieldUtils):
197
+ Utility configurations for handling fields.
187
198
  """
188
199
 
189
200
  class PresetOverrides(BaseModel):
@@ -191,8 +202,8 @@ class TransformRequest(BaseModel):
191
202
  Preset overrides for a transform configuration.
192
203
 
193
204
  Attributes:
194
- omit_fields (List[str]): A list of fields to omit from
195
- the preset.
205
+ omit_fields (List[str]):
206
+ A list of fields to omit from the preset.
196
207
  """
197
208
 
198
209
  omit_fields: Optional[List[str]] = None
@@ -293,8 +304,8 @@ class TransformResponse(BaseModel):
293
304
  applied on the data.
294
305
 
295
306
  Attributes:
296
- stages (List[TransformResponse.Stages]): A list of stages
297
- representing each intermediate transform step.
307
+ stages (List[TransformResponse.Stages]):
308
+ A list of stages representing each intermediate transform step.
298
309
  """
299
310
 
300
311
  class Stages(BaseModel):
@@ -302,12 +313,13 @@ class TransformResponse(BaseModel):
302
313
  A stage in the transform response.
303
314
 
304
315
  Attributes:
305
- transform_type (str): The type of transform applied in this stage
306
- (one of SilverPreTransform, SilverTransform, Gold, Input).
307
- columns (List[Dbui.TableColumnDetails]): A list of metadata about
308
- the columns returned in this stage.
309
- data (List[Dict[str, str]]): The data represented as a list
310
- of dictionaries.
316
+ transform_type (str):
317
+ The type of transform applied in this stage (one of
318
+ SilverPreTransform, SilverTransform, Gold, Input).
319
+ columns (List[Dbui.TableColumnDetails]):
320
+ A list of metadata about the columns returned in this stage.
321
+ data (List[Dict[str, str]]):
322
+ The data represented as a list of dictionaries.
311
323
  """
312
324
 
313
325
  transform_type: str
dasl_client/types/rule.py CHANGED
@@ -29,15 +29,22 @@ class Rule(BaseModel):
29
29
  Rules define how to generate notables from input data.
30
30
 
31
31
  Attributes:
32
- metadata (Optional[Metadata]): Standard object metadata.
33
- rule_metadata (Optional[Rule.RuleMetadata]): The rule configuration
34
- metadata.
35
- schedule (Schedule): The rule schedule.
36
- input (Rule.Input): The rule input configuration.
37
- observables (Optional[List[Rule.Observable]]): A list of observables.
38
- output (Rule.Output): The rule output configuration.
39
- collate (Optional[Rule.Collate]): The collate configuration.
40
- status (Optional[ResourceStatus]): The current status of the rule.
32
+ metadata (Optional[Metadata]):
33
+ Standard object metadata.
34
+ rule_metadata (Optional[Rule.RuleMetadata]):
35
+ The rule configuration metadata.
36
+ schedule (Schedule):
37
+ The rule schedule.
38
+ input (Rule.Input):
39
+ The rule input configuration.
40
+ observables (Optional[List[Rule.Observable]]):
41
+ A list of observables.
42
+ output (Rule.Output):
43
+ The rule output configuration.
44
+ collate (Optional[Rule.Collate]):
45
+ The collate configuration.
46
+ status (Optional[ResourceStatus]):
47
+ The current status of the rule.
41
48
  """
42
49
 
43
50
  class RuleMetadata(BaseModel):
@@ -45,23 +52,26 @@ class Rule(BaseModel):
45
52
  RuleMetadata object wrapping CoreV1RuleSpecMetadata.
46
53
 
47
54
  Attributes:
48
- version (Optional[Union[float, int]]): The current version of
49
- the rule.
50
- category (Optional[str]): The category of this detection. The
51
- available values are configured in workspace config.
52
- severity (Optional[str]): The threat level associated with the
53
- notable.
54
- fidelity (Optional[str]): Fidelity is used to capture the maturity
55
- of a rule. Newly created, untested rules should be marked as
56
- Investigative fidelity. Older, more well-tested rules should
57
- be marked as High fidelity. This helps an analyst determine
58
- how likely a notable is a false positive.
59
- mitre (Optional[List[Rule.RuleMetadata.Mitre]]): Mitre ATT&CK
60
- tactic information.
61
- objective (Optional[str]): A longer form description of what this
62
- rule is attempting to detect (objectMeta.comment is a summary).
63
- response (Optional[Rule.RuleMetadata.Response]): Response
64
- configuration for the rule.
55
+ version (Optional[Union[float, int]]):
56
+ The current version of the rule.
57
+ category (Optional[str]):
58
+ The category of this detection. The available values are
59
+ configured in workspace config.
60
+ severity (Optional[str]):
61
+ The threat level associated with the notable.
62
+ fidelity (Optional[str]):
63
+ Fidelity is used to capture the maturity of a rule. Newly
64
+ created, untested rules should be marked as Investigative
65
+ fidelity. Older, more well-tested rules should be marked as
66
+ High fidelity. This helps an analyst determine how likely a
67
+ notable is a false positive.
68
+ mitre (Optional[List[Rule.RuleMetadata.Mitre]]):
69
+ Mitre ATT&CK tactic information.
70
+ objective (Optional[str]):
71
+ A longer form description of what this rule is attempting to
72
+ detect (objectMeta.comment is a summary).
73
+ response (Optional[Rule.RuleMetadata.Response]):
74
+ Response configuration for the rule.
65
75
  """
66
76
 
67
77
  class Mitre(BaseModel):
@@ -69,16 +79,18 @@ class Rule(BaseModel):
69
79
  Mitre ATT&CK details associated with a Rule.
70
80
 
71
81
  Attributes:
72
- taxonomy (Optional[str]): Mitre ATT&CK taxonomy.
73
- tactic (Optional[str]): Mitre ATT&CK tactic.
74
- technique_id (Optional[str]): The Mitre ATT&CK technique
75
- identifier.
76
- technique (Optional[str]): The Mitre ATT&CK technique human-
77
- readable name.
78
- sub_technique_id (Optional[str]): The Mitre ATT&CK sub-
79
- technique identifier.
80
- sub_technique (Optional[str]): The Mitre ATT&CK sub-technique
81
- human-readable name.
82
+ taxonomy (Optional[str]):
83
+ Mitre ATT&CK taxonomy.
84
+ tactic (Optional[str]):
85
+ Mitre ATT&CK tactic.
86
+ technique_id (Optional[str]):
87
+ The Mitre ATT&CK technique identifier.
88
+ technique (Optional[str]):
89
+ The Mitre ATT&CK technique human-readable name.
90
+ sub_technique_id (Optional[str]):
91
+ The Mitre ATT&CK sub-technique identifier.
92
+ sub_technique (Optional[str]):
93
+ The Mitre ATT&CK sub-technique human-readable name.
82
94
  """
83
95
 
84
96
  taxonomy: Optional[str] = None
@@ -120,7 +132,9 @@ class Rule(BaseModel):
120
132
 
121
133
  Attributes:
122
134
  guidelines (Optional[str]):
135
+ Response guidelines.
123
136
  playbooks (Optional[List[Rule.RuleMetadata.Response.Playbook]]):
137
+ Suggested response playbooks.
124
138
  """
125
139
 
126
140
  class Playbook(BaseModel):
@@ -130,9 +144,10 @@ class Rule(BaseModel):
130
144
 
131
145
  Attributes:
132
146
  notebook (Optional[str]):
133
- options (Optional[Dict[str, str]]): These are templated,
134
- if they contain ${} this will be filled in using the
135
- notable.
147
+ Notebook to run.
148
+ options (Optional[Dict[str, str]]):
149
+ These are templated, if they contain ${} this will be
150
+ filled in using the notable.
136
151
  """
137
152
 
138
153
  notebook: Optional[str] = None
@@ -231,7 +246,9 @@ class Rule(BaseModel):
231
246
 
232
247
  Attributes:
233
248
  stream (Optional[Rule.Input.Stream]):
249
+ Input if the Rule should operate on streaming input data.
234
250
  batch (Optional[Rule.Input.Batch]):
251
+ Input if the rule should operate on batched input data.
235
252
  """
236
253
 
237
254
  class Custom(BaseModel):
@@ -282,16 +299,21 @@ class Rule(BaseModel):
282
299
 
283
300
  Attributes:
284
301
  name (Optional[str]):
302
+ Name of the table.
285
303
  watermark (Optional[Rule.Input.Stream.Table.Watermark]):
286
- alias (Optional[str]): Alias name for the table.
287
- join_type (Optional[str]): For tables other than the
288
- first, how to join to the preceding table.
289
- join_expr (Optional[str]): For tables other than the
290
- first, the join condition expression to join with
291
- the preceding table.
292
- streaming (Optional[bool]): For tables other than the
293
- first, is this a streaming join or static. Default
294
- is false, except on the first table.
304
+ Watermark configuration.
305
+ alias (Optional[str]):
306
+ Alias name for the table.
307
+ join_type (Optional[str]):
308
+ For tables other than the first, how to join to the
309
+ preceding table.
310
+ join_expr (Optional[str]):
311
+ For tables other than the first, the join condition
312
+ expression to join with the preceding table.
313
+ streaming (Optional[bool]):
314
+ For tables other than the first, is this a streaming
315
+ join or static. Default is false, except on the first
316
+ table.
295
317
  """
296
318
 
297
319
  class Watermark(BaseModel):
@@ -299,13 +321,14 @@ class Rule(BaseModel):
299
321
  Watermark for a streaming input table.
300
322
 
301
323
  Attributes:
302
- event_time_column (str): Which column is the event
303
- time for the delay threshold.
304
- delay_threshold (str): A time duration string for
305
- the watermark delay.
306
- drop_duplicates (Optional[List[str]]): Pass into
307
- pyspark dropDuplicates (effectively columns for
308
- group by).
324
+ event_time_column (str):
325
+ Which column is the event time for the delay
326
+ threshold.
327
+ delay_threshold (str):
328
+ A time duration string for the watermark delay.
329
+ drop_duplicates (Optional[List[str]]):
330
+ Pass into pyspark dropDuplicates (effectively
331
+ columns for group by).
309
332
  """
310
333
 
311
334
  event_time_column: str
@@ -467,10 +490,12 @@ class Rule(BaseModel):
467
490
  Risk level associated with an Observable.
468
491
 
469
492
  Attributes:
470
- impact (str): A SQL expression indicating the impact (should
493
+ impact (str):
494
+ A SQL expression indicating the impact (should evaluate to
495
+ a number between 0-100).
496
+ confidence (str):
497
+ A SQL expression indicating the confidence (should
471
498
  evaluate to a number between 0-100).
472
- confidence (str): A SQL expression indicating the confidence
473
- (should evaluate to a number between 0-100).
474
499
  """
475
500
 
476
501
  impact: str
@@ -550,13 +575,14 @@ class Rule(BaseModel):
550
575
  within a given timeframe.
551
576
 
552
577
  Attributes:
553
- collate_on (Optional[List[str]]): SQL column(s) to collate
554
- notables on. This must be either 'summary', 'context', or
555
- a JSON key within 'context'. Only one level of nesting is
556
- currently supported.
557
- within (Optional[str]): A time duration string for the window
558
- to collate within.
559
- action (Optional[str]): append | updateStats | inhibit.
578
+ collate_on (Optional[List[str]]):
579
+ SQL column(s) to collate notables on. This must be either
580
+ 'summary', 'context', or a JSON key within 'context'. Only
581
+ one level of nesting is currently supported.
582
+ within (Optional[str]):
583
+ A time duration string for the window to collate within.
584
+ action (Optional[str]):
585
+ append | updateStats | inhibit.
560
586
  """
561
587
 
562
588
  collate_on: Optional[List[str]] = None
@@ -9,36 +9,46 @@ from dasl_api import (
9
9
  CoreV1Schedule,
10
10
  )
11
11
 
12
+ from dasl_client.conn.client_identifier import get_client_identifier
13
+
12
14
 
13
15
  class Metadata(BaseModel):
14
16
  """
15
17
  General resource metadata.
16
18
 
17
19
  Attributes:
18
- name (Optional[str]): The name of the resource.
19
- workspace (Optional[str]): The workspace to which the resource belongs.
20
- comment (Optional[str]): A description or comment associated with
21
- the resource.
22
- annotations (Optional[Dict[str, Optional[str]]]): Annotations is an
23
- unstructured key value map stored with a resource that may be set
24
- by external tools to store and retrieve arbitrary metadata. They
25
- are not queryable and should be preserved when modifying objects.
26
- created_timestamp (Optional[datetime]): The time at which this
27
- resource was created.
28
- created_by (Optional[str]): The account that created this resource.
29
- modified_timestamp (Optional[datetime]): The last time at which this
30
- resource was modified.
31
- last_successful_run_timestamp (Optional[datetime]): The last time at
32
- which the job associated with this resource successfuly completed.
33
- modified_by (Optional[str]): The account that modified this resource
34
- most recently.
35
- version (Optional[int]): The resource's version.
36
- deleted (Optional[bool]): Indicates whether the resource has been
37
- deleted.
38
- resource_status (Optional[str]): Internal resource status. Cannot
39
- be updated by the user.
40
- ui_status (Optional[str]): Internal resource status. Cannot be
41
- updated by the user.
20
+ name (Optional[str]):
21
+ The name of the resource.
22
+ workspace (Optional[str]):
23
+ The workspace to which the resource belongs.
24
+ comment (Optional[str]):
25
+ A description or comment associated with the resource.
26
+ annotations (Optional[Dict[str, Optional[str]]]):
27
+ Annotations is an unstructured key value map stored with a
28
+ resource that may be set by external tools to store and retrieve
29
+ arbitrary metadata. They are not queryable and should be preserved
30
+ when modifying objects.
31
+ created_timestamp (Optional[datetime]):
32
+ The time at which this resource was created.
33
+ created_by (Optional[str]):
34
+ The account that created this resource.
35
+ modified_timestamp (Optional[datetime]):
36
+ The last time at which this resource was modified.
37
+ last_successful_run_timestamp (Optional[datetime]):
38
+ The last time at which the job associated with this resource
39
+ successfuly completed.
40
+ modified_by (Optional[str]):
41
+ The account that modified this resource most recently.
42
+ version (Optional[int]):
43
+ The resource's version.
44
+ deleted (Optional[bool]):
45
+ Indicates whether the resource has been deleted.
46
+ resource_status (Optional[str]):
47
+ Internal resource status. Cannot be updated by the user.
48
+ ui_status (Optional[str]):
49
+ Internal resource status. Cannot be updated by the user.
50
+ client_of_origin (Optional[str]):
51
+ The client that last created or modified this resource.
42
52
  """
43
53
 
44
54
  name: Optional[str] = None
@@ -54,6 +64,7 @@ class Metadata(BaseModel):
54
64
  deleted: Optional[bool] = None
55
65
  resource_status: Optional[str] = None
56
66
  ui_status: Optional[str] = None
67
+ client_of_origin: Optional[str] = None
57
68
 
58
69
  @staticmethod
59
70
  def from_api_obj(obj: Optional[CommonV1ObjectMeta]) -> "Metadata":
@@ -73,6 +84,7 @@ class Metadata(BaseModel):
73
84
  deleted=obj.deleted,
74
85
  resource_status=obj.resource_status,
75
86
  ui_status=obj.ui_status,
87
+ client_of_origin=obj.client_of_origin,
76
88
  )
77
89
 
78
90
  def to_api_obj(self) -> CommonV1ObjectMeta:
@@ -90,6 +102,7 @@ class Metadata(BaseModel):
90
102
  deleted=self.deleted,
91
103
  resource_status=self.resource_status,
92
104
  ui_status=self.ui_status,
105
+ client_of_origin=self.client_of_origin or get_client_identifier(),
93
106
  )
94
107
 
95
108
 
@@ -98,16 +111,21 @@ class ResourceStatus(BaseModel):
98
111
  The status of the resource, along with status update events.
99
112
 
100
113
  Attributes:
101
- job_id (Optional[int]): The associated Databricks Job ID.
102
- job_name (str): The associated Databricks Job name.
103
- enabled (bool): Indicates whether the resource is enabled.
104
- notebook_path (str): The path to the Databricks notebook that the
105
- Job has been scheduled with.
106
- created_at (datetime): The time at which the resources were created
107
- in Databricks.
108
- job_status (str): The current reported status of the job.
109
- events (List[StatusEvent]): The most recent 25 events related to
110
- this resource.
114
+ job_id (Optional[int]):
115
+ The associated Databricks Job ID.
116
+ job_name (str):
117
+ The associated Databricks Job name.
118
+ enabled (bool):
119
+ Indicates whether the resource is enabled.
120
+ notebook_path (str):
121
+ The path to the Databricks notebook that the Job has been
122
+ scheduled with.
123
+ created_at (datetime):
124
+ The time at which the resources were created in Databricks.
125
+ job_status (str):
126
+ The current reported status of the job.
127
+ events (List[StatusEvent]):
128
+ The most recent 25 events related to this resource.
111
129
  """
112
130
 
113
131
  class StatusEvent(BaseModel):
@@ -115,12 +133,12 @@ class ResourceStatus(BaseModel):
115
133
  An event related to changes in the status of the resource.
116
134
 
117
135
  Attributes:
118
- action (Optional[str]): The action taken as part of the lifecycle
119
- of a resource.
120
- message (Optional[str]): A human-readable message describing the
121
- event.
122
- recorded_at (Optional[datetime]): The timestamp associated with
123
- the event.
136
+ action (Optional[str]):
137
+ The action taken as part of the lifecycle of a resource.
138
+ message (Optional[str]):
139
+ A human-readable message describing the event.
140
+ recorded_at (Optional[datetime]):
141
+ The timestamp associated with the event.
124
142
  """
125
143
 
126
144
  action: Optional[str] = None
@@ -183,18 +201,20 @@ class Schedule(BaseModel):
183
201
  A schedule for recurring dispatch of the Job(s) associated with a resource.
184
202
 
185
203
  Attributes:
186
- at_least_every (Optional[str]): A duration string defining the
187
- schedule. The string may contain components for days, hours,
188
- minutes and seconds. Examples include '5d', '5d3h', '3d2h5m12s',
189
- and '12m16s'.
190
- exactly (Optional[str]): A quartz cron expression defining the
191
- precise schedule for dispatch.
192
- continuous (Optional[bool]): True if the Job should be continuously
193
- dispatched, False/None otherwise.
194
- compute_group (Optional[str]): 'dedicated', 'automatic' or a custom
195
- group name.
196
- enabled (Optional[bool]): Whether the schedule (and hence Job
197
- associated with the resource) is active.
204
+ at_least_every (Optional[str]):
205
+ A duration string defining the schedule. The string may contain
206
+ components for days, hours, minutes and seconds. Examples include
207
+ '5d', '5d3h', '3d2h5m12s', and '12m16s'.
208
+ exactly (Optional[str]):
209
+ A quartz cron expression defining the precise schedule for dispatch.
210
+ continuous (Optional[bool]):
211
+ True if the Job should be continuously dispatched, False/None
212
+ otherwise.
213
+ compute_group (Optional[str]):
214
+ 'dedicated', 'automatic' or a custom group name.
215
+ enabled (Optional[bool]):
216
+ Whether the schedule (and hence Job associated with the resource)
217
+ is active.
198
218
  """
199
219
 
200
220
  at_least_every: Optional[str] = None