-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for macros #516
base: develop
Are you sure you want to change the base?
Conversation
It is also worth noting that the name/argument validation (e.g., 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'} |
I've brought this PR up to date with 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? 🙇 |
+1 We need this for our use case! |
+1 would be helpful! |
Thanks @maszyk99, let me know if there is anything I can assist with. |
@maszyk99 any update on this? Anything I can do to move it along? 🙇 |
@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. 🙇 |
This adds
Service.macros
for creating, retrieving, updating, and deleting macros.Currently macros can be accessed via
Configurations
/ConfigurationFile
but creating a properMacros(Collection)
andMacro(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 bysetUp
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 theself.macro.acl_update
call because it was failing withArgument "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