Updated on 2024-12-16 GMT+08:00

Creating a Configuration File

Function

This API is used to create a configuration file.

URI

POST /v3/{project_id}/cas/configs

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Tenant's project ID. See Obtaining a Project ID.

Request

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format). Default value: application/json;charset=utf8.

X-Auth-Token

Yes

String

API calling can be authenticated using a token or AK/SK. If you use a token, this parameter is mandatory and must be set to the token. For details about how to obtain the token, see Authentication.

Table 3 Request body parameter

Parameter

Mandatory

Type

Description

config_group_id

Yes

String

Configuration group ID.

name

Yes

String

Configuration file name.

The value contains 2 to 64 characters consisting of letters, digits, hyphens (-), and underscores (_). It starts with a letter and ends with a letter or digit.

content

Yes

String

Configuration file content.

description

No

String

Configuration file description. The value can contain up to 128 characters.

type

Yes

String

Configuration file format.

  • yaml
  • properties

sensitive

Yes

Boolean

Whether to encrypt the configuration file.

  • true: Encrypt.
  • false: Not encrypt.

Response

Table 4 Response parameters

Parameter

Type

Description

id

String

Configuration file ID.

name

String

Configuration file name.

description

String

Configuration description.

creator

String

Creator.

project_id

String

Project ID.

type

String

Configuration file format.

  • yaml
  • properties

sensitive

Boolean

Whether to encrypt the configuration file.

  • true: Encrypt.
  • false: Not encrypt.

components

Array of objects

Component to which the configuration file is bound. See Table 5.

create_time

Integer

Creation time.

update_time

Integer

Update time.

Table 5 components

Parameter

Type

Description

application_id

String

Application ID.

component_id

String

Component ID.

component_name

String

Component name.

environment_id

String

Environment ID.

Example Request

Create a configuration file named test-config. Do not encrypt the content and set the file format to properties.

{
	"config_group_id": "f3e6d5b4-4d7d-4009-b806-22cfed2ac6ea",
	"name": "test-config",
	"description": "",
	"type": "properties",
	"content": "test-key = test-value",
	"sensitive": false
}

Example Response

{
	"id": "d5821100-9a82-4d1c-9468-fc6b2b9ccdad",
	"config_group_id": "f3e6d5b4-4d7d-4009-b806-22cfed2ac6ea",
	"name": "test-config",
	"description": "",
	"type": "properties",
	"content": "testkey = testvalue",
	"version": "v1",
	"project_id": "2cfeefc3e4c54a5aa7548b8350e638d7",
	"sensitive": false,
	"create_time": 1717485580152,
	"update_time": 1717485580152,
	"components": [],
	"creator": "ss-test"
}

Status Code

Status Code

Description

200

OK

400

Bad Request

404

Not Found

500

Internal Server Error

Error Code

The error code format is SVCSTG.00100.[Error_ID], for example, SVCSTG.00100400. For details, see ServiceStage Error Codes.