class TestResourcePipe(messages.Message): """A test resource pipe for a test plan.""" name = messages.StringField(1, required=True) url = messages.StringField(2) test_resource_type = messages.EnumField(ndb_models.TestResourceType, 3)
class Breakpoint(_messages.Message): """Represents the breakpoint specification, status and results. Enums: ActionValueValuesEnum: Defines what to do when the breakpoint hits. LogLevelValueValuesEnum: Indicates the severity of the log. Only relevant when action is "LOG". Fields: action: Defines what to do when the breakpoint hits. condition: A condition to trigger the breakpoint. The condition is a compound boolean expression composed using expressions in a programming language at the source location. createTime: The time this breakpoint was created by the server. The value is in seconds resolution. evaluatedExpressions: The evaluated expressions' values at breakpoint time. The evaluated expressions appear in exactly the same order they are listed in the 'expressions' field. The 'name' field holds the original expression text, the 'value'/'members' field holds the result of the evaluated expression. If the expression can not be evaluated, an error text is placed in the value field. expressions: A list of read-only expressions to evaluate at the breakpoint location. The expressions are composed using expressions in the programming language at the source location. If the breakpoint action is "LOG", the evaluated expressions are included in log statements. finalTime: The time this breakpoint was finalized as seen by the server. The value is in seconds resolution. id: Breakpoint identifier, unique in the scope of the debuggee. isFinalState: When true, indicates that this is a final result and the breakpoint state will not change from here on. location: The breakpoint source location. logLevel: Indicates the severity of the log. Only relevant when action is "LOG". logMessageFormat: Only relevant when action is "LOG". Defines the message to log when the breakpoint hits. The message may include parameter placeholders "$0", "$1", etc. These placeholders will be replaced with the evaluated value of the appropriate expression. Expressions not referenced in "log_message_format" will not be logged. Example: "Poisonous message received, id = $0, count = $1" with expressions = [ "message.id", "message.count" ]. stackFrames: The stack at breakpoint time. status: Breakpoint status. The status includes an error flag and a human readable message. This field will usually stay unset. The message can be either informational or error. Nevertheless, clients should always display the text message back to the user. Error status of a breakpoint indicates complete failure. Example (non-final state): 'Still loading symbols...' Examples (final state): 'Failed to insert breakpoint' referring to breakpoint, 'Field f not found in class C' referring to condition, ... userEmail: The e-mail of the user that created this breakpoint variableTable: The variable_table exists to aid with computation, memory and network traffic optimization. It enables storing a variable once and reference it from multiple variables, including variables stored in the variable_table itself. For example, the object 'this', which may appear at many levels of the stack, can have all of it's data stored once in this table. The stack frame variables then would hold only a reference to it. The variable var_index field is an index into this repeated field. The stored objects are nameless and get their name from the referencing variable. The effective variable is a merge of the referencing veariable and the referenced variable. """ class ActionValueValuesEnum(_messages.Enum): """Defines what to do when the breakpoint hits. Values: CAPTURE: Capture stack frame and variables and update the breakpoint. The data is only captured once. After that the breakpoint is set in a final state. LOG: Log each breakpoint hit. The breakpoint will remain active until deleted or expired. """ CAPTURE = 0 LOG = 1 class LogLevelValueValuesEnum(_messages.Enum): """Indicates the severity of the log. Only relevant when action is "LOG". Values: INFO: Information log message. WARNING: Warning log message. ERROR: Error log message. """ INFO = 0 WARNING = 1 ERROR = 2 action = _messages.EnumField('ActionValueValuesEnum', 1) condition = _messages.StringField(2) createTime = _messages.StringField(3) evaluatedExpressions = _messages.MessageField('Variable', 4, repeated=True) expressions = _messages.StringField(5, repeated=True) finalTime = _messages.StringField(6) id = _messages.StringField(7) isFinalState = _messages.BooleanField(8) location = _messages.MessageField('SourceLocation', 9) logLevel = _messages.EnumField('LogLevelValueValuesEnum', 10) logMessageFormat = _messages.StringField(11) stackFrames = _messages.MessageField('StackFrame', 12, repeated=True) status = _messages.MessageField('StatusMessage', 13) userEmail = _messages.StringField(14) variableTable = _messages.MessageField('Variable', 15, repeated=True)
class ProfileForm(messages.Message): """ProfileForm -- Profile outbound form message""" displayName = messages.StringField(1) mainEmail = messages.StringField(2) teeShirtSize = messages.EnumField('TeeShirtSize', 3) conferenceKeysToAttend = messages.StringField(4, repeated=True)
class MakeMoveForm(messages.Message): """Used to make a move in an existing game""" user_name = messages.StringField(1, required=True) play = messages.EnumField('MoveOptions', 2, required=True)
class ConferenceApi(remote.Service): """Conference API v0.1""" # - - - Conference objects - - - - - - - - - - - - - - - - - def _copyConferenceToForm(self, conf, displayName): """Copy relevant fields from Conference to ConferenceForm.""" cf = ConferenceForm() for field in cf.all_fields(): if hasattr(conf, field.name): # convert Date to date string; just copy others if field.name.endswith('Date'): setattr(cf, field.name, str(getattr(conf, field.name))) else: setattr(cf, field.name, getattr(conf, field.name)) elif field.name == "websafeKey": setattr(cf, field.name, conf.key.urlsafe()) if displayName: setattr(cf, 'organizerDisplayName', displayName) cf.check_initialized() return cf def _createConferenceObject(self, request): """Create or update Conference object, returning ConferenceForm/request.""" # preload necessary data items user = endpoints.get_current_user() if not user: raise endpoints.UnauthorizedException('Authorization required') user_id = getUserId(user) if not request.name: raise endpoints.BadRequestException( "Conference 'name' field required") # copy ConferenceForm/ProtoRPC Message into dict data = { field.name: getattr(request, field.name) for field in request.all_fields() } del data['websafeKey'] del data['organizerDisplayName'] # add default values for those missing (both data model & outbound Message) for df in DEFAULTS: if data[df] in (None, []): data[df] = DEFAULTS[df] setattr(request, df, DEFAULTS[df]) # convert dates from strings to Date objects; set month based on start_date if data['startDate']: data['startDate'] = datetime.strptime(data['startDate'][:10], "%Y-%m-%d").date() data['month'] = data['startDate'].month else: data['month'] = 0 if data['endDate']: data['endDate'] = datetime.strptime(data['endDate'][:10], "%Y-%m-%d").date() # set seatsAvailable to be same as maxAttendees on creation # both for data model & outbound Message if data["maxAttendees"] > 0: data["seatsAvailable"] = data["maxAttendees"] setattr(request, "seatsAvailable", data["maxAttendees"]) # generate Profile Key based on user ID and Conference # ID based on Profile key get Conference key from ID p_key = ndb.Key(Profile, user_id) c_id = Conference.allocate_ids(size=1, parent=p_key)[0] c_key = ndb.Key(Conference, c_id, parent=p_key) data['key'] = c_key data['organizerUserId'] = request.organizerUserId = user_id # create Conference, send email to organizer confirming # creation of Conference & return (modified) ConferenceForm Conference(**data).put() taskqueue.add(params={ 'email': user.email(), 'conferenceInfo': repr(request) }, url='/tasks/send_confirmation_email') return request @ndb.transactional() def _updateConferenceObject(self, request): user = endpoints.get_current_user() if not user: raise endpoints.UnauthorizedException('Authorization required') user_id = getUserId(user) # copy ConferenceForm/ProtoRPC Message into dict data = { field.name: getattr(request, field.name) for field in request.all_fields() } # update existing conference conf = ndb.Key(urlsafe=request.websafeConferenceKey).get() # check that conference exists if not conf: raise endpoints.NotFoundException( 'No conference found with key: %s' % request.websafeConferenceKey) # check that user is owner if user_id != conf.organizerUserId: raise endpoints.ForbiddenException( 'Only the owner can update the conference.') # Not getting all the fields, so don't create a new object; just # copy relevant fields from ConferenceForm to Conference object for field in request.all_fields(): data = getattr(request, field.name) # only copy fields where we get data if data not in (None, []): # special handling for dates (convert string to Date) if field.name in ('startDate', 'endDate'): data = datetime.strptime(data, "%Y-%m-%d").date() if field.name == 'startDate': conf.month = data.month # write to Conference object setattr(conf, field.name, data) conf.put() prof = ndb.Key(Profile, user_id).get() return self._copyConferenceToForm(conf, getattr(prof, 'displayName')) @endpoints.method(ConferenceForm, ConferenceForm, path='conference', http_method='POST', name='createConference') def createConference(self, request): """Create new conference.""" return self._createConferenceObject(request) @endpoints.method(CONF_POST_REQUEST, ConferenceForm, path='conference/{websafeConferenceKey}', http_method='PUT', name='updateConference') def updateConference(self, request): """Update conference w/provided fields & return w/updated info.""" return self._updateConferenceObject(request) @endpoints.method(CONF_GET_REQUEST, ConferenceForm, path='conference/{websafeConferenceKey}', http_method='GET', name='getConference') def getConference(self, request): """Return requested conference (by websafeConferenceKey).""" # get Conference object from request; bail if not found conf = ndb.Key(urlsafe=request.websafeConferenceKey).get() if not conf: raise endpoints.NotFoundException( 'No conference found with key: %s' % request.websafeConferenceKey) prof = conf.key.parent().get() # return ConferenceForm return self._copyConferenceToForm(conf, getattr(prof, 'displayName')) @endpoints.method(message_types.VoidMessage, ConferenceForms, path='getConferencesCreated', http_method='POST', name='getConferencesCreated') def getConferencesCreated(self, request): """Return conferences created by user.""" # make sure user is authed user = endpoints.get_current_user() if not user: raise endpoints.UnauthorizedException('Authorization required') user_id = getUserId(user) # create ancestor query for all key matches for this user confs = Conference.query(ancestor=ndb.Key(Profile, user_id)) prof = ndb.Key(Profile, user_id).get() # return set of ConferenceForm objects per Conference return ConferenceForms(items=[ self._copyConferenceToForm(conf, getattr(prof, 'displayName')) for conf in confs ]) def _getQuery(self, request): """Return formatted query from the submitted filters.""" q = Conference.query() inequality_filter, filters = self._formatFilters(request.filters) # If exists, sort on inequality filter first if not inequality_filter: q = q.order(Conference.name) else: q = q.order(ndb.GenericProperty(inequality_filter)) q = q.order(Conference.name) for filtr in filters: if filtr["field"] in ["month", "maxAttendees"]: filtr["value"] = int(filtr["value"]) formatted_query = ndb.query.FilterNode(filtr["field"], filtr["operator"], filtr["value"]) q = q.filter(formatted_query) return q def _formatFilters(self, filters): """Parse, check validity and format user supplied filters.""" formatted_filters = [] inequality_field = None for f in filters: filtr = { field.name: getattr(f, field.name) for field in f.all_fields() } try: filtr["field"] = FIELDS[filtr["field"]] filtr["operator"] = OPERATORS[filtr["operator"]] except KeyError: raise endpoints.BadRequestException( "Filter contains invalid field or operator.") # Every operation except "=" is an inequality if filtr["operator"] != "=": # check if inequality operation has been used in previous filters # disallow the filter if inequality was performed on a different field before # track the field on which the inequality operation is performed if inequality_field and inequality_field != filtr["field"]: raise endpoints.BadRequestException( "Inequality filter is allowed on only one field.") else: inequality_field = filtr["field"] formatted_filters.append(filtr) return (inequality_field, formatted_filters) @endpoints.method(ConferenceQueryForms, ConferenceForms, path='queryConferences', http_method='POST', name='queryConferences') def queryConferences(self, request): """Query for conferences.""" conferences = self._getQuery(request) # need to fetch organiser displayName from profiles # get all keys and use get_multi for speed organisers = [(ndb.Key(Profile, conf.organizerUserId)) for conf in conferences] profiles = ndb.get_multi(organisers) # put display names in a dict for easier fetching names = {} for profile in profiles: names[profile.key.id()] = profile.displayName # return individual ConferenceForm object per Conference return ConferenceForms( items=[self._copyConferenceToForm(conf, names[conf.organizerUserId]) for conf in \ conferences] ) @endpoints.method(message_types.VoidMessage, ConferenceForms, path='conferences/attending', http_method='GET', name='getConferencesToAttend') def getConferencesToAttend(self, request): """Get list of conferences that user has registered for.""" prof = self._getProfileFromUser() # get user Profile conf_keys = [ ndb.Key(urlsafe=wsck) for wsck in prof.conferenceKeysToAttend ] conferences = ndb.get_multi(conf_keys) # get organizers organisers = [ ndb.Key(Profile, conf.organizerUserId) for conf in conferences ] profiles = ndb.get_multi(organisers) # put display names in a dict for easier fetching names = {} for profile in profiles: names[profile.key.id()] = profile.displayName # return set of ConferenceForm objects per Conference return ConferenceForms(items=[ self._copyConferenceToForm(conf, names[conf.organizerUserId]) for conf in conferences ]) # - - - Profile objects - - - - - - - - - - - - - - - - - - - def _copyProfileToForm(self, prof): """Copy relevant fields from Profile to ProfileForm.""" # copy relevant fields from Profile to ProfileForm pf = ProfileForm() for field in pf.all_fields(): if hasattr(prof, field.name): # convert t-shirt string to Enum; just copy others if field.name == 'teeShirtSize': setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name))) else: setattr(pf, field.name, getattr(prof, field.name)) pf.check_initialized() return pf def _getProfileFromUser(self): """Return user Profile from datastore, creating new one if non-existent.""" # make sure user is authed user = endpoints.get_current_user() if not user: raise endpoints.UnauthorizedException('Authorization required') # get Profile from datastore user_id = getUserId(user) p_key = ndb.Key(Profile, user_id) profile = p_key.get() # create new Profile if not there if not profile: profile = Profile( key=p_key, displayName=user.nickname(), mainEmail=user.email(), teeShirtSize=str(TeeShirtSize.NOT_SPECIFIED), ) profile.put() return profile # return Profile def _doProfile(self, save_request=None): """Get user Profile and return to user, possibly updating it first.""" # get user Profile prof = self._getProfileFromUser() # if saveProfile(), process user-modifyable fields if save_request: for field in ('displayName', 'teeShirtSize'): if hasattr(save_request, field): val = getattr(save_request, field) if val: setattr(prof, field, str(val)) #if field == 'teeShirtSize': # setattr(prof, field, str(val).upper()) #else: # setattr(prof, field, val) prof.put() # return ProfileForm return self._copyProfileToForm(prof) @endpoints.method(message_types.VoidMessage, ProfileForm, path='profile', http_method='GET', name='getProfile') def getProfile(self, request): """Return user profile.""" return self._doProfile() @endpoints.method(ProfileMiniForm, ProfileForm, path='profile', http_method='POST', name='saveProfile') def saveProfile(self, request): """Update & return user profile.""" return self._doProfile(request) # - - - Announcements - - - - - - - - - - - - - - - - - - - - @staticmethod def _cacheAnnouncement(): """Create Announcement & assign to memcache; used by memcache cron job & putAnnouncement(). """ confs = Conference.query( ndb.AND(Conference.seatsAvailable <= 5, Conference.seatsAvailable > 0)).fetch( projection=[Conference.name]) if confs: # If there are almost sold out conferences, # format announcement and set it in memcache announcement = ANNOUNCEMENT_TPL % (', '.join(conf.name for conf in confs)) memcache.set(MEMCACHE_ANNOUNCEMENTS_KEY, announcement) else: # If there are no sold out conferences, # delete the memcache announcements entry announcement = "" memcache.delete(MEMCACHE_ANNOUNCEMENTS_KEY) return announcement @endpoints.method(message_types.VoidMessage, StringMessage, path='conference/announcement/get', http_method='GET', name='getAnnouncement') def getAnnouncement(self, request): """Return Announcement from memcache.""" return StringMessage( data=memcache.get(MEMCACHE_ANNOUNCEMENTS_KEY) or "") # - - - Registration - - - - - - - - - - - - - - - - - - - - @ndb.transactional(xg=True) def _conferenceRegistration(self, request, reg=True): """Register or unregister user for selected conference.""" retval = None prof = self._getProfileFromUser() # get user Profile # check if conf exists given websafeConfKey # get conference; check that it exists wsck = request.websafeConferenceKey conf = ndb.Key(urlsafe=wsck).get() if not conf: raise endpoints.NotFoundException( 'No conference found with key: %s' % wsck) # register if reg: # check if user already registered otherwise add if wsck in prof.conferenceKeysToAttend: raise ConflictException( "You have already registered for this conference") # check if seats avail if conf.seatsAvailable <= 0: raise ConflictException("There are no seats available.") # register user, take away one seat prof.conferenceKeysToAttend.append(wsck) conf.seatsAvailable -= 1 retval = True # unregister else: # check if user already registered if wsck in prof.conferenceKeysToAttend: # unregister user, add back one seat prof.conferenceKeysToAttend.remove(wsck) conf.seatsAvailable += 1 retval = True else: retval = False # write things back to the datastore & return prof.put() conf.put() return BooleanMessage(data=retval) @endpoints.method(CONF_GET_REQUEST, BooleanMessage, path='conference/{websafeConferenceKey}', http_method='POST', name='registerForConference') def registerForConference(self, request): """Register user for selected conference.""" return self._conferenceRegistration(request) @endpoints.method(CONF_GET_REQUEST, BooleanMessage, path='conference/{websafeConferenceKey}', http_method='DELETE', name='unregisterFromConference') def unregisterFromConference(self, request): """Unregister user for selected conference.""" return self._conferenceRegistration(request, reg=False) # - - - Session - - - - - - - - - - - - - - - - - - - def _copySessionToForm(self, sess): """Copy relevant fields from Session to SessionForm.""" sf = SessionForm() for field in sf.all_fields(): if hasattr(sess, field.name): if field.name == 'date': sf.date = str(sess.date) elif field.name == 'timeStart': sf.timeStart = str(sess.timeStart) elif field.name == 'timeEnd': sf.timeEnd = str(sess.timeEnd) elif field.name == 'duration': sf.timeEnd = str(sess.timeEnd) elif field.name == 'typeOfSession': try: setattr( sf, field.name, getattr(SessionType, getattr(sess, field.name))) except AttributeError: setattr(sf, field.name, getattr(SessionType, 'NOT_SPECIFIED')) else: setattr(sf, field.name, getattr(sess, field.name)) sf.websafeKey = sess.key.urlsafe() sf.check_initialized() return sf def _createSessionObject(self, request): """Create or update Session object, returning SessionForm/request.""" user = endpoints.get_current_user() if not user: raise endpoints.UnauthorizedException('Authorization required') # get user ID (email) user_id = getUserId(user) if not request.name: raise endpoints.BadRequestException( "Session 'name' field required") #get session key conf = ndb.Key(urlsafe=request.websafeConferenceKey).get() #get conference organizer ID (email) and compare with current user ID conf_organizer_id = conf.key.parent().id() if user_id != conf_organizer_id: raise endpoints.BadRequestException( "Only the Conference Organizer able to create Session") if not conf: raise endpoints.NotFoundException( 'No conference found with key: %s' % request.websafeConferenceKey) new_id = Session.allocate_ids(size=1, parent=conf.key)[0] s_key = ndb.Key(Session, new_id, parent=conf.key) #get data data = { field.name: getattr(request, field.name) for field in request.all_fields() if field.name != "websafeConferenceKey" } del data['websafeKey'] # add default values for those missing (both data model & outbound Message) for df in SESSION_DEFAULTS: if data[df] in (None, []): data[df] = SESSION_DEFAULTS[df] setattr(request, df, SESSION_DEFAULTS[df]) if data['date']: data['date'] = datetime.strptime(data['date'][:10], "%Y-%m-%d").date() if data['timeStart']: data['timeStart'] = int(data['timeStart']) if data['timeEnd']: data['timeEnd'] = int(data['timeEnd']) if data['duration']: data['duration'] = int(data['duration']) data['typeOfSession'] = str(data['typeOfSession']) data['key'] = s_key # store Session data & return (modified) SessionForm Session(**data).put() # set memcache for featured speaker and session if data['speaker'] and data['speaker'] != "Unknown": taskqueue.add(params={ 'websafeConferenceKey': request.websafeConferenceKey, 'speaker': data['speaker'] }, url='/tasks/set_featured_speaker') return self._copySessionToForm(s_key.get()) @endpoints.method(SESS_POST_REQUEST, SessionForm, path='/conference/{websafeConferenceKey}/createsession', http_method='POST', name='createSession') def createSession(self, request): """Create new Session.""" return self._createSessionObject(request) @endpoints.method(SESS_GET_REQUEST, SessionForms, path='/conference/{websafeConferenceKey}/session', http_method='GET', name='getConferenceSessions') def getConferenceSessions(self, request): """Given a conference, return all sessions""" # #get conference key conference_key = ndb.Key(urlsafe=request.websafeConferenceKey) if not conference_key: raise endpoints.NotFoundException( 'No conference found with key: %s' % request.websafeConferenceKey) sessions_all = Session.query(ancestor=conference_key) return SessionForms( items=[self._copySessionToForm(sess) for sess in sessions_all]) @endpoints.method( SESS_GET_TYPE, SessionForms, path='/conference/{websafeConferenceKey}/session/type/{typeOfSession}', http_method='GET', name='getConferenceSessionsByType') def getConferenceSessionsByType(self, request): """Given a conference, return all sessions of a specified type (eg lecture, keynote, workshop) """ #get conference key conference_key = ndb.Key(urlsafe=request.websafeConferenceKey) if not conference_key: raise endpoints.NotFoundException( 'No conference found with key: %s' % request.websafeConferenceKey) sessions_all = Session.query(ancestor=conference_key) sessions_ByType = sessions_all.filter( Session.typeOfSession == request.typeOfSession.name) return SessionForms( items=[self._copySessionToForm(sess) for sess in sessions_ByType]) @endpoints.method( SESS_GET_SPEAKER, SessionForms, path='/conference/{websafeConferenceKey}/session/speaker/{speaker}', http_method='GET', name='getConferenceSessionsBySpeaker') def getSessionsBySpeaker(self, request): """Given a conference, return all sessions for by Speaker""" #get conference key conference_key = ndb.Key(urlsafe=request.websafeConferenceKey) if not conference_key: raise endpoints.NotFoundException( 'No conference found with key: %s' % request.websafeConferenceKey) sessions_all = Session.query(ancestor=conference_key) sessions_BySpeaker = sessions_all.filter( Session.speaker == request.speaker) return SessionForms(items=[ self._copySessionToForm(sess) for sess in sessions_BySpeaker ]) @endpoints.method( SESS_GET_DATE, SessionForms, path='/conference/{websafeConferenceKey}/session/date/{date}', http_method='GET', name='getConferenceSessionsByDate') def getConferenceSessionsByDate(self, request): """Given a conference, return all sessions on specific date""" #get conference key conference_key = ndb.Key(urlsafe=request.websafeConferenceKey) if not conference_key: raise endpoints.NotFoundException( 'No conference found with key: %s' % request.websafeConferenceKey) # transform {date} into date format date = datetime.strptime(request.date, '%Y-%m-%d').date() print("date: ", date) # get sessions on this date sessions_all = Session.query(ancestor=conference_key) sessions_ByDate = sessions_all.filter(Session.date == date) return SessionForms( items=[self._copySessionToForm(sess) for sess in sessions_ByDate]) @endpoints.method( SESS_GET_TIME, SessionForms, path= '/conference/{websafeConferenceKey}/session/time/{timeStart}/{timeEnd}', http_method='GET', name='getConferenceSessionsByTime') def getConferenceSessionsByTime(self, request): """Return all sessions starting between timeStart and timeEnd""" # #get conference key conference_key = ndb.Key(urlsafe=request.websafeConferenceKey) if not conference_key: raise endpoints.NotFoundException( 'No conference found with key: %s' % request.websafeConferenceKey) # get sessions for conference in a time range sessions_all = Session.query(ancestor=conference_key) sessions_ByTime = sessions_all.filter( ndb.AND(Session.timeStart >= request.timeStart, Session.timeStart <= request.timeEnd)) return SessionForms( items=[self._copySessionToForm(sess) for sess in sessions_ByTime]) # - - - User Wishlist - - - - - - - - - - - - - - - - - - - @endpoints.method(SESS_TO_WISHLIST_GET_REQUEST, BooleanMessage, path='session/{sessionKey}', http_method='POST', name='addSessionToWishlist') def addSessionToWishlist(self, request): """Add a Session To Wishlist.""" return self._manageSessionInWishlist(request) @endpoints.method(SESS_TO_WISHLIST_GET_REQUEST, BooleanMessage, path='session/{sessionKey}', http_method='DELETE', name='removeSessionFromWishlist') def removeSessionFromWishlist(self, request): """Remove session from wishlist.""" return self._manageSessionInWishlist(request, add=False) @ndb.transactional(xg=True) def _manageSessionInWishlist(self, request, add=True): """Create or update Session object, returning SessionForm/request.""" # preload necessary data items user = endpoints.get_current_user() if not user: raise endpoints.UnauthorizedException('Authorization required') prof = self._getProfileFromUser() session_key = request.sessionKey session = ndb.Key(urlsafe=session_key).get() if not session: raise endpoints.NotFoundException('No session found with key: %s' % session) # add to wishlist if add: # check if session is already registered otherwise add if session_key in prof.sessionKeysInWishlist: raise ConflictException( "You have already added this session to your wishlist") if prof.sessionKeysInWishlist is None: prof.sessionKeysInWishlist[0] = session_key else: prof.sessionKeysInWishlist.append(session_key) retval = True # remove else: # check if session already in wishlist and remove if session_key in prof.sessionKeysInWishlist: prof.sessionKeysInWishlist.remove(session_key) retval = True else: retval = False # write things back to the datastore & return prof.put() return BooleanMessage(data=retval) @endpoints.method(SESS_IN_WISHLIST_GET_REQUEST, SessionForms, path='session/wishlist', http_method='GET', name='getSessionsInWishlist') def getSessionsInWishlist(self, request): """Get list of Sessions that user wish to attend 1)return a wishlist of sessions for a specific conference if with key = {websafeConferenceKey} 2) return a wishlist of all sessions over all conferences use added to a whishlist if {websafeConferenceKey} is None """ # get user Profile user = endpoints.get_current_user() if not user: raise endpoints.UnauthorizedException('Authorization required') prof = self._getProfileFromUser() # show all sessions for all conferences to attend session_wishlist_keys = [ ndb.Key(urlsafe=session_key) for session_key in prof.sessionKeysInWishlist ] sessions_wishlist = ndb.get_multi(session_wishlist_keys) # if user wants to see selected session for a specific conference # use {websafeConferenceKey} to select them if request.websafeConferenceKey is not None: output = [] conference_key = ndb.Key(urlsafe=request.websafeConferenceKey) for item in session_wishlist_keys: if item.parent() == conference_key: print("item.parent: ", item.parent()) output.append(item) sessions_wishlist = ndb.get_multi(output) return SessionForms(items=[ self._copySessionToForm(sess) for sess in sessions_wishlist ]) # return set of SessionForm objects return SessionForms(items=[ self._copySessionToForm(sess) for sess in sessions_wishlist ]) # - - - Featured Speaker - - - - - - - - - - - - - - - - - - - @staticmethod def setFeaturedSpeaker(websafeConferenceKey, speaker): """ Check a speaker in a memcache for featured speaker and set him to the memcache if he is a speaker for at least 2 sessions """ conf_key = ndb.Key(urlsafe=websafeConferenceKey) sessions = Session.query(Session.speaker == speaker, ancestor=conf_key) if sessions.count() > 1: featuredSpeaker_cache = "%s is a featured speaker for %s sessions!" % ( speaker, sessions.count()) memcache.set(websafeConferenceKey, featuredSpeaker_cache) @endpoints.method( SESSION_GET_FEATURED_SPEAKER, StringMessage, path='conference/{websafeConferenceKey}/session/speaker/featured', http_method='GET', name='getFeaturedSpeaker') def getFeaturedSpeaker(self, request): """Return featured speaker of a conference from memcache""" # get conference key MEMCACHE_FEATURED_KEY = request.websafeConferenceKey FeaturedSpeakers = memcache.get(MEMCACHE_FEATURED_KEY) if not FeaturedSpeakers: FeaturedSpeakers = '' # return empty speaker form on failure for no results return StringMessage(data=FeaturedSpeakers) # - - - Session Inaquality Filter - - - - - - - - - - - - - - - - - - - SESS_FILTER_TYPE_TIME = endpoints.ResourceContainer( message_types.VoidMessage, websafeConferenceKey=messages.StringField(1), typeOfSession=messages.EnumField(SessionType, 2), timeStart=messages.IntegerField(3), ) @endpoints.method( SESS_FILTER_TYPE_TIME, SessionForms, path= 'conference/{websafeConferenceKey}/session/{typeOfSession}/time/{timeStart}', http_method='GET', name='filterSessionNotTypeByTime') def filterSessionNotTypeByTime(self, request): """Return filtered Sessions which are != type of Session and != timeStart """ type = str(request.typeOfSession) sessions_noType = Session.query( ndb.OR(Session.typeOfSession < str(type), Session.typeOfSession > str(type))) sessions = [ sess for sess in sessions_noType if sess.timeStart <= request.timeStart ] return SessionForms( items=[self._copySessionToForm(sess) for sess in sessions])
class TaskResult(messages.Message): """Representation of the TaskResultSummary or TaskRunResult ndb model.""" # Time when the task was abandoned instead of normal completion (e.g. # EXPIRED, BOT_DIED, KILLED). # # In the case of KILLED, this records the time the user requested the task to # stop. abandoned_ts = message_types.DateTimeField(1) # The same key cannot be repeated. bot_dimensions = messages.MessageField(StringListPair, 2, repeated=True) # Unique ID of the bot. bot_id = messages.StringField(3) # Hash of the bot code which ran the task. bot_version = messages.StringField(4) # List of task IDs that this task triggered, if any. children_task_ids = messages.StringField(5, repeated=True) # Time the task completed normally. Only one of abandoned_ts or completed_ts # can be set except for state == KILLED. # # In case of KILLED, completed_ts is the time the task completed. completed_ts = message_types.DateTimeField(6) # $ saved for task with state DEDUPED. cost_saved_usd = messages.FloatField(7) # Time the task was requested. created_ts = message_types.DateTimeField(8) # Task ID which results was reused for state DEDUPED. deduped_from = messages.StringField(9) # Duration of the task in seconds. This excludes overheads. duration = messages.FloatField(10) # Process exit code if relevant. May be forcibly set to -1 in exceptional # cases. exit_code = messages.IntegerField(11) # True if exit_code != 0. failure = messages.BooleanField(12) # True if state is BOT_DIED. internal_failure = messages.BooleanField(13) # Time the results was last updated in the DB. modified_ts = message_types.DateTimeField(14) # Isolated outputs, if any. outputs_ref = messages.MessageField(FilesRef, 15) # Server versions that touched this task. server_versions = messages.StringField(17, repeated=True) # Time the task started being run by a bot. started_ts = message_types.DateTimeField(18) # Current state of the task (e.g. PENDING, RUNNING, COMPLETED, EXPIRED, etc). state = messages.EnumField(StateField, 19) # Summary task ID (ending with '0') when creating a new task. task_id = messages.StringField(20) # Can be 0, 1 or 2. It is 0 for a deduped task, since nothing ran. It is # normally 1. It is 2 if the first try had an internal failure. try_number = messages.IntegerField(21) # Can be multiple values only in TaskResultSummary. costs_usd = messages.FloatField(22, repeated=True) # Name of the task. Only set when requesting task ID summary, ending with '0'. name = messages.StringField(23) # Tags associated with the task when it was requested. Only set when # requesting task ID summary, ending with '0'. tags = messages.StringField(24, repeated=True) # User on behalf this task was requested. Only set when requesting task ID # summary, ending with '0'. user = messages.StringField(25) # Statistics about overhead for an isolated task. Only sent when requested. performance_stats = messages.MessageField(PerformanceStats, 26) # Listing of the ACTUAL pinned CipdPackages that the task used. These can vary # from the input packages if the inputs included non-identity versions (e.g. a # ref like "latest"). cipd_pins = messages.MessageField(CipdPins, 27) # Actual executed task id that this task represents. For deduped tasks, it is # the same value as deduped_from. This value can be empty if there is no # execution, for example the task was cancelled. run_id = messages.StringField(28) # Index in the TaskRequest.task_slices (TaskSlice instance) that this result # represents. This is updated when a TaskSlice is enqueued to run. # # The TaskSlice contains a TaskProperties, which defines what is run. current_task_slice = messages.IntegerField(29)
class Field(messages.Message): placeholder = messages.StringField(3) field_type = messages.EnumField(FieldType, 4) name = messages.StringField(5) value = messages.StringField(6)
class StatusMessage(messages.Message): status = messages.EnumField(Status, 1, required=True)
class Condition(_messages.Message): """A condition to be met. Enums: IamValueValuesEnum: Trusted attributes supplied by the IAM system. OpValueValuesEnum: An operator to apply the subject with. SysValueValuesEnum: Trusted attributes supplied by any service that owns resources and uses the IAM system for access control. Fields: iam: Trusted attributes supplied by the IAM system. op: An operator to apply the subject with. svc: Trusted attributes discharged by the service. sys: Trusted attributes supplied by any service that owns resources and uses the IAM system for access control. value: The object of the condition. Exactly one of these must be set. values: The objects of the condition. This is mutually exclusive with 'value'. """ class IamValueValuesEnum(_messages.Enum): """Trusted attributes supplied by the IAM system. Values: ATTRIBUTION: <no description> AUTHORITY: <no description> NO_ATTR: <no description> """ ATTRIBUTION = 0 AUTHORITY = 1 NO_ATTR = 2 class OpValueValuesEnum(_messages.Enum): """An operator to apply the subject with. Values: DISCHARGED: <no description> EQUALS: <no description> IN: <no description> NOT_EQUALS: <no description> NOT_IN: <no description> NO_OP: <no description> """ DISCHARGED = 0 EQUALS = 1 IN = 2 NOT_EQUALS = 3 NOT_IN = 4 NO_OP = 5 class SysValueValuesEnum(_messages.Enum): """Trusted attributes supplied by any service that owns resources and uses the IAM system for access control. Values: IP: <no description> NAME: <no description> NO_ATTR: <no description> REGION: <no description> SERVICE: <no description> """ IP = 0 NAME = 1 NO_ATTR = 2 REGION = 3 SERVICE = 4 iam = _messages.EnumField('IamValueValuesEnum', 1) op = _messages.EnumField('OpValueValuesEnum', 2) svc = _messages.StringField(3) sys = _messages.EnumField('SysValueValuesEnum', 4) value = _messages.StringField(5) values = _messages.StringField(6, repeated=True)
class LogEntryMetadata(_messages.Message): """Additional data that is associated with a log entry, set by the service creating the log entry. Enums: SeverityValueValuesEnum: The severity of the log entry. Messages: LabelsValue: A set of (key, value) data that provides additional information about the log entry. If the log entry is from one of the Google Cloud Platform sources listed below, the indicated (key, value) information must be provided: Google App Engine, service_name `appengine.googleapis.com`: "appengine.googleapis.com/module_id", <module ID> "appengine.googleapis.com/version_id", <version ID> and one of: "appengine.googleapis.com/replica_index", <instance index> "appengine.googleapis.com/clone_id", <instance ID> or else provide the following Compute Engine labels: Google Compute Engine, service_name `compute.googleapis.com`: "compute.googleapis.com/resource_type", "instance" "compute.googleapis.com/resource_id", <instance ID> Fields: labels: A set of (key, value) data that provides additional information about the log entry. If the log entry is from one of the Google Cloud Platform sources listed below, the indicated (key, value) information must be provided: Google App Engine, service_name `appengine.googleapis.com`: "appengine.googleapis.com/module_id", <module ID> "appengine.googleapis.com/version_id", <version ID> and one of: "appengine.googleapis.com/replica_index", <instance index> "appengine.googleapis.com/clone_id", <instance ID> or else provide the following Compute Engine labels: Google Compute Engine, service_name `compute.googleapis.com`: "compute.googleapis.com/resource_type", "instance" "compute.googleapis.com/resource_id", <instance ID> projectId: The project ID of the Google Cloud Platform service that created the log entry. projectNumber: This field is populated by the API at ingestion time. region: The region name of the Google Cloud Platform service that created the log entry. For example, `"us-central1"`. serviceName: The API name of the Google Cloud Platform service that created the log entry. For example, `"compute.googleapis.com"`. severity: The severity of the log entry. timeNanos: Use timestamp instead of this field. timestamp: The time the event described by the log entry occurred. Timestamps must be later than January 1, 1970. userId: The fully-qualified email address of the authenticated user that performed or requested the action represented by the log entry. If the log entry does not apply to an action taken by an authenticated user, then the field should be empty. zone: The zone of the Google Cloud Platform service that created the log entry. For example, `"us-central1-a"`. """ class SeverityValueValuesEnum(_messages.Enum): """The severity of the log entry. Values: DEFAULT: The log entry has no assigned severity level. DEBUG: Debug or trace information. INFO: Routine information, such as ongoing status or performance. NOTICE: Normal but significant events, such as start up, shut down, or configuration. WARNING: Warning events might cause problems. ERROR: Error events are likely to cause problems. CRITICAL: Critical events cause more severe problems or brief outages. ALERT: A person must take an action immediately. EMERGENCY: One or more systems are unusable. """ DEFAULT = 0 DEBUG = 1 INFO = 2 NOTICE = 3 WARNING = 4 ERROR = 5 CRITICAL = 6 ALERT = 7 EMERGENCY = 8 @encoding.MapUnrecognizedFields('additionalProperties') class LabelsValue(_messages.Message): """A set of (key, value) data that provides additional information about the log entry. If the log entry is from one of the Google Cloud Platform sources listed below, the indicated (key, value) information must be provided: Google App Engine, service_name `appengine.googleapis.com`: "appengine.googleapis.com/module_id", <module ID> "appengine.googleapis.com/version_id", <version ID> and one of: "appengine.googleapis.com/replica_index", <instance index> "appengine.googleapis.com/clone_id", <instance ID> or else provide the following Compute Engine labels: Google Compute Engine, service_name `compute.googleapis.com`: "compute.googleapis.com/resource_type", "instance" "compute.googleapis.com/resource_id", <instance ID> Messages: AdditionalProperty: An additional property for a LabelsValue object. Fields: additionalProperties: Additional properties of type LabelsValue """ class AdditionalProperty(_messages.Message): """An additional property for a LabelsValue object. Fields: key: Name of the additional property. value: A string attribute. """ key = _messages.StringField(1) value = _messages.StringField(2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) labels = _messages.MessageField('LabelsValue', 1) projectId = _messages.StringField(2) projectNumber = _messages.IntegerField(3) region = _messages.StringField(4) serviceName = _messages.StringField(5) severity = _messages.EnumField('SeverityValueValuesEnum', 6) timeNanos = _messages.IntegerField(7) timestamp = _messages.StringField(8) userId = _messages.StringField(9) zone = _messages.StringField(10)
class Project(messages.Message): """This protocol buffer holds all the metadata associated with a project.""" state = messages.EnumField(ProjectState, 1, required=True) access = messages.EnumField(ProjectAccess, 18, default=ProjectAccess.ANYONE) # The short identifier for this project. This value is lower-cased, # and must be between 3 and 20 characters (inclusive). Alphanumeric # and dashes are allowed, and it must start with an alpha character. # Project names must be unique. project_name = messages.StringField(2, required=True) # A numeric identifier for this project. project_id = messages.IntegerField(3, required=True) # A one-line summary (human-readable) name of the project. summary = messages.StringField(4, default='') # A detailed description of the project. description = messages.StringField(5, default='') # Description of why this project has the state set as it is. # This is used for administrative purposes to notify Owners that we # are going to delete their project unless they can provide a good # reason to not do so. state_reason = messages.StringField(9) # Time (in seconds) at which an ARCHIVED project may automatically # be changed to state DELETABLE. The state change is done by a # cron job. delete_time = messages.IntegerField(10) # Note that these lists are disjoint (a user ID will not appear twice). owner_ids = messages.IntegerField(11, repeated=True) committer_ids = messages.IntegerField(12, repeated=True) contributor_ids = messages.IntegerField(15, repeated=True) class ExtraPerms(messages.Message): """Nested message for each member's extra permissions in a project.""" member_id = messages.IntegerField(1, required=True) # Each custom perm is a single word [a-zA-Z0-9]. perms = messages.StringField(2, repeated=True) extra_perms = messages.MessageField(ExtraPerms, 16, repeated=True) extra_perms_are_sorted = messages.BooleanField(17, default=False) # Project owners may choose to have ALL issue change notifications go to a # mailing list (in addition to going directly to the users interested # in that issue). issue_notify_address = messages.StringField(14) # These fields keep track of the cumulative size of all issue attachments # in a given project. Normally, the number of bytes used is compared # to a constant defined in the web application. However, if a custom # quota is specified here, it will be used instead. An issue attachment # will fail if its size would put the project over its quota. Not all # projects have these fields: they are only set when the first attachment # is uploaded. attachment_bytes_used = messages.IntegerField(38, default=0) # If quota is not set, default from tracker_constants.py is used. attachment_quota = messages.IntegerField(39) # NOTE: open slots 40, 41 # Recent_activity is a timestamp (in seconds since the Epoch) of the # last time that an issue was entered, updated, or commented on. recent_activity = messages.IntegerField(42, default=0) # NOTE: open slots 43... # Timestamp (in seconds since the Epoch) of the most recent change # to this project that would invalidate cached content. It is set # whenever project membership is edited, or any component config PB # is edited. HTTP requests for auto-complete feeds include this # value in the URL. cached_content_timestamp = messages.IntegerField(53, default=0) # If set, this project has been moved elsewhere. This can # be an absolute URL, the name of another project on the same site. moved_to = messages.StringField(60) # Enable inbound email processing for issues. process_inbound_email = messages.BooleanField(63, default=False) # Limit removal of Restrict-* labels to project owners. only_owners_remove_restrictions = messages.BooleanField(64, default=False) # A per-project read-only lock. This lock (1) is meant to be # long-lived (lasting as long as migration operations, project # deletion, or anything else might take and (2) is meant to only # limit user mutations; whether or not it limits automated actions # that would change project data (such as workflow items) is # determined based on the action. # # This lock is implemented as a user-visible string describing the # reason for the project being in a read-only state. An absent or empty # value indicates that the project is read-write; a present and # non-empty value indicates that the project is read-only for the # reason described. read_only_reason = messages.StringField(65) # This option is rarely used, but it makes sense for projects that aim for # hub-and-spoke collaboration bewtween a vendor organization (like Google) # and representatives of partner companies who are not supposed to know # about each other. # When true, it prevents project committers, contributors, and visitors # from seeing the list of project members on the project summary page, # on the People list page, and in autocomplete for issue owner and Cc. # Project owners can always see the complete list of project members. only_owners_see_contributors = messages.BooleanField(66, default=False) # This configures the URLs generated when autolinking revision numbers. # E.g., gitiles, viewvc, or crrev.com. revision_url_format = messages.StringField(67) # The home page of the Project. home_page = messages.StringField(68) # The url to redirect to for wiki/documentation links. docs_url = messages.StringField(71) # The url to redirect to for wiki/documentation links. source_url = messages.StringField(72) # The GCS object ID of the Project's logo. logo_gcs_id = messages.StringField(69) # The uploaded file name of the Project's logo. logo_file_name = messages.StringField(70)
class SensorDataResponse(messages.Message): datatype = messages.EnumField(dataTypes, 1, required=True) allSessions = messages.MessageField(RawSensorData, 2, repeated=True) message = messages.StringField(3)
class sessionDataSubmit(messages.Message): uniqueId = messages.StringField(1, required=True) datatype = messages.EnumField(dataTypes, 3, required=True) rawData = messages.MessageField(sessionDataRaw, 4, repeated=True) aggData = messages.MessageField(sessionDataAgg, 5)
class Child(messages.Message): """A child message to test recursion with.""" enum = messages.EnumField(Enum, 1, default=Enum.UNKNOWN)
class DetachTagsResponse(messages.Message): """Results of detachTags call.""" status = messages.EnumField(Status, 1, required=True) error_message = messages.StringField(2, required=False)
class Operation(_messages.Message): """An Operation resource, used to manage asynchronous API requests. Enums: StatusValueValuesEnum: [Output Only] Status of the operation. Can be one of the following: PENDING, RUNNING, or DONE. Messages: ErrorValue: [Output Only] If errors are generated during processing of the operation, this field will be populated. WarningsValueListEntry: A WarningsValueListEntry object. Fields: clientOperationId: [Output Only] An optional identifier specified by the client when the mutation was initiated. Must be unique for all Operation resources in the project. creationTimestamp: [Output Only] Creation timestamp in RFC3339 text format. endTime: [Output Only] The time that this operation was completed. This is in RFC3339 text format. error: [Output Only] If errors are generated during processing of the operation, this field will be populated. httpErrorMessage: [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. httpErrorStatusCode: [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as 404. id: [Output Only] Unique identifier for the resource; defined by the server. insertTime: [Output Only] The time that this operation was requested. This is in RFC3339 text format. kind: [Output Only] Type of the resource. Always compute#operation for Operation resources. name: [Output Only] Name of the resource. operationType: [Output Only] Type of the operation, such as insert, compute.instanceGroups.update, or compute.instanceGroups.delete. progress: [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess at when the operation will be complete. This number should monotonically increase as the operation progresses. region: [Output Only] URL of the region where the operation resides. Only applicable for regional resources. selfLink: [Output Only] Server-defined URL for the resource. startTime: [Output Only] The time that this operation was started by the server. This is in RFC3339 text format. status: [Output Only] Status of the operation. Can be one of the following: PENDING, RUNNING, or DONE. statusMessage: [Output Only] An optional textual description of the current status of the operation. targetId: [Output Only] Unique target ID which identifies a particular incarnation of the target. targetLink: [Output Only] URL of the resource the operation is mutating. user: [Output Only] User who requested the operation, for example: [email protected]. warnings: [Output Only] If warning messages are generated during processing of the operation, this field will be populated. zone: [Output Only] URL of the zone where the operation resides. """ class StatusValueValuesEnum(_messages.Enum): """[Output Only] Status of the operation. Can be one of the following: PENDING, RUNNING, or DONE. Values: DONE: <no description> PENDING: <no description> RUNNING: <no description> """ DONE = 0 PENDING = 1 RUNNING = 2 class ErrorValue(_messages.Message): """[Output Only] If errors are generated during processing of the operation, this field will be populated. Messages: ErrorsValueListEntry: A ErrorsValueListEntry object. Fields: errors: [Output Only] The array of errors encountered while processing this operation. """ class ErrorsValueListEntry(_messages.Message): """A ErrorsValueListEntry object. Fields: code: [Output Only] The error type identifier for this error. location: [Output Only] Indicates the field in the request which caused the error. This property is optional. message: [Output Only] An optional, human-readable error message. """ code = _messages.StringField(1) location = _messages.StringField(2) message = _messages.StringField(3) errors = _messages.MessageField('ErrorsValueListEntry', 1, repeated=True) class WarningsValueListEntry(_messages.Message): """A WarningsValueListEntry object. Enums: CodeValueValuesEnum: [Output Only] The warning type identifier for this warning. Messages: DataValueListEntry: A DataValueListEntry object. Fields: code: [Output Only] The warning type identifier for this warning. data: [Output Only] Metadata for this warning in key: value format. message: [Output Only] Optional human-readable details for this warning. """ class CodeValueValuesEnum(_messages.Enum): """[Output Only] The warning type identifier for this warning. Values: DEPRECATED_RESOURCE_USED: <no description> DISK_SIZE_LARGER_THAN_IMAGE_SIZE: <no description> INJECTED_KERNELS_DEPRECATED: <no description> NEXT_HOP_ADDRESS_NOT_ASSIGNED: <no description> NEXT_HOP_CANNOT_IP_FORWARD: <no description> NEXT_HOP_INSTANCE_NOT_FOUND: <no description> NEXT_HOP_INSTANCE_NOT_ON_NETWORK: <no description> NEXT_HOP_NOT_RUNNING: <no description> NOT_CRITICAL_ERROR: <no description> NO_RESULTS_ON_PAGE: <no description> REQUIRED_TOS_AGREEMENT: <no description> RESOURCE_NOT_DELETED: <no description> SINGLE_INSTANCE_PROPERTY_TEMPLATE: <no description> UNREACHABLE: <no description> """ DEPRECATED_RESOURCE_USED = 0 DISK_SIZE_LARGER_THAN_IMAGE_SIZE = 1 INJECTED_KERNELS_DEPRECATED = 2 NEXT_HOP_ADDRESS_NOT_ASSIGNED = 3 NEXT_HOP_CANNOT_IP_FORWARD = 4 NEXT_HOP_INSTANCE_NOT_FOUND = 5 NEXT_HOP_INSTANCE_NOT_ON_NETWORK = 6 NEXT_HOP_NOT_RUNNING = 7 NOT_CRITICAL_ERROR = 8 NO_RESULTS_ON_PAGE = 9 REQUIRED_TOS_AGREEMENT = 10 RESOURCE_NOT_DELETED = 11 SINGLE_INSTANCE_PROPERTY_TEMPLATE = 12 UNREACHABLE = 13 class DataValueListEntry(_messages.Message): """A DataValueListEntry object. Fields: key: [Output Only] A key for the warning data. value: [Output Only] A warning data value corresponding to the key. """ key = _messages.StringField(1) value = _messages.StringField(2) code = _messages.EnumField('CodeValueValuesEnum', 1) data = _messages.MessageField('DataValueListEntry', 2, repeated=True) message = _messages.StringField(3) clientOperationId = _messages.StringField(1) creationTimestamp = _messages.StringField(2) endTime = _messages.StringField(3) error = _messages.MessageField('ErrorValue', 4) httpErrorMessage = _messages.StringField(5) httpErrorStatusCode = _messages.IntegerField( 6, variant=_messages.Variant.INT32) id = _messages.IntegerField(7, variant=_messages.Variant.UINT64) insertTime = _messages.StringField(8) kind = _messages.StringField(9, default=u'clouduseraccounts#operation') name = _messages.StringField(10) operationType = _messages.StringField(11) progress = _messages.IntegerField(12, variant=_messages.Variant.INT32) region = _messages.StringField(13) selfLink = _messages.StringField(14) startTime = _messages.StringField(15) status = _messages.EnumField('StatusValueValuesEnum', 16) statusMessage = _messages.StringField(17) targetId = _messages.IntegerField(18, variant=_messages.Variant.UINT64) targetLink = _messages.StringField(19) user = _messages.StringField(20) warnings = _messages.MessageField('WarningsValueListEntry', 21, repeated=True) zone = _messages.StringField(22)
class ModifyACLResponse(messages.Message): """Results of modifyACL call.""" status = messages.EnumField(Status, 1, required=True) error_message = messages.StringField(2, required=False)
class WarningsValueListEntry(_messages.Message): """A WarningsValueListEntry object. Enums: CodeValueValuesEnum: [Output Only] The warning type identifier for this warning. Messages: DataValueListEntry: A DataValueListEntry object. Fields: code: [Output Only] The warning type identifier for this warning. data: [Output Only] Metadata for this warning in key: value format. message: [Output Only] Optional human-readable details for this warning. """ class CodeValueValuesEnum(_messages.Enum): """[Output Only] The warning type identifier for this warning. Values: DEPRECATED_RESOURCE_USED: <no description> DISK_SIZE_LARGER_THAN_IMAGE_SIZE: <no description> INJECTED_KERNELS_DEPRECATED: <no description> NEXT_HOP_ADDRESS_NOT_ASSIGNED: <no description> NEXT_HOP_CANNOT_IP_FORWARD: <no description> NEXT_HOP_INSTANCE_NOT_FOUND: <no description> NEXT_HOP_INSTANCE_NOT_ON_NETWORK: <no description> NEXT_HOP_NOT_RUNNING: <no description> NOT_CRITICAL_ERROR: <no description> NO_RESULTS_ON_PAGE: <no description> REQUIRED_TOS_AGREEMENT: <no description> RESOURCE_NOT_DELETED: <no description> SINGLE_INSTANCE_PROPERTY_TEMPLATE: <no description> UNREACHABLE: <no description> """ DEPRECATED_RESOURCE_USED = 0 DISK_SIZE_LARGER_THAN_IMAGE_SIZE = 1 INJECTED_KERNELS_DEPRECATED = 2 NEXT_HOP_ADDRESS_NOT_ASSIGNED = 3 NEXT_HOP_CANNOT_IP_FORWARD = 4 NEXT_HOP_INSTANCE_NOT_FOUND = 5 NEXT_HOP_INSTANCE_NOT_ON_NETWORK = 6 NEXT_HOP_NOT_RUNNING = 7 NOT_CRITICAL_ERROR = 8 NO_RESULTS_ON_PAGE = 9 REQUIRED_TOS_AGREEMENT = 10 RESOURCE_NOT_DELETED = 11 SINGLE_INSTANCE_PROPERTY_TEMPLATE = 12 UNREACHABLE = 13 class DataValueListEntry(_messages.Message): """A DataValueListEntry object. Fields: key: [Output Only] A key for the warning data. value: [Output Only] A warning data value corresponding to the key. """ key = _messages.StringField(1) value = _messages.StringField(2) code = _messages.EnumField('CodeValueValuesEnum', 1) data = _messages.MessageField('DataValueListEntry', 2, repeated=True) message = _messages.StringField(3)
class Greeting(messages.Message): text = messages.StringField(1, required=True) when = messages.IntegerField(2) color = messages.EnumField(Color, 3)
message_types.VoidMessage, websafeConferenceKey=messages.StringField(1), ) CONF_POST_REQUEST = endpoints.ResourceContainer( ConferenceForm, websafeConferenceKey=messages.StringField(1), ) SESS_GET_REQUEST = endpoints.ResourceContainer( message_types.VoidMessage, websafeConferenceKey=messages.StringField(1), ) SESS_TYPE_GET_REQUEST = endpoints.ResourceContainer( typeOfSession=messages.EnumField(TypeOfSession, 1), websafeConferenceKey=messages.StringField(2), ) SESS_POST_REQUEST = endpoints.ResourceContainer( SessionForm, websafeConferenceKey=messages.StringField(1), ) SESS_WISHL_POST_REQUEST = endpoints.ResourceContainer( message_types.VoidMessage, websafeSessionKey=messages.StringField(1), ) # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
class ProfileMiniForm(messages.Message): """ProfileMiniForm - update Profile form message""" display_name = messages.StringField(1) tee_shirt_size = messages.EnumField('TeeShirtSizesEnum', 2)
class GlobalConfigMessage(messages.Message): """GlobalConfig as a RPC message.""" services_config_storage_type = messages.EnumField(ServiceConfigStorageType, 1) services_config_location = messages.StringField(2)
) CONF_POST_REQUEST = endpoints.ResourceContainer( ConferenceForm, websafeConferenceKey=messages.StringField(1), ) SESS_GET_REQUEST = endpoints.ResourceContainer( message_types.VoidMessage, websafeConferenceKey=messages.StringField(1), ) SESS_GET_TYPE = endpoints.ResourceContainer( message_types.VoidMessage, websafeConferenceKey=messages.StringField(1), typeOfSession=messages.EnumField(SessionType, 2)) SESS_GET_SPEAKER = endpoints.ResourceContainer( message_types.VoidMessage, websafeConferenceKey=messages.StringField(1), speaker=messages.StringField(2), ) SESS_POST_REQUEST = endpoints.ResourceContainer( SessionForm, websafeConferenceKey=messages.StringField(1), ) SESS_TO_WISHLIST_GET_REQUEST = endpoints.ResourceContainer( message_types.VoidMessage, sessionKey=messages.StringField(1),
class SessionTypeQueryForm(messages.Message): """SessionQueryForm -- Session query inbound form message""" websafeConfKey = messages.StringField(1) typeOfSession = messages.EnumField('SessionType', 2)
class ProfileForm(messages.Message): """ProfileForm -- Profile outbound form message""" displayName = messages.StringField(1) mainEmail = messages.StringField(2) teeShirtSize = messages.EnumField('TeeShirtSize', 3)
class UpdateCommentRequest(messages.Message): comment_id = messages.StringField(1, required=False) action_type = messages.EnumField(entity_proto.ActionType, 2, required=False) username = messages.StringField(3, required=False)
class StandardQueryParameters(_messages.Message): """Query parameters accepted by all methods. Enums: FXgafvValueValuesEnum: V1 error format. AltValueValuesEnum: Data format for response. Fields: f__xgafv: V1 error format. access_token: OAuth access token. alt: Data format for response. bearer_token: OAuth bearer token. callback: JSONP fields: Selector specifying which fields to include in a partial response. key: API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. oauth_token: OAuth 2.0 token for the current user. pp: Pretty-print response. prettyPrint: Returns response with indentations and line breaks. quotaUser: Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. trace: A tracing token of the form "token:<tokenid>" or "email:<ldap>" to include in api requests. uploadType: Legacy upload protocol for media (e.g. "media", "multipart"). upload_protocol: Upload protocol for media (e.g. "raw", "multipart"). """ class AltValueValuesEnum(_messages.Enum): """Data format for response. Values: json: Responses with Content-Type of application/json media: Media download with context-dependent Content-Type proto: Responses with Content-Type of application/x-protobuf """ json = 0 media = 1 proto = 2 class FXgafvValueValuesEnum(_messages.Enum): """V1 error format. Values: _1: v1 error format _2: v2 error format """ _1 = 0 _2 = 1 f__xgafv = _messages.EnumField('FXgafvValueValuesEnum', 1) access_token = _messages.StringField(2) alt = _messages.EnumField('AltValueValuesEnum', 3, default=u'json') bearer_token = _messages.StringField(4) callback = _messages.StringField(5) fields = _messages.StringField(6) key = _messages.StringField(7) oauth_token = _messages.StringField(8) pp = _messages.BooleanField(9, default=True) prettyPrint = _messages.BooleanField(10, default=True) quotaUser = _messages.StringField(11) trace = _messages.StringField(12) uploadType = _messages.StringField(13) upload_protocol = _messages.StringField(14)
class Condition(_messages.Message): """A condition to be met. Enums: IamValueValuesEnum: Trusted attributes supplied by the IAM system. OpValueValuesEnum: An operator to apply the subject with. SysValueValuesEnum: Trusted attributes supplied by any service that owns resources and uses the IAM system for access control. Fields: iam: Trusted attributes supplied by the IAM system. op: An operator to apply the subject with. svc: Trusted attributes discharged by the service. sys: Trusted attributes supplied by any service that owns resources and uses the IAM system for access control. value: The object of the condition. Exactly one of these must be set. values: The objects of the condition. This is mutually exclusive with 'value'. """ class IamValueValuesEnum(_messages.Enum): """Trusted attributes supplied by the IAM system. Values: NO_ATTR: Default non-attribute. AUTHORITY: Either principal or (if present) authority ATTRIBUTION: selector Always the original principal, but making clear """ NO_ATTR = 0 AUTHORITY = 1 ATTRIBUTION = 2 class OpValueValuesEnum(_messages.Enum): """An operator to apply the subject with. Values: NO_OP: Default no-op. EQUALS: Equality check. NOT_EQUALS: Non-equality check. IN: Set-inclusion check. NOT_IN: Set-exclusion check. DISCHARGED: Subject is discharged """ NO_OP = 0 EQUALS = 1 NOT_EQUALS = 2 IN = 3 NOT_IN = 4 DISCHARGED = 5 class SysValueValuesEnum(_messages.Enum): """Trusted attributes supplied by any service that owns resources and uses the IAM system for access control. Values: NO_ATTR: Default non-attribute type REGION: Region of the resource SERVICE: Service name NAME: Resource name IP: IP address of the caller """ NO_ATTR = 0 REGION = 1 SERVICE = 2 NAME = 3 IP = 4 iam = _messages.EnumField('IamValueValuesEnum', 1) op = _messages.EnumField('OpValueValuesEnum', 2) svc = _messages.StringField(3) sys = _messages.EnumField('SysValueValuesEnum', 4) value = _messages.StringField(5) values = _messages.StringField(6, repeated=True)
class ProfileMiniForm(messages.Message): """Form message for update on Profile""" displayName = messages.StringField(1) teeShirtSize = messages.EnumField('TeeShirtSize', 2)
class EventLogEntry(messages.Message): """An event log entry.""" create_time = message_types.DateTimeField(1, required=True) level = messages.EnumField(ndb_models.EventLogLevel, 2, required=True) message = messages.StringField(3, required=True)