blob: d3b32200a9e69c37a9cba073b45494f57c218937 [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
10from chromite.api import router as router_lib
Alex Klein231d2da2019-07-22 16:44:45 -060011from chromite.api import validate
Alex Klein54e38e32019-06-21 14:54:17 -060012
Alex Klein104b0672019-06-28 15:43:00 -060013# API version number.
14# The major version MUST be updated on breaking changes.
15VERSION_MAJOR = 1
16# The minor and bug versions are not currently utilized, but put in place
17# to simplify future requirements.
18VERSION_MINOR = 0
19VERSION_BUG = 0
20
Alex Klein54e38e32019-06-21 14:54:17 -060021
Alex Klein231d2da2019-07-22 16:44:45 -060022@validate.validation_complete
23def GetMethods(_input_proto, output_proto, _config):
Alex Klein54e38e32019-06-21 14:54:17 -060024 """List all of the registered methods."""
25 router = router_lib.GetRouter()
26 for method in router.ListMethods():
27 output_proto.methods.add().method = method
Alex Klein104b0672019-06-28 15:43:00 -060028
29
Alex Klein231d2da2019-07-22 16:44:45 -060030@validate.validation_complete
31def GetVersion(_input_proto, output_proto, _config):
Alex Klein104b0672019-06-28 15:43:00 -060032 """Get the Build API major version number."""
33 output_proto.version.major = VERSION_MAJOR
34 output_proto.version.minor = VERSION_MINOR
35 output_proto.version.bug = VERSION_BUG