| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
It is also worth noting that the name/argument validation (e.g., Number of arguments provided (2) does not match with the number implied by the macro name (0)) appears to be occurring in the web UI so its possible to create macros that violate that naming convention. I didn't add validation for that here as it should really be handled by the API and not in each SDK. That is, this is an issue with the API allowing creation of macros that don't conform to the expected naming conventions, not an SDK issue. >>> sc = connect(host='localhost', port=8089, username='admin', password='changed!')
>>> sc.macros.create(name='no_args', definition='| eval foo="bar"', args='one, two')
<splunklib.client.Macro object at 0x7f8aac282860>
>>> sc.macros.list(search='no_args')[0].content
{'args': 'one, two', 'definition': '| eval foo="bar"', 'disabled': '0', 'eai:appName': 'search', 'eai:userName': 'admin'} |
Sorry, something went wrong.
|
I've brought this PR up to date with develop and ensured tests still pass for the 2.0.0 release:
Tagging a few recent contributors to get some movement on this PR (it's been sitting over a year now). @ashah-splunk, @PKing70, @maszyk99, @ichaer, or @akaila-splunk is there anything y'all can do to help move this along? 🙇 |
Sorry, something went wrong.
|
+1 We need this for our use case! |
Sorry, something went wrong.
|
+1 would be helpful! |
Sorry, something went wrong.
|
Thanks @maszyk99, let me know if there is anything I can assist with. |
Sorry, something went wrong.
|
@maszyk99 any update on this? Anything I can do to move it along? 🙇 |
Sorry, something went wrong.
|
@maszyk99 @ashah-splunk @PKing70 @ichaer @akaila-splunk any update on this? Is there anything I can assist with to get this merged? If there's tests I can add or any changes you'd like to see please let me know. 🙇 |
Sorry, something went wrong.
|
Hi, this PR was merged here #589. Thank you for your patience. |
Sorry, something went wrong.
Thanks @maszyk99 I'm confused why it was merged in #589 and not in this PR but thank you for getting it merged. What is the process to get this into the master branch and ultimately into a new Splunk SDK for Python release? |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This adds Service.macros for creating, retrieving, updating, and deleting macros.
Currently macros can be accessed via Configurations / ConfigurationFile but creating a proper Macros(Collection) and Macro(Entity) makes them much easier to work with.
Almost all of the code, including tests, is copied and modified from the existing code for saved searches (Service.saved_searches) so you can interact with macros in the same manner.
Tests
I added a few tests modeled after the existing ones for saved searches. The naming for macros with arguments means that test_create_with_args should probably move to another class (self.macro created by setUp is not used) but I didn't want to get carried away until I know there's a desire to merge this (or not).
I also had to remove the app parameter from the self.macro.acl_update call because it was failing with Argument "app" is not supported by this handler. It's not immediately clear to me why this is working for saved searches but not for macros.
Usage
As mentioned above, the usage is almost identical to Service.saved_searches for saved searches today.
List macros
Create a macro
Enable/disable a macro
Update a macro
Delete a macro