1 // Code generated by protoc-gen-go. DO NOT EDIT.
2 // source: google/api/http.proto
6 import proto "github.com/golang/protobuf/proto"
10 // Reference imports to suppress errors if they are not otherwise used.
15 // Defines the HTTP configuration for a service. It contains a list of
16 // [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
17 // to one or more HTTP REST API methods.
19 // A list of HTTP configuration rules that apply to individual API methods.
21 // **NOTE:** All service configuration rules follow "last one wins" order.
22 Rules []*HttpRule `protobuf:"bytes,1,rep,name=rules" json:"rules,omitempty"`
25 func (m *Http) Reset() { *m = Http{} }
26 func (m *Http) String() string { return proto.CompactTextString(m) }
27 func (*Http) ProtoMessage() {}
28 func (*Http) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
30 func (m *Http) GetRules() []*HttpRule {
37 // `HttpRule` defines the mapping of an RPC method to one or more HTTP
38 // REST APIs. The mapping determines what portions of the request
39 // message are populated from the path, query parameters, or body of
40 // the HTTP request. The mapping is typically specified as an
41 // `google.api.http` annotation, see "google/api/annotations.proto"
44 // The mapping consists of a field specifying the path template and
45 // method kind. The path template can refer to fields in the request
46 // message, as in the example below which describes a REST GET
47 // operation on a resource collection of messages:
50 // service Messaging {
51 // rpc GetMessage(GetMessageRequest) returns (Message) {
52 // option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}";
55 // message GetMessageRequest {
56 // message SubMessage {
57 // string subfield = 1;
59 // string message_id = 1; // mapped to the URL
60 // SubMessage sub = 2; // `sub.subfield` is url-mapped
63 // string text = 1; // content of the resource
66 // The same http annotation can alternatively be expressed inside the
67 // `GRPC API Configuration` YAML file.
71 // - selector: <proto_package_name>.Messaging.GetMessage
72 // get: /v1/messages/{message_id}/{sub.subfield}
74 // This definition enables an automatic, bidrectional mapping of HTTP
75 // JSON to RPC. Example:
79 // `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))`
81 // In general, not only fields but also field paths can be referenced
82 // from a path pattern. Fields mapped to the path pattern cannot be
83 // repeated and must have a primitive (non-message) type.
85 // Any fields in the request message which are not bound by the path
86 // pattern automatically become (optional) HTTP query
87 // parameters. Assume the following definition of the request message:
90 // message GetMessageRequest {
91 // message SubMessage {
92 // string subfield = 1;
94 // string message_id = 1; // mapped to the URL
95 // int64 revision = 2; // becomes a parameter
96 // SubMessage sub = 3; // `sub.subfield` becomes a parameter
100 // This enables a HTTP JSON to RPC mapping as below:
104 // `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`
106 // Note that fields which are mapped to HTTP parameters must have a
107 // primitive type or a repeated primitive type. Message types are not
108 // allowed. In the case of a repeated type, the parameter can be
109 // repeated in the URL, as in `...?param=A¶m=B`.
111 // For HTTP method kinds which allow a request body, the `body` field
112 // specifies the mapping. Consider a REST update method on the
113 // message resource collection:
116 // service Messaging {
117 // rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
118 // option (google.api.http) = {
119 // put: "/v1/messages/{message_id}"
124 // message UpdateMessageRequest {
125 // string message_id = 1; // mapped to the URL
126 // Message message = 2; // mapped to the body
130 // The following HTTP JSON to RPC mapping is enabled, where the
131 // representation of the JSON in the request body is determined by
132 // protos JSON encoding:
136 // `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
138 // The special name `*` can be used in the body mapping to define that
139 // every field not bound by the path template should be mapped to the
140 // request body. This enables the following alternative definition of
141 // the update method:
143 // service Messaging {
144 // rpc UpdateMessage(Message) returns (Message) {
145 // option (google.api.http) = {
146 // put: "/v1/messages/{message_id}"
152 // string message_id = 1;
157 // The following HTTP JSON to RPC mapping is enabled:
161 // `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")`
163 // Note that when using `*` in the body mapping, it is not possible to
164 // have HTTP parameters, as all fields not bound by the path end in
165 // the body. This makes this option more rarely used in practice of
166 // defining REST APIs. The common usage of `*` is in custom methods
167 // which don't use the URL at all for transferring data.
169 // It is possible to define multiple HTTP methods for one RPC by using
170 // the `additional_bindings` option. Example:
172 // service Messaging {
173 // rpc GetMessage(GetMessageRequest) returns (Message) {
174 // option (google.api.http) = {
175 // get: "/v1/messages/{message_id}"
176 // additional_bindings {
177 // get: "/v1/users/{user_id}/messages/{message_id}"
182 // message GetMessageRequest {
183 // string message_id = 1;
184 // string user_id = 2;
188 // This enables the following two alternative HTTP JSON to RPC
193 // `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
194 // `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")`
196 // # Rules for HTTP mapping
198 // The rules for mapping HTTP path, query parameters, and body fields
199 // to the request message are as follows:
201 // 1. The `body` field specifies either `*` or a field path, or is
202 // omitted. If omitted, it assumes there is no HTTP body.
203 // 2. Leaf fields (recursive expansion of nested messages in the
204 // request) can be classified into three types:
205 // (a) Matched in the URL template.
206 // (b) Covered by body (if body is `*`, everything except (a) fields;
207 // else everything under the body field)
208 // (c) All other fields.
209 // 3. URL query parameters found in the HTTP request are mapped to (c) fields.
210 // 4. Any body sent with an HTTP request can contain only (b) fields.
212 // The syntax of the path template is as follows:
214 // Template = "/" Segments [ Verb ] ;
215 // Segments = Segment { "/" Segment } ;
216 // Segment = "*" | "**" | LITERAL | Variable ;
217 // Variable = "{" FieldPath [ "=" Segments ] "}" ;
218 // FieldPath = IDENT { "." IDENT } ;
219 // Verb = ":" LITERAL ;
221 // The syntax `*` matches a single path segment. It follows the semantics of
222 // [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
225 // The syntax `**` matches zero or more path segments. It follows the semantics
226 // of [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.3 Reserved
227 // Expansion. NOTE: it must be the last segment in the path except the Verb.
229 // The syntax `LITERAL` matches literal text in the URL path.
231 // The syntax `Variable` matches the entire path as specified by its template;
232 // this nested template must not contain further variables. If a variable
233 // matches a single path segment, its template may be omitted, e.g. `{var}`
234 // is equivalent to `{var=*}`.
236 // NOTE: the field paths in variables and in the `body` must not refer to
237 // repeated fields or map fields.
239 // Use CustomHttpPattern to specify any HTTP method that is not included in the
240 // `pattern` field, such as HEAD, or "*" to leave the HTTP method unspecified for
241 // a given URL path rule. The wild-card rule is useful for services that provide
242 // content to Web (HTML) clients.
243 type HttpRule struct {
244 // Selects methods to which this rule applies.
246 // Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
247 Selector string `protobuf:"bytes,1,opt,name=selector" json:"selector,omitempty"`
248 // Determines the URL pattern is matched by this rules. This pattern can be
249 // used with any of the {get|put|post|delete|patch} methods. A custom method
250 // can be defined using the 'custom' field.
252 // Types that are valid to be assigned to Pattern:
259 Pattern isHttpRule_Pattern `protobuf_oneof:"pattern"`
260 // The name of the request field whose value is mapped to the HTTP body, or
261 // `*` for mapping all fields not captured by the path pattern to the HTTP
262 // body. NOTE: the referred field must not be a repeated field and must be
263 // present at the top-level of request message type.
264 Body string `protobuf:"bytes,7,opt,name=body" json:"body,omitempty"`
265 // Additional HTTP bindings for the selector. Nested bindings must
266 // not contain an `additional_bindings` field themselves (that is,
267 // the nesting may only be one level deep).
268 AdditionalBindings []*HttpRule `protobuf:"bytes,11,rep,name=additional_bindings,json=additionalBindings" json:"additional_bindings,omitempty"`
271 func (m *HttpRule) Reset() { *m = HttpRule{} }
272 func (m *HttpRule) String() string { return proto.CompactTextString(m) }
273 func (*HttpRule) ProtoMessage() {}
274 func (*HttpRule) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} }
276 type isHttpRule_Pattern interface {
280 type HttpRule_Get struct {
281 Get string `protobuf:"bytes,2,opt,name=get,oneof"`
283 type HttpRule_Put struct {
284 Put string `protobuf:"bytes,3,opt,name=put,oneof"`
286 type HttpRule_Post struct {
287 Post string `protobuf:"bytes,4,opt,name=post,oneof"`
289 type HttpRule_Delete struct {
290 Delete string `protobuf:"bytes,5,opt,name=delete,oneof"`
292 type HttpRule_Patch struct {
293 Patch string `protobuf:"bytes,6,opt,name=patch,oneof"`
295 type HttpRule_Custom struct {
296 Custom *CustomHttpPattern `protobuf:"bytes,8,opt,name=custom,oneof"`
299 func (*HttpRule_Get) isHttpRule_Pattern() {}
300 func (*HttpRule_Put) isHttpRule_Pattern() {}
301 func (*HttpRule_Post) isHttpRule_Pattern() {}
302 func (*HttpRule_Delete) isHttpRule_Pattern() {}
303 func (*HttpRule_Patch) isHttpRule_Pattern() {}
304 func (*HttpRule_Custom) isHttpRule_Pattern() {}
306 func (m *HttpRule) GetPattern() isHttpRule_Pattern {
313 func (m *HttpRule) GetSelector() string {
320 func (m *HttpRule) GetGet() string {
321 if x, ok := m.GetPattern().(*HttpRule_Get); ok {
327 func (m *HttpRule) GetPut() string {
328 if x, ok := m.GetPattern().(*HttpRule_Put); ok {
334 func (m *HttpRule) GetPost() string {
335 if x, ok := m.GetPattern().(*HttpRule_Post); ok {
341 func (m *HttpRule) GetDelete() string {
342 if x, ok := m.GetPattern().(*HttpRule_Delete); ok {
348 func (m *HttpRule) GetPatch() string {
349 if x, ok := m.GetPattern().(*HttpRule_Patch); ok {
355 func (m *HttpRule) GetCustom() *CustomHttpPattern {
356 if x, ok := m.GetPattern().(*HttpRule_Custom); ok {
362 func (m *HttpRule) GetBody() string {
369 func (m *HttpRule) GetAdditionalBindings() []*HttpRule {
371 return m.AdditionalBindings
376 // XXX_OneofFuncs is for the internal use of the proto package.
377 func (*HttpRule) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
378 return _HttpRule_OneofMarshaler, _HttpRule_OneofUnmarshaler, _HttpRule_OneofSizer, []interface{}{
379 (*HttpRule_Get)(nil),
380 (*HttpRule_Put)(nil),
381 (*HttpRule_Post)(nil),
382 (*HttpRule_Delete)(nil),
383 (*HttpRule_Patch)(nil),
384 (*HttpRule_Custom)(nil),
388 func _HttpRule_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
391 switch x := m.Pattern.(type) {
393 b.EncodeVarint(2<<3 | proto.WireBytes)
394 b.EncodeStringBytes(x.Get)
396 b.EncodeVarint(3<<3 | proto.WireBytes)
397 b.EncodeStringBytes(x.Put)
399 b.EncodeVarint(4<<3 | proto.WireBytes)
400 b.EncodeStringBytes(x.Post)
401 case *HttpRule_Delete:
402 b.EncodeVarint(5<<3 | proto.WireBytes)
403 b.EncodeStringBytes(x.Delete)
404 case *HttpRule_Patch:
405 b.EncodeVarint(6<<3 | proto.WireBytes)
406 b.EncodeStringBytes(x.Patch)
407 case *HttpRule_Custom:
408 b.EncodeVarint(8<<3 | proto.WireBytes)
409 if err := b.EncodeMessage(x.Custom); err != nil {
414 return fmt.Errorf("HttpRule.Pattern has unexpected type %T", x)
419 func _HttpRule_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
422 case 2: // pattern.get
423 if wire != proto.WireBytes {
424 return true, proto.ErrInternalBadWireType
426 x, err := b.DecodeStringBytes()
427 m.Pattern = &HttpRule_Get{x}
429 case 3: // pattern.put
430 if wire != proto.WireBytes {
431 return true, proto.ErrInternalBadWireType
433 x, err := b.DecodeStringBytes()
434 m.Pattern = &HttpRule_Put{x}
436 case 4: // pattern.post
437 if wire != proto.WireBytes {
438 return true, proto.ErrInternalBadWireType
440 x, err := b.DecodeStringBytes()
441 m.Pattern = &HttpRule_Post{x}
443 case 5: // pattern.delete
444 if wire != proto.WireBytes {
445 return true, proto.ErrInternalBadWireType
447 x, err := b.DecodeStringBytes()
448 m.Pattern = &HttpRule_Delete{x}
450 case 6: // pattern.patch
451 if wire != proto.WireBytes {
452 return true, proto.ErrInternalBadWireType
454 x, err := b.DecodeStringBytes()
455 m.Pattern = &HttpRule_Patch{x}
457 case 8: // pattern.custom
458 if wire != proto.WireBytes {
459 return true, proto.ErrInternalBadWireType
461 msg := new(CustomHttpPattern)
462 err := b.DecodeMessage(msg)
463 m.Pattern = &HttpRule_Custom{msg}
470 func _HttpRule_OneofSizer(msg proto.Message) (n int) {
473 switch x := m.Pattern.(type) {
475 n += proto.SizeVarint(2<<3 | proto.WireBytes)
476 n += proto.SizeVarint(uint64(len(x.Get)))
479 n += proto.SizeVarint(3<<3 | proto.WireBytes)
480 n += proto.SizeVarint(uint64(len(x.Put)))
483 n += proto.SizeVarint(4<<3 | proto.WireBytes)
484 n += proto.SizeVarint(uint64(len(x.Post)))
486 case *HttpRule_Delete:
487 n += proto.SizeVarint(5<<3 | proto.WireBytes)
488 n += proto.SizeVarint(uint64(len(x.Delete)))
490 case *HttpRule_Patch:
491 n += proto.SizeVarint(6<<3 | proto.WireBytes)
492 n += proto.SizeVarint(uint64(len(x.Patch)))
494 case *HttpRule_Custom:
495 s := proto.Size(x.Custom)
496 n += proto.SizeVarint(8<<3 | proto.WireBytes)
497 n += proto.SizeVarint(uint64(s))
501 panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
506 // A custom pattern is used for defining custom HTTP verb.
507 type CustomHttpPattern struct {
508 // The name of this custom HTTP verb.
509 Kind string `protobuf:"bytes,1,opt,name=kind" json:"kind,omitempty"`
510 // The path matched by this custom verb.
511 Path string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"`
514 func (m *CustomHttpPattern) Reset() { *m = CustomHttpPattern{} }
515 func (m *CustomHttpPattern) String() string { return proto.CompactTextString(m) }
516 func (*CustomHttpPattern) ProtoMessage() {}
517 func (*CustomHttpPattern) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} }
519 func (m *CustomHttpPattern) GetKind() string {
526 func (m *CustomHttpPattern) GetPath() string {
534 proto.RegisterType((*Http)(nil), "google.api.Http")
535 proto.RegisterType((*HttpRule)(nil), "google.api.HttpRule")
536 proto.RegisterType((*CustomHttpPattern)(nil), "google.api.CustomHttpPattern")
539 func init() { proto.RegisterFile("google/api/http.proto", fileDescriptor1) }
541 var fileDescriptor1 = []byte{
542 // 359 bytes of a gzipped FileDescriptorProto
543 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xcf, 0x6a, 0xe3, 0x30,
544 0x10, 0xc6, 0xd7, 0x89, 0xe3, 0x24, 0x13, 0x58, 0x58, 0x6d, 0x76, 0x11, 0x85, 0x42, 0xc8, 0x29,
545 0xf4, 0x60, 0x43, 0x7a, 0xe8, 0x21, 0xa7, 0xb8, 0x94, 0xa6, 0xb7, 0xe0, 0x63, 0x2f, 0x45, 0xb1,
546 0x85, 0xa2, 0xd6, 0x91, 0x84, 0x3d, 0x3e, 0xf4, 0x75, 0xfa, 0x0e, 0x7d, 0xb7, 0x1e, 0x8b, 0xfe,
547 0xa4, 0x09, 0x14, 0x7a, 0x9b, 0xef, 0x37, 0x9f, 0x34, 0xa3, 0x19, 0xc1, 0x3f, 0xa1, 0xb5, 0xa8,
548 0x79, 0xc6, 0x8c, 0xcc, 0xf6, 0x88, 0x26, 0x35, 0x8d, 0x46, 0x4d, 0xc0, 0xe3, 0x94, 0x19, 0x39,
549 0x5f, 0x42, 0xbc, 0x41, 0x34, 0xe4, 0x0a, 0x06, 0x4d, 0x57, 0xf3, 0x96, 0x46, 0xb3, 0xfe, 0x62,
550 0xb2, 0x9c, 0xa6, 0x27, 0x4f, 0x6a, 0x0d, 0x45, 0x57, 0xf3, 0xc2, 0x5b, 0xe6, 0xef, 0x3d, 0x18,
551 0x1d, 0x19, 0xb9, 0x80, 0x51, 0xcb, 0x6b, 0x5e, 0xa2, 0x6e, 0x68, 0x34, 0x8b, 0x16, 0xe3, 0xe2,
552 0x4b, 0x13, 0x02, 0x7d, 0xc1, 0x91, 0xf6, 0x2c, 0xde, 0xfc, 0x2a, 0xac, 0xb0, 0xcc, 0x74, 0x48,
553 0xfb, 0x47, 0x66, 0x3a, 0x24, 0x53, 0x88, 0x8d, 0x6e, 0x91, 0xc6, 0x01, 0x3a, 0x45, 0x28, 0x24,
554 0x15, 0xaf, 0x39, 0x72, 0x3a, 0x08, 0x3c, 0x68, 0xf2, 0x1f, 0x06, 0x86, 0x61, 0xb9, 0xa7, 0x49,
555 0x48, 0x78, 0x49, 0x6e, 0x20, 0x29, 0xbb, 0x16, 0xf5, 0x81, 0x8e, 0x66, 0xd1, 0x62, 0xb2, 0xbc,
556 0x3c, 0x7f, 0xc5, 0xad, 0xcb, 0xd8, 0xbe, 0xb7, 0x0c, 0x91, 0x37, 0xca, 0x5e, 0xe8, 0xed, 0x84,
557 0x40, 0xbc, 0xd3, 0xd5, 0x2b, 0x1d, 0xba, 0x07, 0xb8, 0x98, 0xdc, 0xc1, 0x5f, 0x56, 0x55, 0x12,
558 0xa5, 0x56, 0xac, 0x7e, 0xda, 0x49, 0x55, 0x49, 0x25, 0x5a, 0x3a, 0xf9, 0x61, 0x3e, 0xe4, 0x74,
559 0x20, 0x0f, 0xfe, 0x7c, 0x0c, 0x43, 0xe3, 0xeb, 0xcd, 0x57, 0xf0, 0xe7, 0x5b, 0x13, 0xb6, 0xf4,
560 0x8b, 0x54, 0x55, 0x98, 0x9d, 0x8b, 0x2d, 0x33, 0x0c, 0xf7, 0x7e, 0x70, 0x85, 0x8b, 0xf3, 0x67,
561 0xf8, 0x5d, 0xea, 0xc3, 0x59, 0xd9, 0x7c, 0xec, 0xae, 0xb1, 0x1b, 0xdd, 0x46, 0x8f, 0xeb, 0x90,
562 0x10, 0xba, 0x66, 0x4a, 0xa4, 0xba, 0x11, 0x99, 0xe0, 0xca, 0xed, 0x3b, 0xf3, 0x29, 0x66, 0x64,
563 0xeb, 0x7e, 0x02, 0x53, 0x4a, 0x23, 0xb3, 0x6d, 0xb6, 0xab, 0xb3, 0xf8, 0x23, 0x8a, 0xde, 0x7a,
564 0xf1, 0xfd, 0x7a, 0xfb, 0xb0, 0x4b, 0xdc, 0xb9, 0xeb, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x68,
565 0x15, 0x60, 0x5b, 0x40, 0x02, 0x00, 0x00,