Added option showitemcountonly to gam print domains

This commit is contained in:
Ross Scroggs
2024-07-18 13:19:41 -07:00
parent 752b502399
commit f1e599d535
8 changed files with 52 additions and 15 deletions

View File

@@ -3275,9 +3275,13 @@ gam delete domain <DomainName>
gam info domain [<DomainName>]
[formatjson]
gam print domains [todrive <ToDriveAttribute>*]
gam print domains
[todrive <ToDriveAttribute>*]
[formatjson [quotechar <Character>]]
gam show domains [formatjson]
[showitemcountonly]
gam show domains
[formatjson]
[showitemcountonly]
gam create|add domainalias|aliasdomain <DomainAlias> <DomainName>
gam delete domainalias|aliasdomain <DomainAlias>

View File

@@ -2,6 +2,11 @@
Merged GAM-Team version
6.77.17
Added option `showitemcountonly` to `gam print domains` that causes GAM to display the
number of domains on stdout; no CSV file is written.
6.77.16
Fixed bug in `gam <UserTypeEntity> print filelist` that caused a trap.

View File

@@ -16090,18 +16090,33 @@ def doInfoDomain():
DOMAIN_SORT_TITLES = ['domainName', 'parentDomainName', 'creationTime', 'type', 'verified']
# gam print domains [todrive <ToDriveAttribute>*] [formatjson [quotechar <Character>]]
# gam show domains [formatjson]
# gam print domains [todrive <ToDriveAttribute>*]
# [formatjson [quotechar <Character>]]
# [showitemcountonly]
# gam show domains
# [formatjson]
# [showitemcountonly]
def doPrintShowDomains():
cd = buildGAPIObject(API.DIRECTORY)
csvPF = CSVPrintFile(['domainName'], DOMAIN_SORT_TITLES) if Act.csvFormat() else None
FJQC = FormatJSONQuoteChar(csvPF)
getTodriveFJQCOnly(csvPF, FJQC, True)
showItemCountOnly = False
while Cmd.ArgumentsRemaining():
myarg = getArgument()
if csvPF and myarg == 'todrive':
csvPF.GetTodriveParameters()
elif myarg == 'showitemcountonly':
showItemCountOnly = True
else:
FJQC.GetFormatJSONQuoteChar(myarg, True)
try:
domains = callGAPIitems(cd.domains(), 'list', 'domains',
throwReasons=[GAPI.BAD_REQUEST, GAPI.NOT_FOUND, GAPI.FORBIDDEN],
customer=GC.Values[GC.CUSTOMER_ID])
count = len(domains)
if showItemCountOnly:
writeStdout(f'{count}\n')
return
i = 0
for domain in domains:
i += 1