33
33
SPLUNKBASE_URL = "https://splunkbase.splunk.com/app/{uid}/release/{version}/download"
34
34
35
35
36
- # TODO (#266): disable the use_enum_values configuration
37
36
class App_Base (BaseModel ,ABC ):
38
- model_config = ConfigDict (use_enum_values = True , validate_default = True , arbitrary_types_allowed = True )
37
+ model_config = ConfigDict (validate_default = True , arbitrary_types_allowed = True )
39
38
uid : Optional [int ] = Field (default = None )
40
39
title : str = Field (description = "Human-readable name used by the app. This can have special characters." )
41
40
appid : Optional [APPID_TYPE ]= Field (default = None ,description = "Internal name used by your app. "
@@ -59,9 +58,8 @@ def ensureAppPathExists(self, config:test, stage_file:bool=False):
59
58
config .getLocalAppDir ().mkdir (parents = True )
60
59
61
60
62
- # TODO (#266): disable the use_enum_values configuration
63
61
class TestApp (App_Base ):
64
- model_config = ConfigDict (use_enum_values = True , validate_default = True , arbitrary_types_allowed = True )
62
+ model_config = ConfigDict (validate_default = True , arbitrary_types_allowed = True )
65
63
hardcoded_path : Optional [Union [FilePath ,HttpUrl ]] = Field (default = None , description = "This may be a relative or absolute link to a file OR an HTTP URL linking to your app." )
66
64
67
65
@@ -99,9 +97,8 @@ def getApp(self, config:test,stage_file:bool=False)->str:
99
97
return str (destination )
100
98
101
99
102
- # TODO (#266): disable the use_enum_values configuration
103
100
class CustomApp (App_Base ):
104
- model_config = ConfigDict (use_enum_values = True , validate_default = True , arbitrary_types_allowed = True )
101
+ model_config = ConfigDict (validate_default = True , arbitrary_types_allowed = True )
105
102
# Fields required for app.conf based on
106
103
# https://docs.splunk.com/Documentation/Splunk/9.0.4/Admin/Appconf
107
104
uid : int = Field (ge = 2 , lt = 100000 , default_factory = lambda :random .randint (20000 ,100000 ))
@@ -159,9 +156,8 @@ def getApp(self, config:test, stage_file=True)->str:
159
156
verbose_print = True )
160
157
return str (destination )
161
158
162
- # TODO (#266): disable the use_enum_values configuration
163
159
class Config_Base (BaseModel ):
164
- model_config = ConfigDict (use_enum_values = True , validate_default = True , arbitrary_types_allowed = True )
160
+ model_config = ConfigDict (validate_default = True , arbitrary_types_allowed = True )
165
161
166
162
path : DirectoryPath = Field (default = DirectoryPath ("." ), description = "The root of your app." )
167
163
app :CustomApp = Field (default_factory = CustomApp )
@@ -175,7 +171,7 @@ def serialize_path(path: DirectoryPath)->str:
175
171
return str (path )
176
172
177
173
class init (Config_Base ):
178
- model_config = ConfigDict (use_enum_values = True , validate_default = True , arbitrary_types_allowed = True )
174
+ model_config = ConfigDict (validate_default = True , arbitrary_types_allowed = True )
179
175
bare : bool = Field (default = False , description = "contentctl normally provides some some example content "
180
176
"(macros, stories, data_sources, and/or analytic stories). This option disables "
181
177
"initialization with that additional contnet. Note that even if --bare is used, it "
@@ -184,9 +180,8 @@ class init(Config_Base):
184
180
"the deployment/ directory (since it is not yet easily customizable)." )
185
181
186
182
187
- # TODO (#266): disable the use_enum_values configuration
188
183
class validate (Config_Base ):
189
- model_config = ConfigDict (use_enum_values = True , validate_default = True , arbitrary_types_allowed = True )
184
+ model_config = ConfigDict (validate_default = True , arbitrary_types_allowed = True )
190
185
enrichments : bool = Field (default = False , description = "Enable MITRE, APP, and CVE Enrichments. " \
191
186
"This is useful when outputting a release build " \
192
187
"and validating these values, but should otherwise " \
@@ -241,9 +236,8 @@ def getReportingPath(self)->pathlib.Path:
241
236
return self .path / "reporting/"
242
237
243
238
244
- # TODO (#266): disable the use_enum_values configuration
245
239
class build (validate ):
246
- model_config = ConfigDict (use_enum_values = True , validate_default = True , arbitrary_types_allowed = True )
240
+ model_config = ConfigDict (validate_default = True , arbitrary_types_allowed = True )
247
241
build_path : DirectoryPath = Field (default = DirectoryPath ("dist/" ), title = "Target path for all build outputs" )
248
242
249
243
@field_serializer ('build_path' ,when_used = 'always' )
@@ -395,17 +389,15 @@ class new(Config_Base):
395
389
type : NewContentType = Field (default = NewContentType .detection , description = "Specify the type of content you would like to create." )
396
390
397
391
398
- # TODO (#266): disable the use_enum_values configuration
399
392
class deploy_acs (inspect ):
400
- model_config = ConfigDict (use_enum_values = True , validate_default = False , arbitrary_types_allowed = True )
393
+ model_config = ConfigDict (validate_default = False , arbitrary_types_allowed = True )
401
394
#ignore linter error
402
395
splunk_cloud_jwt_token : str = Field (exclude = True , description = "Splunk JWT used for performing ACS operations on a Splunk Cloud Instance" )
403
396
splunk_cloud_stack : str = Field (description = "The name of your Splunk Cloud Stack" )
404
397
405
398
406
- # TODO (#266): disable the use_enum_values configuration
407
399
class Infrastructure (BaseModel ):
408
- model_config = ConfigDict (use_enum_values = True , validate_default = True , arbitrary_types_allowed = True )
400
+ model_config = ConfigDict (validate_default = True , arbitrary_types_allowed = True )
409
401
splunk_app_username :str = Field (default = "admin" , description = "Username for logging in to your Splunk Server" )
410
402
splunk_app_password :str = Field (exclude = True , default = "password" , description = "Password for logging in to your Splunk Server." )
411
403
instance_address :str = Field (..., description = "Address of your splunk server." )
@@ -415,15 +407,13 @@ class Infrastructure(BaseModel):
415
407
instance_name : str = Field (...)
416
408
417
409
418
- # TODO (#266): disable the use_enum_values configuration
419
410
class Container (Infrastructure ):
420
- model_config = ConfigDict (use_enum_values = True , validate_default = True , arbitrary_types_allowed = True )
411
+ model_config = ConfigDict (validate_default = True , arbitrary_types_allowed = True )
421
412
instance_address :str = Field (default = "localhost" , description = "Address of your splunk server." )
422
413
423
414
424
- # TODO (#266): disable the use_enum_values configuration
425
415
class ContainerSettings (BaseModel ):
426
- model_config = ConfigDict (use_enum_values = True , validate_default = True , arbitrary_types_allowed = True )
416
+ model_config = ConfigDict (validate_default = True , arbitrary_types_allowed = True )
427
417
leave_running : bool = Field (default = True , description = "Leave container running after it is first "
428
418
"set up to speed up subsequent test runs." )
429
419
num_containers : PositiveInt = Field (default = 1 , description = "Number of containers to start in parallel. "
@@ -447,15 +437,13 @@ class All(BaseModel):
447
437
pass
448
438
449
439
450
- # TODO (#266): disable the use_enum_values configuration
451
440
class Changes (BaseModel ):
452
- model_config = ConfigDict (use_enum_values = True , validate_default = True , arbitrary_types_allowed = True )
441
+ model_config = ConfigDict (validate_default = True , arbitrary_types_allowed = True )
453
442
target_branch :str = Field (...,description = "The target branch to diff against. Note that this includes uncommitted changes in the working directory as well." )
454
443
455
444
456
- # TODO (#266): disable the use_enum_values configuration
457
445
class Selected (BaseModel ):
458
- model_config = ConfigDict (use_enum_values = True , validate_default = True , arbitrary_types_allowed = True )
446
+ model_config = ConfigDict (validate_default = True , arbitrary_types_allowed = True )
459
447
files :List [FilePath ] = Field (...,description = "List of detection files to test, separated by spaces." )
460
448
461
449
@field_serializer ('files' ,when_used = 'always' )
@@ -826,9 +814,8 @@ def getModeName(self)->str:
826
814
return DetectionTestingMode .selected .value
827
815
828
816
829
- # TODO (#266): disable the use_enum_values configuration
830
817
class test (test_common ):
831
- model_config = ConfigDict (use_enum_values = True , validate_default = True , arbitrary_types_allowed = True )
818
+ model_config = ConfigDict (validate_default = True , arbitrary_types_allowed = True )
832
819
container_settings :ContainerSettings = ContainerSettings ()
833
820
test_instances : List [Container ] = Field ([], exclude = True , validate_default = True )
834
821
splunk_api_username : Optional [str ] = Field (default = None , exclude = True ,description = "Splunk API username used for running appinspect or installating apps from Splunkbase" )
@@ -893,9 +880,8 @@ def getAppFilePath(self):
893
880
TEST_ARGS_ENV = "CONTENTCTL_TEST_INFRASTRUCTURES"
894
881
895
882
896
- # TODO (#266): disable the use_enum_values configuration
897
883
class test_servers (test_common ):
898
- model_config = ConfigDict (use_enum_values = True , validate_default = True , arbitrary_types_allowed = True )
884
+ model_config = ConfigDict (validate_default = True , arbitrary_types_allowed = True )
899
885
test_instances :List [Infrastructure ] = Field ([],description = "Test against one or more preconfigured servers." , validate_default = True )
900
886
server_info :Optional [str ] = Field (None , validate_default = True , description = 'String of pre-configured servers to use for testing. The list MUST be in the format:\n '
901
887
'address,username,web_ui_port,hec_port,api_port;address_2,username_2,web_ui_port_2,hec_port_2,api_port_2'
0 commit comments