Hide
Compute Engine

GlobalForwardingRules: list

Requires authorization

Retrieves the list of ForwardingRule resources available to the specified project. Try it now.

Request

HTTP request

GET https://www.googleapis.com/compute/v1/projects/project/global/forwardingRules

Parameters

Parameter name Value Description
Path parameters
project string Project ID for this request.
Optional query parameters
filter string Filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must contain the following:
FIELD_NAME COMPARISON_STRING LITERAL_STRING
  • FIELD_NAME: The name of the field you want to compare. The field name must be valid for the type of resource being filtered. Only atomic field types are supported (string, number, boolean). Array and object fields are not currently supported. For example, if you search for machineType in the Firewalls collection, the filter will fail, because the machineType field is specific to instances and other resources do not have that property.
  • COMPARISON_STRING: The comparison string, either eq (equals) or ne (not equals).
  • LITERAL_STRING: The literal string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. For example, when filtering instances by name, name eq my-instance won't work, but name eq .*my-instance will work.

For example, for all resources, you could filter by the name of the resource:

filter=name ne example-forwarding-rule

The above filter returns only results whose name field does not equal example-forwarding-rule. You can also enclose your literal string in single, double, or no quotes. For example, all three of the following would be valid expressions:

filter=name ne "example-forwarding-rule"
filter=name ne 'example-forwarding-rule'
filter=name ne example-forwarding-rule

If you use a complex regular expression, you need to encode the special characters, including quotes. Consider the following regular expression:

name eq 'example-rule-[0-9]+'

To use the expression, you would need to encode it:

filter=name+eq+%27example-rule-%5B0-9%5D%2B%27

If you are using the API through a client, such as client libraries, or gcloud compute, keep in mind that your client might encode your regular expression automatically so that you will not need to encode it yourself.

maxResults unsigned integer Maximum count of results to be returned. Acceptable values are 0 to 500, inclusive. (Default: 500)
pageToken string Tag returned by a previous list request truncated by maxResults. Used to continue a previous list request.

Authorization

This request requires authorization with at least one of the following scopes (read more about authentication and authorization).

Scope
https://www.googleapis.com/auth/compute.readonly
https://www.googleapis.com/auth/compute

Request body

Do not supply a request body with this method.

Response

If successful, this method returns a response body with the following structure:

{
  "kind": "compute#forwardingRuleList",
  "id": string,
  "items": [
    globalForwardingRules Resource
  ],
  "nextPageToken": string,
  "selfLink": string
}
Property name Value Description Notes
kind string [Output Only] Type of resource. Always compute#forwardingRuleList for this request.
id string [Output Only] Unique identifier for the resource; defined by the server.
items[] list [Output Only] The ForwardingRule resources.
nextPageToken string [Output Only] A token used to continue a truncated list request.

Try it!

Use the APIs Explorer below to call this method on live data and see the response.