创建一个包年包月或按量付费的网关。
接口说明
调用该接口时,您需要注意:
-
请确保在使用该接口前,已充分了解云存储网关产品的收费方式和价格。
-
您已经注册阿里云账号,并完成实名认证。
-
您已经开通云存储网关服务。
-
您在需要创建云上网关的地域,已有可用的专有网络 VPC 和虚拟交换机 vSwitch。
-
您在需要创建云上网关的地域,已有可用的云服务器 ECS,并将此服务器归属到已创建的专有网络 VPC 下。
-
在创建网关前,确保您已创建网关集群,如果还未创建,可以通过 CreateStorageBundle 接口完成网关集群的创建。
-
如果您的网关付费类型为包年包月,完成网关创建后,您需要通过接口返回的购买链接进行网关购买,完成网关的创建。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
下表是API对应的授权信息,可以在RAM权限策略语句的Action
元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:
- 操作:是指具体的权限点。
- 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
- 资源类型:是指操作中支持授权的资源类型。具体说明如下:
- 对于必选的资源类型,用前面加 * 表示。
- 对于不支持资源级授权的操作,用
全部资源
表示。
- 条件关键字:是指云产品自身定义的条件关键字。
- 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作 | 访问级别 | 资源类型 | 条件关键字 | 关联操作 |
---|---|---|---|---|
hcs-sgw:CreateGateway | create | *全部资源 * |
| 无 |
请求参数
名称 | 类型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
StorageBundleId | string | 否 | 网关集群 ID,如果不指定 ResourceRegionId,则必须指定该参数。 | sb-0001b2otnkdxrigeq*** |
Name | string | 是 | 网关名称。长度为 60 个字符且以大小写字母或者中文开头,可以包含大小写字母,中文、数字、下划线(_)、短划线(-)和半角句号(.)。 | alex*** |
Description | string | 否 | 网关描述。长度限制 0~255 个字符。 | 测试使用 |
Category | string | 是 | 网关类别。默认值为 | Aliyun |
Type | string | 是 | 网关类型。取值范围:
| File |
Location | string | 是 | 网关位置。取值范围:
| Cloud |
GatewayClass | string | 否 | 网关规格。该参数涉及费用,详情请参见计量项和计费项。 如果您的网关位置在本地数据中心,即线下网关,您可以忽略这个参数。 如果您的网关位置在阿里云,即线上网关,则取值范围:
| Basic |
VSwitchId | string | 否 | 虚拟交换机的 ID。如果您的网关位置在本地数据中心,可以忽略这个参数。
| vsw-bp1krhkglx3nahkb9s*** |
PostPaid | boolean | 否 | true | |
ReleaseAfterExpiration | boolean | 否 | 预付费情况下,是否到期释放。可能值如下: true:到期自动释放,直接收回。 false:预付费到期后自动转为按量付费模式。 | true |
PublicNetworkBandwidth | integer | 否 | 数据公网带宽。单位为 Mbps。取值范围为 5~200。该参数涉及费用,详情请参见计量项和计费项。 说明
| 5 |
ResourceRegionId | string | 否 | 资源地域 ID。 | cn-hangzhou |
UntrustedEnvInstanceType | string | 否 | 非授信(云盒)场景下网关的实际规格。 | ecs.g6.large |
UntrustedEnvId | string | 否 | 非授信(云盒)实例 ID。 | cb-2vcdsa32432*** |
SecondaryVSwitchId | string | 否 | 高可用网关备节点虚拟交换机 ID。 | vsw-bp1krhkglx3nahcx9s*** |
返回参数
示例
正常返回示例
JSON
格式
{
"BuyURL": "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}®ionId=cn-hangzhou#/buy",
"RequestId": "8E69E1A1-9076-4C8C-8ADF-ACD253886E22",
"Message": "successful",
"GatewayId": "gw-0001xv7je357zm9u6***",
"Code": 200,
"Success": true
}
错误码
HTTP status code | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | EmptyGatewayName | You must enter a valid name for the gateway. | 网关名称不能为空。 |
400 | InvalidGatewayName | The specified name of the gateway is invalid. The name must be 1 to 60 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter. | 无效的网关名称,网关名称长度限制1~60个字符,可以包含大小写字母,中文,数字,“.”,“_”或“-”,同时必须以大小写字母或者中文开头。 |
400 | DescriptionOverLimit | The length of the specified gateway description exceeds the maximum limit. The description cannot exceed 255 characters. | 网关描述超过最大长度,最大限度为255个字符。 |
400 | EmptyStorageBundleId | You must enter a valid ID for the gateway cluster. | 网关集群ID不能为空。 |
400 | InvalidGatewayClass | The specified specification of the gateway is invalid. | 无效的网关规格。 |
400 | InvalidGatewayType | The specified type of the gateway is invalid. | 无效的网关类型。 |
400 | InvalidVSwitchId | The specified VSwitch ID does not exist. | 指定的虚拟交换机ID不存在。 |
400 | NoAvailableOnlineResource | There are no cloud gateways available. We recommend that you select a different specification or VSwitch that resides in another zone. | 当前没有可用的线上网关资源,请选择其他规格或者其他可用区虚拟交换机。 |
400 | DuplicateGatewayName | The specified name of the gateway already exists. You must specify a valid name. | 存在同名的网关,请选用其它名称。 |
400 | InvalidGatewayBandwidth | The specified public network bandwidth for the gateway is invalid. The bandwidth ranges from 6 to 200 Mbit/s. | 网关数据公网带宽不合法, 取值为6 - 200, 单位Mbps。 |
400 | GatewayBandwidthNotSupported | You cannot decrease the public network bandwidth of a On Premise Gateway. | 线下网关不支持设置数据公网带宽。 |
400 | InvalidGatewayLocation | The specified location of the gateway is invalid. | 无效的网关位置。 |
400 | ServiceReleased | Service is released, please open service again. | 服务已释放,请重新开通。 |
404 | StorageBundleNotExist | The name you specified for the gateway cluster does not exist. You must specify a valid parameter. | 网关集群不存在,请确认输入参数是否正确。 |
访问错误中心查看更多错误码。
变更历史
变更时间 | 变更内容概要 | 操作 |
---|---|---|
2024-09-25 | OpenAPI 错误码发生变更 | 查看变更详情 |
2024-03-14 | OpenAPI 错误码发生变更、OpenAPI 入参发生变更 | 查看变更详情 |