gam7 7.13.2__py3-none-any.whl → 7.13.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of gam7 might be problematic. Click here for more details.

gam/__init__.py CHANGED
@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
25
25
  """
26
26
 
27
27
  __author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
28
- __version__ = '7.13.02'
28
+ __version__ = '7.13.03'
29
29
  __license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
30
30
 
31
31
  #pylint: disable=wrong-import-position
@@ -25677,24 +25677,28 @@ def doPrintShowChromeProfiles():
25677
25677
  csvPF.writeCSVfile('Chrome Profiles')
25678
25678
 
25679
25679
  def _getChromeProfileNameList():
25680
- if not Cmd.PeekArgumentPresent(['select', 'filter', 'filters']):
25680
+ if not Cmd.PeekArgumentPresent(['select', 'commands', 'filter', 'filters']):
25681
25681
  return getString(Cmd.OB_CHROMEPROFILE_NAME_LIST).replace(',', ' ').split()
25682
25682
  return []
25683
25683
 
25684
25684
  def _initChromeProfileNameParameters():
25685
25685
  cm = buildGAPIObject(API.CHROMEMANAGEMENT)
25686
- return (cm, {'profileNameList': _getChromeProfileNameList(), 'customerId': _getCustomerId(),
25686
+ return (cm, {'profileNameList': _getChromeProfileNameList(),
25687
+ 'commandNameList': [],
25688
+ 'customerId': _getCustomerId(),
25687
25689
  'cbfilter': None, 'filterTimes': {},
25688
25690
  'OBY': OrderBy(CHROMEPROFILE_ORDERBY_CHOICE_MAP)})
25689
25691
 
25690
25692
  def _getChromeProfileNameParameters(myarg, parameters):
25691
- if not parameters['cbfilter'] and myarg == 'select':
25693
+ if not parameters['cbfilter'] and not parameters['commandNameList'] and myarg == 'select':
25692
25694
  parameters['profileNameList'].extend(getEntityList(Cmd.OB_CHROMEPROFILE_NAME_LIST))
25693
- elif not parameters['profileNameList'] and myarg == 'orderby':
25695
+ elif not parameters['cbfilter'] and not parameters['profileNameList'] and myarg == 'commands':
25696
+ parameters['commandNameList'].extend(getEntityList(Cmd.OB_CHROMEPROFILE_COMMAND_NAME_LIST))
25697
+ elif not parameters['profileNameList'] and not parameters['commandNameList'] and myarg == 'orderby':
25694
25698
  parameters['OBY'].GetChoice()
25695
- elif not parameters['profileNameList'] and myarg.startswith('filtertime'):
25699
+ elif not parameters['profileNameList'] and not parameters['commandNameList'] and myarg.startswith('filtertime'):
25696
25700
  parameters['filterTimes'][myarg] = getTimeOrDeltaFromNow()
25697
- elif not parameters['profileNameList'] and myarg in {'filter', 'filters'}:
25701
+ elif not parameters['profileNameList'] and not parameters['commandNameList'] and myarg in {'filter', 'filters'}:
25698
25702
  parameters['cbfilter'] = getString(Cmd.OB_STRING)
25699
25703
  else:
25700
25704
  return False
@@ -25703,9 +25707,14 @@ def _getChromeProfileNameParameters(myarg, parameters):
25703
25707
  def _getChromeProfileNameEntityForCommand(cm, parameters):
25704
25708
  if parameters['cbfilter'] is None:
25705
25709
  customerId = parameters['customerId']
25706
- for i, profileName in enumerate(parameters['profileNameList']):
25707
- if not profileName.startswith('customers'):
25708
- parameters['profileNameList'][i] = f'customers/{customerId}/profiles/{profileName}'
25710
+ if parameters['profileNameList']:
25711
+ for i, profileName in enumerate(parameters['profileNameList']):
25712
+ if not profileName.startswith('customers'):
25713
+ parameters['profileNameList'][i] = f'customers/{customerId}/profiles/{profileName}'
25714
+ elif parameters['commandNameList']:
25715
+ for i, commandName in enumerate(parameters['commandNameList']):
25716
+ if not commandName.startswith('customers'):
25717
+ parameters['commandNameList'][i] = f'customers/{customerId}/profiles/{commandName}'
25709
25718
  return
25710
25719
  if parameters['filterTimes']:
25711
25720
  for filterTimeName, filterTimeValue in iter(parameters['filterTimes'].items()):
@@ -25740,13 +25749,23 @@ def _showChromeProfileCommand(profcmd, FJQC, i=0, count=0):
25740
25749
  showJSON(None, profcmd, timeObjects=CHROMEPROFILECOMMAND_TIME_OBJECTS)
25741
25750
  Ind.Decrement()
25742
25751
 
25752
+ def _printChromeProfileCommand(profcmd, csvPF, FJQC):
25753
+ row = flattenJSON(profcmd, timeObjects=CHROMEPROFILECOMMAND_TIME_OBJECTS)
25754
+ if not FJQC.formatJSON:
25755
+ csvPF.WriteRowTitles(row)
25756
+ elif csvPF.CheckRowTitles(row):
25757
+ csvPF.WriteRowNoFilter({'name': profcmd['name'],
25758
+ 'JSON': json.dumps(cleanJSON(profcmd, timeObjects=CHROMEPROFILECOMMAND_TIME_OBJECTS),
25759
+ ensure_ascii=False, sort_keys=True)})
25760
+
25743
25761
  # gam create chromeprofilecommand <ChromeProfileNameEntity>
25744
25762
  # [clearcache [<Boolean>]] [clearcookies [<Boolean>]]
25745
- # [formatjson]
25763
+ # [csv [todrive <ToDriveAttribute>*] [formatjson [quotechar <Character>]]]
25746
25764
  def doCreateChromeProfileCommand():
25747
25765
  cm, parameters = _initChromeProfileNameParameters()
25748
25766
  body = {'commandType': 'clearBrowsingData', 'payload': {}}
25749
- FJQC = FormatJSONQuoteChar()
25767
+ csvPF = None
25768
+ FJQC = FormatJSONQuoteChar(None)
25750
25769
  while Cmd.ArgumentsRemaining():
25751
25770
  myarg = getArgument()
25752
25771
  if _getChromeProfileNameParameters(myarg, parameters):
@@ -25755,8 +25774,13 @@ def doCreateChromeProfileCommand():
25755
25774
  body['payload']['clearCache'] = getBoolean()
25756
25775
  elif myarg == 'clearcookies':
25757
25776
  body['payload']['clearCookies'] = getBoolean()
25777
+ elif myarg == 'csv':
25778
+ csvPF = CSVPrintFile(['name'], 'sortall')
25779
+ FJQC.SetCsvPF(csvPF)
25780
+ elif csvPF and myarg == 'todrive':
25781
+ csvPF.GetTodriveParameters()
25758
25782
  else:
25759
- FJQC.GetFormatJSON(myarg)
25783
+ FJQC.GetFormatJSONQuoteChar(myarg, True)
25760
25784
  _getChromeProfileNameEntityForCommand(cm, parameters)
25761
25785
  count = len(parameters['profileNameList'])
25762
25786
  i = 0
@@ -25766,11 +25790,16 @@ def doCreateChromeProfileCommand():
25766
25790
  profcmd = callGAPI(cm.customers().profiles().commands(), 'create',
25767
25791
  throwReasons=[GAPI.INVALID_ARGUMENT, GAPI.NOT_FOUND, GAPI.PERMISSION_DENIED],
25768
25792
  parent=profileName, body=body)
25769
- _showChromeProfileCommand(profcmd, FJQC)
25793
+ if csvPF is None:
25794
+ _showChromeProfileCommand(profcmd, FJQC, i, count)
25795
+ else:
25796
+ _printChromeProfileCommand(profcmd, csvPF, FJQC)
25770
25797
  except (GAPI.notFound) as e:
25771
25798
  entityActionFailedWarning([Ent.CHROME_PROFILE_COMMAND, profileName], str(e), i, count)
25772
25799
  except (GAPI.invalidArgument, GAPI.permissionDenied) as e:
25773
25800
  entityActionFailedExit([Ent.CHROME_PROFILE_COMMAND, profileName], str(e))
25801
+ if csvPF:
25802
+ csvPF.writeCSVfile('Chrome Profile Commands')
25774
25803
 
25775
25804
  # gam info chromeprofilecommand <ChromeProfileCommandName>
25776
25805
  # [formatjson]
@@ -25794,15 +25823,6 @@ def doInfoChromeProfileCommand():
25794
25823
  # gam print chromeprofilecommands <ChromeProfilNameEntity> [todrive <ToDriveAttribute>*]
25795
25824
  # [formatjson [quotechar <Character>]]
25796
25825
  def doPrintShowChromeProfileCommands():
25797
- def _printProfileCommand(profcmd):
25798
- row = flattenJSON(profcmd, timeObjects=CHROMEPROFILECOMMAND_TIME_OBJECTS)
25799
- if not FJQC.formatJSON:
25800
- csvPF.WriteRowTitles(row)
25801
- elif csvPF.CheckRowTitles(row):
25802
- csvPF.WriteRowNoFilter({'name': profcmd['name'],
25803
- 'JSON': json.dumps(cleanJSON(profcmd, timeObjects=CHROMEPROFILECOMMAND_TIME_OBJECTS),
25804
- ensure_ascii=False, sort_keys=True)})
25805
-
25806
25826
  csvPF = CSVPrintFile(['name']) if Act.csvFormat() else None
25807
25827
  FJQC = FormatJSONQuoteChar(csvPF)
25808
25828
  cm, parameters = _initChromeProfileNameParameters()
@@ -25815,32 +25835,50 @@ def doPrintShowChromeProfileCommands():
25815
25835
  else:
25816
25836
  FJQC.GetFormatJSONQuoteChar(myarg, True)
25817
25837
  _getChromeProfileNameEntityForCommand(cm, parameters)
25818
- count = len(parameters['profileNameList'])
25819
- i = 0
25820
- for profileName in parameters['profileNameList']:
25821
- i +=1
25822
- printGettingEntityItemForWhom(Ent.CHROME_PROFILE_COMMAND, profileName, i, count)
25823
- pageMessage = getPageMessage()
25824
- try:
25825
- profcmds = callGAPIpages(cm.customers().profiles().commands(), 'list', 'chromeBrowserProfileCommands',
25826
- pageMessage=pageMessage,
25827
- throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.PERMISSION_DENIED],
25828
- parent=profileName, pageSize=100)
25829
- if not csvPF:
25830
- jcount = len(profcmds)
25831
- Ind.Increment()
25832
- j = 0
25833
- for profcmd in profcmds:
25834
- j += 1
25835
- _showChromeProfileCommand(profcmd, FJQC, j, jcount)
25836
- Ind.Decrement()
25837
- else:
25838
- for profcmd in profcmds:
25839
- _printProfileCommand(profcmd)
25840
- except (GAPI.notFound) as e:
25841
- entityActionFailedWarning([Ent.CHROME_PROFILE, profileName], str(e), i, count)
25842
- except (GAPI.invalidArgument, GAPI.permissionDenied) as e:
25843
- entityActionFailedExit([Ent.CHROME_PROFILE, profileName], str(e))
25838
+ if parameters['profileNameList']:
25839
+ count = len(parameters['profileNameList'])
25840
+ i = 0
25841
+ for profileName in parameters['profileNameList']:
25842
+ i +=1
25843
+ printGettingEntityItemForWhom(Ent.CHROME_PROFILE_COMMAND, profileName, i, count)
25844
+ pageMessage = getPageMessage()
25845
+ try:
25846
+ profcmds = callGAPIpages(cm.customers().profiles().commands(), 'list', 'chromeBrowserProfileCommands',
25847
+ pageMessage=pageMessage,
25848
+ throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.PERMISSION_DENIED],
25849
+ parent=profileName, pageSize=100)
25850
+ if not csvPF:
25851
+ jcount = len(profcmds)
25852
+ Ind.Increment()
25853
+ j = 0
25854
+ for profcmd in profcmds:
25855
+ j += 1
25856
+ _showChromeProfileCommand(profcmd, FJQC, j, jcount)
25857
+ Ind.Decrement()
25858
+ else:
25859
+ for profcmd in profcmds:
25860
+ _printChromeProfileCommand(profcmd, csvPF, FJQC)
25861
+ except GAPI.notFound as e:
25862
+ entityActionFailedWarning([Ent.CHROME_PROFILE, profileName], str(e), i, count)
25863
+ except (GAPI.invalidArgument, GAPI.permissionDenied) as e:
25864
+ entityActionFailedExit([Ent.CHROME_PROFILE, profileName], str(e))
25865
+ elif parameters['commandNameList']:
25866
+ count = len(parameters['commandNameList'])
25867
+ i = 0
25868
+ for profileCommandName in parameters['commandNameList']:
25869
+ i +=1
25870
+ try:
25871
+ profcmd = callGAPI(cm.customers().profiles().commands(), 'get',
25872
+ throwReasons=[GAPI.INVALID_ARGUMENT, GAPI.NOT_FOUND, GAPI.PERMISSION_DENIED],
25873
+ name=profileCommandName)
25874
+ if not csvPF:
25875
+ _showChromeProfileCommand(profcmd, FJQC, i, count)
25876
+ else:
25877
+ _printChromeProfileCommand(profcmd, csvPF, FJQC)
25878
+ except GAPI.notFound as e:
25879
+ entityActionFailedWarning([Ent.CHROME_PROFILE_COMMAND, profileCommandName], str(e), i, count)
25880
+ except (GAPI.invalidArgument, GAPI.permissionDenied) as e:
25881
+ entityActionFailedExit([Ent.CHROME_PROFILE, profileCommandName], str(e))
25844
25882
  if csvPF:
25845
25883
  csvPF.writeCSVfile('Chrome Profile Commands')
25846
25884
 
gam/gamlib/glclargs.py CHANGED
@@ -859,6 +859,8 @@ class GamCLArgs():
859
859
  OB_CHAT_THREAD = 'ChatThread'
860
860
  OB_CHROMEPROFILE_NAME = 'ChromeProfileName'
861
861
  OB_CHROMEPROFILE_NAME_LIST = 'ChromeProfileNameList'
862
+ OB_CHROMEPROFILE_COMMAND_NAME = 'ChromeProfileCommandName'
863
+ OB_CHROMEPROFILE_COMMAND_NAME_LIST = 'ChromeProfileNameCommandList'
862
864
  OB_CHROME_VERSION = 'ChromeVersion'
863
865
  OB_CIDR_NETMASK = 'CIDRnetmask'
864
866
  OB_CIGROUP_ALIAS_LIST = "CIGroupAliasList"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gam7
3
- Version: 7.13.2
3
+ Version: 7.13.3
4
4
  Summary: CLI tool to manage Google Workspace
5
5
  Project-URL: Homepage, https://github.com/GAM-team/GAM
6
6
  Project-URL: Issues, https://github.com/GAM-team/GAM/issues
@@ -1,4 +1,4 @@
1
- gam/__init__.py,sha256=IV4dLB-d_ujpKNkejbHaDHxTecVFKgdPR1FqvGvDes8,3561686
1
+ gam/__init__.py,sha256=evlJ5qIFGRjZn43m5KrUowSCy_CY7k_EfA_XvpJuu94,3563784
2
2
  gam/__main__.py,sha256=amz0-959ph6zkZKqjaar4n60yho-T37w6qWI36qx0CA,1049
3
3
  gam/cacerts.pem,sha256=82Ak7btW_2XvocLUvAwPmpx8Chi0oqtZUG1gseLK_t4,50235
4
4
  gam/cbcm-v1.1beta1.json,sha256=xO5XloCQQULmPbFBx5bckdqmbLFQ7sJ2TImhE1ysDIY,19439
@@ -25,7 +25,7 @@ gam/gamlib/__init__.py,sha256=z5mF-y0j8pm-YNFBaiuxB4M_GAUPG-cXWwrhYwrVReM,679
25
25
  gam/gamlib/glaction.py,sha256=1Il_HrChVnPkzZwiZs5au4mFQVtq4K1Z42uIuR6qdnI,9419
26
26
  gam/gamlib/glapi.py,sha256=27NW2etvdNK4jfR699eqFzhV4gPotijXIQeX-wxCvHA,35319
27
27
  gam/gamlib/glcfg.py,sha256=bNTckxzIM_HruxO2DfYsDbEgqOIz1RX6CbU6XOQQQyg,28296
28
- gam/gamlib/glclargs.py,sha256=cx3WfZSG42fGSFs_wdV6d4IlCmBMEfYo_Dyah7-BX7M,42876
28
+ gam/gamlib/glclargs.py,sha256=b-2ow-EeVoDbwhmlGYtZ4JCowy7icwvy_r2aILci_Nc,43007
29
29
  gam/gamlib/glentity.py,sha256=zQ64Q5MVDnJwgUTxNapO5s-KC8yfr1fS4GxXu7uGPT0,33877
30
30
  gam/gamlib/glgapi.py,sha256=sJMWCyVd_2MP3rF2z-zqFwWEdUu6kceRA7e42u4kVv8,40181
31
31
  gam/gamlib/glgdata.py,sha256=weRppttWm6uRyqtBoGPKoHiNZ2h28nhfUV4J_mbCszY,2707
@@ -65,8 +65,8 @@ gam/googleapiclient/discovery_cache/base.py,sha256=yCDPtxnbNN-p5_9fzBacC6P3wcUPl
65
65
  gam/googleapiclient/discovery_cache/file_cache.py,sha256=sim3Mg4HgRYo3vX75jvcKy_aV568EvIrtBfvfbw-044,4774
66
66
  gam/iso8601/__init__.py,sha256=Z2PsYbXgAH5a5xzUvgczCboPzqWpm65kRcIngCnhViU,1218
67
67
  gam/iso8601/iso8601.py,sha256=Li2FHZ4sBTWuthuQhyCvmvj0j6At8JbGzkSv2fc2RHU,4384
68
- gam7-7.13.2.dist-info/METADATA,sha256=76mc2jCySBhYeSW2QWY5ytnsx6PbDsAwyOPfMlaPe9Y,2978
69
- gam7-7.13.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
70
- gam7-7.13.2.dist-info/entry_points.txt,sha256=HVUM5J7dA8YwvJfG30jiLefR19ExMs387TWugWd9sf4,42
71
- gam7-7.13.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
72
- gam7-7.13.2.dist-info/RECORD,,
68
+ gam7-7.13.3.dist-info/METADATA,sha256=v6As87oNBBgCjvpF9pfWwJ1jyVHHnu-O4L78dSaYEMM,2978
69
+ gam7-7.13.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
70
+ gam7-7.13.3.dist-info/entry_points.txt,sha256=HVUM5J7dA8YwvJfG30jiLefR19ExMs387TWugWd9sf4,42
71
+ gam7-7.13.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
72
+ gam7-7.13.3.dist-info/RECORD,,
File without changes