Compare commits

...

6 Commits

Author SHA1 Message Date
Jay Lee
7bdee0927a actions: run more steps on manual actions button push
Some checks are pending
Build and test GAM / build (Win64, build, 10, VC-WIN64A, windows-2022) (push) Waiting to run
Build and test GAM / build (aarch64, build, 3, linux-aarch64, ubuntu-24.04-arm) (push) Waiting to run
Build and test GAM / build (aarch64, build, 4, linux-aarch64, ubuntu-22.04-arm) (push) Waiting to run
Build and test GAM / build (aarch64, build, 6, linux-aarch64, ubuntu-22.04-arm, yes) (push) Waiting to run
Build and test GAM / build (aarch64, build, 8, darwin64-arm64, macos-14) (push) Waiting to run
Build and test GAM / build (aarch64, build, 9, darwin64-arm64, macos-15) (push) Waiting to run
Build and test GAM / build (x86_64, build, 1, linux-x86_64, ubuntu-22.04) (push) Waiting to run
Build and test GAM / build (x86_64, build, 2, linux-x86_64, ubuntu-24.04) (push) Waiting to run
Build and test GAM / build (x86_64, build, 5, linux-x86_64, ubuntu-22.04, yes) (push) Waiting to run
Build and test GAM / build (x86_64, build, 7, darwin64-x86_64, macos-13) (push) Waiting to run
Build and test GAM / build (x86_64, test, 11, ubuntu-24.04, 3.10) (push) Waiting to run
Build and test GAM / build (x86_64, test, 12, ubuntu-24.04, 3.11) (push) Waiting to run
Build and test GAM / build (x86_64, test, 13, ubuntu-24.04, 3.12) (push) Waiting to run
Build and test GAM / merge (push) Blocked by required conditions
Build and test GAM / publish (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Check for Google Root CA Updates / check-apis (push) Waiting to run
2025-02-11 10:25:57 -05:00
Jay Lee
b18d8a0107 actions: allow manual actions from GitHub UI
https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#workflow_dispatch
2025-02-11 09:17:17 -05:00
Jay Lee
5ed5540746 enable manual pypi runs
Some checks failed
Build and test GAM / build (Win64, build, 10, VC-WIN64A, windows-2022) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 3, linux-aarch64, ubuntu-24.04-arm) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 4, linux-aarch64, ubuntu-22.04-arm) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 6, linux-aarch64, ubuntu-22.04-arm, yes) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 8, darwin64-arm64, macos-14) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 9, darwin64-arm64, macos-15) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 1, linux-x86_64, ubuntu-22.04) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 2, linux-x86_64, ubuntu-24.04) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 5, linux-x86_64, ubuntu-22.04, yes) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 7, darwin64-x86_64, macos-13) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 11, ubuntu-24.04, 3.10) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 12, ubuntu-24.04, 3.11) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 13, ubuntu-24.04, 3.12) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Check for Google Root CA Updates / check-apis (push) Has been cancelled
Build and test GAM / merge (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled
2025-02-08 19:50:00 +00:00
Jay Lee
0a9ea7fc83 remove unknown classifier 2025-02-08 19:46:32 +00:00
Jay Lee
7ece7a0a1a 3.7.8, fix yubikey optional for pip package 2025-02-08 19:43:17 +00:00
Ross Scroggs
8d9f5689f3 Updated gam create vaultexport to include corpus gemini. 2025-02-08 09:38:37 -08:00
6 changed files with 86 additions and 46 deletions

View File

@@ -5,6 +5,7 @@ on:
pull_request:
schedule:
- cron: '37 22 * * *'
workflow_dispatch:
permissions:
contents: read
@@ -756,7 +757,7 @@ jobs:
- name: Attest that gam package files were generated from this Action
uses: actions/attest-build-provenance@v1
if: (github.event_name == 'push' || github.event_name == 'schedule') && matrix.goal == 'build'
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && matrix.goal == 'build'
with:
subject-path: |
gam*.tar.xz
@@ -765,7 +766,7 @@ jobs:
- name: Archive production artifacts
uses: actions/upload-artifact@v4
if: (github.event_name == 'push' || github.event_name == 'schedule') && matrix.goal != 'test'
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && matrix.goal != 'test'
with:
name: gam-binaries-${{ env.GAMOS }}-${{ env.arch }}-${{ matrix.jid }}
path: |
@@ -793,8 +794,8 @@ jobs:
fi
echo "We successfully compiled Python ${this_python} and OpenSSL ${this_openssl}"
- name: Live API tests push only
if: (github.event_name == 'push' || github.event_name == 'schedule')
- name: Live API tests
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
run: |
export gam_user="gam-gha-${JID}@pdl.jaylee.us"
echo "gam_user=${gam_user}" >> $GITHUB_ENV
@@ -1004,7 +1005,7 @@ jobs:
tar cJvvf cache.tar.xz $tar_folders
merge:
if: (github.event_name == 'push' || github.event_name == 'schedule')
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
runs-on: ubuntu-24.04
needs: build
permissions:
@@ -1018,7 +1019,7 @@ jobs:
pattern: gam-binaries-*
publish:
if: github.event_name == 'push'
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
runs-on: ubuntu-24.04
needs: merge
permissions:

View File

@@ -3,6 +3,7 @@ on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
jobs:
pypi:

View File

@@ -1,29 +1,54 @@
[project]
name = "gam7"
dynamic = [
"dependencies",
"version",
]
authors = [
{ name="Jay Lee", email="jay0lee@gmail.com" },
{ name="Ross Scroggs", email="Ross.Scroggs@gmail.com" },
]
dependencies = [
"chardet",
"cryptography",
"distro; sys_platform=='linux'",
"filelock",
"google-api-python-client>=2.1",
"google-auth-httplib2",
"google-auth-oauthlib>=0.4.1",
"google-auth>=2.3.2",
"httplib2>=0.17.0",
"lxml",
"passlib>=1.7.2",
"pathvalidate",
"python-dateutil",
]
description = "CLI tool to manage Google Workspace"
readme = "README.md"
requires-python = ">=3.9"
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
]
license = {text = "Apache License (2.0)"}
license-files = ["LICEN[CS]E*"]
[project.optional-dependencies]
yubikey = ["yubikey-manager>=5.0"]
[project.scripts]
gam = "gam.__main__:main"
[project.urls]
Homepage = "https://github.com/GAM-team/GAM"
Issues = "https://github.com/GAM-team/GAM/issues"
Discussion = "https://groups.google.com/group/google-apps-manager"
Chat = "https://git.io/gam-chat"
[tool.hatch.version]
path = "src/gam/__init__.py"
@@ -31,12 +56,8 @@ path = "src/gam/__init__.py"
[tool.hatch.build.targets.wheel]
packages = ["src/gam"]
[tool.hatch.metadata.hooks.requirements_txt]
files = ["src/requirements.txt"]
[build-system]
requires = [
"hatchling",
"hatch-requirements_txt",
]
build-backend = "hatchling.build"

