• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference
  4. PersistentVolumeClaim (Native Kubernetes APIs)
  5. Partially Updating a Specified PersistentVolumeClaim

Partially Updating a Specified PersistentVolumeClaim

Function

This API is used to update a PersistentVolumeClaim object.

The following fields can be updated:

  • metadata.labels
  • metadata.generateName

URI

PATCH /api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}

Table 1 describes the parameters of this API.

Table 1 Parameter description

Parameter

Mandatory

Description

name

Yes

Name of the PersistentVolumeClaim.

namespace

Yes

Object name and auth scope, such as for teams and projects.

pretty

No

If 'true', then the output is pretty printed.

Request

Request parameters:

For the description about the parameters message header, see section Patch Request Method Operation Description.

Example request:

Content-Type: application/merge-patch+json
{
    "metadata": {
        "labels": {
            "app": "pvc-lables"
        }
    }
}

Response

Response parameters:

For the description about response parameters, see the parameter description in Table 2.

Example response:

{
    "kind": "PersistentVolumeClaim",
    "apiVersion": "v1",
    "metadata": {
        "name": "db-number-2",
        "namespace": "default",
        "selfLink": "/api/v1/namespaces/default/persistentvolumeclaims/db-number-2",
        "uid": "ce51d5fb-2a5c-11e7-a2a3-fa163e3a4289",
        "resourceVersion": "1397068",
        "creationTimestamp": "2017-04-26T08:46:14Z",
        "labels": {
            "app": "pvc-lables"
        },
        "annotations": {
            "pv.kubernetes.io/bind-completed": "yes",
            "pv.kubernetes.io/bound-by-controller": "yes"
        }
    },
    "spec": {
        "accessModes": [
            "ReadWriteOnce"
        ],
        "resources": {
            "limits": {
                "cpu": "-199G"
            },
            "requests": {
                "storage": "1Gi"
            }
        },
        "volumeName": "pv-test3"
    },
    "status": {
        "phase": "Bound",
        "accessModes": [
            "ReadWriteOnce"
        ],
        "capacity": {
            "storage": "1Gi"
        }
    }
}

Status Code

Table 2 describes the status code of this API.

Table 2 Status code

Status Code

Description

200

This operation succeeds, and a PersistentVolumeClaim resource object is returned.

For the description about status codes, see Status Codes.