Method: securityPolicies.get

Lists all of the ordered rules present in a single specified policy.

HTTP request

GET https://www.googleapis.com/compute/beta/projects/{project}/global/securityPolicies/{resourceId}

The URL uses Google API HTTP annotation syntax.

Path parameters

Parameters
project

string

Project ID for this request.

resourceId

string

Name of the security policy to get.

Request body

The request body must be empty.

Response body

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

JSON representation
{
  "resource": {
    "id": string,
    "creationTimestamp": string,
    "name": string,
    "description": string,
    "rules": {
      "description": string,
      "priority": number,
      "match": {
        "versionedExpr": enum,
        "config": {
          "srcIpRanges": [
            string
          ]
        },
        "srcIpRanges": string
      },
      "action": string,
      "preview": boolean,
      "kind": string
    },
    "fingerprint": string,
    "selfLink": string,
    "kind": string
  },
}
Fields
resource

object

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.rules[]

object

Lists of rules that belong to this policy. There must always be a default rule (rule with priority 2147483647 and match "*"). If no rules are provided when creating a security policy, a default rule with action "allow" will be added.

resource.rules[].description

string

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

resource.rules[].priority

number

An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated in the increasing order of priority.

resource.rules[].match

object

A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding ‘action’ is enforced.

resource.rules[].match.versionedExpr

enum

Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding srcIpRange field in config.

resource.rules[].match.config

object

The configuration options available when specifying versionedExpr. This field must be specified if versionedExpr is specified and cannot be specified if versionedExpr is not specified.

resource.rules[].match.config.srcIpRanges[]

string

CIDR IP address range.

resource.rules[].match.srcIpRanges[]

string

CIDR IP address range.

resource.rules[].action

string

The Action to preform when the client connection triggers the rule. Can currently be either "allow" or "deny()" where valid values for status are 403, 404, and 502.

resource.rules[].preview

boolean

If set to true, the specified action is not enforced.

resource.rules[].kind

string

[Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules

resource.fingerprint

string (bytes format)

Specifies a fingerprint for this resource, which is essentially a hash of the metadata's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update metadata. You must always provide an up-to-date fingerprint hash in order to update or change metadata.

To see the latest fingerprint, make get() request to the security policy.

A base64-encoded string.

resource.selfLink

string

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

resource.kind

string

[Output only] Type of the resource. Always compute#securityPolicyfor security policies

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 Auth Guide.

IAM Permissions

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

  • compute.securityPolicies.get

Send feedback about...

Compute Engine