blob: 3d9cf2c1f701aa18bbfdfca11f261adbd05c39cb [file] [log] [blame]
Khen Nursimuluaaac7ee2016-12-11 22:03:52 -05001
2module ietf-http {
3
4
5 namespace "urn:opencord:params:xml:ns:voltha:ietf-http";
6 prefix http;
7
8
9 organization "CORD";
10 contact
11 " Any name";
12
13 description
14 "";
15
16 revision "2016-11-15" {
17 description "Initial revision.";
18 reference "reference";
19 }
20
21
22 grouping HttpRule {
23 description
24 "`HttpRule` defines the mapping of an RPC method to one or more HTTP REST API
25 methods. The mapping determines what portions of the request message are
26 populated from the path, query parameters, or body of the HTTP request. The
27 mapping is typically specified as an `google.api.http` annotation, see
28 google api annotations.proto for details.
29
30 The mapping consists of a mandatory field specifying a path template and an
31 optional `body` field specifying what data is represented in the HTTP request
32 body. The field name for the path indicates the HTTP method. Example:
33
34 ```
35 package google.storage.v2;
36
37 import google api annotations.proto ;
38
39 service Storage
40 rpc CreateObject(CreateObjectRequest) returns (Object)
41 option (google.api.http)
42 post: v2 bucket_name=buckets objects
43 body: object
44 ;
45 ;
46
47 ```
48
49 Here `bucket_name` and `object` bind to fields of the request message
50 `CreateObjectRequest`.
51
52 The rules for mapping HTTP path, query parameters, and body fields
53 to the request message are as follows:
54
55 1. The `body` field specifies either ` ` or a field path, or is
56 omitted. If omitted, it assumes there is no HTTP body.
57 2. Leaf fields (recursive expansion of nested messages in the
58 request) can be classified into three types:
59 (a) Matched in the URL template.
60 (b) Covered by body (if body is ` `, everything except (a) fields;
61 else everything under the body field)
62 (c) All other fields.
63 3. URL query parameters found in the HTTP request are mapped to (c) fields.
64 4. Any body sent with an HTTP request can contain only (b) fields.
65
66 The syntax of the path template is as follows:
67
68 Template = Segments Verb ;
69 Segments = Segment Segment ;
70 Segment = | | LITERAL | Variable ;
71 Variable = FieldPath = Segments ;
72 FieldPath = IDENT . IDENT ;
73 Verb = : LITERAL ;
74
75 ` ` matches a single path component, ` ` zero or more path components, and
76 `LITERAL` a constant. A `Variable` can match an entire path as specified
77 again by a template; this nested template must not contain further variables.
78 If no template is given with a variable, it matches a single path component.
79 The notation ` var ` is henceforth equivalent to ` var= `.
80
81 Use CustomHttpPattern to specify any HTTP method that is not included in the
82 pattern field, such as HEAD, or to leave the HTTP method unspecified for
83 a given URL path rule. The wild-card rule is useful for services that provide
84 content to Web (HTML) clients.";
85 leaf get {
86 type string;
87 description
88 "Used for listing and getting information about resources.";
89 }
90
91 leaf put {
92 type string;
93 description
94 "Used for updating a resource.";
95 }
96
97 leaf post {
98 type string;
99 description
100 "Used for creating a resource.";
101 }
102
103 leaf delete {
104 type string;
105 description
106 "Used for deleting a resource.";
107 }
108
109 leaf patch {
110 type string;
111 description
112 "Used for updating a resource.";
113 }
114
115 container custom {
116 uses CustomHttpPattern;
117
118 description
119 "Custom pattern is used for defining custom verbs.";
120 }
121
122 leaf body {
123 type string;
124 description
125 "The name of the request field whose value is mapped to the HTTP body, or
126 ` ` for mapping all fields not captured by the path pattern to the HTTP
127 body.";
128 }
129
130 list additional_bindings {
131 key "get";
132 uses HttpRule;
133
134 description
135 "Additional HTTP bindings for the selector. Nested bindings must not
136 specify a selector and must not contain additional bindings.";
137 }
138
139 }
140
141 grouping CustomHttpPattern {
142 description
143 "A custom pattern is used for defining custom HTTP verb.";
144 leaf kind {
145 type string;
146 description
147 "The name of this custom HTTP verb.";
148 }
149
150 leaf path {
151 type string;
152 description
153 "The path matched by this custom verb.";
154 }
155
156 }
157
158}