Method: projects.locations.rules.list

Lists rules in a given project.

HTTP request

GET https://workloadmanager.googleapis.com/v1/{parent=projects/*/locations/*}/rules

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
parent

string

Required. The [project] on which to execute the request. The format is: projects/{projectId}/locations/{location} Currently, the pre-defined rules are global available to all projects and all regions

Query parameters

Parameters
pageSize

integer

Requested page size. Server may return fewer items than requested. If unspecified, server will pick an appropriate default.

pageToken

string

A token identifying a page of results the server should return.

filter

string

Filter based on primaryCategory, secondaryCategory

customRulesBucket

string

The Cloud Storage bucket name for custom rules.

evaluationType

enum (EvaluationType)

Optional. The evaluation type of the rules will be applied to. The Cloud Storage bucket name for custom rules.

Request body

The request body must be empty.

Response body

Mesesage of response of list rules

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

JSON representation
{
  "rules": [
    {
      object (Rule)
    }
  ],
  "invalidRulesWrapper": {
    object (InvalidRulesWrapper)
  }
}
Fields
rules[]

object (Rule)

all rules in response

invalidRulesWrapper

object (InvalidRulesWrapper)

A wrapper of the invalid rules that failed to be validated.

Authorization scopes

Requires the following OAuth scope:

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

Rule

Message represent a rule

JSON representation
{
  "name": string,
  "revisionId": string,
  "displayName": string,
  "description": string,
  "severity": string,
  "primaryCategory": string,
  "secondaryCategory": string,
  "errorMessage": string,
  "uri": string,
  "remediation": string,
  "tags": [
    string
  ],
  "ruleType": enum (RuleType),
  "assetType": string
}
Fields
name

string

rule name

revisionId

string

Output only. the version of the rule

displayName

string

the name display in UI

description

string

descrite rule in plain language

severity

string

the severity of the rule

primaryCategory

string

the primary category

secondaryCategory

string

the secondary category

errorMessage

string

the message template for rule

uri

string

the docuement url for the rule

remediation

string

the remediation for the rule

tags[]

string

List of user-defined tags

ruleType

enum (RuleType)

The type of the rule.

assetType

string

The CAI asset type of the rule is evaluating, for joined asset types, it will be the corresponding primary asset types.

RuleType

The type of the rule.

Enums
RULE_TYPE_UNSPECIFIED Not specified.
BASELINE Baseline rules
CUSTOM Custom rules

InvalidRulesWrapper

Message wrappes a list of invalid rules.

JSON representation
{
  "invalidRules": [
    {
      object (InvalidRule)
    }
  ]
}
Fields
invalidRules[]

object (InvalidRule)

The invalid rules that failed to be validated.

InvalidRule

Message represent an rule that failed to be validated.

JSON representation
{
  "name": string,
  "displayName": string,
  "gcsUri": string,
  "valiadtionError": string
}
Fields
name

string

name of the invalid rule

displayName

string

display name of the invalid rule

gcsUri

string

cloud storage destination of the invalid rule

valiadtionError

string

The error message of valdating rule formats.