Repository: incubator-trafficcontrol Updated Branches: refs/heads/master 8e85502e8 -> b36993a68
responses to update/create now mirror that of show Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/a975fe95 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/a975fe95 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/a975fe95 Branch: refs/heads/master Commit: a975fe95148869390972cf9c6ba67fe9d75e9378 Parents: 8e85502 Author: Jeremy Mitchell <[email protected]> Authored: Wed Apr 12 09:02:00 2017 -0600 Committer: Dave Neuman <[email protected]> Committed: Wed Apr 12 10:12:36 2017 -0600 ---------------------------------------------------------------------- .../traffic_ops_api/v12/deliveryservice.rst | 326 ++++++++++++++++++- traffic_ops/app/lib/API/Deliveryservice.pm | 263 +++++++++------ 2 files changed, 468 insertions(+), 121 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a975fe95/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 c157dd8..8fe4e48 100644 --- a/docs/source/development/traffic_ops_api/v12/deliveryservice.rst +++ b/docs/source/development/traffic_ops_api/v12/deliveryservice.rst @@ -1531,10 +1531,154 @@ SSL Keys } + **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`` | int | The TTL of the DNS response for A or AAAA queries requesting the IP address of the tr. host. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``cdnId`` | int | 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. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``dnsBypassCname`` | string | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``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`` | int | The TTL of the DNS bypass response. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``dscp`` | int | The Differentiated Services Code Point (DSCP) with which to mark downstream (EDGE -> customer) traffic. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``edgeHeaderRewrite`` | string | The EDGE header rewrite actions to perform. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``exampleURLs`` | array | Entry points into the CDN for this deliveryservice. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``geoLimitRedirectUrl`` | string | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``geoLimit`` | int | - 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`` | int | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``globalMaxMbps`` | int | 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`` | int | 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`` | int | The deliveryservice id (database row number). | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``infoUrl`` | string | Use this to add a URL that points to more information about that deliveryservice. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``initialDispersion`` | int | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``ipv6RoutingEnabled`` | bool | false: send IPv4 address of Traffic Router to client on HTTP type del. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``lastUpdated`` | string | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``logsEnabled`` | bool | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``longDesc`` | string | Description field. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``longDesc1`` | string | Description field 1. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``longDesc2`` | string | Description field 2. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``matchList`` | array | Array of matchList hashes. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``>>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`` | int | 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`` | float | The latitude as decimal degrees to use when the client cannot be found in the CZF or the Geo lookup. | + | | | | + | | | - e.g. 39.7391500 or null | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``missLong`` | float | The longitude as decimal degrees to use when the client cannot be found in the CZF or the Geo lookup. | + | | | | + | | | - e.g. -104.9847000 or null | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``multiSiteOrigin`` | 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`` | int | 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`` | int | - 0: serve with http:// at EDGE | + | | | - 1: serve with https:// at EDGE | + | | | - 2: serve with both http:// and https:// at EDGE | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``qstringIgnore`` | int | - 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`` | int | 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`` | int | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``trRequestHeaders`` | string | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``trResponseHeaders`` | string | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``typeId`` | int | 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": + "response": [ { "active": true, "cacheurl": null, @@ -1549,6 +1693,9 @@ SSL Keys "dnsBypassTtl": "30", "dscp": "40", "edgeHeaderRewrite": null, + "exampleURLs": [ + "http://edge.foo-ds.foo.bar.net" + ], "geoLimit": "0", "geoLimitCountries": null, "geoLimitRedirectURL": null, @@ -1565,6 +1712,13 @@ SSL Keys "longDesc": "", "longDesc1": "", "longDesc2": "", + "matchList": [ + { + "pattern": ".*\\.foo-ds\\..*", + "setNumber": "0", + "type": "HOST_REGEXP" + } + ], "maxDnsAnswers": "0", "midHeaderRewrite": null, "missLat": "39.7391500", @@ -1589,12 +1743,7 @@ SSL Keys "typeId": "8", "xmlId": "foo-ds" } - "alerts":[ - { - "level": "success", - "text": "Delivery service was created: 312" - } - ] + ] } | @@ -1769,10 +1918,154 @@ SSL Keys } + **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`` | int | The TTL of the DNS response for A or AAAA queries requesting the IP address of the tr. host. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``cdnId`` | int | 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. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``dnsBypassCname`` | string | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``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`` | int | The TTL of the DNS bypass response. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``dscp`` | int | The Differentiated Services Code Point (DSCP) with which to mark downstream (EDGE -> customer) traffic. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``edgeHeaderRewrite`` | string | The EDGE header rewrite actions to perform. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``exampleURLs`` | array | Entry points into the CDN for this deliveryservice. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``geoLimitRedirectUrl`` | string | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``geoLimit`` | int | - 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`` | int | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``globalMaxMbps`` | int | 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`` | int | 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`` | int | The deliveryservice id (database row number). | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``infoUrl`` | string | Use this to add a URL that points to more information about that deliveryservice. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``initialDispersion`` | int | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``ipv6RoutingEnabled`` | bool | false: send IPv4 address of Traffic Router to client on HTTP type del. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``lastUpdated`` | string | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``logsEnabled`` | bool | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``longDesc`` | string | Description field. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``longDesc1`` | string | Description field 1. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``longDesc2`` | string | Description field 2. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``matchList`` | array | Array of matchList hashes. | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``>>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`` | int | 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`` | float | The latitude as decimal degrees to use when the client cannot be found in the CZF or the Geo lookup. | + | | | | + | | | - e.g. 39.7391500 or null | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``missLong`` | float | The longitude as decimal degrees to use when the client cannot be found in the CZF or the Geo lookup. | + | | | | + | | | - e.g. -104.9847000 or null | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``multiSiteOrigin`` | 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`` | int | 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`` | int | - 0: serve with http:// at EDGE | + | | | - 1: serve with https:// at EDGE | + | | | - 2: serve with both http:// and https:// at EDGE | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``qstringIgnore`` | int | - 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`` | int | 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`` | int | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``trRequestHeaders`` | string | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``trResponseHeaders`` | string | | + +--------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------+ + | ``typeId`` | int | 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": + "response": [ { "active": true, "cacheurl": null, @@ -1787,6 +2080,9 @@ SSL Keys "dnsBypassTtl": "30", "dscp": "40", "edgeHeaderRewrite": null, + "exampleURLs": [ + "http://edge.foo-ds.foo.bar.net" + ], "geoLimit": "0", "geoLimitCountries": null, "geoLimitRedirectURL": null, @@ -1803,6 +2099,13 @@ SSL Keys "longDesc": "", "longDesc1": "", "longDesc2": "", + "matchList": [ + { + "pattern": ".*\\.foo-ds\\..*", + "setNumber": "0", + "type": "HOST_REGEXP" + } + ], "maxDnsAnswers": "0", "midHeaderRewrite": null, "missLat": "39.7391500", @@ -1827,12 +2130,7 @@ SSL Keys "typeId": "8", "xmlId": "foo-ds" } - "alerts":[ - { - "level": "success", - "text": "Delivery service was updated: 312" - } - ] + ] } | http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a975fe95/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 75c7007..a45f816 100644 --- a/traffic_ops/app/lib/API/Deliveryservice.pm +++ b/traffic_ops/app/lib/API/Deliveryservice.pm @@ -61,9 +61,12 @@ sub index { my $rs_data = $self->db->resultset("Deliveryservice")->search( \%criteria, { prefetch => [ 'cdn', 'profile', 'type' ], order_by => 'me.' . $orderby } ); while ( my $row = $rs_data->next ) { + + # build example urls for each delivery service + my @example_urls = (); 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 ); + @example_urls = &UI::DeliveryService::get_example_urls( $self, $row->id, $regexp_set, $row, $cdn_domain, $row->protocol ); push( @data, { @@ -143,8 +146,10 @@ sub show { my $rs = $self->db->resultset("Deliveryservice")->search( { id => $id } ); while ( my $row = $rs->next ) { - my $ds_regexes = $row->deliveryservice_regexes; + + # build the matchlist (the list of ds regexes and their type) my @matchlist = (); + my $ds_regexes = $row->deliveryservice_regexes; while ( my $ds_regex = $ds_regexes->next ) { push( @@ -156,9 +161,11 @@ sub show { ); } + # build example urls for the delivery service + my @example_urls = (); 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 ); + @example_urls = &UI::DeliveryService::get_example_urls( $self, $row->id, $regexp_set, $row, $cdn_domain, $row->protocol ); push( @data, { @@ -307,61 +314,82 @@ sub update { &UI::DeliveryService::regex_remap( $self, $rs->id, $params->{profileId}, $params->{xmlId}, $params->{regexRemap} ); &UI::DeliveryService::cacheurl( $self, $rs->id, $params->{profileId}, $params->{xmlId}, $params->{cacheurl} ); + # build example urls + my @example_urls = (); + my $cdn_domain = $self->get_cdn_domain_by_ds_id( $rs->id ); + my $regexp_set = &UI::DeliveryService::get_regexp_set( $self, $rs->id ); + @example_urls = &UI::DeliveryService::get_example_urls( $self, $rs->id, $regexp_set, $rs, $cdn_domain, $rs->protocol ); + + # build the matchlist (the list of ds regexes and their type) + my @matchlist = (); + my $ds_regexes = $self->db->resultset('DeliveryserviceRegex')->search( { deliveryservice => $rs->id }, { prefetch => [ { 'regex' => 'type' } ] } ); + while ( my $ds_regex = $ds_regexes->next ) { + push( + @matchlist, { + type => $ds_regex->regex->type->name, + pattern => $ds_regex->regex->pattern, + setNumber => $ds_regex->set_number + } + ); + } + my @response; push( @response, { - "active" => $rs->active, - "cacheurl" => $rs->cacheurl, - "ccrDnsTtl" => $rs->ccr_dns_ttl, - "cdnId" => $rs->cdn->id, - "cdnName" => $rs->cdn->name, - "checkPath" => $rs->check_path, - "displayName" => $rs->display_name, - "dnsBypassCname" => $rs->dns_bypass_cname, - "dnsBypassIp" => $rs->dns_bypass_ip, - "dnsBypassIp6" => $rs->dns_bypass_ip6, - "dnsBypassTtl" => $rs->dns_bypass_ttl, - "dscp" => $rs->dscp, - "edgeHeaderRewrite" => $rs->edge_header_rewrite, - "geoLimitRedirectURL" => $rs->geolimit_redirect_url, - "geoLimit" => $rs->geo_limit, - "geoLimitCountries" => $rs->geo_limit_countries, - "geoProvider" => $rs->geo_provider, - "globalMaxMbps" => $rs->global_max_mbps, - "globalMaxTps" => $rs->global_max_tps, - "httpBypassFqdn" => $rs->http_bypass_fqdn, - "id" => $rs->id, - "infoUrl" => $rs->info_url, - "initialDispersion" => $rs->initial_dispersion, - "ipv6RoutingEnabled" => $rs->ipv6_routing_enabled, - "lastUpdated" => $rs->last_updated, - "logsEnabled" => $rs->logs_enabled, - "longDesc" => $rs->long_desc, - "longDesc1" => $rs->long_desc_1, - "longDesc2" => $rs->long_desc_2, - "maxDnsAnswers" => $rs->max_dns_answers, - "midHeaderRewrite" => $rs->mid_header_rewrite, - "missLat" => defined( $rs->miss_lat ) ? 0.0 + $rs->miss_lat : undef, - "missLong" => defined( $rs->miss_long ) ? 0.0 + $rs->miss_long : undef, - "multiSiteOrigin" => $rs->multi_site_origin, - "orgServerFqdn" => $rs->org_server_fqdn, - "originShield" => $rs->origin_shield, - "profileId" => defined( $rs->profile ) ? $rs->profile->id : undef, - "profileName" => defined( $rs->profile ) ? $rs->profile->name : undef, - "profileDescription" => defined( $rs->profile ) ? $rs->profile->description : undef, - "protocol" => $rs->protocol, - "qstringIgnore" => $rs->qstring_ignore, - "rangeRequestHandling" => $rs->range_request_handling, - "regexRemap" => $rs->regex_remap, - "regionalGeoBlocking" => $rs->regional_geo_blocking, - "remapText" => $rs->remap_text, - "signed" => $rs->signed, - "sslKeyVersion" => $rs->ssl_key_version, - "trRequestHeaders" => $rs->tr_request_headers, - "trResponseHeaders" => $rs->tr_response_headers, - "type" => $rs->type->name, - "typeId" => $rs->type->id, - "xmlId" => $rs->xml_id + "active" => $rs->active, + "cacheurl" => $rs->cacheurl, + "ccrDnsTtl" => $rs->ccr_dns_ttl, + "cdnId" => $rs->cdn->id, + "cdnName" => $rs->cdn->name, + "checkPath" => $rs->check_path, + "displayName" => $rs->display_name, + "dnsBypassCname" => $rs->dns_bypass_cname, + "dnsBypassIp" => $rs->dns_bypass_ip, + "dnsBypassIp6" => $rs->dns_bypass_ip6, + "dnsBypassTtl" => $rs->dns_bypass_ttl, + "dscp" => $rs->dscp, + "edgeHeaderRewrite" => $rs->edge_header_rewrite, + "exampleURLs" => \@example_urls, + "geoLimitRedirectURL" => $rs->geolimit_redirect_url, + "geoLimit" => $rs->geo_limit, + "geoLimitCountries" => $rs->geo_limit_countries, + "geoProvider" => $rs->geo_provider, + "globalMaxMbps" => $rs->global_max_mbps, + "globalMaxTps" => $rs->global_max_tps, + "httpBypassFqdn" => $rs->http_bypass_fqdn, + "id" => $rs->id, + "infoUrl" => $rs->info_url, + "initialDispersion" => $rs->initial_dispersion, + "ipv6RoutingEnabled" => $rs->ipv6_routing_enabled, + "lastUpdated" => $rs->last_updated, + "logsEnabled" => $rs->logs_enabled, + "longDesc" => $rs->long_desc, + "longDesc1" => $rs->long_desc_1, + "longDesc2" => $rs->long_desc_2, + "matchList" => \@matchlist, + "maxDnsAnswers" => $rs->max_dns_answers, + "midHeaderRewrite" => $rs->mid_header_rewrite, + "missLat" => defined($rs->miss_lat) ? 0.0 + $rs->miss_lat : undef, + "missLong" => defined($rs->miss_long) ? 0.0 + $rs->miss_long : undef, + "multiSiteOrigin" => $rs->multi_site_origin, + "orgServerFqdn" => $rs->org_server_fqdn, + "originShield" => $rs->origin_shield, + "profileId" => defined($rs->profile) ? $rs->profile->id : undef, + "profileName" => defined($rs->profile) ? $rs->profile->name : undef, + "profileDescription" => defined($rs->profile) ? $rs->profile->description : undef, + "protocol" => $rs->protocol, + "qstringIgnore" => $rs->qstring_ignore, + "rangeRequestHandling" => $rs->range_request_handling, + "regexRemap" => $rs->regex_remap, + "regionalGeoBlocking" => $rs->regional_geo_blocking, + "remapText" => $rs->remap_text, + "signed" => $rs->signed, + "sslKeyVersion" => $rs->ssl_key_version, + "trRequestHeaders" => $rs->tr_request_headers, + "trResponseHeaders" => $rs->tr_response_headers, + "type" => $rs->type->name, + "typeId" => $rs->type->id, + "xmlId" => $rs->xml_id } ); @@ -462,61 +490,82 @@ sub create { # create a default deliveryservice_regex in the format .*\.xml-id\..* $self->create_default_ds_regex( $insert->id, '.*\.' . $insert->xml_id . '\..*' ); + # build example urls + my @example_urls = (); + my $cdn_domain = $self->get_cdn_domain_by_ds_id( $insert->id ); + my $regexp_set = &UI::DeliveryService::get_regexp_set( $self, $insert->id ); + @example_urls = &UI::DeliveryService::get_example_urls( $self, $insert->id, $regexp_set, $insert, $cdn_domain, $insert->protocol ); + + # build the matchlist (the list of ds regexes and their type) + my @matchlist = (); + my $ds_regexes = $self->db->resultset('DeliveryserviceRegex')->search( { deliveryservice => $insert->id }, { prefetch => [ { 'regex' => 'type' } ] } ); + while ( my $ds_regex = $ds_regexes->next ) { + push( + @matchlist, { + type => $ds_regex->regex->type->name, + pattern => $ds_regex->regex->pattern, + setNumber => $ds_regex->set_number + } + ); + } + my @response; push( @response, { - "active" => $insert->active, - "cacheurl" => $insert->cacheurl, - "ccrDnsTtl" => $insert->ccr_dns_ttl, - "cdnId" => $insert->cdn->id, - "cdnName" => $insert->cdn->name, - "checkPath" => $insert->check_path, - "displayName" => $insert->display_name, - "dnsBypassCname" => $insert->dns_bypass_cname, - "dnsBypassIp" => $insert->dns_bypass_ip, - "dnsBypassIp6" => $insert->dns_bypass_ip6, - "dnsBypassTtl" => $insert->dns_bypass_ttl, - "dscp" => $insert->dscp, - "edgeHeaderRewrite" => $insert->edge_header_rewrite, - "geoLimitRedirectURL" => $insert->geolimit_redirect_url, - "geoLimit" => $insert->geo_limit, - "geoLimitCountries" => $insert->geo_limit_countries, - "geoProvider" => $insert->geo_provider, - "globalMaxMbps" => $insert->global_max_mbps, - "globalMaxTps" => $insert->global_max_tps, - "httpBypassFqdn" => $insert->http_bypass_fqdn, - "id" => $insert->id, - "infoUrl" => $insert->info_url, - "initialDispersion" => $insert->initial_dispersion, - "ipv6RoutingEnabled" => $insert->ipv6_routing_enabled, - "lastUpdated" => $insert->last_updated, - "logsEnabled" => $insert->logs_enabled, - "longDesc" => $insert->long_desc, - "longDesc1" => $insert->long_desc_1, - "longDesc2" => $insert->long_desc_2, - "maxDnsAnswers" => $insert->max_dns_answers, - "midHeaderRewrite" => $insert->mid_header_rewrite, - "missLat" => defined( $insert->miss_lat ) ? 0.0 + $insert->miss_lat : undef, - "missLong" => defined( $insert->miss_long ) ? 0.0 + $insert->miss_long : undef, - "multiSiteOrigin" => $insert->multi_site_origin, - "orgServerFqdn" => $insert->org_server_fqdn, - "originShield" => $insert->origin_shield, - "profileId" => defined( $insert->profile ) ? $insert->profile->id : undef, - "profileName" => defined( $insert->profile ) ? $insert->profile->name : undef, - "profileDescription" => defined( $insert->profile ) ? $insert->profile->description : undef, - "protocol" => $insert->protocol, - "qstringIgnore" => $insert->qstring_ignore, - "rangeRequestHandling" => $insert->range_request_handling, - "regexRemap" => $insert->regex_remap, - "regionalGeoBlocking" => $insert->regional_geo_blocking, - "remapText" => $insert->remap_text, - "signed" => $insert->signed, - "sslKeyVersion" => $insert->ssl_key_version, - "trRequestHeaders" => $insert->tr_request_headers, - "trResponseHeaders" => $insert->tr_response_headers, - "type" => $insert->type->name, - "typeId" => $insert->type->id, - "xmlId" => $insert->xml_id + "active" => $insert->active, + "cacheurl" => $insert->cacheurl, + "ccrDnsTtl" => $insert->ccr_dns_ttl, + "cdnId" => $insert->cdn->id, + "cdnName" => $insert->cdn->name, + "checkPath" => $insert->check_path, + "displayName" => $insert->display_name, + "dnsBypassCname" => $insert->dns_bypass_cname, + "dnsBypassIp" => $insert->dns_bypass_ip, + "dnsBypassIp6" => $insert->dns_bypass_ip6, + "dnsBypassTtl" => $insert->dns_bypass_ttl, + "dscp" => $insert->dscp, + "edgeHeaderRewrite" => $insert->edge_header_rewrite, + "exampleURLs" => \@example_urls, + "geoLimitRedirectURL" => $insert->geolimit_redirect_url, + "geoLimit" => $insert->geo_limit, + "geoLimitCountries" => $insert->geo_limit_countries, + "geoProvider" => $insert->geo_provider, + "globalMaxMbps" => $insert->global_max_mbps, + "globalMaxTps" => $insert->global_max_tps, + "httpBypassFqdn" => $insert->http_bypass_fqdn, + "id" => $insert->id, + "infoUrl" => $insert->info_url, + "initialDispersion" => $insert->initial_dispersion, + "ipv6RoutingEnabled" => $insert->ipv6_routing_enabled, + "lastUpdated" => $insert->last_updated, + "logsEnabled" => $insert->logs_enabled, + "longDesc" => $insert->long_desc, + "longDesc1" => $insert->long_desc_1, + "longDesc2" => $insert->long_desc_2, + "matchList" => \@matchlist, + "maxDnsAnswers" => $insert->max_dns_answers, + "midHeaderRewrite" => $insert->mid_header_rewrite, + "missLat" => defined($insert->miss_lat) ? 0.0 + $insert->miss_lat : undef, + "missLong" => defined($insert->miss_long) ? 0.0 + $insert->miss_long : undef, + "multiSiteOrigin" => $insert->multi_site_origin, + "orgServerFqdn" => $insert->org_server_fqdn, + "originShield" => $insert->origin_shield, + "profileId" => defined($insert->profile) ? $insert->profile->id : undef, + "profileName" => defined($insert->profile) ? $insert->profile->name : undef, + "profileDescription" => defined($insert->profile) ? $insert->profile->description : undef, + "protocol" => $insert->protocol, + "qstringIgnore" => $insert->qstring_ignore, + "rangeRequestHandling" => $insert->range_request_handling, + "regexRemap" => $insert->regex_remap, + "regionalGeoBlocking" => $insert->regional_geo_blocking, + "remapText" => $insert->remap_text, + "signed" => $insert->signed, + "sslKeyVersion" => $insert->ssl_key_version, + "trRequestHeaders" => $insert->tr_request_headers, + "trResponseHeaders" => $insert->tr_response_headers, + "type" => $insert->type->name, + "typeId" => $insert->type->id, + "xmlId" => $insert->xml_id } );
