1// Copyright 2021 Google LLC 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 15syntax = "proto3"; 16 17package google.cloud.gkehub.servicemesh.v1alpha; 18 19import "google/api/field_behavior.proto"; 20import "google/protobuf/struct.proto"; 21 22option csharp_namespace = "Google.Cloud.GkeHub.ServiceMesh.V1Alpha"; 23option go_package = "cloud.google.com/go/gkehub/servicemesh/apiv1alpha/servicemeshpb;servicemeshpb"; 24option java_multiple_files = true; 25option java_outer_classname = "ServiceMeshProto"; 26option java_package = "com.google.cloud.gkehub.servicemesh.v1alpha"; 27option php_namespace = "Google\\Cloud\\GkeHub\\ServiceMesh\\V1alpha"; 28option ruby_package = "Google::Cloud::GkeHub::ServiceMesh::V1alpha"; 29 30// **Service Mesh**: State for the whole Hub, as analyzed by the Service Mesh 31// Hub Controller. 32message FeatureState { 33 // Output only. Results of running Service Mesh analyzers. 34 repeated AnalysisMessage analysis_messages = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 35} 36 37// **Service Mesh**: State for a single Membership, as analyzed by the Service 38// Mesh Hub Controller. 39message MembershipState { 40 // Output only. Results of running Service Mesh analyzers. 41 repeated AnalysisMessage analysis_messages = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 42} 43 44// AnalysisMessageBase describes some common information that is 45// needed for all messages. 46message AnalysisMessageBase { 47 // A unique identifier for the type of message. Display_name is intended to be 48 // human-readable, code is intended to be machine readable. There should be a 49 // one-to-one mapping between display_name and code. (i.e. do not re-use 50 // display_names or codes between message types.) 51 // See istio.analysis.v1alpha1.AnalysisMessageBase.Type 52 message Type { 53 // A human-readable name for the message type. e.g. "InternalError", 54 // "PodMissingProxy". This should be the same for all messages of the same 55 // type. (This corresponds to the `name` field in open-source Istio.) 56 string display_name = 1; 57 58 // A 7 character code matching `^IST[0-9]{4}$` or `^ASM[0-9]{4}$`, intended 59 // to uniquely identify the message type. (e.g. "IST0001" is mapped to the 60 // "InternalError" message type.) 61 string code = 2; 62 } 63 64 // The values here are chosen so that more severe messages get sorted higher, 65 // as well as leaving space in between to add more later 66 // See istio.analysis.v1alpha1.AnalysisMessageBase.Level 67 enum Level { 68 // Illegal. Same istio.analysis.v1alpha1.AnalysisMessageBase.Level.UNKNOWN. 69 LEVEL_UNSPECIFIED = 0; 70 71 // ERROR represents a misconfiguration that must be fixed. 72 ERROR = 3; 73 74 // WARNING represents a misconfiguration that should be fixed. 75 WARNING = 8; 76 77 // INFO represents an informational finding. 78 INFO = 12; 79 } 80 81 // Represents the specific type of a message. 82 Type type = 1; 83 84 // Represents how severe a message is. 85 Level level = 2; 86 87 // A url pointing to the Service Mesh or Istio documentation for this specific 88 // error type. 89 string documentation_url = 3; 90} 91 92// AnalysisMessage is a single message produced by an analyzer, and 93// it used to communicate to the end user about the state of their Service 94// Mesh configuration. 95message AnalysisMessage { 96 // Details common to all types of Istio and ServiceMesh analysis messages. 97 AnalysisMessageBase message_base = 1; 98 99 // A human readable description of what the error means. It is suitable for 100 // non-internationalize display purposes. 101 string description = 2; 102 103 // A list of strings specifying the resource identifiers that were the cause 104 // of message generation. 105 // A "path" here may be: 106 // * MEMBERSHIP_ID if the cause is a specific member cluster 107 // * MEMBERSHIP_ID/(NAMESPACE\/)?RESOURCETYPE/NAME if the cause is a resource 108 // in a cluster 109 repeated string resource_paths = 3; 110 111 // A UI can combine these args with a template (based on message_base.type) 112 // to produce an internationalized message. 113 google.protobuf.Struct args = 4; 114} 115