blob: b8241efd944a9b5d2ac68fe2283eb6a5471ca626 [file] [log] [blame]
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Default field masks for API responses."""
from google.protobuf import field_mask_pb2
from components import protoutil
from import build_pb2
from import builds_service_pb2 as rpc_pb2
def _build_default_field_paths(prefix=''): # pragma: no cover
paths = [
# TODO(nodir): add the following fields when they are defined in the
# proto:
# 'user_duration',
return [prefix + p for p in paths]
# Maps a message class to default field paths.
_PATHS = {
(['next_page_token'] + _build_default_field_paths('builds.*.')),
# Maps a message class to a protoutil.Mask.
mclass: protoutil.Mask.from_field_mask(
field_mask_pb2.FieldMask(paths=paths), mclass.DESCRIPTOR
) for mclass, paths in _PATHS.iteritems()