Method: urlMaps.validate

Runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap.

HTTP request

POST https://www.googleapis.com/compute/v1/projects/{project}/global/urlMaps/{resourceId}/validate

The URL uses Google API HTTP annotation syntax.

Path parameters

Parameters
project

string

Project ID for this request.

resourceId

string

Name of the UrlMap resource to be validated as.

Request body

The request body contains data with the following structure:

JSON representation
{
  "resource": {
    "id": string,
    "creationTimestamp": string,
    "name": string,
    "description": string,
    "selfLink": string,
    "hostRules": [
      
    ],
    "pathMatchers": [
      
    ],
    "tests": [
      
    ],
    "defaultService": string,
    "fingerprint": string,
    "kind": string
  }
}
Fields
resource

object

Content of the UrlMap to be validated.

resource.id

string (fixed64 format)

[Output Only] The unique identifier for the resource. This identifier is defined by the server.

resource.creationTimestamp

string

[Output Only] Creation timestamp in RFC3339 text format.

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. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

resource.description

string

An optional description of this resource. Provide this property when you create the resource.

resource.selfLink

string

[Output Only] Server-defined URL for the resource.

resource.hostRules[]

object

The list of HostRules to use against the URL.

resource.hostRules[].description

string

An optional description of this resource. Provide this property when you create the resource.

resource.hostRules[].hosts[]

string

The list of host patterns to match. They must be valid hostnames, except * will match any string of ([a-z0-9-.]*). In that case, * must be the first character and must be followed in the pattern by either - or ..

resource.hostRules[].pathMatcher

string

The name of the PathMatcher to use to match the path portion of the URL if the hostRule matches the URL's host portion.

resource.pathMatchers[]

object

The list of named PathMatchers to use against the URL.

resource.pathMatchers[].name

string

The name to which this PathMatcher is referred by the HostRule.

resource.pathMatchers[].description

string

An optional description of this resource. Provide this property when you create the resource.

resource.pathMatchers[].defaultService

string

The full or partial URL to the BackendService resource. This will be used if none of the pathRules defined by this PathMatcher is matched by the URL's path portion. For example, the following are all valid URLs to a BackendService resource:

resource.pathMatchers[].pathRules[]

object

The list of path rules.

resource.pathMatchers[].pathRules[].service

string

The URL of the BackendService resource if this rule is matched.

resource.pathMatchers[].pathRules[].paths[]

string

The list of path patterns to match. Each must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.

resource.tests[]

object

The list of expected URL mapping tests. Request to update this UrlMap will succeed only if all of the test cases pass. You can specify a maximum of 100 tests per UrlMap.

resource.tests[].description

string

Description of this test case.

resource.tests[].host

string

Host portion of the URL.

resource.tests[].path

string

Path portion of the URL.

resource.tests[].service

string

Expected BackendService resource the given URL should be mapped to.

resource.defaultService

string

The URL of the BackendService resource if none of the hostRules match.

resource.fingerprint

string (bytes format)

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.

To see the latest fingerprint, make a get() request to retrieve a UrlMap.

A base64-encoded string.

resource.kind

string

[Output Only] Type of the resource. Always compute#urlMaps for url maps.

Response body

If successful, the response body contains data with the following structure:

JSON representation
{
  "result": {
    "loadSucceeded": boolean,
    "loadErrors": [
      string
    ],
    "testPassed": boolean,
    "testFailures": [
      {
        "host": string,
        "path": string,
        "expectedService": string,
        "actualService": string
      }
    ]
  }
}
Fields
result

object

result.loadSucceeded

boolean

Whether the given UrlMap can be successfully loaded. If false, 'loadErrors' indicates the reasons.

result.loadErrors[]

string

result.testPassed

boolean

If successfully loaded, this field indicates whether the test passed. If false, 'testFailures's indicate the reason of failure.

result.testFailures[]

object

result.testFailures[].host

string

result.testFailures[].path

string

result.testFailures[].expectedService

string

result.testFailures[].actualService

string

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/compute
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

In addition to any permissions specified on the fields above, authorization requires one or more of the following Google IAM permissions:

  • compute.urlMaps.validate
Was this page helpful? Let us know how we did:

Send feedback about...

Compute Engine