cuelang.org/go@v0.10.1/encoding/protobuf/testdata/istio.io/api/mixer/v1/config/client/quota.proto (about) 1 // Copyright 2017 Istio Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 syntax = "proto3"; 16 17 package istio.mixer.v1.config.client; 18 19 option go_package="istio.io/api/mixer/v1/config/client"; 20 21 import "gogoproto/gogo.proto"; 22 import "mixer/v1/config/client/service.proto"; 23 24 option (gogoproto.goproto_getters_all) = false; 25 option (gogoproto.equal_all) = false; 26 option (gogoproto.gostring_all) = false; 27 option (gogoproto.stable_marshaler_all) = true; 28 29 // Specifies runtime quota rules. 30 // * Uses Istio attributes to match individual requests 31 // * Specifies list of quotas to use for matched requests. 32 // 33 // Example1: 34 // Charge "request_count" quota with 1 amount for all requests. 35 // 36 // QuotaSpec: 37 // - rules 38 // - quotas: 39 // quota: request_count 40 // charge: 1 41 // 42 // Example2: 43 // For HTTP POST requests with path are prefixed with /books or 44 // api.operation is create_books, charge two quotas: 45 // * write_count of 1 amount 46 // * request_count of 5 amount. 47 // 48 // ```yaml 49 // QuotaSpec: 50 // - rules: 51 // - match: 52 // clause: 53 // request.path: 54 // string_prefix: /books 55 // request.http_method: 56 // string_exact: POST 57 // - match: 58 // clause: 59 // api.operation: 60 // string_exact: create_books 61 // - quotas: 62 // quota: write_count 63 // charge: 1 64 // - quotas: 65 // quota: request_count 66 // charge: 5 67 // ``` 68 69 // Determines the quotas used for individual requests. 70 message QuotaSpec { 71 // A list of Quota rules. 72 repeated QuotaRule rules = 1; 73 } 74 75 // Specifies a rule with list of matches and list of quotas. 76 // If any clause matched, the list of quotas will be used. 77 message QuotaRule { 78 // If empty, match all request. 79 // If any of match is true, it is matched. 80 repeated AttributeMatch match = 1; 81 82 // The list of quotas to charge. 83 repeated Quota quotas = 2; 84 } 85 86 // Describes how to match a given string in HTTP headers. Match is 87 // case-sensitive. 88 message StringMatch { 89 oneof match_type { 90 // exact string match 91 string exact = 1; 92 // prefix-based match 93 string prefix = 2; 94 // ECMAscript style regex-based match 95 string regex = 3; 96 } 97 } 98 99 // Specifies a match clause to match Istio attributes 100 message AttributeMatch { 101 // Map of attribute names to StringMatch type. 102 // Each map element specifies one condition to match. 103 // 104 // Example: 105 // 106 // clause: 107 // source.uid: 108 // exact: SOURCE_UID 109 // request.http_method: 110 // exact: POST 111 map<string, StringMatch> clause = 1; 112 } 113 114 // Specifies a quota to use with quota name and amount. 115 message Quota { 116 // The quota name to charge 117 string quota = 1; 118 119 // The quota amount to charge 120 int64 charge = 2; 121 } 122 123 // QuotaSpecBinding defines the binding between QuotaSpecs and one or more 124 // IstioService. 125 message QuotaSpecBinding { 126 // REQUIRED. One or more services to map the listed QuotaSpec onto. 127 repeated IstioService services = 1; 128 129 // QuotaSpecReference uniquely identifies the QuotaSpec used in the 130 // Binding. 131 message QuotaSpecReference { 132 // REQUIRED. The short name of the QuotaSpec. This is the resource 133 // name defined by the metadata name field. 134 string name = 1; 135 136 // Optional namespace of the QuotaSpec. Defaults to the value of the 137 // metadata namespace field. 138 string namespace = 2; 139 } 140 141 // REQUIRED. One or more QuotaSpec references that should be mapped to 142 // the specified service(s). The aggregate collection of match 143 // conditions defined in the QuotaSpecs should not overlap. 144 repeated QuotaSpecReference quota_specs = 2; 145 }