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/01/03 19:28:11 UTC
[01/13] incubator-trafficcontrol git commit: provides the ability to
filter delivery services by cdn
Repository: incubator-trafficcontrol
Updated Branches:
refs/heads/master 81bfb561d -> 58fe1dbda
provides the ability to filter delivery services by cdn
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/6fc161ee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/6fc161ee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/6fc161ee
Branch: refs/heads/master
Commit: 6fc161eedbf23df1eee1323bd4dd6979eac906c8
Parents: f0564a9
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Thu Dec 29 09:30:21 2016 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Thu Dec 29 09:30:21 2016 -0700
----------------------------------------------------------------------
.../development/traffic_ops_api/v12/deliveryservice.rst | 9 +++++++++
traffic_ops/app/lib/API/Deliveryservice.pm | 4 ++++
2 files changed, 13 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/6fc161ee/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
----------------------------------------------------------------------
diff --git a/docs/source/development/traffic_ops_api/v12/deliveryservice.rst b/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
index 9d86ffd..75c26dd 100644
--- a/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
+++ b/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
@@ -32,6 +32,15 @@ Delivery Service
Role(s) Required: None
+ **Request Query Parameters**
+
+ +-----------------+----------+---------------------------------------------------+
+ | Name | Required | Description |
+ +=================+==========+===================================================+
+ | ``cdn`` | no | Filter delivery services by CDN ID. |
+ +-----------------+----------+---------------------------------------------------+
+
+
**Response Properties**
+--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/6fc161ee/traffic_ops/app/lib/API/Deliveryservice.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Deliveryservice.pm b/traffic_ops/app/lib/API/Deliveryservice.pm
index 27ee53c..69d14b8 100644
--- a/traffic_ops/app/lib/API/Deliveryservice.pm
+++ b/traffic_ops/app/lib/API/Deliveryservice.pm
@@ -32,11 +32,15 @@ use Validate::Tiny ':all';
sub index {
my $self = shift;
my $orderby = $self->param('orderby') || "xml_id";
+ my $cdn_id = $self->param('cdn');
my $logs_enabled = $self->param('logsEnabled');
my $current_user = $self->current_user()->{username};
my @data;
my %criteria;
+ if ( defined $cdn_id ) {
+ $criteria{'cdn_id'} = $cdn_id;
+ }
if ( defined $logs_enabled ) {
$criteria{'logs_enabled'} = $logs_enabled ? 1 : 0; # converts bool to 0|1
}
[06/13] incubator-trafficcontrol git commit: provides the ability to
retrieve all profiles assigned to a parameter
Posted by da...@apache.org.
provides the ability to retrieve all profiles assigned to a parameter
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/b2cc48a2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/b2cc48a2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/b2cc48a2
Branch: refs/heads/master
Commit: b2cc48a25f790efe8fe998fa6a335ca89ba35bf1
Parents: 28f732f
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Thu Dec 29 11:29:26 2016 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Thu Dec 29 11:29:26 2016 -0700
----------------------------------------------------------------------
.../traffic_ops_api/v12/parameter.rst | 46 ++++++++++++++++++++
traffic_ops/app/lib/API/Profile.pm | 27 ++++++++++++
traffic_ops/app/lib/TrafficOpsRoutes.pm | 3 ++
3 files changed, 76 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/b2cc48a2/docs/source/development/traffic_ops_api/v12/parameter.rst
----------------------------------------------------------------------
diff --git a/docs/source/development/traffic_ops_api/v12/parameter.rst b/docs/source/development/traffic_ops_api/v12/parameter.rst
index 9de8451..569cb85 100644
--- a/docs/source/development/traffic_ops_api/v12/parameter.rst
+++ b/docs/source/development/traffic_ops_api/v12/parameter.rst
@@ -114,6 +114,52 @@ Parameter
|
+**GET /api/1.2/parameters/:id/profiles**
+
+ Retrieves all profiles assigned to the parameter.
+
+ Authentication Required: Yes
+
+ Role(s) Required: None
+
+ **Request Route Parameters**
+
+ +---------------+----------+----------------------------------------------------+
+ | Name | Required | Description |
+ +===============+==========+====================================================+
+ | ``id`` | yes | Parameter ID. |
+ +---------------+----------+----------------------------------------------------+
+
+ **Response Properties**
+
+ +-----------------+--------+----------------------------------------------------+
+ | Parameter | Type | Description |
+ +=================+========+====================================================+
+ | ``lastUpdated`` | array | The Time / Date this server entry was last updated |
+ +-----------------+--------+----------------------------------------------------+
+ | ``name`` | string | The name for the profile |
+ +-----------------+--------+----------------------------------------------------+
+ | ``id`` | string | Primary key |
+ +-----------------+--------+----------------------------------------------------+
+ | ``description`` | string | The description for the profile |
+ +-----------------+--------+----------------------------------------------------+
+
+ **Response Example** ::
+
+ {
+ "response": [
+ {
+ "lastUpdated": "2012-10-08 19:34:45",
+ "name": "CCR_TOP",
+ "id": "8",
+ "description": "Content Router for top.foobar.net"
+ }
+ ]
+ }
+
+|
+
+
**GET /api/1.2/profiles/:id/parameters**
Authentication Required: Yes
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/b2cc48a2/traffic_ops/app/lib/API/Profile.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Profile.pm b/traffic_ops/app/lib/API/Profile.pm
index 34b4a02..68fffb5 100644
--- a/traffic_ops/app/lib/API/Profile.pm
+++ b/traffic_ops/app/lib/API/Profile.pm
@@ -72,6 +72,33 @@ sub index_trimmed {
$self->render( json => \@data );
}
+sub get_profiles_by_paramId {
+ my $self = shift;
+ my $param_id = $self->param('id');
+
+ my $param_profiles = $self->db->resultset('ProfileParameter')->search( { parameter => $param_id } );
+
+ my $profiles = $self->db->resultset('Profile')->search(
+ { 'me.id' => { -in => $param_profiles->get_column('profile')->as_query } }
+ );
+
+ my @data;
+ if ( defined($profiles) ) {
+ while ( my $row = $profiles->next ) {
+ push(
+ @data, {
+ "id" => $row->id,
+ "name" => $row->name,
+ "description" => $row->description,
+ "lastUpdated" => $row->last_updated
+ }
+ );
+ }
+ }
+
+ return $self->success( \@data );
+}
+
sub show {
my $self = shift;
my $id = $self->param('id');
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/b2cc48a2/traffic_ops/app/lib/TrafficOpsRoutes.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/TrafficOpsRoutes.pm b/traffic_ops/app/lib/TrafficOpsRoutes.pm
index 53b9fc7..9fc7d09 100644
--- a/traffic_ops/app/lib/TrafficOpsRoutes.pm
+++ b/traffic_ops/app/lib/TrafficOpsRoutes.pm
@@ -579,6 +579,9 @@ sub api_routes {
$r->delete("/api/$version/parameters/:id")->over( authenticated => 1 )->to( 'Parameter#delete', namespace => $namespace );
$r->post("/api/$version/parameters/validate")->over( authenticated => 1 )->to( 'Parameter#validate', namespace => $namespace );
+ # get all profiles associated with a parameter (from profile_parameter table)
+ $r->get( "/api/$version/parameters/:id/profiles")->over( authenticated => 1 )->to( 'Profile#get_profiles_by_paramId', namespace => $namespace );
+
# parameters for a profile
$r->get( "/api/$version/profiles/:id/parameters" => [ id => qr/\d+/ ] )->over( authenticated => 1 )->to( 'Parameter#get_profile_params', namespace => $namespace );
$r->get("/api/$version/profiles/name/:name/parameters")->over( authenticated => 1 )->to( 'Parameter#get_profile_params', namespace => $namespace );
[11/13] incubator-trafficcontrol git commit: Merge branch 'master'
into tc-81
Posted by da...@apache.org.
Merge branch 'master' into tc-81
# Conflicts:
# traffic_ops/app/lib/API/Server.pm
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/20046d5f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/20046d5f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/20046d5f
Branch: refs/heads/master
Commit: 20046d5f3b753079aeea9206a9fbfa15c113fb98
Parents: d018a1e 81bfb56
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Tue Jan 3 12:05:22 2017 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Tue Jan 3 12:05:22 2017 -0700
----------------------------------------------------------------------
LICENSE | 241 ++++++++++++++++++-
.../development/traffic_ops_api/v12/asn.rst | 8 +
.../traffic_ops_api/v12/cachegroup.rst | 41 ++++
.../traffic_ops_api/v12/phys_location.rst | 8 +
.../development/traffic_ops_api/v12/server.rst | 6 +-
traffic_ops/app/lib/API/Asn.pm | 11 +-
traffic_ops/app/lib/API/Parameter.pm | 30 +++
traffic_ops/app/lib/API/PhysLocation.pm | 11 +-
traffic_ops/app/lib/API/Server.pm | 4 +-
traffic_ops/app/lib/TrafficOpsRoutes.pm | 2 +
10 files changed, 345 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/20046d5f/docs/source/development/traffic_ops_api/v12/cachegroup.rst
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/20046d5f/docs/source/development/traffic_ops_api/v12/server.rst
----------------------------------------------------------------------
diff --cc docs/source/development/traffic_ops_api/v12/server.rst
index 9671e23,a53151e..2a08586
--- a/docs/source/development/traffic_ops_api/v12/server.rst
+++ b/docs/source/development/traffic_ops_api/v12/server.rst
@@@ -42,10 -42,12 +42,14 @@@ Serve
+--------------------+----------+---------------------------------------------+
| ``type`` | no | Used to filter servers by type. |
+--------------------+----------+---------------------------------------------+
- | ``profileId`` | no | Used to filter servers by profile. |
+ | ``profileId`` | no | Used to filter servers by profile ID. |
+ +--------------------+----------+---------------------------------------------+
+ | ``cdn`` | no | Used to filter servers by CDN ID. |
+ +--------------------+----------+---------------------------------------------+
+ | ``cachegroup`` | no | Used to filter servers by cache group ID. |
+--------------------+----------+---------------------------------------------+
+ | ``physLocation`` | no | Used to filter servers by phys location ID. |
+ +--------------------+----------+---------------------------------------------+
**Response Properties**
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/20046d5f/traffic_ops/app/lib/API/Server.pm
----------------------------------------------------------------------
diff --cc traffic_ops/app/lib/API/Server.pm
index e9522a1,672c17f..6debb62
--- a/traffic_ops/app/lib/API/Server.pm
+++ b/traffic_ops/app/lib/API/Server.pm
@@@ -36,9 -36,8 +36,9 @@@ sub index
my $type = $self->param('type');
my $status = $self->param('status');
my $profile_id = $self->param('profileId');
- my $cdn_id = $self->param('cdnId');
- my $cg_id = $self->param('cachegroupId');
+ my $cdn_id = $self->param('cdn');
+ my $cg_id = $self->param('cachegroup');
+ my $phys_loc_id = $self->param('physLocation');
my $servers;
my $forbidden;
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/20046d5f/traffic_ops/app/lib/TrafficOpsRoutes.pm
----------------------------------------------------------------------
[13/13] incubator-trafficcontrol git commit: This closes #154.
Posted by da...@apache.org.
This closes #154.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/58fe1dbd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/58fe1dbd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/58fe1dbd
Branch: refs/heads/master
Commit: 58fe1dbdac6045d80b1b88f20874b006c58f61ea
Parents: 2df215f
Author: Dan Kirkwood <da...@gmail.com>
Authored: Tue Jan 3 12:27:55 2017 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Tue Jan 3 12:27:55 2017 -0700
----------------------------------------------------------------------
----------------------------------------------------------------------
[07/13] incubator-trafficcontrol git commit: no need to return the
expensive call to build example_urls
Posted by da...@apache.org.
no need to return the expensive call to build example_urls
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/0c066aba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/0c066aba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/0c066aba
Branch: refs/heads/master
Commit: 0c066abaa2732c5d334e170753d6e9e860ebc276
Parents: b2cc48a
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Thu Dec 29 12:14:23 2016 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Thu Dec 29 12:14:23 2016 -0700
----------------------------------------------------------------------
traffic_ops/app/lib/API/Deliveryservice.pm | 5 -----
1 file changed, 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/0c066aba/traffic_ops/app/lib/API/Deliveryservice.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Deliveryservice.pm b/traffic_ops/app/lib/API/Deliveryservice.pm
index 2431f77..99054a3 100644
--- a/traffic_ops/app/lib/API/Deliveryservice.pm
+++ b/traffic_ops/app/lib/API/Deliveryservice.pm
@@ -551,10 +551,6 @@ sub get_deliveryservices_by_serverId {
my @data;
if ( defined($deliveryservices) ) {
while ( my $row = $deliveryservices->next ) {
- my $cdn_domain = $self->get_cdn_domain_by_ds_id( $row->id );
- my $regexp_set = &UI::DeliveryService::get_regexp_set( $self, $row->id );
- my @example_urls = &UI::DeliveryService::get_example_urls( $self, $row->id, $regexp_set, $row, $cdn_domain, $row->protocol );
-
push(
@data, {
"active" => \$row->active,
@@ -570,7 +566,6 @@ sub get_deliveryservices_by_serverId {
"dnsBypassTtl" => $row->dns_bypass_ttl,
"dscp" => $row->dscp,
"edgeHeaderRewrite" => $row->edge_header_rewrite,
- "exampleURLs" => \@example_urls,
"geoLimitRedirectURL" => $row->geolimit_redirect_url,
"geoLimit" => $row->geo_limit,
"geoLimitCountries" => $row->geo_limit_countries,
[05/13] incubator-trafficcontrol git commit: provides the ability to
retrieve all delivery services assigned to a server
Posted by da...@apache.org.
provides the ability to retrieve all delivery services assigned to a server
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/28f732f0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/28f732f0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/28f732f0
Branch: refs/heads/master
Commit: 28f732f0d32fcc25040236d9cc35a5f1b3e340e4
Parents: 9422ee6
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Thu Dec 29 11:10:00 2016 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Thu Dec 29 11:10:00 2016 -0700
----------------------------------------------------------------------
.../development/traffic_ops_api/v12/server.rst | 231 +++++++++++++++++++
traffic_ops/app/lib/API/Deliveryservice.pm | 81 +++++++
traffic_ops/app/lib/TrafficOpsRoutes.pm | 3 +
3 files changed, 315 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/28f732f0/docs/source/development/traffic_ops_api/v12/server.rst
----------------------------------------------------------------------
diff --git a/docs/source/development/traffic_ops_api/v12/server.rst b/docs/source/development/traffic_ops_api/v12/server.rst
index 0ddc0d1..9671e23 100644
--- a/docs/source/development/traffic_ops_api/v12/server.rst
+++ b/docs/source/development/traffic_ops_api/v12/server.rst
@@ -341,6 +341,237 @@ Server
|
+**GET /api/1.2/servers/:id/deliveryservices**
+
+ Retrieves all delivery services assigned to the server. See also `Using Traffic Ops - Delivery Service <http://trafficcontrol.apache.org/docs/latest/admin/traffic_ops_using.html#delivery-service>`_.
+
+ Authentication Required: Yes
+
+ Role(s) Required: None
+
+ **Request Route Parameters**
+
+ +-----------------+----------+---------------------------------------------------+
+ | Name | Required | Description |
+ +=================+==========+===================================================+
+ | ``id`` | yes | Server ID. |
+ +-----------------+----------+---------------------------------------------------+
+
+ **Response Properties**
+
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | Parameter | Type | Description |
+ +==========================+========+======================================================================================================================================+
+ | ``active`` | bool | true if active, false if inactive. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``cacheurl`` | string | Cache URL rule to apply to this delivery service. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``ccrDnsTtl`` | string | The TTL of the DNS response for A or AAAA queries requesting the IP address of the tr. host. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``cdnId`` | string | Id of the CDN to which the delivery service belongs to. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``cdnName`` | string | Name of the CDN to which the delivery service belongs to. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``checkPath`` | string | The path portion of the URL to check this deliveryservice for health. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``displayName`` | string | The display name of the delivery service. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``dnsBypassIp`` | string | The IPv4 IP to use for bypass on a DNS deliveryservice - bypass starts when serving more than the |
+ | | | globalMaxMbps traffic on this deliveryservice. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``dnsBypassIp6`` | string | The IPv6 IP to use for bypass on a DNS deliveryservice - bypass starts when serving more than the |
+ | | | globalMaxMbps traffic on this deliveryservice. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``dnsBypassTtl`` | string | The TTL of the DNS bypass response. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``dscp`` | string | The Differentiated Services Code Point (DSCP) with which to mark downstream (EDGE -> customer) traffic. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``edgeHeaderRewrite`` | string | The EDGE header rewrite actions to perform. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``geoLimitRedirectUrl`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``geoLimit`` | string | - 0: None - no limitations |
+ | | | - 1: Only route on CZF file hit |
+ | | | - 2: Only route on CZF hit or when from USA |
+ | | | |
+ | | | Note that this does not prevent access to content or makes content secure; it just prevents |
+ | | | routing to the content by Traffic Router. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``geoLimitCountries`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``geoProvider`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``globalMaxMbps`` | string | The maximum global bandwidth allowed on this deliveryservice. If exceeded, the traffic routes to the |
+ | | | dnsByPassIp* for DNS deliveryservices and to the httpBypassFqdn for HTTP deliveryservices. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``globalMaxTps`` | string | The maximum global transactions per second allowed on this deliveryservice. When this is exceeded |
+ | | | traffic will be sent to the dnsByPassIp* for DNS deliveryservices and to the httpBypassFqdn for |
+ | | | HTTP deliveryservices |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``httpBypassFqdn`` | string | The HTTP destination to use for bypass on an HTTP deliveryservice - bypass starts when serving more than the |
+ | | | globalMaxMbps traffic on this deliveryservice. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``id`` | string | The deliveryservice id (database row number). |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``infoUrl`` | string | Use this to add a URL that points to more information about that deliveryservice. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``initialDispersion`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``ipv6RoutingEnabled`` | bool | false: send IPv4 address of Traffic Router to client on HTTP type del. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``lastUpdated`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``logsEnabled`` | bool | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``longDesc`` | string | Description field 1. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``longDesc1`` | string | Description field 2. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``longDesc2`` | string | Description field 2. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``>>type`` | string | The type of MatchList (one of :ref:to-api-v11-types use_in_table='regex'). |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``>>setNumber`` | string | The set Number of the matchList. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``>>pattern`` | string | The regexp for the matchList. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``maxDnsAnswers`` | string | The maximum number of IPs to put in a A/AAAA response for a DNS deliveryservice (0 means all |
+ | | | available). |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``midHeaderRewrite`` | string | The MID header rewrite actions to perform. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``missLat`` | string | The latitude to use when the client cannot be found in the CZF or the Geo lookup. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``missLong`` | string | The longitude to use when the client cannot be found in the CZF or the Geo lookup. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``multiSiteOrigin`` | bool | Is the Multi Site Origin feature enabled for this delivery service (0=false, 1=true). See :ref:`rl-multi-site-origin` |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``multiSiteOriginAlgor`` | bool | Is the Multi Site Origin feature enabled for this delivery service (0=false, 1=true). See :ref:`rl-multi-site-origin` |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``orgServerFqdn`` | string | The origin server base URL (FQDN when used in this instance, includes the |
+ | | | protocol (http:// or https://) for use in retrieving content from the origin server. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``originShield`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``profileDescription`` | string | The description of the Traffic Router Profile with which this deliveryservice is associated. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``profileId`` | string | The id of the Traffic Router Profile with which this deliveryservice is associated. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``profileName`` | string | The name of the Traffic Router Profile with which this deliveryservice is associated. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``protocol`` | string | - 0: serve with http:// at EDGE |
+ | | | - 1: serve with https:// at EDGE |
+ | | | - 2: serve with both http:// and https:// at EDGE |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``qstringIgnore`` | string | - 0: no special query string handling; it is for use in the cache-key and pass up to origin. |
+ | | | - 1: ignore query string in cache-key, but pass it up to parent and or origin. |
+ | | | - 2: drop query string at edge, and do not use it in the cache-key. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``rangeRequestHandling`` | string | How to treat range requests: |
+ | | | |
+ | | | - 0 Do not cache (ranges requested from files taht are already cached due to a non range request will be a HIT) |
+ | | | - 1 Use the `background_fetch <https://docs.trafficserver.apache.org/en/latest/reference/plugins/background_fetch.en.html>`_ plugin. |
+ | | | - 2 Use the cache_range_requests plugin. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``regexRemap`` | string | Regex Remap rule to apply to this delivery service at the Edge tier. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``regionalGeoBlocking`` | bool | Regex Remap rule to apply to this delivery service at the Edge tier. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``remapText`` | string | Additional raw remap line text. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``signed`` | bool | - false: token based auth (see :ref:token-based-auth) is not enabled for this deliveryservice. |
+ | | | - true: token based auth is enabled for this deliveryservice. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``sslKeyVersion`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``trRequestHeaders`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``trResponseHeaders`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``type`` | string | The type of this deliveryservice (one of :ref:to-api-v11-types use_in_table='deliveryservice'). |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``typeId`` | string | The type of this deliveryservice (one of :ref:to-api-v11-types use_in_table='deliveryservice'). |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``xmlId`` | string | Unique string that describes this deliveryservice. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+
+ **Response Example** ::
+
+ {
+ "response": [
+ {
+ "active": true,
+ "cacheurl": null,
+ "ccrDnsTtl": "3600",
+ "cdnId": "2",
+ "cdnName": "over-the-top",
+ "checkPath": "",
+ "displayName": "My Cool Delivery Service",
+ "dnsBypassCname": "",
+ "dnsBypassIp": "",
+ "dnsBypassIp6": "",
+ "dnsBypassTtl": "30",
+ "dscp": "40",
+ "edgeHeaderRewrite": null,
+ "exampleURLs": [
+ "http://edge.foo-ds.foo.bar.net"
+ ],
+ "geoLimit": "0",
+ "geoLimitCountries": null,
+ "geoLimitRedirectURL": null,
+ "geoProvider": "0",
+ "globalMaxMbps": null,
+ "globalMaxTps": "0",
+ "httpBypassFqdn": "",
+ "id": "442",
+ "infoUrl": "",
+ "initialDispersion": "1",
+ "ipv6RoutingEnabled": true,
+ "lastUpdated": "2016-01-26 08:49:35",
+ "logsEnabled": false,
+ "longDesc": "",
+ "longDesc1": "",
+ "longDesc2": "",
+ "matchList": [
+ {
+ "pattern": ".*\\.foo-ds\\..*",
+ "setNumber": "0",
+ "type": "HOST_REGEXP"
+ }
+ ],
+ "maxDnsAnswers": "0",
+ "midHeaderRewrite": null,
+ "missLat": "41.881944",
+ "missLong": "-87.627778",
+ "multiSiteOrigin": false,
+ "multiSiteOriginAlgorithm": null,
+ "orgServerFqdn": "http://baz.boo.net",
+ "originShield": null,
+ "profileDescription": "Content Router for over-the-top",
+ "profileId": "5",
+ "profileName": "ROUTER_TOP",
+ "protocol": "0",
+ "qstringIgnore": "1",
+ "rangeRequestHandling": "0",
+ "regexRemap": null,
+ "regionalGeoBlocking": false,
+ "remapText": null,
+ "signed": false,
+ "sslKeyVersion": "0",
+ "trRequestHeaders": null,
+ "trResponseHeaders": "Access-Control-Allow-Origin: *",
+ "type": "HTTP",
+ "typeId": "8",
+ "xmlId": "foo-ds"
+ }
+ { .. },
+ { .. }
+ ]
+ }
+
+|
+
+
**GET /api/1.2/servers/summary**
Retrieves a count of CDN servers by type.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/28f732f0/traffic_ops/app/lib/API/Deliveryservice.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Deliveryservice.pm b/traffic_ops/app/lib/API/Deliveryservice.pm
index 69d14b8..2431f77 100644
--- a/traffic_ops/app/lib/API/Deliveryservice.pm
+++ b/traffic_ops/app/lib/API/Deliveryservice.pm
@@ -538,6 +538,87 @@ sub delete {
return $self->success_message("Delivery service was deleted.");
}
+sub get_deliveryservices_by_serverId {
+ my $self = shift;
+ my $server_id = $self->param('id');
+
+ my $server_ds_ids = $self->db->resultset('DeliveryserviceServer')->search( { server => $server_id } );
+
+ my $deliveryservices = $self->db->resultset('Deliveryservice')->search(
+ { 'me.id' => { -in => $server_ds_ids->get_column('deliveryservice')->as_query } }
+ );
+
+ my @data;
+ if ( defined($deliveryservices) ) {
+ while ( my $row = $deliveryservices->next ) {
+ my $cdn_domain = $self->get_cdn_domain_by_ds_id( $row->id );
+ my $regexp_set = &UI::DeliveryService::get_regexp_set( $self, $row->id );
+ my @example_urls = &UI::DeliveryService::get_example_urls( $self, $row->id, $regexp_set, $row, $cdn_domain, $row->protocol );
+
+ push(
+ @data, {
+ "active" => \$row->active,
+ "cacheurl" => $row->cacheurl,
+ "ccrDnsTtl" => $row->ccr_dns_ttl,
+ "cdnId" => $row->cdn->id,
+ "cdnName" => $row->cdn->name,
+ "checkPath" => $row->check_path,
+ "displayName" => $row->display_name,
+ "dnsBypassCname" => $row->dns_bypass_cname,
+ "dnsBypassIp" => $row->dns_bypass_ip,
+ "dnsBypassIp6" => $row->dns_bypass_ip6,
+ "dnsBypassTtl" => $row->dns_bypass_ttl,
+ "dscp" => $row->dscp,
+ "edgeHeaderRewrite" => $row->edge_header_rewrite,
+ "exampleURLs" => \@example_urls,
+ "geoLimitRedirectURL" => $row->geolimit_redirect_url,
+ "geoLimit" => $row->geo_limit,
+ "geoLimitCountries" => $row->geo_limit_countries,
+ "geoProvider" => $row->geo_provider,
+ "globalMaxMbps" => $row->global_max_mbps,
+ "globalMaxTps" => $row->global_max_tps,
+ "httpBypassFqdn" => $row->http_bypass_fqdn,
+ "id" => $row->id,
+ "infoUrl" => $row->info_url,
+ "initialDispersion" => $row->initial_dispersion,
+ "ipv6RoutingEnabled" => \$row->ipv6_routing_enabled,
+ "lastUpdated" => $row->last_updated,
+ "logsEnabled" => \$row->logs_enabled,
+ "longDesc" => $row->long_desc,
+ "longDesc1" => $row->long_desc_1,
+ "longDesc2" => $row->long_desc_2,
+ "maxDnsAnswers" => $row->max_dns_answers,
+ "midHeaderRewrite" => $row->mid_header_rewrite,
+ "missLat" => $row->miss_lat,
+ "missLong" => $row->miss_long,
+ "multiSiteOrigin" => \$row->multi_site_origin,
+ "multiSiteOriginAlgorithm" => $row->multi_site_origin_algorithm,
+ "orgServerFqdn" => $row->org_server_fqdn,
+ "originShield" => $row->origin_shield,
+ "profileId" => $row->profile->id,
+ "profileName" => $row->profile->name,
+ "profileDescription" => $row->profile->description,
+ "protocol" => $row->protocol,
+ "qstringIgnore" => $row->qstring_ignore,
+ "rangeRequestHandling" => $row->range_request_handling,
+ "regexRemap" => $row->regex_remap,
+ "regionalGeoBlocking" => \$row->regional_geo_blocking,
+ "remapText" => $row->remap_text,
+ "signed" => \$row->signed,
+ "sslKeyVersion" => $row->ssl_key_version,
+ "trRequestHeaders" => $row->tr_request_headers,
+ "trResponseHeaders" => $row->tr_response_headers,
+ "type" => $row->type->name,
+ "typeId" => $row->type->id,
+ "xmlId" => $row->xml_id
+ }
+ );
+ }
+ }
+
+ return $self->success( \@data );
+}
+
sub routing {
my $self = shift;
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/28f732f0/traffic_ops/app/lib/TrafficOpsRoutes.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/TrafficOpsRoutes.pm b/traffic_ops/app/lib/TrafficOpsRoutes.pm
index 3fe1c14..53b9fc7 100644
--- a/traffic_ops/app/lib/TrafficOpsRoutes.pm
+++ b/traffic_ops/app/lib/TrafficOpsRoutes.pm
@@ -647,6 +647,9 @@ sub api_routes {
$r->put("/api/$version/servers/:id")->over( authenticated => 1 )->to( 'Server#update', namespace => $namespace );
$r->delete("/api/$version/servers/:id")->over( authenticated => 1 )->to( 'Server#delete', namespace => $namespace );
+ # get all delivery services associated with a server (from deliveryservice_server table)
+ $r->get( "/api/$version/servers/:id/deliveryservices")->over( authenticated => 1 )->to( 'Deliveryservice#get_deliveryservices_by_serverId', namespace => $namespace );
+
# alernate server routes
$r->post("/api/$version/servers/create")->over( authenticated => 1 )->to( 'Server2#create', namespace => $namespace );
$r->put("/api/$version/servers/:id/update")->over( authenticated => 1 )->to( 'Server2#update', namespace => $namespace );
[09/13] incubator-trafficcontrol git commit: provides the ability to
filter deliveryservices by type
Posted by da...@apache.org.
provides the ability to filter deliveryservices by type
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/77096b1e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/77096b1e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/77096b1e
Branch: refs/heads/master
Commit: 77096b1e5d68955c66e10dc1ca194ce2ebaf0923
Parents: ac45172
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Fri Dec 30 09:56:33 2016 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Fri Dec 30 09:56:33 2016 -0700
----------------------------------------------------------------------
docs/source/development/traffic_ops_api/v12/deliveryservice.rst | 2 ++
traffic_ops/app/lib/API/Deliveryservice.pm | 4 ++++
2 files changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/77096b1e/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
----------------------------------------------------------------------
diff --git a/docs/source/development/traffic_ops_api/v12/deliveryservice.rst b/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
index 27930c6..c1100dd 100644
--- a/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
+++ b/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
@@ -39,6 +39,8 @@ Delivery Service
+=================+==========+===================================================+
| ``cdn`` | no | Filter delivery services by CDN ID. |
+-----------------+----------+---------------------------------------------------+
+ | ``type`` | no | Filter delivery services by Type ID. |
+ +-----------------+----------+---------------------------------------------------+
**Response Properties**
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/77096b1e/traffic_ops/app/lib/API/Deliveryservice.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Deliveryservice.pm b/traffic_ops/app/lib/API/Deliveryservice.pm
index 6653b29..c3fa0ce 100644
--- a/traffic_ops/app/lib/API/Deliveryservice.pm
+++ b/traffic_ops/app/lib/API/Deliveryservice.pm
@@ -33,6 +33,7 @@ sub index {
my $self = shift;
my $orderby = $self->param('orderby') || "xml_id";
my $cdn_id = $self->param('cdn');
+ my $type_id = $self->param('type');
my $logs_enabled = $self->param('logsEnabled');
my $current_user = $self->current_user()->{username};
my @data;
@@ -41,6 +42,9 @@ sub index {
if ( defined $cdn_id ) {
$criteria{'cdn_id'} = $cdn_id;
}
+ if ( defined $type_id ) {
+ $criteria{'type'} = $type_id;
+ }
if ( defined $logs_enabled ) {
$criteria{'logs_enabled'} = $logs_enabled ? 1 : 0; # converts bool to 0|1
}
[03/13] incubator-trafficcontrol git commit: provides the ability to
filter servers by phys location
Posted by da...@apache.org.
provides the ability to filter servers by phys location
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/48998175
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/48998175
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/48998175
Branch: refs/heads/master
Commit: 489981758bcf216ff2bc79646203b21a31f60594
Parents: a991ef9
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Thu Dec 29 09:45:03 2016 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Thu Dec 29 09:45:03 2016 -0700
----------------------------------------------------------------------
.../development/traffic_ops_api/v12/server.rst | 2 ++
traffic_ops/app/lib/API/Server.pm | 19 +++++++++++++++++++
2 files changed, 21 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/48998175/docs/source/development/traffic_ops_api/v12/server.rst
----------------------------------------------------------------------
diff --git a/docs/source/development/traffic_ops_api/v12/server.rst b/docs/source/development/traffic_ops_api/v12/server.rst
index 3700160..0ddc0d1 100644
--- a/docs/source/development/traffic_ops_api/v12/server.rst
+++ b/docs/source/development/traffic_ops_api/v12/server.rst
@@ -44,6 +44,8 @@ Server
+--------------------+----------+---------------------------------------------+
| ``profileId`` | no | Used to filter servers by profile. |
+--------------------+----------+---------------------------------------------+
+ | ``physLocation`` | no | Used to filter servers by phys location ID. |
+ +--------------------+----------+---------------------------------------------+
**Response Properties**
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/48998175/traffic_ops/app/lib/API/Server.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Server.pm b/traffic_ops/app/lib/API/Server.pm
index 0a3a905..90ab79e 100644
--- a/traffic_ops/app/lib/API/Server.pm
+++ b/traffic_ops/app/lib/API/Server.pm
@@ -38,6 +38,7 @@ sub index {
my $profile_id = $self->param('profileId');
my $cdn_id = $self->param('cdnId');
my $cg_id = $self->param('cachegroupId');
+ my $phys_loc_id = $self->param('physLocation');
my $servers;
my $forbidden;
@@ -59,6 +60,9 @@ sub index {
elsif ( defined $cg_id ) {
( $forbidden, $servers ) = $self->get_servers_by_cachegroup($cg_id);
}
+ elsif ( defined $phys_loc_id ) {
+ ( $forbidden, $servers ) = $self->get_servers_by_phys_loc($phys_loc_id);
+ }
else {
$servers = $self->get_servers_by_status( $current_user, $status );
}
@@ -779,6 +783,21 @@ sub get_servers_by_cdn {
return ( $forbidden, $servers );
}
+sub get_servers_by_phys_loc {
+ my $self = shift;
+ my $phys_loc_id = shift;
+
+ my $forbidden;
+ my $servers;
+ if ( !&is_oper($self) ) {
+ $forbidden = "Forbidden. You must have the operations role to perform this operation.";
+ return ( $forbidden, $servers );
+ }
+
+ my $servers = $self->db->resultset('Server')->search( { phys_location => $phys_loc_id } );
+ return ( $forbidden, $servers );
+}
+
sub get_servers_by_cachegroup {
my $self = shift;
my $cg_id = shift;
[04/13] incubator-trafficcontrol git commit: provides the ability to
retrieve all edge servers by delivery service
Posted by da...@apache.org.
provides the ability to retrieve all edge servers by delivery service
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/9422ee6d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/9422ee6d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/9422ee6d
Branch: refs/heads/master
Commit: 9422ee6d4024432d7299a6cdf193cfd925284d35
Parents: 4899817
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Thu Dec 29 10:50:05 2016 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Thu Dec 29 10:50:05 2016 -0700
----------------------------------------------------------------------
.../traffic_ops_api/v12/deliveryservice.rst | 164 +++++++++++++++++++
traffic_ops/app/lib/API/Server.pm | 71 ++++++++
traffic_ops/app/lib/TrafficOpsRoutes.pm | 3 +
3 files changed, 238 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9422ee6d/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
----------------------------------------------------------------------
diff --git a/docs/source/development/traffic_ops_api/v12/deliveryservice.rst b/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
index 75c26dd..27930c6 100644
--- a/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
+++ b/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
@@ -264,6 +264,14 @@ Delivery Service
Role(s) Required: None
+ **Request Route Parameters**
+
+ +-----------------+----------+---------------------------------------------------+
+ | Name | Required | Description |
+ +=================+==========+===================================================+
+ | ``id`` | yes | Delivery service ID. |
+ +-----------------+----------+---------------------------------------------------+
+
**Response Properties**
+--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
@@ -480,6 +488,162 @@ Delivery Service
|
+**GET /api/1.2/deliveryservices/:id/servers**
+
+ Retrieves properties of CDN Edge servers assigned to a delivery service.
+
+ Authentication Required: Yes
+
+ Role(s) Required: None
+
+ **Request Route Parameters**
+
+ +-----------------+----------+---------------------------------------------------+
+ | Name | Required | Description |
+ +=================+==========+===================================================+
+ | ``id`` | yes | Delivery service ID. |
+ +-----------------+----------+---------------------------------------------------+
+
+ **Response Properties**
+
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | Parameter | Type | Description |
+ +====================+========+============================================================================================================+
+ | ``cachegroup`` | string | The cache group name (see :ref:`to-api-v11-cachegroup`). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``cachegroupId`` | string | The cache group id. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``cdnId`` | string | Id of the CDN to which the server belongs to. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``cdnName`` | string | Name of the CDN to which the server belongs to. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``domainName`` | string | The domain name part of the FQDN of the cache. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``guid`` | string | An identifier used to uniquely identify the server. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``hostName`` | string | The host name part of the cache. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``httpsPort`` | string | The HTTPS port on which the main application listens (443 in most cases). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``id`` | string | The server id (database row number). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``iloIpAddress`` | string | The IPv4 address of the lights-out-management port. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``iloIpGateway`` | string | The IPv4 gateway address of the lights-out-management port. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``iloIpNetmask`` | string | The IPv4 netmask of the lights-out-management port. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``iloPassword`` | string | The password of the of the lights-out-management user (displays as ****** unless you are an 'admin' user). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``iloUsername`` | string | The user name for lights-out-management. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``interfaceMtu`` | string | The Maximum Transmission Unit (MTU) to configure for ``interfaceName``. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``interfaceName`` | string | The network interface name used for serving traffic. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``ip6Address`` | string | The IPv6 address/netmask for ``interfaceName``. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``ip6Gateway`` | string | The IPv6 gateway for ``interfaceName``. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``ipAddress`` | string | The IPv4 address for ``interfaceName``. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``ipGateway`` | string | The IPv4 gateway for ``interfaceName``. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``ipNetmask`` | string | The IPv4 netmask for ``interfaceName``. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``lastUpdated`` | string | The Time and Date for the last update for this server. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``mgmtIpAddress`` | string | The IPv4 address of the management port (optional). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``mgmtIpGateway`` | string | The IPv4 gateway of the management port (optional). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``mgmtIpNetmask`` | string | The IPv4 netmask of the management port (optional). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``offlineReason`` | string | A user-entered reason why the server is in ADMIN_DOWN or OFFLINE status. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``physLocation`` | string | The physical location name (see :ref:`to-api-v11-phys-loc`). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``physLocationId`` | string | The physical location id (see :ref:`to-api-v11-phys-loc`). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``profile`` | string | The assigned profile name (see :ref:`to-api-v11-profile`). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``profileDesc`` | string | The assigned profile description (see :ref:`to-api-v11-profile`). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``profileId`` | string | The assigned profile Id (see :ref:`to-api-v11-profile`). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``rack`` | string | A string indicating rack location. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``routerHostName`` | string | The human readable name of the router. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``routerPortName`` | string | The human readable name of the router port. |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``status`` | string | The Status string (See :ref:`to-api-v11-status`). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``statusId`` | string | The Status id (See :ref:`to-api-v11-status`). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``tcpPort`` | string | The default TCP port on which the main application listens (80 for a cache in most cases). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``type`` | string | The name of the type of this server (see :ref:`to-api-v11-type`). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``typeId`` | string | The id of the type of this server (see :ref:`to-api-v11-type`). |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+ | ``updPending`` | bool | |
+ +--------------------+--------+------------------------------------------------------------------------------------------------------------+
+
+ **Response Example** ::
+
+ {
+ "response": [
+ {
+ "cachegroup": "us-il-chicago",
+ "cachegroupId": "3",
+ "cdnId": "3",
+ "cdnName": "CDN-1",
+ "domainName": "chi.kabletown.net",
+ "guid": null,
+ "hostName": "atsec-chi-00",
+ "id": "19",
+ "iloIpAddress": "172.16.2.6",
+ "iloIpGateway": "172.16.2.1",
+ "iloIpNetmask": "255.255.255.0",
+ "iloPassword": "********",
+ "iloUsername": "",
+ "interfaceMtu": "9000",
+ "interfaceName": "bond0",
+ "ip6Address": "2033:D0D0:3300::2:2/64",
+ "ip6Gateway": "2033:D0D0:3300::2:1",
+ "ipAddress": "10.10.2.2",
+ "ipGateway": "10.10.2.1",
+ "ipNetmask": "255.255.255.0",
+ "lastUpdated": "2015-03-08 15:57:32",
+ "mgmtIpAddress": "",
+ "mgmtIpGateway": "",
+ "mgmtIpNetmask": "",
+ "offlineReason": "N/A",
+ "physLocation": "plocation-chi-1",
+ "physLocationId": "9",
+ "profile": "EDGE1_CDN1_421_SSL",
+ "profileDesc": "EDGE1_CDN1_421_SSL profile",
+ "profileId": "12",
+ "rack": "RR 119.02",
+ "routerHostName": "rtr-chi.kabletown.net",
+ "routerPortName": "2",
+ "status": "ONLINE",
+ "statusId": "6",
+ "tcpPort": "80",
+ "httpsPort": "443",
+ "type": "EDGE",
+ "typeId": "3",
+ "updPending": false
+ },
+ {
+ ... more server data
+ }
+ ]
+ }
+
+|
+
.. _to-api-v12-ds-health:
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9422ee6d/traffic_ops/app/lib/API/Server.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Server.pm b/traffic_ops/app/lib/API/Server.pm
index 90ab79e..e9522a1 100644
--- a/traffic_ops/app/lib/API/Server.pm
+++ b/traffic_ops/app/lib/API/Server.pm
@@ -488,6 +488,77 @@ sub get_servers_by_dsid {
return ( $forbidden, $servers );
}
+sub get_edge_servers_by_dsid {
+ my $self = shift;
+ my $ds_id = $self->param('id');
+
+ my $ds_servers;
+ if ( &is_privileged($self) || $self->is_delivery_service_assigned($ds_id) ) {
+ $ds_servers = $self->db->resultset('DeliveryserviceServer')->search( { deliveryservice => $ds_id } );
+ }
+ else {
+ return $self->alert("Forbidden. Delivery service not assigned to user.");
+ }
+
+ my $servers = $self->db->resultset('Server')->search(
+ { 'me.id' => { -in => $ds_servers->get_column('server')->as_query } },
+ { prefetch => [ 'cdn', 'cachegroup', 'type', 'profile', 'status', 'phys_location' ] }
+ );
+
+ my @data;
+ if ( defined($servers) ) {
+ my $is_admin = &is_admin($self);
+ while ( my $row = $servers->next ) {
+ push(
+ @data, {
+ "cachegroup" => $row->cachegroup->name,
+ "cachegroupId" => $row->cachegroup->id,
+ "cdnId" => $row->cdn->id,
+ "cdnName" => $row->cdn->name,
+ "domainName" => $row->domain_name,
+ "guid" => $row->guid,
+ "hostName" => $row->host_name,
+ "httpsPort" => $row->https_port,
+ "id" => $row->id,
+ "iloIpAddress" => $row->ilo_ip_address,
+ "iloIpNetmask" => $row->ilo_ip_netmask,
+ "iloIpGateway" => $row->ilo_ip_gateway,
+ "iloUsername" => $row->ilo_username,
+ "iloPassword" => $is_admin ? $row->ilo_password : "",
+ "interfaceMtu" => $row->interface_mtu,
+ "interfaceName" => $row->interface_name,
+ "ip6Address" => $row->ip6_address,
+ "ip6Gateway" => $row->ip6_gateway,
+ "ipAddress" => $row->ip_address,
+ "ipNetmask" => $row->ip_netmask,
+ "ipGateway" => $row->ip_gateway,
+ "lastUpdated" => $row->last_updated,
+ "mgmtIpAddress" => $row->mgmt_ip_address,
+ "mgmtIpNetmask" => $row->mgmt_ip_netmask,
+ "mgmtIpGateway" => $row->mgmt_ip_gateway,
+ "offlineReason" => $row->offline_reason,
+ "physLocation" => $row->phys_location->name,
+ "physLocationId" => $row->phys_location->id,
+ "profile" => $row->profile->name,
+ "profileId" => $row->profile->id,
+ "profileDesc" => $row->profile->description,
+ "rack" => $row->rack,
+ "routerHostName" => $row->router_host_name,
+ "routerPortName" => $row->router_port_name,
+ "status" => $row->status->name,
+ "statusId" => $row->status->id,
+ "tcpPort" => $row->tcp_port,
+ "type" => $row->type->name,
+ "typeId" => $row->type->id,
+ "updPending" => \$row->upd_pending
+ }
+ );
+ }
+ }
+
+ return $self->success( \@data );
+}
+
sub get_servers_by_type {
my $self = shift;
my $current_user = shift;
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9422ee6d/traffic_ops/app/lib/TrafficOpsRoutes.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/TrafficOpsRoutes.pm b/traffic_ops/app/lib/TrafficOpsRoutes.pm
index 9d0e546..3fe1c14 100644
--- a/traffic_ops/app/lib/TrafficOpsRoutes.pm
+++ b/traffic_ops/app/lib/TrafficOpsRoutes.pm
@@ -482,6 +482,9 @@ sub api_routes {
$r->put("/api/$version/deliveryservices/:id")->over( authenticated => 1 )->to( 'Deliveryservice#update', namespace => $namespace );
$r->delete("/api/$version/deliveryservices/:id")->over( authenticated => 1 )->to( 'Deliveryservice#delete', namespace => $namespace );
+ # get all edge servers associated with a delivery service (from deliveryservice_server table)
+ $r->get( "/api/$version/deliveryservices/:id/servers")->over( authenticated => 1 )->to( 'Server#get_edge_servers_by_dsid', namespace => $namespace );
+
# alternate deliveryservice routes
$r->get("/api/$version/deliveryservices/list")->over( authenticated => 1 )->to( 'Deliveryservice2#delivery_services', namespace => $namespace );
$r->get( "/api/$version/deliveryservices/:id/get" => [ id => qr/\d+/ ] )->over( authenticated => 1 )
[12/13] incubator-trafficcontrol git commit: fixes broken test
Posted by da...@apache.org.
fixes broken test
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/2df215f3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/2df215f3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/2df215f3
Branch: refs/heads/master
Commit: 2df215f3052b3d3f1ec39b5a80d91ba975bf5e6b
Parents: 20046d5
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Tue Jan 3 12:05:42 2017 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Tue Jan 3 12:05:42 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/t/api/1.2/server.t | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/2df215f3/traffic_ops/app/t/api/1.2/server.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/api/1.2/server.t b/traffic_ops/app/t/api/1.2/server.t
index e6757d5..86d7b02 100644
--- a/traffic_ops/app/t/api/1.2/server.t
+++ b/traffic_ops/app/t/api/1.2/server.t
@@ -56,13 +56,13 @@ ok $t->get_ok('/api/1.2/servers?type=MID')->status_is(200)->or( sub { diag $t->t
->json_is( "/response/0/type", "MID" )
->or( sub { diag $t->tx->res->content->asset->{content}; } );
-ok $t->get_ok('/api/1.2/servers?cdnId=1')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
+ok $t->get_ok('/api/1.2/servers?cdn=1')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
->json_is( "/response/0/hostName", "atlanta-edge-01" )
->json_is( "/response/0/domainName", "ga.atlanta.kabletown.net" )
->json_is( "/response/0/cdnId", 1 )
->or( sub { diag $t->tx->res->content->asset->{content}; } );
-ok $t->get_ok('/api/1.2/servers?cachegroupId=2')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
+ok $t->get_ok('/api/1.2/servers?cachegroup=2')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
->json_is( "/response/0/hostName", "atlanta-mid-02" )
->json_is( "/response/0/domainName", "ga.atlanta.kabletown.net" )
->json_is( "/response/0/cachegroupId", 2 )
[08/13] incubator-trafficcontrol git commit: provides the ability to
pull all deliveryservices assigned to a user
Posted by da...@apache.org.
provides the ability to pull all deliveryservices assigned to a user
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/ac45172f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/ac45172f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/ac45172f
Branch: refs/heads/master
Commit: ac45172fc07d5ecc00792b71bec64899700bf6da
Parents: 0c066ab
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Thu Dec 29 12:33:37 2016 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Thu Dec 29 12:33:37 2016 -0700
----------------------------------------------------------------------
.../development/traffic_ops_api/v12/user.rst | 231 +++++++++++++++++++
traffic_ops/app/lib/API/Deliveryservice.pm | 75 ++++++
traffic_ops/app/lib/TrafficOpsRoutes.pm | 5 +-
3 files changed, 310 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac45172f/docs/source/development/traffic_ops_api/v12/user.rst
----------------------------------------------------------------------
diff --git a/docs/source/development/traffic_ops_api/v12/user.rst b/docs/source/development/traffic_ops_api/v12/user.rst
index bbe0278..b141eca 100644
--- a/docs/source/development/traffic_ops_api/v12/user.rst
+++ b/docs/source/development/traffic_ops_api/v12/user.rst
@@ -208,6 +208,237 @@ Users
|
+**GET /api/1.2/users/:id/deliveryservices**
+
+ Retrieves all delivery services assigned to the user. See also `Using Traffic Ops - Delivery Service <http://trafficcontrol.apache.org/docs/latest/admin/traffic_ops_using.html#delivery-service>`_.
+
+ Authentication Required: Yes
+
+ Role(s) Required: None
+
+ **Request Route Parameters**
+
+ +-----------------+----------+---------------------------------------------------+
+ | Name | Required | Description |
+ +=================+==========+===================================================+
+ | ``id`` | yes | User ID. |
+ +-----------------+----------+---------------------------------------------------+
+
+
+ **Response Properties**
+
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | Parameter | Type | Description |
+ +==========================+========+======================================================================================================================================+
+ | ``active`` | bool | true if active, false if inactive. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``cacheurl`` | string | Cache URL rule to apply to this delivery service. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``ccrDnsTtl`` | string | The TTL of the DNS response for A or AAAA queries requesting the IP address of the tr. host. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``cdnId`` | string | Id of the CDN to which the delivery service belongs to. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``cdnName`` | string | Name of the CDN to which the delivery service belongs to. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``checkPath`` | string | The path portion of the URL to check this deliveryservice for health. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``displayName`` | string | The display name of the delivery service. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``dnsBypassIp`` | string | The IPv4 IP to use for bypass on a DNS deliveryservice - bypass starts when serving more than the |
+ | | | globalMaxMbps traffic on this deliveryservice. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``dnsBypassIp6`` | string | The IPv6 IP to use for bypass on a DNS deliveryservice - bypass starts when serving more than the |
+ | | | globalMaxMbps traffic on this deliveryservice. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``dnsBypassTtl`` | string | The TTL of the DNS bypass response. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``dscp`` | string | The Differentiated Services Code Point (DSCP) with which to mark downstream (EDGE -> customer) traffic. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``edgeHeaderRewrite`` | string | The EDGE header rewrite actions to perform. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``geoLimitRedirectUrl`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``geoLimit`` | string | - 0: None - no limitations |
+ | | | - 1: Only route on CZF file hit |
+ | | | - 2: Only route on CZF hit or when from USA |
+ | | | |
+ | | | Note that this does not prevent access to content or makes content secure; it just prevents |
+ | | | routing to the content by Traffic Router. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``geoLimitCountries`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``geoProvider`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``globalMaxMbps`` | string | The maximum global bandwidth allowed on this deliveryservice. If exceeded, the traffic routes to the |
+ | | | dnsByPassIp* for DNS deliveryservices and to the httpBypassFqdn for HTTP deliveryservices. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``globalMaxTps`` | string | The maximum global transactions per second allowed on this deliveryservice. When this is exceeded |
+ | | | traffic will be sent to the dnsByPassIp* for DNS deliveryservices and to the httpBypassFqdn for |
+ | | | HTTP deliveryservices |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``httpBypassFqdn`` | string | The HTTP destination to use for bypass on an HTTP deliveryservice - bypass starts when serving more than the |
+ | | | globalMaxMbps traffic on this deliveryservice. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``id`` | string | The deliveryservice id (database row number). |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``infoUrl`` | string | Use this to add a URL that points to more information about that deliveryservice. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``initialDispersion`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``ipv6RoutingEnabled`` | bool | false: send IPv4 address of Traffic Router to client on HTTP type del. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``lastUpdated`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``logsEnabled`` | bool | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``longDesc`` | string | Description field 1. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``longDesc1`` | string | Description field 2. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``longDesc2`` | string | Description field 2. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``>>type`` | string | The type of MatchList (one of :ref:to-api-v11-types use_in_table='regex'). |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``>>setNumber`` | string | The set Number of the matchList. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``>>pattern`` | string | The regexp for the matchList. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``maxDnsAnswers`` | string | The maximum number of IPs to put in a A/AAAA response for a DNS deliveryservice (0 means all |
+ | | | available). |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``midHeaderRewrite`` | string | The MID header rewrite actions to perform. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``missLat`` | string | The latitude to use when the client cannot be found in the CZF or the Geo lookup. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``missLong`` | string | The longitude to use when the client cannot be found in the CZF or the Geo lookup. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``multiSiteOrigin`` | bool | Is the Multi Site Origin feature enabled for this delivery service (0=false, 1=true). See :ref:`rl-multi-site-origin` |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``multiSiteOriginAlgor`` | bool | Is the Multi Site Origin feature enabled for this delivery service (0=false, 1=true). See :ref:`rl-multi-site-origin` |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``orgServerFqdn`` | string | The origin server base URL (FQDN when used in this instance, includes the |
+ | | | protocol (http:// or https://) for use in retrieving content from the origin server. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``originShield`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``profileDescription`` | string | The description of the Traffic Router Profile with which this deliveryservice is associated. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``profileId`` | string | The id of the Traffic Router Profile with which this deliveryservice is associated. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``profileName`` | string | The name of the Traffic Router Profile with which this deliveryservice is associated. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``protocol`` | string | - 0: serve with http:// at EDGE |
+ | | | - 1: serve with https:// at EDGE |
+ | | | - 2: serve with both http:// and https:// at EDGE |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``qstringIgnore`` | string | - 0: no special query string handling; it is for use in the cache-key and pass up to origin. |
+ | | | - 1: ignore query string in cache-key, but pass it up to parent and or origin. |
+ | | | - 2: drop query string at edge, and do not use it in the cache-key. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``rangeRequestHandling`` | string | How to treat range requests: |
+ | | | |
+ | | | - 0 Do not cache (ranges requested from files taht are already cached due to a non range request will be a HIT) |
+ | | | - 1 Use the `background_fetch <https://docs.trafficserver.apache.org/en/latest/reference/plugins/background_fetch.en.html>`_ plugin. |
+ | | | - 2 Use the cache_range_requests plugin. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``regexRemap`` | string | Regex Remap rule to apply to this delivery service at the Edge tier. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``regionalGeoBlocking`` | bool | Regex Remap rule to apply to this delivery service at the Edge tier. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``remapText`` | string | Additional raw remap line text. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``signed`` | bool | - false: token based auth (see :ref:token-based-auth) is not enabled for this deliveryservice. |
+ | | | - true: token based auth is enabled for this deliveryservice. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``sslKeyVersion`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``trRequestHeaders`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``trResponseHeaders`` | string | |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``type`` | string | The type of this deliveryservice (one of :ref:to-api-v11-types use_in_table='deliveryservice'). |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``typeId`` | string | The type of this deliveryservice (one of :ref:to-api-v11-types use_in_table='deliveryservice'). |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+ | ``xmlId`` | string | Unique string that describes this deliveryservice. |
+ +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+
+
+ **Response Example** ::
+
+ {
+ "response": [
+ {
+ "active": true,
+ "cacheurl": null,
+ "ccrDnsTtl": "3600",
+ "cdnId": "2",
+ "cdnName": "over-the-top",
+ "checkPath": "",
+ "displayName": "My Cool Delivery Service",
+ "dnsBypassCname": "",
+ "dnsBypassIp": "",
+ "dnsBypassIp6": "",
+ "dnsBypassTtl": "30",
+ "dscp": "40",
+ "edgeHeaderRewrite": null,
+ "exampleURLs": [
+ "http://edge.foo-ds.foo.bar.net"
+ ],
+ "geoLimit": "0",
+ "geoLimitCountries": null,
+ "geoLimitRedirectURL": null,
+ "geoProvider": "0",
+ "globalMaxMbps": null,
+ "globalMaxTps": "0",
+ "httpBypassFqdn": "",
+ "id": "442",
+ "infoUrl": "",
+ "initialDispersion": "1",
+ "ipv6RoutingEnabled": true,
+ "lastUpdated": "2016-01-26 08:49:35",
+ "logsEnabled": false,
+ "longDesc": "",
+ "longDesc1": "",
+ "longDesc2": "",
+ "matchList": [
+ {
+ "pattern": ".*\\.foo-ds\\..*",
+ "setNumber": "0",
+ "type": "HOST_REGEXP"
+ }
+ ],
+ "maxDnsAnswers": "0",
+ "midHeaderRewrite": null,
+ "missLat": "41.881944",
+ "missLong": "-87.627778",
+ "multiSiteOrigin": false,
+ "multiSiteOriginAlgorithm": null,
+ "orgServerFqdn": "http://baz.boo.net",
+ "originShield": null,
+ "profileDescription": "Content Router for over-the-top",
+ "profileId": "5",
+ "profileName": "ROUTER_TOP",
+ "protocol": "0",
+ "qstringIgnore": "1",
+ "rangeRequestHandling": "0",
+ "regexRemap": null,
+ "regionalGeoBlocking": false,
+ "remapText": null,
+ "signed": false,
+ "sslKeyVersion": "0",
+ "trRequestHeaders": null,
+ "trResponseHeaders": "Access-Control-Allow-Origin: *",
+ "type": "HTTP",
+ "typeId": "8",
+ "xmlId": "foo-ds"
+ }
+ { .. },
+ { .. }
+ ]
+ }
+
+|
+
**GET /api/1.2/user/current.json**
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac45172f/traffic_ops/app/lib/API/Deliveryservice.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Deliveryservice.pm b/traffic_ops/app/lib/API/Deliveryservice.pm
index 99054a3..6653b29 100644
--- a/traffic_ops/app/lib/API/Deliveryservice.pm
+++ b/traffic_ops/app/lib/API/Deliveryservice.pm
@@ -613,6 +613,81 @@ sub get_deliveryservices_by_serverId {
return $self->success( \@data );
}
+sub get_deliveryservices_by_userId {
+ my $self = shift;
+ my $user_id = $self->param('id');
+
+ my $user_ds_ids = $self->db->resultset('DeliveryserviceTmuser')->search( { tm_user_id => $user_id } );
+
+ my $deliveryservices = $self->db->resultset('Deliveryservice')->search(
+ { 'me.id' => { -in => $user_ds_ids->get_column('deliveryservice')->as_query } }
+ );
+
+ my @data;
+ if ( defined($deliveryservices) ) {
+ while ( my $row = $deliveryservices->next ) {
+ push(
+ @data, {
+ "active" => \$row->active,
+ "cacheurl" => $row->cacheurl,
+ "ccrDnsTtl" => $row->ccr_dns_ttl,
+ "cdnId" => $row->cdn->id,
+ "cdnName" => $row->cdn->name,
+ "checkPath" => $row->check_path,
+ "displayName" => $row->display_name,
+ "dnsBypassCname" => $row->dns_bypass_cname,
+ "dnsBypassIp" => $row->dns_bypass_ip,
+ "dnsBypassIp6" => $row->dns_bypass_ip6,
+ "dnsBypassTtl" => $row->dns_bypass_ttl,
+ "dscp" => $row->dscp,
+ "edgeHeaderRewrite" => $row->edge_header_rewrite,
+ "geoLimitRedirectURL" => $row->geolimit_redirect_url,
+ "geoLimit" => $row->geo_limit,
+ "geoLimitCountries" => $row->geo_limit_countries,
+ "geoProvider" => $row->geo_provider,
+ "globalMaxMbps" => $row->global_max_mbps,
+ "globalMaxTps" => $row->global_max_tps,
+ "httpBypassFqdn" => $row->http_bypass_fqdn,
+ "id" => $row->id,
+ "infoUrl" => $row->info_url,
+ "initialDispersion" => $row->initial_dispersion,
+ "ipv6RoutingEnabled" => \$row->ipv6_routing_enabled,
+ "lastUpdated" => $row->last_updated,
+ "logsEnabled" => \$row->logs_enabled,
+ "longDesc" => $row->long_desc,
+ "longDesc1" => $row->long_desc_1,
+ "longDesc2" => $row->long_desc_2,
+ "maxDnsAnswers" => $row->max_dns_answers,
+ "midHeaderRewrite" => $row->mid_header_rewrite,
+ "missLat" => $row->miss_lat,
+ "missLong" => $row->miss_long,
+ "multiSiteOrigin" => \$row->multi_site_origin,
+ "multiSiteOriginAlgorithm" => $row->multi_site_origin_algorithm,
+ "orgServerFqdn" => $row->org_server_fqdn,
+ "originShield" => $row->origin_shield,
+ "profileId" => $row->profile->id,
+ "profileName" => $row->profile->name,
+ "profileDescription" => $row->profile->description,
+ "protocol" => $row->protocol,
+ "qstringIgnore" => $row->qstring_ignore,
+ "rangeRequestHandling" => $row->range_request_handling,
+ "regexRemap" => $row->regex_remap,
+ "regionalGeoBlocking" => \$row->regional_geo_blocking,
+ "remapText" => $row->remap_text,
+ "signed" => \$row->signed,
+ "sslKeyVersion" => $row->ssl_key_version,
+ "trRequestHeaders" => $row->tr_request_headers,
+ "trResponseHeaders" => $row->tr_response_headers,
+ "type" => $row->type->name,
+ "typeId" => $row->type->id,
+ "xmlId" => $row->xml_id
+ }
+ );
+ }
+ }
+
+ return $self->success( \@data );
+}
sub routing {
my $self = shift;
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac45172f/traffic_ops/app/lib/TrafficOpsRoutes.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/TrafficOpsRoutes.pm b/traffic_ops/app/lib/TrafficOpsRoutes.pm
index 9fc7d09..53725c4 100644
--- a/traffic_ops/app/lib/TrafficOpsRoutes.pm
+++ b/traffic_ops/app/lib/TrafficOpsRoutes.pm
@@ -704,7 +704,10 @@ sub api_routes {
$r->get( "/api/$version/users/:id" => [ id => qr/\d+/ ] )->over( authenticated => 1 )->to( 'User#show', namespace => $namespace );
$r->put("/api/$version/users/:id")->over( authenticated => 1 )->to( 'User#update', namespace => $namespace );
- # -- USERS: CURRENT USER
+ # get all deliveryservices assigned to a user (from deliveryservice_tmuser table)
+ $r->get( "/api/$version/users/:id/deliveryservices")->over( authenticated => 1 )->to( 'Deliveryservice#get_deliveryservices_by_userId', namespace => $namespace );
+
+ # -- USERS: CURRENT USER
$r->get("/api/$version/user/current")->over( authenticated => 1 )->to( 'User#current', namespace => $namespace );
$r->post("/api/$version/user/current/update")->over( authenticated => 1 )->to( 'User#update_current', namespace => $namespace );
[02/13] incubator-trafficcontrol git commit: provides the ability to
filter regions by division
Posted by da...@apache.org.
provides the ability to filter regions by division
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/a991ef92
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/a991ef92
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/a991ef92
Branch: refs/heads/master
Commit: a991ef92c0d9af4ba923605c75da21bfefdc961f
Parents: 6fc161e
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Thu Dec 29 09:36:26 2016 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Thu Dec 29 09:36:26 2016 -0700
----------------------------------------------------------------------
docs/source/development/traffic_ops_api/v12/region.rst | 8 ++++++++
traffic_ops/app/lib/API/Region.pm | 11 +++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a991ef92/docs/source/development/traffic_ops_api/v12/region.rst
----------------------------------------------------------------------
diff --git a/docs/source/development/traffic_ops_api/v12/region.rst b/docs/source/development/traffic_ops_api/v12/region.rst
index 11e2f18..74e6fbf 100644
--- a/docs/source/development/traffic_ops_api/v12/region.rst
+++ b/docs/source/development/traffic_ops_api/v12/region.rst
@@ -29,6 +29,14 @@ Regions
Role(s) Required: None
+ **Request Route Parameters**
+
+ +---------------+----------+---------------------------------------------+
+ | Name | Required | Description |
+ +===============+==========+=============================================+
+ | ``division`` | no | Filter regions by Division ID. |
+ +---------------+----------+---------------------------------------------+
+
**Response Properties**
+----------------------+--------+------------------------------------------------+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a991ef92/traffic_ops/app/lib/API/Region.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Region.pm b/traffic_ops/app/lib/API/Region.pm
index a871a2b..39953d9 100644
--- a/traffic_ops/app/lib/API/Region.pm
+++ b/traffic_ops/app/lib/API/Region.pm
@@ -26,10 +26,17 @@ use MojoPlugins::Response;
my $finfo = __FILE__ . ":";
sub index {
- my $self = shift;
+ my $self = shift;
+ my $division_id = $self->param('division');
+
+ my %criteria;
+ if ( defined $division_id ) {
+ $criteria{'division'} = $division_id;
+ }
+
my @data;
my $orderby = $self->param('orderby') || "name";
- my $rs_data = $self->db->resultset("Region")->search( undef, { prefetch => ['division'], order_by => 'me.' . $orderby } );
+ my $rs_data = $self->db->resultset("Region")->search( \%criteria, { prefetch => ['division'], order_by => 'me.' . $orderby } );
while ( my $row = $rs_data->next ) {
push(
@data, {
[10/13] incubator-trafficcontrol git commit: provides the ability to
filter cache groups by type
Posted by da...@apache.org.
provides the ability to filter cache groups by type
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/d018a1eb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/d018a1eb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/d018a1eb
Branch: refs/heads/master
Commit: d018a1ebbed992b66abf90cf9c5bcbe1dc039554
Parents: 77096b1
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Fri Dec 30 09:59:26 2016 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Fri Dec 30 09:59:26 2016 -0700
----------------------------------------------------------------------
docs/source/development/traffic_ops_api/v12/cachegroup.rst | 8 ++++++++
traffic_ops/app/lib/API/Cachegroup.pm | 8 +++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d018a1eb/docs/source/development/traffic_ops_api/v12/cachegroup.rst
----------------------------------------------------------------------
diff --git a/docs/source/development/traffic_ops_api/v12/cachegroup.rst b/docs/source/development/traffic_ops_api/v12/cachegroup.rst
index 2d9f08d..cc7999a 100644
--- a/docs/source/development/traffic_ops_api/v12/cachegroup.rst
+++ b/docs/source/development/traffic_ops_api/v12/cachegroup.rst
@@ -29,6 +29,14 @@ Cache Group
Role(s) Required: None
+ **Request Query Parameters**
+
+ +-----------------+----------+---------------------------------------------------+
+ | Name | Required | Description |
+ +=================+==========+===================================================+
+ | ``type`` | no | Filter cache groups by Type ID. |
+ +-----------------+----------+---------------------------------------------------+
+
**Response Properties**
+-----------------------------------+--------+--------------------------------------------------------------------------+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d018a1eb/traffic_ops/app/lib/API/Cachegroup.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Cachegroup.pm b/traffic_ops/app/lib/API/Cachegroup.pm
index 7066b6c..e91a82b 100644
--- a/traffic_ops/app/lib/API/Cachegroup.pm
+++ b/traffic_ops/app/lib/API/Cachegroup.pm
@@ -33,13 +33,19 @@ sub index {
my @data;
my %idnames;
my $orderby = $self->param('orderby') || "name";
+ my $type_id = $self->param('type');
my $rs_idnames = $self->db->resultset("Cachegroup")->search( undef, { columns => [qw/id name/] } );
while ( my $row = $rs_idnames->next ) {
$idnames{ $row->id } = $row->name;
}
- my $rs_data = $self->db->resultset("Cachegroup")->search( undef, { prefetch => [ { 'type' => undef, } ], order_by => 'me.' . $orderby } );
+ my %criteria;
+ if ( defined $type_id ) {
+ $criteria{'type'} = $type_id;
+ }
+
+ my $rs_data = $self->db->resultset("Cachegroup")->search( \%criteria, { prefetch => [ { 'type' => undef, } ], order_by => 'me.' . $orderby } );
while ( my $row = $rs_data->next ) {
push(
@data, {