blob: 28c89d08de8d40db34436f017e33d46f9eb830b2 [file] [log] [blame]
Marcel van Lohuizen5274e982019-04-28 17:51:43 +02001
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +02002// 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 Lohuizen5274e982019-04-28 17:51:43 +020015package v1
16
Marcel van Lohuizen13c97182019-08-13 13:39:50 +020017import (
18 "googleapis.com/acme/test"
19 "googleapis.com/acme/test/test"
20 "time"
21)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020022
Marcel van Lohuizend8f44502019-08-01 15:05:02 +020023StructWrap: {
Marcel van Lohuizen0797e462020-01-16 14:32:29 +010024 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 Lohuizend8f44502019-08-01 15:05:02 +020028 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 Lohuizenb1d44392019-08-23 13:13:54 +020033// 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 Lohuizen5274e982019-04-28 17:51:43 +020050Attributes: {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020051 // A map of attribute name to its value.
Jason Wang5f471672019-08-23 09:59:46 -070052 attributes?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +020053 [string]: Attributes_AttributeValue
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +020054 } @protobuf(1,type=map<string,AttributeValue>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020055}
56
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020057// Specifies one attribute value with different type.
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020058Attributes_AttributeValue: {
59}
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020060// The attribute value.
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020061Attributes_AttributeValue: {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020062 // Used for values of type STRING, DNS_NAME, EMAIL_ADDRESS, and URI
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020063 stringValue: string @protobuf(2,name=string_value)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020064} | {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020065 // Used for values of type INT64
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020066 int64Value: int64 @protobuf(3,name=int64_value)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020067} | {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020068 // Used for values of type DOUBLE
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020069 doubleValue: float64 @protobuf(4,type=double,name=double_value)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020070} | {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020071 // Used for values of type BOOL
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020072 boolValue: bool @protobuf(5,name=bool_value)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020073} | {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020074 // Used for values of type BYTES
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020075 bytesValue: bytes @protobuf(6,name=bytes_value)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020076} | {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020077 // Used for values of type TIMESTAMP
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020078 timestampValue: time.Time @protobuf(7,type=google.protobuf.Timestamp,name=timestamp_value)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020079} | {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020080 // Used for values of type DURATION
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020081 durationValue: time.Duration @protobuf(8,type=google.protobuf.Duration,name=duration_value)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020082} | {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020083 // Used for values of type STRING_MAP
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020084 stringMapValue: Attributes_StringMap @protobuf(9,type=StringMap,name=string_map_value)
Marcel van Lohuizen13c97182019-08-13 13:39:50 +020085} | {
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 Lohuizen5274e982019-04-28 17:51:43 +020089}
90
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020091// Defines a string map.
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020092Attributes_StringMap: {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020093 // Holds a set of name/value pairs.
Jason Wang5f471672019-08-23 09:59:46 -070094 entries?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +020095 [string]: string
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +020096 } @protobuf(1,type=map<string,string>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020097}
98
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020099// 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 Lohuizen5274e982019-04-28 17:51:43 +0200106CompressedAttributes: {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200107 // The message-level dictionary.
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200108 words?: [...string] @protobuf(1)
109
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200110 // Holds attributes of type STRING, DNS_NAME, EMAIL_ADDRESS, URI
Jason Wang5f471672019-08-23 09:59:46 -0700111 strings?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200112 [string]: int32
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200113 } @protobuf(2,type=map<sint32,sint32>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200114
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200115 // Holds attributes of type INT64
Jason Wang5f471672019-08-23 09:59:46 -0700116 int64s?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200117 [string]: int64
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200118 } @protobuf(3,type=map<sint32,int64>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200119
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200120 // Holds attributes of type DOUBLE
Jason Wang5f471672019-08-23 09:59:46 -0700121 doubles?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200122 [string]: float64
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200123 } @protobuf(4,type=map<sint32,double>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200124
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200125 // Holds attributes of type BOOL
Jason Wang5f471672019-08-23 09:59:46 -0700126 bools?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200127 [string]: bool
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200128 } @protobuf(5,type=map<sint32,bool>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200129
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200130 // Holds attributes of type TIMESTAMP
Jason Wang5f471672019-08-23 09:59:46 -0700131 time?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200132 [string]: _time_.Time
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200133 } @protobuf(6,type=map<sint32,google.protobuf.Timestamp>,"(gogoproto.nullable)=false","(gogoproto.stdtime)")
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200134
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200135 // Holds attributes of type DURATION
Jason Wang5f471672019-08-23 09:59:46 -0700136 durations?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200137 [string]: _time_.Duration
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200138 } @protobuf(7,type=map<sint32,google.protobuf.Duration>,"(gogoproto.nullable)=false","(gogoproto.stdduration)")
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200139
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200140 // Holds attributes of type BYTES
Jason Wang5f471672019-08-23 09:59:46 -0700141 bytes?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200142 [string]: _bytes_
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200143 } @protobuf(8,type=map<sint32,bytes>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200144
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200145 // Holds attributes of type STRING_MAP
Jason Wang5f471672019-08-23 09:59:46 -0700146 stringMaps?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200147 [string]: StringMap
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200148 } @protobuf(9,type=map<sint32,StringMap>,string_maps,"(gogoproto.nullable)=false")
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200149}
Marcel van Lohuizene7abb202019-10-08 11:17:17 +0200150_time_ = time
151_bytes_ = bytes
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200152
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200153// 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 Lohuizen5274e982019-04-28 17:51:43 +0200155StringMap: {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200156 // Holds a set of name/value pairs.
Jason Wang5f471672019-08-23 09:59:46 -0700157 entries?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200158 [string]: int32
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200159 } @protobuf(1,type=map<sint32,sint32>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200160}