UpdateEnv - Update environment

Updated at:

Applicable versions

Central version, Region version

Endpoint and authorization information

  • Get the endpoint: Replace {domain} in the API request syntax.

  • Get a personal access token.

  • Get organizationId: Required for Central version only. Go to the Basic Information page in the Organization Management console to obtain your organization ID.

Product

Resource

Required permission

Application Delivery

Environment

Read and write

Request syntax

Central version

PUT https://{domain}/oapi/v1/appstack/organizations/{organizationId}/apps/{appName}/envs/{envName}

Region version

PUT https://{domain}/oapi/v1/appstack/apps/{appName}/envs/{envName}

Request headers

Parameter

Type

Required

Description

Example

x-yunxiao-token

string

Yes

Personal access token.

pt-0fh3****0fbG_35af****0484

Request parameters

Parameter

Type

Location

Required

Description

Example

appName

string

path

Yes

Application name.

my-web-service

envName

string

path

Yes

Environment name.

dev

organizationId

string

path

  • Yes: Central version

  • No: Region version

Organization ID.

ec766e63aee3437d9a51f334d6exe671

-

object

body

No

Update environment request.

deployGroupName

string

body

No

Deployment group name.

deploy-group-name

description

string

body

No

Environment description.

description

displayName

string

body

No

Environment display name.

display-name

labelList

array

body

No

List of tags.

-

object

body

No

AppStack tag.

displayName

string

body

No

Tag display name. Used for descriptive purposes only and not used in tag matching.

Test tag key

displayValue

string

body

No

Tag display value. Used for descriptive purposes only and not used in tag matching.

Test tag value

extraMap

object

body

No

Map of tag extension properties. You can use this to store custom extension fields when defining a tag.

{}

name

string

body

No

Tag name. Must contain only lowercase letters, hyphens, and digits, and must start and end with a lowercase letter or digit.

demo-label

namespace

string

body

No

Tag namespace. Determines the scope of the tag.

default

value

string

body

No

Tag value. Must contain only lowercase letters, hyphens, and digits, and must start and end with a lowercase letter or digit.

demo-label-value

orchestrationName

string

body

No

Environment orchestration name.

orchestration-name

profiles

array

body

No

List of variable groups.

-

object

body

No

Generic variable group model.

displayName

string

body

No

Variable group display name.

Development variable group

name

string

body

No

Variable group identifier.

dev

type

string

body

No

Variable group type.

GLOBAL

replicasManagement

string

body

No

Replica count control mode. Possible values: [SYSTEM USER].

SYSTEM

resourceType

string

body

Yes

Resource type. Possible values: [KUBERNETES HOST BePending].

KUBERNETES

rolloutStrategies

array

body

No

List of deployment strategies.

-

object

body

No

Deployment strategy.

batchMode

string

body

No

Batch mode. Possible values: [ConfirmFirstBatch Auto Manual].

ConfirmFirstBatch

batchSteps

array

body

No

List of batch details.

-

object

body

No

Batch detail.

type

string

body

Yes

Batch type. Possible values: [WEIGHT REPLICAS].

WEIGHT

value

string

body

Yes

Batch value.

90

batches

string

body

No

Number of batches.

2

deployType

string

body

No

Deployment type. Possible values: [Rolling Batch Recreate].

Batch

locator

string

body

Yes

Deployment resource coordinate.

aaa.bbb.ccc

targetReplicas

number

body

No

Target replica count.

3

timeOutMS

number

body

No

Timeout duration.

60000

status

string

body

No

Status.

SUCCESS

Request examples

Central version

curl -X 'PUT' \
  'https://{domain}/oapi/v1/appstack/organizations/ec766e63aee3437d9a51f334d6exe671/apps/my-web-service/envs/dev' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "deployGroupName": "deploy-group-name",
        "description": "description",
        "displayName": "display-name",
        "labelList": [
            {
                "displayName": "Test tag key",
                "displayValue": "Test tag value",
                "extraMap": {},
                "name": "demo-label",
                "namespace": "default",
                "value": "demo-label-value"
            }
        ],
        "orchestrationName": "orchestration-name",
        "profiles": [
            {
                "displayName": "Development variable group",
                "name": "dev",
                "type": "GLOBAL"
            }
        ],
        "replicasManagement": "SYSTEM",
        "resourceType": "KUBERNETES",
        "rolloutStrategies": [
            {
                "batchMode": "ConfirmFirstBatch",
                "batchSteps": [
                    {
                        "type": "WEIGHT",
                        "value": "90"
                    }
                ],
                "batches": "2",
                "deployType": "Batch",
                "locator": "aaa.bbb.ccc",
                "targetReplicas": 3,
                "timeOutMS": 60000
            }
        ],
        "status": "SUCCESS"
    }'

Region version

