Replacing a ConfigMap

Function

This API is used to replace a specified configMap.

The following fields can be updated:

  • metadata.labels
  • metadata.annotations
  • data

URI

PUT /api/v1/namespaces/{namespace}/configmaps/{name}

Table 1 Path parameters

Parameter

Description

namespace

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

name

Name of the ConfigMap.

Table 2 Query parameter

Parameter

Mandatory

Description

pretty

No

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

Request

Request parameters

For the description about request parameters, see Table 121.

Example request

Change the property_1 of the configMap created in Creating a ConfigMap to test2.

{
    "apiVersion": "v1",
    "data": {
        "property_1": "test2"
    },
    "kind": "ConfigMap",
    "metadata": {
        "name": "configmap-test"
    }
}

Response

Response parameters

For the description about response parameters, see Table 121.

Example response

{
    "kind": "ConfigMap",
    "apiVersion": "v1",
    "metadata": {
        "name": "configmap-test",
        "namespace": "namespace-test",
        "selfLink": "/api/v1/namespaces/namespace-test/configmaps/configmap-test",
        "uid": "379519a3-aff0-11e8-8f17-c81fbe371a17",
        "resourceVersion": "5172849",
        "creationTimestamp": "2018-09-04T03:11:29Z",
        "enable": true
    },
    "data": {
        "property_1": "test2"
    }
}

Status Codes

Table 3 describes the status codes of this API.

Table 3 Status codes

Status Code

Description

200

This operation succeeds.

For more status codes, see Status Codes.