├── .gitignore ├── go.mod ├── Readme.md ├── install-protobuf.sh ├── .travis.yml ├── go.sum ├── google ├── api │ ├── annotations.proto │ ├── annotations.pb.go │ ├── expr │ │ └── v1alpha1 │ │ │ ├── value.proto │ │ │ └── syntax.proto │ ├── http.proto │ └── http.pb.go └── rpc │ ├── status.proto │ ├── code.proto │ ├── error_details.proto │ ├── code.pb.go │ └── status.pb.go ├── protoc-gen-gogogoogleapis └── main.go ├── Makefile └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/gogo/googleapis 2 | 3 | go 1.12 4 | 5 | require github.com/gogo/protobuf v1.3.0 6 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Google APIs generated by gogoprotobuf 2 | 3 | [![Build Status](https://travis-ci.org/gogo/googleapis.svg?branch=master)](https://travis-ci.org/gogo/googleapis) 4 | 5 | The [grpc-example](https://github.com/gogo/grpc-example) includes an example usage of this repository. 6 | -------------------------------------------------------------------------------- /install-protobuf.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -ex 4 | 5 | cd /home/travis 6 | 7 | VERSION=3.9.1 8 | 9 | wget https://github.com/protocolbuffers/protobuf/releases/download/v$VERSION/protoc-$VERSION-linux-x86_64.zip 10 | unzip protoc-$VERSION-linux-x86_64.zip 11 | rm -rf protoc-$VERSION-linux-x86_64.zip 12 | 13 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - ./install-protobuf.sh 3 | - PATH=/home/travis/bin:$PATH protoc --version 4 | - echo $TRAVIS_GO_VERSION 5 | 6 | script: 7 | - PATH=/home/travis/bin:$PATH GO111MODULE=on make regenerate 8 | - git diff --exit-code 9 | 10 | language: go 11 | 12 | go: 13 | - "1.11.x" 14 | - "1.12.x" 15 | - tip 16 | 17 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= 2 | github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= 3 | github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= 4 | github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE= 5 | github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= 6 | github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= 7 | github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= 8 | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= 9 | golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 10 | golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 11 | -------------------------------------------------------------------------------- /google/api/annotations.proto: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015, Google Inc. 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 google.api; 18 | 19 | import "google/api/http.proto"; 20 | import "google/protobuf/descriptor.proto"; 21 | 22 | option go_package = "api"; 23 | option java_multiple_files = true; 24 | option java_outer_classname = "AnnotationsProto"; 25 | option java_package = "com.google.api"; 26 | option objc_class_prefix = "GAPI"; 27 | 28 | extend google.protobuf.MethodOptions { 29 | // See `HttpRule`. 30 | HttpRule http = 72295728; 31 | } 32 | -------------------------------------------------------------------------------- /protoc-gen-gogogoogleapis/main.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, The GoGo 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 | package main 16 | 17 | import ( 18 | "strings" 19 | 20 | "github.com/gogo/protobuf/vanity" 21 | "github.com/gogo/protobuf/vanity/command" 22 | ) 23 | 24 | func main() { 25 | req := command.Read() 26 | files := req.GetProtoFile() 27 | files = vanity.FilterFiles(files, vanity.NotGoogleProtobufDescriptorProto) 28 | 29 | vanity.ForEachFile(files, vanity.TurnOnMarshalerAll) 30 | vanity.ForEachFile(files, vanity.TurnOnSizerAll) 31 | vanity.ForEachFile(files, vanity.TurnOnUnmarshalerAll) 32 | 33 | for _, file := range files { 34 | if strings.HasPrefix(file.GetName(), "google/rpc") { 35 | vanity.TurnOffGoEnumPrefixAll(file) 36 | } 37 | } 38 | 39 | vanity.ForEachFile(files, vanity.TurnOffGoEnumStringerAll) 40 | vanity.ForEachFile(files, vanity.TurnOnEnumStringerAll) 41 | 42 | vanity.ForEachFile(files, vanity.TurnOnEqualAll) 43 | vanity.ForEachFile(files, vanity.TurnOnGoStringAll) 44 | vanity.ForEachFile(files, vanity.TurnOffGoStringerAll) 45 | 46 | vanity.ForEachFile(files, vanity.TurnOnMessageNameAll) 47 | 48 | for _, file := range files { 49 | if strings.HasSuffix(file.GetName(), "annotations.proto") { 50 | continue 51 | } 52 | if strings.HasSuffix(file.GetName(), "http.proto") { 53 | continue 54 | } 55 | if strings.HasPrefix(file.GetName(), "google/api/expr/v1alpha1") { 56 | continue 57 | } 58 | vanity.TurnOnCompareAll(file) 59 | } 60 | 61 | for _, file := range files { 62 | vanity.TurnOnStringerAll(file) 63 | vanity.TurnOnPopulateAll(file) 64 | } 65 | 66 | resp := command.Generate(req) 67 | command.Write(resp) 68 | } 69 | -------------------------------------------------------------------------------- /google/api/annotations.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 | // source: google/api/annotations.proto 3 | 4 | package api 5 | 6 | import ( 7 | fmt "fmt" 8 | proto "github.com/gogo/protobuf/proto" 9 | descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" 10 | math "math" 11 | ) 12 | 13 | // Reference imports to suppress errors if they are not otherwise used. 14 | var _ = proto.Marshal 15 | var _ = fmt.Errorf 16 | var _ = math.Inf 17 | 18 | // This is a compile-time assertion to ensure that this generated file 19 | // is compatible with the proto package it is being compiled against. 20 | // A compilation error at this line likely means your copy of the 21 | // proto package needs to be updated. 22 | const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 23 | 24 | var E_Http = &proto.ExtensionDesc{ 25 | ExtendedType: (*descriptor.MethodOptions)(nil), 26 | ExtensionType: (*HttpRule)(nil), 27 | Field: 72295728, 28 | Name: "google.api.http", 29 | Tag: "bytes,72295728,opt,name=http", 30 | Filename: "google/api/annotations.proto", 31 | } 32 | 33 | func init() { 34 | proto.RegisterExtension(E_Http) 35 | } 36 | 37 | func init() { proto.RegisterFile("google/api/annotations.proto", fileDescriptor_c591c5aa9fb79aab) } 38 | 39 | var fileDescriptor_c591c5aa9fb79aab = []byte{ 40 | // 226 bytes of a gzipped FileDescriptorProto 41 | 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xcf, 0xcf, 0x4f, 42 | 0xcf, 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 43 | 0xcf, 0x2b, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x82, 0xc8, 0xea, 0x25, 0x16, 0x64, 44 | 0x4a, 0x89, 0x22, 0xa9, 0xcc, 0x28, 0x29, 0x29, 0x80, 0x28, 0x91, 0x52, 0x80, 0x0a, 0x83, 0x79, 45 | 0x49, 0xa5, 0x69, 0xfa, 0x29, 0xa9, 0xc5, 0xc9, 0x45, 0x99, 0x05, 0x25, 0xf9, 0x45, 0x10, 0x15, 46 | 0x56, 0xde, 0x5c, 0x2c, 0x20, 0xf5, 0x42, 0x72, 0x7a, 0x50, 0xd3, 0x60, 0x4a, 0xf5, 0x7c, 0x53, 47 | 0x4b, 0x32, 0xf2, 0x53, 0xfc, 0x0b, 0xc0, 0x56, 0x4a, 0x6c, 0x38, 0xb5, 0x47, 0x49, 0x81, 0x51, 48 | 0x83, 0xdb, 0x48, 0x44, 0x0f, 0x61, 0xad, 0x9e, 0x47, 0x49, 0x49, 0x41, 0x50, 0x69, 0x4e, 0x6a, 49 | 0x10, 0xd8, 0x10, 0xa7, 0x98, 0x1b, 0x0f, 0xe5, 0x18, 0x3e, 0x3c, 0x94, 0x63, 0xfc, 0xf1, 0x50, 50 | 0x8e, 0xb1, 0xe1, 0x91, 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 51 | 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8b, 0x47, 0x72, 0x0c, 0x1f, 0x40, 0x62, 0x8f, 0xe5, 52 | 0x18, 0xb9, 0xf8, 0x92, 0xf3, 0x73, 0x91, 0x0c, 0x73, 0x12, 0x70, 0x44, 0x78, 0x31, 0x00, 0xe4, 53 | 0x8a, 0x00, 0xc6, 0x28, 0xe6, 0xc4, 0x82, 0xcc, 0x45, 0x4c, 0x2c, 0xee, 0x8e, 0x01, 0x9e, 0x49, 54 | 0x6c, 0x60, 0xa7, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xe9, 0xae, 0xdf, 0x16, 0x01, 55 | 0x00, 0x00, 56 | } 57 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | URL="https://raw.githubusercontent.com/googleapis/googleapis/master/" 2 | 3 | regenerate: 4 | go install ./protoc-gen-gogogoogleapis 5 | 6 | protoc \ 7 | --gogogoogleapis_out=\ 8 | Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\ 9 | Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,\ 10 | :. \ 11 | -I=. \ 12 | google/rpc/status.proto \ 13 | google/rpc/error_details.proto \ 14 | google/rpc/code.proto \ 15 | 16 | protoc \ 17 | --gogogoogleapis_out=\ 18 | Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor,\ 19 | :. \ 20 | -I=. \ 21 | google/api/http.proto \ 22 | google/api/annotations.proto 23 | 24 | protoc \ 25 | --gogogoogleapis_out=\ 26 | Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\ 27 | Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\ 28 | Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types,\ 29 | Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,\ 30 | Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor,\ 31 | :. \ 32 | -I=. \ 33 | google/api/expr/v1alpha1/syntax.proto \ 34 | google/api/expr/v1alpha1/value.proto 35 | 36 | update: 37 | go get github.com/gogo/protobuf/gogoreplace 38 | 39 | (cd ./google/rpc && rm status.proto; wget ${URL}/google/rpc/status.proto) 40 | gogoreplace \ 41 | 'option go_package = "google.golang.org/genproto/googleapis/rpc/status;status";' \ 42 | 'option go_package = "rpc";' \ 43 | ./google/rpc/status.proto 44 | 45 | (cd ./google/rpc && rm error_details.proto; wget ${URL}/google/rpc/error_details.proto) 46 | gogoreplace \ 47 | 'option go_package = "google.golang.org/genproto/googleapis/rpc/errdetails;errdetails";' \ 48 | 'option go_package = "rpc";' \ 49 | ./google/rpc/error_details.proto 50 | 51 | (cd ./google/rpc && rm code.proto; wget ${URL}/google/rpc/code.proto) 52 | gogoreplace \ 53 | 'option go_package = "google.golang.org/genproto/googleapis/rpc/code;code";' \ 54 | 'option go_package = "rpc";' \ 55 | ./google/rpc/code.proto 56 | 57 | (cd ./google/api && rm http.proto; wget ${URL}/google/api/http.proto) 58 | gogoreplace \ 59 | 'option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";' \ 60 | 'option go_package = "api";' \ 61 | ./google/api/http.proto 62 | 63 | (cd ./google/api && rm annotations.proto; wget ${URL}/google/api/annotations.proto) 64 | gogoreplace \ 65 | 'option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";' \ 66 | 'option go_package = "api";' \ 67 | ./google/api/annotations.proto 68 | 69 | (cd ./google/api/expr/v1alpha1 && rm syntax.proto; wget ${URL}/google/api/expr/v1alpha1/syntax.proto) 70 | gogoreplace \ 71 | 'option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";' \ 72 | 'option go_package = "expr";' \ 73 | ./google/api/expr/v1alpha1/syntax.proto 74 | 75 | (cd ./google/api/expr/v1alpha1 && rm value.proto; wget ${URL}/google/api/expr/v1alpha1/value.proto) 76 | gogoreplace \ 77 | 'option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";' \ 78 | 'option go_package = "expr";' \ 79 | ./google/api/expr/v1alpha1/value.proto 80 | -------------------------------------------------------------------------------- /google/api/expr/v1alpha1/value.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Google LLC. 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 | 16 | syntax = "proto3"; 17 | 18 | package google.api.expr.v1alpha1; 19 | 20 | import "google/protobuf/any.proto"; 21 | import "google/protobuf/struct.proto"; 22 | 23 | option cc_enable_arenas = true; 24 | option go_package = "expr"; 25 | option java_multiple_files = true; 26 | option java_outer_classname = "ValueProto"; 27 | option java_package = "com.google.api.expr.v1alpha1"; 28 | 29 | // Contains representations for CEL runtime values. 30 | 31 | // Represents a CEL value. 32 | // 33 | // This is similar to `google.protobuf.Value`, but can represent CEL's full 34 | // range of values. 35 | message Value { 36 | // Required. The valid kinds of values. 37 | oneof kind { 38 | // Null value. 39 | google.protobuf.NullValue null_value = 1; 40 | 41 | // Boolean value. 42 | bool bool_value = 2; 43 | 44 | // Signed integer value. 45 | int64 int64_value = 3; 46 | 47 | // Unsigned integer value. 48 | uint64 uint64_value = 4; 49 | 50 | // Floating point value. 51 | double double_value = 5; 52 | 53 | // UTF-8 string value. 54 | string string_value = 6; 55 | 56 | // Byte string value. 57 | bytes bytes_value = 7; 58 | 59 | // An enum value. 60 | EnumValue enum_value = 9; 61 | 62 | // The proto message backing an object value. 63 | google.protobuf.Any object_value = 10; 64 | 65 | // Map value. 66 | MapValue map_value = 11; 67 | 68 | // List value. 69 | ListValue list_value = 12; 70 | 71 | // Type value. 72 | string type_value = 15; 73 | } 74 | } 75 | 76 | // An enum value. 77 | message EnumValue { 78 | // The fully qualified name of the enum type. 79 | string type = 1; 80 | 81 | // The value of the enum. 82 | int32 value = 2; 83 | } 84 | 85 | // A list. 86 | // 87 | // Wrapped in a message so 'not set' and empty can be differentiated, which is 88 | // required for use in a 'oneof'. 89 | message ListValue { 90 | // The ordered values in the list. 91 | repeated Value values = 1; 92 | } 93 | 94 | // A map. 95 | // 96 | // Wrapped in a message so 'not set' and empty can be differentiated, which is 97 | // required for use in a 'oneof'. 98 | message MapValue { 99 | // An entry in the map. 100 | message Entry { 101 | // The key. 102 | // 103 | // Must be unique with in the map. 104 | // Currently only boolean, int, uint, and string values can be keys. 105 | Value key = 1; 106 | 107 | // The value. 108 | Value value = 2; 109 | } 110 | 111 | // The set of map entries. 112 | // 113 | // CEL has fewer restrictions on keys, so a protobuf map represenation 114 | // cannot be used. 115 | repeated Entry entries = 1; 116 | } 117 | -------------------------------------------------------------------------------- /google/rpc/status.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Google Inc. 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 google.rpc; 18 | 19 | import "google/protobuf/any.proto"; 20 | 21 | option go_package = "rpc"; 22 | option java_multiple_files = true; 23 | option java_outer_classname = "StatusProto"; 24 | option java_package = "com.google.rpc"; 25 | option objc_class_prefix = "RPC"; 26 | 27 | // The `Status` type defines a logical error model that is suitable for 28 | // different programming environments, including REST APIs and RPC APIs. It is 29 | // used by [gRPC](https://github.com/grpc). The error model is designed to be: 30 | // 31 | // - Simple to use and understand for most users 32 | // - Flexible enough to meet unexpected needs 33 | // 34 | // # Overview 35 | // 36 | // The `Status` message contains three pieces of data: error code, error 37 | // message, and error details. The error code should be an enum value of 38 | // [google.rpc.Code][google.rpc.Code], but it may accept additional error codes 39 | // if needed. The error message should be a developer-facing English message 40 | // that helps developers *understand* and *resolve* the error. If a localized 41 | // user-facing error message is needed, put the localized message in the error 42 | // details or localize it in the client. The optional error details may contain 43 | // arbitrary information about the error. There is a predefined set of error 44 | // detail types in the package `google.rpc` that can be used for common error 45 | // conditions. 46 | // 47 | // # Language mapping 48 | // 49 | // The `Status` message is the logical representation of the error model, but it 50 | // is not necessarily the actual wire format. When the `Status` message is 51 | // exposed in different client libraries and different wire protocols, it can be 52 | // mapped differently. For example, it will likely be mapped to some exceptions 53 | // in Java, but more likely mapped to some error codes in C. 54 | // 55 | // # Other uses 56 | // 57 | // The error model and the `Status` message can be used in a variety of 58 | // environments, either with or without APIs, to provide a 59 | // consistent developer experience across different environments. 60 | // 61 | // Example uses of this error model include: 62 | // 63 | // - Partial errors. If a service needs to return partial errors to the client, 64 | // it may embed the `Status` in the normal response to indicate the partial 65 | // errors. 66 | // 67 | // - Workflow errors. A typical workflow has multiple steps. Each step may 68 | // have a `Status` message for error reporting. 69 | // 70 | // - Batch operations. If a client uses batch request and batch response, the 71 | // `Status` message should be used directly inside batch response, one for 72 | // each error sub-response. 73 | // 74 | // - Asynchronous operations. If an API call embeds asynchronous operation 75 | // results in its response, the status of those operations should be 76 | // represented directly using the `Status` message. 77 | // 78 | // - Logging. If some API errors are stored in logs, the message `Status` could 79 | // be used directly after any stripping needed for security/privacy reasons. 80 | message Status { 81 | // The status code, which should be an enum value of 82 | // [google.rpc.Code][google.rpc.Code]. 83 | int32 code = 1; 84 | 85 | // A developer-facing error message, which should be in English. Any 86 | // user-facing error message should be localized and sent in the 87 | // [google.rpc.Status.details][google.rpc.Status.details] field, or localized 88 | // by the client. 89 | string message = 2; 90 | 91 | // A list of messages that carry the error details. There is a common set of 92 | // message types for APIs to use. 93 | repeated google.protobuf.Any details = 3; 94 | } 95 | -------------------------------------------------------------------------------- /google/rpc/code.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Google Inc. 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 google.rpc; 18 | 19 | option go_package = "rpc"; 20 | option java_multiple_files = true; 21 | option java_outer_classname = "CodeProto"; 22 | option java_package = "com.google.rpc"; 23 | option objc_class_prefix = "RPC"; 24 | 25 | // The canonical error codes for Google APIs. 26 | // 27 | // 28 | // Sometimes multiple error codes may apply. Services should return 29 | // the most specific error code that applies. For example, prefer 30 | // `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply. 31 | // Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`. 32 | enum Code { 33 | // Not an error; returned on success 34 | // 35 | // HTTP Mapping: 200 OK 36 | OK = 0; 37 | 38 | // The operation was cancelled, typically by the caller. 39 | // 40 | // HTTP Mapping: 499 Client Closed Request 41 | CANCELLED = 1; 42 | 43 | // Unknown error. For example, this error may be returned when 44 | // a `Status` value received from another address space belongs to 45 | // an error space that is not known in this address space. Also 46 | // errors raised by APIs that do not return enough error information 47 | // may be converted to this error. 48 | // 49 | // HTTP Mapping: 500 Internal Server Error 50 | UNKNOWN = 2; 51 | 52 | // The client specified an invalid argument. Note that this differs 53 | // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments 54 | // that are problematic regardless of the state of the system 55 | // (e.g., a malformed file name). 56 | // 57 | // HTTP Mapping: 400 Bad Request 58 | INVALID_ARGUMENT = 3; 59 | 60 | // The deadline expired before the operation could complete. For operations 61 | // that change the state of the system, this error may be returned 62 | // even if the operation has completed successfully. For example, a 63 | // successful response from a server could have been delayed long 64 | // enough for the deadline to expire. 65 | // 66 | // HTTP Mapping: 504 Gateway Timeout 67 | DEADLINE_EXCEEDED = 4; 68 | 69 | // Some requested entity (e.g., file or directory) was not found. 70 | // 71 | // Note to server developers: if a request is denied for an entire class 72 | // of users, such as gradual feature rollout or undocumented whitelist, 73 | // `NOT_FOUND` may be used. If a request is denied for some users within 74 | // a class of users, such as user-based access control, `PERMISSION_DENIED` 75 | // must be used. 76 | // 77 | // HTTP Mapping: 404 Not Found 78 | NOT_FOUND = 5; 79 | 80 | // The entity that a client attempted to create (e.g., file or directory) 81 | // already exists. 82 | // 83 | // HTTP Mapping: 409 Conflict 84 | ALREADY_EXISTS = 6; 85 | 86 | // The caller does not have permission to execute the specified 87 | // operation. `PERMISSION_DENIED` must not be used for rejections 88 | // caused by exhausting some resource (use `RESOURCE_EXHAUSTED` 89 | // instead for those errors). `PERMISSION_DENIED` must not be 90 | // used if the caller can not be identified (use `UNAUTHENTICATED` 91 | // instead for those errors). This error code does not imply the 92 | // request is valid or the requested entity exists or satisfies 93 | // other pre-conditions. 94 | // 95 | // HTTP Mapping: 403 Forbidden 96 | PERMISSION_DENIED = 7; 97 | 98 | // The request does not have valid authentication credentials for the 99 | // operation. 100 | // 101 | // HTTP Mapping: 401 Unauthorized 102 | UNAUTHENTICATED = 16; 103 | 104 | // Some resource has been exhausted, perhaps a per-user quota, or 105 | // perhaps the entire file system is out of space. 106 | // 107 | // HTTP Mapping: 429 Too Many Requests 108 | RESOURCE_EXHAUSTED = 8; 109 | 110 | // The operation was rejected because the system is not in a state 111 | // required for the operation's execution. For example, the directory 112 | // to be deleted is non-empty, an rmdir operation is applied to 113 | // a non-directory, etc. 114 | // 115 | // Service implementors can use the following guidelines to decide 116 | // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: 117 | // (a) Use `UNAVAILABLE` if the client can retry just the failing call. 118 | // (b) Use `ABORTED` if the client should retry at a higher level 119 | // (e.g., when a client-specified test-and-set fails, indicating the 120 | // client should restart a read-modify-write sequence). 121 | // (c) Use `FAILED_PRECONDITION` if the client should not retry until 122 | // the system state has been explicitly fixed. E.g., if an "rmdir" 123 | // fails because the directory is non-empty, `FAILED_PRECONDITION` 124 | // should be returned since the client should not retry unless 125 | // the files are deleted from the directory. 126 | // 127 | // HTTP Mapping: 400 Bad Request 128 | FAILED_PRECONDITION = 9; 129 | 130 | // The operation was aborted, typically due to a concurrency issue such as 131 | // a sequencer check failure or transaction abort. 132 | // 133 | // See the guidelines above for deciding between `FAILED_PRECONDITION`, 134 | // `ABORTED`, and `UNAVAILABLE`. 135 | // 136 | // HTTP Mapping: 409 Conflict 137 | ABORTED = 10; 138 | 139 | // The operation was attempted past the valid range. E.g., seeking or 140 | // reading past end-of-file. 141 | // 142 | // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may 143 | // be fixed if the system state changes. For example, a 32-bit file 144 | // system will generate `INVALID_ARGUMENT` if asked to read at an 145 | // offset that is not in the range [0,2^32-1], but it will generate 146 | // `OUT_OF_RANGE` if asked to read from an offset past the current 147 | // file size. 148 | // 149 | // There is a fair bit of overlap between `FAILED_PRECONDITION` and 150 | // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific 151 | // error) when it applies so that callers who are iterating through 152 | // a space can easily look for an `OUT_OF_RANGE` error to detect when 153 | // they are done. 154 | // 155 | // HTTP Mapping: 400 Bad Request 156 | OUT_OF_RANGE = 11; 157 | 158 | // The operation is not implemented or is not supported/enabled in this 159 | // service. 160 | // 161 | // HTTP Mapping: 501 Not Implemented 162 | UNIMPLEMENTED = 12; 163 | 164 | // Internal errors. This means that some invariants expected by the 165 | // underlying system have been broken. This error code is reserved 166 | // for serious errors. 167 | // 168 | // HTTP Mapping: 500 Internal Server Error 169 | INTERNAL = 13; 170 | 171 | // The service is currently unavailable. This is most likely a 172 | // transient condition, which can be corrected by retrying with 173 | // a backoff. 174 | // 175 | // See the guidelines above for deciding between `FAILED_PRECONDITION`, 176 | // `ABORTED`, and `UNAVAILABLE`. 177 | // 178 | // HTTP Mapping: 503 Service Unavailable 179 | UNAVAILABLE = 14; 180 | 181 | // Unrecoverable data loss or corruption. 182 | // 183 | // HTTP Mapping: 500 Internal Server Error 184 | DATA_LOSS = 15; 185 | } 186 | -------------------------------------------------------------------------------- /google/rpc/error_details.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Google Inc. 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 google.rpc; 18 | 19 | import "google/protobuf/duration.proto"; 20 | 21 | option go_package = "rpc"; 22 | option java_multiple_files = true; 23 | option java_outer_classname = "ErrorDetailsProto"; 24 | option java_package = "com.google.rpc"; 25 | option objc_class_prefix = "RPC"; 26 | 27 | // Describes when the clients can retry a failed request. Clients could ignore 28 | // the recommendation here or retry when this information is missing from error 29 | // responses. 30 | // 31 | // It's always recommended that clients should use exponential backoff when 32 | // retrying. 33 | // 34 | // Clients should wait until `retry_delay` amount of time has passed since 35 | // receiving the error response before retrying. If retrying requests also 36 | // fail, clients should use an exponential backoff scheme to gradually increase 37 | // the delay between retries based on `retry_delay`, until either a maximum 38 | // number of retires have been reached or a maximum retry delay cap has been 39 | // reached. 40 | message RetryInfo { 41 | // Clients should wait at least this long between retrying the same request. 42 | google.protobuf.Duration retry_delay = 1; 43 | } 44 | 45 | // Describes additional debugging info. 46 | message DebugInfo { 47 | // The stack trace entries indicating where the error occurred. 48 | repeated string stack_entries = 1; 49 | 50 | // Additional debugging information provided by the server. 51 | string detail = 2; 52 | } 53 | 54 | // Describes how a quota check failed. 55 | // 56 | // For example if a daily limit was exceeded for the calling project, 57 | // a service could respond with a QuotaFailure detail containing the project 58 | // id and the description of the quota limit that was exceeded. If the 59 | // calling project hasn't enabled the service in the developer console, then 60 | // a service could respond with the project id and set `service_disabled` 61 | // to true. 62 | // 63 | // Also see RetryDetail and Help types for other details about handling a 64 | // quota failure. 65 | message QuotaFailure { 66 | // A message type used to describe a single quota violation. For example, a 67 | // daily quota or a custom quota that was exceeded. 68 | message Violation { 69 | // The subject on which the quota check failed. 70 | // For example, "clientip:" or "project:". 72 | string subject = 1; 73 | 74 | // A description of how the quota check failed. Clients can use this 75 | // description to find more about the quota configuration in the service's 76 | // public documentation, or find the relevant quota limit to adjust through 77 | // developer console. 78 | // 79 | // For example: "Service disabled" or "Daily Limit for read operations 80 | // exceeded". 81 | string description = 2; 82 | } 83 | 84 | // Describes all quota violations. 85 | repeated Violation violations = 1; 86 | } 87 | 88 | // Describes what preconditions have failed. 89 | // 90 | // For example, if an RPC failed because it required the Terms of Service to be 91 | // acknowledged, it could list the terms of service violation in the 92 | // PreconditionFailure message. 93 | message PreconditionFailure { 94 | // A message type used to describe a single precondition failure. 95 | message Violation { 96 | // The type of PreconditionFailure. We recommend using a service-specific 97 | // enum type to define the supported precondition violation types. For 98 | // example, "TOS" for "Terms of Service violation". 99 | string type = 1; 100 | 101 | // The subject, relative to the type, that failed. 102 | // For example, "google.com/cloud" relative to the "TOS" type would 103 | // indicate which terms of service is being referenced. 104 | string subject = 2; 105 | 106 | // A description of how the precondition failed. Developers can use this 107 | // description to understand how to fix the failure. 108 | // 109 | // For example: "Terms of service not accepted". 110 | string description = 3; 111 | } 112 | 113 | // Describes all precondition violations. 114 | repeated Violation violations = 1; 115 | } 116 | 117 | // Describes violations in a client request. This error type focuses on the 118 | // syntactic aspects of the request. 119 | message BadRequest { 120 | // A message type used to describe a single bad request field. 121 | message FieldViolation { 122 | // A path leading to a field in the request body. The value will be a 123 | // sequence of dot-separated identifiers that identify a protocol buffer 124 | // field. E.g., "field_violations.field" would identify this field. 125 | string field = 1; 126 | 127 | // A description of why the request element is bad. 128 | string description = 2; 129 | } 130 | 131 | // Describes all violations in a client request. 132 | repeated FieldViolation field_violations = 1; 133 | } 134 | 135 | // Contains metadata about the request that clients can attach when filing a bug 136 | // or providing other forms of feedback. 137 | message RequestInfo { 138 | // An opaque string that should only be interpreted by the service generating 139 | // it. For example, it can be used to identify requests in the service's logs. 140 | string request_id = 1; 141 | 142 | // Any data that was used to serve this request. For example, an encrypted 143 | // stack trace that can be sent back to the service provider for debugging. 144 | string serving_data = 2; 145 | } 146 | 147 | // Describes the resource that is being accessed. 148 | message ResourceInfo { 149 | // A name for the type of resource being accessed, e.g. "sql table", 150 | // "cloud storage bucket", "file", "Google calendar"; or the type URL 151 | // of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". 152 | string resource_type = 1; 153 | 154 | // The name of the resource being accessed. For example, a shared calendar 155 | // name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current 156 | // error is 157 | // [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. 158 | string resource_name = 2; 159 | 160 | // The owner of the resource (optional). 161 | // For example, "user:" or "project:". 163 | string owner = 3; 164 | 165 | // Describes what error is encountered when accessing this resource. 166 | // For example, updating a cloud project may require the `writer` permission 167 | // on the developer console project. 168 | string description = 4; 169 | } 170 | 171 | // Provides links to documentation or for performing an out of band action. 172 | // 173 | // For example, if a quota check failed with an error indicating the calling 174 | // project hasn't enabled the accessed service, this can contain a URL pointing 175 | // directly to the right place in the developer console to flip the bit. 176 | message Help { 177 | // Describes a URL link. 178 | message Link { 179 | // Describes what the link offers. 180 | string description = 1; 181 | 182 | // The URL of the link. 183 | string url = 2; 184 | } 185 | 186 | // URL(s) pointing to additional information on handling the current error. 187 | repeated Link links = 1; 188 | } 189 | 190 | // Provides a localized error message that is safe to return to the user 191 | // which can be attached to an RPC error. 192 | message LocalizedMessage { 193 | // The locale used following the specification defined at 194 | // http://www.rfc-editor.org/rfc/bcp/bcp47.txt. 195 | // Examples are: "en-US", "fr-CH", "es-MX" 196 | string locale = 1; 197 | 198 | // The localized error message in the above locale. 199 | string message = 2; 200 | } 201 | -------------------------------------------------------------------------------- /google/rpc/code.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 | // source: google/rpc/code.proto 3 | 4 | package rpc 5 | 6 | import ( 7 | fmt "fmt" 8 | proto "github.com/gogo/protobuf/proto" 9 | math "math" 10 | strconv "strconv" 11 | ) 12 | 13 | // Reference imports to suppress errors if they are not otherwise used. 14 | var _ = proto.Marshal 15 | var _ = fmt.Errorf 16 | var _ = math.Inf 17 | 18 | // This is a compile-time assertion to ensure that this generated file 19 | // is compatible with the proto package it is being compiled against. 20 | // A compilation error at this line likely means your copy of the 21 | // proto package needs to be updated. 22 | const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 23 | 24 | // The canonical error codes for Google APIs. 25 | // 26 | // 27 | // Sometimes multiple error codes may apply. Services should return 28 | // the most specific error code that applies. For example, prefer 29 | // `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply. 30 | // Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`. 31 | type Code int32 32 | 33 | const ( 34 | // Not an error; returned on success 35 | // 36 | // HTTP Mapping: 200 OK 37 | OK Code = 0 38 | // The operation was cancelled, typically by the caller. 39 | // 40 | // HTTP Mapping: 499 Client Closed Request 41 | CANCELLED Code = 1 42 | // Unknown error. For example, this error may be returned when 43 | // a `Status` value received from another address space belongs to 44 | // an error space that is not known in this address space. Also 45 | // errors raised by APIs that do not return enough error information 46 | // may be converted to this error. 47 | // 48 | // HTTP Mapping: 500 Internal Server Error 49 | UNKNOWN Code = 2 50 | // The client specified an invalid argument. Note that this differs 51 | // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments 52 | // that are problematic regardless of the state of the system 53 | // (e.g., a malformed file name). 54 | // 55 | // HTTP Mapping: 400 Bad Request 56 | INVALID_ARGUMENT Code = 3 57 | // The deadline expired before the operation could complete. For operations 58 | // that change the state of the system, this error may be returned 59 | // even if the operation has completed successfully. For example, a 60 | // successful response from a server could have been delayed long 61 | // enough for the deadline to expire. 62 | // 63 | // HTTP Mapping: 504 Gateway Timeout 64 | DEADLINE_EXCEEDED Code = 4 65 | // Some requested entity (e.g., file or directory) was not found. 66 | // 67 | // Note to server developers: if a request is denied for an entire class 68 | // of users, such as gradual feature rollout or undocumented whitelist, 69 | // `NOT_FOUND` may be used. If a request is denied for some users within 70 | // a class of users, such as user-based access control, `PERMISSION_DENIED` 71 | // must be used. 72 | // 73 | // HTTP Mapping: 404 Not Found 74 | NOT_FOUND Code = 5 75 | // The entity that a client attempted to create (e.g., file or directory) 76 | // already exists. 77 | // 78 | // HTTP Mapping: 409 Conflict 79 | ALREADY_EXISTS Code = 6 80 | // The caller does not have permission to execute the specified 81 | // operation. `PERMISSION_DENIED` must not be used for rejections 82 | // caused by exhausting some resource (use `RESOURCE_EXHAUSTED` 83 | // instead for those errors). `PERMISSION_DENIED` must not be 84 | // used if the caller can not be identified (use `UNAUTHENTICATED` 85 | // instead for those errors). This error code does not imply the 86 | // request is valid or the requested entity exists or satisfies 87 | // other pre-conditions. 88 | // 89 | // HTTP Mapping: 403 Forbidden 90 | PERMISSION_DENIED Code = 7 91 | // The request does not have valid authentication credentials for the 92 | // operation. 93 | // 94 | // HTTP Mapping: 401 Unauthorized 95 | UNAUTHENTICATED Code = 16 96 | // Some resource has been exhausted, perhaps a per-user quota, or 97 | // perhaps the entire file system is out of space. 98 | // 99 | // HTTP Mapping: 429 Too Many Requests 100 | RESOURCE_EXHAUSTED Code = 8 101 | // The operation was rejected because the system is not in a state 102 | // required for the operation's execution. For example, the directory 103 | // to be deleted is non-empty, an rmdir operation is applied to 104 | // a non-directory, etc. 105 | // 106 | // Service implementors can use the following guidelines to decide 107 | // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: 108 | // (a) Use `UNAVAILABLE` if the client can retry just the failing call. 109 | // (b) Use `ABORTED` if the client should retry at a higher level 110 | // (e.g., when a client-specified test-and-set fails, indicating the 111 | // client should restart a read-modify-write sequence). 112 | // (c) Use `FAILED_PRECONDITION` if the client should not retry until 113 | // the system state has been explicitly fixed. E.g., if an "rmdir" 114 | // fails because the directory is non-empty, `FAILED_PRECONDITION` 115 | // should be returned since the client should not retry unless 116 | // the files are deleted from the directory. 117 | // 118 | // HTTP Mapping: 400 Bad Request 119 | FAILED_PRECONDITION Code = 9 120 | // The operation was aborted, typically due to a concurrency issue such as 121 | // a sequencer check failure or transaction abort. 122 | // 123 | // See the guidelines above for deciding between `FAILED_PRECONDITION`, 124 | // `ABORTED`, and `UNAVAILABLE`. 125 | // 126 | // HTTP Mapping: 409 Conflict 127 | ABORTED Code = 10 128 | // The operation was attempted past the valid range. E.g., seeking or 129 | // reading past end-of-file. 130 | // 131 | // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may 132 | // be fixed if the system state changes. For example, a 32-bit file 133 | // system will generate `INVALID_ARGUMENT` if asked to read at an 134 | // offset that is not in the range [0,2^32-1], but it will generate 135 | // `OUT_OF_RANGE` if asked to read from an offset past the current 136 | // file size. 137 | // 138 | // There is a fair bit of overlap between `FAILED_PRECONDITION` and 139 | // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific 140 | // error) when it applies so that callers who are iterating through 141 | // a space can easily look for an `OUT_OF_RANGE` error to detect when 142 | // they are done. 143 | // 144 | // HTTP Mapping: 400 Bad Request 145 | OUT_OF_RANGE Code = 11 146 | // The operation is not implemented or is not supported/enabled in this 147 | // service. 148 | // 149 | // HTTP Mapping: 501 Not Implemented 150 | UNIMPLEMENTED Code = 12 151 | // Internal errors. This means that some invariants expected by the 152 | // underlying system have been broken. This error code is reserved 153 | // for serious errors. 154 | // 155 | // HTTP Mapping: 500 Internal Server Error 156 | INTERNAL Code = 13 157 | // The service is currently unavailable. This is most likely a 158 | // transient condition, which can be corrected by retrying with 159 | // a backoff. 160 | // 161 | // See the guidelines above for deciding between `FAILED_PRECONDITION`, 162 | // `ABORTED`, and `UNAVAILABLE`. 163 | // 164 | // HTTP Mapping: 503 Service Unavailable 165 | UNAVAILABLE Code = 14 166 | // Unrecoverable data loss or corruption. 167 | // 168 | // HTTP Mapping: 500 Internal Server Error 169 | DATA_LOSS Code = 15 170 | ) 171 | 172 | var Code_name = map[int32]string{ 173 | 0: "OK", 174 | 1: "CANCELLED", 175 | 2: "UNKNOWN", 176 | 3: "INVALID_ARGUMENT", 177 | 4: "DEADLINE_EXCEEDED", 178 | 5: "NOT_FOUND", 179 | 6: "ALREADY_EXISTS", 180 | 7: "PERMISSION_DENIED", 181 | 16: "UNAUTHENTICATED", 182 | 8: "RESOURCE_EXHAUSTED", 183 | 9: "FAILED_PRECONDITION", 184 | 10: "ABORTED", 185 | 11: "OUT_OF_RANGE", 186 | 12: "UNIMPLEMENTED", 187 | 13: "INTERNAL", 188 | 14: "UNAVAILABLE", 189 | 15: "DATA_LOSS", 190 | } 191 | 192 | var Code_value = map[string]int32{ 193 | "OK": 0, 194 | "CANCELLED": 1, 195 | "UNKNOWN": 2, 196 | "INVALID_ARGUMENT": 3, 197 | "DEADLINE_EXCEEDED": 4, 198 | "NOT_FOUND": 5, 199 | "ALREADY_EXISTS": 6, 200 | "PERMISSION_DENIED": 7, 201 | "UNAUTHENTICATED": 16, 202 | "RESOURCE_EXHAUSTED": 8, 203 | "FAILED_PRECONDITION": 9, 204 | "ABORTED": 10, 205 | "OUT_OF_RANGE": 11, 206 | "UNIMPLEMENTED": 12, 207 | "INTERNAL": 13, 208 | "UNAVAILABLE": 14, 209 | "DATA_LOSS": 15, 210 | } 211 | 212 | func (Code) EnumDescriptor() ([]byte, []int) { 213 | return fileDescriptor_fe593a732623ccf0, []int{0} 214 | } 215 | 216 | func init() { 217 | proto.RegisterEnum("google.rpc.Code", Code_name, Code_value) 218 | } 219 | 220 | func init() { proto.RegisterFile("google/rpc/code.proto", fileDescriptor_fe593a732623ccf0) } 221 | 222 | var fileDescriptor_fe593a732623ccf0 = []byte{ 223 | // 393 bytes of a gzipped FileDescriptorProto 224 | 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x91, 0x3d, 0x6e, 0x13, 0x41, 225 | 0x14, 0xc7, 0x3d, 0x76, 0x70, 0xe2, 0xf1, 0xd7, 0xcb, 0x84, 0x40, 0x37, 0x07, 0xa0, 0x70, 0x0a, 226 | 0x4e, 0xf0, 0xbc, 0xf3, 0x9c, 0x8c, 0x32, 0x7e, 0xb3, 0x9a, 0x9d, 0x09, 0x01, 0x21, 0xad, 0xc4, 227 | 0xc6, 0x4a, 0x03, 0x5a, 0xcb, 0xe2, 0x00, 0x9c, 0x85, 0x8a, 0x1b, 0x70, 0x85, 0x94, 0x29, 0x29, 228 | 0xf1, 0xa6, 0xa1, 0x74, 0x49, 0x89, 0x06, 0x0a, 0xda, 0x9f, 0xde, 0xc7, 0xff, 0x43, 0x9e, 0xdf, 229 | 0xb7, 0xed, 0xfd, 0xc7, 0xcd, 0xc5, 0x6e, 0xdb, 0x5c, 0x34, 0xed, 0xdd, 0x66, 0xb1, 0xdd, 0xb5, 230 | 0x9f, 0x5b, 0x25, 0xff, 0xe1, 0xc5, 0x6e, 0xdb, 0xbc, 0xfa, 0xde, 0x97, 0x47, 0x45, 0x7b, 0xb7, 231 | 0x51, 0x43, 0xd9, 0xf7, 0xd7, 0xd0, 0x53, 0x53, 0x39, 0x2a, 0x90, 0x0b, 0x72, 0x8e, 0x0c, 0x08, 232 | 0x35, 0x96, 0xc7, 0x89, 0xaf, 0xd9, 0xbf, 0x61, 0xe8, 0xab, 0xe7, 0x12, 0x2c, 0xdf, 0xa0, 0xb3, 233 | 0xa6, 0xc6, 0x70, 0x99, 0xd6, 0xc4, 0x11, 0x06, 0xea, 0x5c, 0x9e, 0x1a, 0x42, 0xe3, 0x2c, 0x53, 234 | 0x4d, 0xb7, 0x05, 0x91, 0x21, 0x03, 0x47, 0xf9, 0x10, 0xfb, 0x58, 0xaf, 0x7c, 0x62, 0x03, 0xcf, 235 | 0x94, 0x92, 0x33, 0x74, 0x81, 0xd0, 0xbc, 0xad, 0xe9, 0xd6, 0x56, 0xb1, 0x82, 0x61, 0xde, 0x2c, 236 | 0x29, 0xac, 0x6d, 0x55, 0x59, 0xcf, 0xb5, 0x21, 0xb6, 0x64, 0xe0, 0x58, 0x9d, 0xc9, 0x79, 0x62, 237 | 0x4c, 0xf1, 0x8a, 0x38, 0xda, 0x02, 0x23, 0x19, 0x00, 0xf5, 0x42, 0xaa, 0x40, 0x95, 0x4f, 0xa1, 238 | 0xc8, 0x5f, 0xae, 0x30, 0x55, 0x99, 0x9f, 0xa8, 0x97, 0xf2, 0x6c, 0x85, 0xd6, 0x91, 0xa9, 0xcb, 239 | 0x40, 0x85, 0x67, 0x63, 0xa3, 0xf5, 0x0c, 0xa3, 0xac, 0x1c, 0x97, 0x3e, 0xe4, 0x29, 0xa9, 0x40, 240 | 0x4e, 0x7c, 0x8a, 0xb5, 0x5f, 0xd5, 0x01, 0xf9, 0x92, 0x60, 0xac, 0x4e, 0xe5, 0x34, 0xb1, 0x5d, 241 | 0x97, 0x8e, 0xb2, 0x0d, 0x32, 0x30, 0x51, 0x13, 0x79, 0x62, 0x39, 0x52, 0x60, 0x74, 0x30, 0x55, 242 | 0x73, 0x39, 0x4e, 0x8c, 0x37, 0x68, 0x1d, 0x2e, 0x1d, 0xc1, 0x2c, 0x1b, 0x32, 0x18, 0xb1, 0x76, 243 | 0xbe, 0xaa, 0x60, 0xbe, 0x7c, 0xff, 0xb8, 0xd7, 0xbd, 0x1f, 0x7b, 0xdd, 0x3b, 0xec, 0xb5, 0xf8, 244 | 0xbd, 0xd7, 0xe2, 0x4b, 0xa7, 0xc5, 0xb7, 0x4e, 0x8b, 0x87, 0x4e, 0x8b, 0xc7, 0x4e, 0x8b, 0x9f, 245 | 0x9d, 0x16, 0xbf, 0x3a, 0xdd, 0x3b, 0x64, 0xfe, 0xa4, 0xc5, 0xc3, 0x93, 0x16, 0x72, 0xd6, 0xb4, 246 | 0x9f, 0x16, 0xff, 0xf3, 0x5f, 0x8e, 0x72, 0xf8, 0x65, 0xae, 0xa5, 0x14, 0xef, 0x06, 0xbb, 0x6d, 247 | 0xf3, 0xb5, 0x3f, 0x08, 0x65, 0xf1, 0x61, 0xf8, 0xb7, 0xaa, 0xd7, 0x7f, 0x02, 0x00, 0x00, 0xff, 248 | 0xff, 0x03, 0xd4, 0x27, 0xff, 0xc3, 0x01, 0x00, 0x00, 249 | } 250 | 251 | func (x Code) String() string { 252 | s, ok := Code_name[int32(x)] 253 | if ok { 254 | return s 255 | } 256 | return strconv.Itoa(int(x)) 257 | } 258 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2015, Google Inc 190 | Copyright 2018, GoGo Authors 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | 204 | -------------------------------------------------------------------------------- /google/api/expr/v1alpha1/syntax.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Google LLC. 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 | 16 | syntax = "proto3"; 17 | 18 | package google.api.expr.v1alpha1; 19 | 20 | import "google/protobuf/duration.proto"; 21 | import "google/protobuf/struct.proto"; 22 | import "google/protobuf/timestamp.proto"; 23 | 24 | option cc_enable_arenas = true; 25 | option go_package = "expr"; 26 | option java_multiple_files = true; 27 | option java_outer_classname = "SyntaxProto"; 28 | option java_package = "com.google.api.expr.v1alpha1"; 29 | 30 | // A representation of the abstract syntax of the Common Expression Language. 31 | 32 | // An expression together with source information as returned by the parser. 33 | message ParsedExpr { 34 | // The parsed expression. 35 | Expr expr = 2; 36 | 37 | // The source info derived from input that generated the parsed `expr`. 38 | SourceInfo source_info = 3; 39 | } 40 | 41 | // An abstract representation of a common expression. 42 | // 43 | // Expressions are abstractly represented as a collection of identifiers, 44 | // select statements, function calls, literals, and comprehensions. All 45 | // operators with the exception of the '.' operator are modelled as function 46 | // calls. This makes it easy to represent new operators into the existing AST. 47 | // 48 | // All references within expressions must resolve to a 49 | // [Decl][google.api.expr.v1alpha1.Decl] provided at type-check for an 50 | // expression to be valid. A reference may either be a bare identifier `name` or 51 | // a qualified identifier `google.api.name`. References may either refer to a 52 | // value or a function declaration. 53 | // 54 | // For example, the expression `google.api.name.startsWith('expr')` references 55 | // the declaration `google.api.name` within a 56 | // [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression, and the 57 | // function declaration `startsWith`. 58 | message Expr { 59 | // An identifier expression. e.g. `request`. 60 | message Ident { 61 | // Required. Holds a single, unqualified identifier, possibly preceded by a 62 | // '.'. 63 | // 64 | // Qualified names are represented by the 65 | // [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression. 66 | string name = 1; 67 | } 68 | 69 | // A field selection expression. e.g. `request.auth`. 70 | message Select { 71 | // Required. The target of the selection expression. 72 | // 73 | // For example, in the select expression `request.auth`, the `request` 74 | // portion of the expression is the `operand`. 75 | Expr operand = 1; 76 | 77 | // Required. The name of the field to select. 78 | // 79 | // For example, in the select expression `request.auth`, the `auth` portion 80 | // of the expression would be the `field`. 81 | string field = 2; 82 | 83 | // Whether the select is to be interpreted as a field presence test. 84 | // 85 | // This results from the macro `has(request.auth)`. 86 | bool test_only = 3; 87 | } 88 | 89 | // A call expression, including calls to predefined functions and operators. 90 | // 91 | // For example, `value == 10`, `size(map_value)`. 92 | message Call { 93 | // The target of an method call-style expression. For example, `x` in 94 | // `x.f()`. 95 | Expr target = 1; 96 | 97 | // Required. The name of the function or method being called. 98 | string function = 2; 99 | 100 | // The arguments. 101 | repeated Expr args = 3; 102 | } 103 | 104 | // A list creation expression. 105 | // 106 | // Lists may either be homogenous, e.g. `[1, 2, 3]`, or heterogenous, e.g. 107 | // `dyn([1, 'hello', 2.0])` 108 | message CreateList { 109 | // The elements part of the list. 110 | repeated Expr elements = 1; 111 | } 112 | 113 | // A map or message creation expression. 114 | // 115 | // Maps are constructed as `{'key_name': 'value'}`. Message construction is 116 | // similar, but prefixed with a type name and composed of field ids: 117 | // `types.MyType{field_id: 'value'}`. 118 | message CreateStruct { 119 | // Represents an entry. 120 | message Entry { 121 | // Required. An id assigned to this node by the parser which is unique 122 | // in a given expression tree. This is used to associate type 123 | // information and other attributes to the node. 124 | int64 id = 1; 125 | 126 | // The `Entry` key kinds. 127 | oneof key_kind { 128 | // The field key for a message creator statement. 129 | string field_key = 2; 130 | 131 | // The key expression for a map creation statement. 132 | Expr map_key = 3; 133 | } 134 | 135 | // Required. The value assigned to the key. 136 | Expr value = 4; 137 | } 138 | 139 | // The type name of the message to be created, empty when creating map 140 | // literals. 141 | string message_name = 1; 142 | 143 | // The entries in the creation expression. 144 | repeated Entry entries = 2; 145 | } 146 | 147 | // A comprehension expression applied to a list or map. 148 | // 149 | // Comprehensions are not part of the core syntax, but enabled with macros. 150 | // A macro matches a specific call signature within a parsed AST and replaces 151 | // the call with an alternate AST block. Macro expansion happens at parse 152 | // time. 153 | // 154 | // The following macros are supported within CEL: 155 | // 156 | // Aggregate type macros may be applied to all elements in a list or all keys 157 | // in a map: 158 | // 159 | // * `all`, `exists`, `exists_one` - test a predicate expression against 160 | // the inputs and return `true` if the predicate is satisfied for all, 161 | // any, or only one value `list.all(x, x < 10)`. 162 | // * `filter` - test a predicate expression against the inputs and return 163 | // the subset of elements which satisfy the predicate: 164 | // `payments.filter(p, p > 1000)`. 165 | // * `map` - apply an expression to all elements in the input and return the 166 | // output aggregate type: `[1, 2, 3].map(i, i * i)`. 167 | // 168 | // The `has(m.x)` macro tests whether the property `x` is present in struct 169 | // `m`. The semantics of this macro depend on the type of `m`. For proto2 170 | // messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the 171 | // macro tests whether the property is set to its default. For map and struct 172 | // types, the macro tests whether the property `x` is defined on `m`. 173 | message Comprehension { 174 | // The name of the iteration variable. 175 | string iter_var = 1; 176 | 177 | // The range over which var iterates. 178 | Expr iter_range = 2; 179 | 180 | // The name of the variable used for accumulation of the result. 181 | string accu_var = 3; 182 | 183 | // The initial value of the accumulator. 184 | Expr accu_init = 4; 185 | 186 | // An expression which can contain iter_var and accu_var. 187 | // 188 | // Returns false when the result has been computed and may be used as 189 | // a hint to short-circuit the remainder of the comprehension. 190 | Expr loop_condition = 5; 191 | 192 | // An expression which can contain iter_var and accu_var. 193 | // 194 | // Computes the next value of accu_var. 195 | Expr loop_step = 6; 196 | 197 | // An expression which can contain accu_var. 198 | // 199 | // Computes the result. 200 | Expr result = 7; 201 | } 202 | 203 | // Required. An id assigned to this node by the parser which is unique in a 204 | // given expression tree. This is used to associate type information and other 205 | // attributes to a node in the parse tree. 206 | int64 id = 2; 207 | 208 | // Required. Variants of expressions. 209 | oneof expr_kind { 210 | // A literal expression. 211 | Constant const_expr = 3; 212 | 213 | // An identifier expression. 214 | Ident ident_expr = 4; 215 | 216 | // A field selection expression, e.g. `request.auth`. 217 | Select select_expr = 5; 218 | 219 | // A call expression, including calls to predefined functions and operators. 220 | Call call_expr = 6; 221 | 222 | // A list creation expression. 223 | CreateList list_expr = 7; 224 | 225 | // A map or message creation expression. 226 | CreateStruct struct_expr = 8; 227 | 228 | // A comprehension expression. 229 | Comprehension comprehension_expr = 9; 230 | } 231 | } 232 | 233 | // Represents a primitive literal. 234 | // 235 | // Named 'Constant' here for backwards compatibility. 236 | // 237 | // This is similar as the primitives supported in the well-known type 238 | // `google.protobuf.Value`, but richer so it can represent CEL's full range of 239 | // primitives. 240 | // 241 | // Lists and structs are not included as constants as these aggregate types may 242 | // contain [Expr][google.api.expr.v1alpha1.Expr] elements which require 243 | // evaluation and are thus not constant. 244 | // 245 | // Examples of literals include: `"hello"`, `b'bytes'`, `1u`, `4.2`, `-2`, 246 | // `true`, `null`. 247 | message Constant { 248 | // Required. The valid constant kinds. 249 | oneof constant_kind { 250 | // null value. 251 | google.protobuf.NullValue null_value = 1; 252 | 253 | // boolean value. 254 | bool bool_value = 2; 255 | 256 | // int64 value. 257 | int64 int64_value = 3; 258 | 259 | // uint64 value. 260 | uint64 uint64_value = 4; 261 | 262 | // double value. 263 | double double_value = 5; 264 | 265 | // string value. 266 | string string_value = 6; 267 | 268 | // bytes value. 269 | bytes bytes_value = 7; 270 | 271 | // protobuf.Duration value. 272 | // 273 | // Deprecated: duration is no longer considered a builtin cel type. 274 | google.protobuf.Duration duration_value = 8 [deprecated = true]; 275 | 276 | // protobuf.Timestamp value. 277 | // 278 | // Deprecated: timestamp is no longer considered a builtin cel type. 279 | google.protobuf.Timestamp timestamp_value = 9 [deprecated = true]; 280 | } 281 | } 282 | 283 | // Source information collected at parse time. 284 | message SourceInfo { 285 | // The syntax version of the source, e.g. `cel1`. 286 | string syntax_version = 1; 287 | 288 | // The location name. All position information attached to an expression is 289 | // relative to this location. 290 | // 291 | // The location could be a file, UI element, or similar. For example, 292 | // `acme/app/AnvilPolicy.cel`. 293 | string location = 2; 294 | 295 | // Monotonically increasing list of character offsets where newlines appear. 296 | // 297 | // The line number of a given position is the index `i` where for a given 298 | // `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The 299 | // column may be derivd from `id_positions[id] - line_offsets[i]`. 300 | repeated int32 line_offsets = 3; 301 | 302 | // A map from the parse node id (e.g. `Expr.id`) to the character offset 303 | // within source. 304 | map positions = 4; 305 | } 306 | 307 | // A specific position in source. 308 | message SourcePosition { 309 | // The soucre location name (e.g. file name). 310 | string location = 1; 311 | 312 | // The character offset. 313 | int32 offset = 2; 314 | 315 | // The 1-based index of the starting line in the source text 316 | // where the issue occurs, or 0 if unknown. 317 | int32 line = 3; 318 | 319 | // The 0-based index of the starting position within the line of source text 320 | // where the issue occurs. Only meaningful if line is nonzero. 321 | int32 column = 4; 322 | } 323 | -------------------------------------------------------------------------------- /google/api/http.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Google LLC. 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 | 16 | syntax = "proto3"; 17 | 18 | package google.api; 19 | 20 | option cc_enable_arenas = true; 21 | option go_package = "api"; 22 | option java_multiple_files = true; 23 | option java_outer_classname = "HttpProto"; 24 | option java_package = "com.google.api"; 25 | option objc_class_prefix = "GAPI"; 26 | 27 | // Defines the HTTP configuration for an API service. It contains a list of 28 | // [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method 29 | // to one or more HTTP REST API methods. 30 | message Http { 31 | // A list of HTTP configuration rules that apply to individual API methods. 32 | // 33 | // **NOTE:** All service configuration rules follow "last one wins" order. 34 | repeated HttpRule rules = 1; 35 | 36 | // When set to true, URL path parameters will be fully URI-decoded except in 37 | // cases of single segment matches in reserved expansion, where "%2F" will be 38 | // left encoded. 39 | // 40 | // The default behavior is to not decode RFC 6570 reserved characters in multi 41 | // segment matches. 42 | bool fully_decode_reserved_expansion = 2; 43 | } 44 | 45 | // # gRPC Transcoding 46 | // 47 | // gRPC Transcoding is a feature for mapping between a gRPC method and one or 48 | // more HTTP REST endpoints. It allows developers to build a single API service 49 | // that supports both gRPC APIs and REST APIs. Many systems, including [Google 50 | // APIs](https://github.com/googleapis/googleapis), 51 | // [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC 52 | // Gateway](https://github.com/grpc-ecosystem/grpc-gateway), 53 | // and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature 54 | // and use it for large scale production services. 55 | // 56 | // `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies 57 | // how different portions of the gRPC request message are mapped to the URL 58 | // path, URL query parameters, and HTTP request body. It also controls how the 59 | // gRPC response message is mapped to the HTTP response body. `HttpRule` is 60 | // typically specified as an `google.api.http` annotation on the gRPC method. 61 | // 62 | // Each mapping specifies a URL path template and an HTTP method. The path 63 | // template may refer to one or more fields in the gRPC request message, as long 64 | // as each field is a non-repeated field with a primitive (non-message) type. 65 | // The path template controls how fields of the request message are mapped to 66 | // the URL path. 67 | // 68 | // Example: 69 | // 70 | // service Messaging { 71 | // rpc GetMessage(GetMessageRequest) returns (Message) { 72 | // option (google.api.http) = { 73 | // get: "/v1/{name=messages/*}" 74 | // }; 75 | // } 76 | // } 77 | // message GetMessageRequest { 78 | // string name = 1; // Mapped to URL path. 79 | // } 80 | // message Message { 81 | // string text = 1; // The resource content. 82 | // } 83 | // 84 | // This enables an HTTP REST to gRPC mapping as below: 85 | // 86 | // HTTP | gRPC 87 | // -----|----- 88 | // `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` 89 | // 90 | // Any fields in the request message which are not bound by the path template 91 | // automatically become HTTP query parameters if there is no HTTP request body. 92 | // For example: 93 | // 94 | // service Messaging { 95 | // rpc GetMessage(GetMessageRequest) returns (Message) { 96 | // option (google.api.http) = { 97 | // get:"/v1/messages/{message_id}" 98 | // }; 99 | // } 100 | // } 101 | // message GetMessageRequest { 102 | // message SubMessage { 103 | // string subfield = 1; 104 | // } 105 | // string message_id = 1; // Mapped to URL path. 106 | // int64 revision = 2; // Mapped to URL query parameter `revision`. 107 | // SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. 108 | // } 109 | // 110 | // This enables a HTTP JSON to RPC mapping as below: 111 | // 112 | // HTTP | gRPC 113 | // -----|----- 114 | // `GET /v1/messages/123456?revision=2&sub.subfield=foo` | 115 | // `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: 116 | // "foo"))` 117 | // 118 | // Note that fields which are mapped to URL query parameters must have a 119 | // primitive type or a repeated primitive type or a non-repeated message type. 120 | // In the case of a repeated type, the parameter can be repeated in the URL 121 | // as `...?param=A¶m=B`. In the case of a message type, each field of the 122 | // message is mapped to a separate parameter, such as 123 | // `...?foo.a=A&foo.b=B&foo.c=C`. 124 | // 125 | // For HTTP methods that allow a request body, the `body` field 126 | // specifies the mapping. Consider a REST update method on the 127 | // message resource collection: 128 | // 129 | // service Messaging { 130 | // rpc UpdateMessage(UpdateMessageRequest) returns (Message) { 131 | // option (google.api.http) = { 132 | // patch: "/v1/messages/{message_id}" 133 | // body: "message" 134 | // }; 135 | // } 136 | // } 137 | // message UpdateMessageRequest { 138 | // string message_id = 1; // mapped to the URL 139 | // Message message = 2; // mapped to the body 140 | // } 141 | // 142 | // The following HTTP JSON to RPC mapping is enabled, where the 143 | // representation of the JSON in the request body is determined by 144 | // protos JSON encoding: 145 | // 146 | // HTTP | gRPC 147 | // -----|----- 148 | // `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: 149 | // "123456" message { text: "Hi!" })` 150 | // 151 | // The special name `*` can be used in the body mapping to define that 152 | // every field not bound by the path template should be mapped to the 153 | // request body. This enables the following alternative definition of 154 | // the update method: 155 | // 156 | // service Messaging { 157 | // rpc UpdateMessage(Message) returns (Message) { 158 | // option (google.api.http) = { 159 | // patch: "/v1/messages/{message_id}" 160 | // body: "*" 161 | // }; 162 | // } 163 | // } 164 | // message Message { 165 | // string message_id = 1; 166 | // string text = 2; 167 | // } 168 | // 169 | // 170 | // The following HTTP JSON to RPC mapping is enabled: 171 | // 172 | // HTTP | gRPC 173 | // -----|----- 174 | // `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: 175 | // "123456" text: "Hi!")` 176 | // 177 | // Note that when using `*` in the body mapping, it is not possible to 178 | // have HTTP parameters, as all fields not bound by the path end in 179 | // the body. This makes this option more rarely used in practice when 180 | // defining REST APIs. The common usage of `*` is in custom methods 181 | // which don't use the URL at all for transferring data. 182 | // 183 | // It is possible to define multiple HTTP methods for one RPC by using 184 | // the `additional_bindings` option. Example: 185 | // 186 | // service Messaging { 187 | // rpc GetMessage(GetMessageRequest) returns (Message) { 188 | // option (google.api.http) = { 189 | // get: "/v1/messages/{message_id}" 190 | // additional_bindings { 191 | // get: "/v1/users/{user_id}/messages/{message_id}" 192 | // } 193 | // }; 194 | // } 195 | // } 196 | // message GetMessageRequest { 197 | // string message_id = 1; 198 | // string user_id = 2; 199 | // } 200 | // 201 | // This enables the following two alternative HTTP JSON to RPC mappings: 202 | // 203 | // HTTP | gRPC 204 | // -----|----- 205 | // `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` 206 | // `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: 207 | // "123456")` 208 | // 209 | // ## Rules for HTTP mapping 210 | // 211 | // 1. Leaf request fields (recursive expansion nested messages in the request 212 | // message) are classified into three categories: 213 | // - Fields referred by the path template. They are passed via the URL path. 214 | // - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP 215 | // request body. 216 | // - All other fields are passed via the URL query parameters, and the 217 | // parameter name is the field path in the request message. A repeated 218 | // field can be represented as multiple query parameters under the same 219 | // name. 220 | // 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields 221 | // are passed via URL path and HTTP request body. 222 | // 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all 223 | // fields are passed via URL path and URL query parameters. 224 | // 225 | // ### Path template syntax 226 | // 227 | // Template = "/" Segments [ Verb ] ; 228 | // Segments = Segment { "/" Segment } ; 229 | // Segment = "*" | "**" | LITERAL | Variable ; 230 | // Variable = "{" FieldPath [ "=" Segments ] "}" ; 231 | // FieldPath = IDENT { "." IDENT } ; 232 | // Verb = ":" LITERAL ; 233 | // 234 | // The syntax `*` matches a single URL path segment. The syntax `**` matches 235 | // zero or more URL path segments, which must be the last part of the URL path 236 | // except the `Verb`. 237 | // 238 | // The syntax `Variable` matches part of the URL path as specified by its 239 | // template. A variable template must not contain other variables. If a variable 240 | // matches a single path segment, its template may be omitted, e.g. `{var}` 241 | // is equivalent to `{var=*}`. 242 | // 243 | // The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` 244 | // contains any reserved character, such characters should be percent-encoded 245 | // before the matching. 246 | // 247 | // If a variable contains exactly one path segment, such as `"{var}"` or 248 | // `"{var=*}"`, when such a variable is expanded into a URL path on the client 249 | // side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The 250 | // server side does the reverse decoding. Such variables show up in the 251 | // [Discovery 252 | // Document](https://developers.google.com/discovery/v1/reference/apis) as 253 | // `{var}`. 254 | // 255 | // If a variable contains multiple path segments, such as `"{var=foo/*}"` 256 | // or `"{var=**}"`, when such a variable is expanded into a URL path on the 257 | // client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. 258 | // The server side does the reverse decoding, except "%2F" and "%2f" are left 259 | // unchanged. Such variables show up in the 260 | // [Discovery 261 | // Document](https://developers.google.com/discovery/v1/reference/apis) as 262 | // `{+var}`. 263 | // 264 | // ## Using gRPC API Service Configuration 265 | // 266 | // gRPC API Service Configuration (service config) is a configuration language 267 | // for configuring a gRPC service to become a user-facing product. The 268 | // service config is simply the YAML representation of the `google.api.Service` 269 | // proto message. 270 | // 271 | // As an alternative to annotating your proto file, you can configure gRPC 272 | // transcoding in your service config YAML files. You do this by specifying a 273 | // `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same 274 | // effect as the proto annotation. This can be particularly useful if you 275 | // have a proto that is reused in multiple services. Note that any transcoding 276 | // specified in the service config will override any matching transcoding 277 | // configuration in the proto. 278 | // 279 | // Example: 280 | // 281 | // http: 282 | // rules: 283 | // # Selects a gRPC method and applies HttpRule to it. 284 | // - selector: example.v1.Messaging.GetMessage 285 | // get: /v1/messages/{message_id}/{sub.subfield} 286 | // 287 | // ## Special notes 288 | // 289 | // When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the 290 | // proto to JSON conversion must follow the [proto3 291 | // specification](https://developers.google.com/protocol-buffers/docs/proto3#json). 292 | // 293 | // While the single segment variable follows the semantics of 294 | // [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String 295 | // Expansion, the multi segment variable **does not** follow RFC 6570 Section 296 | // 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion 297 | // does not expand special characters like `?` and `#`, which would lead 298 | // to invalid URLs. As the result, gRPC Transcoding uses a custom encoding 299 | // for multi segment variables. 300 | // 301 | // The path variables **must not** refer to any repeated or mapped field, 302 | // because client libraries are not capable of handling such variable expansion. 303 | // 304 | // The path variables **must not** capture the leading "/" character. The reason 305 | // is that the most common use case "{var}" does not capture the leading "/" 306 | // character. For consistency, all path variables must share the same behavior. 307 | // 308 | // Repeated message fields must not be mapped to URL query parameters, because 309 | // no client library can support such complicated mapping. 310 | // 311 | // If an API needs to use a JSON array for request or response body, it can map 312 | // the request or response body to a repeated field. However, some gRPC 313 | // Transcoding implementations may not support this feature. 314 | message HttpRule { 315 | // Selects a method to which this rule applies. 316 | // 317 | // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. 318 | string selector = 1; 319 | 320 | // Determines the URL pattern is matched by this rules. This pattern can be 321 | // used with any of the {get|put|post|delete|patch} methods. A custom method 322 | // can be defined using the 'custom' field. 323 | oneof pattern { 324 | // Maps to HTTP GET. Used for listing and getting information about 325 | // resources. 326 | string get = 2; 327 | 328 | // Maps to HTTP PUT. Used for replacing a resource. 329 | string put = 3; 330 | 331 | // Maps to HTTP POST. Used for creating a resource or performing an action. 332 | string post = 4; 333 | 334 | // Maps to HTTP DELETE. Used for deleting a resource. 335 | string delete = 5; 336 | 337 | // Maps to HTTP PATCH. Used for updating a resource. 338 | string patch = 6; 339 | 340 | // The custom pattern is used for specifying an HTTP method that is not 341 | // included in the `pattern` field, such as HEAD, or "*" to leave the 342 | // HTTP method unspecified for this rule. The wild-card rule is useful 343 | // for services that provide content to Web (HTML) clients. 344 | CustomHttpPattern custom = 8; 345 | } 346 | 347 | // The name of the request field whose value is mapped to the HTTP request 348 | // body, or `*` for mapping all request fields not captured by the path 349 | // pattern to the HTTP body, or omitted for not having any HTTP request body. 350 | // 351 | // NOTE: the referred field must be present at the top-level of the request 352 | // message type. 353 | string body = 7; 354 | 355 | // Optional. The name of the response field whose value is mapped to the HTTP 356 | // response body. When omitted, the entire response message will be used 357 | // as the HTTP response body. 358 | // 359 | // NOTE: The referred field must be present at the top-level of the response 360 | // message type. 361 | string response_body = 12; 362 | 363 | // Additional HTTP bindings for the selector. Nested bindings must 364 | // not contain an `additional_bindings` field themselves (that is, 365 | // the nesting may only be one level deep). 366 | repeated HttpRule additional_bindings = 11; 367 | } 368 | 369 | // A custom pattern is used for defining custom HTTP verb. 370 | message CustomHttpPattern { 371 | // The name of this custom HTTP verb. 372 | string kind = 1; 373 | 374 | // The path matched by this custom verb. 375 | string path = 2; 376 | } 377 | -------------------------------------------------------------------------------- /google/rpc/status.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 | // source: google/rpc/status.proto 3 | 4 | package rpc 5 | 6 | import ( 7 | bytes "bytes" 8 | fmt "fmt" 9 | proto "github.com/gogo/protobuf/proto" 10 | types "github.com/gogo/protobuf/types" 11 | io "io" 12 | math "math" 13 | math_bits "math/bits" 14 | reflect "reflect" 15 | strings "strings" 16 | ) 17 | 18 | // Reference imports to suppress errors if they are not otherwise used. 19 | var _ = proto.Marshal 20 | var _ = fmt.Errorf 21 | var _ = math.Inf 22 | 23 | // This is a compile-time assertion to ensure that this generated file 24 | // is compatible with the proto package it is being compiled against. 25 | // A compilation error at this line likely means your copy of the 26 | // proto package needs to be updated. 27 | const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 28 | 29 | // The `Status` type defines a logical error model that is suitable for 30 | // different programming environments, including REST APIs and RPC APIs. It is 31 | // used by [gRPC](https://github.com/grpc). The error model is designed to be: 32 | // 33 | // - Simple to use and understand for most users 34 | // - Flexible enough to meet unexpected needs 35 | // 36 | // # Overview 37 | // 38 | // The `Status` message contains three pieces of data: error code, error 39 | // message, and error details. The error code should be an enum value of 40 | // [google.rpc.Code][google.rpc.Code], but it may accept additional error codes 41 | // if needed. The error message should be a developer-facing English message 42 | // that helps developers *understand* and *resolve* the error. If a localized 43 | // user-facing error message is needed, put the localized message in the error 44 | // details or localize it in the client. The optional error details may contain 45 | // arbitrary information about the error. There is a predefined set of error 46 | // detail types in the package `google.rpc` that can be used for common error 47 | // conditions. 48 | // 49 | // # Language mapping 50 | // 51 | // The `Status` message is the logical representation of the error model, but it 52 | // is not necessarily the actual wire format. When the `Status` message is 53 | // exposed in different client libraries and different wire protocols, it can be 54 | // mapped differently. For example, it will likely be mapped to some exceptions 55 | // in Java, but more likely mapped to some error codes in C. 56 | // 57 | // # Other uses 58 | // 59 | // The error model and the `Status` message can be used in a variety of 60 | // environments, either with or without APIs, to provide a 61 | // consistent developer experience across different environments. 62 | // 63 | // Example uses of this error model include: 64 | // 65 | // - Partial errors. If a service needs to return partial errors to the client, 66 | // it may embed the `Status` in the normal response to indicate the partial 67 | // errors. 68 | // 69 | // - Workflow errors. A typical workflow has multiple steps. Each step may 70 | // have a `Status` message for error reporting. 71 | // 72 | // - Batch operations. If a client uses batch request and batch response, the 73 | // `Status` message should be used directly inside batch response, one for 74 | // each error sub-response. 75 | // 76 | // - Asynchronous operations. If an API call embeds asynchronous operation 77 | // results in its response, the status of those operations should be 78 | // represented directly using the `Status` message. 79 | // 80 | // - Logging. If some API errors are stored in logs, the message `Status` could 81 | // be used directly after any stripping needed for security/privacy reasons. 82 | type Status struct { 83 | // The status code, which should be an enum value of 84 | // [google.rpc.Code][google.rpc.Code]. 85 | Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` 86 | // A developer-facing error message, which should be in English. Any 87 | // user-facing error message should be localized and sent in the 88 | // [google.rpc.Status.details][google.rpc.Status.details] field, or localized 89 | // by the client. 90 | Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` 91 | // A list of messages that carry the error details. There is a common set of 92 | // message types for APIs to use. 93 | Details []*types.Any `protobuf:"bytes,3,rep,name=details,proto3" json:"details,omitempty"` 94 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 95 | XXX_unrecognized []byte `json:"-"` 96 | XXX_sizecache int32 `json:"-"` 97 | } 98 | 99 | func (m *Status) Reset() { *m = Status{} } 100 | func (*Status) ProtoMessage() {} 101 | func (*Status) Descriptor() ([]byte, []int) { 102 | return fileDescriptor_24d244abaf643bfe, []int{0} 103 | } 104 | func (m *Status) XXX_Unmarshal(b []byte) error { 105 | return m.Unmarshal(b) 106 | } 107 | func (m *Status) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 108 | if deterministic { 109 | return xxx_messageInfo_Status.Marshal(b, m, deterministic) 110 | } else { 111 | b = b[:cap(b)] 112 | n, err := m.MarshalToSizedBuffer(b) 113 | if err != nil { 114 | return nil, err 115 | } 116 | return b[:n], nil 117 | } 118 | } 119 | func (m *Status) XXX_Merge(src proto.Message) { 120 | xxx_messageInfo_Status.Merge(m, src) 121 | } 122 | func (m *Status) XXX_Size() int { 123 | return m.Size() 124 | } 125 | func (m *Status) XXX_DiscardUnknown() { 126 | xxx_messageInfo_Status.DiscardUnknown(m) 127 | } 128 | 129 | var xxx_messageInfo_Status proto.InternalMessageInfo 130 | 131 | func (m *Status) GetCode() int32 { 132 | if m != nil { 133 | return m.Code 134 | } 135 | return 0 136 | } 137 | 138 | func (m *Status) GetMessage() string { 139 | if m != nil { 140 | return m.Message 141 | } 142 | return "" 143 | } 144 | 145 | func (m *Status) GetDetails() []*types.Any { 146 | if m != nil { 147 | return m.Details 148 | } 149 | return nil 150 | } 151 | 152 | func (*Status) XXX_MessageName() string { 153 | return "google.rpc.Status" 154 | } 155 | func init() { 156 | proto.RegisterType((*Status)(nil), "google.rpc.Status") 157 | } 158 | 159 | func init() { proto.RegisterFile("google/rpc/status.proto", fileDescriptor_24d244abaf643bfe) } 160 | 161 | var fileDescriptor_24d244abaf643bfe = []byte{ 162 | // 235 bytes of a gzipped FileDescriptorProto 163 | 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xcf, 0xcf, 0x4f, 164 | 0xcf, 0x49, 0xd5, 0x2f, 0x2a, 0x48, 0xd6, 0x2f, 0x2e, 0x49, 0x2c, 0x29, 0x2d, 0xd6, 0x2b, 0x28, 165 | 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x82, 0x48, 0xe8, 0x15, 0x15, 0x24, 0x4b, 0x49, 0x42, 0x15, 0x81, 166 | 0x65, 0x92, 0x4a, 0xd3, 0xf4, 0x13, 0xf3, 0x2a, 0x21, 0xca, 0x94, 0xd2, 0xb8, 0xd8, 0x82, 0xc1, 167 | 0xda, 0x84, 0x84, 0xb8, 0x58, 0x92, 0xf3, 0x53, 0x52, 0x25, 0x18, 0x15, 0x18, 0x35, 0x58, 0x83, 168 | 0xc0, 0x6c, 0x21, 0x09, 0x2e, 0xf6, 0xdc, 0xd4, 0xe2, 0xe2, 0xc4, 0xf4, 0x54, 0x09, 0x26, 0x05, 169 | 0x46, 0x0d, 0xce, 0x20, 0x18, 0x57, 0x48, 0x8f, 0x8b, 0x3d, 0x25, 0xb5, 0x24, 0x31, 0x33, 0xa7, 170 | 0x58, 0x82, 0x59, 0x81, 0x59, 0x83, 0xdb, 0x48, 0x44, 0x0f, 0x6a, 0x21, 0xcc, 0x12, 0x3d, 0xc7, 171 | 0xbc, 0xca, 0x20, 0x98, 0x22, 0xa7, 0xb8, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c, 0x94, 0x63, 0xf8, 172 | 0xf0, 0x50, 0x8e, 0xf1, 0xc7, 0x43, 0x39, 0xc6, 0x86, 0x47, 0x72, 0x8c, 0x2b, 0x1e, 0xc9, 0x31, 173 | 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x2f, 0x1e, 0xc9, 174 | 0x31, 0x7c, 0x00, 0x89, 0x3f, 0x96, 0x63, 0x3c, 0xf1, 0x58, 0x8e, 0x91, 0x8b, 0x2f, 0x39, 0x3f, 175 | 0x57, 0x0f, 0xe1, 0x11, 0x27, 0x6e, 0x88, 0x5b, 0x03, 0x40, 0x56, 0x04, 0x30, 0x46, 0x31, 0x17, 176 | 0x15, 0x24, 0x2f, 0x62, 0x62, 0x0e, 0x0a, 0x70, 0x4e, 0x62, 0x03, 0x5b, 0x6b, 0x0c, 0x08, 0x00, 177 | 0x00, 0xff, 0xff, 0xaa, 0x06, 0xa1, 0xaa, 0x10, 0x01, 0x00, 0x00, 178 | } 179 | 180 | func (this *Status) Compare(that interface{}) int { 181 | if that == nil { 182 | if this == nil { 183 | return 0 184 | } 185 | return 1 186 | } 187 | 188 | that1, ok := that.(*Status) 189 | if !ok { 190 | that2, ok := that.(Status) 191 | if ok { 192 | that1 = &that2 193 | } else { 194 | return 1 195 | } 196 | } 197 | if that1 == nil { 198 | if this == nil { 199 | return 0 200 | } 201 | return 1 202 | } else if this == nil { 203 | return -1 204 | } 205 | if this.Code != that1.Code { 206 | if this.Code < that1.Code { 207 | return -1 208 | } 209 | return 1 210 | } 211 | if this.Message != that1.Message { 212 | if this.Message < that1.Message { 213 | return -1 214 | } 215 | return 1 216 | } 217 | if len(this.Details) != len(that1.Details) { 218 | if len(this.Details) < len(that1.Details) { 219 | return -1 220 | } 221 | return 1 222 | } 223 | for i := range this.Details { 224 | if c := this.Details[i].Compare(that1.Details[i]); c != 0 { 225 | return c 226 | } 227 | } 228 | if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { 229 | return c 230 | } 231 | return 0 232 | } 233 | func (this *Status) Equal(that interface{}) bool { 234 | if that == nil { 235 | return this == nil 236 | } 237 | 238 | that1, ok := that.(*Status) 239 | if !ok { 240 | that2, ok := that.(Status) 241 | if ok { 242 | that1 = &that2 243 | } else { 244 | return false 245 | } 246 | } 247 | if that1 == nil { 248 | return this == nil 249 | } else if this == nil { 250 | return false 251 | } 252 | if this.Code != that1.Code { 253 | return false 254 | } 255 | if this.Message != that1.Message { 256 | return false 257 | } 258 | if len(this.Details) != len(that1.Details) { 259 | return false 260 | } 261 | for i := range this.Details { 262 | if !this.Details[i].Equal(that1.Details[i]) { 263 | return false 264 | } 265 | } 266 | if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { 267 | return false 268 | } 269 | return true 270 | } 271 | func (this *Status) GoString() string { 272 | if this == nil { 273 | return "nil" 274 | } 275 | s := make([]string, 0, 7) 276 | s = append(s, "&rpc.Status{") 277 | s = append(s, "Code: "+fmt.Sprintf("%#v", this.Code)+",\n") 278 | s = append(s, "Message: "+fmt.Sprintf("%#v", this.Message)+",\n") 279 | if this.Details != nil { 280 | s = append(s, "Details: "+fmt.Sprintf("%#v", this.Details)+",\n") 281 | } 282 | if this.XXX_unrecognized != nil { 283 | s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") 284 | } 285 | s = append(s, "}") 286 | return strings.Join(s, "") 287 | } 288 | func valueToGoStringStatus(v interface{}, typ string) string { 289 | rv := reflect.ValueOf(v) 290 | if rv.IsNil() { 291 | return "nil" 292 | } 293 | pv := reflect.Indirect(rv).Interface() 294 | return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) 295 | } 296 | func (m *Status) Marshal() (dAtA []byte, err error) { 297 | size := m.Size() 298 | dAtA = make([]byte, size) 299 | n, err := m.MarshalToSizedBuffer(dAtA[:size]) 300 | if err != nil { 301 | return nil, err 302 | } 303 | return dAtA[:n], nil 304 | } 305 | 306 | func (m *Status) MarshalTo(dAtA []byte) (int, error) { 307 | size := m.Size() 308 | return m.MarshalToSizedBuffer(dAtA[:size]) 309 | } 310 | 311 | func (m *Status) MarshalToSizedBuffer(dAtA []byte) (int, error) { 312 | i := len(dAtA) 313 | _ = i 314 | var l int 315 | _ = l 316 | if m.XXX_unrecognized != nil { 317 | i -= len(m.XXX_unrecognized) 318 | copy(dAtA[i:], m.XXX_unrecognized) 319 | } 320 | if len(m.Details) > 0 { 321 | for iNdEx := len(m.Details) - 1; iNdEx >= 0; iNdEx-- { 322 | { 323 | size, err := m.Details[iNdEx].MarshalToSizedBuffer(dAtA[:i]) 324 | if err != nil { 325 | return 0, err 326 | } 327 | i -= size 328 | i = encodeVarintStatus(dAtA, i, uint64(size)) 329 | } 330 | i-- 331 | dAtA[i] = 0x1a 332 | } 333 | } 334 | if len(m.Message) > 0 { 335 | i -= len(m.Message) 336 | copy(dAtA[i:], m.Message) 337 | i = encodeVarintStatus(dAtA, i, uint64(len(m.Message))) 338 | i-- 339 | dAtA[i] = 0x12 340 | } 341 | if m.Code != 0 { 342 | i = encodeVarintStatus(dAtA, i, uint64(m.Code)) 343 | i-- 344 | dAtA[i] = 0x8 345 | } 346 | return len(dAtA) - i, nil 347 | } 348 | 349 | func encodeVarintStatus(dAtA []byte, offset int, v uint64) int { 350 | offset -= sovStatus(v) 351 | base := offset 352 | for v >= 1<<7 { 353 | dAtA[offset] = uint8(v&0x7f | 0x80) 354 | v >>= 7 355 | offset++ 356 | } 357 | dAtA[offset] = uint8(v) 358 | return base 359 | } 360 | func NewPopulatedStatus(r randyStatus, easy bool) *Status { 361 | this := &Status{} 362 | this.Code = int32(r.Int31()) 363 | if r.Intn(2) == 0 { 364 | this.Code *= -1 365 | } 366 | this.Message = string(randStringStatus(r)) 367 | if r.Intn(5) != 0 { 368 | v1 := r.Intn(5) 369 | this.Details = make([]*types.Any, v1) 370 | for i := 0; i < v1; i++ { 371 | this.Details[i] = types.NewPopulatedAny(r, easy) 372 | } 373 | } 374 | if !easy && r.Intn(10) != 0 { 375 | this.XXX_unrecognized = randUnrecognizedStatus(r, 4) 376 | } 377 | return this 378 | } 379 | 380 | type randyStatus interface { 381 | Float32() float32 382 | Float64() float64 383 | Int63() int64 384 | Int31() int32 385 | Uint32() uint32 386 | Intn(n int) int 387 | } 388 | 389 | func randUTF8RuneStatus(r randyStatus) rune { 390 | ru := r.Intn(62) 391 | if ru < 10 { 392 | return rune(ru + 48) 393 | } else if ru < 36 { 394 | return rune(ru + 55) 395 | } 396 | return rune(ru + 61) 397 | } 398 | func randStringStatus(r randyStatus) string { 399 | v2 := r.Intn(100) 400 | tmps := make([]rune, v2) 401 | for i := 0; i < v2; i++ { 402 | tmps[i] = randUTF8RuneStatus(r) 403 | } 404 | return string(tmps) 405 | } 406 | func randUnrecognizedStatus(r randyStatus, maxFieldNumber int) (dAtA []byte) { 407 | l := r.Intn(5) 408 | for i := 0; i < l; i++ { 409 | wire := r.Intn(4) 410 | if wire == 3 { 411 | wire = 5 412 | } 413 | fieldNumber := maxFieldNumber + r.Intn(100) 414 | dAtA = randFieldStatus(dAtA, r, fieldNumber, wire) 415 | } 416 | return dAtA 417 | } 418 | func randFieldStatus(dAtA []byte, r randyStatus, fieldNumber int, wire int) []byte { 419 | key := uint32(fieldNumber)<<3 | uint32(wire) 420 | switch wire { 421 | case 0: 422 | dAtA = encodeVarintPopulateStatus(dAtA, uint64(key)) 423 | v3 := r.Int63() 424 | if r.Intn(2) == 0 { 425 | v3 *= -1 426 | } 427 | dAtA = encodeVarintPopulateStatus(dAtA, uint64(v3)) 428 | case 1: 429 | dAtA = encodeVarintPopulateStatus(dAtA, uint64(key)) 430 | dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) 431 | case 2: 432 | dAtA = encodeVarintPopulateStatus(dAtA, uint64(key)) 433 | ll := r.Intn(100) 434 | dAtA = encodeVarintPopulateStatus(dAtA, uint64(ll)) 435 | for j := 0; j < ll; j++ { 436 | dAtA = append(dAtA, byte(r.Intn(256))) 437 | } 438 | default: 439 | dAtA = encodeVarintPopulateStatus(dAtA, uint64(key)) 440 | dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) 441 | } 442 | return dAtA 443 | } 444 | func encodeVarintPopulateStatus(dAtA []byte, v uint64) []byte { 445 | for v >= 1<<7 { 446 | dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) 447 | v >>= 7 448 | } 449 | dAtA = append(dAtA, uint8(v)) 450 | return dAtA 451 | } 452 | func (m *Status) Size() (n int) { 453 | if m == nil { 454 | return 0 455 | } 456 | var l int 457 | _ = l 458 | if m.Code != 0 { 459 | n += 1 + sovStatus(uint64(m.Code)) 460 | } 461 | l = len(m.Message) 462 | if l > 0 { 463 | n += 1 + l + sovStatus(uint64(l)) 464 | } 465 | if len(m.Details) > 0 { 466 | for _, e := range m.Details { 467 | l = e.Size() 468 | n += 1 + l + sovStatus(uint64(l)) 469 | } 470 | } 471 | if m.XXX_unrecognized != nil { 472 | n += len(m.XXX_unrecognized) 473 | } 474 | return n 475 | } 476 | 477 | func sovStatus(x uint64) (n int) { 478 | return (math_bits.Len64(x|1) + 6) / 7 479 | } 480 | func sozStatus(x uint64) (n int) { 481 | return sovStatus(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 482 | } 483 | func (this *Status) String() string { 484 | if this == nil { 485 | return "nil" 486 | } 487 | repeatedStringForDetails := "[]*Any{" 488 | for _, f := range this.Details { 489 | repeatedStringForDetails += strings.Replace(fmt.Sprintf("%v", f), "Any", "types.Any", 1) + "," 490 | } 491 | repeatedStringForDetails += "}" 492 | s := strings.Join([]string{`&Status{`, 493 | `Code:` + fmt.Sprintf("%v", this.Code) + `,`, 494 | `Message:` + fmt.Sprintf("%v", this.Message) + `,`, 495 | `Details:` + repeatedStringForDetails + `,`, 496 | `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, 497 | `}`, 498 | }, "") 499 | return s 500 | } 501 | func valueToStringStatus(v interface{}) string { 502 | rv := reflect.ValueOf(v) 503 | if rv.IsNil() { 504 | return "nil" 505 | } 506 | pv := reflect.Indirect(rv).Interface() 507 | return fmt.Sprintf("*%v", pv) 508 | } 509 | func (m *Status) Unmarshal(dAtA []byte) error { 510 | l := len(dAtA) 511 | iNdEx := 0 512 | for iNdEx < l { 513 | preIndex := iNdEx 514 | var wire uint64 515 | for shift := uint(0); ; shift += 7 { 516 | if shift >= 64 { 517 | return ErrIntOverflowStatus 518 | } 519 | if iNdEx >= l { 520 | return io.ErrUnexpectedEOF 521 | } 522 | b := dAtA[iNdEx] 523 | iNdEx++ 524 | wire |= uint64(b&0x7F) << shift 525 | if b < 0x80 { 526 | break 527 | } 528 | } 529 | fieldNum := int32(wire >> 3) 530 | wireType := int(wire & 0x7) 531 | if wireType == 4 { 532 | return fmt.Errorf("proto: Status: wiretype end group for non-group") 533 | } 534 | if fieldNum <= 0 { 535 | return fmt.Errorf("proto: Status: illegal tag %d (wire type %d)", fieldNum, wire) 536 | } 537 | switch fieldNum { 538 | case 1: 539 | if wireType != 0 { 540 | return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) 541 | } 542 | m.Code = 0 543 | for shift := uint(0); ; shift += 7 { 544 | if shift >= 64 { 545 | return ErrIntOverflowStatus 546 | } 547 | if iNdEx >= l { 548 | return io.ErrUnexpectedEOF 549 | } 550 | b := dAtA[iNdEx] 551 | iNdEx++ 552 | m.Code |= int32(b&0x7F) << shift 553 | if b < 0x80 { 554 | break 555 | } 556 | } 557 | case 2: 558 | if wireType != 2 { 559 | return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) 560 | } 561 | var stringLen uint64 562 | for shift := uint(0); ; shift += 7 { 563 | if shift >= 64 { 564 | return ErrIntOverflowStatus 565 | } 566 | if iNdEx >= l { 567 | return io.ErrUnexpectedEOF 568 | } 569 | b := dAtA[iNdEx] 570 | iNdEx++ 571 | stringLen |= uint64(b&0x7F) << shift 572 | if b < 0x80 { 573 | break 574 | } 575 | } 576 | intStringLen := int(stringLen) 577 | if intStringLen < 0 { 578 | return ErrInvalidLengthStatus 579 | } 580 | postIndex := iNdEx + intStringLen 581 | if postIndex < 0 { 582 | return ErrInvalidLengthStatus 583 | } 584 | if postIndex > l { 585 | return io.ErrUnexpectedEOF 586 | } 587 | m.Message = string(dAtA[iNdEx:postIndex]) 588 | iNdEx = postIndex 589 | case 3: 590 | if wireType != 2 { 591 | return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) 592 | } 593 | var msglen int 594 | for shift := uint(0); ; shift += 7 { 595 | if shift >= 64 { 596 | return ErrIntOverflowStatus 597 | } 598 | if iNdEx >= l { 599 | return io.ErrUnexpectedEOF 600 | } 601 | b := dAtA[iNdEx] 602 | iNdEx++ 603 | msglen |= int(b&0x7F) << shift 604 | if b < 0x80 { 605 | break 606 | } 607 | } 608 | if msglen < 0 { 609 | return ErrInvalidLengthStatus 610 | } 611 | postIndex := iNdEx + msglen 612 | if postIndex < 0 { 613 | return ErrInvalidLengthStatus 614 | } 615 | if postIndex > l { 616 | return io.ErrUnexpectedEOF 617 | } 618 | m.Details = append(m.Details, &types.Any{}) 619 | if err := m.Details[len(m.Details)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 620 | return err 621 | } 622 | iNdEx = postIndex 623 | default: 624 | iNdEx = preIndex 625 | skippy, err := skipStatus(dAtA[iNdEx:]) 626 | if err != nil { 627 | return err 628 | } 629 | if skippy < 0 { 630 | return ErrInvalidLengthStatus 631 | } 632 | if (iNdEx + skippy) < 0 { 633 | return ErrInvalidLengthStatus 634 | } 635 | if (iNdEx + skippy) > l { 636 | return io.ErrUnexpectedEOF 637 | } 638 | m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 639 | iNdEx += skippy 640 | } 641 | } 642 | 643 | if iNdEx > l { 644 | return io.ErrUnexpectedEOF 645 | } 646 | return nil 647 | } 648 | func skipStatus(dAtA []byte) (n int, err error) { 649 | l := len(dAtA) 650 | iNdEx := 0 651 | for iNdEx < l { 652 | var wire uint64 653 | for shift := uint(0); ; shift += 7 { 654 | if shift >= 64 { 655 | return 0, ErrIntOverflowStatus 656 | } 657 | if iNdEx >= l { 658 | return 0, io.ErrUnexpectedEOF 659 | } 660 | b := dAtA[iNdEx] 661 | iNdEx++ 662 | wire |= (uint64(b) & 0x7F) << shift 663 | if b < 0x80 { 664 | break 665 | } 666 | } 667 | wireType := int(wire & 0x7) 668 | switch wireType { 669 | case 0: 670 | for shift := uint(0); ; shift += 7 { 671 | if shift >= 64 { 672 | return 0, ErrIntOverflowStatus 673 | } 674 | if iNdEx >= l { 675 | return 0, io.ErrUnexpectedEOF 676 | } 677 | iNdEx++ 678 | if dAtA[iNdEx-1] < 0x80 { 679 | break 680 | } 681 | } 682 | return iNdEx, nil 683 | case 1: 684 | iNdEx += 8 685 | return iNdEx, nil 686 | case 2: 687 | var length int 688 | for shift := uint(0); ; shift += 7 { 689 | if shift >= 64 { 690 | return 0, ErrIntOverflowStatus 691 | } 692 | if iNdEx >= l { 693 | return 0, io.ErrUnexpectedEOF 694 | } 695 | b := dAtA[iNdEx] 696 | iNdEx++ 697 | length |= (int(b) & 0x7F) << shift 698 | if b < 0x80 { 699 | break 700 | } 701 | } 702 | if length < 0 { 703 | return 0, ErrInvalidLengthStatus 704 | } 705 | iNdEx += length 706 | if iNdEx < 0 { 707 | return 0, ErrInvalidLengthStatus 708 | } 709 | return iNdEx, nil 710 | case 3: 711 | for { 712 | var innerWire uint64 713 | var start int = iNdEx 714 | for shift := uint(0); ; shift += 7 { 715 | if shift >= 64 { 716 | return 0, ErrIntOverflowStatus 717 | } 718 | if iNdEx >= l { 719 | return 0, io.ErrUnexpectedEOF 720 | } 721 | b := dAtA[iNdEx] 722 | iNdEx++ 723 | innerWire |= (uint64(b) & 0x7F) << shift 724 | if b < 0x80 { 725 | break 726 | } 727 | } 728 | innerWireType := int(innerWire & 0x7) 729 | if innerWireType == 4 { 730 | break 731 | } 732 | next, err := skipStatus(dAtA[start:]) 733 | if err != nil { 734 | return 0, err 735 | } 736 | iNdEx = start + next 737 | if iNdEx < 0 { 738 | return 0, ErrInvalidLengthStatus 739 | } 740 | } 741 | return iNdEx, nil 742 | case 4: 743 | return iNdEx, nil 744 | case 5: 745 | iNdEx += 4 746 | return iNdEx, nil 747 | default: 748 | return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 749 | } 750 | } 751 | panic("unreachable") 752 | } 753 | 754 | var ( 755 | ErrInvalidLengthStatus = fmt.Errorf("proto: negative length found during unmarshaling") 756 | ErrIntOverflowStatus = fmt.Errorf("proto: integer overflow") 757 | ) 758 | -------------------------------------------------------------------------------- /google/api/http.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 | // source: google/api/http.proto 3 | 4 | package api 5 | 6 | import ( 7 | bytes "bytes" 8 | fmt "fmt" 9 | proto "github.com/gogo/protobuf/proto" 10 | io "io" 11 | math "math" 12 | math_bits "math/bits" 13 | reflect "reflect" 14 | strings "strings" 15 | ) 16 | 17 | // Reference imports to suppress errors if they are not otherwise used. 18 | var _ = proto.Marshal 19 | var _ = fmt.Errorf 20 | var _ = math.Inf 21 | 22 | // This is a compile-time assertion to ensure that this generated file 23 | // is compatible with the proto package it is being compiled against. 24 | // A compilation error at this line likely means your copy of the 25 | // proto package needs to be updated. 26 | const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 27 | 28 | // Defines the HTTP configuration for an API service. It contains a list of 29 | // [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method 30 | // to one or more HTTP REST API methods. 31 | type Http struct { 32 | // A list of HTTP configuration rules that apply to individual API methods. 33 | // 34 | // **NOTE:** All service configuration rules follow "last one wins" order. 35 | Rules []*HttpRule `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"` 36 | // When set to true, URL path parameters will be fully URI-decoded except in 37 | // cases of single segment matches in reserved expansion, where "%2F" will be 38 | // left encoded. 39 | // 40 | // The default behavior is to not decode RFC 6570 reserved characters in multi 41 | // segment matches. 42 | FullyDecodeReservedExpansion bool `protobuf:"varint,2,opt,name=fully_decode_reserved_expansion,json=fullyDecodeReservedExpansion,proto3" json:"fully_decode_reserved_expansion,omitempty"` 43 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 44 | XXX_unrecognized []byte `json:"-"` 45 | XXX_sizecache int32 `json:"-"` 46 | } 47 | 48 | func (m *Http) Reset() { *m = Http{} } 49 | func (*Http) ProtoMessage() {} 50 | func (*Http) Descriptor() ([]byte, []int) { 51 | return fileDescriptor_ff9994be407cdcc9, []int{0} 52 | } 53 | func (m *Http) XXX_Unmarshal(b []byte) error { 54 | return m.Unmarshal(b) 55 | } 56 | func (m *Http) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 57 | if deterministic { 58 | return xxx_messageInfo_Http.Marshal(b, m, deterministic) 59 | } else { 60 | b = b[:cap(b)] 61 | n, err := m.MarshalToSizedBuffer(b) 62 | if err != nil { 63 | return nil, err 64 | } 65 | return b[:n], nil 66 | } 67 | } 68 | func (m *Http) XXX_Merge(src proto.Message) { 69 | xxx_messageInfo_Http.Merge(m, src) 70 | } 71 | func (m *Http) XXX_Size() int { 72 | return m.Size() 73 | } 74 | func (m *Http) XXX_DiscardUnknown() { 75 | xxx_messageInfo_Http.DiscardUnknown(m) 76 | } 77 | 78 | var xxx_messageInfo_Http proto.InternalMessageInfo 79 | 80 | func (m *Http) GetRules() []*HttpRule { 81 | if m != nil { 82 | return m.Rules 83 | } 84 | return nil 85 | } 86 | 87 | func (m *Http) GetFullyDecodeReservedExpansion() bool { 88 | if m != nil { 89 | return m.FullyDecodeReservedExpansion 90 | } 91 | return false 92 | } 93 | 94 | func (*Http) XXX_MessageName() string { 95 | return "google.api.Http" 96 | } 97 | 98 | // # gRPC Transcoding 99 | // 100 | // gRPC Transcoding is a feature for mapping between a gRPC method and one or 101 | // more HTTP REST endpoints. It allows developers to build a single API service 102 | // that supports both gRPC APIs and REST APIs. Many systems, including [Google 103 | // APIs](https://github.com/googleapis/googleapis), 104 | // [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC 105 | // Gateway](https://github.com/grpc-ecosystem/grpc-gateway), 106 | // and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature 107 | // and use it for large scale production services. 108 | // 109 | // `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies 110 | // how different portions of the gRPC request message are mapped to the URL 111 | // path, URL query parameters, and HTTP request body. It also controls how the 112 | // gRPC response message is mapped to the HTTP response body. `HttpRule` is 113 | // typically specified as an `google.api.http` annotation on the gRPC method. 114 | // 115 | // Each mapping specifies a URL path template and an HTTP method. The path 116 | // template may refer to one or more fields in the gRPC request message, as long 117 | // as each field is a non-repeated field with a primitive (non-message) type. 118 | // The path template controls how fields of the request message are mapped to 119 | // the URL path. 120 | // 121 | // Example: 122 | // 123 | // service Messaging { 124 | // rpc GetMessage(GetMessageRequest) returns (Message) { 125 | // option (google.api.http) = { 126 | // get: "/v1/{name=messages/*}" 127 | // }; 128 | // } 129 | // } 130 | // message GetMessageRequest { 131 | // string name = 1; // Mapped to URL path. 132 | // } 133 | // message Message { 134 | // string text = 1; // The resource content. 135 | // } 136 | // 137 | // This enables an HTTP REST to gRPC mapping as below: 138 | // 139 | // HTTP | gRPC 140 | // -----|----- 141 | // `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` 142 | // 143 | // Any fields in the request message which are not bound by the path template 144 | // automatically become HTTP query parameters if there is no HTTP request body. 145 | // For example: 146 | // 147 | // service Messaging { 148 | // rpc GetMessage(GetMessageRequest) returns (Message) { 149 | // option (google.api.http) = { 150 | // get:"/v1/messages/{message_id}" 151 | // }; 152 | // } 153 | // } 154 | // message GetMessageRequest { 155 | // message SubMessage { 156 | // string subfield = 1; 157 | // } 158 | // string message_id = 1; // Mapped to URL path. 159 | // int64 revision = 2; // Mapped to URL query parameter `revision`. 160 | // SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. 161 | // } 162 | // 163 | // This enables a HTTP JSON to RPC mapping as below: 164 | // 165 | // HTTP | gRPC 166 | // -----|----- 167 | // `GET /v1/messages/123456?revision=2&sub.subfield=foo` | 168 | // `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: 169 | // "foo"))` 170 | // 171 | // Note that fields which are mapped to URL query parameters must have a 172 | // primitive type or a repeated primitive type or a non-repeated message type. 173 | // In the case of a repeated type, the parameter can be repeated in the URL 174 | // as `...?param=A¶m=B`. In the case of a message type, each field of the 175 | // message is mapped to a separate parameter, such as 176 | // `...?foo.a=A&foo.b=B&foo.c=C`. 177 | // 178 | // For HTTP methods that allow a request body, the `body` field 179 | // specifies the mapping. Consider a REST update method on the 180 | // message resource collection: 181 | // 182 | // service Messaging { 183 | // rpc UpdateMessage(UpdateMessageRequest) returns (Message) { 184 | // option (google.api.http) = { 185 | // patch: "/v1/messages/{message_id}" 186 | // body: "message" 187 | // }; 188 | // } 189 | // } 190 | // message UpdateMessageRequest { 191 | // string message_id = 1; // mapped to the URL 192 | // Message message = 2; // mapped to the body 193 | // } 194 | // 195 | // The following HTTP JSON to RPC mapping is enabled, where the 196 | // representation of the JSON in the request body is determined by 197 | // protos JSON encoding: 198 | // 199 | // HTTP | gRPC 200 | // -----|----- 201 | // `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: 202 | // "123456" message { text: "Hi!" })` 203 | // 204 | // The special name `*` can be used in the body mapping to define that 205 | // every field not bound by the path template should be mapped to the 206 | // request body. This enables the following alternative definition of 207 | // the update method: 208 | // 209 | // service Messaging { 210 | // rpc UpdateMessage(Message) returns (Message) { 211 | // option (google.api.http) = { 212 | // patch: "/v1/messages/{message_id}" 213 | // body: "*" 214 | // }; 215 | // } 216 | // } 217 | // message Message { 218 | // string message_id = 1; 219 | // string text = 2; 220 | // } 221 | // 222 | // 223 | // The following HTTP JSON to RPC mapping is enabled: 224 | // 225 | // HTTP | gRPC 226 | // -----|----- 227 | // `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: 228 | // "123456" text: "Hi!")` 229 | // 230 | // Note that when using `*` in the body mapping, it is not possible to 231 | // have HTTP parameters, as all fields not bound by the path end in 232 | // the body. This makes this option more rarely used in practice when 233 | // defining REST APIs. The common usage of `*` is in custom methods 234 | // which don't use the URL at all for transferring data. 235 | // 236 | // It is possible to define multiple HTTP methods for one RPC by using 237 | // the `additional_bindings` option. Example: 238 | // 239 | // service Messaging { 240 | // rpc GetMessage(GetMessageRequest) returns (Message) { 241 | // option (google.api.http) = { 242 | // get: "/v1/messages/{message_id}" 243 | // additional_bindings { 244 | // get: "/v1/users/{user_id}/messages/{message_id}" 245 | // } 246 | // }; 247 | // } 248 | // } 249 | // message GetMessageRequest { 250 | // string message_id = 1; 251 | // string user_id = 2; 252 | // } 253 | // 254 | // This enables the following two alternative HTTP JSON to RPC mappings: 255 | // 256 | // HTTP | gRPC 257 | // -----|----- 258 | // `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` 259 | // `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: 260 | // "123456")` 261 | // 262 | // ## Rules for HTTP mapping 263 | // 264 | // 1. Leaf request fields (recursive expansion nested messages in the request 265 | // message) are classified into three categories: 266 | // - Fields referred by the path template. They are passed via the URL path. 267 | // - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP 268 | // request body. 269 | // - All other fields are passed via the URL query parameters, and the 270 | // parameter name is the field path in the request message. A repeated 271 | // field can be represented as multiple query parameters under the same 272 | // name. 273 | // 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields 274 | // are passed via URL path and HTTP request body. 275 | // 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all 276 | // fields are passed via URL path and URL query parameters. 277 | // 278 | // ### Path template syntax 279 | // 280 | // Template = "/" Segments [ Verb ] ; 281 | // Segments = Segment { "/" Segment } ; 282 | // Segment = "*" | "**" | LITERAL | Variable ; 283 | // Variable = "{" FieldPath [ "=" Segments ] "}" ; 284 | // FieldPath = IDENT { "." IDENT } ; 285 | // Verb = ":" LITERAL ; 286 | // 287 | // The syntax `*` matches a single URL path segment. The syntax `**` matches 288 | // zero or more URL path segments, which must be the last part of the URL path 289 | // except the `Verb`. 290 | // 291 | // The syntax `Variable` matches part of the URL path as specified by its 292 | // template. A variable template must not contain other variables. If a variable 293 | // matches a single path segment, its template may be omitted, e.g. `{var}` 294 | // is equivalent to `{var=*}`. 295 | // 296 | // The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` 297 | // contains any reserved character, such characters should be percent-encoded 298 | // before the matching. 299 | // 300 | // If a variable contains exactly one path segment, such as `"{var}"` or 301 | // `"{var=*}"`, when such a variable is expanded into a URL path on the client 302 | // side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The 303 | // server side does the reverse decoding. Such variables show up in the 304 | // [Discovery 305 | // Document](https://developers.google.com/discovery/v1/reference/apis) as 306 | // `{var}`. 307 | // 308 | // If a variable contains multiple path segments, such as `"{var=foo/*}"` 309 | // or `"{var=**}"`, when such a variable is expanded into a URL path on the 310 | // client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. 311 | // The server side does the reverse decoding, except "%2F" and "%2f" are left 312 | // unchanged. Such variables show up in the 313 | // [Discovery 314 | // Document](https://developers.google.com/discovery/v1/reference/apis) as 315 | // `{+var}`. 316 | // 317 | // ## Using gRPC API Service Configuration 318 | // 319 | // gRPC API Service Configuration (service config) is a configuration language 320 | // for configuring a gRPC service to become a user-facing product. The 321 | // service config is simply the YAML representation of the `google.api.Service` 322 | // proto message. 323 | // 324 | // As an alternative to annotating your proto file, you can configure gRPC 325 | // transcoding in your service config YAML files. You do this by specifying a 326 | // `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same 327 | // effect as the proto annotation. This can be particularly useful if you 328 | // have a proto that is reused in multiple services. Note that any transcoding 329 | // specified in the service config will override any matching transcoding 330 | // configuration in the proto. 331 | // 332 | // Example: 333 | // 334 | // http: 335 | // rules: 336 | // # Selects a gRPC method and applies HttpRule to it. 337 | // - selector: example.v1.Messaging.GetMessage 338 | // get: /v1/messages/{message_id}/{sub.subfield} 339 | // 340 | // ## Special notes 341 | // 342 | // When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the 343 | // proto to JSON conversion must follow the [proto3 344 | // specification](https://developers.google.com/protocol-buffers/docs/proto3#json). 345 | // 346 | // While the single segment variable follows the semantics of 347 | // [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String 348 | // Expansion, the multi segment variable **does not** follow RFC 6570 Section 349 | // 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion 350 | // does not expand special characters like `?` and `#`, which would lead 351 | // to invalid URLs. As the result, gRPC Transcoding uses a custom encoding 352 | // for multi segment variables. 353 | // 354 | // The path variables **must not** refer to any repeated or mapped field, 355 | // because client libraries are not capable of handling such variable expansion. 356 | // 357 | // The path variables **must not** capture the leading "/" character. The reason 358 | // is that the most common use case "{var}" does not capture the leading "/" 359 | // character. For consistency, all path variables must share the same behavior. 360 | // 361 | // Repeated message fields must not be mapped to URL query parameters, because 362 | // no client library can support such complicated mapping. 363 | // 364 | // If an API needs to use a JSON array for request or response body, it can map 365 | // the request or response body to a repeated field. However, some gRPC 366 | // Transcoding implementations may not support this feature. 367 | type HttpRule struct { 368 | // Selects a method to which this rule applies. 369 | // 370 | // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. 371 | Selector string `protobuf:"bytes,1,opt,name=selector,proto3" json:"selector,omitempty"` 372 | // Determines the URL pattern is matched by this rules. This pattern can be 373 | // used with any of the {get|put|post|delete|patch} methods. A custom method 374 | // can be defined using the 'custom' field. 375 | // 376 | // Types that are valid to be assigned to Pattern: 377 | // *HttpRule_Get 378 | // *HttpRule_Put 379 | // *HttpRule_Post 380 | // *HttpRule_Delete 381 | // *HttpRule_Patch 382 | // *HttpRule_Custom 383 | Pattern isHttpRule_Pattern `protobuf_oneof:"pattern"` 384 | // The name of the request field whose value is mapped to the HTTP request 385 | // body, or `*` for mapping all request fields not captured by the path 386 | // pattern to the HTTP body, or omitted for not having any HTTP request body. 387 | // 388 | // NOTE: the referred field must be present at the top-level of the request 389 | // message type. 390 | Body string `protobuf:"bytes,7,opt,name=body,proto3" json:"body,omitempty"` 391 | // Optional. The name of the response field whose value is mapped to the HTTP 392 | // response body. When omitted, the entire response message will be used 393 | // as the HTTP response body. 394 | // 395 | // NOTE: The referred field must be present at the top-level of the response 396 | // message type. 397 | ResponseBody string `protobuf:"bytes,12,opt,name=response_body,json=responseBody,proto3" json:"response_body,omitempty"` 398 | // Additional HTTP bindings for the selector. Nested bindings must 399 | // not contain an `additional_bindings` field themselves (that is, 400 | // the nesting may only be one level deep). 401 | AdditionalBindings []*HttpRule `protobuf:"bytes,11,rep,name=additional_bindings,json=additionalBindings,proto3" json:"additional_bindings,omitempty"` 402 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 403 | XXX_unrecognized []byte `json:"-"` 404 | XXX_sizecache int32 `json:"-"` 405 | } 406 | 407 | func (m *HttpRule) Reset() { *m = HttpRule{} } 408 | func (*HttpRule) ProtoMessage() {} 409 | func (*HttpRule) Descriptor() ([]byte, []int) { 410 | return fileDescriptor_ff9994be407cdcc9, []int{1} 411 | } 412 | func (m *HttpRule) XXX_Unmarshal(b []byte) error { 413 | return m.Unmarshal(b) 414 | } 415 | func (m *HttpRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 416 | if deterministic { 417 | return xxx_messageInfo_HttpRule.Marshal(b, m, deterministic) 418 | } else { 419 | b = b[:cap(b)] 420 | n, err := m.MarshalToSizedBuffer(b) 421 | if err != nil { 422 | return nil, err 423 | } 424 | return b[:n], nil 425 | } 426 | } 427 | func (m *HttpRule) XXX_Merge(src proto.Message) { 428 | xxx_messageInfo_HttpRule.Merge(m, src) 429 | } 430 | func (m *HttpRule) XXX_Size() int { 431 | return m.Size() 432 | } 433 | func (m *HttpRule) XXX_DiscardUnknown() { 434 | xxx_messageInfo_HttpRule.DiscardUnknown(m) 435 | } 436 | 437 | var xxx_messageInfo_HttpRule proto.InternalMessageInfo 438 | 439 | type isHttpRule_Pattern interface { 440 | isHttpRule_Pattern() 441 | Equal(interface{}) bool 442 | MarshalTo([]byte) (int, error) 443 | Size() int 444 | } 445 | 446 | type HttpRule_Get struct { 447 | Get string `protobuf:"bytes,2,opt,name=get,proto3,oneof"` 448 | } 449 | type HttpRule_Put struct { 450 | Put string `protobuf:"bytes,3,opt,name=put,proto3,oneof"` 451 | } 452 | type HttpRule_Post struct { 453 | Post string `protobuf:"bytes,4,opt,name=post,proto3,oneof"` 454 | } 455 | type HttpRule_Delete struct { 456 | Delete string `protobuf:"bytes,5,opt,name=delete,proto3,oneof"` 457 | } 458 | type HttpRule_Patch struct { 459 | Patch string `protobuf:"bytes,6,opt,name=patch,proto3,oneof"` 460 | } 461 | type HttpRule_Custom struct { 462 | Custom *CustomHttpPattern `protobuf:"bytes,8,opt,name=custom,proto3,oneof"` 463 | } 464 | 465 | func (*HttpRule_Get) isHttpRule_Pattern() {} 466 | func (*HttpRule_Put) isHttpRule_Pattern() {} 467 | func (*HttpRule_Post) isHttpRule_Pattern() {} 468 | func (*HttpRule_Delete) isHttpRule_Pattern() {} 469 | func (*HttpRule_Patch) isHttpRule_Pattern() {} 470 | func (*HttpRule_Custom) isHttpRule_Pattern() {} 471 | 472 | func (m *HttpRule) GetPattern() isHttpRule_Pattern { 473 | if m != nil { 474 | return m.Pattern 475 | } 476 | return nil 477 | } 478 | 479 | func (m *HttpRule) GetSelector() string { 480 | if m != nil { 481 | return m.Selector 482 | } 483 | return "" 484 | } 485 | 486 | func (m *HttpRule) GetGet() string { 487 | if x, ok := m.GetPattern().(*HttpRule_Get); ok { 488 | return x.Get 489 | } 490 | return "" 491 | } 492 | 493 | func (m *HttpRule) GetPut() string { 494 | if x, ok := m.GetPattern().(*HttpRule_Put); ok { 495 | return x.Put 496 | } 497 | return "" 498 | } 499 | 500 | func (m *HttpRule) GetPost() string { 501 | if x, ok := m.GetPattern().(*HttpRule_Post); ok { 502 | return x.Post 503 | } 504 | return "" 505 | } 506 | 507 | func (m *HttpRule) GetDelete() string { 508 | if x, ok := m.GetPattern().(*HttpRule_Delete); ok { 509 | return x.Delete 510 | } 511 | return "" 512 | } 513 | 514 | func (m *HttpRule) GetPatch() string { 515 | if x, ok := m.GetPattern().(*HttpRule_Patch); ok { 516 | return x.Patch 517 | } 518 | return "" 519 | } 520 | 521 | func (m *HttpRule) GetCustom() *CustomHttpPattern { 522 | if x, ok := m.GetPattern().(*HttpRule_Custom); ok { 523 | return x.Custom 524 | } 525 | return nil 526 | } 527 | 528 | func (m *HttpRule) GetBody() string { 529 | if m != nil { 530 | return m.Body 531 | } 532 | return "" 533 | } 534 | 535 | func (m *HttpRule) GetResponseBody() string { 536 | if m != nil { 537 | return m.ResponseBody 538 | } 539 | return "" 540 | } 541 | 542 | func (m *HttpRule) GetAdditionalBindings() []*HttpRule { 543 | if m != nil { 544 | return m.AdditionalBindings 545 | } 546 | return nil 547 | } 548 | 549 | // XXX_OneofWrappers is for the internal use of the proto package. 550 | func (*HttpRule) XXX_OneofWrappers() []interface{} { 551 | return []interface{}{ 552 | (*HttpRule_Get)(nil), 553 | (*HttpRule_Put)(nil), 554 | (*HttpRule_Post)(nil), 555 | (*HttpRule_Delete)(nil), 556 | (*HttpRule_Patch)(nil), 557 | (*HttpRule_Custom)(nil), 558 | } 559 | } 560 | 561 | func (*HttpRule) XXX_MessageName() string { 562 | return "google.api.HttpRule" 563 | } 564 | 565 | // A custom pattern is used for defining custom HTTP verb. 566 | type CustomHttpPattern struct { 567 | // The name of this custom HTTP verb. 568 | Kind string `protobuf:"bytes,1,opt,name=kind,proto3" json:"kind,omitempty"` 569 | // The path matched by this custom verb. 570 | Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` 571 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 572 | XXX_unrecognized []byte `json:"-"` 573 | XXX_sizecache int32 `json:"-"` 574 | } 575 | 576 | func (m *CustomHttpPattern) Reset() { *m = CustomHttpPattern{} } 577 | func (*CustomHttpPattern) ProtoMessage() {} 578 | func (*CustomHttpPattern) Descriptor() ([]byte, []int) { 579 | return fileDescriptor_ff9994be407cdcc9, []int{2} 580 | } 581 | func (m *CustomHttpPattern) XXX_Unmarshal(b []byte) error { 582 | return m.Unmarshal(b) 583 | } 584 | func (m *CustomHttpPattern) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 585 | if deterministic { 586 | return xxx_messageInfo_CustomHttpPattern.Marshal(b, m, deterministic) 587 | } else { 588 | b = b[:cap(b)] 589 | n, err := m.MarshalToSizedBuffer(b) 590 | if err != nil { 591 | return nil, err 592 | } 593 | return b[:n], nil 594 | } 595 | } 596 | func (m *CustomHttpPattern) XXX_Merge(src proto.Message) { 597 | xxx_messageInfo_CustomHttpPattern.Merge(m, src) 598 | } 599 | func (m *CustomHttpPattern) XXX_Size() int { 600 | return m.Size() 601 | } 602 | func (m *CustomHttpPattern) XXX_DiscardUnknown() { 603 | xxx_messageInfo_CustomHttpPattern.DiscardUnknown(m) 604 | } 605 | 606 | var xxx_messageInfo_CustomHttpPattern proto.InternalMessageInfo 607 | 608 | func (m *CustomHttpPattern) GetKind() string { 609 | if m != nil { 610 | return m.Kind 611 | } 612 | return "" 613 | } 614 | 615 | func (m *CustomHttpPattern) GetPath() string { 616 | if m != nil { 617 | return m.Path 618 | } 619 | return "" 620 | } 621 | 622 | func (*CustomHttpPattern) XXX_MessageName() string { 623 | return "google.api.CustomHttpPattern" 624 | } 625 | func init() { 626 | proto.RegisterType((*Http)(nil), "google.api.Http") 627 | proto.RegisterType((*HttpRule)(nil), "google.api.HttpRule") 628 | proto.RegisterType((*CustomHttpPattern)(nil), "google.api.CustomHttpPattern") 629 | } 630 | 631 | func init() { proto.RegisterFile("google/api/http.proto", fileDescriptor_ff9994be407cdcc9) } 632 | 633 | var fileDescriptor_ff9994be407cdcc9 = []byte{ 634 | // 440 bytes of a gzipped FileDescriptorProto 635 | 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xb1, 0x8f, 0xd3, 0x30, 636 | 0x14, 0xc6, 0xeb, 0x36, 0xed, 0xb5, 0xaf, 0x07, 0x12, 0xe6, 0x40, 0x16, 0x02, 0x53, 0x95, 0xa5, 637 | 0x62, 0xe8, 0x49, 0xc7, 0xc0, 0xc0, 0x44, 0xa0, 0xe2, 0xd8, 0xaa, 0x4c, 0x88, 0x25, 0x72, 0xe3, 638 | 0x47, 0x6b, 0x91, 0x8b, 0xad, 0xd8, 0x41, 0x74, 0xe3, 0x6f, 0x61, 0xe2, 0x4f, 0x61, 0x64, 0x44, 639 | 0x4c, 0x34, 0x2c, 0x8c, 0x37, 0xde, 0x88, 0xec, 0xa4, 0x5c, 0x25, 0x24, 0xb6, 0xf7, 0x7d, 0xef, 640 | 0x97, 0x97, 0x2f, 0x2f, 0x0f, 0xee, 0xac, 0xb5, 0x5e, 0xe7, 0x78, 0x2a, 0x8c, 0x3a, 0xdd, 0x38, 641 | 0x67, 0xe6, 0xa6, 0xd4, 0x4e, 0x53, 0x68, 0xec, 0xb9, 0x30, 0x6a, 0xba, 0x85, 0xe8, 0xdc, 0x39, 642 | 0x43, 0x1f, 0x43, 0xbf, 0xac, 0x72, 0xb4, 0x8c, 0x4c, 0x7a, 0xb3, 0xf1, 0xd9, 0xc9, 0xfc, 0x9a, 643 | 0x99, 0x7b, 0x20, 0xa9, 0x72, 0x4c, 0x1a, 0x84, 0x2e, 0xe0, 0xe1, 0xbb, 0x2a, 0xcf, 0xb7, 0xa9, 644 | 0xc4, 0x4c, 0x4b, 0x4c, 0x4b, 0xb4, 0x58, 0x7e, 0x40, 0x99, 0xe2, 0x47, 0x23, 0x0a, 0xab, 0x74, 645 | 0xc1, 0xba, 0x13, 0x32, 0x1b, 0x26, 0xf7, 0x03, 0xf6, 0x32, 0x50, 0x49, 0x0b, 0x2d, 0xf6, 0xcc, 646 | 0xf4, 0x47, 0x17, 0x86, 0xfb, 0xd1, 0xf4, 0x1e, 0x0c, 0x2d, 0xe6, 0x98, 0x39, 0x5d, 0x32, 0x32, 647 | 0x21, 0xb3, 0x51, 0xf2, 0x57, 0x53, 0x0a, 0xbd, 0x35, 0xba, 0x30, 0x73, 0x74, 0xde, 0x49, 0xbc, 648 | 0xf0, 0x9e, 0xa9, 0x1c, 0xeb, 0xed, 0x3d, 0x53, 0x39, 0x7a, 0x02, 0x91, 0xd1, 0xd6, 0xb1, 0xa8, 649 | 0x35, 0x83, 0xa2, 0x0c, 0x06, 0x12, 0x73, 0x74, 0xc8, 0xfa, 0xad, 0xdf, 0x6a, 0x7a, 0x17, 0xfa, 650 | 0x46, 0xb8, 0x6c, 0xc3, 0x06, 0x6d, 0xa3, 0x91, 0xf4, 0x29, 0x0c, 0xb2, 0xca, 0x3a, 0x7d, 0xc1, 651 | 0x86, 0x13, 0x32, 0x1b, 0x9f, 0x3d, 0x38, 0x5c, 0xc6, 0x8b, 0xd0, 0xf1, 0xb9, 0x97, 0xc2, 0x39, 652 | 0x2c, 0x0b, 0x3f, 0xb0, 0xc1, 0x29, 0x85, 0x68, 0xa5, 0xe5, 0x96, 0x1d, 0x85, 0x0f, 0x08, 0x35, 653 | 0x7d, 0x04, 0x37, 0x4a, 0xb4, 0x46, 0x17, 0x16, 0xd3, 0xd0, 0x3c, 0x0e, 0xcd, 0xe3, 0xbd, 0x19, 654 | 0x7b, 0x68, 0x01, 0xb7, 0x85, 0x94, 0xca, 0x29, 0x5d, 0x88, 0x3c, 0x5d, 0xa9, 0x42, 0xaa, 0x62, 655 | 0x6d, 0xd9, 0xf8, 0x3f, 0xff, 0x82, 0x5e, 0x3f, 0x10, 0xb7, 0x7c, 0x3c, 0x82, 0x23, 0xd3, 0x84, 656 | 0x9a, 0x3e, 0x83, 0x5b, 0xff, 0x24, 0xf5, 0xf9, 0xde, 0xab, 0x42, 0xb6, 0x0b, 0x0e, 0xb5, 0xf7, 657 | 0x8c, 0x70, 0x9b, 0x66, 0xbb, 0x49, 0xa8, 0xe3, 0x37, 0xdf, 0x77, 0xbc, 0x73, 0xb9, 0xe3, 0xe4, 658 | 0x6a, 0xc7, 0xc9, 0xa7, 0x9a, 0x93, 0x2f, 0x35, 0x27, 0x5f, 0x6b, 0x4e, 0xbe, 0xd5, 0x9c, 0xfc, 659 | 0xac, 0x39, 0xf9, 0x5d, 0xf3, 0xce, 0xa5, 0xf7, 0x7e, 0x71, 0x02, 0x37, 0x33, 0x7d, 0x71, 0x10, 660 | 0x31, 0x1e, 0x85, 0x57, 0xfa, 0x4b, 0x5b, 0x92, 0xb7, 0x3d, 0x61, 0xd4, 0x15, 0x21, 0x9f, 0xbb, 661 | 0xd1, 0xab, 0xe7, 0xcb, 0xd7, 0xab, 0x41, 0xb8, 0xc0, 0x27, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 662 | 0x1e, 0x40, 0xdc, 0xc0, 0x9a, 0x02, 0x00, 0x00, 663 | } 664 | 665 | func (this *Http) Equal(that interface{}) bool { 666 | if that == nil { 667 | return this == nil 668 | } 669 | 670 | that1, ok := that.(*Http) 671 | if !ok { 672 | that2, ok := that.(Http) 673 | if ok { 674 | that1 = &that2 675 | } else { 676 | return false 677 | } 678 | } 679 | if that1 == nil { 680 | return this == nil 681 | } else if this == nil { 682 | return false 683 | } 684 | if len(this.Rules) != len(that1.Rules) { 685 | return false 686 | } 687 | for i := range this.Rules { 688 | if !this.Rules[i].Equal(that1.Rules[i]) { 689 | return false 690 | } 691 | } 692 | if this.FullyDecodeReservedExpansion != that1.FullyDecodeReservedExpansion { 693 | return false 694 | } 695 | if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { 696 | return false 697 | } 698 | return true 699 | } 700 | func (this *HttpRule) Equal(that interface{}) bool { 701 | if that == nil { 702 | return this == nil 703 | } 704 | 705 | that1, ok := that.(*HttpRule) 706 | if !ok { 707 | that2, ok := that.(HttpRule) 708 | if ok { 709 | that1 = &that2 710 | } else { 711 | return false 712 | } 713 | } 714 | if that1 == nil { 715 | return this == nil 716 | } else if this == nil { 717 | return false 718 | } 719 | if this.Selector != that1.Selector { 720 | return false 721 | } 722 | if that1.Pattern == nil { 723 | if this.Pattern != nil { 724 | return false 725 | } 726 | } else if this.Pattern == nil { 727 | return false 728 | } else if !this.Pattern.Equal(that1.Pattern) { 729 | return false 730 | } 731 | if this.Body != that1.Body { 732 | return false 733 | } 734 | if this.ResponseBody != that1.ResponseBody { 735 | return false 736 | } 737 | if len(this.AdditionalBindings) != len(that1.AdditionalBindings) { 738 | return false 739 | } 740 | for i := range this.AdditionalBindings { 741 | if !this.AdditionalBindings[i].Equal(that1.AdditionalBindings[i]) { 742 | return false 743 | } 744 | } 745 | if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { 746 | return false 747 | } 748 | return true 749 | } 750 | func (this *HttpRule_Get) Equal(that interface{}) bool { 751 | if that == nil { 752 | return this == nil 753 | } 754 | 755 | that1, ok := that.(*HttpRule_Get) 756 | if !ok { 757 | that2, ok := that.(HttpRule_Get) 758 | if ok { 759 | that1 = &that2 760 | } else { 761 | return false 762 | } 763 | } 764 | if that1 == nil { 765 | return this == nil 766 | } else if this == nil { 767 | return false 768 | } 769 | if this.Get != that1.Get { 770 | return false 771 | } 772 | return true 773 | } 774 | func (this *HttpRule_Put) Equal(that interface{}) bool { 775 | if that == nil { 776 | return this == nil 777 | } 778 | 779 | that1, ok := that.(*HttpRule_Put) 780 | if !ok { 781 | that2, ok := that.(HttpRule_Put) 782 | if ok { 783 | that1 = &that2 784 | } else { 785 | return false 786 | } 787 | } 788 | if that1 == nil { 789 | return this == nil 790 | } else if this == nil { 791 | return false 792 | } 793 | if this.Put != that1.Put { 794 | return false 795 | } 796 | return true 797 | } 798 | func (this *HttpRule_Post) Equal(that interface{}) bool { 799 | if that == nil { 800 | return this == nil 801 | } 802 | 803 | that1, ok := that.(*HttpRule_Post) 804 | if !ok { 805 | that2, ok := that.(HttpRule_Post) 806 | if ok { 807 | that1 = &that2 808 | } else { 809 | return false 810 | } 811 | } 812 | if that1 == nil { 813 | return this == nil 814 | } else if this == nil { 815 | return false 816 | } 817 | if this.Post != that1.Post { 818 | return false 819 | } 820 | return true 821 | } 822 | func (this *HttpRule_Delete) Equal(that interface{}) bool { 823 | if that == nil { 824 | return this == nil 825 | } 826 | 827 | that1, ok := that.(*HttpRule_Delete) 828 | if !ok { 829 | that2, ok := that.(HttpRule_Delete) 830 | if ok { 831 | that1 = &that2 832 | } else { 833 | return false 834 | } 835 | } 836 | if that1 == nil { 837 | return this == nil 838 | } else if this == nil { 839 | return false 840 | } 841 | if this.Delete != that1.Delete { 842 | return false 843 | } 844 | return true 845 | } 846 | func (this *HttpRule_Patch) Equal(that interface{}) bool { 847 | if that == nil { 848 | return this == nil 849 | } 850 | 851 | that1, ok := that.(*HttpRule_Patch) 852 | if !ok { 853 | that2, ok := that.(HttpRule_Patch) 854 | if ok { 855 | that1 = &that2 856 | } else { 857 | return false 858 | } 859 | } 860 | if that1 == nil { 861 | return this == nil 862 | } else if this == nil { 863 | return false 864 | } 865 | if this.Patch != that1.Patch { 866 | return false 867 | } 868 | return true 869 | } 870 | func (this *HttpRule_Custom) Equal(that interface{}) bool { 871 | if that == nil { 872 | return this == nil 873 | } 874 | 875 | that1, ok := that.(*HttpRule_Custom) 876 | if !ok { 877 | that2, ok := that.(HttpRule_Custom) 878 | if ok { 879 | that1 = &that2 880 | } else { 881 | return false 882 | } 883 | } 884 | if that1 == nil { 885 | return this == nil 886 | } else if this == nil { 887 | return false 888 | } 889 | if !this.Custom.Equal(that1.Custom) { 890 | return false 891 | } 892 | return true 893 | } 894 | func (this *CustomHttpPattern) Equal(that interface{}) bool { 895 | if that == nil { 896 | return this == nil 897 | } 898 | 899 | that1, ok := that.(*CustomHttpPattern) 900 | if !ok { 901 | that2, ok := that.(CustomHttpPattern) 902 | if ok { 903 | that1 = &that2 904 | } else { 905 | return false 906 | } 907 | } 908 | if that1 == nil { 909 | return this == nil 910 | } else if this == nil { 911 | return false 912 | } 913 | if this.Kind != that1.Kind { 914 | return false 915 | } 916 | if this.Path != that1.Path { 917 | return false 918 | } 919 | if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { 920 | return false 921 | } 922 | return true 923 | } 924 | func (this *Http) GoString() string { 925 | if this == nil { 926 | return "nil" 927 | } 928 | s := make([]string, 0, 6) 929 | s = append(s, "&api.Http{") 930 | if this.Rules != nil { 931 | s = append(s, "Rules: "+fmt.Sprintf("%#v", this.Rules)+",\n") 932 | } 933 | s = append(s, "FullyDecodeReservedExpansion: "+fmt.Sprintf("%#v", this.FullyDecodeReservedExpansion)+",\n") 934 | if this.XXX_unrecognized != nil { 935 | s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") 936 | } 937 | s = append(s, "}") 938 | return strings.Join(s, "") 939 | } 940 | func (this *HttpRule) GoString() string { 941 | if this == nil { 942 | return "nil" 943 | } 944 | s := make([]string, 0, 14) 945 | s = append(s, "&api.HttpRule{") 946 | s = append(s, "Selector: "+fmt.Sprintf("%#v", this.Selector)+",\n") 947 | if this.Pattern != nil { 948 | s = append(s, "Pattern: "+fmt.Sprintf("%#v", this.Pattern)+",\n") 949 | } 950 | s = append(s, "Body: "+fmt.Sprintf("%#v", this.Body)+",\n") 951 | s = append(s, "ResponseBody: "+fmt.Sprintf("%#v", this.ResponseBody)+",\n") 952 | if this.AdditionalBindings != nil { 953 | s = append(s, "AdditionalBindings: "+fmt.Sprintf("%#v", this.AdditionalBindings)+",\n") 954 | } 955 | if this.XXX_unrecognized != nil { 956 | s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") 957 | } 958 | s = append(s, "}") 959 | return strings.Join(s, "") 960 | } 961 | func (this *HttpRule_Get) GoString() string { 962 | if this == nil { 963 | return "nil" 964 | } 965 | s := strings.Join([]string{`&api.HttpRule_Get{` + 966 | `Get:` + fmt.Sprintf("%#v", this.Get) + `}`}, ", ") 967 | return s 968 | } 969 | func (this *HttpRule_Put) GoString() string { 970 | if this == nil { 971 | return "nil" 972 | } 973 | s := strings.Join([]string{`&api.HttpRule_Put{` + 974 | `Put:` + fmt.Sprintf("%#v", this.Put) + `}`}, ", ") 975 | return s 976 | } 977 | func (this *HttpRule_Post) GoString() string { 978 | if this == nil { 979 | return "nil" 980 | } 981 | s := strings.Join([]string{`&api.HttpRule_Post{` + 982 | `Post:` + fmt.Sprintf("%#v", this.Post) + `}`}, ", ") 983 | return s 984 | } 985 | func (this *HttpRule_Delete) GoString() string { 986 | if this == nil { 987 | return "nil" 988 | } 989 | s := strings.Join([]string{`&api.HttpRule_Delete{` + 990 | `Delete:` + fmt.Sprintf("%#v", this.Delete) + `}`}, ", ") 991 | return s 992 | } 993 | func (this *HttpRule_Patch) GoString() string { 994 | if this == nil { 995 | return "nil" 996 | } 997 | s := strings.Join([]string{`&api.HttpRule_Patch{` + 998 | `Patch:` + fmt.Sprintf("%#v", this.Patch) + `}`}, ", ") 999 | return s 1000 | } 1001 | func (this *HttpRule_Custom) GoString() string { 1002 | if this == nil { 1003 | return "nil" 1004 | } 1005 | s := strings.Join([]string{`&api.HttpRule_Custom{` + 1006 | `Custom:` + fmt.Sprintf("%#v", this.Custom) + `}`}, ", ") 1007 | return s 1008 | } 1009 | func (this *CustomHttpPattern) GoString() string { 1010 | if this == nil { 1011 | return "nil" 1012 | } 1013 | s := make([]string, 0, 6) 1014 | s = append(s, "&api.CustomHttpPattern{") 1015 | s = append(s, "Kind: "+fmt.Sprintf("%#v", this.Kind)+",\n") 1016 | s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") 1017 | if this.XXX_unrecognized != nil { 1018 | s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") 1019 | } 1020 | s = append(s, "}") 1021 | return strings.Join(s, "") 1022 | } 1023 | func valueToGoStringHttp(v interface{}, typ string) string { 1024 | rv := reflect.ValueOf(v) 1025 | if rv.IsNil() { 1026 | return "nil" 1027 | } 1028 | pv := reflect.Indirect(rv).Interface() 1029 | return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) 1030 | } 1031 | func (m *Http) Marshal() (dAtA []byte, err error) { 1032 | size := m.Size() 1033 | dAtA = make([]byte, size) 1034 | n, err := m.MarshalToSizedBuffer(dAtA[:size]) 1035 | if err != nil { 1036 | return nil, err 1037 | } 1038 | return dAtA[:n], nil 1039 | } 1040 | 1041 | func (m *Http) MarshalTo(dAtA []byte) (int, error) { 1042 | size := m.Size() 1043 | return m.MarshalToSizedBuffer(dAtA[:size]) 1044 | } 1045 | 1046 | func (m *Http) MarshalToSizedBuffer(dAtA []byte) (int, error) { 1047 | i := len(dAtA) 1048 | _ = i 1049 | var l int 1050 | _ = l 1051 | if m.XXX_unrecognized != nil { 1052 | i -= len(m.XXX_unrecognized) 1053 | copy(dAtA[i:], m.XXX_unrecognized) 1054 | } 1055 | if m.FullyDecodeReservedExpansion { 1056 | i-- 1057 | if m.FullyDecodeReservedExpansion { 1058 | dAtA[i] = 1 1059 | } else { 1060 | dAtA[i] = 0 1061 | } 1062 | i-- 1063 | dAtA[i] = 0x10 1064 | } 1065 | if len(m.Rules) > 0 { 1066 | for iNdEx := len(m.Rules) - 1; iNdEx >= 0; iNdEx-- { 1067 | { 1068 | size, err := m.Rules[iNdEx].MarshalToSizedBuffer(dAtA[:i]) 1069 | if err != nil { 1070 | return 0, err 1071 | } 1072 | i -= size 1073 | i = encodeVarintHttp(dAtA, i, uint64(size)) 1074 | } 1075 | i-- 1076 | dAtA[i] = 0xa 1077 | } 1078 | } 1079 | return len(dAtA) - i, nil 1080 | } 1081 | 1082 | func (m *HttpRule) Marshal() (dAtA []byte, err error) { 1083 | size := m.Size() 1084 | dAtA = make([]byte, size) 1085 | n, err := m.MarshalToSizedBuffer(dAtA[:size]) 1086 | if err != nil { 1087 | return nil, err 1088 | } 1089 | return dAtA[:n], nil 1090 | } 1091 | 1092 | func (m *HttpRule) MarshalTo(dAtA []byte) (int, error) { 1093 | size := m.Size() 1094 | return m.MarshalToSizedBuffer(dAtA[:size]) 1095 | } 1096 | 1097 | func (m *HttpRule) MarshalToSizedBuffer(dAtA []byte) (int, error) { 1098 | i := len(dAtA) 1099 | _ = i 1100 | var l int 1101 | _ = l 1102 | if m.XXX_unrecognized != nil { 1103 | i -= len(m.XXX_unrecognized) 1104 | copy(dAtA[i:], m.XXX_unrecognized) 1105 | } 1106 | if len(m.ResponseBody) > 0 { 1107 | i -= len(m.ResponseBody) 1108 | copy(dAtA[i:], m.ResponseBody) 1109 | i = encodeVarintHttp(dAtA, i, uint64(len(m.ResponseBody))) 1110 | i-- 1111 | dAtA[i] = 0x62 1112 | } 1113 | if len(m.AdditionalBindings) > 0 { 1114 | for iNdEx := len(m.AdditionalBindings) - 1; iNdEx >= 0; iNdEx-- { 1115 | { 1116 | size, err := m.AdditionalBindings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) 1117 | if err != nil { 1118 | return 0, err 1119 | } 1120 | i -= size 1121 | i = encodeVarintHttp(dAtA, i, uint64(size)) 1122 | } 1123 | i-- 1124 | dAtA[i] = 0x5a 1125 | } 1126 | } 1127 | if m.Pattern != nil { 1128 | { 1129 | size := m.Pattern.Size() 1130 | i -= size 1131 | if _, err := m.Pattern.MarshalTo(dAtA[i:]); err != nil { 1132 | return 0, err 1133 | } 1134 | } 1135 | } 1136 | if len(m.Body) > 0 { 1137 | i -= len(m.Body) 1138 | copy(dAtA[i:], m.Body) 1139 | i = encodeVarintHttp(dAtA, i, uint64(len(m.Body))) 1140 | i-- 1141 | dAtA[i] = 0x3a 1142 | } 1143 | if len(m.Selector) > 0 { 1144 | i -= len(m.Selector) 1145 | copy(dAtA[i:], m.Selector) 1146 | i = encodeVarintHttp(dAtA, i, uint64(len(m.Selector))) 1147 | i-- 1148 | dAtA[i] = 0xa 1149 | } 1150 | return len(dAtA) - i, nil 1151 | } 1152 | 1153 | func (m *HttpRule_Get) MarshalTo(dAtA []byte) (int, error) { 1154 | return m.MarshalToSizedBuffer(dAtA[:m.Size()]) 1155 | } 1156 | 1157 | func (m *HttpRule_Get) MarshalToSizedBuffer(dAtA []byte) (int, error) { 1158 | i := len(dAtA) 1159 | i -= len(m.Get) 1160 | copy(dAtA[i:], m.Get) 1161 | i = encodeVarintHttp(dAtA, i, uint64(len(m.Get))) 1162 | i-- 1163 | dAtA[i] = 0x12 1164 | return len(dAtA) - i, nil 1165 | } 1166 | func (m *HttpRule_Put) MarshalTo(dAtA []byte) (int, error) { 1167 | return m.MarshalToSizedBuffer(dAtA[:m.Size()]) 1168 | } 1169 | 1170 | func (m *HttpRule_Put) MarshalToSizedBuffer(dAtA []byte) (int, error) { 1171 | i := len(dAtA) 1172 | i -= len(m.Put) 1173 | copy(dAtA[i:], m.Put) 1174 | i = encodeVarintHttp(dAtA, i, uint64(len(m.Put))) 1175 | i-- 1176 | dAtA[i] = 0x1a 1177 | return len(dAtA) - i, nil 1178 | } 1179 | func (m *HttpRule_Post) MarshalTo(dAtA []byte) (int, error) { 1180 | return m.MarshalToSizedBuffer(dAtA[:m.Size()]) 1181 | } 1182 | 1183 | func (m *HttpRule_Post) MarshalToSizedBuffer(dAtA []byte) (int, error) { 1184 | i := len(dAtA) 1185 | i -= len(m.Post) 1186 | copy(dAtA[i:], m.Post) 1187 | i = encodeVarintHttp(dAtA, i, uint64(len(m.Post))) 1188 | i-- 1189 | dAtA[i] = 0x22 1190 | return len(dAtA) - i, nil 1191 | } 1192 | func (m *HttpRule_Delete) MarshalTo(dAtA []byte) (int, error) { 1193 | return m.MarshalToSizedBuffer(dAtA[:m.Size()]) 1194 | } 1195 | 1196 | func (m *HttpRule_Delete) MarshalToSizedBuffer(dAtA []byte) (int, error) { 1197 | i := len(dAtA) 1198 | i -= len(m.Delete) 1199 | copy(dAtA[i:], m.Delete) 1200 | i = encodeVarintHttp(dAtA, i, uint64(len(m.Delete))) 1201 | i-- 1202 | dAtA[i] = 0x2a 1203 | return len(dAtA) - i, nil 1204 | } 1205 | func (m *HttpRule_Patch) MarshalTo(dAtA []byte) (int, error) { 1206 | return m.MarshalToSizedBuffer(dAtA[:m.Size()]) 1207 | } 1208 | 1209 | func (m *HttpRule_Patch) MarshalToSizedBuffer(dAtA []byte) (int, error) { 1210 | i := len(dAtA) 1211 | i -= len(m.Patch) 1212 | copy(dAtA[i:], m.Patch) 1213 | i = encodeVarintHttp(dAtA, i, uint64(len(m.Patch))) 1214 | i-- 1215 | dAtA[i] = 0x32 1216 | return len(dAtA) - i, nil 1217 | } 1218 | func (m *HttpRule_Custom) MarshalTo(dAtA []byte) (int, error) { 1219 | return m.MarshalToSizedBuffer(dAtA[:m.Size()]) 1220 | } 1221 | 1222 | func (m *HttpRule_Custom) MarshalToSizedBuffer(dAtA []byte) (int, error) { 1223 | i := len(dAtA) 1224 | if m.Custom != nil { 1225 | { 1226 | size, err := m.Custom.MarshalToSizedBuffer(dAtA[:i]) 1227 | if err != nil { 1228 | return 0, err 1229 | } 1230 | i -= size 1231 | i = encodeVarintHttp(dAtA, i, uint64(size)) 1232 | } 1233 | i-- 1234 | dAtA[i] = 0x42 1235 | } 1236 | return len(dAtA) - i, nil 1237 | } 1238 | func (m *CustomHttpPattern) Marshal() (dAtA []byte, err error) { 1239 | size := m.Size() 1240 | dAtA = make([]byte, size) 1241 | n, err := m.MarshalToSizedBuffer(dAtA[:size]) 1242 | if err != nil { 1243 | return nil, err 1244 | } 1245 | return dAtA[:n], nil 1246 | } 1247 | 1248 | func (m *CustomHttpPattern) MarshalTo(dAtA []byte) (int, error) { 1249 | size := m.Size() 1250 | return m.MarshalToSizedBuffer(dAtA[:size]) 1251 | } 1252 | 1253 | func (m *CustomHttpPattern) MarshalToSizedBuffer(dAtA []byte) (int, error) { 1254 | i := len(dAtA) 1255 | _ = i 1256 | var l int 1257 | _ = l 1258 | if m.XXX_unrecognized != nil { 1259 | i -= len(m.XXX_unrecognized) 1260 | copy(dAtA[i:], m.XXX_unrecognized) 1261 | } 1262 | if len(m.Path) > 0 { 1263 | i -= len(m.Path) 1264 | copy(dAtA[i:], m.Path) 1265 | i = encodeVarintHttp(dAtA, i, uint64(len(m.Path))) 1266 | i-- 1267 | dAtA[i] = 0x12 1268 | } 1269 | if len(m.Kind) > 0 { 1270 | i -= len(m.Kind) 1271 | copy(dAtA[i:], m.Kind) 1272 | i = encodeVarintHttp(dAtA, i, uint64(len(m.Kind))) 1273 | i-- 1274 | dAtA[i] = 0xa 1275 | } 1276 | return len(dAtA) - i, nil 1277 | } 1278 | 1279 | func encodeVarintHttp(dAtA []byte, offset int, v uint64) int { 1280 | offset -= sovHttp(v) 1281 | base := offset 1282 | for v >= 1<<7 { 1283 | dAtA[offset] = uint8(v&0x7f | 0x80) 1284 | v >>= 7 1285 | offset++ 1286 | } 1287 | dAtA[offset] = uint8(v) 1288 | return base 1289 | } 1290 | func NewPopulatedHttp(r randyHttp, easy bool) *Http { 1291 | this := &Http{} 1292 | if r.Intn(5) == 0 { 1293 | v1 := r.Intn(5) 1294 | this.Rules = make([]*HttpRule, v1) 1295 | for i := 0; i < v1; i++ { 1296 | this.Rules[i] = NewPopulatedHttpRule(r, easy) 1297 | } 1298 | } 1299 | this.FullyDecodeReservedExpansion = bool(bool(r.Intn(2) == 0)) 1300 | if !easy && r.Intn(10) != 0 { 1301 | this.XXX_unrecognized = randUnrecognizedHttp(r, 3) 1302 | } 1303 | return this 1304 | } 1305 | 1306 | func NewPopulatedHttpRule(r randyHttp, easy bool) *HttpRule { 1307 | this := &HttpRule{} 1308 | this.Selector = string(randStringHttp(r)) 1309 | oneofNumber_Pattern := []int32{2, 3, 4, 5, 6, 8}[r.Intn(6)] 1310 | switch oneofNumber_Pattern { 1311 | case 2: 1312 | this.Pattern = NewPopulatedHttpRule_Get(r, easy) 1313 | case 3: 1314 | this.Pattern = NewPopulatedHttpRule_Put(r, easy) 1315 | case 4: 1316 | this.Pattern = NewPopulatedHttpRule_Post(r, easy) 1317 | case 5: 1318 | this.Pattern = NewPopulatedHttpRule_Delete(r, easy) 1319 | case 6: 1320 | this.Pattern = NewPopulatedHttpRule_Patch(r, easy) 1321 | case 8: 1322 | this.Pattern = NewPopulatedHttpRule_Custom(r, easy) 1323 | } 1324 | this.Body = string(randStringHttp(r)) 1325 | if r.Intn(5) == 0 { 1326 | v2 := r.Intn(5) 1327 | this.AdditionalBindings = make([]*HttpRule, v2) 1328 | for i := 0; i < v2; i++ { 1329 | this.AdditionalBindings[i] = NewPopulatedHttpRule(r, easy) 1330 | } 1331 | } 1332 | this.ResponseBody = string(randStringHttp(r)) 1333 | if !easy && r.Intn(10) != 0 { 1334 | this.XXX_unrecognized = randUnrecognizedHttp(r, 13) 1335 | } 1336 | return this 1337 | } 1338 | 1339 | func NewPopulatedHttpRule_Get(r randyHttp, easy bool) *HttpRule_Get { 1340 | this := &HttpRule_Get{} 1341 | this.Get = string(randStringHttp(r)) 1342 | return this 1343 | } 1344 | func NewPopulatedHttpRule_Put(r randyHttp, easy bool) *HttpRule_Put { 1345 | this := &HttpRule_Put{} 1346 | this.Put = string(randStringHttp(r)) 1347 | return this 1348 | } 1349 | func NewPopulatedHttpRule_Post(r randyHttp, easy bool) *HttpRule_Post { 1350 | this := &HttpRule_Post{} 1351 | this.Post = string(randStringHttp(r)) 1352 | return this 1353 | } 1354 | func NewPopulatedHttpRule_Delete(r randyHttp, easy bool) *HttpRule_Delete { 1355 | this := &HttpRule_Delete{} 1356 | this.Delete = string(randStringHttp(r)) 1357 | return this 1358 | } 1359 | func NewPopulatedHttpRule_Patch(r randyHttp, easy bool) *HttpRule_Patch { 1360 | this := &HttpRule_Patch{} 1361 | this.Patch = string(randStringHttp(r)) 1362 | return this 1363 | } 1364 | func NewPopulatedHttpRule_Custom(r randyHttp, easy bool) *HttpRule_Custom { 1365 | this := &HttpRule_Custom{} 1366 | this.Custom = NewPopulatedCustomHttpPattern(r, easy) 1367 | return this 1368 | } 1369 | func NewPopulatedCustomHttpPattern(r randyHttp, easy bool) *CustomHttpPattern { 1370 | this := &CustomHttpPattern{} 1371 | this.Kind = string(randStringHttp(r)) 1372 | this.Path = string(randStringHttp(r)) 1373 | if !easy && r.Intn(10) != 0 { 1374 | this.XXX_unrecognized = randUnrecognizedHttp(r, 3) 1375 | } 1376 | return this 1377 | } 1378 | 1379 | type randyHttp interface { 1380 | Float32() float32 1381 | Float64() float64 1382 | Int63() int64 1383 | Int31() int32 1384 | Uint32() uint32 1385 | Intn(n int) int 1386 | } 1387 | 1388 | func randUTF8RuneHttp(r randyHttp) rune { 1389 | ru := r.Intn(62) 1390 | if ru < 10 { 1391 | return rune(ru + 48) 1392 | } else if ru < 36 { 1393 | return rune(ru + 55) 1394 | } 1395 | return rune(ru + 61) 1396 | } 1397 | func randStringHttp(r randyHttp) string { 1398 | v3 := r.Intn(100) 1399 | tmps := make([]rune, v3) 1400 | for i := 0; i < v3; i++ { 1401 | tmps[i] = randUTF8RuneHttp(r) 1402 | } 1403 | return string(tmps) 1404 | } 1405 | func randUnrecognizedHttp(r randyHttp, maxFieldNumber int) (dAtA []byte) { 1406 | l := r.Intn(5) 1407 | for i := 0; i < l; i++ { 1408 | wire := r.Intn(4) 1409 | if wire == 3 { 1410 | wire = 5 1411 | } 1412 | fieldNumber := maxFieldNumber + r.Intn(100) 1413 | dAtA = randFieldHttp(dAtA, r, fieldNumber, wire) 1414 | } 1415 | return dAtA 1416 | } 1417 | func randFieldHttp(dAtA []byte, r randyHttp, fieldNumber int, wire int) []byte { 1418 | key := uint32(fieldNumber)<<3 | uint32(wire) 1419 | switch wire { 1420 | case 0: 1421 | dAtA = encodeVarintPopulateHttp(dAtA, uint64(key)) 1422 | v4 := r.Int63() 1423 | if r.Intn(2) == 0 { 1424 | v4 *= -1 1425 | } 1426 | dAtA = encodeVarintPopulateHttp(dAtA, uint64(v4)) 1427 | case 1: 1428 | dAtA = encodeVarintPopulateHttp(dAtA, uint64(key)) 1429 | dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) 1430 | case 2: 1431 | dAtA = encodeVarintPopulateHttp(dAtA, uint64(key)) 1432 | ll := r.Intn(100) 1433 | dAtA = encodeVarintPopulateHttp(dAtA, uint64(ll)) 1434 | for j := 0; j < ll; j++ { 1435 | dAtA = append(dAtA, byte(r.Intn(256))) 1436 | } 1437 | default: 1438 | dAtA = encodeVarintPopulateHttp(dAtA, uint64(key)) 1439 | dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) 1440 | } 1441 | return dAtA 1442 | } 1443 | func encodeVarintPopulateHttp(dAtA []byte, v uint64) []byte { 1444 | for v >= 1<<7 { 1445 | dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) 1446 | v >>= 7 1447 | } 1448 | dAtA = append(dAtA, uint8(v)) 1449 | return dAtA 1450 | } 1451 | func (m *Http) Size() (n int) { 1452 | if m == nil { 1453 | return 0 1454 | } 1455 | var l int 1456 | _ = l 1457 | if len(m.Rules) > 0 { 1458 | for _, e := range m.Rules { 1459 | l = e.Size() 1460 | n += 1 + l + sovHttp(uint64(l)) 1461 | } 1462 | } 1463 | if m.FullyDecodeReservedExpansion { 1464 | n += 2 1465 | } 1466 | if m.XXX_unrecognized != nil { 1467 | n += len(m.XXX_unrecognized) 1468 | } 1469 | return n 1470 | } 1471 | 1472 | func (m *HttpRule) Size() (n int) { 1473 | if m == nil { 1474 | return 0 1475 | } 1476 | var l int 1477 | _ = l 1478 | l = len(m.Selector) 1479 | if l > 0 { 1480 | n += 1 + l + sovHttp(uint64(l)) 1481 | } 1482 | if m.Pattern != nil { 1483 | n += m.Pattern.Size() 1484 | } 1485 | l = len(m.Body) 1486 | if l > 0 { 1487 | n += 1 + l + sovHttp(uint64(l)) 1488 | } 1489 | if len(m.AdditionalBindings) > 0 { 1490 | for _, e := range m.AdditionalBindings { 1491 | l = e.Size() 1492 | n += 1 + l + sovHttp(uint64(l)) 1493 | } 1494 | } 1495 | l = len(m.ResponseBody) 1496 | if l > 0 { 1497 | n += 1 + l + sovHttp(uint64(l)) 1498 | } 1499 | if m.XXX_unrecognized != nil { 1500 | n += len(m.XXX_unrecognized) 1501 | } 1502 | return n 1503 | } 1504 | 1505 | func (m *HttpRule_Get) Size() (n int) { 1506 | if m == nil { 1507 | return 0 1508 | } 1509 | var l int 1510 | _ = l 1511 | l = len(m.Get) 1512 | n += 1 + l + sovHttp(uint64(l)) 1513 | return n 1514 | } 1515 | func (m *HttpRule_Put) Size() (n int) { 1516 | if m == nil { 1517 | return 0 1518 | } 1519 | var l int 1520 | _ = l 1521 | l = len(m.Put) 1522 | n += 1 + l + sovHttp(uint64(l)) 1523 | return n 1524 | } 1525 | func (m *HttpRule_Post) Size() (n int) { 1526 | if m == nil { 1527 | return 0 1528 | } 1529 | var l int 1530 | _ = l 1531 | l = len(m.Post) 1532 | n += 1 + l + sovHttp(uint64(l)) 1533 | return n 1534 | } 1535 | func (m *HttpRule_Delete) Size() (n int) { 1536 | if m == nil { 1537 | return 0 1538 | } 1539 | var l int 1540 | _ = l 1541 | l = len(m.Delete) 1542 | n += 1 + l + sovHttp(uint64(l)) 1543 | return n 1544 | } 1545 | func (m *HttpRule_Patch) Size() (n int) { 1546 | if m == nil { 1547 | return 0 1548 | } 1549 | var l int 1550 | _ = l 1551 | l = len(m.Patch) 1552 | n += 1 + l + sovHttp(uint64(l)) 1553 | return n 1554 | } 1555 | func (m *HttpRule_Custom) Size() (n int) { 1556 | if m == nil { 1557 | return 0 1558 | } 1559 | var l int 1560 | _ = l 1561 | if m.Custom != nil { 1562 | l = m.Custom.Size() 1563 | n += 1 + l + sovHttp(uint64(l)) 1564 | } 1565 | return n 1566 | } 1567 | func (m *CustomHttpPattern) Size() (n int) { 1568 | if m == nil { 1569 | return 0 1570 | } 1571 | var l int 1572 | _ = l 1573 | l = len(m.Kind) 1574 | if l > 0 { 1575 | n += 1 + l + sovHttp(uint64(l)) 1576 | } 1577 | l = len(m.Path) 1578 | if l > 0 { 1579 | n += 1 + l + sovHttp(uint64(l)) 1580 | } 1581 | if m.XXX_unrecognized != nil { 1582 | n += len(m.XXX_unrecognized) 1583 | } 1584 | return n 1585 | } 1586 | 1587 | func sovHttp(x uint64) (n int) { 1588 | return (math_bits.Len64(x|1) + 6) / 7 1589 | } 1590 | func sozHttp(x uint64) (n int) { 1591 | return sovHttp(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 1592 | } 1593 | func (this *Http) String() string { 1594 | if this == nil { 1595 | return "nil" 1596 | } 1597 | repeatedStringForRules := "[]*HttpRule{" 1598 | for _, f := range this.Rules { 1599 | repeatedStringForRules += strings.Replace(f.String(), "HttpRule", "HttpRule", 1) + "," 1600 | } 1601 | repeatedStringForRules += "}" 1602 | s := strings.Join([]string{`&Http{`, 1603 | `Rules:` + repeatedStringForRules + `,`, 1604 | `FullyDecodeReservedExpansion:` + fmt.Sprintf("%v", this.FullyDecodeReservedExpansion) + `,`, 1605 | `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, 1606 | `}`, 1607 | }, "") 1608 | return s 1609 | } 1610 | func (this *HttpRule) String() string { 1611 | if this == nil { 1612 | return "nil" 1613 | } 1614 | repeatedStringForAdditionalBindings := "[]*HttpRule{" 1615 | for _, f := range this.AdditionalBindings { 1616 | repeatedStringForAdditionalBindings += strings.Replace(f.String(), "HttpRule", "HttpRule", 1) + "," 1617 | } 1618 | repeatedStringForAdditionalBindings += "}" 1619 | s := strings.Join([]string{`&HttpRule{`, 1620 | `Selector:` + fmt.Sprintf("%v", this.Selector) + `,`, 1621 | `Pattern:` + fmt.Sprintf("%v", this.Pattern) + `,`, 1622 | `Body:` + fmt.Sprintf("%v", this.Body) + `,`, 1623 | `AdditionalBindings:` + repeatedStringForAdditionalBindings + `,`, 1624 | `ResponseBody:` + fmt.Sprintf("%v", this.ResponseBody) + `,`, 1625 | `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, 1626 | `}`, 1627 | }, "") 1628 | return s 1629 | } 1630 | func (this *HttpRule_Get) String() string { 1631 | if this == nil { 1632 | return "nil" 1633 | } 1634 | s := strings.Join([]string{`&HttpRule_Get{`, 1635 | `Get:` + fmt.Sprintf("%v", this.Get) + `,`, 1636 | `}`, 1637 | }, "") 1638 | return s 1639 | } 1640 | func (this *HttpRule_Put) String() string { 1641 | if this == nil { 1642 | return "nil" 1643 | } 1644 | s := strings.Join([]string{`&HttpRule_Put{`, 1645 | `Put:` + fmt.Sprintf("%v", this.Put) + `,`, 1646 | `}`, 1647 | }, "") 1648 | return s 1649 | } 1650 | func (this *HttpRule_Post) String() string { 1651 | if this == nil { 1652 | return "nil" 1653 | } 1654 | s := strings.Join([]string{`&HttpRule_Post{`, 1655 | `Post:` + fmt.Sprintf("%v", this.Post) + `,`, 1656 | `}`, 1657 | }, "") 1658 | return s 1659 | } 1660 | func (this *HttpRule_Delete) String() string { 1661 | if this == nil { 1662 | return "nil" 1663 | } 1664 | s := strings.Join([]string{`&HttpRule_Delete{`, 1665 | `Delete:` + fmt.Sprintf("%v", this.Delete) + `,`, 1666 | `}`, 1667 | }, "") 1668 | return s 1669 | } 1670 | func (this *HttpRule_Patch) String() string { 1671 | if this == nil { 1672 | return "nil" 1673 | } 1674 | s := strings.Join([]string{`&HttpRule_Patch{`, 1675 | `Patch:` + fmt.Sprintf("%v", this.Patch) + `,`, 1676 | `}`, 1677 | }, "") 1678 | return s 1679 | } 1680 | func (this *HttpRule_Custom) String() string { 1681 | if this == nil { 1682 | return "nil" 1683 | } 1684 | s := strings.Join([]string{`&HttpRule_Custom{`, 1685 | `Custom:` + strings.Replace(fmt.Sprintf("%v", this.Custom), "CustomHttpPattern", "CustomHttpPattern", 1) + `,`, 1686 | `}`, 1687 | }, "") 1688 | return s 1689 | } 1690 | func (this *CustomHttpPattern) String() string { 1691 | if this == nil { 1692 | return "nil" 1693 | } 1694 | s := strings.Join([]string{`&CustomHttpPattern{`, 1695 | `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, 1696 | `Path:` + fmt.Sprintf("%v", this.Path) + `,`, 1697 | `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, 1698 | `}`, 1699 | }, "") 1700 | return s 1701 | } 1702 | func valueToStringHttp(v interface{}) string { 1703 | rv := reflect.ValueOf(v) 1704 | if rv.IsNil() { 1705 | return "nil" 1706 | } 1707 | pv := reflect.Indirect(rv).Interface() 1708 | return fmt.Sprintf("*%v", pv) 1709 | } 1710 | func (m *Http) Unmarshal(dAtA []byte) error { 1711 | l := len(dAtA) 1712 | iNdEx := 0 1713 | for iNdEx < l { 1714 | preIndex := iNdEx 1715 | var wire uint64 1716 | for shift := uint(0); ; shift += 7 { 1717 | if shift >= 64 { 1718 | return ErrIntOverflowHttp 1719 | } 1720 | if iNdEx >= l { 1721 | return io.ErrUnexpectedEOF 1722 | } 1723 | b := dAtA[iNdEx] 1724 | iNdEx++ 1725 | wire |= uint64(b&0x7F) << shift 1726 | if b < 0x80 { 1727 | break 1728 | } 1729 | } 1730 | fieldNum := int32(wire >> 3) 1731 | wireType := int(wire & 0x7) 1732 | if wireType == 4 { 1733 | return fmt.Errorf("proto: Http: wiretype end group for non-group") 1734 | } 1735 | if fieldNum <= 0 { 1736 | return fmt.Errorf("proto: Http: illegal tag %d (wire type %d)", fieldNum, wire) 1737 | } 1738 | switch fieldNum { 1739 | case 1: 1740 | if wireType != 2 { 1741 | return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) 1742 | } 1743 | var msglen int 1744 | for shift := uint(0); ; shift += 7 { 1745 | if shift >= 64 { 1746 | return ErrIntOverflowHttp 1747 | } 1748 | if iNdEx >= l { 1749 | return io.ErrUnexpectedEOF 1750 | } 1751 | b := dAtA[iNdEx] 1752 | iNdEx++ 1753 | msglen |= int(b&0x7F) << shift 1754 | if b < 0x80 { 1755 | break 1756 | } 1757 | } 1758 | if msglen < 0 { 1759 | return ErrInvalidLengthHttp 1760 | } 1761 | postIndex := iNdEx + msglen 1762 | if postIndex < 0 { 1763 | return ErrInvalidLengthHttp 1764 | } 1765 | if postIndex > l { 1766 | return io.ErrUnexpectedEOF 1767 | } 1768 | m.Rules = append(m.Rules, &HttpRule{}) 1769 | if err := m.Rules[len(m.Rules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1770 | return err 1771 | } 1772 | iNdEx = postIndex 1773 | case 2: 1774 | if wireType != 0 { 1775 | return fmt.Errorf("proto: wrong wireType = %d for field FullyDecodeReservedExpansion", wireType) 1776 | } 1777 | var v int 1778 | for shift := uint(0); ; shift += 7 { 1779 | if shift >= 64 { 1780 | return ErrIntOverflowHttp 1781 | } 1782 | if iNdEx >= l { 1783 | return io.ErrUnexpectedEOF 1784 | } 1785 | b := dAtA[iNdEx] 1786 | iNdEx++ 1787 | v |= int(b&0x7F) << shift 1788 | if b < 0x80 { 1789 | break 1790 | } 1791 | } 1792 | m.FullyDecodeReservedExpansion = bool(v != 0) 1793 | default: 1794 | iNdEx = preIndex 1795 | skippy, err := skipHttp(dAtA[iNdEx:]) 1796 | if err != nil { 1797 | return err 1798 | } 1799 | if skippy < 0 { 1800 | return ErrInvalidLengthHttp 1801 | } 1802 | if (iNdEx + skippy) < 0 { 1803 | return ErrInvalidLengthHttp 1804 | } 1805 | if (iNdEx + skippy) > l { 1806 | return io.ErrUnexpectedEOF 1807 | } 1808 | m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 1809 | iNdEx += skippy 1810 | } 1811 | } 1812 | 1813 | if iNdEx > l { 1814 | return io.ErrUnexpectedEOF 1815 | } 1816 | return nil 1817 | } 1818 | func (m *HttpRule) Unmarshal(dAtA []byte) error { 1819 | l := len(dAtA) 1820 | iNdEx := 0 1821 | for iNdEx < l { 1822 | preIndex := iNdEx 1823 | var wire uint64 1824 | for shift := uint(0); ; shift += 7 { 1825 | if shift >= 64 { 1826 | return ErrIntOverflowHttp 1827 | } 1828 | if iNdEx >= l { 1829 | return io.ErrUnexpectedEOF 1830 | } 1831 | b := dAtA[iNdEx] 1832 | iNdEx++ 1833 | wire |= uint64(b&0x7F) << shift 1834 | if b < 0x80 { 1835 | break 1836 | } 1837 | } 1838 | fieldNum := int32(wire >> 3) 1839 | wireType := int(wire & 0x7) 1840 | if wireType == 4 { 1841 | return fmt.Errorf("proto: HttpRule: wiretype end group for non-group") 1842 | } 1843 | if fieldNum <= 0 { 1844 | return fmt.Errorf("proto: HttpRule: illegal tag %d (wire type %d)", fieldNum, wire) 1845 | } 1846 | switch fieldNum { 1847 | case 1: 1848 | if wireType != 2 { 1849 | return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) 1850 | } 1851 | var stringLen uint64 1852 | for shift := uint(0); ; shift += 7 { 1853 | if shift >= 64 { 1854 | return ErrIntOverflowHttp 1855 | } 1856 | if iNdEx >= l { 1857 | return io.ErrUnexpectedEOF 1858 | } 1859 | b := dAtA[iNdEx] 1860 | iNdEx++ 1861 | stringLen |= uint64(b&0x7F) << shift 1862 | if b < 0x80 { 1863 | break 1864 | } 1865 | } 1866 | intStringLen := int(stringLen) 1867 | if intStringLen < 0 { 1868 | return ErrInvalidLengthHttp 1869 | } 1870 | postIndex := iNdEx + intStringLen 1871 | if postIndex < 0 { 1872 | return ErrInvalidLengthHttp 1873 | } 1874 | if postIndex > l { 1875 | return io.ErrUnexpectedEOF 1876 | } 1877 | m.Selector = string(dAtA[iNdEx:postIndex]) 1878 | iNdEx = postIndex 1879 | case 2: 1880 | if wireType != 2 { 1881 | return fmt.Errorf("proto: wrong wireType = %d for field Get", wireType) 1882 | } 1883 | var stringLen uint64 1884 | for shift := uint(0); ; shift += 7 { 1885 | if shift >= 64 { 1886 | return ErrIntOverflowHttp 1887 | } 1888 | if iNdEx >= l { 1889 | return io.ErrUnexpectedEOF 1890 | } 1891 | b := dAtA[iNdEx] 1892 | iNdEx++ 1893 | stringLen |= uint64(b&0x7F) << shift 1894 | if b < 0x80 { 1895 | break 1896 | } 1897 | } 1898 | intStringLen := int(stringLen) 1899 | if intStringLen < 0 { 1900 | return ErrInvalidLengthHttp 1901 | } 1902 | postIndex := iNdEx + intStringLen 1903 | if postIndex < 0 { 1904 | return ErrInvalidLengthHttp 1905 | } 1906 | if postIndex > l { 1907 | return io.ErrUnexpectedEOF 1908 | } 1909 | m.Pattern = &HttpRule_Get{string(dAtA[iNdEx:postIndex])} 1910 | iNdEx = postIndex 1911 | case 3: 1912 | if wireType != 2 { 1913 | return fmt.Errorf("proto: wrong wireType = %d for field Put", wireType) 1914 | } 1915 | var stringLen uint64 1916 | for shift := uint(0); ; shift += 7 { 1917 | if shift >= 64 { 1918 | return ErrIntOverflowHttp 1919 | } 1920 | if iNdEx >= l { 1921 | return io.ErrUnexpectedEOF 1922 | } 1923 | b := dAtA[iNdEx] 1924 | iNdEx++ 1925 | stringLen |= uint64(b&0x7F) << shift 1926 | if b < 0x80 { 1927 | break 1928 | } 1929 | } 1930 | intStringLen := int(stringLen) 1931 | if intStringLen < 0 { 1932 | return ErrInvalidLengthHttp 1933 | } 1934 | postIndex := iNdEx + intStringLen 1935 | if postIndex < 0 { 1936 | return ErrInvalidLengthHttp 1937 | } 1938 | if postIndex > l { 1939 | return io.ErrUnexpectedEOF 1940 | } 1941 | m.Pattern = &HttpRule_Put{string(dAtA[iNdEx:postIndex])} 1942 | iNdEx = postIndex 1943 | case 4: 1944 | if wireType != 2 { 1945 | return fmt.Errorf("proto: wrong wireType = %d for field Post", wireType) 1946 | } 1947 | var stringLen uint64 1948 | for shift := uint(0); ; shift += 7 { 1949 | if shift >= 64 { 1950 | return ErrIntOverflowHttp 1951 | } 1952 | if iNdEx >= l { 1953 | return io.ErrUnexpectedEOF 1954 | } 1955 | b := dAtA[iNdEx] 1956 | iNdEx++ 1957 | stringLen |= uint64(b&0x7F) << shift 1958 | if b < 0x80 { 1959 | break 1960 | } 1961 | } 1962 | intStringLen := int(stringLen) 1963 | if intStringLen < 0 { 1964 | return ErrInvalidLengthHttp 1965 | } 1966 | postIndex := iNdEx + intStringLen 1967 | if postIndex < 0 { 1968 | return ErrInvalidLengthHttp 1969 | } 1970 | if postIndex > l { 1971 | return io.ErrUnexpectedEOF 1972 | } 1973 | m.Pattern = &HttpRule_Post{string(dAtA[iNdEx:postIndex])} 1974 | iNdEx = postIndex 1975 | case 5: 1976 | if wireType != 2 { 1977 | return fmt.Errorf("proto: wrong wireType = %d for field Delete", wireType) 1978 | } 1979 | var stringLen uint64 1980 | for shift := uint(0); ; shift += 7 { 1981 | if shift >= 64 { 1982 | return ErrIntOverflowHttp 1983 | } 1984 | if iNdEx >= l { 1985 | return io.ErrUnexpectedEOF 1986 | } 1987 | b := dAtA[iNdEx] 1988 | iNdEx++ 1989 | stringLen |= uint64(b&0x7F) << shift 1990 | if b < 0x80 { 1991 | break 1992 | } 1993 | } 1994 | intStringLen := int(stringLen) 1995 | if intStringLen < 0 { 1996 | return ErrInvalidLengthHttp 1997 | } 1998 | postIndex := iNdEx + intStringLen 1999 | if postIndex < 0 { 2000 | return ErrInvalidLengthHttp 2001 | } 2002 | if postIndex > l { 2003 | return io.ErrUnexpectedEOF 2004 | } 2005 | m.Pattern = &HttpRule_Delete{string(dAtA[iNdEx:postIndex])} 2006 | iNdEx = postIndex 2007 | case 6: 2008 | if wireType != 2 { 2009 | return fmt.Errorf("proto: wrong wireType = %d for field Patch", wireType) 2010 | } 2011 | var stringLen uint64 2012 | for shift := uint(0); ; shift += 7 { 2013 | if shift >= 64 { 2014 | return ErrIntOverflowHttp 2015 | } 2016 | if iNdEx >= l { 2017 | return io.ErrUnexpectedEOF 2018 | } 2019 | b := dAtA[iNdEx] 2020 | iNdEx++ 2021 | stringLen |= uint64(b&0x7F) << shift 2022 | if b < 0x80 { 2023 | break 2024 | } 2025 | } 2026 | intStringLen := int(stringLen) 2027 | if intStringLen < 0 { 2028 | return ErrInvalidLengthHttp 2029 | } 2030 | postIndex := iNdEx + intStringLen 2031 | if postIndex < 0 { 2032 | return ErrInvalidLengthHttp 2033 | } 2034 | if postIndex > l { 2035 | return io.ErrUnexpectedEOF 2036 | } 2037 | m.Pattern = &HttpRule_Patch{string(dAtA[iNdEx:postIndex])} 2038 | iNdEx = postIndex 2039 | case 7: 2040 | if wireType != 2 { 2041 | return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) 2042 | } 2043 | var stringLen uint64 2044 | for shift := uint(0); ; shift += 7 { 2045 | if shift >= 64 { 2046 | return ErrIntOverflowHttp 2047 | } 2048 | if iNdEx >= l { 2049 | return io.ErrUnexpectedEOF 2050 | } 2051 | b := dAtA[iNdEx] 2052 | iNdEx++ 2053 | stringLen |= uint64(b&0x7F) << shift 2054 | if b < 0x80 { 2055 | break 2056 | } 2057 | } 2058 | intStringLen := int(stringLen) 2059 | if intStringLen < 0 { 2060 | return ErrInvalidLengthHttp 2061 | } 2062 | postIndex := iNdEx + intStringLen 2063 | if postIndex < 0 { 2064 | return ErrInvalidLengthHttp 2065 | } 2066 | if postIndex > l { 2067 | return io.ErrUnexpectedEOF 2068 | } 2069 | m.Body = string(dAtA[iNdEx:postIndex]) 2070 | iNdEx = postIndex 2071 | case 8: 2072 | if wireType != 2 { 2073 | return fmt.Errorf("proto: wrong wireType = %d for field Custom", wireType) 2074 | } 2075 | var msglen int 2076 | for shift := uint(0); ; shift += 7 { 2077 | if shift >= 64 { 2078 | return ErrIntOverflowHttp 2079 | } 2080 | if iNdEx >= l { 2081 | return io.ErrUnexpectedEOF 2082 | } 2083 | b := dAtA[iNdEx] 2084 | iNdEx++ 2085 | msglen |= int(b&0x7F) << shift 2086 | if b < 0x80 { 2087 | break 2088 | } 2089 | } 2090 | if msglen < 0 { 2091 | return ErrInvalidLengthHttp 2092 | } 2093 | postIndex := iNdEx + msglen 2094 | if postIndex < 0 { 2095 | return ErrInvalidLengthHttp 2096 | } 2097 | if postIndex > l { 2098 | return io.ErrUnexpectedEOF 2099 | } 2100 | v := &CustomHttpPattern{} 2101 | if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 2102 | return err 2103 | } 2104 | m.Pattern = &HttpRule_Custom{v} 2105 | iNdEx = postIndex 2106 | case 11: 2107 | if wireType != 2 { 2108 | return fmt.Errorf("proto: wrong wireType = %d for field AdditionalBindings", wireType) 2109 | } 2110 | var msglen int 2111 | for shift := uint(0); ; shift += 7 { 2112 | if shift >= 64 { 2113 | return ErrIntOverflowHttp 2114 | } 2115 | if iNdEx >= l { 2116 | return io.ErrUnexpectedEOF 2117 | } 2118 | b := dAtA[iNdEx] 2119 | iNdEx++ 2120 | msglen |= int(b&0x7F) << shift 2121 | if b < 0x80 { 2122 | break 2123 | } 2124 | } 2125 | if msglen < 0 { 2126 | return ErrInvalidLengthHttp 2127 | } 2128 | postIndex := iNdEx + msglen 2129 | if postIndex < 0 { 2130 | return ErrInvalidLengthHttp 2131 | } 2132 | if postIndex > l { 2133 | return io.ErrUnexpectedEOF 2134 | } 2135 | m.AdditionalBindings = append(m.AdditionalBindings, &HttpRule{}) 2136 | if err := m.AdditionalBindings[len(m.AdditionalBindings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 2137 | return err 2138 | } 2139 | iNdEx = postIndex 2140 | case 12: 2141 | if wireType != 2 { 2142 | return fmt.Errorf("proto: wrong wireType = %d for field ResponseBody", wireType) 2143 | } 2144 | var stringLen uint64 2145 | for shift := uint(0); ; shift += 7 { 2146 | if shift >= 64 { 2147 | return ErrIntOverflowHttp 2148 | } 2149 | if iNdEx >= l { 2150 | return io.ErrUnexpectedEOF 2151 | } 2152 | b := dAtA[iNdEx] 2153 | iNdEx++ 2154 | stringLen |= uint64(b&0x7F) << shift 2155 | if b < 0x80 { 2156 | break 2157 | } 2158 | } 2159 | intStringLen := int(stringLen) 2160 | if intStringLen < 0 { 2161 | return ErrInvalidLengthHttp 2162 | } 2163 | postIndex := iNdEx + intStringLen 2164 | if postIndex < 0 { 2165 | return ErrInvalidLengthHttp 2166 | } 2167 | if postIndex > l { 2168 | return io.ErrUnexpectedEOF 2169 | } 2170 | m.ResponseBody = string(dAtA[iNdEx:postIndex]) 2171 | iNdEx = postIndex 2172 | default: 2173 | iNdEx = preIndex 2174 | skippy, err := skipHttp(dAtA[iNdEx:]) 2175 | if err != nil { 2176 | return err 2177 | } 2178 | if skippy < 0 { 2179 | return ErrInvalidLengthHttp 2180 | } 2181 | if (iNdEx + skippy) < 0 { 2182 | return ErrInvalidLengthHttp 2183 | } 2184 | if (iNdEx + skippy) > l { 2185 | return io.ErrUnexpectedEOF 2186 | } 2187 | m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 2188 | iNdEx += skippy 2189 | } 2190 | } 2191 | 2192 | if iNdEx > l { 2193 | return io.ErrUnexpectedEOF 2194 | } 2195 | return nil 2196 | } 2197 | func (m *CustomHttpPattern) Unmarshal(dAtA []byte) error { 2198 | l := len(dAtA) 2199 | iNdEx := 0 2200 | for iNdEx < l { 2201 | preIndex := iNdEx 2202 | var wire uint64 2203 | for shift := uint(0); ; shift += 7 { 2204 | if shift >= 64 { 2205 | return ErrIntOverflowHttp 2206 | } 2207 | if iNdEx >= l { 2208 | return io.ErrUnexpectedEOF 2209 | } 2210 | b := dAtA[iNdEx] 2211 | iNdEx++ 2212 | wire |= uint64(b&0x7F) << shift 2213 | if b < 0x80 { 2214 | break 2215 | } 2216 | } 2217 | fieldNum := int32(wire >> 3) 2218 | wireType := int(wire & 0x7) 2219 | if wireType == 4 { 2220 | return fmt.Errorf("proto: CustomHttpPattern: wiretype end group for non-group") 2221 | } 2222 | if fieldNum <= 0 { 2223 | return fmt.Errorf("proto: CustomHttpPattern: illegal tag %d (wire type %d)", fieldNum, wire) 2224 | } 2225 | switch fieldNum { 2226 | case 1: 2227 | if wireType != 2 { 2228 | return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) 2229 | } 2230 | var stringLen uint64 2231 | for shift := uint(0); ; shift += 7 { 2232 | if shift >= 64 { 2233 | return ErrIntOverflowHttp 2234 | } 2235 | if iNdEx >= l { 2236 | return io.ErrUnexpectedEOF 2237 | } 2238 | b := dAtA[iNdEx] 2239 | iNdEx++ 2240 | stringLen |= uint64(b&0x7F) << shift 2241 | if b < 0x80 { 2242 | break 2243 | } 2244 | } 2245 | intStringLen := int(stringLen) 2246 | if intStringLen < 0 { 2247 | return ErrInvalidLengthHttp 2248 | } 2249 | postIndex := iNdEx + intStringLen 2250 | if postIndex < 0 { 2251 | return ErrInvalidLengthHttp 2252 | } 2253 | if postIndex > l { 2254 | return io.ErrUnexpectedEOF 2255 | } 2256 | m.Kind = string(dAtA[iNdEx:postIndex]) 2257 | iNdEx = postIndex 2258 | case 2: 2259 | if wireType != 2 { 2260 | return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) 2261 | } 2262 | var stringLen uint64 2263 | for shift := uint(0); ; shift += 7 { 2264 | if shift >= 64 { 2265 | return ErrIntOverflowHttp 2266 | } 2267 | if iNdEx >= l { 2268 | return io.ErrUnexpectedEOF 2269 | } 2270 | b := dAtA[iNdEx] 2271 | iNdEx++ 2272 | stringLen |= uint64(b&0x7F) << shift 2273 | if b < 0x80 { 2274 | break 2275 | } 2276 | } 2277 | intStringLen := int(stringLen) 2278 | if intStringLen < 0 { 2279 | return ErrInvalidLengthHttp 2280 | } 2281 | postIndex := iNdEx + intStringLen 2282 | if postIndex < 0 { 2283 | return ErrInvalidLengthHttp 2284 | } 2285 | if postIndex > l { 2286 | return io.ErrUnexpectedEOF 2287 | } 2288 | m.Path = string(dAtA[iNdEx:postIndex]) 2289 | iNdEx = postIndex 2290 | default: 2291 | iNdEx = preIndex 2292 | skippy, err := skipHttp(dAtA[iNdEx:]) 2293 | if err != nil { 2294 | return err 2295 | } 2296 | if skippy < 0 { 2297 | return ErrInvalidLengthHttp 2298 | } 2299 | if (iNdEx + skippy) < 0 { 2300 | return ErrInvalidLengthHttp 2301 | } 2302 | if (iNdEx + skippy) > l { 2303 | return io.ErrUnexpectedEOF 2304 | } 2305 | m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 2306 | iNdEx += skippy 2307 | } 2308 | } 2309 | 2310 | if iNdEx > l { 2311 | return io.ErrUnexpectedEOF 2312 | } 2313 | return nil 2314 | } 2315 | func skipHttp(dAtA []byte) (n int, err error) { 2316 | l := len(dAtA) 2317 | iNdEx := 0 2318 | for iNdEx < l { 2319 | var wire uint64 2320 | for shift := uint(0); ; shift += 7 { 2321 | if shift >= 64 { 2322 | return 0, ErrIntOverflowHttp 2323 | } 2324 | if iNdEx >= l { 2325 | return 0, io.ErrUnexpectedEOF 2326 | } 2327 | b := dAtA[iNdEx] 2328 | iNdEx++ 2329 | wire |= (uint64(b) & 0x7F) << shift 2330 | if b < 0x80 { 2331 | break 2332 | } 2333 | } 2334 | wireType := int(wire & 0x7) 2335 | switch wireType { 2336 | case 0: 2337 | for shift := uint(0); ; shift += 7 { 2338 | if shift >= 64 { 2339 | return 0, ErrIntOverflowHttp 2340 | } 2341 | if iNdEx >= l { 2342 | return 0, io.ErrUnexpectedEOF 2343 | } 2344 | iNdEx++ 2345 | if dAtA[iNdEx-1] < 0x80 { 2346 | break 2347 | } 2348 | } 2349 | return iNdEx, nil 2350 | case 1: 2351 | iNdEx += 8 2352 | return iNdEx, nil 2353 | case 2: 2354 | var length int 2355 | for shift := uint(0); ; shift += 7 { 2356 | if shift >= 64 { 2357 | return 0, ErrIntOverflowHttp 2358 | } 2359 | if iNdEx >= l { 2360 | return 0, io.ErrUnexpectedEOF 2361 | } 2362 | b := dAtA[iNdEx] 2363 | iNdEx++ 2364 | length |= (int(b) & 0x7F) << shift 2365 | if b < 0x80 { 2366 | break 2367 | } 2368 | } 2369 | if length < 0 { 2370 | return 0, ErrInvalidLengthHttp 2371 | } 2372 | iNdEx += length 2373 | if iNdEx < 0 { 2374 | return 0, ErrInvalidLengthHttp 2375 | } 2376 | return iNdEx, nil 2377 | case 3: 2378 | for { 2379 | var innerWire uint64 2380 | var start int = iNdEx 2381 | for shift := uint(0); ; shift += 7 { 2382 | if shift >= 64 { 2383 | return 0, ErrIntOverflowHttp 2384 | } 2385 | if iNdEx >= l { 2386 | return 0, io.ErrUnexpectedEOF 2387 | } 2388 | b := dAtA[iNdEx] 2389 | iNdEx++ 2390 | innerWire |= (uint64(b) & 0x7F) << shift 2391 | if b < 0x80 { 2392 | break 2393 | } 2394 | } 2395 | innerWireType := int(innerWire & 0x7) 2396 | if innerWireType == 4 { 2397 | break 2398 | } 2399 | next, err := skipHttp(dAtA[start:]) 2400 | if err != nil { 2401 | return 0, err 2402 | } 2403 | iNdEx = start + next 2404 | if iNdEx < 0 { 2405 | return 0, ErrInvalidLengthHttp 2406 | } 2407 | } 2408 | return iNdEx, nil 2409 | case 4: 2410 | return iNdEx, nil 2411 | case 5: 2412 | iNdEx += 4 2413 | return iNdEx, nil 2414 | default: 2415 | return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 2416 | } 2417 | } 2418 | panic("unreachable") 2419 | } 2420 | 2421 | var ( 2422 | ErrInvalidLengthHttp = fmt.Errorf("proto: negative length found during unmarshaling") 2423 | ErrIntOverflowHttp = fmt.Errorf("proto: integer overflow") 2424 | ) 2425 | --------------------------------------------------------------------------------