Skip to main content
POST
/
v1
/
projects
/
{project}
/
databaseGroups
cURL
curl --request POST \
  --url https://api.example.com/v1/projects/{project}/databaseGroups \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "<string>",
  "name": "<string>",
  "databaseExpr": {
    "id": "<string>",
    "constExpr": {
      "nullValue": "NULL_VALUE",
      "boolValue": true,
      "int64Value": "<string>",
      "uint64Value": "<string>",
      "doubleValue": 123,
      "stringValue": "<string>",
      "bytesValue": "<string>",
      "durationValue": "<string>",
      "timestampValue": "2023-11-07T05:31:56Z"
    },
    "identExpr": {
      "name": "<string>"
    },
    "selectExpr": {
      "operand": "<unknown>",
      "field": "<string>",
      "testOnly": true
    },
    "callExpr": {
      "target": "<unknown>",
      "function": "<string>",
      "args": "<array>"
    },
    "listExpr": {
      "elements": "<array>",
      "optionalIndices": [
        123
      ]
    },
    "structExpr": {
      "messageName": "<string>",
      "entries": [
        {
          "id": "<string>",
          "fieldKey": "<string>",
          "mapKey": "<unknown>",
          "value": "<unknown>",
          "optionalEntry": true
        }
      ]
    },
    "comprehensionExpr": {
      "iterVar": "<string>",
      "iterVar2": "<string>",
      "iterRange": "<unknown>",
      "accuVar": "<string>",
      "accuInit": "<unknown>",
      "loopCondition": "<unknown>",
      "loopStep": "<unknown>",
      "result": "<unknown>"
    }
  }
}
'
{
  "title": "<string>",
  "name": "<string>",
  "databaseExpr": {
    "id": "<string>",
    "constExpr": {
      "nullValue": "NULL_VALUE",
      "boolValue": true,
      "int64Value": "<string>",
      "uint64Value": "<string>",
      "doubleValue": 123,
      "stringValue": "<string>",
      "bytesValue": "<string>",
      "durationValue": "<string>",
      "timestampValue": "2023-11-07T05:31:56Z"
    },
    "identExpr": {
      "name": "<string>"
    },
    "selectExpr": {
      "operand": "<unknown>",
      "field": "<string>",
      "testOnly": true
    },
    "callExpr": {
      "target": "<unknown>",
      "function": "<string>",
      "args": "<array>"
    },
    "listExpr": {
      "elements": "<array>",
      "optionalIndices": [
        123
      ]
    },
    "structExpr": {
      "messageName": "<string>",
      "entries": [
        {
          "id": "<string>",
          "fieldKey": "<string>",
          "mapKey": "<unknown>",
          "value": "<unknown>",
          "optionalEntry": true
        }
      ]
    },
    "comprehensionExpr": {
      "iterVar": "<string>",
      "iterVar2": "<string>",
      "iterRange": "<unknown>",
      "accuVar": "<string>",
      "accuInit": "<unknown>",
      "loopCondition": "<unknown>",
      "loopStep": "<unknown>",
      "result": "<unknown>"
    }
  },
  "matchedDatabases": [
    {
      "name": "<string>"
    }
  ]
}

Path Parameters

project
string
required

The project id.

Query Parameters

databaseGroupId
string

The ID to use for the database group, which will become the final component of the database group's resource name.

This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.

validateOnly
boolean

If set, validate the create request and preview the full database group response, but do not actually create it.

Body

application/json

A group of databases matched by expressions.

title
string
required

The short name used in actual databases specified by users.

name
string

The name of the database group. Format: projects/{project}/databaseGroups/{databaseGroup}

databaseExpr
object

The condition that is associated with this database group. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec

Support variables: resource.environment_id: the environment resource id. Support "==", "!=", "in [XX]", "!(in [xx])" operations. resource.instance_id: the instance resource id. Support "==", "!=", "in [XX]", "!(in [xx])", "contains", "matches", "startsWith", "endsWith" operations. resource.database_name: the database name. Support "==", "!=", "in [XX]", "!(in [xx])", "contains", "matches", "startsWith", "endsWith" operations. resource.database_labels: the database labels. Support map access operations. All variables should join with "&&" condition.

For example: resource.environment_id == "test" && resource.database_name.startsWith("sample_") resource.database_labels["tenant"] == "tenant1"

Response

OK

A group of databases matched by expressions.

title
string
required

The short name used in actual databases specified by users.

name
string

The name of the database group. Format: projects/{project}/databaseGroups/{databaseGroup}

databaseExpr
object

The condition that is associated with this database group. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec

Support variables: resource.environment_id: the environment resource id. Support "==", "!=", "in [XX]", "!(in [xx])" operations. resource.instance_id: the instance resource id. Support "==", "!=", "in [XX]", "!(in [xx])", "contains", "matches", "startsWith", "endsWith" operations. resource.database_name: the database name. Support "==", "!=", "in [XX]", "!(in [xx])", "contains", "matches", "startsWith", "endsWith" operations. resource.database_labels: the database labels. Support map access operations. All variables should join with "&&" condition.

For example: resource.environment_id == "test" && resource.database_name.startsWith("sample_") resource.database_labels["tenant"] == "tenant1"

matchedDatabases
object[]

The list of databases that match the database group condition.