LockEnv - Lock an environment

Updated at:

Applicable editions

Centralized Edition, Region Edition

Prerequisites

Product

Resource

Required permissions

Application Delivery

environment

Read and write

Request syntax

Centralized edition

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

Region edition

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

Request header

Parameter

Type

Required

Description

Example

x-yunxiao-token

string

Yes

The personal access token for Alibaba Cloud DevOps.

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

Request parameters

Parameter

Type

Location

Required

Description

Example

appName

string

path

Yes

The name of the application.

my-web-service

envName

string

path

Yes

The name of the environment.

dev

organizationId

string

path

  • Yes (for Centralized Edition)

  • No (for Region Edition)

The organization ID.

ec766e63aee3437d9a51f334d6exe671

Request examples

Centralized edition

curl -X 'PUT' \
  'https://{domain}/oapi/v1/appstack/organizations/ec766e63aee3437d9a51f334d6exe671/apps/my-web-service/envs/dev:lock' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Region edition

curl -X 'PUT' \
  'https://{domain}/oapi/v1/appstack/apps/my-web-service/envs/dev:lock' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Response parameters

Parameter

Type

Description

Example

-

object

The environment object.

appName

string

The unique name of the application.

my-web-service

creatorId

string

The ID of the user who created the environment.

bd9e3c6d-624f-4580-af7d-c5e26f1ed0f0

deployGroupName

string

The unique name of the deployment group.

k8s-dev

description

string

The description of the environment.

This is a development environment for demonstration purposes.

descriptiveName

string

The display name of the environment.

Test environment

gmtCreate

string

The time when the environment was created.

2024-09-01 00:00:00

labelList

array

The list of labels.

-

object

A label object.

displayName

string

The display name of the label. For descriptive purposes only; not used for label matching.

Test label key

displayValue

string

The display value of the label. For descriptive purposes only; not used for label matching.

Test label value

extraMap

object

A map of extended attributes for storing custom attribute fields.

{}

name

string

The name of the label. It can contain only lowercase letters, digits, and hyphens (-), and must start and end with a lowercase letter or a digit.

demo-label

namespace

string

The namespace of the label, which determines its scope.

default

value

string

The value of the label. It can contain only lowercase letters, digits, and hyphens (-), and must start and end with a lowercase letter or a digit.

demo-label-value

lockBy

string

The ID of the user who locked the environment.

bd9e3c6d-624f-4580-af7d-c5e26f1ed0f0

name

string

The unique name of the environment. It can contain only lowercase letters, digits, and hyphens (-), and must start and end with a lowercase letter or a digit.

dev

replicasManagement

string

The replica management mode.

USER

resourcePoolName

string

The unique name of the resource pool.

default

rolloutStrategies

array

The deployment strategies.

-

object

The deployment strategy.

batchMode

string

The batch mode. Possible values: ConfirmFirstBatch, Auto, and Manual.

ConfirmFirstBatch

batchSteps

array

The list of batch details.

-

object

The batch details.

type

string

The batch type. Possible values: WEIGHT and REPLICAS.

WEIGHT

value

string

The value for the batch step.

90

batches

string

The number of batches.

2

deployType

string

The deployment type. Possible values: Rolling, Batch, and Recreate.

Batch

locator

string

The locator for the deployment resource.

aaa.bbb.ccc

targetReplicas

number

The target number of replicas.

3

timeOutMS

number

The timeout period, in milliseconds.

60000

state

string

The state of the environment. Possible values: NEW, DEPLOYING, RUNNING, and ERROR.

RUNNING

variableGroupName

string

The unique name of the variable group.

dev

variableGroups

array

The variable groups.

-

object

A variable group object.

displayName

string

The display name of the variable group.

Development variable group

name

string

The identifier of the variable group.

dev

type

string

The type of the variable group.

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": "Test environment",
    "gmtCreate": "2024-09-01 00:00:00",
    "labelList": [
        {
            "displayName": "Test label key",
            "displayValue": "Test label 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": "RUNNING",
    "variableGroupName": "dev",
    "variableGroups": [
        {
            "displayName": "Development variable group",
            "name": "dev",
            "type": "GLOBAL"
        }
    ]
}

Error codes

For a list of API error codes, see the Error Code Center.