Reputation: 23
Command #1
slcli call-api Account getUsers --mask=username,secondaryLoginRequiredFlag --filter 'users.secondaryLoginRequiredFlag!=True'
Command #2
slcli call-api Account getUsers --mask=username,successfulLogins.createDate,successfulLogins.ipAddres --filter 'users.successfulLogins.createDate>=2017-01-01T00:00:00-06:00'
Upvotes: 2
Views: 289
Reputation: 4396
Currenlty the object filters using the SCLI are not fully supported it only works with some cases such as this:
slcli call-api Account getUsers --mask=username,secondaryLoginRequiredFlag --filter "users.username=sl307608-rcabero"
another thing is that it only is working for the equal case, you can verify that in the code:
https://github.com/softlayer/softlayer-python/blob/master/SoftLayer/CLI/call_api.py#L17-L19
So if you really need the objectFilters the best option is use a python script for that and not to use the scli:
see this article for more information:
https://sldn.softlayer.com/article/object-filters
Also you can submit this issue at the Softlayer Python client:
https://github.com/softlayer/softlayer-python/issues
But I am not sure that they will fix it soon.
here an example using Python script
import SoftLayer
# Your SoftLayer API username and key.
USERNAME = 'set me'
API_KEY = 'set me'
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
accountService = client['SoftLayer_Account']
# Filter the users whose secondaryLoginRequiredFlag = false
filterLoginFalse = {"users":{"secondaryLoginRequiredFlag":{"operation": "!= 1"}}}
# Filter the users whose secondaryLoginRequiredFlag = null
filterLoginNull = {"users":{"secondaryLoginRequiredFlag":{"operation": "is null"}}}
userLoginFalse = accountService.getUsers(filter=filterLoginFalse)
userLoginNull = accountService.getUsers(filter=filterLoginNull)
users = userLoginFalse + userLoginNull
print (users)
# Filter the users created betwern a derteminated date the date must have the following format mm/dd/YY
filterDate = {"users":{"createDate":{"operation":"betweenDate","options":[{"name":"startDate","value":["2/4/2014 00:00:00"]},{"name":"endDate","value":["2/4/2014 10:40:00"]}]}}}
users = accountService.getUsers(filter=filterDate)
print (users)
Regards
Upvotes: 1