Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 1 | |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 2 | // Copyright 2016 Istio Authors |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 15 | package v1 |
| 16 | |
Marcel van Lohuizen | 13c9718 | 2019-08-13 13:39:50 +0200 | [diff] [blame] | 17 | import ( |
| 18 | "googleapis.com/acme/test" |
| 19 | "googleapis.com/acme/test/test" |
| 20 | "time" |
| 21 | ) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 22 | |
Marcel van Lohuizen | d8f4450 | 2019-08-01 15:05:02 +0200 | [diff] [blame] | 23 | StructWrap: { |
Marcel van Lohuizen | 0797e46 | 2020-01-16 14:32:29 +0100 | [diff] [blame] | 24 | struct?: { |
| 25 | } @protobuf(1,type=google.protobuf.Struct) |
| 26 | any?: _ @protobuf(2,type=google.protobuf.Value) |
| 27 | listVal?: [...] @protobuf(3,type=google.protobuf.ListValue) |
Marcel van Lohuizen | d8f4450 | 2019-08-01 15:05:02 +0200 | [diff] [blame] | 28 | boolVal?: bool @protobuf(4,type=google.protobuf.BoolValue) |
| 29 | stringVal?: string @protobuf(5,type=google.protobuf.StringValue) |
| 30 | numberVal?: number @protobuf(6,type=google.protobuf.NumberValue) |
| 31 | } |
| 32 | |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 33 | // Attributes represents a set of typed name/value pairs. Many of Mixer's |
| 34 | // API either consume and/or return attributes. |
| 35 | // |
| 36 | // Istio uses attributes to control the runtime behavior of services running in the service mesh. |
| 37 | // Attributes are named and typed pieces of metadata describing ingress and egress traffic and the |
| 38 | // environment this traffic occurs in. An Istio attribute carries a specific piece |
| 39 | // of information such as the error code of an API request, the latency of an API request, or the |
| 40 | // original IP address of a TCP connection. For example: |
| 41 | // |
| 42 | // ```yaml |
| 43 | // request.path: xyz/abc |
| 44 | // request.size: 234 |
| 45 | // request.time: 12:34:56.789 04/17/2017 |
| 46 | // source.ip: 192.168.0.1 |
| 47 | // target.service: example |
| 48 | // ``` |
| 49 | // |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 50 | Attributes: { |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 51 | // A map of attribute name to its value. |
Jason Wang | 5f47167 | 2019-08-23 09:59:46 -0700 | [diff] [blame] | 52 | attributes?: { |
Marcel van Lohuizen | 6d8c95d | 2019-10-23 23:07:03 +0200 | [diff] [blame] | 53 | [string]: Attributes_AttributeValue |
Marcel van Lohuizen | f03161d | 2019-08-02 22:55:43 +0200 | [diff] [blame] | 54 | } @protobuf(1,type=map<string,AttributeValue>) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 55 | } |
| 56 | |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 57 | // Specifies one attribute value with different type. |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 58 | Attributes_AttributeValue: { |
| 59 | } |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 60 | // The attribute value. |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 61 | Attributes_AttributeValue: { |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 62 | // Used for values of type STRING, DNS_NAME, EMAIL_ADDRESS, and URI |
Marcel van Lohuizen | 84ffa3c | 2019-08-12 21:27:15 +0200 | [diff] [blame] | 63 | stringValue: string @protobuf(2,name=string_value) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 64 | } | { |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 65 | // Used for values of type INT64 |
Marcel van Lohuizen | 84ffa3c | 2019-08-12 21:27:15 +0200 | [diff] [blame] | 66 | int64Value: int64 @protobuf(3,name=int64_value) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 67 | } | { |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 68 | // Used for values of type DOUBLE |
Marcel van Lohuizen | 84ffa3c | 2019-08-12 21:27:15 +0200 | [diff] [blame] | 69 | doubleValue: float64 @protobuf(4,type=double,name=double_value) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 70 | } | { |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 71 | // Used for values of type BOOL |
Marcel van Lohuizen | 84ffa3c | 2019-08-12 21:27:15 +0200 | [diff] [blame] | 72 | boolValue: bool @protobuf(5,name=bool_value) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 73 | } | { |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 74 | // Used for values of type BYTES |
Marcel van Lohuizen | 84ffa3c | 2019-08-12 21:27:15 +0200 | [diff] [blame] | 75 | bytesValue: bytes @protobuf(6,name=bytes_value) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 76 | } | { |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 77 | // Used for values of type TIMESTAMP |
Marcel van Lohuizen | 84ffa3c | 2019-08-12 21:27:15 +0200 | [diff] [blame] | 78 | timestampValue: time.Time @protobuf(7,type=google.protobuf.Timestamp,name=timestamp_value) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 79 | } | { |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 80 | // Used for values of type DURATION |
Marcel van Lohuizen | 84ffa3c | 2019-08-12 21:27:15 +0200 | [diff] [blame] | 81 | durationValue: time.Duration @protobuf(8,type=google.protobuf.Duration,name=duration_value) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 82 | } | { |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 83 | // Used for values of type STRING_MAP |
Marcel van Lohuizen | 84ffa3c | 2019-08-12 21:27:15 +0200 | [diff] [blame] | 84 | stringMapValue: Attributes_StringMap @protobuf(9,type=StringMap,name=string_map_value) |
Marcel van Lohuizen | 13c9718 | 2019-08-13 13:39:50 +0200 | [diff] [blame] | 85 | } | { |
| 86 | testValue: test.Test @protobuf(10,type=acme.test.Test,name=test_value) |
| 87 | } | { |
| 88 | testValue: test_test.AnotherTest @protobuf(11,type=acme.test.test.AnotherTest,name=test_value) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 89 | } |
| 90 | |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 91 | // Defines a string map. |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 92 | Attributes_StringMap: { |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 93 | // Holds a set of name/value pairs. |
Jason Wang | 5f47167 | 2019-08-23 09:59:46 -0700 | [diff] [blame] | 94 | entries?: { |
Marcel van Lohuizen | 6d8c95d | 2019-10-23 23:07:03 +0200 | [diff] [blame] | 95 | [string]: string |
Marcel van Lohuizen | f03161d | 2019-08-02 22:55:43 +0200 | [diff] [blame] | 96 | } @protobuf(1,type=map<string,string>) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 97 | } |
| 98 | |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 99 | // Defines a list of attributes in compressed format optimized for transport. |
| 100 | // Within this message, strings are referenced using integer indices into |
| 101 | // one of two string dictionaries. Positive integers index into the global |
| 102 | // deployment-wide dictionary, whereas negative integers index into the message-level |
| 103 | // dictionary instead. The message-level dictionary is carried by the |
| 104 | // `words` field of this message, the deployment-wide dictionary is determined via |
| 105 | // configuration. |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 106 | CompressedAttributes: { |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 107 | // The message-level dictionary. |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 108 | words?: [...string] @protobuf(1) |
| 109 | |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 110 | // Holds attributes of type STRING, DNS_NAME, EMAIL_ADDRESS, URI |
Jason Wang | 5f47167 | 2019-08-23 09:59:46 -0700 | [diff] [blame] | 111 | strings?: { |
Marcel van Lohuizen | 6d8c95d | 2019-10-23 23:07:03 +0200 | [diff] [blame] | 112 | [string]: int32 |
Marcel van Lohuizen | f03161d | 2019-08-02 22:55:43 +0200 | [diff] [blame] | 113 | } @protobuf(2,type=map<sint32,sint32>) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 114 | |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 115 | // Holds attributes of type INT64 |
Jason Wang | 5f47167 | 2019-08-23 09:59:46 -0700 | [diff] [blame] | 116 | int64s?: { |
Marcel van Lohuizen | 6d8c95d | 2019-10-23 23:07:03 +0200 | [diff] [blame] | 117 | [string]: int64 |
Marcel van Lohuizen | f03161d | 2019-08-02 22:55:43 +0200 | [diff] [blame] | 118 | } @protobuf(3,type=map<sint32,int64>) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 119 | |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 120 | // Holds attributes of type DOUBLE |
Jason Wang | 5f47167 | 2019-08-23 09:59:46 -0700 | [diff] [blame] | 121 | doubles?: { |
Marcel van Lohuizen | 6d8c95d | 2019-10-23 23:07:03 +0200 | [diff] [blame] | 122 | [string]: float64 |
Marcel van Lohuizen | f03161d | 2019-08-02 22:55:43 +0200 | [diff] [blame] | 123 | } @protobuf(4,type=map<sint32,double>) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 124 | |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 125 | // Holds attributes of type BOOL |
Jason Wang | 5f47167 | 2019-08-23 09:59:46 -0700 | [diff] [blame] | 126 | bools?: { |
Marcel van Lohuizen | 6d8c95d | 2019-10-23 23:07:03 +0200 | [diff] [blame] | 127 | [string]: bool |
Marcel van Lohuizen | f03161d | 2019-08-02 22:55:43 +0200 | [diff] [blame] | 128 | } @protobuf(5,type=map<sint32,bool>) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 129 | |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 130 | // Holds attributes of type TIMESTAMP |
Jason Wang | 5f47167 | 2019-08-23 09:59:46 -0700 | [diff] [blame] | 131 | time?: { |
Marcel van Lohuizen | 6d8c95d | 2019-10-23 23:07:03 +0200 | [diff] [blame] | 132 | [string]: _time_.Time |
Marcel van Lohuizen | f03161d | 2019-08-02 22:55:43 +0200 | [diff] [blame] | 133 | } @protobuf(6,type=map<sint32,google.protobuf.Timestamp>,"(gogoproto.nullable)=false","(gogoproto.stdtime)") |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 134 | |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 135 | // Holds attributes of type DURATION |
Jason Wang | 5f47167 | 2019-08-23 09:59:46 -0700 | [diff] [blame] | 136 | durations?: { |
Marcel van Lohuizen | 6d8c95d | 2019-10-23 23:07:03 +0200 | [diff] [blame] | 137 | [string]: _time_.Duration |
Marcel van Lohuizen | f03161d | 2019-08-02 22:55:43 +0200 | [diff] [blame] | 138 | } @protobuf(7,type=map<sint32,google.protobuf.Duration>,"(gogoproto.nullable)=false","(gogoproto.stdduration)") |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 139 | |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 140 | // Holds attributes of type BYTES |
Jason Wang | 5f47167 | 2019-08-23 09:59:46 -0700 | [diff] [blame] | 141 | bytes?: { |
Marcel van Lohuizen | 6d8c95d | 2019-10-23 23:07:03 +0200 | [diff] [blame] | 142 | [string]: _bytes_ |
Marcel van Lohuizen | f03161d | 2019-08-02 22:55:43 +0200 | [diff] [blame] | 143 | } @protobuf(8,type=map<sint32,bytes>) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 144 | |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 145 | // Holds attributes of type STRING_MAP |
Jason Wang | 5f47167 | 2019-08-23 09:59:46 -0700 | [diff] [blame] | 146 | stringMaps?: { |
Marcel van Lohuizen | 6d8c95d | 2019-10-23 23:07:03 +0200 | [diff] [blame] | 147 | [string]: StringMap |
Marcel van Lohuizen | f03161d | 2019-08-02 22:55:43 +0200 | [diff] [blame] | 148 | } @protobuf(9,type=map<sint32,StringMap>,string_maps,"(gogoproto.nullable)=false") |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 149 | } |
Marcel van Lohuizen | e7abb20 | 2019-10-08 11:17:17 +0200 | [diff] [blame] | 150 | _time_ = time |
| 151 | _bytes_ = bytes |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 152 | |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 153 | // A map of string to string. The keys and values in this map are dictionary |
| 154 | // indices (see the [Attributes][istio.mixer.v1.CompressedAttributes] message for an explanation) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 155 | StringMap: { |
Marcel van Lohuizen | b1d4439 | 2019-08-23 13:13:54 +0200 | [diff] [blame] | 156 | // Holds a set of name/value pairs. |
Jason Wang | 5f47167 | 2019-08-23 09:59:46 -0700 | [diff] [blame] | 157 | entries?: { |
Marcel van Lohuizen | 6d8c95d | 2019-10-23 23:07:03 +0200 | [diff] [blame] | 158 | [string]: int32 |
Marcel van Lohuizen | f03161d | 2019-08-02 22:55:43 +0200 | [diff] [blame] | 159 | } @protobuf(1,type=map<sint32,sint32>) |
Marcel van Lohuizen | 5274e98 | 2019-04-28 17:51:43 +0200 | [diff] [blame] | 160 | } |