• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference 2.0
  4. Kubernetes API
  5. ConfigMap
  6. Creating a ConfigMap

Creating a ConfigMap

Function

This API is used to create a ConfigMap resource object.

URI

POST /api/v1/namespaces/{namespace}/configmaps

Table 1 describes the parameters of this API.

Table 1 Parameter description

Parameter

Mandatory

Description

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:

Table 2 Request parameter

Parameter

Mandatory

Type

Description

apiVersion

Yes

String

APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.

kind

Yes

String

Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated.

metadata

Yes

3.1 Table11 Data structure of the metadata field

Standard list metadata.

data

Yes

Object

Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'.

Example request:

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

Response

Response parameters:

For the description about response parameters, see Table 2

Example response:

{
    "kind": "ConfigMap",
    "apiVersion": "v1",
    "metadata": {
        "name": "test-12130306",
        "namespace": "ns-12130306-s",
        "selfLink": "/api/v1/namespaces/ns-12130306-s/configmaps/test-12130306",
        "uid": "efd6d9e0-dfb3-11e7-9c19-fa163e2d897b",
        "resourceVersion": "419081",
        "creationTimestamp": "2017-12-13T03:15:57Z",
        "enable": true
    },
    "data": {
        "property_1": "test"
    }
}

Status Code

Table 3 describes the status code of this API.

Table 3 Status code

Status Code

Description

201

The request has been fulfilled, resulting in the creation of a new resource.

For the description about status codes, see Status Codes.