blob: 319e791777dfc7652868a2d52692fe0f98862ca9 [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: {
24 struct?: {} @protobuf(1,type=google.protobuf.Struct)
25 any?: _ @protobuf(2,type=google.protobuf.Value)
26 listVal?: [...] @protobuf(3,type=google.protobuf.ListValue)
27 boolVal?: bool @protobuf(4,type=google.protobuf.BoolValue)
28 stringVal?: string @protobuf(5,type=google.protobuf.StringValue)
29 numberVal?: number @protobuf(6,type=google.protobuf.NumberValue)
30}
31
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020032// Attributes represents a set of typed name/value pairs. Many of Mixer's
33// API either consume and/or return attributes.
34//
35// Istio uses attributes to control the runtime behavior of services running in the service mesh.
36// Attributes are named and typed pieces of metadata describing ingress and egress traffic and the
37// environment this traffic occurs in. An Istio attribute carries a specific piece
38// of information such as the error code of an API request, the latency of an API request, or the
39// original IP address of a TCP connection. For example:
40//
41// ```yaml
42// request.path: xyz/abc
43// request.size: 234
44// request.time: 12:34:56.789 04/17/2017
45// source.ip: 192.168.0.1
46// target.service: example
47// ```
48//
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020049Attributes: {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020050 // A map of attribute name to its value.
Jason Wang5f471672019-08-23 09:59:46 -070051 attributes?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +020052 [string]: Attributes_AttributeValue
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +020053 } @protobuf(1,type=map<string,AttributeValue>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020054}
55
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020056// Specifies one attribute value with different type.
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020057Attributes_AttributeValue: {
58}
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020059// The attribute value.
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020060Attributes_AttributeValue: {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020061 // Used for values of type STRING, DNS_NAME, EMAIL_ADDRESS, and URI
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020062 stringValue: string @protobuf(2,name=string_value)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020063} | {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020064 // Used for values of type INT64
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020065 int64Value: int64 @protobuf(3,name=int64_value)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020066} | {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020067 // Used for values of type DOUBLE
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020068 doubleValue: float64 @protobuf(4,type=double,name=double_value)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020069} | {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020070 // Used for values of type BOOL
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020071 boolValue: bool @protobuf(5,name=bool_value)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020072} | {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020073 // Used for values of type BYTES
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020074 bytesValue: bytes @protobuf(6,name=bytes_value)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020075} | {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020076 // Used for values of type TIMESTAMP
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020077 timestampValue: time.Time @protobuf(7,type=google.protobuf.Timestamp,name=timestamp_value)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020078} | {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020079 // Used for values of type DURATION
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020080 durationValue: time.Duration @protobuf(8,type=google.protobuf.Duration,name=duration_value)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020081} | {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020082 // Used for values of type STRING_MAP
Marcel van Lohuizen84ffa3c2019-08-12 21:27:15 +020083 stringMapValue: Attributes_StringMap @protobuf(9,type=StringMap,name=string_map_value)
Marcel van Lohuizen13c97182019-08-13 13:39:50 +020084} | {
85 testValue: test.Test @protobuf(10,type=acme.test.Test,name=test_value)
86} | {
87 testValue: test_test.AnotherTest @protobuf(11,type=acme.test.test.AnotherTest,name=test_value)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020088}
89
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020090// Defines a string map.
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020091Attributes_StringMap: {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020092 // Holds a set of name/value pairs.
Jason Wang5f471672019-08-23 09:59:46 -070093 entries?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +020094 [string]: string
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +020095 } @protobuf(1,type=map<string,string>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +020096}
97
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +020098// Defines a list of attributes in compressed format optimized for transport.
99// Within this message, strings are referenced using integer indices into
100// one of two string dictionaries. Positive integers index into the global
101// deployment-wide dictionary, whereas negative integers index into the message-level
102// dictionary instead. The message-level dictionary is carried by the
103// `words` field of this message, the deployment-wide dictionary is determined via
104// configuration.
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200105CompressedAttributes: {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200106 // The message-level dictionary.
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200107 words?: [...string] @protobuf(1)
108
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200109 // Holds attributes of type STRING, DNS_NAME, EMAIL_ADDRESS, URI
Jason Wang5f471672019-08-23 09:59:46 -0700110 strings?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200111 [string]: int32
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200112 } @protobuf(2,type=map<sint32,sint32>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200113
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200114 // Holds attributes of type INT64
Jason Wang5f471672019-08-23 09:59:46 -0700115 int64s?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200116 [string]: int64
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200117 } @protobuf(3,type=map<sint32,int64>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200118
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200119 // Holds attributes of type DOUBLE
Jason Wang5f471672019-08-23 09:59:46 -0700120 doubles?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200121 [string]: float64
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200122 } @protobuf(4,type=map<sint32,double>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200123
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200124 // Holds attributes of type BOOL
Jason Wang5f471672019-08-23 09:59:46 -0700125 bools?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200126 [string]: bool
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200127 } @protobuf(5,type=map<sint32,bool>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200128
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200129 // Holds attributes of type TIMESTAMP
Jason Wang5f471672019-08-23 09:59:46 -0700130 time?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200131 [string]: _time_.Time
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200132 } @protobuf(6,type=map<sint32,google.protobuf.Timestamp>,"(gogoproto.nullable)=false","(gogoproto.stdtime)")
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200133
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200134 // Holds attributes of type DURATION
Jason Wang5f471672019-08-23 09:59:46 -0700135 durations?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200136 [string]: _time_.Duration
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200137 } @protobuf(7,type=map<sint32,google.protobuf.Duration>,"(gogoproto.nullable)=false","(gogoproto.stdduration)")
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200138
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200139 // Holds attributes of type BYTES
Jason Wang5f471672019-08-23 09:59:46 -0700140 bytes?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200141 [string]: _bytes_
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200142 } @protobuf(8,type=map<sint32,bytes>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200143
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200144 // Holds attributes of type STRING_MAP
Jason Wang5f471672019-08-23 09:59:46 -0700145 stringMaps?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200146 [string]: StringMap
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200147 } @protobuf(9,type=map<sint32,StringMap>,string_maps,"(gogoproto.nullable)=false")
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200148}
Marcel van Lohuizene7abb202019-10-08 11:17:17 +0200149_time_ = time
150_bytes_ = bytes
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200151
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200152// A map of string to string. The keys and values in this map are dictionary
153// indices (see the [Attributes][istio.mixer.v1.CompressedAttributes] message for an explanation)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200154StringMap: {
Marcel van Lohuizenb1d44392019-08-23 13:13:54 +0200155 // Holds a set of name/value pairs.
Jason Wang5f471672019-08-23 09:59:46 -0700156 entries?: {
Marcel van Lohuizen6d8c95d2019-10-23 23:07:03 +0200157 [string]: int32
Marcel van Lohuizenf03161d2019-08-02 22:55:43 +0200158 } @protobuf(1,type=map<sint32,sint32>)
Marcel van Lohuizen5274e982019-04-28 17:51:43 +0200159}