Skip to content

Commit

Permalink
Doc update, minor code updates
Browse files Browse the repository at this point in the history
  • Loading branch information
taers232c committed Nov 16, 2024
1 parent 6fe196b commit 2884904
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
25 changes: 17 additions & 8 deletions docs/Reports.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ gam report <ActivityApplicationName> [todrive <ToDriveAttributes>*]
[(user all|<UserItem>)|(orgunit|org|ou <OrgUnitPath> [showorgunit])|(select <UserTypeEntity>)]
[([start <Time>] [end <Time>])|(range <Time> <Time>)|
yesterday|today|thismonth|(previousmonths <Integer>)]
[filtertime.* <Time>] [filter|filters <String>]
[filtertime<String> <Time>] [filter|filters <String>]
[event|events <EventNameList>] [ip <String>]
[groupidfilter <String>]
[maxactivities <Number>] [maxevents <Number>] [maxresults <Number>]
Expand Down Expand Up @@ -96,8 +96,10 @@ Limit the time period.
Apply API filters.
* `filter|filters <String>` - `<String>` is a comma separated list of filter expressions.

Use the `filtertime.* <Time>` option to allow times, usually relative, to be substituted into the `filter <String>` option.
The characters following `filtertime` can be any combination of lowercase letters and numbers.
Use the `filtertime<String> <Time>` option to allow times, usually relative, to be substituted into the `filters` option.
The `filtertime<String> <Time>` value replaces the string `#filtertime<String>#` in any filters..
The characters following `filtertime` can be any combination of lowercase letters and numbers. This is most useful in scripts
where you can specify a relative date without having to change the script.

You can use `config csv_output_row_filter` to filter the events if the API filter can't produce the results you want.

Expand Down Expand Up @@ -355,7 +357,7 @@ gam report users|user [todrive <ToDriveAttributes>*]
[(date <Date>)|(range <Date> <Date>)|
yesterday|today|thismonth|(previousmonths <Integer>)]
[(nodatechange | limitdatechanges <Integer>) | (fulldatarequired all|<UserServiceNameList>)]
[filtertime.* <Time>] [filter|filters <String>]
[filtertime<String> <Time>] [filter|filters <String>]
[(fields|parameters <String>)|(services <UserServiceNameList>)]
[aggregatebydate|aggregatebyuser [Boolean]]
[maxresults <Number>]
Expand Down Expand Up @@ -398,8 +400,15 @@ where `date` is the earliest date for which report data was requested.
Apply filters.
* `filter|filters <String>` - `<String>` is a comma separated list of filter expressions.

Use the `filtertime.* <Time>` option to allow times, usually relative, to be substituted into the `filter <String>` option.
The characters following `filtertime` can be any combination of lowercase letters and numbers.
Use the `filtertime<String> <Time>` option to allow times, usually relative, to be substituted into the `filters` option.
The `filtertime<String> <Time>` value replaces the string `#filtertime<String>#` in any filters..
The characters following `filtertime` can be any combination of lowercase letters and numbers. This is most useful in scripts
where you can specify a relative date without having to change the script.

For example, filter for last logins more that 60 days ago.
```
filtertime60d -60d filters "accounts:last_login_time<#filtertime60d#"
```

Select the fields/parameters to display.
* `fields|parameters <String>` - A list of parameters separated by commas
Expand All @@ -417,11 +426,11 @@ Limit the number of activities downloaded per API call; infrequently used.