curl -X 'PUT' \
  'https://{domain}/oapi/v1/appstack/apps/my-web-service/envs/dev' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "deployGroupName": "deploy-group-name",
        "description": "description",
        "displayName": "display-name",
        "labelList": [
            {
                "displayName": "Test tag key",
                "displayValue": "Test tag value",
                "extraMap": {},
                "name": "demo-label",
                "namespace": "default",
                "value": "demo-label-value"
            }
        ],
        "orchestrationName": "orchestration-name",
        "profiles": [
            {
                "displayName": "Development variable group",
                "name": "dev",
                "type": "GLOBAL"
            }
        ],
        "replicasManagement": "SYSTEM",
        "resourceType": "KUBERNETES",
        "rolloutStrategies": [
            {
                "batchMode": "ConfirmFirstBatch",
                "batchSteps": [
                    {
                        "type": "WEIGHT",
                        "value": "90"
                    }
                ],
                "batches": "2",
                "deployType": "Batch",
                "locator": "aaa.bbb.ccc",
                "targetReplicas": 3,
                "timeOutMS": 60000
            }
        ],
        "status": "SUCCESS"
    }'

Response parameters

Parameter

Type

Description

Example

-

object

AppStack environment model.

appName

string

Unique name of the application to which the environment belongs.

my-web-service

creatorId

string

User ID of the environment creator.

bd9e3c6d-624f-4580-af7d-c5e26f1ed0f0

deployGroupName

string

Unique name of the deployment group.

k8s-dev

description

string

Environment description.

This is a development environment for demonstration purposes.

descriptiveName

string

Environment display name.

Staging environment

gmtCreate

string

Environment creation time.

2024-09-01 00:00:00

labelList

array

List of tags.

-

object

AppStack tag.

displayName

string

Tag display name. Used for descriptive purposes only and not used in tag matching.

Test tag key

displayValue

string

Tag display value. Used for descriptive purposes only and not used in tag matching.

Test tag value

extraMap

object

Map of tag extension properties. You can use this to store custom extension fields when defining a tag.

{}

name

string

Tag name. Must contain only lowercase letters, hyphens, and digits, and must start and end with a lowercase letter or digit.

demo-label

namespace

string

Tag namespace. Determines the scope of the tag.

default

value

string

Tag value. Must contain only lowercase letters, hyphens, and digits, and must start and end with a lowercase letter or digit.

demo-label-value

lockBy

string

User ID of the user currently locking the environment.

bd9e3c6d-624f-4580-af7d-c5e26f1ed0f0

name

string

Unique environment name. Must contain only lowercase letters, hyphens, and digits, and must start and end with a lowercase letter or digit.

dev

replicasManagement

string

Replica management mode.

USER

resourcePoolName

string

Unique name of the resource pool.

default

rolloutStrategies

array

Deployment strategies.

-

object

Deployment strategy.

batchMode

string

Batch mode. Possible values: [ConfirmFirstBatch Auto Manual].

ConfirmFirstBatch

batchSteps

array

List of batch details.

-

object

Batch detail.

type

string

Batch type. Possible values: [WEIGHT REPLICAS].

WEIGHT

value

string

Batch value.

90

batches

string

Number of batches.

2

deployType

string

Deployment type. Possible values: [Rolling Batch Recreate].

Batch

locator

string

Deployment resource coordinate.

aaa.bbb.ccc

targetReplicas

number

Target replica count.

3

timeOutMS

number

Timeout duration.

60000

state

string

Environment state. Possible values: [NEW DEPLOYING RUNNING ERROR].

my-web-service

variableGroupName

string

Unique name of the variable group.

dev

variableGroups

array

Variable groups.

-

object

Generic variable group model.

displayName

string

Variable group display name.

Development variable group

name

string

Variable group identifier.

dev

type

string

Variable group type.

GLOBAL

Response example

{
    "appName": "my-web-service",
    "creatorId": "bd9e3c6d-624f-4580-af7d-c5e26f1ed0f0",
    "deployGroupName": "k8s-dev",
    "description": "This is a development environment for demonstration purposes.",
    "descriptiveName": "Staging environment",
    "gmtCreate": "2024-09-01 00:00:00",
    "labelList": [
        {
            "displayName": "Test tag key",
            "displayValue": "Test tag value",
            "extraMap": {},
            "name": "demo-label",
            "namespace": "default",
            "value": "demo-label-value"
        }
    ],
    "lockBy": "bd9e3c6d-624f-4580-af7d-c5e26f1ed0f0",
    "name": "dev",
    "replicasManagement": "USER",
    "resourcePoolName": "default",
    "rolloutStrategies": [
        {
            "batchMode": "ConfirmFirstBatch",
            "batchSteps": [
                {
                    "type": "WEIGHT",
                    "value": "90"
                }
            ],
            "batches": "2",
            "deployType": "Batch",
            "locator": "aaa.bbb.ccc",
            "targetReplicas": 3,
            "timeOutMS": 60000
        }
    ],
    "state": "my-web-service",
    "variableGroupName": "dev",
    "variableGroups": [
        {
            "displayName": "Development variable group",
            "name": "dev",
            "type": "GLOBAL"
        }
    ]
}

Error codes

Visit the Error Code Center to view API-related error codes.