blob: e0c5d5a7989a7571071f012206c504ec7d3764c3 [file] [log] [blame]
Alex Klein54e38e32019-06-21 14:54:17 -06001# -*- coding: utf-8 -*-
2# Copyright 2019 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6"""API information controller."""
7
8from __future__ import print_function
9
Alex Klein076841b2019-08-29 15:19:39 -060010from chromite.api import faux
Alex Klein54e38e32019-06-21 14:54:17 -060011from chromite.api import router as router_lib
Alex Klein231d2da2019-07-22 16:44:45 -060012from chromite.api import validate
Alex Klein54e38e32019-06-21 14:54:17 -060013
Alex Klein104b0672019-06-28 15:43:00 -060014# API version number.
15# The major version MUST be updated on breaking changes.
16VERSION_MAJOR = 1
17# The minor and bug versions are not currently utilized, but put in place
18# to simplify future requirements.
19VERSION_MINOR = 0
20VERSION_BUG = 0
21
Alex Klein54e38e32019-06-21 14:54:17 -060022
Alex Klein076841b2019-08-29 15:19:39 -060023@faux.all_empty
Alex Klein231d2da2019-07-22 16:44:45 -060024@validate.validation_complete
25def GetMethods(_input_proto, output_proto, _config):
Alex Klein54e38e32019-06-21 14:54:17 -060026 """List all of the registered methods."""
27 router = router_lib.GetRouter()
28 for method in router.ListMethods():
29 output_proto.methods.add().method = method
Alex Klein104b0672019-06-28 15:43:00 -060030
31
Alex Klein231d2da2019-07-22 16:44:45 -060032@validate.validation_complete
33def GetVersion(_input_proto, output_proto, _config):
Alex Klein104b0672019-06-28 15:43:00 -060034 """Get the Build API major version number."""
35 output_proto.version.major = VERSION_MAJOR
36 output_proto.version.minor = VERSION_MINOR
37 output_proto.version.bug = VERSION_BUG