You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2017/05/05 17:05:15 UTC

[1/2] incubator-trafficcontrol git commit: adds back GET api/1.1/asns. the only truly 1.1 api :)

Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/master 63f6abf26 -> b74661ba4


adds back GET api/1.1/asns. the only truly 1.1 api :)


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/cebc5ede
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/cebc5ede
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/cebc5ede

Branch: refs/heads/master
Commit: cebc5ede307ea2844eae02b1f8318c921f9dc74c
Parents: 63f6abf
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Fri May 5 09:53:01 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Fri May 5 11:02:42 2017 -0600

----------------------------------------------------------------------
 traffic_ops/app/lib/API/Asn.pm          | 18 ++++++++++++++++++
 traffic_ops/app/lib/TrafficOpsRoutes.pm |  6 ++++++
 2 files changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/cebc5ede/traffic_ops/app/lib/API/Asn.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Asn.pm b/traffic_ops/app/lib/API/Asn.pm
index a271a96..0978abf 100644
--- a/traffic_ops/app/lib/API/Asn.pm
+++ b/traffic_ops/app/lib/API/Asn.pm
@@ -49,6 +49,24 @@ sub index {
 	$self->success( \@data );
 }
 
+sub index_v11 {
+	my $self = shift;
+	my @data;
+	my $orderby = $self->param('orderby') || "asn";
+	my $rs_data = $self->db->resultset("Asn")->search( undef, { prefetch => [ { 'cachegroup' => undef } ], order_by => "me." . $orderby } );
+	while ( my $row = $rs_data->next ) {
+		push(
+			@data, {
+				"id"          => $row->id,
+				"asn"         => $row->asn,
+				"cachegroup"  => $row->cachegroup->name,
+				"lastUpdated" => $row->last_updated,
+			}
+		);
+	}
+	$self->success( { "asns" => \@data } );
+}
+
 # Show
 sub show {
 	my $self = shift;

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/cebc5ede/traffic_ops/app/lib/TrafficOpsRoutes.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/TrafficOpsRoutes.pm b/traffic_ops/app/lib/TrafficOpsRoutes.pm
index 483de16..09322b7 100644
--- a/traffic_ops/app/lib/TrafficOpsRoutes.pm
+++ b/traffic_ops/app/lib/TrafficOpsRoutes.pm
@@ -376,6 +376,12 @@ sub api_routes {
 	my $version   = shift;
 	my $namespace = shift;
 
+	# -- 1.1 API ROUTES
+
+	$r->get("/api/1.1/asns")->over( authenticated => 1 )->to( 'Asn#index_v11', namespace => $namespace );
+
+	# -- 1.1 or 1.2 API ROUTES
+
 	# -- ASNS (CRANS)
 	$r->get("/api/$version/asns")->over( authenticated => 1 )->to( 'Asn#index',     namespace => $namespace );
 	$r->get("/api/$version/asns/:id" => [ id => qr/\d+/ ] )->over( authenticated => 1 )->to( 'Asn#show', namespace => $namespace );


[2/2] incubator-trafficcontrol git commit: This closes #548.

Posted by da...@apache.org.
This closes #548.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/b74661ba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/b74661ba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/b74661ba

Branch: refs/heads/master
Commit: b74661ba4b5d82778d9278505feca83581396532
Parents: cebc5ed
Author: Dan Kirkwood <da...@gmail.com>
Authored: Fri May 5 11:04:01 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Fri May 5 11:04:01 2017 -0600

----------------------------------------------------------------------

----------------------------------------------------------------------