Skip to content

Commit d01d7b2

Browse files
committed
Add "created_at" and "updated_at" to route mappings
1 parent 3635a6b commit d01d7b2

File tree

4 files changed

+34
-11
lines changed

4 files changed

+34
-11
lines changed

app/presenters/v3/route_destination_presenter.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ def destination_hash
2727
},
2828
weight: destination.weight,
2929
port: destination.presented_port,
30-
protocol: destination.protocol
30+
protocol: destination.protocol,
31+
created_at: destination.created_at,
32+
updated_at: destination.updated_at
3133
}
3234
end
3335

docs/v3/source/includes/api_resources/_routes.erb

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
},
2020
"weight": null,
2121
"port": 8080,
22-
"protocol": "tcp"
22+
"protocol": "tcp",
23+
"created_at": "2019-05-10T17:17:48Z",
24+
"updated_at": "2019-05-10T17:17:48Z"
2325
},
2426
{
2527
"guid": "27e96a3b-5bcf-49ed-8048-351e0be23e6f",
@@ -31,7 +33,9 @@
3133
},
3234
"weight": null,
3335
"port": 8080,
34-
"protocol": "tcp"
36+
"protocol": "tcp",
37+
"created_at": "2019-05-10T17:17:48Z",
38+
"updated_at": "2019-05-10T17:17:48Z"
3539
}
3640
],
3741
"options": {
@@ -112,7 +116,9 @@
112116
},
113117
"weight": null,
114118
"port": 8080,
115-
"protocol": "http1"
119+
"protocol": "http1",
120+
"created_at": "2019-05-10T17:17:48Z",
121+
"updated_at": "2019-05-10T17:17:48Z"
116122
},
117123
{
118124
"guid": "27e96a3b-5bcf-49ed-8048-351e0be23e6f",
@@ -124,7 +130,9 @@
124130
},
125131
"weight": null,
126132
"port": 8080,
127-
"protocol": "http1"
133+
"protocol": "http1",
134+
"created_at": "2019-05-10T17:17:48Z",
135+
"updated_at": "2019-05-10T17:17:48Z"
128136
}
129137
],
130138
"options": {
@@ -178,7 +186,9 @@
178186
},
179187
"weight": null,
180188
"port": 8080,
181-
"protocol": "http2"
189+
"protocol": "http2",
190+
"created_at": "2019-05-10T17:17:48Z",
191+
"updated_at": "2019-05-10T17:17:48Z"
182192
},
183193
{
184194
"guid": "fbef10a2-8ee7-11e9-aa2d-abeeaf7b83c5",
@@ -190,7 +200,9 @@
190200
},
191201
"weight": null,
192202
"port": 9000,
193-
"protocol": "http1"
203+
"protocol": "http1",
204+
"created_at": "2019-05-10T17:17:48Z",
205+
"updated_at": "2019-05-10T17:17:48Z"
194206
}
195207
],
196208
"links": {
@@ -215,7 +227,9 @@
215227
},
216228
"weight": null,
217229
"port": 8080,
218-
"protocol": "http2"
230+
"protocol": "http2",
231+
"created_at": "2019-05-10T17:17:48Z",
232+
"updated_at": "2019-05-10T17:17:48Z"
219233
}
220234
<% end %>
221235

docs/v3/source/includes/resources/routes/_destination_object.md.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ If a destination does not specify a port, the default port depends on the app li
2626
| **port** | _integer_ | Port on the destination process to route traffic to
2727
| **weight** (*deprecated*) | _integer_ or `null` | Percentage of traffic which will be routed to this destination. _**DEPRECATED:** this feature was only available via the experimental Service Mesh routing plane. It is no longer supported._ |
2828
| **protocol** | _string_ or `null` | Protocol to use for this destination. Valid protocols are `http1` or `http2` if route protocol is `http`, `tcp` if route protocol is `tcp`. A `null` value will set it either `http1` or `tcp` based on the route protocol; _this feature is only available if you turn it on in routing release_ |
29+
| **created_at** | _[timestamp](#timestamps)_| The time with zone when the object was created |
30+
| **updated_at** | _[timestamp](#timestamps)_| The time with zone when the object was last updated |

spec/unit/presenters/v3/route_destination_presenter_spec.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ module VCAP::CloudController::Presenters::V3
1313
app_port: 1234,
1414
route: route,
1515
process_type: 'web',
16-
weight: 55
16+
weight: 55,
17+
created_at: Time.at(1)
1718
)
1819
end
1920

@@ -37,7 +38,9 @@ module VCAP::CloudController::Presenters::V3
3738
route: {
3839
href: "http://api2.vcap.me/v3/routes/#{route.guid}"
3940
}
40-
}
41+
},
42+
created_at: Time.at(1),
43+
updated_at: route_mapping.updated_at
4144
)
4245
end
4346
end
@@ -54,7 +57,9 @@ module VCAP::CloudController::Presenters::V3
5457
},
5558
weight: route_mapping.weight,
5659
port: route_mapping.presented_port,
57-
protocol: route_mapping.protocol
60+
protocol: route_mapping.protocol,
61+
created_at: Time.at(1),
62+
updated_at: route_mapping.updated_at
5863
)
5964
end
6065
end

0 commit comments

Comments
 (0)