use istio client-go library instead of knative (#1661)

use istio client-go library instead of knative
bump kubernetes dependency version
change code coverage to codecov
This commit is contained in:
zryfish
2019-12-13 11:26:18 +08:00
committed by GitHub
parent f249a6e081
commit ea88c8803d
2071 changed files with 354531 additions and 108336 deletions

3362
vendor/istio.io/api/mixer/v1/attributes.pb.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

148
vendor/istio.io/api/mixer/v1/attributes.proto generated vendored Normal file
View File

@@ -0,0 +1,148 @@
// Copyright 2016 Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package istio.mixer.v1;
option go_package = "istio.io/api/mixer/v1";
import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.equal_all) = false;
option (gogoproto.gostring_all) = false;
option (gogoproto.stable_marshaler_all) = true;
option cc_enable_arenas = true;
// Attributes represents a set of typed name/value pairs. Many of Mixer's
// API either consume and/or return attributes.
//
// Istio uses attributes to control the runtime behavior of services running in the service mesh.
// Attributes are named and typed pieces of metadata describing ingress and egress traffic and the
// environment this traffic occurs in. An Istio attribute carries a specific piece
// of information such as the error code of an API request, the latency of an API request, or the
// original IP address of a TCP connection. For example:
//
// ```yaml
// request.path: xyz/abc
// request.size: 234
// request.time: 12:34:56.789 04/17/2017
// source.ip: 192.168.0.1
// target.service: example
// ```
//
// A given Istio deployment has a fixed vocabulary of attributes that it understands.
// The specific vocabulary is determined by the set of attribute producers being used
// in the deployment. The primary attribute producer in Istio is Envoy, although
// specialized Mixer adapters and services can also generate attributes.
//
// The common baseline set of attributes available in most Istio deployments is defined
// [here](https://istio.io/docs/reference/config/policy-and-telemetry/attribute-vocabulary/).
//
// Attributes are strongly typed. The supported attribute types are defined by
// [ValueType](https://github.com/istio/api/blob/release-1.4/policy/v1beta1/value_type.proto).
// Each type of value is encoded into one of the so-called transport types present
// in this message.
//
// Defines a map of attributes in uncompressed format.
// Following places may use this message:
// 1) Configure Istio/Proxy with static per-proxy attributes, such as source.uid.
// 2) Service IDL definition to extract api attributes for active requests.
// 3) Forward attributes from client proxy to server proxy for HTTP requests.
message Attributes {
// A map of attribute name to its value.
map<string, AttributeValue> attributes = 1;
// Specifies one attribute value with different type.
message AttributeValue {
// The attribute value.
oneof value {
// Used for values of type STRING, DNS_NAME, EMAIL_ADDRESS, and URI
string string_value = 2;
// Used for values of type INT64
int64 int64_value = 3;
// Used for values of type DOUBLE
double double_value = 4;
// Used for values of type BOOL
bool bool_value = 5;
// Used for values of type BYTES
bytes bytes_value = 6;
// Used for values of type TIMESTAMP
google.protobuf.Timestamp timestamp_value = 7;
// Used for values of type DURATION
google.protobuf.Duration duration_value = 8;
// Used for values of type STRING_MAP
StringMap string_map_value = 9;
}
}
// Defines a string map.
message StringMap {
// Holds a set of name/value pairs.
map<string, string> entries = 1;
}
}
// Defines a list of attributes in compressed format optimized for transport.
// Within this message, strings are referenced using integer indices into
// one of two string dictionaries. Positive integers index into the global
// deployment-wide dictionary, whereas negative integers index into the message-level
// dictionary instead. The message-level dictionary is carried by the
// `words` field of this message, the deployment-wide dictionary is determined via
// configuration.
message CompressedAttributes {
// The message-level dictionary.
repeated string words = 1;
// Holds attributes of type STRING, DNS_NAME, EMAIL_ADDRESS, URI
map<sint32, sint32> strings = 2;
// Holds attributes of type INT64
map<sint32, int64> int64s = 3;
// Holds attributes of type DOUBLE
map<sint32, double> doubles = 4;
// Holds attributes of type BOOL
map<sint32, bool> bools = 5;
// Holds attributes of type TIMESTAMP
map<sint32, google.protobuf.Timestamp> timestamps = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
// Holds attributes of type DURATION
map<sint32, google.protobuf.Duration> durations = 7 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
// Holds attributes of type BYTES
map<sint32, bytes> bytes = 8;
// Holds attributes of type STRING_MAP
map<sint32, StringMap> string_maps = 9 [(gogoproto.nullable) = false];
}
// A map of string to string. The keys and values in this map are dictionary
// indices (see the [Attributes][istio.mixer.v1.CompressedAttributes] message for an explanation)
message StringMap {
// Holds a set of name/value pairs.
map<sint32, sint32> entries = 1;
}

79
vendor/istio.io/api/mixer/v1/attributes_json.gen.go generated vendored Normal file
View File

