• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference 2.0
  4. Kubernetes API
  5. PersistentVolumeClaim
  6. Replacing a Specified PersistentVolumeClaim

Replacing a Specified PersistentVolumeClaim

Function

This API is used to replace a PersistentVolumeClaim object under a specified Namespace.

The following fields can be updated:

  • metadata.labels
  • metadata.generateName

URI

PUT /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 request parameters, see Table 2

Example request:

{
    "apiVersion": "v1",
    "kind": "PersistentVolumeClaim",
    "metadata": {
        "labels": {
            "app": "mysql"
        },
        "name": "db-mysql-0",
        "namespace": "default"
    },
    "spec": {
        "accessModes": [
            "ReadWriteMany"
        ],
        "volumeName": "pv-test2",
        "resources": {
            "requests": {
                "storage": "1Gi"
            }
        }
    },
    "status": {
        "phase": "Pending"
    }
}

Response

Response parameters:

For the description about response parameters, see the parameter description in 14.2-Table2 Request parameters.

Example response:

{
  "kind": "PersistentVolumeClaim",
  "apiVersion": "v1",
  "metadata": {
    "name": "db-mysql-0",
    "namespace": "default",
    "selfLink": "/api/v1/namespaces/default/persistentvolumeclaims/db-mysql-0",
    "uid": "1689b402-24da-11e7-9c83-fa163ec08232",
    "resourceVersion": "1919894",
    "creationTimestamp": "2017-04-19T08:27:55Z",
    "labels": {
      "app": "mysql"
    }
  },
  "spec": {
    "accessModes": [
      "ReadWriteMany"
    ],
    "resources": {
      "requests": {
        "storage": "1Gi"
      }
    },
    "volumeName": "pv-test2"
  },
  "status": {
    "phase": "Pending"
  }
}

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.