调用CreateGatewayCacheDisk可以在网关下创建一个缓存盘。

使用该接口时,需要注意如下事项:

  • 仅对线上网关有效
  • 如果网关是预付费,该接口会返回一个buyURL, 需要完成支付后,缓存盘会被自动创建完成。
  • 如果网关是后付费,该接口会返回对应创建缓存盘的任务ID。

调试

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

请求参数

名称 类型 是否必选 示例值 描述
Action String CreateGatewayCacheDisk

系统规定参数。取值:CreateGatewayCacheDisk。

CacheDiskSizeInGB Long 60

缓存盘的容量大小。单位:GB。缓存盘容量要求:

  • 基础型网关缓存盘上限为1TB(即1024GB),标准型网关缓存盘上限为2TB(即2048GB),其他网关缓存盘上限为32TB(即32768GB)。
  • 文件网关缓存盘容量下限40GB,块网关缓存盘容量下限20GB。
GatewayId String gw-000eg44nmxbsfwbvq***

网关ID。

CacheDiskCategory String cloud_efficiency

缓存盘的类型。取值范围:

  • cloud_efficiency:高效云盘。
  • cloud_ssd:SSD。

默认值:cloud_efficiency。

返回数据

名称 类型 示例值 描述
BuyURL String https://common-buy.aliyun.com/?commodityCode=hcs_sgw_csg_pre&request={"gateway_id":"gw-0007va9bnidei3s8a***","directBuy":"false","gateway_class":"standard","cache_cloud_efficiency_size":0}&regionId=cn-hangzhou#/buy

预付费情况下, 售卖链接。

Code String 200

状态码。状态码为200表示请求成功。

Message String successful

请求结果描述。

RequestId String 8E69E1A1-9076-4C8C-8ADF-ACD253886E22

请求ID。

Success Boolean true

请求是否成功。

TaskId String t-0001xv7je357xv4st***

按量付费情况下,创建缓存盘的任务ID。

示例

请求示例

http(s)://[Endpoint]/?Action=CreateGatewayCacheDisk
&CacheDiskSizeInGB=60
&GatewayId=gw-000eg44nmxbsfwbvq***
&<公共请求参数>

正常返回示例

XML 格式

<CreateGatewayCacheDiskResponse>
      <Message>successful</Message>
      <RequestId>8E69E1A1-9076-4C8C-8ADF-ACD253886E22</RequestId>
      <TaskId>t-0001xv7je357xv4st***</TaskId>
      <BuyURL>https://common-buy.aliyun.com/?commodityCode=hcs_sgw_csg_pre&amp;request=%7B%22gateway_id%22:%22gw-0007va9bnidei3s8a09e%22,%22directBuy%22:%22false%22,%22gateway_class%22:%22standard%22,%22cache_cloud_efficiency_size%22:0%7D®ionId=cn-hangzhou#/buy</BuyURL>
      <Code>200</Code>
      <Success>true</Success>
</CreateGatewayCacheDiskResponse>

JSON 格式

{
    "Message":"successful",
    "RequestId":"8E69E1A1-9076-4C8C-8ADF-ACD253886E22",
    "TaskId":"t-0001xv7je357xv4st***",
    "BuyURL":"https://common-buy.aliyun.com/?commodityCode=hcs_sgw_csg_pre&request=%7B%22gateway_id%22:%22gw-0007va9bnidei3s8a09e%22,%22directBuy%22:%22false%22,%22gateway_class%22:%22standard%22,%22cache_cloud_efficiency_size%22:0%7D®ionId=cn-hangzhou#/buy",
    "Code":"200",
    "Success":true
}

错误码

HttpCode 错误码 错误信息 描述
400 LocationCloudRequired You must specify a cloud gateway. Try again later. 需要网关为线上网关,请检查后重试。
400 CacheSizeLimitForBasic The specified scale-up size exceeds the maximum limit. The maximum scale-up size of cache disks for a Basic gateway is 1 TB. 扩容量超过最大缓存盘上限,基础型网关缓存盘上限为1TB。
400 BadRequest Invalid request. You must specify valid parameters in the request.  非法请求,请检查请求参数。
400 CacheSizeLimitForStandard The specified scale-up size exceeds the maximum limit. The maximum scale-up size of cache disks for a Standard gateway is 2 TB. 扩容量超过最大缓存盘上限,标准型网关缓存盘上限为2TB。
400 CacheSizeLimit The maximum size of cache disks for the gateway is 32 TB. The maximum scale-up size is 6 TB. 网关缓存盘大小上限32TB ,扩容上限6TB。
400 GatewayOperationNotAllowed You cannot perform the operation when the gateway is in the current state. 网关当前状态不允许执行该操作。
400 InvalidCacheDiskCategory The category that you specified for the cache disk is invalid. You must specify a valid category. 无效的缓存盘类型。

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