{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google-cloud-security-command-center/json-schema/google-cloud-security-command-center-posture-template-schema.json",
  "title": "PostureTemplate",
  "description": "The details of a posture template.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-cloud-security-command-center-securityposture-organizations-api-openapi.yml#/components/schemas/PostureTemplate",
  "type": "object",
  "properties": {
    "description": {
      "readOnly": true,
      "type": "string",
      "description": "Output only. A description of the posture template."
    },
    "categories": {
      "readOnly": true,
      "description": "Output only. The categories that the posture template belongs to, as determined by the Security Posture API.",
      "items": {
        "enum": [
          "CATEGORY_UNSPECIFIED",
          "AI",
          "AWS",
          "GCP",
          "AZURE"
        ],
        "type": "string"
      },
      "type": "array"
    },
    "state": {
      "readOnly": true,
      "description": "Output only. The state of the posture template at the specified `revision_id`.",
      "enum": [
        "STATE_UNSPECIFIED",
        "ACTIVE",
        "DEPRECATED"
      ],
      "type": "string"
    },
    "revisionId": {
      "readOnly": true,
      "type": "string",
      "description": "Output only. A string that identifies the revision of the posture template."
    },
    "policySets": {
      "items": {
        "$ref": "#/$defs/PolicySet"
      },
      "description": "Output only. The PolicySet resources that the posture template includes.",
      "readOnly": true,
      "type": "array"
    },
    "name": {
      "readOnly": true,
      "description": "Output only. Identifier. The name of the posture template, in the format `organizations/{organization}/locations/global/postureTemplates/{posture_template}`.",
      "type": "string"
    }
  },
  "$defs": {
    "ComplianceStandard": {
      "type": "object",
      "properties": {
        "control": {
          "type": "string",
          "description": "Optional. The control in the compliance standard that the policy helps enforce. For example, `AC-3`."
        },
        "standard": {
          "description": "Optional. The compliance standard that the policy helps enforce. For example, `NIST SP 800-53`.",
          "type": "string"
        }
      },
      "description": "Information about a compliance standard that the policy helps enforce."
    },
    "Constraint": {
      "properties": {
        "securityHealthAnalyticsCustomModule": {
          "$ref": "#/$defs/SecurityHealthAnalyticsCustomModule",
          "description": "Optional. A custom module for Security Health Analytics."
        },
        "securityHealthAnalyticsModule": {
          "$ref": "#/$defs/SecurityHealthAnalyticsModule",
          "description": "Optional. A built-in detector for Security Health Analytics."
        },
        "orgPolicyConstraint": {
          "$ref": "#/$defs/OrgPolicyConstraint",
          "description": "Optional. A predefined organization policy constraint."
        },
        "orgPolicyConstraintCustom": {
          "$ref": "#/$defs/OrgPolicyConstraintCustom",
          "description": "Optional. A custom organization policy constraint."
        }
      },
      "type": "object",
      "description": "Metadata for a constraint in a Policy."
    },
    "CustomConfig": {
      "description": "A custom module configuration for Security Health Analytics. Use `CustomConfig` to create custom detectors that generate custom findings for resources that you specify.",
      "type": "object",
      "properties": {
        "description": {
          "type": "string",
          "description": "Optional. A description of the vulnerability or misconfiguration that the custom module detects. The description appears in each finding. Provide enough information to help an investigator understand the finding. The value must be enclosed in quotation marks."
        },
        "customOutput": {
          "$ref": "#/$defs/CustomOutputSpec",
          "description": "Optional. Definitions of custom source properties to include in findings."
        },
        "predicate": {
          "$ref": "#/$defs/Expr",
          "description": "Required. The Common Expression Language (CEL) expression to evaluate. When the expression evaluates to `true` for a resource, a finding is generated."
        },
        "recommendation": {
          "type": "string",
          "description": "Required. An explanation of the steps that security teams can take to resolve the detected issue. The explanation appears in each finding."
        },
        "resourceSelector": {
          "$ref": "#/$defs/ResourceSelector",
          "description": "Required. The resource types that the custom module operates on."
        },
        "severity": {
          "description": "Required. The severity of findings generated by the custom module.",
          "enum": [
            "SEVERITY_UNSPECIFIED",
            "CRITICAL",
            "HIGH",
            "MEDIUM",
            "LOW"
          ],
          "type": "string"
        }
      }
    },
    "CustomOutputSpec": {
      "type": "object",
      "properties": {
        "properties": {
          "type": "array",
          "description": "Optional. The custom source properties that can appear in findings.",
          "items": {
            "$ref": "#/$defs/Property"
          }
        }
      },
      "description": "Definitions of custom source properties that can appear in findings."
    },
    "Expr": {
      "properties": {
        "expression": {
          "type": "string",
          "description": "Textual representation of an expression in Common Expression Language syntax."
        },
        "description": {
          "type": "string",
          "description": "Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI."
        },
        "location": {
          "description": "Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.",
          "type": "string"
        },
        "title": {
          "description": "Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.",
          "type": "string"
        }
      },
      "type": "object",
      "description": "Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: \"Summary size limit\" description: \"Determines if a summary is less than 100 chars\" expression: \"document.summary.size() < 100\" Example (Equality): title: \"Requestor is owner\" description: \"Determines if requestor is the document owner\" expression: \"document.owner == request.auth.claims.email\" Example (Logic): title: \"Public documents\" description: \"Determine whether the document should be publicly visible\" expression: \"document.type != 'private' && document.type != 'internal'\" Example (Data Manipulation): title: \"Notification string\" description: \"Create a notification string with a timestamp.\" expression: \"'New message received at ' + string(document.create_time)\" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information."
    },
    "GoogleCloudSecuritypostureV1CustomConstraint": {
      "type": "object",
      "description": "A custom, user-defined constraint. You can apply the constraint only to the resource types specified in the constraint, and only within the organization where the constraint is defined. _When you create a custom constraint, it is not enforced automatically._ You must use an organization policy to [enforce the constraint](https://cloud.google.com/resource-manager/help/organization-policy/constraints/enforce).",
      "properties": {
        "resourceTypes": {
          "items": {
            "type": "string"
          },
          "description": "Immutable. The resource type that the constraint applies to, in the format `{canonical_service_name}/{resource_type_name}`. For example, `compute.googleapis.com/Instance`.",
          "type": "array"
        },
        "methodTypes": {
          "items": {
            "type": "string",
            "enum": [
              "METHOD_TYPE_UNSPECIFIED",
              "CREATE",
              "UPDATE",
              "DELETE"
            ]
          },
          "description": "The types of operations that the constraint applies to.",
          "type": "array"
        },
        "updateTime": {
          "format": "google-datetime",
          "description": "Output only. The last time at which the constraint was updated or created.",
          "type": "string",
          "readOnly": true
        },
        "condition": {
          "type": "string",
          "description": "A Common Expression Language (CEL) condition expression that must evaluate to `true` for the constraint to be enforced. The maximum length is 1000 characters. For example: + `resource.instanceName.matches('(production|test)_(.+_)?[\\d]+')`: Evaluates to `true` if the resource's `instanceName` attribute contains the following: + The prefix `production` or `test` + An underscore (`_`) + Optional: One or more characters, followed by an underscore (`_`) + One or more digits + `resource.management.auto_upgrade == true`: Evaluates to `true` if the resource's `management.auto_upgrade` attribute is `true`."
        },
        "actionType": {
          "enum": [
            "ACTION_TYPE_UNSPECIFIED",
            "ALLOW",
            "DENY"
          ],
          "type": "string",
          "description": "Whether to allow or deny the action."
        },
        "name": {
          "description": "Immutable. The name of the constraint, in the format `organizations/{organization_id}/customConstraints/custom.{custom_constraint_id}`. For example, `organizations/123456789012/customConstraints/custom.createOnlyE2TypeVms`. Must contain 1 to 62 characters, excluding the prefix `organizations/{organization_id}/customConstraints/custom.`.",
          "type": "string"
        },
        "displayName": {
          "description": "A display name for the constraint. The maximum length is 200 characters.",
          "type": "string"
        },
        "description": {
          "description": "A description of the constraint. The maximum length is 2000 characters.",
          "type": "string"
        }
      }
    },
    "GoogleCloudSecuritypostureV1PolicyRule": {
      "properties": {
        "condition": {
          "$ref": "#/$defs/Expr",
          "description": "A condition that determines whether this rule is used to evaluate the policy. When set, the google.type.Expr.expression field must contain 1 to 10 subexpressions, joined by the `||` or `&&` operators. Each subexpression must use the `resource.matchTag()`, `resource.matchTagId()`, `resource.hasTagKey()`, or `resource.hasTagKeyId()` Common Expression Language (CEL) function. The `resource.matchTag()` function takes the following arguments: * `key_name`: the namespaced name of the tag key, with the organization ID and a slash (`/`) as a prefix; for example, `123456789012/environment` * `value_name`: the short name of the tag value For example: `resource.matchTag('123456789012/environment, 'prod')` The `resource.matchTagId()` function takes the following arguments: * `key_id`: the permanent ID of the tag key; for example, `tagKeys/123456789012` * `value_id`: the permanent ID of the tag value; for example, `tagValues/567890123456` For example: `resource.matchTagId('tagKeys/123456789012', 'tagValues/567890123456')` The `resource.hasTagKey()` function takes the following argument: * `key_name`: the namespaced name of the tag key, with the organization ID and a slash (`/`) as a prefix; for example, `123456789012/environment` For example: `resource.hasTagKey('123456789012/environment')` The `resource.hasTagKeyId()` function takes the following arguments: * `key_id`: the permanent ID of the tag key; for example, `tagKeys/123456789012` For example: `resource.hasTagKeyId('tagKeys/123456789012')`"
        },
        "parameters": {
          "additionalProperties": {
            "description": "Properties of the object."
          },
          "type": "object",
          "description": "Optional. Required for managed constraints if parameters are defined. Passes parameter values when policy enforcement is enabled. Ensure that parameter value types match those defined in the constraint definition. For example: ``` { \"allowedLocations\": [\"us-east1\", \"us-west1\"], \"allowAll\": true } ```"
        },
        "values": {
          "$ref": "#/$defs/GoogleCloudSecuritypostureV1PolicyRuleStringValues",
          "description": "The allowed and denied values for a list constraint. Valid only for list constraints."
        },
        "allowAll": {
          "type": "boolean",
          "description": "Whether to allow any value for a list constraint. Valid only for list constraints."
        },
        "denyAll": {
          "description": "Whether to deny all values for a list constraint. Valid only for list constraints.",
          "type": "boolean"
        },
        "enforce": {
          "description": "Whether to enforce the constraint. Valid only for boolean constraints.",
          "type": "boolean"
        },
        "resourceTypes": {
          "$ref": "#/$defs/ResourceTypes",
          "description": "Optional. The resource types policies can support, only used for managed constraints. Method type is `GOVERN_TAGS`."
        }
      },
      "description": "A rule that defines the allowed and denied values for an organization policy constraint.",
      "type": "object"
    },
    "GoogleCloudSecuritypostureV1PolicyRuleStringValues": {
      "description": "The allowed and denied values for a list constraint. For all constraints, these fields can contain literal values. Optionally, you can add the `is:` prefix to these values. If the value contains a colon (`:`), then the `is:` prefix is required. Some constraints allow you to specify a portion of the resource hierarchy, known as a [_hierarchy subtree_](https://cloud.google.com/resource-manager/help/organization-policy/hierarchy-subtree), that the constraint applies to. To specify a hierarchy subtree, use the `under:` prefix, followed by a value with one of these formats: - `projects/{project_id}` (for example, `projects/tokyo-rain-123`) - `folders/{folder_id}` (for example, `folders/1234567890123`) - `organizations/{organization_id}` (for example, `organizations/123456789012`) A constraint's `supports_under` field indicates whether you can specify a hierarchy subtree. To learn which predefined constraints let you specify a hierarchy subtree, see the [constraints reference](https://cloud.google.com/resource-manager/help/organization-policy/constraints/reference).",
      "type": "object",
      "properties": {
        "deniedValues": {
          "items": {
            "type": "string"
          },
          "description": "The denied values for the constraint.",
          "type": "array"
        },
        "allowedValues": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The allowed values for the constraint."
        }
      }
    },
    "OrgPolicyConstraint": {
      "properties": {
        "cannedConstraintId": {
          "description": "Required. A unique identifier for the constraint.",
          "type": "string"
        },
        "policyRules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/GoogleCloudSecuritypostureV1PolicyRule"
          },
          "description": "Required. The rules enforced by the constraint."
        }
      },
      "description": "A predefined organization policy constraint.",
      "type": "object"
    },
    "OrgPolicyConstraintCustom": {
      "description": "A custom organization policy constraint.",
      "properties": {
        "customConstraint": {
          "$ref": "#/$defs/GoogleCloudSecuritypostureV1CustomConstraint",
          "description": "Required. Metadata for the constraint."
        },
        "policyRules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/GoogleCloudSecuritypostureV1PolicyRule"
          },
          "description": "Required. The rules enforced by the constraint."
        }
      },
      "type": "object"
    },
    "Policy": {
      "description": "The details of a policy, including the constraints that it includes.",
      "type": "object",
      "properties": {
        "policyId": {
          "description": "Required. A user-specified identifier for the policy. In a PolicySet, each policy must have a unique identifier.",
          "type": "string"
        },
        "constraint": {
          "$ref": "#/$defs/Constraint",
          "description": "Required. The constraints that the policy includes."
        },
        "complianceStandards": {
          "description": "Optional. The compliance standards that the policy helps enforce.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/ComplianceStandard"
          }
        },
        "description": {
          "type": "string",
          "description": "Optional. A description of the policy."
        }
      }
    },
    "PolicySet": {
      "properties": {
        "description": {
          "type": "string",
          "description": "Optional. A description of the policy set."
        },
        "policies": {
          "items": {
            "$ref": "#/$defs/Policy"
          },
          "description": "Required. The Policy resources in the policy set. Each policy must have a policy_id that's unique within the policy set.",
          "type": "array"
        },
        "policySetId": {
          "type": "string",
          "description": "Required. An identifier for the policy set."
        }
      },
      "type": "object",
      "description": "A group of one or more Policy resources."
    },
    "Property": {
      "type": "object",
      "description": "A name-value pair used as a custom source property.",
      "properties": {
        "name": {
          "description": "Required. The name of the custom source property.",
          "type": "string"
        },
        "valueExpression": {
          "$ref": "#/$defs/Expr",
          "description": "Optional. The CEL expression for the value of the custom source property. For resource properties, you can return the value of the property or a string enclosed in quotation marks."
        }
      }
    },
    "ResourceSelector": {
      "type": "object",
      "properties": {
        "resourceTypes": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Required. The resource types to run the detector on. Each custom module can specify up to 5 resource types."
        }
      },
      "description": "A selector for the resource types to run the detector on."
    },
    "ResourceTypes": {
      "properties": {
        "included": {
          "type": "array",
          "description": "Optional. The resource types we support.",
          "items": {
            "type": "string"
          }
        }
      },
      "type": "object",
      "description": "Set multiple resource types for one policy, for example: ``` resourceTypes: included: - compute.googleapis.com/Instance - compute.googleapis.com/Disk ``` Constraint definition contains an empty resource type in order to support multiple resource types in the policy. Only supports managed constraints. Method type is `GOVERN_TAGS`."
    },
    "SecurityHealthAnalyticsCustomModule": {
      "type": "object",
      "description": "A custom module for Security Health Analytics.",
      "properties": {
        "id": {
          "type": "string",
          "readOnly": true,
          "description": "Output only. Immutable. The unique identifier for the custom module. Contains 1 to 20 digits."
        },
        "displayName": {
          "description": "Optional. The display name of the custom module. This value is used as the finding category for all the asset violation findings that the custom module returns. The display name must contain between 1 and 128 alphanumeric characters or underscores, and it must start with a lowercase letter.",
          "type": "string"
        },
        "config": {
          "$ref": "#/$defs/CustomConfig",
          "description": "Required. Configuration settings for the custom module."
        },
        "moduleEnablementState": {
          "type": "string",
          "description": "Whether the custom module is enabled at a specified level of the resource hierarchy.",
          "enum": [
            "ENABLEMENT_STATE_UNSPECIFIED",
            "ENABLED",
            "DISABLED"
          ]
        }
      }
    },
    "SecurityHealthAnalyticsModule": {
      "type": "object",
      "description": "A built-in detector for Security Health Analytics.",
      "properties": {
        "moduleName": {
          "type": "string",
          "description": "Required. The name of the detector. For example, `BIGQUERY_TABLE_CMEK_DISABLED`. This field is also used as the finding category for all the asset violation findings that the detector returns."
        },
        "moduleEnablementState": {
          "enum": [
            "ENABLEMENT_STATE_UNSPECIFIED",
            "ENABLED",
            "DISABLED"
          ],
          "type": "string",
          "description": "Whether the detector is enabled at a specified level of the resource hierarchy."
        }
      }
    }
  }
}