Report on the users that haven't logged in in the last 5 years.
```
gam report users parameters accounts:last_login_time filters "accounts:last_login_time<#filtertime#" filtertime -5y
gam report users parameters accounts:last_login_time filters "accounts:last_login_time<#filtertime5y#" filtertime5y -5y
```
Report on the users that haven't ever logged in.
```
gam report users parameters accounts:last_login_time filters "accounts:last_login_time==#filtertime#" filtertime never
gam report users parameters accounts:last_login_time filters "accounts:last_login_time==#filtertimenever#" filtertimenever never
```
Report on users Google Drive usage.
```
Expand Down
14 changes: 5 additions & 9 deletions src/gam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2708,11 +2708,6 @@ def actionFailedNumItems(itemCount, itemType, errMessage, i=0, count=0):
[f'{itemCount} {Ent.Choose(itemType, itemCount)} {Act.Failed()}: {errMessage} '],
currentCountNL(i, count)))

def performActionModifierNumItems(modifier, itemCount, itemType, i=0, count=0):
writeStdout(formatKeyValueList(Ind.Spaces(),
[f'{Act.ToPerform()} {modifier} {itemCount} {Ent.Choose(itemType, itemCount)}'],
currentCountNL(i, count)))

def actionNotPerformedNumItemsWarning(itemCount, itemType, errMessage, i=0, count=0):
setSysExitRC(ACTION_NOT_PERFORMED_RC)
writeStderr(formatKeyValueList(Ind.Spaces(),
Expand Down Expand Up @@ -25483,7 +25478,7 @@ def _cleanChatSpace(space):
def _cleanChatMessage(message):
message.pop('cards', None)

CHAT_TIME_OBJECTS = {'createTime', 'deleteTime', 'eventTime', 'lastUpdateTime'}
CHAT_TIME_OBJECTS = {'createTime', 'deleteTime', 'eventTime', 'lastActiveTime', 'lastUpdateTime'}

def _showChatItem(citem, entityType, FJQC, i=0, count=0):
if entityType == Ent.CHAT_SPACE:
Expand Down Expand Up @@ -43251,7 +43246,8 @@ def doCreateUser():
throwReasons=[GAPI.DUPLICATE, GAPI.DOMAIN_NOT_FOUND,
GAPI.DOMAIN_CANNOT_USE_APIS, GAPI.FORBIDDEN,
GAPI.INVALID, GAPI.INVALID_INPUT, GAPI.INVALID_PARAMETER,
GAPI.INVALID_ORGUNIT, GAPI.INVALID_SCHEMA_VALUE, GAPI.CONDITION_NOT_MET],
GAPI.INVALID_ORGUNIT, GAPI.INVALID_SCHEMA_VALUE, GAPI.CONDITION_NOT_MET,
GAPI.LIMIT_EXCEEDED],
body=body,
fields=fields,
resolveConflictAccount=resolveConflictAccount)
Expand All @@ -43270,7 +43266,7 @@ def doCreateUser():
except GAPI.invalidOrgunit:
entityActionFailedExit([Ent.USER, user], Msg.INVALID_ORGUNIT)
except (GAPI.domainNotFound, GAPI.domainCannotUseApis, GAPI.forbidden,
GAPI.invalid, GAPI.invalidInput, GAPI.invalidParameter, GAPI.conditionNotMet) as e:
GAPI.invalid, GAPI.invalidInput, GAPI.invalidParameter, GAPI.conditionNotMet, GAPI.limitExceeded) as e:
entityActionFailedExit([Ent.USER, user], str(e))
if PwdOpts.filename and PwdOpts.password:
writeFile(PwdOpts.filename, f'{user},{PwdOpts.password}\n', mode='a', continueOnError=True)
Expand Down Expand Up @@ -74970,7 +74966,7 @@ def doPrintShowCAALevels():
Cmd.ARG_INBOUNDSSOPROFILE: doCreateInboundSSOProfile,
Cmd.ARG_ORG: doCreateOrg,
Cmd.ARG_PERMISSION: doCreatePermissions,
Cmd.ARG_CIPOLICY: doCreateCIPolicy,
Cmd.ARG_CIPOLICY: doCreateCIPolicy,
Cmd.ARG_PRINTER: doCreatePrinter,
Cmd.ARG_PROJECT: doCreateProject,
Cmd.ARG_RESOLDCUSTOMER: doCreateResoldCustomer,
Expand Down

0 comments on commit 2884904

Please sign in to comment.