class PagespeedEntry(validation.Validated): """Describes the format of a pagespeed configuration from a yaml file. URL blacklist entries are patterns (with '?' and '*' as wildcards). Any URLs that match a pattern on the blacklist will not be optimized by PageSpeed. Rewriter names are strings (like 'CombineCss' or 'RemoveComments') describing individual PageSpeed rewriters. A full list of valid rewriter names can be found in the PageSpeed documentation. The domains-to-rewrite list is a whitelist of domain name patterns with '*' as a wildcard, optionally starting with 'http://' or 'https://'. If no protocol is given, 'http://' is assumed. A resource will only be rewritten if it is on the same domain as the HTML that references it, or if its domain is on the domains-to-rewrite list. """ ATTRIBUTES = { URL_BLACKLIST: validation.Optional( validation.Repeated(validation.Regex(_URL_BLACKLIST_REGEX))), ENABLED_REWRITERS: validation.Optional( validation.Repeated(validation.Regex(_REWRITER_NAME_REGEX))), DISABLED_REWRITERS: validation.Optional( validation.Repeated(validation.Regex(_REWRITER_NAME_REGEX))), DOMAINS_TO_REWRITE: validation.Optional( validation.Repeated(validation.Regex(_DOMAINS_TO_REWRITE_REGEX))), }
class Index(validation.Validated): """Individual index definition. Order of the properties determines a given index's sort priority. Attributes: kind: Datastore kind that index belongs to. ancestors: Include ancestors in index. properties: Properties to be included. """ ATTRIBUTES = { 'kind': validation.Type(str, convert=False), 'ancestor': validation.Type(bool, convert=False, default=False), 'properties': validation.Optional(validation.Repeated(Property)), } def CheckInitialized(self): self._Normalize() super(Index, self).CheckInitialized() def _Normalize(self): if self.properties is None: return is_geo = any(x.mode == 'geospatial' for x in self.properties) for prop in self.properties: if is_geo: if prop.direction is not None: raise validation.ValidationError( 'direction not supported in a geospatial index') else: # Normalize the property object by making direction explicit if prop.IsAscending(): prop.direction = 'asc'
class DosInfoExternal(validation.Validated): """Describes the format of a dos.yaml file.""" ATTRIBUTES = { appinfo.APPLICATION: validation.Optional(appinfo.APPLICATION_RE_STRING), BLACKLIST: validation.Optional(validation.Repeated(BlacklistEntry)), }
class CronInfoExternal(validation.Validated): """CronInfoExternal describes all cron entries for an application.""" ATTRIBUTES = { appinfo.APPLICATION: validation.Optional(appinfo.APPLICATION_RE_STRING), CRON: validation.Optional(validation.Repeated(CronEntry)) }
class QueueInfoExternal(validation.Validated): """Describes all of the queue entries for an application.""" ATTRIBUTES = { appinfo.APPLICATION: validation.Optional(appinfo.APPLICATION_RE_STRING), TOTAL_STORAGE_LIMIT: validation.Optional(_TOTAL_STORAGE_LIMIT_REGEX), QUEUE: validation.Optional(validation.Repeated(QueueEntry)), }
class ClientDeployInfoExternal(validation.Validated): """Describes the format of a client_deployinfo.yaml file.""" ATTRIBUTES = { RUNTIME: appinfo.RUNTIME_RE_STRING, START_TIME_USEC: validation.TYPE_LONG, END_TIME_USEC: validation.TYPE_LONG, REQUESTS: validation.Optional(validation.Repeated(Request)), SUCCESS: validation.TYPE_BOOL, SDK_VERSION: validation.Optional(validation.TYPE_STR) }
class IndexDefinitions(validation.Validated): """Top level for index definition file. Attributes: indexes: List of Index definitions. """ ATTRIBUTES = { appinfo.APPLICATION: validation.Optional(appinfo.APPLICATION_RE_STRING), 'indexes': validation.Optional(validation.Repeated(Index)), }
class QueueEntry(validation.Validated): """A queue entry describes a single task queue.""" ATTRIBUTES = { NAME: _NAME_REGEX, RATE: validation.Optional(_RATE_REGEX), MODE: validation.Optional(_MODE_REGEX), BUCKET_SIZE: validation.Optional(validation.TYPE_INT), MAX_CONCURRENT_REQUESTS: validation.Optional(validation.TYPE_INT), RETRY_PARAMETERS: validation.Optional(RetryParameters), ACL: validation.Optional(validation.Repeated(Acl)), # and version. TARGET: validation.Optional(_VERSION_REGEX), }
class QueueEntry(validation.Validated): """Describes a single task queue.""" ATTRIBUTES = { NAME: _NAME_REGEX, RATE: validation.Optional(_RATE_REGEX), MODE: validation.Optional(_MODE_REGEX), BUCKET_SIZE: validation.Optional(validation.TYPE_INT), MAX_CONCURRENT_REQUESTS: validation.Optional(validation.TYPE_INT), RETRY_PARAMETERS: validation.Optional(RetryParameters), ACL: validation.Optional(validation.Repeated(Acl)), # TODO(user): http://b/issue?id=6231287 to split this out to engine # and version. TARGET: validation.Optional(_VERSION_REGEX), }
class DispatchInfoExternal(validation.Validated): """Describes the format of a dispatch.yaml file.""" ATTRIBUTES = { APPLICATION: validation.Optional(appinfo.APPLICATION_RE_STRING), DISPATCH: validation.Optional(validation.Repeated(DispatchEntry)), }