gam7 7.3.4__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.

Files changed (72) hide show
  1. gam/__init__.py +77555 -0
  2. gam/__main__.py +40 -0
  3. gam/atom/__init__.py +1460 -0
  4. gam/atom/auth.py +41 -0
  5. gam/atom/client.py +214 -0
  6. gam/atom/core.py +535 -0
  7. gam/atom/data.py +327 -0
  8. gam/atom/http.py +354 -0
  9. gam/atom/http_core.py +599 -0
  10. gam/atom/http_interface.py +144 -0
  11. gam/atom/mock_http.py +123 -0
  12. gam/atom/mock_http_core.py +313 -0
  13. gam/atom/mock_service.py +235 -0
  14. gam/atom/service.py +723 -0
  15. gam/atom/token_store.py +105 -0
  16. gam/atom/url.py +130 -0
  17. gam/cacerts.pem +1130 -0
  18. gam/cbcm-v1.1beta1.json +593 -0
  19. gam/contactdelegation-v1.json +249 -0
  20. gam/datastudio-v1.json +486 -0
  21. gam/gamlib/__init__.py +17 -0
  22. gam/gamlib/glaction.py +308 -0
  23. gam/gamlib/glapi.py +837 -0
  24. gam/gamlib/glcfg.py +616 -0
  25. gam/gamlib/glclargs.py +1184 -0
  26. gam/gamlib/glentity.py +831 -0
  27. gam/gamlib/glgapi.py +817 -0
  28. gam/gamlib/glgdata.py +98 -0
  29. gam/gamlib/glglobals.py +307 -0
  30. gam/gamlib/glindent.py +46 -0
  31. gam/gamlib/glmsgs.py +547 -0
  32. gam/gamlib/glskus.py +246 -0
  33. gam/gamlib/gluprop.py +279 -0
  34. gam/gamlib/glverlibs.py +33 -0
  35. gam/gamlib/yubikey.py +202 -0
  36. gam/gdata/__init__.py +825 -0
  37. gam/gdata/alt/__init__.py +20 -0
  38. gam/gdata/alt/app_engine.py +101 -0
  39. gam/gdata/alt/appengine.py +321 -0
  40. gam/gdata/apps/__init__.py +526 -0
  41. gam/gdata/apps/audit/__init__.py +1 -0
  42. gam/gdata/apps/audit/service.py +278 -0
  43. gam/gdata/apps/contacts/__init__.py +874 -0
  44. gam/gdata/apps/contacts/service.py +355 -0
  45. gam/gdata/apps/service.py +544 -0
  46. gam/gdata/apps/sites/__init__.py +283 -0
  47. gam/gdata/apps/sites/service.py +246 -0
  48. gam/gdata/service.py +1714 -0
  49. gam/gdata/urlfetch.py +247 -0
  50. gam/googleapiclient/__init__.py +27 -0
  51. gam/googleapiclient/_auth.py +167 -0
  52. gam/googleapiclient/_helpers.py +207 -0
  53. gam/googleapiclient/channel.py +315 -0
  54. gam/googleapiclient/discovery.py +1662 -0
  55. gam/googleapiclient/discovery_cache/__init__.py +78 -0
  56. gam/googleapiclient/discovery_cache/appengine_memcache.py +55 -0
  57. gam/googleapiclient/discovery_cache/base.py +46 -0
  58. gam/googleapiclient/discovery_cache/file_cache.py +145 -0
  59. gam/googleapiclient/errors.py +197 -0
  60. gam/googleapiclient/http.py +1962 -0
  61. gam/googleapiclient/mimeparse.py +183 -0
  62. gam/googleapiclient/model.py +429 -0
  63. gam/googleapiclient/schema.py +317 -0
  64. gam/googleapiclient/version.py +15 -0
  65. gam/iso8601/__init__.py +28 -0
  66. gam/iso8601/iso8601.py +160 -0
  67. gam/serviceaccountlookup-v1.json +141 -0
  68. gam/six.py +982 -0
  69. gam7-7.3.4.dist-info/METADATA +69 -0
  70. gam7-7.3.4.dist-info/RECORD +72 -0
  71. gam7-7.3.4.dist-info/WHEEL +4 -0
  72. gam7-7.3.4.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,278 @@