View File

@@ -2092,7 +2092,7 @@ gam move browsers ou|org|orgunit <OrgUnitPath>
gam info browser <DeviceID>
(basic|full|annotated |
(<BrowserFieldName>* [fields <BrowserFieldNameList>]) |
(rawfields <BrowserFieldNameList>))
(rawfields "<BrowserFieldNameList>"))
[formatjson]
gam show browsers
([ou|org|orgunit|browserou <OrgUnitPath>] [(query <QueryBrowser>)|(queries <QueryBrowserList>))|(select <BrowserEntity>))
@@ -2100,7 +2100,7 @@ gam show browsers
[orderby <BrowserOrderByFieldName> [ascending|descending]]
(basic|full|annotated |
(<BrowserFieldName>* [fields <BrowserFieldNameList>]) |
(rawfields <BrowserFieldNameList>))
(rawfields "<BrowserFieldNameList>"))
[formatjson]
gam print browsers [todrive <ToDriveAttribute>*]
([ou|org|orgunit|browserou <OrgUnitPath>] [(query <QueryBrowser>)|(queries <QueryBrowserList>))|(select <BrowserEntity>))
@@ -2108,7 +2108,7 @@ gam print browsers [todrive <ToDriveAttribute>*]
[orderby <BrowserOrderByFieldName> [ascending|descending]]
(basic|full|annotated |
(<BrowserFieldName>* [fields <BrowserFieldNameList>]) |
(rawfields <BrowserFieldNameList>))
(rawfields "<BrowserFieldNameList>"))
[sortheaders]
[formatjson [quotechar <Character>]]
@@ -5270,7 +5270,7 @@ gam print vaultcounts [todrive <ToDriveAttributes>*]
gam print vaultcounts [todrive <ToDriveAttributes>*]
matter <MatterItem> operation <String> [wait <Integer>]
gam create vaultexport|export matter <MatterItem> [name <String>] corpus calendar|drive|mail|groups|hangouts_chat|voice
gam create vaultexport|export matter <MatterItem> [name <String>] corpus calendar|drive|gemini|groups|hangouts_chat|mail|voice
(accounts <EmailAddressEntity>) | (orgunit|org|ou <OrgUnitPath>) | everyone
(shareddrives|teamdrives <SharedDriveIDList>) | (rooms <RoomList>) | (sitesurl <URLList>)
[scope all_data|held_data|unprocessed_data]
@@ -5278,10 +5278,12 @@ gam create vaultexport|export matter <MatterItem> [name <String>] corpus calenda
[locationquery <StringList>] [peoplequery <StringList>] [minuswords <StringList>]
[responsestatuses <AttendeeStatus>(,<AttendeeStatus>)*] [calendarversiondate <Date>|<Time>]
[includeshareddrives <Boolean>] [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>]
[driveclientsideencryption any|encrypted|unencrypted]
[includerooms <Boolean>]
[excludedrafts <Boolean>] [format mbox|pst]
[excludedrafts <Boolean>] [mailclientsideencryption any|encrypted|unencrypted]
[showconfidentialmodecontent <Boolean>] [usenewexport <Boolean>] [exportlinkeddrivefiles <Boolean>]
[covereddata calllogs|textmessages|voicemails]
[format ics|mbox|pst|xml]
[region any|europe|us] [showdetails|returnidonly]
gam delete vaultexport|export <ExportItem> matter <MatterItem>
gam delete vaultexport|export <MatterItem> <ExportItem>

