update deviceuserstate cleanup/documentation (#1289)

* update deviceuserstate cleanup

* Update GamCommands.txt
This commit is contained in:
Ross Scroggs
2020-12-06 19:24:48 -08:00
committed by GitHub
parent cc60095344
commit 84f52668b7
2 changed files with 16 additions and 8 deletions

View File

@@ -141,6 +141,7 @@ If an item contains spaces, it should be surrounded by ".
<ACLScope> ::= [user:]<EmailAddress>|group:<EmailAddress>|domain[:<DomainName>]|default
<APIScopeURL> ::= <String>
<ASPID> ::= <String>
<AssetTag> ::= <String>
<BuildingID> ::= <String>|id:<String>
<CalendarACLRole> ::= editor|freebusy|freebusyreader|owner|reader|writer
<CalendarACLRuleID> ::= user:<EmailAddress>|group:<EmailAddress>|domain:<DomainName>|default
@@ -554,6 +555,7 @@ Items, separated by spaces, with spaces, commas or single quotes in the items th
<ACLList> ::= "<ACLScope>(,<ACLScope>)*"
<APIScopeURLList> ::= "<APIScopeURL>(,<APIScopeURL>)*"
<ASPIDList> ::= "<ASPID>(,<ASPID>)*"
<AssetTagList> ::= "<AssetTag>(,<AssetTa>g)*"
<CalendarList> ::= "<CalendarItem>(,<CalendarItem>)*"
<ChatRoomList> ::= "<ChatRoom>(,<ChatRoom>)*"
<CollaboratorItemList> ::= "<CollaboratorItem>(,<CollaboratorItem>)*"
@@ -1152,11 +1154,18 @@ gam info device [id] <DeviceID>
gam delete device [id] <DeviceID>
gam cancelwipe device [id] <DeviceID>
gam wipe device [id] <DeviceID>
gam approve deviceuser [id] <DeviceUserID>
gam block deviceuser [id] <DeviceUserID>
gam delete deviceuser [id] <DeviceUserID>
gam cancelwipe deviceuser [id] <DeviceUserID>
gam wipe deviceuser [id] <DeviceUserID>
gam update deviceuserstate [id] <DeviceUserID>
[clientid <String>] [customid <String>] [assettags clear|<AssetTagList>]
[compliantstate|compliancestate compliant|noncompliant] [managedstate clear|managed|unmanaged]
[healthscore verypoor|poor|neutral|good|verygood] [scorereason clear|<String>]
(customvalue (bool <Boolean>)|(number <Integer>)|(string <String>))*
gam print devices [todrive] [filter|query <QueryDevice>]
[orderby <DeviceOrderByFieldName> [ascending|descending]]
[company|personal|nocompanydevices|nopersonaldevices]

View File

@@ -146,7 +146,7 @@ def update_state():
client_id = f'{customer}-{sys.argv[i+1]}'
i += 2
elif myarg in ['assettag', 'assettags']:
body['assetTags'] = sys.argv[i+1].split(',')
body['assetTags'] = gam.shlexSplitList(sys.argv[i+1])
if body['assetTags'] == ['clear']:
# TODO: this doesn't work to clear
# existing values. Figure out why.
@@ -176,21 +176,20 @@ def update_state():
sys.argv[i+1])
i += 2
elif myarg == 'customvalue':
allowed_types = ['boolValue', 'numberValue', 'stringValue']
value_type = f'{sys.argv[i+1].lower()}Value'
allowed_types = ['bool', 'number', 'string']
value_type = sys.argv[i+1].lower()
if value_type not in allowed_types:
controlflow.expected_argument_exit('custom_value',
', '.join(allowed_types),
sys.argv[i+1])
key = sys.argv[i+2]
value = sys.argv[i+3]
if value_type == 'boolValue':
if value_type == 'bool':
value = gam.getBoolean(value, key)
elif value_type == 'numberValue':
elif value_type == 'number':
value = int(value)
if 'keyValuePairs' not in body:
body['keyValuePairs'] = {}
body['keyValuePairs'][key] = {value_type: value}
body.setdefault('keyValuePairs', {})
body['keyValuePairs'][key] = {f'{value_type}Value': value}
i += 4
elif myarg in ['managedstate']:
managed_states = gapi.get_enum_values_minus_unspecified(