调用RollbackApplication接口回退应用历史版本。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求头

该接口使用公共请求头,无特殊请求头。更多信息,请参见公共请求和返回头

请求语法

PUT /pop/v1/sam/app/rollbackApplication HTTP/1.1

请求参数

名称 类型 位置 是否必选 示例值 描述
AppId String Query 017f39b8-dfa4-4e16-a84b-1dcee4b1****

应用ID。

VersionId String Query 0026ff7f-2b57-4127-bdd0-9bf202bb9****

版本ID,需要调用ListAppVersions接口查看。

BatchWaitTime Integer Query 10

分批等待时间,单位为秒。

MinReadyInstances Integer Query 1

最小存活实例数。取值说明如下:

  • 如果设置为0,应用在升级过程中将会中断业务。
  • 如果设置为-1,最小存活实例数将使用系统推荐值,即取现有实例数的25%。如果当前为5个实例,5×25%=1.25,向上取整后,最小存活实例数为2。
说明 每次滚动部署最小存活的实例数建议≥1,保证业务不中断。
MinReadyInstanceRatio Integer Query -1

最小存活实例数百分比。取值说明如下:

  • -1:初始化值,表示不采用百分比。
  • 0~100:单位为百分比,向上取整。例如设置为50%,如果当前为5个实例,则最小存活实例数为3。
说明MinReadyInstanceMinReadyInstanceRatio同时传递时,且MinReadyInstanceRatio的取值非-1时,以MinReadyInstanceRatio参数为准。假设MinReadyInstances取值为5MinReadyInstanceRatio取值为50,则会用50来计算最小存活实例数。
UpdateStrategy String Query {"type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":1},"grayUpdate":{"gray":1}}

部署策略。当最小存活实例数等于1时,UpdateStrategy字段的值为""。当最小存活实例数大于1时,示例如下:

  • 灰度1台+后续分2批+自动分批+分批间隔1分钟。{"type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":1},"grayUpdate":{"gray":1}}
  • 灰度1台+后续分2批+手动分批。{"type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"manual"},"grayUpdate":{"gray":1}}
  • 分2批+自动分批+分批间隔0分钟。{"type":"BatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":0}}

参数说明如下:

  • type:发布策略类型,可选灰度发布GrayBatchUpdate或分批发布BatchUpdate
  • batchUpdate:分批发布策略。
    • batch:发布批次。
    • releaseType:分批间处理方式,可选自动auto或手动manual
    • batchWaitTime:批次内部署间隔时间,单位为秒。
  • grayUpdate:灰度后剩余批次,当typeGrayBatchUpdate时必填。
AutoEnableApplicationScalingRule String Query true

是否自动启用应用弹性伸缩策略。取值说明如下:

  • true:开启。
  • false:关闭。

返回数据

名称 类型 示例值 描述
RequestId String 91F93257-7A4A-4BD3-9A7E-2F6EAE6D****

请求ID。

Message String success

调用结果的附加信息。

TraceId String 0a98a02315955564772843261e****

调用链ID,用于精确查询调用信息。

Data Object

返回结果。

ChangeOrderId String 01db03d3-3ee9-48b3-b3d0-dfce2d88****

变更流程ID。

IsNeedApproval Boolean true

RAM用户发布变更是否需要审批。取值说明如下:

  • true:需审批。
  • false:无需审批。
ErrorCode String

错误码。取值说明如下:

  • 请求成功:不返回ErrorCode字段。
  • 请求失败:返回ErrorCode字段。具体信息,请参见本文的错误码列表。
Code String 200

接口状态或POP错误码。取值说明如下:

  • 2xx:成功。
  • 3xx:重定向。
  • 4xx:请求错误。
  • 5xx:服务器错误。
Success Boolean true

回退历史版本是否成功。取值说明如下:

  • true:回退成功。
  • false:回退失败。

示例

请求示例

PUT /pop/v1/sam/app/rollbackApplication?AppId=017f39b8-dfa4-4e16-a84b-1dcee4b1****&VersionId=0026ff7f-2b57-4127-bdd0-9bf202bb9****&BatchWaitTime=10&MinReadyInstances=1&MinReadyInstanceRatio=-1&UpdateStrategy={"type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":1},"grayUpdate":{"gray":1}}&AutoEnableApplicationScalingRule=true HTTP/1.1
Host:sae.aliyuncs.com
Content-Type:application/json

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<RollbackApplicationResponse>
    <RequestId>91F93257-7A4A-4BD3-9A7E-2F6EAE6D****</RequestId>
    <Message>success</Message>
    <TraceId>0a98a02315955564772843261e****</TraceId>
    <Data>
        <ChangeOrderId>01db03d3-3ee9-48b3-b3d0-dfce2d88****</ChangeOrderId>
        <IsNeedApproval>true</IsNeedApproval>
    </Data>
    <Code>200</Code>
    <Success>true</Success>
</RollbackApplicationResponse>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "91F93257-7A4A-4BD3-9A7E-2F6EAE6D****",
  "Message" : "success",
  "TraceId" : "0a98a02315955564772843261e****",
  "Data" : {
    "ChangeOrderId" : "01db03d3-3ee9-48b3-b3d0-dfce2d88****",
    "IsNeedApproval" : true
  },
  "Code" : "200",
  "Success" : true
}

错误码