View File

@@ -1,8 +1,16 @@
7.03.07
Updated `gam create vaultexport` to include `corpus gemini`.
* See: https://workspaceupdates.googleblog.com/2025/02/google-vault-now-supports-gemini.html
7.03.06
Added option `rawfields <BrowserFieldNameList>` to `gam info|print|show browsers` that allows
Added option `rawfields "<BrowserFieldNameList>"` to `gam info|print|show browsers` that allows
specification of complex field lists with selected subfields.
* See: https://github.com/GAM-team/GAM/wiki/Chrome-Browser-Cloud-Management#raw-fields
7.03.05
Make GAM pip-installable: "pip install gam7"

View File

@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
"""
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
__version__ = '7.03.06'
__version__ = '7.03.08'
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
#pylint: disable=wrong-import-position
@@ -7356,11 +7356,11 @@ def addFieldToFieldsList(fieldName, fieldsChoiceMap, fieldsList):
def _getFieldsList():
return getString(Cmd.OB_FIELD_NAME_LIST).lower().replace('_', '').replace(',', ' ').split()
def _getRawFieldsList(requiredField=None):
rawFieldsList = getString(Cmd.OB_FIELDS)
if requiredField is not None and requiredField not in rawFieldsList:
rawFieldsList = f'{requiredField},{rawFieldsList}'
return rawFieldsList
def _getRawFields(requiredField=None):
rawFields = getString(Cmd.OB_FIELDS)
if requiredField is None or requiredField in rawFields:
return rawFields
return f'{requiredField},{rawFields}'
def _addInitialField(fieldsList, initialField):
if isinstance(initialField, list):
@@ -25133,7 +25133,7 @@ def doInfoBrowsers():
deviceId = getString(Cmd.OB_DEVICE_ID)
projection = 'BASIC'
fieldsList = []
rawFieldsList = None
rawFields = None
FJQC = FormatJSONQuoteChar()
while Cmd.ArgumentsRemaining():
myarg = getArgument()
@@ -25147,15 +25147,12 @@ def doInfoBrowsers():
pass
elif myarg == 'rawfields':
projection = 'FULL'
rawFieldsList = _getRawFieldsList('deviceId')
rawFields = _getRawFields('deviceId')
else:
FJQC.GetFormatJSON(myarg)
if projection == 'BASIC' and set(fieldsList).intersection(BROWSER_FULL_ACCESS_FIELDS):
projection = 'FULL'
if not rawFieldsList:
fields = getFieldsFromFieldsList(fieldsList)
else:
fields = rawFieldsList
fields = getFieldsFromFieldsList(fieldsList) if not rawFields else rawFields
try:
browser = callGAPI(cbcm.chromebrowsers(), 'get',
throwReasons=[GAPI.BAD_REQUEST, GAPI.RESOURCE_NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.FORBIDDEN],
@@ -25524,7 +25521,7 @@ def doPrintShowBrowsers():
csvPF = CSVPrintFile(['deviceId']) if Act.csvFormat() else None
FJQC = FormatJSONQuoteChar(csvPF)
fieldsList = []
rawFieldsList = None
rawFields = None
projection = 'BASIC'
orderBy = 'id'
sortOrder = 'ASCENDING'
@@ -25565,7 +25562,7 @@ def doPrintShowBrowsers():
pass
elif myarg == 'rawfields':
projection = 'FULL'
rawFieldsList = _getRawFieldsList('deviceId')
rawFields = _getRawFields('deviceId')
else:
FJQC.GetFormatJSONQuoteChar(myarg, True)
if projection == 'BASIC' and set(fieldsList).intersection(BROWSER_FULL_ACCESS_FIELDS):
@@ -25574,10 +25571,7 @@ def doPrintShowBrowsers():
sortHeaders = False
substituteQueryTimes(queries, queryTimes)
if entityList is None:
if not rawFieldsList:
fields = getItemFieldsFromFieldsList('browsers', fieldsList)
else:
fields = f'nextPageToken,browsers({rawFieldsList})'
fields = getItemFieldsFromFieldsList('browsers', fieldsList) if not rawFields else f'nextPageToken,browsers({rawFields})'
for query in queries:
printGettingAllAccountEntities(Ent.CHROME_BROWSER, query)
pageMessage = getPageMessage()
@@ -25616,10 +25610,7 @@ def doPrintShowBrowsers():
else:
sortRows = True
jcount = len(entityList)
if not rawFieldsList:
fields = getFieldsFromFieldsList(fieldsList)
else:
fields = rawFieldsList
fields = getFieldsFromFieldsList(fieldsList) if not rawFields else rawFields
j = 0
for deviceId in entityList:
j += 1
@@ -40464,9 +40455,10 @@ VAULT_SEARCH_METHODS_MAP = {
VAULT_CORPUS_ARGUMENT_MAP = {
'calendar': 'CALENDAR',
'drive': 'DRIVE',
'mail': 'MAIL',
'gemini': 'GEMINI',
'groups': 'GROUPS',
'hangoutschat': 'HANGOUTS_CHAT',
'mail': 'MAIL',
'voice': 'VOICE',
}
VAULT_COUNTS_CORPUS_ARGUMENT_MAP = {
@@ -40493,15 +40485,22 @@ VAULT_EXPORT_FORMAT_MAP = {
'ics': 'ICS',
'mbox': 'MBOX',
'pst': 'PST',
'xml': 'XML',
}
VAULT_CORPUS_EXPORT_FORMATS = {
'CALENDAR': ['ICS', 'PST'],
'DRIVE': [],
'GEMINI': ['XML'],
'GROUPS': ['MBOX', 'PST'],
'HANGOUTS_CHAT': ['MBOX', 'PST'],
'MAIL': ['MBOX', 'PST'],
'VOICE' : ['MBOX', 'PST'],
}
VAULT_CSE_OPTION_MAP = {
'any': 'CLIENT_SIDE_ENCRYPTED_OPTION_ANY',
'encrypted': 'CLIENT_SIDE_ENCRYPTED_OPTION_ENCRYPTED',
'unencrypted': 'CLIENT_SIDE_ENCRYPTED_OPTION_UNENCRYPTED',
}
VAULT_EXPORT_REGION_MAP = {
'any': 'ANY',
'europe': 'EUROPE',
@@ -40510,16 +40509,18 @@ VAULT_EXPORT_REGION_MAP = {
VAULT_CORPUS_OPTIONS_MAP = {
'CALENDAR': 'calendarOptions',
'DRIVE': 'driveOptions',
'MAIL': 'mailOptions',
'GEMINI': 'geminiOptions',
'GROUPS': 'groupsOptions',
'HANGOUTS_CHAT': 'hangoutsChatOptions',
'MAIL': 'mailOptions',
'VOICE': 'voiceOptions',
}
VAULT_CORPUS_QUERY_MAP = {
'CALENDAR': None,
'DRIVE': 'driveQuery',
'MAIL': 'mailQuery',
'GEMINI': None,
'GROUPS': 'groupsQuery',
'MAIL': 'mailQuery',
'HANGOUTS_CHAT': 'hangoutsChatQuery',
'VOICE': 'voiceQuery',
}
@@ -40528,11 +40529,11 @@ VAULT_QUERY_ARGS = [
# calendar
'locationquery', 'peoplequery', 'minuswords', 'responsestatuses', 'caldendarversiondate',
# drive
'driveversiondate', 'includeshareddrives', 'includeteamdrives',
'driveclientsideencryption', 'driveversiondate', 'includeshareddrives', 'includeteamdrives',
# hangoutsChat
'includerooms',
# mail
'excludedrafts',
'mailclientsideencryption', 'excludedrafts',
# voice
'covereddata',
] + list(VAULT_SEARCH_METHODS_MAP.keys())
@@ -40589,12 +40590,16 @@ def _buildVaultQuery(myarg, query, corpusArgumentMap):
query.setdefault('driveOptions', {})['versionDate'] = getTimeOrDeltaFromNow()
elif myarg in {'includeshareddrives', 'includeteamdrives'}:
query.setdefault('driveOptions', {})['includeSharedDrives'] = getBoolean()
elif myarg == 'driveclientsideencryption':
query.setdefault('driveOptions', {})['clientSideEncryptedOption'] = getChoice(VAULT_CSE_OPTION_MAP, mapChoice=True)
# hangoutsChat
elif myarg == 'includerooms':
query['hangoutsChatOptions'] = {'includeRooms': getBoolean()}
# mail
elif myarg == 'excludedrafts':
query['mailOptions'] = {'excludeDrafts': getBoolean()}
elif myarg == 'mailclientsideencryption':
query.setdefault('mailOptions', {})['clientSideEncryptedOption'] = getChoice(VAULT_CSE_OPTION_MAP, mapChoice=True)
# voice
elif myarg == 'covereddata':
query['voiceOptions'] = {'coveredData': getChoice(VAULT_VOICE_COVERED_DATA_MAP, mapChoice=True)}
@@ -40609,7 +40614,7 @@ def _validateVaultQuery(body, corpusArgumentMap):
if body['query']['corpus'] != corpus:
body['exportOptions'].pop(options, None)
# gam create vaultexport|export matter <MatterItem> [name <String>] corpus calendar|drive|mail|groups|hangouts_chat|voice
# gam create vaultexport|export matter <MatterItem> [name <String>] corpus calendar|drive|gemini|groups|hangouts_chat|mail|voice
# (accounts <EmailAddressEntity>) | (orgunit|org|ou <OrgUnitPath>) | everyone
# (shareddrives|teamdrives <TeamDriveIDList>) | (rooms <RoomList>) | (sitesurl <URLList>)
# [scope <all_data|held_data|unprocessed_data>]
@@ -40617,10 +40622,12 @@ def _validateVaultQuery(body, corpusArgumentMap):
# [locationquery <StringList>] [peoplequery <StringList>] [minuswords <StringList>]
# [responsestatuses <AttendeeStatus>(,<AttendeeStatus>)*] [calendarversiondate <Date>|<Time>]
# [includeshareddrives <Boolean>] [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>]
# [driveclientsideencryption any|encrypted|unencrypted]
# [includerooms <Boolean>]
# [excludedrafts <Boolean>] [format mbox|pst]
# [excludedrafts <Boolean>] [mailclientsideencryption any|encrypted|unencrypted]
# [showconfidentialmodecontent <Boolean>] [usenewexport <Boolean>] [exportlinkeddrivefiles <Boolean>]
# [covereddata calllogs|textmessages|voicemails]
# [format ics|mbox|pst|xml]
# [region any|europe|us] [showdetails|returnidonly]
def doCreateVaultExport():
v = buildGAPIObject(API.VAULT)