Added command to get customer app details.

This commit is contained in:
Ross Scroggs
2023-10-12 09:03:03 -07:00
parent 994d489226
commit d500196dee
12 changed files with 94 additions and 17 deletions

View File

@@ -2502,7 +2502,10 @@ gam create chromenetwork
gam delete chromenetwork
<OrgUnitItem> <NetworkID>
# Chrome Apps/Versions
# Chrome Apps/Details/Versions
gam info appdetails android|chrome|web <AppID>
[formatjson]
gam show chromeapps
[(ou <OrgUnitItem>)|(ou_and_children <OrgUnitItem>)|

View File

@@ -1,3 +1,15 @@
6.64.13
Added command to get customer app details.
```
gam info appdetails android|chrome|web <AppID> [formatjson]
```
6.64.12
Upgraded to Python 3.12.0 where possible.
Upgraded to OpenSSL 3.1.3 where possible.
6.64.11
Added support for Google Workspace Labs license.

View File

@@ -24088,6 +24088,38 @@ def doInfoPrintShowCrOSTelemetry():
if csvPF:
csvPF.writeCSVfile('CrOS Devices Telemetry')
APP_DETAILS_TIME_OBJECTS = {'firstPublishTime', 'latestPublishTime'}
APP_DETAILS_TYPE_CHOICES = ['android', 'chrome', 'web']
# gam info appdetails android|chrome|web <AppID> [formatjson]
def doInfoAppDetails():
cm = buildGAPIObject(API.CHROMEMANAGEMENT_APPDETAILS)
mode = getChoice(APP_DETAILS_TYPE_CHOICES)
app_id = getString(Cmd.OB_APP_ID)
FJQC = FormatJSONQuoteChar()
while Cmd.ArgumentsRemaining():
myarg = getArgument()
FJQC.GetFormatJSON(myarg)
if mode == 'chrome':
service = cm.customers().apps().chrome()
elif mode == 'android':
service = cm.customers().apps().android()
else:
service = cm.customers().apps().web()
try:
appDetails = callGAPI(service, 'get',
throwReasons=[GAPI.BAD_REQUEST, GAPI.NOT_FOUND, GAPI.FORBIDDEN],
name=f'customers/{GC.Values[GC.CUSTOMER_ID]}/apps/{mode}/{app_id}')
if FJQC.formatJSON:
printLine(json.dumps(cleanJSON(appDetails), ensure_ascii=False, sort_keys=True))
return
printEntity([Ent.APP_ID, app_id])
Ind.Increment()
showJSON(None, appDetails, timeObjects=APP_DETAILS_TIME_OBJECTS)
Ind.Decrement()
except (GAPI.badRequest, GAPI.notFound, GAPI.forbidden):
checkEntityAFDNEorAccessErrorExit(None, Ent.APP_ID, app_id)
# gam delete browser <DeviceID>
def doDeleteBrowsers():
cbcm = buildGAPIObject(API.CBCM)
@@ -70030,6 +70062,7 @@ MAIN_COMMANDS_WITH_OBJECTS = {
(Act.INFO,
{Cmd.ARG_ADMINROLE: doInfoAdminRole,
Cmd.ARG_ALERT: doInfoAlert,
Cmd.ARG_APPDETAILS: doInfoAppDetails,
Cmd.ARG_ALIAS: doInfoAliases,
Cmd.ARG_BUILDING: doInfoBuilding,
Cmd.ARG_BROWSER: doInfoBrowsers,

View File

@@ -32,6 +32,7 @@ CHAT_MESSAGES = 'chatmessages'
CHAT_SPACES = 'chatspaces'
CHAT_SPACES_DELETE = 'chatspacesdelete'
CHROMEMANAGEMENT = 'chromemanagement'
CHROMEMANAGEMENT_APPDETAILS = 'chromemanagementappdetails'
CHROMEMANAGEMENT_TELEMETRY = 'chromemanagementtelemetry'
CHROMEPOLICY = 'chromepolicy'
CHROMEVERSIONHISTORY = 'versionhistory'
@@ -195,6 +196,7 @@ _INFO = {
CHAT_SPACES_DELETE: {'name': 'Chat API - Spaces Delete', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHAT},
CLASSROOM: {'name': 'Classroom API', 'version': 'v1', 'v2discovery': True},
CHROMEMANAGEMENT: {'name': 'Chrome Management API', 'version': 'v1', 'v2discovery': True},
CHROMEMANAGEMENT_APPDETAILS: {'name': 'Chrome Management API - AppDetails', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHROMEMANAGEMENT},
CHROMEMANAGEMENT_TELEMETRY: {'name': 'Chrome Management API - Telemetry', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHROMEMANAGEMENT},
CHROMEPOLICY: {'name': 'Chrome Policy API', 'version': 'v1', 'v2discovery': True},
CHROMEVERSIONHISTORY: {'name': 'Chrome Version History API', 'version': 'v1', 'v2discovery': True},
@@ -266,6 +268,10 @@ _CLIENT_SCOPES = [
'api': CHROMEMANAGEMENT,
'subscopes': [],
'scope': 'https://www.googleapis.com/auth/chrome.management.reports.readonly'},
{'name': 'Chrome Management API - AppDetails read only',
'api': CHROMEMANAGEMENT_APPDETAILS,
'subscopes': [],
'scope': 'https://www.googleapis.com/auth/chrome.management.appdetails.readonly'},
{'name': 'Chrome Management API - Telemetry read only',
'api': CHROMEMANAGEMENT_TELEMETRY,
'subscopes': [],

View File

@@ -428,6 +428,7 @@ class GamCLArgs():
ARG_APIS = 'apis'
ARG_APIPROJECT = 'apiproject'
ARG_APPACCESSSETTINGS = 'appaccesssettings'
ARG_APPDETAILS = 'appdetails'
ARG_APPLICATIONSPECIFICPASSWORDS = 'applicationspecificpasswords'
ARG_ASP = 'asp'
ARG_ASPS = 'asps'