Directory API Mobiledevices update no longer supported (#519)

This commit is contained in:
Ross Scroggs
2017-06-30 12:03:50 -07:00
committed by Jay Lee
parent 180606f721
commit 597a236e05
2 changed files with 13 additions and 31 deletions

View File

@ -472,9 +472,8 @@ Item attributes
(whocanviewgroup ANYONE_CAN_VIEW|ALL_IN_DOMAIN_CAN_VIEW|ALL_MEMBERS_CAN_VIEW|ALL_MANAGERS_CAN_VIEW)| (whocanviewgroup ANYONE_CAN_VIEW|ALL_IN_DOMAIN_CAN_VIEW|ALL_MEMBERS_CAN_VIEW|ALL_MANAGERS_CAN_VIEW)|
(whocanviewmembership ALL_IN_DOMAIN_CAN_VIEW|ALL_MEMBERS_CAN_VIEW|ALL_MANAGERS_CAN_VIEW) (whocanviewmembership ALL_IN_DOMAIN_CAN_VIEW|ALL_MEMBERS_CAN_VIEW|ALL_MANAGERS_CAN_VIEW)
<MobileAttributes> ::= <MobileAction> ::=
(model <String>)|(os <String>)|(useragent <String>)| admin_remote_wipe|wipe|admin_account_wipe|accountwipe|wipeaccount|approve|block|cancel_remote_wipe_then_activate|cancel_remote_wipe_then_block
(action admin_remote_wipe|wipe|admin_account_wipe|accountwipe|wipeaccount|approve|block|cancel_remote_wipe_then_activate|cancel_remote_wipe_then_block)
<PrinterAttributes> ::= (currentquota <Number>)|(dailyquota <Number>)| <PrinterAttributes> ::= (currentquota <Number>)|(dailyquota <Number>)|
(defaultdisplayname <String>)|(description <String>)|(displayname <String>)|(firmware <String>)|(gcpversion <String>)| (defaultdisplayname <String>)|(description <String>)|(displayname <String>)|(firmware <String>)|(gcpversion <String>)|
@ -655,7 +654,7 @@ The listlimit <Number> argument limits the number of recent users and time range
The start <Date> and end <Date> arguments filter the time ranges. The start <Date> and end <Date> arguments filter the time ranges.
Delimiter defaults to comma. Delimiter defaults to comma.
gam update mobile <MobileItem> <MobileAttributes>+ gam update mobile <MobileItem> action <MobileAction>
gam delete mobile <MobileItem> gam delete mobile <MobileItem>
gam info mobile <MobileItem> gam info mobile <MobileItem>
gam print mobile [todrive] [query <QueryMobile>] [basic|full] [orderby <MobileOrderByFieldName> [ascending|descending]] gam print mobile [todrive] [query <QueryMobile>] [basic|full] [orderby <MobileOrderByFieldName> [ascending|descending]]

View File

@ -7520,40 +7520,23 @@ def doUpdateMobile():
cd = buildGAPIObject(u'directory') cd = buildGAPIObject(u'directory')
resourceId = sys.argv[3] resourceId = sys.argv[3]
i = 4 i = 4
action_body = {} body = {}
patch_body = {}
doPatch = doAction = False
while i < len(sys.argv): while i < len(sys.argv):
if sys.argv[i].lower() == u'action': if sys.argv[i].lower() == u'action':
action_body[u'action'] = sys.argv[i+1].lower() body[u'action'] = sys.argv[i+1].lower()
if action_body[u'action'] == u'wipe': if body[u'action'] == u'wipe':
action_body[u'action'] = u'admin_remote_wipe' body[u'action'] = u'admin_remote_wipe'
elif action_body[u'action'].replace(u'_', u'') in [u'accountwipe', u'wipeaccount']: elif body[u'action'].replace(u'_', u'') in [u'accountwipe', u'wipeaccount']:
action_body[u'action'] = u'admin_account_wipe' body[u'action'] = u'admin_account_wipe'
if action_body[u'action'] not in [u'admin_remote_wipe', u'admin_account_wipe', u'approve', u'block', u'cancel_remote_wipe_then_activate', u'cancel_remote_wipe_then_block']: if body[u'action'] not in [u'admin_remote_wipe', u'admin_account_wipe', u'approve', u'block', u'cancel_remote_wipe_then_activate', u'cancel_remote_wipe_then_block']:
print u'ERROR: action must be one of wipe, wipeaccount, approve, block, cancel_remote_wipe_then_activate, cancel_remote_wipe_then_block; got %s' % action_body[u'action'] print u'ERROR: action must be one of wipe, wipeaccount, approve, block, cancel_remote_wipe_then_activate, cancel_remote_wipe_then_block; got %s' % body[u'action']
sys.exit(2) sys.exit(2)
doAction = True
i += 2 i += 2
elif sys.argv[i].lower() == u'model':
patch_body[u'model'] = sys.argv[i+1]
i += 2
doPatch = True
elif sys.argv[i].lower() == u'os':
patch_body[u'os'] = sys.argv[i+1]
i += 2
doPatch = True
elif sys.argv[i].lower() == u'useragent':
patch_body[u'userAgent'] = sys.argv[i+1]
i += 2
doPatch = True
else: else:
print u'ERROR: %s is not a valid argument for "gam update mobile"' % sys.argv[i] print u'ERROR: %s is not a valid argument for "gam update mobile"' % sys.argv[i]
sys.exit(2) sys.exit(2)
if doPatch: if body:
callGAPI(cd.mobiledevices(), u'update', resourceId=resourceId, body=patch_body, customerId=GC_Values[GC_CUSTOMER_ID]) callGAPI(cd.mobiledevices(), u'action', resourceId=resourceId, body=body, customerId=GC_Values[GC_CUSTOMER_ID])
if doAction:
callGAPI(cd.mobiledevices(), u'action', resourceId=resourceId, body=action_body, customerId=GC_Values[GC_CUSTOMER_ID])
def doDeleteMobile(): def doDeleteMobile():
cd = buildGAPIObject(u'directory') cd = buildGAPIObject(u'directory')