-
Notifications
You must be signed in to change notification settings - Fork 13
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
added InvokeMethod on WmiClass #99
added InvokeMethod on WmiClass #99
Conversation
pkg/wmiinstance/WmiClass.go
Outdated
@@ -285,6 +285,16 @@ func (c *WmiClass) InvokeMethod(methodName string, methodParams []string, inputO | |||
// both are SWbemObjects: https://docs.microsoft.com/en-us/windows/win32/wmisdk/swbemobject | |||
} | |||
|
|||
func (c *WmiClass) InvokeMethodWithLiteralParams(methodName string, params ...interface{}) ([]interface{}, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are we planning to use this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use it to create cluster group sets, before we didn't have a way to invoke static methods on wmi classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, how different is this from the unimplemented InvokeMethod call that is right above? (line 282)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other words, let's just name this function "InvokeMethod"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the method above takes a methodParams []string argument, this definition takes effectively an array of interfaces.
(one of the params on the call we invoke this is actually a string[] itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hesitated to replace the signature as technically the original InvokeMethod is a public interface (residing in a pkg subdir with capital name). But can just replace if you think there is no build dependency anywhere on it (obviously there is no functional dependency as it is not implemented)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replaced call, please resolve this comment if you are satisfied @JocelynBerrendonner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Adding ability to call static methods on Wmi Classes using literal parameters in line with pattern of Wmi Instances