diff --git a/app/presenters/v3/route_destination_presenter.rb b/app/presenters/v3/route_destination_presenter.rb index af72e3dfea1..b0b60137191 100644 --- a/app/presenters/v3/route_destination_presenter.rb +++ b/app/presenters/v3/route_destination_presenter.rb @@ -27,7 +27,9 @@ def destination_hash }, weight: destination.weight, port: destination.presented_port, - protocol: destination.protocol + protocol: destination.protocol, + created_at: destination.created_at, + updated_at: destination.updated_at } end diff --git a/docs/v3/source/includes/api_resources/_routes.erb b/docs/v3/source/includes/api_resources/_routes.erb index a1f664a76e5..459e605fbc3 100644 --- a/docs/v3/source/includes/api_resources/_routes.erb +++ b/docs/v3/source/includes/api_resources/_routes.erb @@ -19,7 +19,9 @@ }, "weight": null, "port": 8080, - "protocol": "tcp" + "protocol": "tcp", + "created_at": "2019-05-10T17:17:48Z", + "updated_at": "2019-05-10T17:17:48Z" }, { "guid": "27e96a3b-5bcf-49ed-8048-351e0be23e6f", @@ -31,7 +33,9 @@ }, "weight": null, "port": 8080, - "protocol": "tcp" + "protocol": "tcp", + "created_at": "2019-05-10T17:17:48Z", + "updated_at": "2019-05-10T17:17:48Z" } ], "options": { @@ -112,7 +116,9 @@ }, "weight": null, "port": 8080, - "protocol": "http1" + "protocol": "http1", + "created_at": "2019-05-10T17:17:48Z", + "updated_at": "2019-05-10T17:17:48Z" }, { "guid": "27e96a3b-5bcf-49ed-8048-351e0be23e6f", @@ -124,7 +130,9 @@ }, "weight": null, "port": 8080, - "protocol": "http1" + "protocol": "http1", + "created_at": "2019-05-10T17:17:48Z", + "updated_at": "2019-05-10T17:17:48Z" } ], "options": { @@ -178,7 +186,9 @@ }, "weight": null, "port": 8080, - "protocol": "http2" + "protocol": "http2", + "created_at": "2019-05-10T17:17:48Z", + "updated_at": "2019-05-10T17:17:48Z" }, { "guid": "fbef10a2-8ee7-11e9-aa2d-abeeaf7b83c5", @@ -190,7 +200,9 @@ }, "weight": null, "port": 9000, - "protocol": "http1" + "protocol": "http1", + "created_at": "2019-05-10T17:17:48Z", + "updated_at": "2019-05-10T17:17:48Z" } ], "links": { @@ -215,7 +227,9 @@ }, "weight": null, "port": 8080, - "protocol": "http2" + "protocol": "http2", + "created_at": "2019-05-10T17:17:48Z", + "updated_at": "2019-05-10T17:17:48Z" } <% end %> diff --git a/docs/v3/source/includes/resources/routes/_destination_object.md.erb b/docs/v3/source/includes/resources/routes/_destination_object.md.erb index aa0af55f815..17e1355bbeb 100644 --- a/docs/v3/source/includes/resources/routes/_destination_object.md.erb +++ b/docs/v3/source/includes/resources/routes/_destination_object.md.erb @@ -26,3 +26,5 @@ If a destination does not specify a port, the default port depends on the app li | **port** | _integer_ | Port on the destination process to route traffic to | **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._ | | **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_ | +| **created_at** | _[timestamp](#timestamps)_| The time with zone when the object was created | +| **updated_at** | _[timestamp](#timestamps)_| The time with zone when the object was last updated | diff --git a/spec/request/route_destinations_spec.rb b/spec/request/route_destinations_spec.rb index fa0245a3c99..668b91adeea 100644 --- a/spec/request/route_destinations_spec.rb +++ b/spec/request/route_destinations_spec.rb @@ -145,7 +145,9 @@ }, weight: nil, port: 8080, - protocol: 'http1' + protocol: 'http1', + created_at: destination.created_at.iso8601, + updated_at: destination.updated_at.iso8601 } ], links: { @@ -268,7 +270,9 @@ }, weight: nil, port: 8080, - protocol: 'http1' + protocol: 'http1', + created_at: existing_destination.created_at.iso8601, + updated_at: existing_destination.updated_at.iso8601 }, { guid: UUID_REGEX, @@ -280,7 +284,9 @@ }, weight: nil, port: 8080, - protocol: 'http2' + protocol: 'http2', + created_at: iso8601, + updated_at: iso8601 } ], links: { @@ -791,7 +797,9 @@ }, weight: nil, port: 8080, - protocol: 'http2' + protocol: 'http2', + created_at: iso8601, + updated_at: iso8601 } ], links: { diff --git a/spec/request/routes_spec.rb b/spec/request/routes_spec.rb index e7bac24ded4..2c2fe30cd84 100644 --- a/spec/request/routes_spec.rb +++ b/spec/request/routes_spec.rb @@ -64,7 +64,9 @@ }, weight: route_in_org_dest_web.weight, port: route_in_org_dest_web.presented_port, - protocol: 'http1' + protocol: 'http1', + created_at: iso8601, + updated_at: iso8601 }, { guid: route_in_org_dest_worker.guid, app: { @@ -75,7 +77,9 @@ }, weight: route_in_org_dest_worker.weight, port: route_in_org_dest_worker.presented_port, - protocol: 'http1' + protocol: 'http1', + created_at: iso8601, + updated_at: iso8601 }), relationships: { space: { @@ -3607,7 +3611,9 @@ }, weight: route_mapping1.weight, port: route_mapping1.presented_port, - protocol: 'http1' + protocol: 'http1', + created_at: iso8601, + updated_at: iso8601 }), relationships: { space: { @@ -3651,7 +3657,9 @@ }, weight: route_mapping2.weight, port: route_mapping2.presented_port, - protocol: 'http1' + protocol: 'http1', + created_at: iso8601, + updated_at: iso8601 }), relationships: { space: { diff --git a/spec/unit/presenters/v3/route_destination_presenter_spec.rb b/spec/unit/presenters/v3/route_destination_presenter_spec.rb index ed31ba2c53d..6484403fd4b 100644 --- a/spec/unit/presenters/v3/route_destination_presenter_spec.rb +++ b/spec/unit/presenters/v3/route_destination_presenter_spec.rb @@ -13,7 +13,8 @@ module VCAP::CloudController::Presenters::V3 app_port: 1234, route: route, process_type: 'web', - weight: 55 + weight: 55, + created_at: Time.at(1) ) end @@ -37,7 +38,9 @@ module VCAP::CloudController::Presenters::V3 route: { href: "http://api2.vcap.me/v3/routes/#{route.guid}" } - } + }, + created_at: Time.at(1), + updated_at: route_mapping.updated_at ) end end @@ -54,7 +57,9 @@ module VCAP::CloudController::Presenters::V3 }, weight: route_mapping.weight, port: route_mapping.presented_port, - protocol: route_mapping.protocol + protocol: route_mapping.protocol, + created_at: Time.at(1), + updated_at: route_mapping.updated_at ) end end diff --git a/spec/unit/presenters/v3/route_presenter_spec.rb b/spec/unit/presenters/v3/route_presenter_spec.rb index 423e07c6eb5..684b132e407 100644 --- a/spec/unit/presenters/v3/route_presenter_spec.rb +++ b/spec/unit/presenters/v3/route_presenter_spec.rb @@ -86,7 +86,9 @@ module VCAP::CloudController::Presenters::V3 }, weight: destination.weight, port: destination.presented_port, - protocol: destination.protocol + protocol: destination.protocol, + created_at: destination.created_at, + updated_at: destination.updated_at }, { guid: destination2.guid, @@ -98,7 +100,9 @@ module VCAP::CloudController::Presenters::V3 }, weight: destination2.weight, port: destination2.presented_port, - protocol: destination2.protocol + protocol: destination2.protocol, + created_at: destination.created_at, + updated_at: destination.updated_at } ] expect(subject[:destinations]).to match_array(expected_destinations)