The UrlMaps are used to route requests to a backend service based on rules that you define for the host and path of an incoming URL.
For a list of methods for this resource, see the end of this page.
Resource representations
This resource defines the mapping from URL to the BackendService resource, which is based on the "longest-match" of the URL's host and path.
{
"kind": "compute#urlMap",
"id": unsigned long,
"creationTimestamp": string,
"name": string,
"description": string,
"selfLink": string,
"hostRules": [
{
"description": string,
"hosts": [
string
],
"pathMatcher": string
}
],
"pathMatchers": [
{
"name": string,
"description": string,
"defaultService": string,
"pathRules": [
{
"service": string,
"paths": [
string
]
}
]
}
],
"tests": [
{
"description": string,
"host": string,
"path": string,
"service": string
}
],
"defaultService": string,
"fingerprint": bytes
}
| Property name | Value | Description | Notes |
|---|---|---|---|
creationTimestamp |
string |
[Output Only] Creation timestamp in RFC3339 text format. | |
defaultService |
string |
The URL of the BackendService resource if none of the hostRules match. |
|
description |
string |
An optional textual description of the resource; provided by the client when the resource is created. | |
fingerprint |
bytes |
Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a UrlMap. An up-to-date fingerprint must be provided in order to update the UrlMap. | |
hostRules[] |
list |
The list of HostRules to use against the URL. |
|
hostRules[].description |
string |
||
hostRules[].hosts[] |
list |
The list of host patterns to match. They must be valid hostnames except that they may start with *. or *-. The * acts like a glob and will match any string of atoms (separated by .s and -s) to the left. |
|
hostRules[].pathMatcher |
string |
The name of the PathMatcher to match the path portion of the URL if the HostRule matches the URL's host. |
|
id |
unsigned long |
Unique identifier for the resource; defined by the server (output only). | |
kind |
string |
[Output Only] Type of the resource. | |
name |
string |
Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. | |
pathMatchers[] |
list |
The list of named PathMatchers to use against the URL. |
|
pathMatchers[].defaultService |
string |
The URL to the BackendService resource. This URL is used if none of the 'pathRules' defined by this PathMatcher are matched by the URL's path. |
|
pathMatchers[].description |
string |
||
pathMatchers[].name |
string |
The name to which this PathMatcher is referred by the HostRule. | |
pathMatchers[].pathRules[] |
list |
The list of path rules. | |
pathMatchers[].pathRules[].paths[] |
list |
The list of path patterns to match. Each must start with / |
|
pathMatchers[].pathRules[].service |
string |
The URL of the BackendService resource if this rule is matched. |
|
selfLink |
string |
[Output Only] Server defined URL for the resource. | |
tests[] |
list |
The list of expected URL mappings. Requests to update this UrlMap will only succeed if all of the test cases pass. |
|
tests[].description |
string |
Description of this test case. | |
tests[].host |
string |
Host portion of the URL. | |
tests[].path |
string |
Path portion of the URL. | |
tests[].service |
string |
Expected BackendService resource the given URL should be mapped to. |
Methods
The following are valid UrlMaps resource methods:
- delete
- Deletes the specified
UrlMapresource. - get
- Returns the specified
UrlMapresource. - insert
- Creates a
UrlMapresource in the specified project using the data included in the request. - list
- Retrieves the list of
UrlMapresources available to the specified project. - patch
- Update the entire content of the UrlMap resource. This method supports patch semantics.
- update
- Update the entire content of the UrlMap resource.
- validate
- Run static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap.