# Update

Launch stage: GA

`PATCH /api/2.0/postgres/{branch.name=projects/*/branches/*}`

Updates the specified database branch. You can set this branch as the project's default branch, or protect/unprotect it.

API scopes: postgres

## Path parameters

- `branch` (object, optional)
  The Branch to update.
  
   The branch's `name` field is used to identify the branch to update.
   Format: projects/{project_id}/branches/{branch_id}
  - `name` (string, optional)
    Output only. The full resource path of the branch.
     Format: projects/{project_id}/branches/{branch_id}
  - `uid` (string, optional)
    System-generated unique ID for the branch.
  - `parent` (string, optional)
    The project containing this branch (API resource hierarchy).
     Format: projects/{project_id}
    
     Note: This field indicates where the branch exists in the resource hierarchy.
     For point-in-time branching from another branch, see `status.source_branch`.
  - `create_time` (string, optional)
    A timestamp indicating when the branch was created.
  - `update_time` (string, optional)
    A timestamp indicating when the branch was last updated.
  - `spec` (object, optional)
    The spec contains the branch configuration.
    - `source_branch` (string, optional)
      The name of the source branch from which this branch was created (data lineage for point-in-time recovery).
       If not specified, defaults to the project's default branch.
       Format: projects/{project_id}/branches/{branch_id}
    - `source_branch_lsn` (string, optional)
      The Log Sequence Number (LSN) on the source branch from which this branch was created.
    - `source_branch_time` (string, optional)
      The point in time on the source branch from which this branch was created.
    - `is_protected` (boolean, optional)
      When set to true, protects the branch from deletion and reset. Associated compute endpoints and the project cannot be deleted while the branch is protected.
    - `expire_time` (string, required)
      Absolute expiration timestamp. When set, the branch will expire at this time.
       Mutually exclusive with `ttl` and `no_expiry`. When updating, use `spec.expiration` in the update_mask.
    - `ttl` (string, required)
      Relative time-to-live duration. When set, the branch will expire at creation_time + ttl.
       Mutually exclusive with `expire_time` and `no_expiry`. When updating, use `spec.expiration` in the update_mask.
    - `no_expiry` (boolean, required)
      Explicitly disable expiration. When set to true, the branch will not expire.
       If set to false, the request is invalid; provide either ttl or expire_time instead.
       Mutually exclusive with `expire_time` and `ttl`. When updating, use `spec.expiration` in the update_mask.
  - `status` (object, optional)
    The current status of a Branch.
    - `source_branch` (string, optional)
      The name of the source branch from which this branch was created.
       Format: projects/{project_id}/branches/{branch_id}
    - `source_branch_lsn` (string, optional)
      The Log Sequence Number (LSN) on the source branch from which this branch was created.
    - `source_branch_time` (string, optional)
      The point in time on the source branch from which this branch was created.
    - `default` (boolean, optional)
      Whether the branch is the project's default branch.
    - `is_protected` (boolean, optional)
      Whether the branch is protected.
    - `current_state` (string, optional)
      The branch's state, indicating if it is initializing, ready for use, or archived.
      Possible values: `STATE_UNSPECIFIED`, `INIT`, `IMPORTING`, `RESETTING`, `READY`, `ARCHIVED`
    - `pending_state` (string, optional)
      The pending state of the branch, if a state transition is in progress.
      Possible values: `STATE_UNSPECIFIED`, `INIT`, `IMPORTING`, `RESETTING`, `READY`, `ARCHIVED`
    - `state_change_time` (string, optional)
      A timestamp indicating when the `current_state` began.
    - `logical_size_bytes` (int64, optional)
      The logical size of the branch.
    - `expire_time` (string, optional)
      Absolute expiration time for the branch. Empty if expiration is disabled.
    - `branch_id` (string, optional)
      Part of the resource name.
  - `branch_id` (string, optional)
    The part of the name, chosen by the user when the resource was created.

## Query parameters

- `update_mask` (string, optional)
  The list of fields to update.

## Returns

- `name` (string, optional)
  The server-assigned name, which is only unique within the same service that
   originally returns it. If you use the default HTTP mapping, the
   `name` should be a resource name ending with `operations/{unique_id}`.
- `metadata` (object, optional)
  Service-specific metadata associated with the operation.  It typically
   contains progress information and common metadata such as create time.
   Some services might not provide such metadata.
- `done` (boolean, optional)
  If the value is `false`, it means the operation is still in progress.
   If `true`, the operation is completed, and either `error` or `response` is
   available.
- `error` (object, required)
  The error result of the operation in case of failure or cancellation.
  - `error_code` (string, optional)
    Possible values: `UNKNOWN`, `INTERNAL_ERROR`, `TEMPORARILY_UNAVAILABLE`, `IO_ERROR`, `BAD_REQUEST`, `SERVICE_UNDER_MAINTENANCE`, `WORKSPACE_TEMPORARILY_UNAVAILABLE`, `DEADLINE_EXCEEDED`, `CANCELLED`, `RESOURCE_EXHAUSTED`, `ABORTED`, `NOT_FOUND`, `ALREADY_EXISTS`, `UNAUTHENTICATED`, `UNAVAILABLE`, `INVALID_PARAMETER_VALUE`, `ENDPOINT_NOT_FOUND`, `MALFORMED_REQUEST`, `INVALID_STATE`, `PERMISSION_DENIED`, `FEATURE_DISABLED`, `CUSTOMER_UNAUTHORIZED`, `REQUEST_LIMIT_EXCEEDED`, `RESOURCE_CONFLICT`, `UNPARSEABLE_HTTP_ERROR`, `NOT_IMPLEMENTED`, `DATA_LOSS`, `INVALID_STATE_TRANSITION`, `COULD_NOT_ACQUIRE_LOCK`, `RESOURCE_ALREADY_EXISTS`, `RESOURCE_DOES_NOT_EXIST`, `QUOTA_EXCEEDED`, `MAX_BLOCK_SIZE_EXCEEDED`, `MAX_READ_SIZE_EXCEEDED`, `PARTIAL_DELETE`, `MAX_LIST_SIZE_EXCEEDED`, `DRY_RUN_FAILED`, `RESOURCE_LIMIT_EXCEEDED`, `DIRECTORY_NOT_EMPTY`, `DIRECTORY_PROTECTED`, `MAX_NOTEBOOK_SIZE_EXCEEDED`, `MAX_CHILD_NODE_SIZE_EXCEEDED`, `SEARCH_QUERY_TOO_LONG`, `SEARCH_QUERY_TOO_SHORT`, `MANAGED_RESOURCE_GROUP_DOES_NOT_EXIST`, `PERMISSION_NOT_PROPAGATED`, `DEPLOYMENT_TIMEOUT`, `GIT_CONFLICT`, `GIT_UNKNOWN_REF`, `GIT_SENSITIVE_TOKEN_DETECTED`, `GIT_URL_NOT_ON_ALLOW_LIST`, `GIT_REMOTE_ERROR`, `PROJECTS_OPERATION_TIMEOUT`, `IPYNB_FILE_IN_REPO`, `INSECURE_PARTNER_RESPONSE`, `MALFORMED_PARTNER_RESPONSE`, `METASTORE_DOES_NOT_EXIST`, `DAC_DOES_NOT_EXIST`, `CATALOG_DOES_NOT_EXIST`, `SCHEMA_DOES_NOT_EXIST`, `TABLE_DOES_NOT_EXIST`, `SHARE_DOES_NOT_EXIST`, `RECIPIENT_DOES_NOT_EXIST`, `STORAGE_CREDENTIAL_DOES_NOT_EXIST`, `EXTERNAL_LOCATION_DOES_NOT_EXIST`, `PRINCIPAL_DOES_NOT_EXIST`, `PROVIDER_DOES_NOT_EXIST`, `METASTORE_ALREADY_EXISTS`, `DAC_ALREADY_EXISTS`, `CATALOG_ALREADY_EXISTS`, `SCHEMA_ALREADY_EXISTS`, `TABLE_ALREADY_EXISTS`, `SHARE_ALREADY_EXISTS`, `RECIPIENT_ALREADY_EXISTS`, `STORAGE_CREDENTIAL_ALREADY_EXISTS`, `EXTERNAL_LOCATION_ALREADY_EXISTS`, `PROVIDER_ALREADY_EXISTS`, `CATALOG_NOT_EMPTY`, `SCHEMA_NOT_EMPTY`, `METASTORE_NOT_EMPTY`, `PROVIDER_SHARE_NOT_ACCESSIBLE`
  - `message` (string, optional)
  - `stack_trace` (string, optional)
  - `details` (array of object, optional)
- `response` (object, required)
  The normal, successful response of the operation.

## Response

```json
{
  "name": "string",
  "metadata": {},
  "done": true,
  "error": {
    "error_code": "string",
    "message": "string",
    "stack_trace": "string",
    "details": [
      {}
    ]
  },
  "response": {}
}
```

