From ec4ca0c8a7b3136d2b689b10063205b58b76c1a8 Mon Sep 17 00:00:00 2001 From: Joshua Hiller Date: Fri, 22 Dec 2023 00:46:01 -0500 Subject: [PATCH] Update operation keyword arguments --- src/falconpy/_endpoint/_foundry_logscale.py | 75 ++++++++++++--------- src/falconpy/foundry_logscale.py | 39 +++++++---- 2 files changed, 69 insertions(+), 45 deletions(-) diff --git a/src/falconpy/_endpoint/_foundry_logscale.py b/src/falconpy/_endpoint/_foundry_logscale.py index 9baaea7c4..7b0f7d6e9 100644 --- a/src/falconpy/_endpoint/_foundry_logscale.py +++ b/src/falconpy/_endpoint/_foundry_logscale.py @@ -43,7 +43,15 @@ "/loggingapi/combined/repos/v1", "Lists available repositories and views", "foundry_logscale", - [] + [ + { + "type": "boolean", + "default": False, + "description": "Include whether test data is present in the application repository", + "name": "check_test_data", + "in": "query" + } + ] ], [ "IngestDataV1", @@ -90,6 +98,12 @@ "Execute a dynamic saved search", "foundry_logscale", [ + { + "type": "string", + "description": "Application ID.", + "name": "app_id", + "in": "query" + }, { "type": "boolean", "default": False, @@ -142,6 +156,12 @@ "in": "query", "required": True }, + { + "type": "string", + "description": "Application ID.", + "name": "app_id", + "in": "query" + }, { "minimum": 0, "type": "string", @@ -162,14 +182,6 @@ "description": "Starting pagination offset of records to return.", "name": "offset", "in": "query" - }, - { - "pattern": "v?([0-9]+)(\\.[0-9]+)?(\\.[0-9]+)?(-([0-9A-Za-z\\-]+" - "(\\.[0-9A-Za-z\\-]+)*))?(\\+([0-9A-Za-z\\-]+(\\.[0-9A-Za-z\\-]+)*))?", - "type": "string", - "description": "Version of resource being created", - "name": "version", - "in": "query" } ] ], @@ -180,6 +192,12 @@ "Execute a saved search", "foundry_logscale", [ + { + "type": "string", + "description": "Application ID.", + "name": "app_id", + "in": "query" + }, { "type": "boolean", "default": False, @@ -201,26 +219,6 @@ "name": "metadata", "in": "query" }, - { - "enum": [ - "sync", - "async", - "async_offload" - ], - "type": "string", - "description": "Mode to execute the query under. " - "If provided, takes precedence over the mode provided in the body.", - "name": "mode", - "in": "query" - }, - { - "pattern": "v?([0-9]+)(\\.[0-9]+)?(\\.[0-9]+)?(-([0-9A-Za-z\\-]+" - "(\\.[0-9A-Za-z\\-]+)*))?(\\+([0-9A-Za-z\\-]+(\\.[0-9A-Za-z\\-]+)*))?", - "type": "string", - "description": "Version of resource being created", - "name": "version", - "in": "query" - }, { "name": "body", "in": "body", @@ -234,7 +232,14 @@ "/loggingapi/entities/saved-searches/ingest/v1", "Populate a saved search", "foundry_logscale", - [] + [ + { + "type": "string", + "description": "Application ID.", + "name": "app_id", + "in": "query" + } + ] ], [ "GetSavedSearchesJobResultsDownloadV1", @@ -268,6 +273,14 @@ "/loggingapi/entities/views/v1", "List views", "foundry_logscale", - [] + [ + { + "type": "boolean", + "default": False, + "description": "Include whether test data is present in the application repository", + "name": "check_test_data", + "in": "query" + } + ] ] ] diff --git a/src/falconpy/foundry_logscale.py b/src/falconpy/foundry_logscale.py index 60c3d1c79..446510bff 100644 --- a/src/falconpy/foundry_logscale.py +++ b/src/falconpy/foundry_logscale.py @@ -55,13 +55,16 @@ class FoundryLogScale(ServiceClass): - a valid token provided by the authentication service class (oauth2.py) """ - def list_repos(self: object) -> Dict[str, Union[int, dict]]: + @force_default(defaults=["parameters"], default_types=["dict"]) + def list_repos(self: object, *args, parameters: dict = None, **kwargs) -> Dict[str, Union[int, dict]]: """List available repositories and views. Keyword arguments: - This method does not accept keyword arguments. + check_test_data -- Include whether test data is present in the application repository. Boolean. + parameters - full parameters payload, not required if using other keywords. - This method does not accept arguments. + Arguments: When not specified, the first argument to this method is assumed to be 'check_test_data'. + All others are ignored. Returns: dict object containing API response. @@ -73,7 +76,9 @@ def list_repos(self: object) -> Dict[str, Union[int, dict]]: return process_service_request( calling_object=self, endpoints=Endpoints, - operation_id="ListReposV1" + operation_id="ListReposV1", + keywords=kwargs, + params=handle_single_argument(args, parameters, "check_test_data") ) @force_default(defaults=["parameters", "body"], default_types=["dict", "dict"]) @@ -127,6 +132,7 @@ def execute_dynamic(self: object, """Deploy a saved search. Keyword arguments: + app_id -- Application ID. String. body -- full body payload, not required if using other keywords. { "end": "string", @@ -171,6 +177,7 @@ def get_search_results(self: object, parameters: dict = None, **kwargs) -> Dict[ """Get the results of a saved search. Keyword arguments: + app_id -- Application ID. String. job_id -- Job ID for a previously executed asynchronous query. String. limit -- The maximum number of records to return in this response. Integer. Use with the offset parameter to manage pagination of results. @@ -178,7 +185,6 @@ def get_search_results(self: object, parameters: dict = None, **kwargs) -> Dict[ offset -- The offset to start retrieving records from. String. Use with the limit parameter to manage pagination of results. parameters - full parameters payload, not required if using other keywords. - version -- Version of the resource. String. This method only supports keywords for providing arguments. @@ -206,6 +212,7 @@ def execute(self: object, """Deploy a saved search. Keyword arguments: + app_id -- Application ID. String. body -- full body payload, not required if using other keywords. { "end": "string", @@ -233,15 +240,15 @@ def execute(self: object, ], "with_sort": { "fields": [ - "string" + "string" ], "limit": 0, "order": [ - "string" + "string" ], "reverse": true, "type": [ - "string" + "string" ] } } @@ -250,12 +257,10 @@ def execute(self: object, id -- Saved search ID. String. include_test_data -- Include test data when executing searches. Boolean. metadata -- Include metadata in the response. Boolean. - mode -- Mode to execute the query under (async, async_offload or sync). String. name -- Saved search name. String. search_parameters -- Search specific parameters. Dictionary. NOT to be confused with the default parameters dictionary. start -- Starting position. String. - version -- Version of the search. String. with_in -- With in. Dictionary. with_limit -- With limit. Dictionary. with_renames -- With renames. Dictionary. @@ -333,12 +338,16 @@ def download_results(self: object, parameters: dict = None, **kwargs) -> Dict[st params=parameters ) - def list_views(self: object) -> Dict[str, Union[int, dict]]: + @force_default(defaults=["parameters"], default_types=["dict"]) + def list_views(self: object, *args, parameters: dict = None, **kwargs) -> Dict[str, Union[int, dict]]: """List views. - Keyword arguments: This method does not accept keyword arguments. + Keyword arguments: + check_test_data -- Include whether test data is present in the application repository. Boolean. + parameters - full parameters payload, not required if using other keywords. - Arguments: This method does not accept arguments. + Arguments: When not specified, the first argument to this method is assumed to be 'check_test_data'. + All others are ignored. Returns: dict object containing API response. @@ -350,7 +359,9 @@ def list_views(self: object) -> Dict[str, Union[int, dict]]: return process_service_request( calling_object=self, endpoints=Endpoints, - operation_id="ListViewV1" + operation_id="ListViewV1", + keywords=kwargs, + params=handle_single_argument(args, parameters, "check_test_data") ) # These method names align to the operation IDs in the API but