HttpCode 错误码 错误信息 描述
400 InvalidApplication.NotFound The current application does not exist. 找不到当前应用。
400 InvalidParameter.NotEmpty You must specify the parameter %s. 不合法的参数:%s不能为空。
400 InvalidParameter.Obviously The specified parameter is invalid {%s}. 不合法的参数{%s}。
400 InvalidParameter.WithMessage The parameter is invalid {%s}: %s 不合法的参数{%s}:%s。
400 user.indebt The user has an outstanding payment. 当前用户处于欠费状态。
400 NoComputeResourceQuota.App.Exceed You can create %s instances for each application. Please submit a ticket to raise the quota. 每个应用只允许创建%s个实例,请加入钉群32874633联系技术产品专家进行咨询。
400 NoComputeResourceQuota.User.Exceed Your account is limited to create %s instances. Please submit a ticket to raise the quota. 您的账户限额%s个实例,请加入钉群32874633联系技术产品专家进行咨询。
400 System.Upgrading The system is being upgraded. Please try again later. 系统正在升级,请稍后操作。
400 Application.ChangerOrderRunning An application change process is in progress. Please try again later. 应用有变更流程正在执行,请稍后重试。
400 Application.InvalidStatus The application status is abnormal. Please try again later. 应用状态异常,请稍后重试。
400 Application.NotDeployYet The application has not been deployed. Please deploy it and try again. 应用没有部署,请部署后重试。
400 rollback.error Failed to roll back. 回滚异常。
400 Application.MissingJdk Your application must at least contain a JDK component. 应用必须至少包含JDK组件。
400 JarApplication.MissingJdk A FatJar application must contain JDK. FatJar类型应用必须包含JDK。
400 PandoraApplication.MissingJdk The Pandora application is missing a JDK component. Pandora应用缺少JDK组件。
400 WarApplication.MissingJdkWebcontainer A War application must contain JDK and Tomcat. WAR类型应用必须包含JDK和Tomcat。
400 InvalidComponent.NotFound The current component (such as JDK, Tomcat, or EDASWebContainer) does not exist. 找不到当前组件(JDK、Tomcat、EDASWebContainer等)。
400 InvalidHostnameIp.Invalid The hostname and/or IP is invalid: Hostname [%s], IP [%s]. 主机名或IP不合法:主机名[%s],IP[%s]。
400 InvalidInstanceSpecification.Unsupported The instance specification is not supported: CPU [%s], memory [%s]. 不支持的实例规格。CPU[%s],Memory[%s]。
400 InvalidPackageType.NotFound The package type must be War, FatJar, or Image. 包类型必须为WAR、FatJAR或Image。
400 LogService.ConfigQuotaExceed The maximum number of Log Service configs is exceeded. 日志服务配置个数超过配额限制,请加入钉群32874633联系技术产品专家进行咨询。
400 LogService.InternalError An exception occurred while calling Log Service. Please submit a ticket to solve the problem. 调用日志服务异常,请加入钉群32874633联系技术产品专家进行咨询。
400 LogService.LogDirInvalid The log collection path is invalid. 日志采集路径不合法。
400 LogService.NotAvailable Log Service is unavailable. Please activate Log Service first. 日志服务不可用,请先开通日志服务。
400 LogService.ProjectNumQuotaExceed The maximum number of Log Service projects is exceeded. 日志服务项目个数超过配额限制,请加入钉群32874633联系技术产品专家进行咨询。
400 VolumnPath.Conflict Conflict between log collection directory and persistent storage directory. 日志采集目录与持久化存储目录冲突。
400 MountConflict.ConfigMap Conflict detected for ConfigMap path %s. ConfigMap挂载路径%s存在冲突。
400 NotFound.ConfigMap The ConfigMap object (ID: %s) does not exist. 找不到ConfigMap对象(ID=%s)。
400 NotFound.ConfigMapKey The key %s of ConfigMap object (ID: %s) does not exist. 找不到ConfigMap对象(ID=%s)的Key %s。
400 MinReadyInstances.Not.Smaller.Replicas The minimum number of available instances must be less than the number of application instances. 最小可用实例数必须小于应用实例数。
400 MinReadyInstanceRatio.Invalid The ratio of minimum available instances must be between 0 and 100. 最小存活实例数比例值必须在0~100之间。
400 Package.Version.Too.Long The maximum length of package version is exceeded. 应用部署包版本号长度超过限制。
400 App.Package.Version.Exists The package version of application already exists. 应用部署包版本号已经存在。
400 Slb.Occupied The SLB instance is occupied. SLB实例被占用。
400 Slb.Tag.Not.Qualified The current SLB instance cannot be reused because it may have been occupied by %s. SLB实例正在被%s使用,不建议复用。
400 InvalidParameter.FileName The application deployment package name is invalid. This name can contain only alphanumeric characters, hyphens (-), and underscores (_). For deploying java package, you can upload JAR files only if the selected deployment version supports JAR file. Otherwise, upload WAR files only. For deploying php package, you can upload ZIP files only if the selected deployment version supports ZIP file. 应用部署程序包名称无效。名称只能包含字母、数字和特殊字符“-”“_”。Java 软件包部署,仅当选择的部署版本支持JAR部署时方可上传JAR包,否则只能上传WAR包;PHP 软件包部署,仅当选择的部署版本支持ZIP部署时方可上传ZIP包
400 vswitch.not.exist The specified vSwitch does not exist. vSwitch不存在,请更换vSwitch。
404 InvalidNamespaceId.NotFound The specified NamespaceId does not exist. 指定的NamespaceId不存在。

访问错误中心查看更多错误码。