@@ -0,0 +1,79 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: mixer/v1/attributes.proto
package v1
import (
bytes "bytes"
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
proto "github.com/gogo/protobuf/proto"
_ "github.com/gogo/protobuf/types"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// MarshalJSON is a custom marshaler for Attributes
func (this *Attributes) MarshalJSON() ([]byte, error) {
str, err := AttributesMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for Attributes
func (this *Attributes) UnmarshalJSON(b []byte) error {
return AttributesUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for Attributes_AttributeValue
func (this *Attributes_AttributeValue) MarshalJSON() ([]byte, error) {
str, err := AttributesMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for Attributes_AttributeValue
func (this *Attributes_AttributeValue) UnmarshalJSON(b []byte) error {
return AttributesUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for Attributes_StringMap
func (this *Attributes_StringMap) MarshalJSON() ([]byte, error) {
str, err := AttributesMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for Attributes_StringMap
func (this *Attributes_StringMap) UnmarshalJSON(b []byte) error {
return AttributesUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for CompressedAttributes
func (this *CompressedAttributes) MarshalJSON() ([]byte, error) {
str, err := AttributesMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for CompressedAttributes
func (this *CompressedAttributes) UnmarshalJSON(b []byte) error {
return AttributesUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for StringMap
func (this *StringMap) MarshalJSON() ([]byte, error) {
str, err := AttributesMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for StringMap
func (this *StringMap) UnmarshalJSON(b []byte) error {
return AttributesUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
var (
AttributesMarshaler = &github_com_gogo_protobuf_jsonpb.Marshaler{}
AttributesUnmarshaler = &github_com_gogo_protobuf_jsonpb.Unmarshaler{}
)

1930
vendor/istio.io/api/mixer/v1/config/client/api_spec.pb.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,256 @@
// Copyright 2017 Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package istio.mixer.v1.config.client;
option go_package="istio.io/api/mixer/v1/config/client";
import "gogoproto/gogo.proto";
import "google/api/field_behavior.proto";
import "mixer/v1/attributes.proto";
import "mixer/v1/config/client/service.proto";
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.equal_all) = false;
option (gogoproto.gostring_all) = false;
option (gogoproto.stable_marshaler_all) = true;
// HTTPAPISpec defines the canonical configuration for generating
// API-related attributes from HTTP requests based on the method and
// uri templated path matches. It is sufficient for defining the API
// surface of a service for the purposes of API attribute
// generation. It is not intended to represent auth, quota,
// documentation, or other information commonly found in other API
// specifications, e.g. OpenAPI.
//
// Existing standards that define operations (or methods) in terms of
// HTTP methods and paths can be normalized to this format for use in
// Istio. For example, a simple petstore API described by OpenAPIv2
// [here](https://github.com/googleapis/gnostic/blob/master/examples/v2.0/yaml/petstore-simple.yaml)
// can be represented with the following HTTPAPISpec.
//
// ```yaml
// apiVersion: config.istio.io/v1alpha2
// kind: HTTPAPISpec
// metadata:
// name: petstore
// namespace: default
// spec:
// attributes:
// attributes:
// api.service:
// stringValue: petstore.swagger.io
// api.version:
// stringValue: 1.0.0
// patterns:
// - attributes:
// attributes:
// api.operation:
// stringValue: findPets
// httpMethod: GET
// uriTemplate: /api/pets
// - attributes:
// attributes:
// api.operation:
// stringValue: addPet
// httpMethod: POST
// uriTemplate: /api/pets
// - attributes:
// attributes:
// api.operation:
// stringValue: findPetById
// httpMethod: GET
// uriTemplate: /api/pets/{id}
// - attributes:
// attributes:
// api.operation:
// stringValue: deletePet
// httpMethod: DELETE
// uriTemplate: /api/pets/{id}
// apiKeys:
// - query: api-key
// ```
//
// <!-- go code generation tags
// +kubetype-gen
// +kubetype-gen:groupVersion=config.istio.io/v1alpha2
// +genclient
// +k8s:deepcopy-gen=true
// -->
message HTTPAPISpec {
// List of attributes that are generated when *any* of the HTTP
// patterns match. This list typically includes the "api.service"
// and "api.version" attributes.
Attributes attributes = 1;
// List of HTTP patterns to match.
repeated HTTPAPISpecPattern patterns = 2;
// List of APIKey that describes how to extract an API-KEY from an
// HTTP request. The first API-Key match found in the list is used,
// i.e. 'OR' semantics.
//
// The following default policies are used to generate the
// `request.api_key` attribute if no explicit APIKey is defined.
//
// `query: key, `query: api_key`, and then `header: x-api-key`
//
repeated APIKey api_keys = 3;
}
// HTTPAPISpecPattern defines a single pattern to match against
// incoming HTTP requests. The per-pattern list of attributes is
// generated if both the http_method and uri_template match. In
// addition, the top-level list of attributes in the HTTPAPISpec is also
// generated.
//
// ```yaml
// pattern:
// - attributes
// api.operation: doFooBar
// httpMethod: GET
// uriTemplate: /foo/bar
// ```
message HTTPAPISpecPattern {
// List of attributes that are generated if the HTTP request matches
// the specified http_method and uri_template. This typically
// includes the "api.operation" attribute.
Attributes attributes = 1;
// HTTP request method to match against as defined by
// [rfc7231](https://tools.ietf.org/html/rfc7231#page-21). For
// example: GET, HEAD, POST, PUT, DELETE.
string http_method = 2;
oneof pattern {
// URI template to match against as defined by
// [rfc6570](https://tools.ietf.org/html/rfc6570). For example, the
// following are valid URI templates:
//
// /pets
// /pets/{id}
// /dictionary/{term:1}/{term}
// /search{?q*,lang}
//
string uri_template = 3;
// EXPERIMENTAL:
//
// ecmascript style regex-based match as defined by
// [EDCA-262](http://en.cppreference.com/w/cpp/regex/ecmascript). For
// example,
//
// "^/pets/(.*?)?"
//
string regex = 4;
}
}
// APIKey defines the explicit configuration for generating the
// `request.api_key` attribute from HTTP requests.
//
// See [API Keys](https://swagger.io/docs/specification/authentication/api-keys)
// for a general overview of API keys as defined by OpenAPI.
message APIKey {
oneof key {
// API Key is sent as a query parameter. `query` represents the
// query string parameter name.
//
// For example, `query=api_key` should be used with the
// following request:
//
// GET /something?api_key=abcdef12345
//
string query = 1;
// API key is sent in a request header. `header` represents the
// header name.
//
// For example, `header=X-API-KEY` should be used with the
// following request:
//
// GET /something HTTP/1.1
// X-API-Key: abcdef12345
//
string header = 2;
// API key is sent in a
// [cookie](https://swagger.io/docs/specification/authentication/cookie-authentication),
//
// For example, `cookie=X-API-KEY` should be used for the
// following request:
//
// GET /something HTTP/1.1
// Cookie: X-API-KEY=abcdef12345
//
string cookie = 3;
}
}
// HTTPAPISpecReference defines a reference to an HTTPAPISpec. This is
// typically used for establishing bindings between an HTTPAPISpec and an
// IstioService. For example, the following defines an
// HTTPAPISpecReference for service `foo` in namespace `bar`.
//
// ```yaml
// - name: foo
// namespace: bar
// ```
message HTTPAPISpecReference {
// The short name of the HTTPAPISpec. This is the resource
// name defined by the metadata name field.
string name = 1 [(google.api.field_behavior) = REQUIRED];
// Optional namespace of the HTTPAPISpec. Defaults to the encompassing
// HTTPAPISpecBinding's metadata namespace field.
string namespace = 2;
}
// HTTPAPISpecBinding defines the binding between HTTPAPISpecs and one or more
// IstioService. For example, the following establishes a binding
// between the HTTPAPISpec `petstore` and service `foo` in namespace `bar`.
//
// ```yaml
// apiVersion: config.istio.io/v1alpha2
// kind: HTTPAPISpecBinding
// metadata:
// name: my-binding
// namespace: default
// spec:
// services:
// - name: foo
// namespace: bar
// apiSpecs:
// - name: petstore
// namespace: default
// ```
//
// <!-- go code generation tags
// +kubetype-gen
// +kubetype-gen:groupVersion=config.istio.io/v1alpha2
// +genclient
// +k8s:deepcopy-gen=true
// -->
message HTTPAPISpecBinding {
// One or more services to map the listed HTTPAPISpec onto.
repeated IstioService services = 1 [(google.api.field_behavior) = REQUIRED];
// One or more HTTPAPISpec references that should be mapped to
// the specified service(s). The aggregate collection of match
// conditions defined in the HTTPAPISpecs should not overlap.
repeated HTTPAPISpecReference api_specs = 2 [(google.api.field_behavior) = REQUIRED];
}

View File

@@ -0,0 +1,30 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: mixer/v1/config/client/api_spec.proto
package client
import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
_ "istio.io/api/mixer/v1"
_ "istio.io/gogo-genproto/googleapis/google/api"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// DeepCopyInto supports using HTTPAPISpec within kubernetes types, where deepcopy-gen is used.
func (in *HTTPAPISpec) DeepCopyInto(out *HTTPAPISpec) {
p := proto.Clone(in).(*HTTPAPISpec)
*out = *p
}
// DeepCopyInto supports using HTTPAPISpecBinding within kubernetes types, where deepcopy-gen is used.
func (in *HTTPAPISpecBinding) DeepCopyInto(out *HTTPAPISpecBinding) {
p := proto.Clone(in).(*HTTPAPISpecBinding)
*out = *p
}

View File

@@ -0,0 +1,80 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: mixer/v1/config/client/api_spec.proto
package client
import (
bytes "bytes"
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
proto "github.com/gogo/protobuf/proto"
_ "istio.io/api/mixer/v1"
_ "istio.io/gogo-genproto/googleapis/google/api"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// MarshalJSON is a custom marshaler for HTTPAPISpec
func (this *HTTPAPISpec) MarshalJSON() ([]byte, error) {
str, err := ApiSpecMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for HTTPAPISpec
func (this *HTTPAPISpec) UnmarshalJSON(b []byte) error {
return ApiSpecUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for HTTPAPISpecPattern
func (this *HTTPAPISpecPattern) MarshalJSON() ([]byte, error) {
str, err := ApiSpecMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for HTTPAPISpecPattern
func (this *HTTPAPISpecPattern) UnmarshalJSON(b []byte) error {
return ApiSpecUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for APIKey
func (this *APIKey) MarshalJSON() ([]byte, error) {
str, err := ApiSpecMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for APIKey
func (this *APIKey) UnmarshalJSON(b []byte) error {
return ApiSpecUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for HTTPAPISpecReference
func (this *HTTPAPISpecReference) MarshalJSON() ([]byte, error) {
str, err := ApiSpecMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for HTTPAPISpecReference
func (this *HTTPAPISpecReference) UnmarshalJSON(b []byte) error {
return ApiSpecUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for HTTPAPISpecBinding
func (this *HTTPAPISpecBinding) MarshalJSON() ([]byte, error) {
str, err := ApiSpecMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for HTTPAPISpecBinding
func (this *HTTPAPISpecBinding) UnmarshalJSON(b []byte) error {
return ApiSpecUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
var (
ApiSpecMarshaler = &github_com_gogo_protobuf_jsonpb.Marshaler{}
ApiSpecUnmarshaler = &github_com_gogo_protobuf_jsonpb.Unmarshaler{}
)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,219 @@
// Copyright 2017 Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "mixer/v1/attributes.proto";
import "mixer/v1/config/client/api_spec.proto";
import "mixer/v1/config/client/quota.proto";
// $title: Mixer Client
// $description: Configuration state for the Mixer client library.
// $location: https://istio.io/docs/reference/config/policy-and-telemetry/istio.mixer.v1.config.client
// Describes the configuration state for the Mixer client library that's built into Envoy.
package istio.mixer.v1.config.client;
option go_package = "istio.io/api/mixer/v1/config/client";
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.equal_all) = false;
option (gogoproto.gostring_all) = false;
option (gogoproto.stable_marshaler_all) = true;
// Specifies the behavior when the client is unable to connect to Mixer.
message NetworkFailPolicy {
// Describes the policy.
enum FailPolicy {
// If network connection fails, request is allowed and delivered to the
// service.
FAIL_OPEN = 0;
// If network connection fails, request is rejected.
FAIL_CLOSE = 1;
}
// Specifies the behavior when the client is unable to connect to Mixer.
FailPolicy policy = 1;
// Max retries on transport error.
uint32 max_retry = 2;
// Base time to wait between retries. Will be adjusted by exponential
// backoff and jitter.
google.protobuf.Duration base_retry_wait = 3;
// Max time to wait between retries.
google.protobuf.Duration max_retry_wait = 4;
}
// Defines the per-service client configuration.
message ServiceConfig {
// If true, do not call Mixer Check.
bool disable_check_calls = 1;
// If true, do not call Mixer Report.
bool disable_report_calls = 2;
// Send these attributes to Mixer in both Check and Report. This
// typically includes the "destination.service" attribute.
// In case of a per-route override, per-route attributes take precedence
// over the attributes supplied in the client configuration.
Attributes mixer_attributes = 3;
// HTTP API specifications to generate API attributes.
repeated HTTPAPISpec http_api_spec = 4;
// Quota specifications to generate quota requirements.
repeated QuotaSpec quota_spec = 5;
// Specifies the behavior when the client is unable to connect to Mixer.
// This is the service-level policy. It overrides
// [mesh-level
// policy][istio.mixer.v1.config.client.TransportConfig.network_fail_policy].
NetworkFailPolicy network_fail_policy = 7;
// Default attributes to forward to upstream. This typically
// includes the "source.ip" and "source.uid" attributes.
// In case of a per-route override, per-route attributes take precedence
// over the attributes supplied in the client configuration.
//
// Forwarded attributes take precedence over the static Mixer attributes,
// except in cases where there is clear configuration to ignore forwarded
// attributes. Gateways, for instance, should never use forwarded attributes.
//
// The full order of application is as follows:
// 1. static Mixer attributes from the filter config;
// 2. static Mixer attributes from the route config;
// 3. forwarded attributes from the source filter config (if any and not ignored);
// 4. forwarded attributes from the source route config (if any and not ignored);
// 5. derived attributes from the request metadata.
Attributes forward_attributes = 8;
}
// Defines the transport config on how to call Mixer.
message TransportConfig {
// The flag to disable check cache.
bool disable_check_cache = 1;
// The flag to disable quota cache.
bool disable_quota_cache = 2;
// The flag to disable report batch.
bool disable_report_batch = 3;
// Specifies the behavior when the client is unable to connect to Mixer.
// This is the mesh level policy. The default value for policy is FAIL_OPEN.
NetworkFailPolicy network_fail_policy = 4;
// Specify refresh interval to write Mixer client statistics to Envoy share
// memory. If not specified, the interval is 10 seconds.
google.protobuf.Duration stats_update_interval = 5;
// Name of the cluster that will forward check calls to a pool of mixer
// servers. Defaults to "mixer_server". By using different names for
// checkCluster and reportCluster, it is possible to have one set of
// Mixer servers handle check calls, while another set of Mixer servers
// handle report calls.
//
// NOTE: Any value other than the default "mixer_server" will require the
// Istio Grafana dashboards to be reconfigured to use the new name.
string check_cluster = 6;
// Name of the cluster that will forward report calls to a pool of mixer
// servers. Defaults to "mixer_server". By using different names for
// checkCluster and reportCluster, it is possible to have one set of
// Mixer servers handle check calls, while another set of Mixer servers
// handle report calls.
//
// NOTE: Any value other than the default "mixer_server" will require the
// Istio Grafana dashboards to be reconfigured to use the new name.
string report_cluster = 7;
// Default attributes to forward to Mixer upstream. This typically
// includes the "source.ip" and "source.uid" attributes. These
// attributes are consumed by the proxy in front of mixer.
Attributes attributes_for_mixer_proxy = 8;
// When disable_report_batch is false, this value specifies the maximum number
// of requests that are batched in report. If left unspecified, the default value
// of report_batch_max_entries == 0 will use the hardcoded defaults of
// istio::mixerclient::ReportOptions.
uint32 report_batch_max_entries = 9;
// When disable_report_batch is false, this value specifies the maximum elapsed
// time a batched report will be sent after a user request is processed. If left
// unspecified, the default report_batch_max_time == 0 will use the hardcoded
// defaults of istio::mixerclient::ReportOptions.
google.protobuf.Duration report_batch_max_time = 10;
}
// Defines the client config for HTTP.
message HttpClientConfig {
// The transport config.
TransportConfig transport = 1;
// Map of control configuration indexed by destination.service. This
// is used to support per-service configuration for cases where a
// mixerclient serves multiple services.
map<string, ServiceConfig> service_configs = 2;
// Default destination service name if none was specified in the
// client request.
string default_destination_service = 3;
// Default attributes to send to Mixer in both Check and
// Report. This typically includes "destination.ip" and
// "destination.uid" attributes.
Attributes mixer_attributes = 4;
// Default attributes to forward to upstream. This typically
// includes the "source.ip" and "source.uid" attributes.
Attributes forward_attributes = 5;
// Whether or not to use attributes forwarded in the request headers to
// create the attribute bag to send to mixer. For intra-mesh traffic,
// this should be set to "false". For ingress/egress gateways, this
// should be set to "true".
bool ignore_forwarded_attributes = 6;
}
// Defines the client config for TCP.
message TcpClientConfig {
// The transport config.
TransportConfig transport = 1;
// Default attributes to send to Mixer in both Check and
// Report. This typically includes "destination.ip" and
// "destination.uid" attributes.
Attributes mixer_attributes = 2;
// If set to true, disables Mixer check calls.
bool disable_check_calls = 3;
// If set to true, disables Mixer check calls.
bool disable_report_calls = 4;
// Quota specifications to generate quota requirements.
// It applies on the new TCP connections.
QuotaSpec connection_quota_spec = 5;
// Specify report interval to send periodical reports for long TCP
// connections. If not specified, the interval is 10 seconds. This interval
// should not be less than 1 second, otherwise it will be reset to 1 second.
google.protobuf.Duration report_interval = 6;
}

View File

@@ -0,0 +1,82 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: mixer/v1/config/client/client_config.proto
// Describes the configuration state for the Mixer client library that's built into Envoy.
package client
import (
bytes "bytes"
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
proto "github.com/gogo/protobuf/proto"
_ "github.com/gogo/protobuf/types"
_ "istio.io/api/mixer/v1"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// MarshalJSON is a custom marshaler for NetworkFailPolicy
func (this *NetworkFailPolicy) MarshalJSON() ([]byte, error) {
str, err := ClientConfigMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for NetworkFailPolicy
func (this *NetworkFailPolicy) UnmarshalJSON(b []byte) error {
return ClientConfigUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for ServiceConfig
func (this *ServiceConfig) MarshalJSON() ([]byte, error) {
str, err := ClientConfigMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for ServiceConfig
func (this *ServiceConfig) UnmarshalJSON(b []byte) error {
return ClientConfigUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for TransportConfig
func (this *TransportConfig) MarshalJSON() ([]byte, error) {
str, err := ClientConfigMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for TransportConfig
func (this *TransportConfig) UnmarshalJSON(b []byte) error {
return ClientConfigUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for HttpClientConfig
func (this *HttpClientConfig) MarshalJSON() ([]byte, error) {
str, err := ClientConfigMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for HttpClientConfig
func (this *HttpClientConfig) UnmarshalJSON(b []byte) error {
return ClientConfigUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for TcpClientConfig
func (this *TcpClientConfig) MarshalJSON() ([]byte, error) {
str, err := ClientConfigMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for TcpClientConfig
func (this *TcpClientConfig) UnmarshalJSON(b []byte) error {
return ClientConfigUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
var (
ClientConfigMarshaler = &github_com_gogo_protobuf_jsonpb.Marshaler{}
ClientConfigUnmarshaler = &github_com_gogo_protobuf_jsonpb.Unmarshaler{}
)

View File

@@ -0,0 +1,626 @@
{
"openapi": "3.0.0",
"info": {
"title": "Configuration state for the Mixer client library.",
"version": "client"
},
"components": {
"schemas": {
"istio.mixer.v1.config.client.HTTPAPISpec": {
"description": "HTTPAPISpec defines the canonical configuration for generating API-related attributes from HTTP requests based on the method and uri templated path matches. It is sufficient for defining the API surface of a service for the purposes of API attribute generation. It is not intended to represent auth, quota, documentation, or other information commonly found in other API specifications, e.g. OpenAPI.",
"type": "object",
"properties": {
"attributes": {
"$ref": "#/components/schemas/istio.mixer.v1.Attributes"
},
"patterns": {
"description": "List of HTTP patterns to match.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.HTTPAPISpecPattern"
}
},
"apiKeys": {
"description": "List of APIKey that describes how to extract an API-KEY from an HTTP request. The first API-Key match found in the list is used, i.e. 'OR' semantics.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.APIKey"
}
}
}
},
"istio.mixer.v1.config.client.HTTPAPISpecPattern": {
"description": "HTTPAPISpecPattern defines a single pattern to match against incoming HTTP requests. The per-pattern list of attributes is generated if both the http_method and uri_template match. In addition, the top-level list of attributes in the HTTPAPISpec is also generated.",
"type": "object",
"oneOf": [
{
"required": [
"uriTemplate"
],
"properties": {
"attributes": {
"$ref": "#/components/schemas/istio.mixer.v1.Attributes"
},
"httpMethod": {
"description": "HTTP request method to match against as defined by [rfc7231](https://tools.ietf.org/html/rfc7231#page-21). For example: GET, HEAD, POST, PUT, DELETE.",
"type": "string",
"format": "string"
},
"uriTemplate": {
"description": "URI template to match against as defined by [rfc6570](https://tools.ietf.org/html/rfc6570). For example, the following are valid URI templates: /pets /pets/{id} /dictionary/{term:1}/{term} /search{?q*,lang}",
"type": "string",
"format": "string"
}
}
},
{
"required": [
"regex"
],
"properties": {
"attributes": {
"$ref": "#/components/schemas/istio.mixer.v1.Attributes"
},
"regex": {
"description": "EXPERIMENTAL: ecmascript style regex-based match as defined by [EDCA-262](http://en.cppreference.com/w/cpp/regex/ecmascript). For example,",
"type": "string",
"format": "string"
},
"httpMethod": {
"description": "HTTP request method to match against as defined by [rfc7231](https://tools.ietf.org/html/rfc7231#page-21). For example: GET, HEAD, POST, PUT, DELETE.",
"type": "string",
"format": "string"
}
}
}
]
},
"istio.mixer.v1.config.client.APIKey": {
"description": "APIKey defines the explicit configuration for generating the `request.api_key` attribute from HTTP requests.",
"type": "object",
"oneOf": [
{
"required": [
"query"
],
"properties": {
"query": {
"description": "API Key is sent as a query parameter. `query` represents the query string parameter name.",
"type": "string",
"format": "string"
}
}
},
{
"required": [
"header"
],
"properties": {
"header": {
"description": "API key is sent in a request header. `header` represents the header name.",
"type": "string",
"format": "string"
}
}
},
{
"required": [
"cookie"
],
"properties": {
"cookie": {
"description": "API key is sent in a [cookie](https://swagger.io/docs/specification/authentication/cookie-authentication),",
"type": "string",
"format": "string"
}
}
}
]
},
"istio.mixer.v1.config.client.HTTPAPISpecReference": {
"description": "HTTPAPISpecReference defines a reference to an HTTPAPISpec. This is typically used for establishing bindings between an HTTPAPISpec and an IstioService. For example, the following defines an HTTPAPISpecReference for service `foo` in namespace `bar`.",
"type": "object",
"properties": {
"name": {
"description": "The short name of the HTTPAPISpec. This is the resource name defined by the metadata name field.",
"type": "string",
"format": "string"
},
"namespace": {
"description": "Optional namespace of the HTTPAPISpec. Defaults to the encompassing HTTPAPISpecBinding's metadata namespace field.",
"type": "string",
"format": "string"
}
}
},
"istio.mixer.v1.config.client.HTTPAPISpecBinding": {
"description": "HTTPAPISpecBinding defines the binding between HTTPAPISpecs and one or more IstioService. For example, the following establishes a binding between the HTTPAPISpec `petstore` and service `foo` in namespace `bar`.",
"type": "object",
"properties": {
"services": {
"description": "One or more services to map the listed HTTPAPISpec onto.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.IstioService"
}
},
"apiSpecs": {
"description": "One or more HTTPAPISpec references that should be mapped to the specified service(s). The aggregate collection of match conditions defined in the HTTPAPISpecs should not overlap.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.HTTPAPISpecReference"
}
}
}
},
"istio.mixer.v1.config.client.IstioService": {
"description": "IstioService identifies a service and optionally service version. The FQDN of the service is composed from the name, namespace, and implementation-specific domain suffix (e.g. on Kubernetes, \"reviews\" + \"default\" + \"svc.cluster.local\" -\u003e \"reviews.default.svc.cluster.local\").",
"type": "object",
"properties": {
"name": {
"description": "The short name of the service such as \"foo\".",
"type": "string",
"format": "string"
},
"namespace": {
"description": "Optional namespace of the service. Defaults to value of metadata namespace field.",
"type": "string",
"format": "string"
},
"domain": {
"description": "Domain suffix used to construct the service FQDN in implementations that support such specification.",
"type": "string",
"format": "string"
},
"service": {
"description": "The service FQDN.",
"type": "string",
"format": "string"
},
"labels": {
"description": "Optional one or more labels that uniquely identify the service version.",
"type": "object",
"additionalProperties": {
"type": "string",
"format": "string"
}
}
}
},
"istio.mixer.v1.config.client.NetworkFailPolicy": {
"description": "Specifies the behavior when the client is unable to connect to Mixer.",
"type": "object",
"properties": {
"policy": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.NetworkFailPolicy.FailPolicy"
},
"maxRetry": {
"description": "Max retries on transport error.",
"type": "integer"
},
"baseRetryWait": {
"description": "Base time to wait between retries. Will be adjusted by exponential backoff and jitter.",
"type": "string"
},
"maxRetryWait": {
"description": "Max time to wait between retries.",
"type": "string"
}
}
},
"istio.mixer.v1.config.client.NetworkFailPolicy.FailPolicy": {
"description": "Describes the policy.",
"type": "string",
"enum": [
"FAIL_OPEN",
"FAIL_CLOSE"
]
},
"istio.mixer.v1.config.client.ServiceConfig": {
"description": "Defines the per-service client configuration.",
"type": "object",
"properties": {
"disableCheckCalls": {
"description": "If true, do not call Mixer Check.",
"type": "boolean"
},
"disableReportCalls": {
"description": "If true, do not call Mixer Report.",
"type": "boolean"
},
"mixerAttributes": {
"$ref": "#/components/schemas/istio.mixer.v1.Attributes"
},
"httpApiSpec": {
"description": "HTTP API specifications to generate API attributes.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.HTTPAPISpec"
}
},
"quotaSpec": {
"description": "Quota specifications to generate quota requirements.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.QuotaSpec"
}
},
"networkFailPolicy": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.NetworkFailPolicy"
},
"forwardAttributes": {
"$ref": "#/components/schemas/istio.mixer.v1.Attributes"
}
}
},
"istio.mixer.v1.config.client.QuotaSpec": {
"description": "Determines the quotas used for individual requests.",
"type": "object",
"properties": {
"rules": {
"description": "A list of Quota rules.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.QuotaRule"
}
}
}
},
"istio.mixer.v1.config.client.TransportConfig": {
"description": "Defines the transport config on how to call Mixer.",
"type": "object",
"properties": {
"networkFailPolicy": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.NetworkFailPolicy"
},
"disableCheckCache": {
"description": "The flag to disable check cache.",
"type": "boolean"
},
"disableQuotaCache": {
"description": "The flag to disable quota cache.",
"type": "boolean"
},
"disableReportBatch": {
"description": "The flag to disable report batch.",
"type": "boolean"
},
"statsUpdateInterval": {
"description": "Specify refresh interval to write Mixer client statistics to Envoy share memory. If not specified, the interval is 10 seconds.",
"type": "string"
},
"checkCluster": {
"description": "Name of the cluster that will forward check calls to a pool of mixer servers. Defaults to \"mixer_server\". By using different names for checkCluster and reportCluster, it is possible to have one set of Mixer servers handle check calls, while another set of Mixer servers handle report calls.",
"type": "string",
"format": "string"
},
"reportCluster": {
"description": "Name of the cluster that will forward report calls to a pool of mixer servers. Defaults to \"mixer_server\". By using different names for checkCluster and reportCluster, it is possible to have one set of Mixer servers handle check calls, while another set of Mixer servers handle report calls.",
"type": "string",
"format": "string"
},
"attributesForMixerProxy": {
"$ref": "#/components/schemas/istio.mixer.v1.Attributes"
},
"reportBatchMaxEntries": {
"description": "When disable_report_batch is false, this value specifies the maximum number of requests that are batched in report. If left unspecified, the default value of report_batch_max_entries == 0 will use the hardcoded defaults of istio::mixerclient::ReportOptions.",
"type": "integer"
},
"reportBatchMaxTime": {
"description": "When disable_report_batch is false, this value specifies the maximum elapsed time a batched report will be sent after a user request is processed. If left unspecified, the default report_batch_max_time == 0 will use the hardcoded defaults of istio::mixerclient::ReportOptions.",
"type": "string"
}
}
},
"istio.mixer.v1.config.client.HttpClientConfig": {
"description": "Defines the client config for HTTP.",
"type": "object",
"properties": {
"mixerAttributes": {
"$ref": "#/components/schemas/istio.mixer.v1.Attributes"
},
"forwardAttributes": {
"$ref": "#/components/schemas/istio.mixer.v1.Attributes"
},
"transport": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.TransportConfig"
},
"serviceConfigs": {
"description": "Map of control configuration indexed by destination.service. This is used to support per-service configuration for cases where a mixerclient serves multiple services.",
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.ServiceConfig"
}
},
"defaultDestinationService": {
"description": "Default destination service name if none was specified in the client request.",
"type": "string",
"format": "string"
},
"ignoreForwardedAttributes": {
"description": "Whether or not to use attributes forwarded in the request headers to create the attribute bag to send to mixer. For intra-mesh traffic, this should be set to \"false\". For ingress/egress gateways, this should be set to \"true\".",
"type": "boolean"
}
}
},
"istio.mixer.v1.config.client.TcpClientConfig": {
"description": "Defines the client config for TCP.",
"type": "object",
"properties": {
"disableCheckCalls": {
"description": "If set to true, disables Mixer check calls.",
"type": "boolean"
},
"disableReportCalls": {
"description": "If set to true, disables Mixer check calls.",
"type": "boolean"
},
"mixerAttributes": {
"$ref": "#/components/schemas/istio.mixer.v1.Attributes"
},
"transport": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.TransportConfig"
},
"connectionQuotaSpec": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.QuotaSpec"
},
"reportInterval": {
"description": "Specify report interval to send periodical reports for long TCP connections. If not specified, the interval is 10 seconds. This interval should not be less than 1 second, otherwise it will be reset to 1 second.",
"type": "string"
}
}
},
"istio.mixer.v1.config.client.QuotaRule": {
"description": "Specifies a rule with list of matches and list of quotas. If any clause matched, the list of quotas will be used.",
"type": "object",
"properties": {
"quotas": {
"description": "The list of quotas to charge.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.Quota"
}
},
"match": {
"description": "If empty, match all request. If any of match is true, it is matched.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.AttributeMatch"
}
}
}
},
"istio.mixer.v1.config.client.AttributeMatch": {
"description": "Specifies a match clause to match Istio attributes",
"type": "object",
"properties": {
"clause": {
"description": "Map of attribute names to StringMatch type. Each map element specifies one condition to match.",
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.StringMatch"
}
}
}
},
"istio.mixer.v1.config.client.Quota": {
"description": "Specifies a quota to use with quota name and amount.",
"type": "object",
"properties": {
"quota": {
"description": "The quota name to charge",
"type": "string",
"format": "string"
},
"charge": {
"description": "The quota amount to charge",
"type": "integer",
"format": "int32"
}
}
},
"istio.mixer.v1.config.client.StringMatch": {
"description": "Describes how to match a given string in HTTP headers. Match is case-sensitive.",
"type": "object",
"oneOf": [
{
"required": [
"exact"
],
"properties": {
"exact": {
"description": "exact string match",
"type": "string",
"format": "string"
}
}
},
{
"required": [
"prefix"
],
"properties": {
"prefix": {
"description": "prefix-based match",
"type": "string",
"format": "string"
}
}
},
{
"required": [
"regex"
],
"properties": {
"regex": {
"description": "ECMAscript style regex-based match",
"type": "string",
"format": "string"
}
}
}
]
},
"istio.mixer.v1.config.client.QuotaSpecBinding": {
"description": "QuotaSpecBinding defines the binding between QuotaSpecs and one or more IstioService.",
"type": "object",
"properties": {
"services": {
"description": "One or more services to map the listed QuotaSpec onto.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.IstioService"
}
},
"quotaSpecs": {
"description": "One or more QuotaSpec references that should be mapped to the specified service(s). The aggregate collection of match conditions defined in the QuotaSpecs should not overlap.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.mixer.v1.config.client.QuotaSpecBinding.QuotaSpecReference"
}
}
}
},
"istio.mixer.v1.config.client.QuotaSpecBinding.QuotaSpecReference": {
"description": "QuotaSpecReference uniquely identifies the QuotaSpec used in the Binding.",
"type": "object",
"properties": {
"name": {
"description": "The short name of the QuotaSpec. This is the resource name defined by the metadata name field.",
"type": "string",
"format": "string"
},
"namespace": {
"description": "Optional namespace of the QuotaSpec. Defaults to the value of the metadata namespace field.",
"type": "string",
"format": "string"
}
}
},
"istio.mixer.v1.Attributes": {
"description": "Default attributes to send to Mixer in both Check and Report. This typically includes \"destination.ip\" and \"destination.uid\" attributes.",
"type": "object",
"properties": {
"attributes": {
"description": "A map of attribute name to its value.",
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/istio.mixer.v1.Attributes.AttributeValue"
}
}
}
},
"istio.mixer.v1.Attributes.AttributeValue": {
"type": "object",
"oneOf": [
{
"required": [
"stringValue"
],
"properties": {
"stringValue": {
"description": "Used for values of type STRING, DNS_NAME, EMAIL_ADDRESS, and URI",
"type": "string",
"format": "string"
}
}
},
{
"required": [
"int64Value"
],
"properties": {
"int64Value": {
"description": "Used for values of type INT64",
"type": "integer",
"format": "int64"
}
}
},
{
"required": [
"doubleValue"
],
"properties": {
"doubleValue": {
"description": "Used for values of type DOUBLE",
"type": "number",
"format": "double"
}
}
},
{
"required": [
"boolValue"
],
"properties": {
"boolValue": {
"description": "Used for values of type BOOL",
"type": "boolean"
}
}
},
{
"required": [
"bytesValue"
],
"properties": {
"bytesValue": {
"description": "Used for values of type BYTES",
"type": "string",
"format": "binary"
}
}
},
{
"required": [
"timestampValue"
],
"properties": {
"timestampValue": {
"description": "Used for values of type TIMESTAMP",
"type": "string",
"format": "dateTime"
}
}
},
{
"required": [
"durationValue"
],
"properties": {
"durationValue": {
"description": "Used for values of type DURATION",
"type": "string"
}
}
},
{
"required": [
"stringMapValue"
],
"properties": {
"stringMapValue": {
"$ref": "#/components/schemas/istio.mixer.v1.Attributes.StringMap"
}
}
}
]
},
"istio.mixer.v1.Attributes.StringMap": {
"description": "Used for values of type STRING_MAP",
"type": "object",
"properties": {
"entries": {
"description": "Holds a set of name/value pairs.",
"type": "object",
"additionalProperties": {
"type": "string",
"format": "string"
}
}
}
}
}
}
}

File diff suppressed because it is too large Load Diff

2065
vendor/istio.io/api/mixer/v1/config/client/quota.pb.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

160
vendor/istio.io/api/mixer/v1/config/client/quota.proto generated vendored Normal file
View File

@@ -0,0 +1,160 @@
// Copyright 2017 Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package istio.mixer.v1.config.client;
option go_package="istio.io/api/mixer/v1/config/client";
import "gogoproto/gogo.proto";
import "google/api/field_behavior.proto";
import "mixer/v1/config/client/service.proto";
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.equal_all) = false;
option (gogoproto.gostring_all) = false;
option (gogoproto.stable_marshaler_all) = true;
// Specifies runtime quota rules.
// * Uses Istio attributes to match individual requests
// * Specifies list of quotas to use for matched requests.
//
// Example1:
// Charge "request_count" quota with 1 amount for all requests.
//
// QuotaSpec:
// - rules
// - quotas:
// quota: request_count
// charge: 1
//
// Example2:
// For HTTP POST requests with path are prefixed with /books or
// api.operation is create_books, charge two quotas:
// * write_count of 1 amount
// * request_count of 5 amount.
//
// ```yaml
// QuotaSpec:
// - rules:
// - match:
// clause:
// request.path:
// string_prefix: /books
// request.http_method:
// string_exact: POST
// - match:
// clause:
// api.operation:
// string_exact: create_books
// - quotas:
// quota: write_count
// charge: 1
// - quotas:
// quota: request_count
// charge: 5
// ```
// Determines the quotas used for individual requests.
//
// <!-- go code generation tags
// +kubetype-gen
// +kubetype-gen:groupVersion=config.istio.io/v1alpha2
// +genclient
// +k8s:deepcopy-gen=true
// -->
message QuotaSpec {
// A list of Quota rules.
repeated QuotaRule rules = 1;
}
// Specifies a rule with list of matches and list of quotas.
// If any clause matched, the list of quotas will be used.
message QuotaRule {
// If empty, match all request.
// If any of match is true, it is matched.
repeated AttributeMatch match = 1;
// The list of quotas to charge.
repeated Quota quotas = 2;
}
// Describes how to match a given string in HTTP headers. Match is
// case-sensitive.
message StringMatch {
oneof match_type {
// exact string match
string exact = 1;
// prefix-based match
string prefix = 2;
// ECMAscript style regex-based match
string regex = 3;
}
}
// Specifies a match clause to match Istio attributes
message AttributeMatch {
// Map of attribute names to StringMatch type.
// Each map element specifies one condition to match.
//
// Example:
//
// clause:
// source.uid:
// exact: SOURCE_UID
// request.http_method:
// exact: POST
map<string, StringMatch> clause = 1;
}
// Specifies a quota to use with quota name and amount.
message Quota {
// The quota name to charge
string quota = 1;
// The quota amount to charge
int32 charge = 2;
}
// QuotaSpecBinding defines the binding between QuotaSpecs and one or more
// IstioService.
//
// <!-- go code generation tags
// +kubetype-gen
// +kubetype-gen:groupVersion=config.istio.io/v1alpha2
// +genclient
// +k8s:deepcopy-gen=true
// -->
message QuotaSpecBinding {
// One or more services to map the listed QuotaSpec onto.
repeated IstioService services = 1 [(google.api.field_behavior) = REQUIRED];
// QuotaSpecReference uniquely identifies the QuotaSpec used in the
// Binding.
message QuotaSpecReference {
// The short name of the QuotaSpec. This is the resource
// name defined by the metadata name field.
string name = 1 [(google.api.field_behavior) = REQUIRED];
// Optional namespace of the QuotaSpec. Defaults to the value of the
// metadata namespace field.
string namespace = 2;
}
// One or more QuotaSpec references that should be mapped to
// the specified service(s). The aggregate collection of match
// conditions defined in the QuotaSpecs should not overlap.
repeated QuotaSpecReference quota_specs = 2 [(google.api.field_behavior) = REQUIRED];
}

View File

@@ -0,0 +1,29 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: mixer/v1/config/client/quota.proto
package client
import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
_ "istio.io/gogo-genproto/googleapis/google/api"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// DeepCopyInto supports using QuotaSpec within kubernetes types, where deepcopy-gen is used.
func (in *QuotaSpec) DeepCopyInto(out *QuotaSpec) {
p := proto.Clone(in).(*QuotaSpec)
*out = *p
}
// DeepCopyInto supports using QuotaSpecBinding within kubernetes types, where deepcopy-gen is used.
func (in *QuotaSpecBinding) DeepCopyInto(out *QuotaSpecBinding) {
p := proto.Clone(in).(*QuotaSpecBinding)
*out = *p
}

View File

@@ -0,0 +1,101 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: mixer/v1/config/client/quota.proto
package client
import (
bytes "bytes"
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
proto "github.com/gogo/protobuf/proto"
_ "istio.io/gogo-genproto/googleapis/google/api"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// MarshalJSON is a custom marshaler for QuotaSpec
func (this *QuotaSpec) MarshalJSON() ([]byte, error) {
str, err := QuotaMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for QuotaSpec
func (this *QuotaSpec) UnmarshalJSON(b []byte) error {
return QuotaUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for QuotaRule
func (this *QuotaRule) MarshalJSON() ([]byte, error) {
str, err := QuotaMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for QuotaRule
func (this *QuotaRule) UnmarshalJSON(b []byte) error {
return QuotaUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for StringMatch
func (this *StringMatch) MarshalJSON() ([]byte, error) {
str, err := QuotaMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for StringMatch
func (this *StringMatch) UnmarshalJSON(b []byte) error {
return QuotaUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for AttributeMatch
func (this *AttributeMatch) MarshalJSON() ([]byte, error) {
str, err := QuotaMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for AttributeMatch
func (this *AttributeMatch) UnmarshalJSON(b []byte) error {
return QuotaUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for Quota
func (this *Quota) MarshalJSON() ([]byte, error) {
str, err := QuotaMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for Quota
func (this *Quota) UnmarshalJSON(b []byte) error {
return QuotaUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for QuotaSpecBinding
func (this *QuotaSpecBinding) MarshalJSON() ([]byte, error) {
str, err := QuotaMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for QuotaSpecBinding
func (this *QuotaSpecBinding) UnmarshalJSON(b []byte) error {
return QuotaUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for QuotaSpecBinding_QuotaSpecReference
func (this *QuotaSpecBinding_QuotaSpecReference) MarshalJSON() ([]byte, error) {
str, err := QuotaMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for QuotaSpecBinding_QuotaSpecReference
func (this *QuotaSpecBinding_QuotaSpecReference) UnmarshalJSON(b []byte) error {
return QuotaUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
var (
QuotaMarshaler = &github_com_gogo_protobuf_jsonpb.Marshaler{}
QuotaUnmarshaler = &github_com_gogo_protobuf_jsonpb.Unmarshaler{}
)

View File

@@ -0,0 +1,683 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: mixer/v1/config/client/service.proto
package client
import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys"
io "io"
math "math"
math_bits "math/bits"
reflect "reflect"
strings "strings"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// IstioService identifies a service and optionally service version.
// The FQDN of the service is composed from the name, namespace, and implementation-specific domain suffix
// (e.g. on Kubernetes, "reviews" + "default" + "svc.cluster.local" -> "reviews.default.svc.cluster.local").
type IstioService struct {
// The short name of the service such as "foo".
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// Optional namespace of the service. Defaults to value of metadata namespace field.
Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"`
// Domain suffix used to construct the service FQDN in implementations that support such specification.
Domain string `protobuf:"bytes,3,opt,name=domain,proto3" json:"domain,omitempty"`
// The service FQDN.
Service string `protobuf:"bytes,4,opt,name=service,proto3" json:"service,omitempty"`
// Optional one or more labels that uniquely identify the service version.
//
// *Note:* When used for a VirtualService destination, labels MUST be empty.
//
Labels map[string]string `protobuf:"bytes,5,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (m *IstioService) Reset() { *m = IstioService{} }
func (*IstioService) ProtoMessage() {}
func (*IstioService) Descriptor() ([]byte, []int) {
return fileDescriptor_3358a28a51c817d5, []int{0}
}
func (m *IstioService) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *IstioService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
func (m *IstioService) XXX_Merge(src proto.Message) {
xxx_messageInfo_IstioService.Merge(m, src)
}
func (m *IstioService) XXX_Size() int {
return m.Size()
}
func (m *IstioService) XXX_DiscardUnknown() {
xxx_messageInfo_IstioService.DiscardUnknown(m)
}
var xxx_messageInfo_IstioService proto.InternalMessageInfo
func init() {
proto.RegisterType((*IstioService)(nil), "istio.mixer.v1.config.client.IstioService")
proto.RegisterMapType((map[string]string)(nil), "istio.mixer.v1.config.client.IstioService.LabelsEntry")
}
func init() {
proto.RegisterFile("mixer/v1/config/client/service.proto", fileDescriptor_3358a28a51c817d5)
}
var fileDescriptor_3358a28a51c817d5 = []byte{
// 318 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x51, 0x3f, 0x4b, 0x3b, 0x31,
0x18, 0x4e, 0xfa, 0xef, 0x47, 0xd3, 0xdf, 0x20, 0xa1, 0x48, 0x28, 0xe5, 0xa5, 0xa8, 0x43, 0xa7,
0x84, 0x2a, 0x88, 0x3a, 0x0a, 0x0e, 0x82, 0x38, 0xd4, 0xcd, 0x2d, 0x3d, 0x63, 0x09, 0x5e, 0x2f,
0xe5, 0xee, 0x3c, 0xec, 0xe6, 0x47, 0xf0, 0x63, 0xf8, 0x51, 0x3a, 0x76, 0xec, 0xe8, 0xe5, 0x16,
0xc7, 0x7e, 0x01, 0x41, 0x2e, 0xb9, 0x62, 0x07, 0x71, 0xca, 0xf3, 0xbc, 0xcf, 0xf3, 0xbc, 0x3c,
0x49, 0xc8, 0xd1, 0x4c, 0xbf, 0xa8, 0x58, 0x64, 0x23, 0x11, 0x98, 0xe8, 0x51, 0x4f, 0x45, 0x10,
0x6a, 0x15, 0xa5, 0x22, 0x51, 0x71, 0xa6, 0x03, 0xc5, 0xe7, 0xb1, 0x49, 0x0d, 0xed, 0xeb, 0x24,
0xd5, 0x86, 0x3b, 0x2f, 0xcf, 0x46, 0xdc, 0x7b, 0xb9, 0xf7, 0xf6, 0xba, 0x53, 0x33, 0x35, 0xce,
0x28, 0x4a, 0xe4, 0x33, 0x07, 0x5f, 0x98, 0xfc, 0xbf, 0x2e, 0x63, 0x77, 0x7e, 0x15, 0xa5, 0xa4,
0x11, 0xc9, 0x99, 0x62, 0x78, 0x80, 0x87, 0xed, 0xb1, 0xc3, 0xb4, 0x4f, 0xda, 0xe5, 0x99, 0xcc,
0x65, 0xa0, 0x58, 0xcd, 0x09, 0x3f, 0x03, 0xba, 0x4f, 0x5a, 0x0f, 0x66, 0x26, 0x75, 0xc4, 0xea,
0x4e, 0xaa, 0x18, 0x65, 0xe4, 0x5f, 0xd5, 0x8f, 0x35, 0x9c, 0xb0, 0xa5, 0xf4, 0x96, 0xb4, 0x42,
0x39, 0x51, 0x61, 0xc2, 0x9a, 0x83, 0xfa, 0xb0, 0x73, 0x7c, 0xca, 0xff, 0x6a, 0xce, 0x77, 0xfb,
0xf1, 0x1b, 0x17, 0xbc, 0x8a, 0xd2, 0x78, 0x31, 0xae, 0xb6, 0xf4, 0xce, 0x49, 0x67, 0x67, 0x4c,
0xf7, 0x48, 0xfd, 0x49, 0x2d, 0xaa, 0x1b, 0x94, 0x90, 0x76, 0x49, 0x33, 0x93, 0xe1, 0xf3, 0xb6,
0xbc, 0x27, 0x17, 0xb5, 0x33, 0x7c, 0x29, 0x97, 0x39, 0xa0, 0x55, 0x0e, 0x68, 0x9d, 0x03, 0xda,
0xe4, 0x80, 0x5e, 0x2d, 0xe0, 0x77, 0x0b, 0x68, 0x69, 0x01, 0xaf, 0x2c, 0xe0, 0xb5, 0x05, 0xfc,
0x61, 0x01, 0x7f, 0x5a, 0x40, 0x1b, 0x0b, 0xf8, 0xad, 0x00, 0xb4, 0x2a, 0x00, 0xad, 0x0b, 0x40,
0xf7, 0x87, 0xbe, 0xb7, 0x36, 0x42, 0xce, 0xb5, 0xf8, 0xfd, 0x93, 0x26, 0x2d, 0xf7, 0xd2, 0x27,
0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xab, 0x14, 0xde, 0x44, 0xc5, 0x01, 0x00, 0x00,
}
func (m *IstioService) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *IstioService) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *IstioService) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Labels) > 0 {
keysForLabels := make([]string, 0, len(m.Labels))
for k := range m.Labels {
keysForLabels = append(keysForLabels, string(k))
}
github_com_gogo_protobuf_sortkeys.Strings(keysForLabels)
for iNdEx := len(keysForLabels) - 1; iNdEx >= 0; iNdEx-- {
v := m.Labels[string(keysForLabels[iNdEx])]
baseI := i
i -= len(v)
copy(dAtA[i:], v)
i = encodeVarintService(dAtA, i, uint64(len(v)))
i--
dAtA[i] = 0x12
i -= len(keysForLabels[iNdEx])
copy(dAtA[i:], keysForLabels[iNdEx])
i = encodeVarintService(dAtA, i, uint64(len(keysForLabels[iNdEx])))
i--
dAtA[i] = 0xa
i = encodeVarintService(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x2a
}
}
if len(m.Service) > 0 {
i -= len(m.Service)
copy(dAtA[i:], m.Service)
i = encodeVarintService(dAtA, i, uint64(len(m.Service)))
i--
dAtA[i] = 0x22
}
if len(m.Domain) > 0 {
i -= len(m.Domain)
copy(dAtA[i:], m.Domain)
i = encodeVarintService(dAtA, i, uint64(len(m.Domain)))
i--
dAtA[i] = 0x1a
}
if len(m.Namespace) > 0 {
i -= len(m.Namespace)
copy(dAtA[i:], m.Namespace)
i = encodeVarintService(dAtA, i, uint64(len(m.Namespace)))
i--
dAtA[i] = 0x12
}
if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintService(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintService(dAtA []byte, offset int, v uint64) int {
offset -= sovService(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *IstioService) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Name)
if l > 0 {
n += 1 + l + sovService(uint64(l))
}
l = len(m.Namespace)
if l > 0 {
n += 1 + l + sovService(uint64(l))
}
l = len(m.Domain)
if l > 0 {
n += 1 + l + sovService(uint64(l))
}
l = len(m.Service)
if l > 0 {
n += 1 + l + sovService(uint64(l))
}
if len(m.Labels) > 0 {
for k, v := range m.Labels {
_ = k
_ = v
mapEntrySize := 1 + len(k) + sovService(uint64(len(k))) + 1 + len(v) + sovService(uint64(len(v)))
n += mapEntrySize + 1 + sovService(uint64(mapEntrySize))
}
}
return n
}
func sovService(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozService(x uint64) (n int) {
return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (this *IstioService) String() string {
if this == nil {
return "nil"
}
keysForLabels := make([]string, 0, len(this.Labels))
for k, _ := range this.Labels {
keysForLabels = append(keysForLabels, k)
}
github_com_gogo_protobuf_sortkeys.Strings(keysForLabels)
mapStringForLabels := "map[string]string{"
for _, k := range keysForLabels {
mapStringForLabels += fmt.Sprintf("%v: %v,", k, this.Labels[k])
}
mapStringForLabels += "}"
s := strings.Join([]string{`&IstioService{`,
`Name:` + fmt.Sprintf("%v", this.Name) + `,`,
`Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`,
`Domain:` + fmt.Sprintf("%v", this.Domain) + `,`,
`Service:` + fmt.Sprintf("%v", this.Service) + `,`,
`Labels:` + mapStringForLabels + `,`,
`}`,
}, "")
return s
}
func valueToStringService(v interface{}) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
return "nil"
}
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("*%v", pv)
}
func (m *IstioService) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: IstioService: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: IstioService: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Name = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Namespace = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Domain", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Domain = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Service", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Service = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Labels == nil {
m.Labels = make(map[string]string)
}
var mapkey string
var mapvalue string
for iNdEx < postIndex {
entryPreIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
if fieldNum == 1 {
var stringLenmapkey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLenmapkey |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLenmapkey := int(stringLenmapkey)
if intStringLenmapkey < 0 {
return ErrInvalidLengthService
}
postStringIndexmapkey := iNdEx + intStringLenmapkey
if postStringIndexmapkey < 0 {
return ErrInvalidLengthService
}
if postStringIndexmapkey > l {
return io.ErrUnexpectedEOF
}
mapkey = string(dAtA[iNdEx:postStringIndexmapkey])
iNdEx = postStringIndexmapkey
} else if fieldNum == 2 {
var stringLenmapvalue uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLenmapvalue |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLenmapvalue := int(stringLenmapvalue)
if intStringLenmapvalue < 0 {
return ErrInvalidLengthService
}
postStringIndexmapvalue := iNdEx + intStringLenmapvalue
if postStringIndexmapvalue < 0 {
return ErrInvalidLengthService
}
if postStringIndexmapvalue > l {
return io.ErrUnexpectedEOF
}
mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue])
iNdEx = postStringIndexmapvalue
} else {
iNdEx = entryPreIndex
skippy, err := skipService(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthService
}
if (iNdEx + skippy) > postIndex {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
m.Labels[mapkey] = mapvalue
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipService(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthService
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthService
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipService(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowService
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowService
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowService
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthService
}
iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthService
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowService
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipService(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthService
}
}
return iNdEx, nil
case 4:
return iNdEx, nil
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
}
panic("unreachable")
}
var (
ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowService = fmt.Errorf("proto: integer overflow")
)

View File

@@ -0,0 +1,58 @@
// Copyright 2017 Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package istio.mixer.v1.config.client;
option go_package="istio.io/api/mixer/v1/config/client";
import "gogoproto/gogo.proto";
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.equal_all) = false;
option (gogoproto.gostring_all) = false;
option (gogoproto.stable_marshaler_all) = true;
// NOTE: this is a duplicate of proxy.v1.config.IstioService from
// proxy/v1alpha1/config/route_rules.proto.
//
// Mixer protobufs have gogoproto specific options which are not
// compatiable with the proxy's vanilla protobufs. Ideally, these
// protobuf options be reconciled so fundamental Istio concepts and
// types can be shared by components. Until then, make a copy of
// IstioService for mixerclient to use.
// IstioService identifies a service and optionally service version.
// The FQDN of the service is composed from the name, namespace, and implementation-specific domain suffix
// (e.g. on Kubernetes, "reviews" + "default" + "svc.cluster.local" -> "reviews.default.svc.cluster.local").
message IstioService {
// The short name of the service such as "foo".
string name = 1;
// Optional namespace of the service. Defaults to value of metadata namespace field.
string namespace = 2;
// Domain suffix used to construct the service FQDN in implementations that support such specification.
string domain = 3;
// The service FQDN.
string service = 4;
// Optional one or more labels that uniquely identify the service version.
//
// *Note:* When used for a VirtualService destination, labels MUST be empty.
//
map<string, string> labels = 5;
}

View File

@@ -0,0 +1,34 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: mixer/v1/config/client/service.proto
package client
import (
bytes "bytes"
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
proto "github.com/gogo/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// MarshalJSON is a custom marshaler for IstioService
func (this *IstioService) MarshalJSON() ([]byte, error) {
str, err := ServiceMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for IstioService
func (this *IstioService) UnmarshalJSON(b []byte) error {
return ServiceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
var (
ServiceMarshaler = &github_com_gogo_protobuf_jsonpb.Marshaler{}
ServiceUnmarshaler = &github_com_gogo_protobuf_jsonpb.Unmarshaler{}
)

321
vendor/istio.io/api/mixer/v1/global_dictionary.yaml generated vendored Normal file
View File

@@ -0,0 +1,321 @@
# Copyright 2017 Istio Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
#
#
# This is the global dictionary used by mixer client and server
# for sending mixer attributes.
#
# The main reason using yaml format is that it allows comments like this.
#
# Important update rules:
# * never remove, only add words at the end of file.
# * http headers should be lower case.
# * not duplication, all words have to be unique.
#
# Tools:
# 1) It can be converted to json by:
# python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), \
# sys.stdout, indent=4)' < global_dictionary.yaml
#
# 2) Use this to detect uniqueness and print out duplication:
# python -c 'import yaml, collections; print [item for item, count in \
# collections.Counter(yaml.load(open("global_dictionary.yaml"))).items() if count > 1]'
#
# Section 1: Standard Istio attribute vocabulary
# https://istio.io/docs/reference/config/mixer/attribute-vocabulary.html
- source.ip
- source.port
- source.name
- source.uid
- source.namespace
- source.labels
# source.user is to be deprecated, please refer to the attribute source.principal
- source.user
# target.* attributes have been renamed to destination.*
# They cannot be removed from this append only dictionary.
- target.ip
- target.port
- target.service
- target.name
- target.uid
- target.namespace
- target.labels
- target.user
- request.headers
- request.id
- request.path
- request.host
- request.method
- request.reason
- request.referer
- request.scheme
- request.size
- request.time
- request.useragent
- response.headers
- response.size
- response.time
- response.duration
- response.code
# Section 2: HTTP common headers extracted from
# https://tools.ietf.org/html/rfc7541#appendix-A
- :authority
- :method
- :path
- :scheme
- :status
- access-control-allow-origin
- access-control-allow-methods
- access-control-allow-headers
- access-control-max-age
- access-control-request-method
- access-control-request-headers
- accept-charset
- accept-encoding
- accept-language
- accept-ranges
- accept
- access-control-allow
- age
- allow
- authorization
- cache-control
- content-disposition
- content-encoding
- content-language
- content-length
- content-location
- content-range
- content-type
- cookie
- date
- etag
- expect
- expires
- from
- host
- if-match
- if-modified-since
- if-none-match
- if-range
- if-unmodified-since
- keep-alive
- last-modified
- link
- location
- max-forwards
- proxy-authenticate
- proxy-authorization
- range
- referer
- refresh
- retry-after
- server
- set-cookie
- strict-transport-sec
- transfer-encoding
- user-agent
- vary
- via
- www-authenticate
# HTTP methods
- GET
- POST
# Common strings
- http
- envoy
- '200'
- Keep-Alive
- chunked
- x-envoy-service-time
- x-forwarded-for
- x-forwarded-host
- x-forwarded-proto
- x-http-method-override
- x-request-id
- x-requested-with
# Popular content-type
- application/json
- application/xml
- gzip
- text/html
- text/html; charset=utf-8
- text/plain
- text/plain; charset=utf-8
# common strings
- '0'
- '1'
- true
- false
- gzip, deflate
- max-age=0
- x-envoy-upstream-service-time
- x-envoy-internal
- x-envoy-expected-rq-timeout-ms
- x-ot-span-context
- x-b3-traceid
- x-b3-sampled
- x-b3-spanid
- tcp
# connection attributes
- connection.id
- connection.received.bytes
- connection.received.bytes_total
- connection.sent.bytes
- connection.sent.bytes_total
- connection.duration
# context attributes
- context.protocol
- context.timestamp
- context.time
# common integer strings
- 0
- 1
- 200
- 302
- 400
- 401
- 403
- 404
- 409
- 429
- 499
- 500
- 501
- 502
- 503
- 504
- destination.ip
- destination.port
# destination.service is deprecated, please refer to destination.service.host
- destination.service
- destination.name
- destination.uid
- destination.namespace
- destination.labels
# destination.user is deprecated, please refer to destination.principal
- destination.user
# source.service is deprecated. please do not use moving forward.
- source.service
# api attributes
- api.service
- api.version
- api.operation
- api.protocol
# auth attributes
- request.auth.principal
- request.auth.audiences
- request.auth.presenter
# api key
- request.api_key
# check.error_code and error_message
- check.error_code
- check.error_message
- request.total_size
- response.total_size
# TCP connection event attribute.
- connection.event
# whether mixer check and quota calls hit cache.
- check.cache_hit
- quota.cache_hit
- source.principal
- request.auth.claims
- request.auth.raw_claims
# whether request is sent over mTLS enabled downstream connection.
- connection.mtls
- source.metadata
- source.owner
- source.services
- source.workload.uid
- source.workload.name
- source.workload.namespace
- destination.metadata
- destination.owner
- destination.principal
- destination.workload.uid
- destination.workload.name
- destination.workload.namespace
- destination.service.uid
- destination.service.name
- destination.service.namespace
- destination.service.host
- destination.container.name
- destination.container.image
- context.reporter.local
- context.reporter.uid
# gRPC trailer return status support
- response.grpc_status
- response.grpc_message
- context.reporter.type
- context.reporter.kind
# SNI, for TLS connections
- connection.requested_server_name
# url_path and query_params are derived from http path header.
# url_path is the path part of a url, with query params being stripped.
# query_params is the normalized query part of a url.
- request.url_path
- request.query_params
# context.proxy_error_code = %RESPONSE_FLAGS% in envoy access logs.
# Other proxies should return equivalent error messages.
- context.proxy_error_code
# following are the RESPONSE_FLAGS supported by envoy as of 2018-08-10
# https://www.envoyproxy.io/docs/envoy/latest/configuration/access_log#configuration
- UH
- UF
- UO
- NR
- LH
- UT
- LR
- UR
- UC
- DI
- FI
- RL
- "-"
- inbound
- outbound
- context.proxy_version

511
vendor/istio.io/api/mixer/v1/istio.mixer.v1.json generated vendored Normal file
View File

@@ -0,0 +1,511 @@
{
"openapi": "3.0.0",
"info": {
"title": "This package defines the Mixer API that the sidecar proxy uses to perform precondition checks, manage quotas, and report telemetry.",
"version": "v1"
},
"components": {
"schemas": {
"istio.mixer.v1.Attributes": {
"description": "Attributes represents a set of typed name/value pairs. Many of Mixer's API either consume and/or return attributes.",
"type": "object",
"properties": {
"attributes": {
"description": "A map of attribute name to its value.",
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/istio.mixer.v1.Attributes.AttributeValue"
}
}
}
},
"istio.mixer.v1.Attributes.AttributeValue": {
"description": "Specifies one attribute value with different type.",
"type": "object",
"oneOf": [
{
"required": [
"stringValue"
],
"properties": {
"stringValue": {
"description": "Used for values of type STRING, DNS_NAME, EMAIL_ADDRESS, and URI",
"type": "string",
"format": "string"
}
}
},
{
"required": [
"int64Value"
],
"properties": {
"int64Value": {
"description": "Used for values of type INT64",
"type": "integer",
"format": "int64"
}
}
},
{
"required": [
"doubleValue"
],
"properties": {
"doubleValue": {
"description": "Used for values of type DOUBLE",
"type": "number",
"format": "double"
}
}
},
{
"required": [
"boolValue"
],
"properties": {
"boolValue": {
"description": "Used for values of type BOOL",
"type": "boolean"
}
}
},
{
"required": [
"bytesValue"
],
"properties": {
"bytesValue": {
"description": "Used for values of type BYTES",
"type": "string",
"format": "binary"
}
}
},
{
"required": [
"timestampValue"
],
"properties": {
"timestampValue": {
"description": "Used for values of type TIMESTAMP",
"type": "string",
"format": "dateTime"
}
}
},
{
"required": [
"durationValue"
],
"properties": {
"durationValue": {
"description": "Used for values of type DURATION",
"type": "string"
}
}
},
{
"required": [
"stringMapValue"
],
"properties": {
"stringMapValue": {
"$ref": "#/components/schemas/istio.mixer.v1.Attributes.StringMap"
}
}
}
]
},
"istio.mixer.v1.Attributes.StringMap": {
"description": "Defines a string map.",
"type": "object",
"properties": {
"entries": {
"description": "Holds a set of name/value pairs.",
"type": "object",
"additionalProperties": {
"type": "string",
"format": "string"
}
}
}
},
"istio.mixer.v1.CompressedAttributes": {
"description": "Defines a list of attributes in compressed format optimized for transport. Within this message, strings are referenced using integer indices into one of two string dictionaries. Positive integers index into the global deployment-wide dictionary, whereas negative integers index into the message-level dictionary instead. The message-level dictionary is carried by the `words` field of this message, the deployment-wide dictionary is determined via configuration.",
"type": "object",
"properties": {
"strings": {
"description": "Holds attributes of type STRING, DNS_NAME, EMAIL_ADDRESS, URI",
"type": "object",
"additionalProperties": {
"type": "integer",
"format": "int32"
}
},
"bytes": {
"description": "Holds attributes of type BYTES",
"type": "object",
"additionalProperties": {
"type": "string",
"format": "binary"
}
},
"words": {
"description": "The message-level dictionary.",
"type": "array",
"items": {
"type": "string",
"format": "string"
}
},
"int64s": {
"description": "Holds attributes of type INT64",
"type": "object",
"additionalProperties": {
"type": "integer",
"format": "int64"
}
},
"doubles": {
"description": "Holds attributes of type DOUBLE",
"type": "object",
"additionalProperties": {
"type": "number",
"format": "double"
}
},
"bools": {
"description": "Holds attributes of type BOOL",
"type": "object",
"additionalProperties": {
"type": "boolean"
}
},
"timestamps": {
"description": "Holds attributes of type TIMESTAMP",
"type": "object",
"additionalProperties": {
"type": "string",
"format": "dateTime"
}
},
"durations": {
"description": "Holds attributes of type DURATION",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"stringMaps": {
"description": "Holds attributes of type STRING_MAP",
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/istio.mixer.v1.StringMap"
}
}
}
},
"istio.mixer.v1.StringMap": {
"description": "A map of string to string. The keys and values in this map are dictionary indices (see the [Attributes][istio.mixer.v1.CompressedAttributes] message for an explanation)",
"type": "object",
"properties": {
"entries": {
"description": "Holds a set of name/value pairs.",
"type": "object",
"additionalProperties": {
"type": "integer",
"format": "int32"
}
}
}
},
"istio.mixer.v1.CheckRequest": {
"description": "Used to get a thumbs-up/thumbs-down before performing an action.",
"type": "object",
"properties": {
"attributes": {
"$ref": "#/components/schemas/istio.mixer.v1.CompressedAttributes"
},
"globalWordCount": {
"description": "The number of words in the global dictionary, used with to populate the attributes. This value is used as a quick way to determine whether the client is using a dictionary that the server understands.",
"type": "integer"
},
"deduplicationId": {
"description": "Used for deduplicating `Check` calls in the case of failed RPCs and retries. This should be a UUID per call, where the same UUID is used for retries of the same call.",
"type": "string",
"format": "string"
},
"quotas": {
"description": "The individual quotas to allocate",
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/istio.mixer.v1.CheckRequest.QuotaParams"
}
}
}
},
"istio.mixer.v1.CheckRequest.QuotaParams": {
"description": "parameters for a quota allocation",
"type": "object",
"properties": {
"amount": {
"description": "Amount of quota to allocate",
"type": "integer",
"format": "int64"
},
"bestEffort": {
"description": "When true, supports returning less quota than what was requested.",
"type": "boolean"
}
}
},
"istio.mixer.v1.CheckResponse": {
"description": "The response generated by the Check method.",
"type": "object",
"properties": {
"quotas": {
"description": "The resulting quota, one entry per requested quota.",
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/istio.mixer.v1.CheckResponse.QuotaResult"
}
},
"precondition": {
"$ref": "#/components/schemas/istio.mixer.v1.CheckResponse.PreconditionResult"
}
}
},
"istio.mixer.v1.CheckResponse.PreconditionResult": {
"description": "Expresses the result of a precondition check.",
"type": "object",
"properties": {
"status": {
"$ref": "#/components/schemas/google.rpc.Status"
},
"validDuration": {
"description": "The amount of time for which this result can be considered valid.",
"type": "string"
},
"validUseCount": {
"description": "The number of uses for which this result can be considered valid.",
"type": "integer",
"format": "int32"
},
"referencedAttributes": {
"$ref": "#/components/schemas/istio.mixer.v1.ReferencedAttributes"
},
"routeDirective": {
"$ref": "#/components/schemas/istio.mixer.v1.RouteDirective"
}
}
},
"istio.mixer.v1.CheckResponse.QuotaResult": {
"description": "Expresses the result of a quota allocation.",
"type": "object",
"properties": {
"status": {
"$ref": "#/components/schemas/google.rpc.Status"
},
"validDuration": {
"description": "The amount of time for which this result can be considered valid.",
"type": "string"
},
"referencedAttributes": {
"$ref": "#/components/schemas/istio.mixer.v1.ReferencedAttributes"
},
"grantedAmount": {
"description": "The amount of granted quota. When `QuotaParams.best_effort` is true, this will be \u003e= 0. If `QuotaParams.best_effort` is false, this will be either 0 or \u003e= `QuotaParams.amount`.",
"type": "integer",
"format": "int64"
}
}
},
"istio.mixer.v1.ReferencedAttributes": {
"description": "Describes the attributes that were used to determine the response. This can be used to construct a response cache.",
"type": "object",
"properties": {
"words": {
"description": "The message-level dictionary. Refer to [CompressedAttributes][istio.mixer.v1.CompressedAttributes] for information on using dictionaries.",
"type": "array",
"items": {
"type": "string",
"format": "string"
}
},
"attributeMatches": {
"description": "Describes a set of attributes.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.mixer.v1.ReferencedAttributes.AttributeMatch"
}
}
}
},
"istio.mixer.v1.RouteDirective": {
"description": "Expresses the routing manipulation actions to be performed on behalf of Mixer in response to a precondition check.",
"type": "object",
"properties": {
"requestHeaderOperations": {
"description": "Operations on the request headers.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.mixer.v1.HeaderOperation"
}
},
"responseHeaderOperations": {
"description": "Operations on the response headers.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.mixer.v1.HeaderOperation"
}
},
"directResponseCode": {
"description": "If set, enables a direct response without proxying the request to the routing destination. Required to be a value in the 2xx or 3xx range.",
"type": "integer"
},
"directResponseBody": {
"description": "Supplies the response body for the direct response. If this setting is omitted, no body is included in the generated response.",
"type": "string",
"format": "string"
}
}
},
"istio.mixer.v1.ReferencedAttributes.AttributeMatch": {
"description": "Describes a single attribute match.",
"type": "object",
"properties": {
"name": {
"description": "The name of the attribute. This is a dictionary index encoded in a manner identical to all strings in the [CompressedAttributes][istio.mixer.v1.CompressedAttributes] message.",
"type": "integer",
"format": "int32"
},
"condition": {
"$ref": "#/components/schemas/istio.mixer.v1.ReferencedAttributes.Condition"
},
"regex": {
"description": "If a REGEX condition is provided for a STRING_MAP attribute, clients should use the regex value to match against map keys.",
"type": "string",
"format": "string"
},
"mapKey": {
"description": "A key in a STRING_MAP. When multiple keys from a STRING_MAP attribute were referenced, there will be multiple AttributeMatch messages with different map_key values. Values for map_key SHOULD be ignored for attributes that are not STRING_MAP.",
"type": "integer",
"format": "int32"
}
}
},
"istio.mixer.v1.ReferencedAttributes.Condition": {
"description": "How an attribute's value was matched",
"type": "string",
"enum": [
"CONDITION_UNSPECIFIED",
"ABSENCE",
"EXACT",
"REGEX"
]
},
"istio.mixer.v1.HeaderOperation": {
"description": "Operation on HTTP headers to replace, append, or remove a header. Header names are normalized to lower-case with dashes, e.g. \"x-request-id\". Pseudo-headers \":path\", \":authority\", and \":method\" are supported to modify the request headers.",
"type": "object",
"properties": {
"name": {
"description": "Header name.",
"type": "string",
"format": "string"
},
"value": {
"description": "Header value.",
"type": "string",
"format": "string"
},
"operation": {
"$ref": "#/components/schemas/istio.mixer.v1.HeaderOperation.Operation"
}
}
},
"istio.mixer.v1.HeaderOperation.Operation": {
"description": "Operation type.",
"type": "string",
"enum": [
"REPLACE",
"REMOVE",
"APPEND"
]
},
"istio.mixer.v1.ReportRequest": {
"description": "Used to report telemetry after performing one or more actions.",
"type": "object",
"properties": {
"attributes": {
"description": "The attributes to use for this request.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.mixer.v1.CompressedAttributes"
}
},
"globalWordCount": {
"description": "The number of words in the global dictionary. To detect global dictionary out of sync between client and server.",
"type": "integer"
},
"repeatedAttributesSemantics": {
"$ref": "#/components/schemas/istio.mixer.v1.ReportRequest.RepeatedAttributesSemantics"
},
"defaultWords": {
"description": "The default message-level dictionary for all the attributes. Individual attribute messages can have their own dictionaries, but if they don't then this set of words, if it is provided, is used instead.",
"type": "array",
"items": {
"type": "string",
"format": "string"
}
}
}
},
"istio.mixer.v1.ReportRequest.RepeatedAttributesSemantics": {
"description": "Used to signal how the sets of compressed attributes should be reconstituted server-side.",
"type": "string",
"enum": [
"DELTA_ENCODING",
"INDEPENDENT_ENCODING"
]
},
"istio.mixer.v1.ReportResponse": {
"description": "Used to carry responses to telemetry reports",
"type": "object"
},
"google.rpc.Status": {
"description": "A status code of OK indicates quota was fetched successfully. Any other code indicates error in fetching quota.",
"type": "object",
"properties": {
"code": {
"description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].",
"type": "integer",
"format": "int32"
},
"message": {
"description": "A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.",
"type": "string",
"format": "string"
},
"details": {
"description": "A list of messages that carry the error details. There is a common set of message types for APIs to use.",
"type": "array",
"items": {
"type": "object",
"required": [
"@type"
],
"properties": {
"@type": {
"description": "A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `type.googleapis.com/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). The remaining fields of this object correspond to fields of the proto messsage. If the embedded message is well-known and has a custom JSON representation, that representation is assigned to the 'value' field.",
"type": "string",
"format": "string"
}
}
}
}
}
}
}
}
}

3721
vendor/istio.io/api/mixer/v1/mixer.pb.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

269
vendor/istio.io/api/mixer/v1/mixer.proto generated vendored Normal file
View File

@@ -0,0 +1,269 @@
// Copyright 2016 Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
// This package defines the Mixer API that the sidecar proxy uses to perform
// precondition checks, manage quotas, and report telemetry.
package istio.mixer.v1;
option go_package = "istio.io/api/mixer/v1";
option cc_generic_services = true;
import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "google/rpc/status.proto";
import "mixer/v1/attributes.proto";
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.equal_all) = false;
option (gogoproto.gostring_all) = false;
option cc_enable_arenas = true;
// Mixer provides three core features:
//
// - *Precondition Checking*. Enables callers to verify a number of preconditions
// before responding to an incoming request from a service consumer.
// Preconditions can include whether the service consumer is properly
// authenticated, is on the services whitelist, passes ACL checks, and more.
//
// - *Quota Management*. Enables services to allocate and free quota on a number
// of dimensions, Quotas are used as a relatively simple resource management tool
// to provide some fairness between service consumers when contending for limited
// resources. Rate limits are examples of quotas.
//
// - *Telemetry Reporting*. Enables services to report logging and monitoring.
// In the future, it will also enable tracing and billing streams intended for
// both the service operator as well as for service consumers.
service Mixer {
// Checks preconditions and allocate quota before performing an operation.
// The preconditions enforced depend on the set of supplied attributes and
// the active configuration.
rpc Check(CheckRequest) returns (CheckResponse) {}
// Reports telemetry, such as logs and metrics.
// The reported information depends on the set of supplied attributes and the
// active configuration.
rpc Report(ReportRequest) returns (ReportResponse) {}
}
// Used to get a thumbs-up/thumbs-down before performing an action.
message CheckRequest {
// parameters for a quota allocation
message QuotaParams {
// Amount of quota to allocate
int64 amount = 1;
// When true, supports returning less quota than what was requested.
bool best_effort = 2;
}
// The attributes to use for this request.
//
// Mixer's configuration determines how these attributes are used to
// establish the result returned in the response.
CompressedAttributes attributes = 1 [(gogoproto.nullable) = false];
// The number of words in the global dictionary, used with to populate the attributes.
// This value is used as a quick way to determine whether the client is using a dictionary that
// the server understands.
uint32 global_word_count = 2;
// Used for deduplicating `Check` calls in the case of failed RPCs and retries. This should be a UUID
// per call, where the same UUID is used for retries of the same call.
string deduplication_id = 3;
// The individual quotas to allocate
map<string, QuotaParams> quotas = 4 [(gogoproto.nullable) = false];
}
// The response generated by the Check method.
message CheckResponse {
// Expresses the result of a precondition check.
message PreconditionResult {
reserved 4;
// A status code of OK indicates all preconditions were satisfied. Any other code indicates not
// all preconditions were satisfied and details describe why.
google.rpc.Status status = 1 [(gogoproto.nullable) = false];
// The amount of time for which this result can be considered valid.
google.protobuf.Duration valid_duration = 2 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
// The number of uses for which this result can be considered valid.
int32 valid_use_count = 3;
// The total set of attributes that were used in producing the result
// along with matching conditions.
ReferencedAttributes referenced_attributes = 5;
// An optional routing directive, used to manipulate the traffic metadata
// whenever all preconditions are satisfied.
RouteDirective route_directive = 6;
}
// Expresses the result of a quota allocation.
message QuotaResult {
// The amount of time for which this result can be considered valid.
google.protobuf.Duration valid_duration = 1 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
// The amount of granted quota. When `QuotaParams.best_effort` is true, this will be >= 0.
// If `QuotaParams.best_effort` is false, this will be either 0 or >= `QuotaParams.amount`.
int64 granted_amount = 2;
// A status code of OK indicates quota was fetched successfully.
// Any other code indicates error in fetching quota.
google.rpc.Status status = 6 [(gogoproto.nullable) = false];
// The total set of attributes that were used in producing the result
// along with matching conditions.
ReferencedAttributes referenced_attributes = 5 [(gogoproto.nullable) = false];
}
// The precondition check results.
PreconditionResult precondition = 2 [(gogoproto.nullable) = false];
// The resulting quota, one entry per requested quota.
map<string, QuotaResult> quotas = 3 [(gogoproto.nullable) = false];
}
// Describes the attributes that were used to determine the response.
// This can be used to construct a response cache.
message ReferencedAttributes {
// How an attribute's value was matched
enum Condition {
CONDITION_UNSPECIFIED = 0; // should not occur
ABSENCE = 1; // match when attribute doesn't exist
EXACT = 2; // match when attribute value is an exact byte-for-byte match
REGEX = 3; // match when attribute value matches the included regex
}
// Describes a single attribute match.
message AttributeMatch {
// The name of the attribute. This is a dictionary index encoded in a manner identical
// to all strings in the [CompressedAttributes][istio.mixer.v1.CompressedAttributes] message.
sint32 name = 1;
// The kind of match against the attribute value.
Condition condition = 2;
// If a REGEX condition is provided for a STRING_MAP attribute,
// clients should use the regex value to match against map keys.
string regex = 3;
// A key in a STRING_MAP. When multiple keys from a STRING_MAP
// attribute were referenced, there will be multiple AttributeMatch
// messages with different map_key values. Values for map_key SHOULD
// be ignored for attributes that are not STRING_MAP.
//
// Indices for the keys are used (taken either from the
// message dictionary from the `words` field or the global dictionary).
//
// If no map_key value is provided for a STRING_MAP attribute, the
// entire STRING_MAP will be used.
sint32 map_key = 4;
}
// The message-level dictionary. Refer to [CompressedAttributes][istio.mixer.v1.CompressedAttributes] for information
// on using dictionaries.
repeated string words = 1;
// Describes a set of attributes.
repeated AttributeMatch attribute_matches = 2 [(gogoproto.nullable) = false];
}
// Operation on HTTP headers to replace, append, or remove a header. Header
// names are normalized to lower-case with dashes, e.g. "x-request-id".
// Pseudo-headers ":path", ":authority", and ":method" are supported to modify
// the request headers.
message HeaderOperation {
// Operation type.
enum Operation {
REPLACE = 0; // replaces the header with the given name
REMOVE = 1; // removes the header with the given name (the value is ignored)
APPEND = 2; // appends the value to the header value, or sets it if not present
}
// Header name.
string name = 1;
// Header value.
string value = 2;
// Header operation.
Operation operation = 3;
}
// Expresses the routing manipulation actions to be performed on behalf of
// Mixer in response to a precondition check.
message RouteDirective {
// Operations on the request headers.
repeated HeaderOperation request_header_operations = 1 [(gogoproto.nullable) = false];
// Operations on the response headers.
repeated HeaderOperation response_header_operations = 2 [(gogoproto.nullable) = false];
// If set, enables a direct response without proxying the request to the routing
// destination. Required to be a value in the 2xx or 3xx range.
uint32 direct_response_code = 3;
// Supplies the response body for the direct response.
// If this setting is omitted, no body is included in the generated response.
string direct_response_body = 4;
}
// Used to report telemetry after performing one or more actions.
message ReportRequest {
// next value: 5
// Used to signal how the sets of compressed attributes should be reconstituted server-side.
enum RepeatedAttributesSemantics {
// Use delta encoding between sets of compressed attributes to reduce the overall on-wire
// request size. Each individual set of attributes is used to modify the previous set.
// NOTE: There is no way with this encoding to specify attribute value deletion. This
// option should be used with extreme caution.
DELTA_ENCODING = 0;
// Treat each set of compressed attributes as complete - independent from other sets
// in this request. This will result in on-wire duplication of attributes and values, but
// will allow for proper accounting of absent values in overall encoding.
INDEPENDENT_ENCODING = 1;
}
// The attributes to use for this request.
//
// Each `Attributes` element represents the state of a single action. Multiple actions
// can be provided in a single message in order to improve communication efficiency. The
// client can accumulate a set of actions and send them all in one single message.
repeated CompressedAttributes attributes = 1 [(gogoproto.nullable) = false];
// Indicates how to decode the attributes sets in this request.
RepeatedAttributesSemantics repeated_attributes_semantics = 4;
// The default message-level dictionary for all the attributes.
// Individual attribute messages can have their own dictionaries, but if they don't
// then this set of words, if it is provided, is used instead.
//
// This makes it possible to share the same dictionary for all attributes in this
// request, which can substantially reduce the overall request size.
repeated string default_words = 2;
// The number of words in the global dictionary.
// To detect global dictionary out of sync between client and server.
uint32 global_word_count = 3;
}
// Used to carry responses to telemetry reports
message ReportResponse {
}

149
vendor/istio.io/api/mixer/v1/mixer_json.gen.go generated vendored Normal file
View File

@@ -0,0 +1,149 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: mixer/v1/mixer.proto
// This package defines the Mixer API that the sidecar proxy uses to perform
// precondition checks, manage quotas, and report telemetry.
package v1
import (
bytes "bytes"
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
proto "github.com/gogo/protobuf/proto"
_ "github.com/gogo/protobuf/types"
_ "istio.io/gogo-genproto/googleapis/google/rpc"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// MarshalJSON is a custom marshaler for CheckRequest
func (this *CheckRequest) MarshalJSON() ([]byte, error) {
str, err := MixerMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for CheckRequest
func (this *CheckRequest) UnmarshalJSON(b []byte) error {
return MixerUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for CheckRequest_QuotaParams
func (this *CheckRequest_QuotaParams) MarshalJSON() ([]byte, error) {
str, err := MixerMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for CheckRequest_QuotaParams
func (this *CheckRequest_QuotaParams) UnmarshalJSON(b []byte) error {
return MixerUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for CheckResponse
func (this *CheckResponse) MarshalJSON() ([]byte, error) {
str, err := MixerMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for CheckResponse
func (this *CheckResponse) UnmarshalJSON(b []byte) error {
return MixerUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for CheckResponse_PreconditionResult
func (this *CheckResponse_PreconditionResult) MarshalJSON() ([]byte, error) {
str, err := MixerMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for CheckResponse_PreconditionResult
func (this *CheckResponse_PreconditionResult) UnmarshalJSON(b []byte) error {
return MixerUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for CheckResponse_QuotaResult
func (this *CheckResponse_QuotaResult) MarshalJSON() ([]byte, error) {
str, err := MixerMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for CheckResponse_QuotaResult
func (this *CheckResponse_QuotaResult) UnmarshalJSON(b []byte) error {
return MixerUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for ReferencedAttributes
func (this *ReferencedAttributes) MarshalJSON() ([]byte, error) {
str, err := MixerMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for ReferencedAttributes
func (this *ReferencedAttributes) UnmarshalJSON(b []byte) error {
return MixerUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for ReferencedAttributes_AttributeMatch
func (this *ReferencedAttributes_AttributeMatch) MarshalJSON() ([]byte, error) {
str, err := MixerMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for ReferencedAttributes_AttributeMatch
func (this *ReferencedAttributes_AttributeMatch) UnmarshalJSON(b []byte) error {
return MixerUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for HeaderOperation
func (this *HeaderOperation) MarshalJSON() ([]byte, error) {
str, err := MixerMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for HeaderOperation
func (this *HeaderOperation) UnmarshalJSON(b []byte) error {
return MixerUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for RouteDirective
func (this *RouteDirective) MarshalJSON() ([]byte, error) {
str, err := MixerMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for RouteDirective
func (this *RouteDirective) UnmarshalJSON(b []byte) error {
return MixerUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for ReportRequest
func (this *ReportRequest) MarshalJSON() ([]byte, error) {
str, err := MixerMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for ReportRequest
func (this *ReportRequest) UnmarshalJSON(b []byte) error {
return MixerUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for ReportResponse
func (this *ReportResponse) MarshalJSON() ([]byte, error) {
str, err := MixerMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for ReportResponse
func (this *ReportResponse) UnmarshalJSON(b []byte) error {
return MixerUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
var (
MixerMarshaler = &github_com_gogo_protobuf_jsonpb.Marshaler{}
MixerUnmarshaler = &github_com_gogo_protobuf_jsonpb.Unmarshaler{}
)