1
+ #!/usr/bin/env python
2
+ # Copyright (C) 2008 Google, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ """Allow Google Apps domain administrators to audit user data.
17
+
18
+ AuditService: Set auditing."""
19
+
20
+ __author__ = 'jlee@pbu.edu'
21
+
22
+ from base64 import b64encode
23
+
24
+ import gdata.apps
25
+ import gdata.apps.service
26
+ import gdata.service
27
+
28
+ class AuditService(gdata.apps.service.PropertyService):
29
+ """Client for the Google Apps Audit service."""
30
+
31
+ def _serviceUrl(self, setting_id, domain=None, user=None):
32
+ if domain is None:
33
+ domain = self.domain
34
+ if user is None:
35
+ return '/a/feeds/compliance/audit/%s/%s' % (setting_id, domain)
36
+ else:
37
+ return '/a/feeds/compliance/audit/%s/%s/%s' % (setting_id, domain, user)
38
+
39
+ def updatePGPKey(self, pgpkey):
40
+ """Updates Public PGP Key Google uses to encrypt audit data
41
+
42
+ Args:
43
+ pgpkey: string, ASCII text of PGP Public Key to be used
44
+
45
+ Returns:
46
+ A dict containing the result of the POST operation."""
47
+
48
+ uri = self._serviceUrl('publickey')
49
+ b64pgpkey = b64encode(pgpkey)
50
+ properties = {}
51
+ properties['publicKey'] = b64pgpkey
52
+ return self._PostProperties(uri, properties)
53
+
54
+ def createEmailMonitor(self, source_user, destination_user, end_date,
55
+ begin_date=None, incoming_headers_only=False,
56
+ outgoing_headers_only=False, drafts=False,
57
+ drafts_headers_only=False, chats=False,
58
+ chats_headers_only=False):
59
+ """Creates a email monitor, forwarding the source_users emails/chats
60
+
61
+ Args:
62
+ source_user: string, the user whose email will be audited
63
+ destination_user: string, the user to receive the audited email
64
+ end_date: string, the date the audit will end in
65
+ "yyyy-MM-dd HH:mm" format, required
66
+ begin_date: string, the date the audit will start in
67
+ "yyyy-MM-dd HH:mm" format, leave blank to use current time
68
+ incoming_headers_only: boolean, whether to audit only the headers of
69
+ mail delivered to source user
70
+ outgoing_headers_only: boolean, whether to audit only the headers of
71
+ mail sent from the source user
72
+ drafts: boolean, whether to audit draft messages of the source user
73
+ drafts_headers_only: boolean, whether to audit only the headers of
74
+ mail drafts saved by the user
75
+ chats: boolean, whether to audit archived chats of the source user
76
+ chats_headers_only: boolean, whether to audit only the headers of
77
+ archived chats of the source user
78
+
79
+ Returns:
80
+ A dict containing the result of the POST operation."""
81
+
82
+ uri = self._serviceUrl('mail/monitor', user=source_user)
83
+ properties = {}
84
+ properties['destUserName'] = destination_user
85
+ if begin_date is not None:
86
+ properties['beginDate'] = begin_date
87
+ properties['endDate'] = end_date
88
+ if incoming_headers_only:
89
+ properties['incomingEmailMonitorLevel'] = 'HEADER_ONLY'
90
+ else:
91
+ properties['incomingEmailMonitorLevel'] = 'FULL_MESSAGE'
92
+ if outgoing_headers_only:
93
+ properties['outgoingEmailMonitorLevel'] = 'HEADER_ONLY'
94
+ else:
95
+ properties['outgoingEmailMonitorLevel'] = 'FULL_MESSAGE'
96
+ if drafts:
97
+ if drafts_headers_only:
98
+ properties['draftMonitorLevel'] = 'HEADER_ONLY'
99
+ else:
100
+ properties['draftMonitorLevel'] = 'FULL_MESSAGE'
101
+ if chats:
102
+ if chats_headers_only:
103
+ properties['chatMonitorLevel'] = 'HEADER_ONLY'
104
+ else:
105
+ properties['chatMonitorLevel'] = 'FULL_MESSAGE'
106
+ return self._PostProperties(uri, properties)
107
+
108
+ def getEmailMonitors(self, user):
109
+ """"Gets the email monitors for the given user
110
+
111
+ Args:
112
+ user: string, the user to retrieve email monitors for
113
+
114
+ Returns:
115
+ list results of the POST operation
116
+
117
+ """
118
+ uri = self._serviceUrl('mail/monitor', user=user)
119
+ return self._GetPropertiesList(uri)
120
+
121
+ def deleteEmailMonitor(self, source_user, destination_user):
122
+ """Deletes the email monitor for the given user
123
+
124
+ Args:
125
+ source_user: string, the user who is being monitored
126
+ destination_user: string, theuser who recieves the monitored emails
127
+
128
+ Returns:
129
+ Nothing
130
+ """
131
+
132
+ uri = self._serviceUrl('mail/monitor', user=source_user+'/'+destination_user)
133
+ try:
134
+ return self._DeleteProperties(uri)
135
+ except gdata.service.RequestError as e:
136
+ raise gdata.apps.service.AppsForYourDomainException(e.args[0])
137
+
138
+ def createAccountInformationRequest(self, user):
139
+ """Creates a request for account auditing details
140
+
141
+ Args:
142
+ user: string, the user to request account information for
143
+
144
+ Returns:
145
+ A dict containing the result of the post operation."""
146
+
147
+ uri = self._serviceUrl('account', user=user)
148
+ properties = {}
149
+ #XML Body is left empty
150
+ try:
151
+ return self._PostProperties(uri, properties)
152
+ except gdata.service.RequestError as e:
153
+ raise gdata.apps.service.AppsForYourDomainException(e.args[0])
154
+
155
+ def getAccountInformationRequestStatus(self, user, request_id):
156
+ """Gets the status of an account auditing request
157
+
158
+ Args:
159
+ user: string, the user whose account auditing details were requested
160
+ request_id: string, the request_id
161
+
162
+ Returns:
163
+ A dict containing the result of the get operation."""
164
+
165
+ uri = self._serviceUrl('account', user=user+'/'+request_id)
166
+ try:
167
+ return self._GetProperties(uri)
168
+ except gdata.service.RequestError as e:
169
+ raise gdata.apps.service.AppsForYourDomainException(e.args[0])
170
+
171
+ def getAllAccountInformationRequestsStatus(self):
172
+ """Gets the status of all account auditing requests for the domain
173
+
174
+ Args:
175
+ None
176
+
177
+ Returns:
178
+ list results of the POST operation
179
+ """
180
+
181
+ uri = self._serviceUrl('account')
182
+ return self._GetPropertiesList(uri)
183
+
184
+
185
+ def deleteAccountInformationRequest(self, user, request_id):
186
+ """Deletes the request for account auditing information
187
+
188
+ Args:
189
+ user: string, the user whose account auditing details were requested
190
+ request_id: string, the request_id
191
+
192
+ Returns:
193
+ Nothing
194
+ """
195
+
196
+ uri = self._serviceUrl('account', user=user+'/'+request_id)
197
+ try:
198
+ return self._DeleteProperties(uri)
199
+ except gdata.service.RequestError as e:
200
+ raise gdata.apps.service.AppsForYourDomainException(e.args[0])
201
+
202
+ def createMailboxExportRequest(self, user, begin_date=None, end_date=None, include_deleted=False, search_query=None, headers_only=False):
203
+ """Creates a mailbox export request
204
+
205
+ Args:
206
+ user: string, the user whose mailbox export is being requested
207
+ begin_date: string, date of earliest emails to export, optional, defaults to date of account creation
208
+ format is 'yyyy-MM-dd HH:mm'
209
+ end_date: string, date of latest emails to export, optional, defaults to current date
210
+ format is 'yyyy-MM-dd HH:mm'
211
+ include_deleted: boolean, whether to include deleted emails in export, mutually exclusive with search_query
212
+ search_query: string, gmail style search query, matched emails will be exported, mutually exclusive with include_deleted
213
+
214
+ Returns:
215
+ A dict containing the result of the post operation."""
216
+
217
+ uri = self._serviceUrl('mail/export', user=user)
218
+ properties = {}
219
+ if begin_date is not None:
220
+ properties['beginDate'] = begin_date
221
+ if end_date is not None:
222
+ properties['endDate'] = end_date
223
+ if include_deleted is not None:
224
+ properties['includeDeleted'] = gdata.apps.service._bool2str(include_deleted)
225
+ if search_query is not None:
226
+ properties['searchQuery'] = search_query
227
+ if headers_only is True:
228
+ properties['packageContent'] = 'HEADER_ONLY'
229
+ else:
230
+ properties['packageContent'] = 'FULL_MESSAGE'
231
+ return self._PostProperties(uri, properties)
232
+
233
+ def getMailboxExportRequestStatus(self, user, request_id):
234
+ """Gets the status of an mailbox export request
235
+
236
+ Args:
237
+ user: string, the user whose mailbox were requested
238
+ request_id: string, the request_id
239
+
240
+ Returns:
241
+ A dict containing the result of the get operation."""
242
+
243
+ uri = self._serviceUrl('mail/export', user=user+'/'+request_id)
244
+ try:
245
+ return self._GetProperties(uri)
246
+ except gdata.service.RequestError as e:
247
+ raise gdata.apps.service.AppsForYourDomainException(e.args[0])
248
+
249
+ def getAllMailboxExportRequestsStatus(self):
250
+ """Gets the status of all mailbox export requests for the domain
251
+
252
+ Args:
253
+ None
254
+
255
+ Returns:
256
+ list results of the POST operation
257
+ """
258
+
259
+ uri = self._serviceUrl('mail/export')
260
+ return self._GetPropertiesList(uri)
261
+
262
+
263
+ def deleteMailboxExportRequest(self, user, request_id):
264
+ """Deletes the request for mailbox export
265
+
266
+ Args:
267
+ user: string, the user whose mailbox were requested
268
+ request_id: string, the request_id
269
+
270
+ Returns:
271
+ Nothing
272
+ """
273
+
274
+ uri = self._serviceUrl('mail/export', user=user+'/'+request_id)
275
+ try:
276
+ return self._DeleteProperties(uri)
277
+ except gdata.service.RequestError as e:
278
+ raise gdata.apps.service.AppsForYourDomainException(e.args[0])