|
| 1 | +// Copyright 2019 Istio Authors |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +syntax = "proto3"; |
| 16 | + |
| 17 | +// $title: Analysis Messages |
| 18 | +// $description: Describes the structure of messages generated by Istio analyzers. |
| 19 | +// $location: https://istio.io/docs/reference/config/istio.analysis.v1alpha1.html |
| 20 | +// $weight: 20 |
| 21 | + |
| 22 | +// Describes the structure of messages generated by Istio analyzers. |
| 23 | +package istio.analysis.v1alpha1; |
| 24 | + |
| 25 | +option go_package="istio.io/api/analysis/v1alpha1"; |
| 26 | + |
| 27 | +// AnalysisMessageType describes some common information that is needed for both |
| 28 | +// creating a message schema or a reified message. Weakly typed message schemas |
| 29 | +// are defined in istio/istio/galley/pkg/config/analysis/msg/messages.yaml |
| 30 | +message AnalysisMessageType { |
| 31 | + // A human-readable name for the message type. e.g. "InternalError", |
| 32 | + // "Deprecated". This should be the same for all messages of the same type. |
| 33 | + // Required. |
| 34 | + string name = 1; |
| 35 | + |
| 36 | + // A 7 character code matching `^IST[0-9]{4}$` intended to uniquely identify |
| 37 | + // the message type. (e.g. "IST0001" is mapped to the "InternalError" message |
| 38 | + // type.) 0000-0100 are reserved. Required. |
| 39 | + string code = 2; |
| 40 | + |
| 41 | + // The values here are chosen so that more severe messages get sorted higher, |
| 42 | + // as well as leaving space in between to add more later |
| 43 | + enum Level { |
| 44 | + UNKNOWN = 0; // invalid, but included for proto compatibility for 0 values |
| 45 | + ERROR = 3; |
| 46 | + WARNING = 8; |
| 47 | + INFO = 12; |
| 48 | + } |
| 49 | + |
| 50 | + // Represents how severe a message is. Required. |
| 51 | + Level level = 3; |
| 52 | + |
| 53 | + enum MessageTypeVersion { |
| 54 | + V1ALPHA1 = 0; |
| 55 | + } |
| 56 | + |
| 57 | + // The version of this proto schema that the message was build with. Required. |
| 58 | + MessageTypeVersion base_message_schema = 4; |
| 59 | + |
| 60 | + // A url pointing to the Istio documentation for this specific error type. |
| 61 | + // Should be of the form |
| 62 | + // `^http(s)?://(preliminary\.)?istio.io/docs/reference/config/analysis/` |
| 63 | + // Required. |
| 64 | + string documentation_url = 5; |
| 65 | + |
| 66 | +} |
| 67 | + |
| 68 | +// AnalysisMessageSchema is the set of information that's needed to define a |
| 69 | +// weakly-typed schema. The purpose of this proto is to provide a mechanism for |
| 70 | +// validating istio/istio/galley/pkg/config/analysis/msg/messages.yaml to make |
| 71 | +// sure that we don't allow committing underspecified types. |
| 72 | +message AnalysisMessageSchema { |
| 73 | + // Required |
| 74 | + AnalysisMessageType type_info = 1; |
| 75 | + |
| 76 | + // A human readable description of what the error means. Required when |
| 77 | + // defining a schema in YAML. |
| 78 | + string description = 2; |
| 79 | + |
| 80 | + // A go-style template string defining how to combine the args for a |
| 81 | + // particular message into a log line. Required when defining a schema in |
| 82 | + // YAML. |
| 83 | + string template = 3; |
| 84 | + |
| 85 | + message ArgType { |
| 86 | + // Required |
| 87 | + string name = 1; |
| 88 | + // Required. Should be an OpenAPI data type: |
| 89 | + // https://swagger.io/docs/specification/data-models/data-types/ |
| 90 | + string type = 2; |
| 91 | + } |
| 92 | + |
| 93 | + // A description of the arguments for a particular message type |
| 94 | + repeated ArgType args = 4; |
| 95 | +} |
| 96 | + |
| 97 | +// GenericAnalysisMessage is an instance of an AnalysisMessage defined by a |
| 98 | +// schema, whose metaschema is AnalysisMessageSchema. (Names are hard.) Code |
| 99 | +// should be able to perform validation of arguments as needed by using the |
| 100 | +// message type information to look at the AnalysisMessageSchema and examine the |
| 101 | +// list of args at runtime. Developers can also create stronger-typed versions |
| 102 | +// of GenericAnalysisMessage for well-known and stable message types. |
| 103 | +message GenericAnalysisMessage { |
| 104 | + // Required |
| 105 | + AnalysisMessageType type_info = 1; |
| 106 | + |
| 107 | + // Any message-type specific arguments that need to get codified. Optional. |
| 108 | + map<string, string> args = 2; |
| 109 | + |
| 110 | + // A list of strings specifying the path for resources which were the cause of |
| 111 | + // message generation. At least one is required. |
| 112 | + repeated string resource_paths = 3; |
| 113 | +} |
0 commit comments